فهرست منبع

Update unittest to avoid saving problems data

Marcelo Fornet 6 سال پیش
والد
کامیت
7dce5c4572
49فایلهای تغییر یافته به همراه175 افزوده شده و 14 حذف شده
  1. 0 1
      src/extension.ts
  2. BIN
      src/test/arena/exampleContest/A/attic/sol
  3. 11 0
      src/test/arena/exampleContest/A/sol.cpp
  4. 1 0
      src/test/arena/exampleContest/A/testcases/0.cur
  5. 1 0
      src/test/arena/exampleContest/A/testcases/0.in
  6. 1 0
      src/test/arena/exampleContest/A/testcases/0.out
  7. 1 0
      src/test/arena/exampleContest/A/testcases/1.cur
  8. 1 0
      src/test/arena/exampleContest/A/testcases/1.in
  9. 1 0
      src/test/arena/exampleContest/A/testcases/1.out
  10. 1 0
      src/test/arena/exampleContest/A/testcases/2.cur
  11. 1 0
      src/test/arena/exampleContest/A/testcases/2.in
  12. 1 0
      src/test/arena/exampleContest/A/testcases/2.out
  13. BIN
      src/test/arena/exampleContest/B/attic/sol
  14. 25 0
      src/test/arena/exampleContest/B/sol.cpp
  15. 1 0
      src/test/arena/exampleContest/B/testcases/0.cur
  16. 1 0
      src/test/arena/exampleContest/B/testcases/0.in
  17. 1 0
      src/test/arena/exampleContest/B/testcases/0.out
  18. 1 0
      src/test/arena/exampleContest/B/testcases/1.cur
  19. 1 0
      src/test/arena/exampleContest/B/testcases/1.in
  20. 1 0
      src/test/arena/exampleContest/B/testcases/1.out
  21. 1 0
      src/test/arena/exampleContest/B/testcases/2.cur
  22. 1 0
      src/test/arena/exampleContest/B/testcases/2.in
  23. 1 0
      src/test/arena/exampleContest/B/testcases/2.out
  24. BIN
      src/test/arena/exampleContest/C/attic/sol
  25. 24 0
      src/test/arena/exampleContest/C/sol.cpp
  26. 0 0
      src/test/arena/exampleContest/C/testcases/0.cur
  27. 1 0
      src/test/arena/exampleContest/C/testcases/0.in
  28. 1 0
      src/test/arena/exampleContest/C/testcases/0.out
  29. 1 0
      src/test/arena/exampleContest/C/testcases/1.in
  30. 1 0
      src/test/arena/exampleContest/C/testcases/1.out
  31. 1 0
      src/test/arena/exampleContest/C/testcases/2.in
  32. 1 0
      src/test/arena/exampleContest/C/testcases/2.out
  33. BIN
      src/test/arena/exampleContest/D/attic/sol
  34. 29 0
      src/test/arena/exampleContest/D/sol.cpp
  35. 0 0
      src/test/arena/exampleContest/D/testcases/0.cur
  36. 1 0
      src/test/arena/exampleContest/D/testcases/0.in
  37. 1 0
      src/test/arena/exampleContest/D/testcases/0.out
  38. 1 0
      src/test/arena/exampleContest/D/testcases/1.in
  39. 1 0
      src/test/arena/exampleContest/D/testcases/1.out
  40. 1 0
      src/test/arena/exampleContest/D/testcases/2.in
  41. 1 0
      src/test/arena/exampleContest/D/testcases/2.out
  42. 22 0
      src/test/arena/exampleContest/E/sol.cpp
  43. 1 0
      src/test/arena/exampleContest/E/testcases/0.in
  44. 1 0
      src/test/arena/exampleContest/E/testcases/0.out
  45. 1 0
      src/test/arena/exampleContest/E/testcases/1.in
  46. 1 0
      src/test/arena/exampleContest/E/testcases/1.out
  47. 1 0
      src/test/arena/exampleContest/E/testcases/2.in
  48. 1 0
      src/test/arena/exampleContest/E/testcases/2.out
  49. 28 13
      src/test/extension.test.ts

+ 0 - 1
src/extension.ts

@@ -12,7 +12,6 @@ import { Veredict } from './types';
  * TODO: Add several checkers and try to infer which is the correct! [*]
  * TODO: Smart ID detection while parsing ContestId & ProblemId [*]
  * TODO: Find great name/slogan!!! other than acmhelper Competitive Programming made simple
- * TODO: Change mock for personal -> Allow user choose number of problems while creating personal contest
  * TODO: Implement parser for codeforces to test on real cases
  * TODO: Learn how to move static files from `src` to `out`.
  * TODO: Allow programming in other languages than c++

