mikemirzayanov hace 7 meses
padre
commit
8d92a1dad9
Se han modificado 90 ficheros con 312 adiciones y 7 borrados
  1. 17 7
      testlib.h
  2. 3 0
      tests/test-007_validators/files/unix/input.01
  3. 7 0
      tests/test-007_validators/files/unix/input.02
  4. 7 0
      tests/test-007_validators/files/unix/input.03
  5. 5 0
      tests/test-007_validators/files/unix/input.04
  6. 9 0
      tests/test-007_validators/files/unix/input.05
  7. 5 0
      tests/test-007_validators/files/unix/input.06
  8. 3 0
      tests/test-007_validators/files/win/input.01
  9. 7 0
      tests/test-007_validators/files/win/input.02
  10. 7 0
      tests/test-007_validators/files/win/input.03
  11. 5 0
      tests/test-007_validators/files/win/input.04
  12. 9 0
      tests/test-007_validators/files/win/input.05
  13. 5 0
      tests/test-007_validators/files/win/input.06
  14. 1 0
      tests/test-007_validators/refs/v1-01/exit_code
  15. 3 0
      tests/test-007_validators/refs/v1-01/stderr
  16. 0 0
      tests/test-007_validators/refs/v1-01/stdout
  17. 1 0
      tests/test-007_validators/refs/v1-02/exit_code
  18. 3 0
      tests/test-007_validators/refs/v1-02/stderr
  19. 0 0
      tests/test-007_validators/refs/v1-02/stdout
  20. 1 0
      tests/test-007_validators/refs/v1-03/exit_code
  21. 1 0
      tests/test-007_validators/refs/v1-03/stderr
  22. 0 0
      tests/test-007_validators/refs/v1-03/stdout
  23. 1 0
      tests/test-007_validators/refs/v1-04/exit_code
  24. 3 0
      tests/test-007_validators/refs/v1-04/stderr
  25. 0 0
      tests/test-007_validators/refs/v1-04/stdout
  26. 1 0
      tests/test-007_validators/refs/v1-05/exit_code
  27. 1 0
      tests/test-007_validators/refs/v1-05/stderr
  28. 0 0
      tests/test-007_validators/refs/v1-05/stdout
  29. 1 0
      tests/test-007_validators/refs/v1-06/exit_code
  30. 3 0
      tests/test-007_validators/refs/v1-06/stderr
  31. 0 0
      tests/test-007_validators/refs/v1-06/stdout
  32. 1 0
      tests/test-007_validators/refs/v2-01/exit_code
  33. 3 0
      tests/test-007_validators/refs/v2-01/stderr
  34. 0 0
      tests/test-007_validators/refs/v2-01/stdout
  35. 1 0
      tests/test-007_validators/refs/v2-02/exit_code
  36. 3 0
      tests/test-007_validators/refs/v2-02/stderr
  37. 0 0
      tests/test-007_validators/refs/v2-02/stdout
  38. 1 0
      tests/test-007_validators/refs/v2-03/exit_code
  39. 1 0
      tests/test-007_validators/refs/v2-03/stderr
  40. 0 0
      tests/test-007_validators/refs/v2-03/stdout
  41. 1 0
      tests/test-007_validators/refs/v2-04/exit_code
  42. 3 0
      tests/test-007_validators/refs/v2-04/stderr
  43. 0 0
      tests/test-007_validators/refs/v2-04/stdout
  44. 1 0
      tests/test-007_validators/refs/v2-05/exit_code
  45. 1 0
      tests/test-007_validators/refs/v2-05/stderr
  46. 0 0
      tests/test-007_validators/refs/v2-05/stdout
  47. 1 0
      tests/test-007_validators/refs/v2-06/exit_code
  48. 3 0
      tests/test-007_validators/refs/v2-06/stderr
  49. 0 0
      tests/test-007_validators/refs/v2-06/stdout
  50. 1 0
      tests/test-007_validators/refs/v3-01/exit_code
  51. 5 0
      tests/test-007_validators/refs/v3-01/stderr
  52. 0 0
      tests/test-007_validators/refs/v3-01/stdout
  53. 1 0
      tests/test-007_validators/refs/v3-02/exit_code
  54. 5 0
      tests/test-007_validators/refs/v3-02/stderr
  55. 0 0
      tests/test-007_validators/refs/v3-02/stdout
  56. 1 0
      tests/test-007_validators/refs/v3-03/exit_code
  57. 1 0
      tests/test-007_validators/refs/v3-03/stderr
  58. 0 0
      tests/test-007_validators/refs/v3-03/stdout
  59. 1 0
      tests/test-007_validators/refs/v3-04/exit_code
  60. 5 0
      tests/test-007_validators/refs/v3-04/stderr
  61. 0 0
      tests/test-007_validators/refs/v3-04/stdout
  62. 1 0
      tests/test-007_validators/refs/v3-05/exit_code
  63. 1 0
      tests/test-007_validators/refs/v3-05/stderr
  64. 0 0
      tests/test-007_validators/refs/v3-05/stdout
  65. 1 0
      tests/test-007_validators/refs/v3-06/exit_code
  66. 5 0
      tests/test-007_validators/refs/v3-06/stderr
  67. 0 0
      tests/test-007_validators/refs/v3-06/stdout
  68. 1 0
      tests/test-007_validators/refs/v4-01/exit_code
  69. 5 0
      tests/test-007_validators/refs/v4-01/stderr
  70. 0 0
      tests/test-007_validators/refs/v4-01/stdout
  71. 1 0
      tests/test-007_validators/refs/v4-02/exit_code
  72. 5 0
      tests/test-007_validators/refs/v4-02/stderr
  73. 0 0
      tests/test-007_validators/refs/v4-02/stdout
  74. 1 0
      tests/test-007_validators/refs/v4-03/exit_code
  75. 1 0
      tests/test-007_validators/refs/v4-03/stderr
  76. 0 0
      tests/test-007_validators/refs/v4-03/stdout
  77. 1 0
      tests/test-007_validators/refs/v4-04/exit_code
  78. 5 0
      tests/test-007_validators/refs/v4-04/stderr
  79. 0 0
      tests/test-007_validators/refs/v4-04/stdout
  80. 1 0
      tests/test-007_validators/refs/v4-05/exit_code
  81. 1 0
      tests/test-007_validators/refs/v4-05/stderr
  82. 0 0
      tests/test-007_validators/refs/v4-05/stdout
  83. 1 0
      tests/test-007_validators/refs/v4-06/exit_code
  84. 5 0
      tests/test-007_validators/refs/v4-06/stderr
  85. 0 0
      tests/test-007_validators/refs/v4-06/stdout
  86. 19 0
      tests/test-007_validators/run.sh
  87. 27 0
      tests/test-007_validators/src/v1.cpp
  88. 27 0
      tests/test-007_validators/src/v2.cpp
  89. 27 0
      tests/test-007_validators/src/v3.cpp
  90. 27 0
      tests/test-007_validators/src/v4.cpp

+ 17 - 7
testlib.h

@@ -2515,13 +2515,23 @@ public:
         if (!_testOverviewLogFileName.empty()) {
             std::string fileName(_testOverviewLogFileName);
             _testOverviewLogFileName = "";
-            FILE *testOverviewLogFile = fopen(fileName.c_str(), "w");
-            if (NULL == testOverviewLogFile)
-                __testlib_fail("Validator::writeTestOverviewLog: can't write test overview log to (" + fileName + ")");
-            fprintf(testOverviewLogFile, "%s%s", getBoundsHitLog().c_str(), getFeaturesLog().c_str());
-            if (fclose(testOverviewLogFile))
-                __testlib_fail(
-                        "Validator::writeTestOverviewLog: can't close test overview log file (" + fileName + ")");
+
+            FILE* f;
+            bool standard_file = false;
+            if (fileName == "stdout")
+                f = stdout, standard_file = true;
+            else if (fileName == "stderr")
+                f = stderr, standard_file = true;
+            else {
+                f = fopen(fileName.c_str(), "wb");
+                if (NULL == f)
+                    __testlib_fail("Validator::writeTestOverviewLog: can't write test overview log to (" + fileName + ")");
+            }
+            fprintf(f, "%s%s", getBoundsHitLog().c_str(), getFeaturesLog().c_str());
+            std::fflush(f);
+            if (!standard_file)
+                if (std::fclose(f))
+                    __testlib_fail("Validator::writeTestOverviewLog: can't close test overview log file (" + fileName + ")");
         }
     }
 

+ 3 - 0
tests/test-007_validators/files/unix/input.01