BIN
src/test/arena/exampleContest/A/attic/sol


+ 11 - 0
src/test/arena/exampleContest/A/sol.cpp

@@ -0,0 +1,11 @@
+#include <iostream>
+
+using namespace std;
+
+int main(){
+    int n; cin >> n;
+
+    cout << n + 2 << endl;
+
+    return 0;
+}

+ 1 - 0
src/test/arena/exampleContest/A/testcases/0.cur

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

+ 1 - 0
src/test/arena/exampleContest/A/testcases/0.in

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

+ 1 - 0
src/test/arena/exampleContest/A/testcases/0.out

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

+ 1 - 0
src/test/arena/exampleContest/A/testcases/1.cur

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

+ 1 - 0
src/test/arena/exampleContest/A/testcases/1.in

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

+ 1 - 0
src/test/arena/exampleContest/A/testcases/1.out

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

+ 1 - 0
src/test/arena/exampleContest/A/testcases/2.cur

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

+ 1 - 0
src/test/arena/exampleContest/A/testcases/2.in

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

+ 1 - 0
src/test/arena/exampleContest/A/testcases/2.out

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

BIN
src/test/arena/exampleContest/B/attic/sol


+ 25 - 0
src/test/arena/exampleContest/B/sol.cpp

@@ -0,0 +1,25 @@
+#include <bits/stdc++.h>
+
+using namespace std;
+
+#define endl '\n'
+
+typedef long long int64;
+typedef pair<int,int> pii;
+typedef vector<int> vi;
+
+const double eps = 1e-9;
+const int oo = 0x3f3f3f3f;
+const int mod = 1000000007;
+
+int main(){
+    ios_base::sync_with_stdio(0);
+    cin.tie(0);
+
+    int  n; cin >> n;
+
+    cout << n + 3 << endl;
+
+
+    return 0;
+}

+ 1 - 0
src/test/arena/exampleContest/B/testcases/0.cur

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

+ 1 - 0
src/test/arena/exampleContest/B/testcases/0.in

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

+ 1 - 0
src/test/arena/exampleContest/B/testcases/0.out

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

+ 1 - 0
src/test/arena/exampleContest/B/testcases/1.cur

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

+ 1 - 0
src/test/arena/exampleContest/B/testcases/1.in

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

+ 1 - 0
src/test/arena/exampleContest/B/testcases/1.out

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

+ 1 - 0
src/test/arena/exampleContest/B/testcases/2.cur

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

+ 1 - 0
src/test/arena/exampleContest/B/testcases/2.in

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

+ 1 - 0
src/test/arena/exampleContest/B/testcases/2.out

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

BIN
src/test/arena/exampleContest/C/attic/sol


+ 24 - 0
src/test/arena/exampleContest/C/sol.cpp

@@ -0,0 +1,24 @@
+#include <bits/stdc++.h>
+
+using namespace std;
+
+#define endl '\n'
+
+typedef long long int64;
+typedef pair<int,int> pii;
+typedef vector<int> vi;
+
+const double eps = 1e-9;
+const int oo = 0x3f3f3f3f;
+const int mod = 1000000007;
+
+int main(){
+    ios_base::sync_with_stdio(0);
+    cin.tie(0);
+
+    int n; cin >> n;
+
+    cout << 1 / n << endl;
+
+    return 0;
+}

+ 0 - 0
src/test/arena/exampleContest/C/testcases/0.cur


+ 1 - 0
src/test/arena/exampleContest/C/testcases/0.in

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

+ 1 - 0
src/test/arena/exampleContest/C/testcases/0.out

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

+ 1 - 0
src/test/arena/exampleContest/C/testcases/1.in

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

+ 1 - 0
src/test/arena/exampleContest/C/testcases/1.out

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

+ 1 - 0
src/test/arena/exampleContest/C/testcases/2.in

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

+ 1 - 0
src/test/arena/exampleContest/C/testcases/2.out

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

BIN
src/test/arena/exampleContest/D/attic/sol


+ 29 - 0
src/test/arena/exampleContest/D/sol.cpp

@@ -0,0 +1,29 @@
+#include <bits/stdc++.h>
+
+using namespace std;
+
+#define endl '\n'
+
+typedef long long int64;
+typedef pair<int,int> pii;
+typedef vector<int> vi;
+
+const double eps = 1e-9;
+const int oo = 0x3f3f3f3f;
+const int mod = 1000000007;
+
+int main(){
+    ios_base::sync_with_stdio(0);
+    cin.tie(0);
+
+    int n; cin >> n;
+    int x = 0;
+
+    for (int i = 0; i < n; i = min(i + 1, 0)){
+        x++;
+    }
+
+    cout << x << endl;
+
+    return 0;
+}