@@ -0,0 +1,3 @@
+1
+2 0 0
+1 2

+ 7 - 0
tests/test-007_validators/files/unix/input.02

@@ -0,0 +1,7 @@
+3
+1 0 0
+1
+2 0 0
+2 1
+4 0 0
+1 2 3 4

+ 7 - 0
tests/test-007_validators/files/unix/input.03

@@ -0,0 +1,7 @@
+3
+1 0 0
+1
+2 0 0
+2 1
+4 0 0
+1 2 2 4

+ 5 - 0
tests/test-007_validators/files/unix/input.04

@@ -0,0 +1,5 @@
+2
+2 0 0
+1 2
+3 0 0
+1 3 2

+ 9 - 0
tests/test-007_validators/files/unix/input.05

@@ -0,0 +1,9 @@
+4
+2 0 0
+1 2
+3 0 0
+1 3 2
+2 0 0
+1 2
+3 0 0
+1 3 2

+ 5 - 0
tests/test-007_validators/files/unix/input.06

@@ -0,0 +1,5 @@
+2
+4 -2 -5
+1 2 3 4
+4 2 5
+1 2 3 4

+ 3 - 0
tests/test-007_validators/files/win/input.01

@@ -0,0 +1,3 @@
+1
+2 0 0
+1 2

+ 7 - 0
tests/test-007_validators/files/win/input.02

@@ -0,0 +1,7 @@
+3
+1 0 0
+1
+2 0 0
+2 1
+4 0 0
+1 2 3 4

+ 7 - 0
tests/test-007_validators/files/win/input.03

@@ -0,0 +1,7 @@
+3
+1 0 0
+1
+2 0 0
+2 1
+4 0 0
+1 2 2 4

+ 5 - 0
tests/test-007_validators/files/win/input.04

@@ -0,0 +1,5 @@
+2
+2 0 0
+1 2
+3 0 0
+1 3 2

+ 9 - 0
tests/test-007_validators/files/win/input.05

@@ -0,0 +1,9 @@
+4
+2 0 0
+1 2
+3 0 0
+1 3 2
+2 0 0
+1 2
+3 0 0
+1 3 2

+ 5 - 0
tests/test-007_validators/files/win/input.06

@@ -0,0 +1,5 @@
+2
+4 -2 -5
+1 2 3 4
+4 2 5
+1 2 3 4

+ 1 - 0
tests/test-007_validators/refs/v1-01/exit_code

@@ -0,0 +1 @@
+0

+ 3 - 0
tests/test-007_validators/refs/v1-01/stderr

@@ -0,0 +1,3 @@
+"a": min-value-hit max-value-hit
+"n":
+"t": min-value-hit

+ 0 - 0
tests/test-007_validators/refs/v1-01/stdout


+ 1 - 0
tests/test-007_validators/refs/v1-02/exit_code

@@ -0,0 +1 @@
+0

+ 3 - 0
tests/test-007_validators/refs/v1-02/stderr

@@ -0,0 +1,3 @@
+"a": min-value-hit max-value-hit
+"n": min-value-hit max-value-hit
+"t": max-value-hit

+ 0 - 0
tests/test-007_validators/refs/v1-02/stdout


+ 1 - 0
tests/test-007_validators/refs/v1-03/exit_code

@@ -0,0 +1 @@
+3

+ 1 - 0
tests/test-007_validators/refs/v1-03/stderr

@@ -0,0 +1 @@
+FAIL not a permutation (duplicates) (test case 4)

+ 0 - 0
tests/test-007_validators/refs/v1-03/stdout


+ 1 - 0
tests/test-007_validators/refs/v1-04/exit_code

@@ -0,0 +1 @@
+0

+ 3 - 0
tests/test-007_validators/refs/v1-04/stderr

@@ -0,0 +1,3 @@
+"a": min-value-hit max-value-hit
+"n":
+"t":

+ 0 - 0
tests/test-007_validators/refs/v1-04/stdout


+ 1 - 0
tests/test-007_validators/refs/v1-05/exit_code

@@ -0,0 +1 @@
+3

+ 1 - 0
tests/test-007_validators/refs/v1-05/stderr

@@ -0,0 +1 @@
+FAIL Integer parameter [name=t] equals to 4, violates the range [1, 3] (stdin, line 1)

+ 0 - 0
tests/test-007_validators/refs/v1-05/stdout


+ 1 - 0
tests/test-007_validators/refs/v1-06/exit_code

@@ -0,0 +1 @@
+0

+ 3 - 0
tests/test-007_validators/refs/v1-06/stderr

@@ -0,0 +1,3 @@
+"a": min-value-hit max-value-hit
+"n": max-value-hit
+"t":

+ 0 - 0
tests/test-007_validators/refs/v1-06/stdout


+ 1 - 0
tests/test-007_validators/refs/v2-01/exit_code

@@ -0,0 +1 @@
+0

+ 3 - 0
tests/test-007_validators/refs/v2-01/stderr

@@ -0,0 +1,3 @@
+"a": min-value-hit max-value-hit
+"n": max-value-hit
+"t": min-value-hit

+ 0 - 0
tests/test-007_validators/refs/v2-01/stdout


+ 1 - 0
tests/test-007_validators/refs/v2-02/exit_code

@@ -0,0 +1 @@
+0

+ 3 - 0
tests/test-007_validators/refs/v2-02/stderr

@@ -0,0 +1,3 @@
+"a": min-value-hit max-value-hit
+"n": min-value-hit max-value-hit
+"t": min-value-hit max-value-hit

+ 0 - 0
tests/test-007_validators/refs/v2-02/stdout


+ 1 - 0
tests/test-007_validators/refs/v2-03/exit_code

@@ -0,0 +1 @@
+3

+ 1 - 0
tests/test-007_validators/refs/v2-03/stderr

@@ -0,0 +1 @@
+FAIL not a permutation (duplicates) (test case 4)

+ 0 - 0
tests/test-007_validators/refs/v2-03/stdout


+ 1 - 0
tests/test-007_validators/refs/v2-04/exit_code

@@ -0,0 +1 @@
+0

+ 3 - 0
tests/test-007_validators/refs/v2-04/stderr

@@ -0,0 +1,3 @@
+"a": min-value-hit max-value-hit
+"n": max-value-hit
+"t": min-value-hit

+ 0 - 0
tests/test-007_validators/refs/v2-04/stdout


+ 1 - 0
tests/test-007_validators/refs/v2-05/exit_code

@@ -0,0 +1 @@
+3

+ 1 - 0
tests/test-007_validators/refs/v2-05/stderr

@@ -0,0 +1 @@
+FAIL Integer parameter [name=~t] equals to 4, violates the range [1, 3] (stdin, line 1)

+ 0 - 0
tests/test-007_validators/refs/v2-05/stdout


+ 1 - 0
tests/test-007_validators/refs/v2-06/exit_code

@@ -0,0 +1 @@
+0

+ 3 - 0
tests/test-007_validators/refs/v2-06/stderr

@@ -0,0 +1,3 @@
+"a": min-value-hit max-value-hit
+"n": max-value-hit
+"t": min-value-hit

+ 0 - 0
tests/test-007_validators/refs/v2-06/stdout


+ 1 - 0
tests/test-007_validators/refs/v3-01/exit_code

@@ -0,0 +1 @@
+0

+ 5 - 0
tests/test-007_validators/refs/v3-01/stderr

@@ -0,0 +1,5 @@
+"a": min-value-hit max-value-hit
+"l":
+"n": min-value-hit
+"r":
+"t": min-value-hit max-value-hit

+ 0 - 0
tests/test-007_validators/refs/v3-01/stdout


+ 1 - 0
tests/test-007_validators/refs/v3-02/exit_code

@@ -0,0 +1 @@
+0

+ 5 - 0
tests/test-007_validators/refs/v3-02/stderr

@@ -0,0 +1,5 @@
+"a": min-value-hit max-value-hit
+"l":
+"n": min-value-hit max-value-hit
+"r":
+"t": min-value-hit max-value-hit

+ 0 - 0
tests/test-007_validators/refs/v3-02/stdout


+ 1 - 0
tests/test-007_validators/refs/v3-03/exit_code

@@ -0,0 +1 @@
+3

+ 1 - 0
tests/test-007_validators/refs/v3-03/stderr

@@ -0,0 +1 @@
+FAIL not a permutation (duplicates) (test case 4)

+ 0 - 0
tests/test-007_validators/refs/v3-03/stdout


+ 1 - 0
tests/test-007_validators/refs/v3-04/exit_code

@@ -0,0 +1 @@
+0

+ 5 - 0
tests/test-007_validators/refs/v3-04/stderr