+ 0 - 0
src/test/arena/exampleContest/D/testcases/0.cur


+ 1 - 0
src/test/arena/exampleContest/D/testcases/0.in

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

+ 1 - 0
src/test/arena/exampleContest/D/testcases/0.out

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

+ 1 - 0
src/test/arena/exampleContest/D/testcases/1.in

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

+ 1 - 0
src/test/arena/exampleContest/D/testcases/1.out

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

+ 1 - 0
src/test/arena/exampleContest/D/testcases/2.in

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

+ 1 - 0
src/test/arena/exampleContest/D/testcases/2.out

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

+ 22 - 0
src/test/arena/exampleContest/E/sol.cpp

@@ -0,0 +1,22 @@
+#include <iostream>
+
+using namespace std;
+
+#define endl '\n'
+
+typedef long long int64;
+typedef pair<int,int> pii;
+typedef vector<int> vi;
+
+const double eps = 1e-9;
+const int oo = 0x3f3f3f3f;
+const int mod = 1000000007;
+
+int main(){
+    ios_base::sync_with_stdio(0);
+    cin.tie(0);
+
+    cout << n + 2 << endl;
+
+    return 0;
+}

+ 1 - 0
src/test/arena/exampleContest/E/testcases/0.in

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

+ 1 - 0
src/test/arena/exampleContest/E/testcases/0.out

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

+ 1 - 0
src/test/arena/exampleContest/E/testcases/1.in

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

+ 1 - 0
src/test/arena/exampleContest/E/testcases/1.out

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

+ 1 - 0
src/test/arena/exampleContest/E/testcases/2.in

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

+ 1 - 0
src/test/arena/exampleContest/E/testcases/2.out

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

+ 28 - 13
src/test/extension.test.ts

@@ -38,10 +38,6 @@ suite("Extension Tests", function () {
         closeSync(currentFd);
     }
 
-    // Defines a Mocha unit test
-    test("learnjs", function() {
-    });
-
     /**
      * core::newArena
      */
@@ -59,6 +55,8 @@ suite("Extension Tests", function () {
         assert.equal(existsSync(join(path, ATTIC)), true);
         assert.equal(existsSync(join(path, TESTCASES)), true);
         assert.equal(existsSync(join(path, 'sol.cpp')), true);
+
+        recRmdir(path);
     });
 
     /**
@@ -78,6 +76,8 @@ suite("Extension Tests", function () {
 
         assert.equal(existsSync(join(path, ATTIC, 'gen.py')), true);
         assert.equal(existsSync(join(path, 'brute.cpp')), true);
+
+        recRmdir(path);
     });
 
     /**
@@ -98,24 +98,35 @@ suite("Extension Tests", function () {
      * core::newProblem
      */
     test("newProblemFromId", function(){
-        let path = join(ARENA);
         let problemId = 'testProblemFromId';
-        newProblemFromId(join(path, problemId), 'personal', problemId);
+        let path = join(ARENA, problemId);
+
+        assert.equal(existsSync(path), false);
+
+        newProblemFromId(path, 'personal', problemId);
+
+        assert.equal(existsSync(join(path, 'sol.cpp')), true);
+        assert.equal(existsSync(join(path, ATTIC)), true);
+        assert.equal(existsSync(join(path, TESTCASES)), true);
+        assert.equal(readdirSync(join(path, TESTCASES)).length, 6);
 
-        assert.equal(existsSync(join(path, problemId, 'sol.cpp')), true);
-        assert.equal(existsSync(join(path, problemId, ATTIC)), true);
-        assert.equal(existsSync(join(path, problemId, TESTCASES)), true);
-        assert.equal(readdirSync(join(path, problemId, TESTCASES)).length, 6);
+        recRmdir(path);
     });
 
     /**
      * core::newProblem
      */
     test("newContestFromId", function(){
-        let path = join(ARENA);
         let contestId = 'testContestFromId';
-        newContestFromId(join(path, contestId), 'personal', 5);
-        assert.equal(readdirSync(join(path, contestId)).length, 5);
+        let path = join(ARENA, contestId);
+
+        assert.equal(existsSync(path), false);
+
+        newContestFromId(path, 'personal', 5);
+
+        assert.equal(readdirSync(path).length, 5);
+
+        recRmdir(path);
     });
 
     /**
@@ -224,6 +235,8 @@ suite("Extension Tests", function () {
         let result = stressSolution(path);
 
         assert.equal(result.status, Veredict.OK);
+
+        recRmdir(path);
     });
 
     test("stressSolutionWA", function() {
@@ -273,5 +286,7 @@ suite("Extension Tests", function () {
         let result = stressSolution(path);
 
         assert.equal(result.status, Veredict.WA);
+
+        recRmdir(path);
     });
 });