@@ -0,0 +1,5 @@
+"a": min-value-hit max-value-hit
+"l":
+"n": min-value-hit
+"r":
+"t": min-value-hit max-value-hit

+ 0 - 0
tests/test-007_validators/refs/v3-04/stdout


+ 1 - 0
tests/test-007_validators/refs/v3-05/exit_code

@@ -0,0 +1 @@
+3

+ 1 - 0
tests/test-007_validators/refs/v3-05/stderr

@@ -0,0 +1 @@
+FAIL Integer parameter [name=~t~] equals to 4, violates the range [1, 3] (stdin, line 1)

+ 0 - 0
tests/test-007_validators/refs/v3-05/stdout


+ 1 - 0
tests/test-007_validators/refs/v3-06/exit_code

@@ -0,0 +1 @@
+0

+ 5 - 0
tests/test-007_validators/refs/v3-06/stderr

@@ -0,0 +1,5 @@
+"a": min-value-hit max-value-hit
+"l": min-value-hit max-value-hit
+"n": min-value-hit max-value-hit
+"r": min-value-hit max-value-hit
+"t": min-value-hit max-value-hit

+ 0 - 0
tests/test-007_validators/refs/v3-06/stdout


+ 1 - 0
tests/test-007_validators/refs/v4-01/exit_code

@@ -0,0 +1 @@
+0

+ 5 - 0
tests/test-007_validators/refs/v4-01/stderr

@@ -0,0 +1,5 @@
+"a": min-value-hit max-value-hit
+"l": max-value-hit
+"n": min-value-hit
+"r": min-value-hit max-value-hit
+"t": min-value-hit max-value-hit

+ 0 - 0
tests/test-007_validators/refs/v4-01/stdout


+ 1 - 0
tests/test-007_validators/refs/v4-02/exit_code

@@ -0,0 +1 @@
+0

+ 5 - 0
tests/test-007_validators/refs/v4-02/stderr

@@ -0,0 +1,5 @@
+"a": min-value-hit max-value-hit
+"l": max-value-hit
+"n": min-value-hit max-value-hit
+"r": min-value-hit max-value-hit
+"t": min-value-hit max-value-hit

+ 0 - 0
tests/test-007_validators/refs/v4-02/stdout


+ 1 - 0
tests/test-007_validators/refs/v4-03/exit_code

@@ -0,0 +1 @@
+3

+ 1 - 0
tests/test-007_validators/refs/v4-03/stderr

@@ -0,0 +1 @@
+FAIL not a permutation (duplicates) (test case 4)

+ 0 - 0
tests/test-007_validators/refs/v4-03/stdout


+ 1 - 0
tests/test-007_validators/refs/v4-04/exit_code

@@ -0,0 +1 @@
+0

+ 5 - 0
tests/test-007_validators/refs/v4-04/stderr

@@ -0,0 +1,5 @@
+"a": min-value-hit max-value-hit
+"l": max-value-hit
+"n": min-value-hit
+"r": min-value-hit max-value-hit
+"t": min-value-hit max-value-hit

+ 0 - 0
tests/test-007_validators/refs/v4-04/stdout


+ 1 - 0
tests/test-007_validators/refs/v4-05/exit_code

@@ -0,0 +1 @@
+3

+ 1 - 0
tests/test-007_validators/refs/v4-05/stderr

@@ -0,0 +1 @@
+FAIL Integer parameter [name=~t~] equals to 4, violates the range [1, 3] (stdin, line 1)

+ 0 - 0
tests/test-007_validators/refs/v4-05/stdout


+ 1 - 0
tests/test-007_validators/refs/v4-06/exit_code

@@ -0,0 +1 @@
+0

+ 5 - 0
tests/test-007_validators/refs/v4-06/stderr

@@ -0,0 +1,5 @@
+"a": min-value-hit max-value-hit
+"l": min-value-hit max-value-hit
+"n": min-value-hit max-value-hit
+"r": min-value-hit max-value-hit
+"t": min-value-hit max-value-hit

+ 0 - 0
tests/test-007_validators/refs/v4-06/stdout


+ 19 - 0
tests/test-007_validators/run.sh

@@ -0,0 +1,19 @@
+#!/bin/bash
+set -eo pipefail
+
+os="unix"
+if [[ "$MACHINE" == "Windows" ]]; then
+  os="win"
+fi
+
+# Loop through the versions v1, v2, v3, and v4
+for version in v1 v2 v3 v4; do
+    bash ../scripts/compile src/"$version".cpp
+    
+    # Loop through the test numbers 01, 02, 03, and 04
+    for test_num in 01 02 03 04 05 06; do
+        bash ../scripts/test-ref "$version"-"$test_num" "$VALGRIND" ./"$version" --testOverviewLogFileName stderr < files/"$os"/input."$test_num"
+    done
+    
+    rm -f "$version" "$version".exe
+done

+ 27 - 0
tests/test-007_validators/src/v1.cpp

@@ -0,0 +1,27 @@
+#include "testlib.h"
+
+using namespace std;
+
+int main(int argc, char *argv[]) {
+    registerValidation(argc, argv);
+
+    int t = inf.readInt(1, 3, "t");
+    inf.readEoln();
+
+    for (int tt = 1; tt <= t; tt++) {
+        setTestCase(tt + 1);
+        
+        int n = inf.readInt(1, 4, "n");
+        inf.readSpace();
+        inf.readInt(-2, 2, "l0");
+        inf.readSpace();
+        inf.readInt(-5, 5, "r[1]");
+        inf.readEoln();
+
+        vector<int> a = inf.readInts(n, 1, n, "a");
+        ensuref(int(set<int>(a.begin(), a.end()).size()) == n, "not a permutation (duplicates)");
+        inf.readEoln();
+    }
+
+    inf.readEof();
+}

+ 27 - 0
tests/test-007_validators/src/v2.cpp

@@ -0,0 +1,27 @@
+#include "testlib.h"
+
+using namespace std;
+
+int main(int argc, char *argv[]) {
+    registerValidation(argc, argv);
+
+    int t = inf.readInt(1, 3, "~t");
+    inf.readEoln();
+
+    for (int tt = 1; tt <= t; tt++) {
+        setTestCase(tt + 1);
+        
+        int n = inf.readInt(1, 4, "n~");
+        inf.readSpace();
+        inf.readInt(-2, 2, "l0l");
+        inf.readSpace();
+        inf.readInt(-5, 5, "r1d");
+        inf.readEoln();
+
+        vector<int> a = inf.readInts(n, 1, n, "a");
+        ensuref(int(set<int>(a.begin(), a.end()).size()) == n, "not a permutation (duplicates)");
+        inf.readEoln();
+    }
+
+    inf.readEof();
+}

+ 27 - 0
tests/test-007_validators/src/v3.cpp

@@ -0,0 +1,27 @@
+#include "testlib.h"
+
+using namespace std;
+
+int main(int argc, char *argv[]) {
+    registerValidation(argc, argv);
+
+    int t = inf.readInt(1, 3, "~t~");
+    inf.readEoln();
+
+    for (int tt = 1; tt <= t; tt++) {
+        setTestCase(tt + 1);
+        
+        int n = inf.readInt(1, 4, "~n");
+        inf.readSpace();
+        inf.readInt(-2, 2, "l");
+        inf.readSpace();
+        inf.readInt(-5, 5, "r");
+        inf.readEoln();
+
+        vector<int> a = inf.readInts(n, 1, n, "~a");
+        ensuref(int(set<int>(a.begin(), a.end()).size()) == n, "not a permutation (duplicates)");
+        inf.readEoln();
+    }
+
+    inf.readEof();
+}

+ 27 - 0
tests/test-007_validators/src/v4.cpp

@@ -0,0 +1,27 @@
+#include "testlib.h"
+
+using namespace std;
+
+int main(int argc, char *argv[]) {
+    registerValidation(argc, argv);
+
+    int t = inf.readInt(1, 3, "~t~");
+    inf.readEoln();
+
+    for (int tt = 1; tt <= t; tt++) {
+        setTestCase(tt + 1);
+        
+        int n = inf.readInt(1, 4, "~n");
+        inf.readSpace();
+        inf.readInt(-2, 2, "l~");
+        inf.readSpace();
+        inf.readInt(-5, 5, "~r~");
+        inf.readEoln();
+
+        vector<int> a = inf.readInts(n, 1, n, "~a~");
+        ensuref(int(set<int>(a.begin(), a.end()).size()) == n, "not a permutation (duplicates)");
+        inf.readEoln();
+    }
+
+    inf.readEof();
+}