|
1 | 1 | import unittest |
2 | 2 | from coderunner import coderunner |
3 | 3 | from coderunner.coderunner import InvalidURL, ValueTooLargeError |
4 | | -import os |
5 | 4 | # # test for Java program |
6 | | -from dotenv import load_dotenv |
7 | 5 |
|
8 | | -load_dotenv() |
| 6 | +# class TestRunA(unittest.TestCase): |
| 7 | +# def test_run(self): |
| 8 | +# source_code = "testfiles/" + "test_java.java" |
| 9 | +# language = "Java" |
| 10 | +# output = "testfiles/output/" + "output.txt" |
| 11 | +# r = coderunner.code(source_code, language, output) |
| 12 | +# r.api(key=API_KEY) |
| 13 | +# r.run() |
| 14 | +# self.assertEqual(r.getStatus(), "Accepted", "Something Wrong") |
9 | 15 |
|
10 | | -API_KEY = os.environ["API_KEY"] |
11 | 16 |
|
12 | | - |
13 | | -class TestRunA(unittest.TestCase): |
14 | | - def test_run(self): |
15 | | - source_code = "testfiles/" + "test_java.java" |
16 | | - language = "Java" |
17 | | - output = "testfiles/output/" + "output.txt" |
18 | | - r = coderunner.code(source_code, language, output) |
19 | | - r.api(key=API_KEY) |
20 | | - r.run() |
21 | | - self.assertEqual(r.getStatus(), "Accepted", "Something Wrong") |
| 17 | +# # test for Java program with input |
22 | 18 |
|
23 | 19 |
|
24 | | -# test for Java program with input |
| 20 | +# class TestRunB(unittest.TestCase): |
| 21 | +# def test_run(self): |
| 22 | +# source_code = "testfiles/" + "test_java_input.java" |
| 23 | +# language = "Java" |
| 24 | +# output = "testfiles/output/" + "output5.txt" |
| 25 | +# Input = "testfiles/input/" + "input4.txt" |
| 26 | +# r = coderunner.code(source_code, language, output, Input) |
| 27 | +# r.api(key=API_KEY) |
| 28 | +# r.run() |
| 29 | +# self.assertEqual(r.getStatus(), "Accepted", "Something Wrong") |
25 | 30 |
|
26 | 31 |
|
27 | | -class TestRunB(unittest.TestCase): |
28 | | - def test_run(self): |
29 | | - source_code = "testfiles/" + "test_java_input.java" |
30 | | - language = "Java" |
31 | | - output = "testfiles/output/" + "output5.txt" |
32 | | - Input = "testfiles/input/" + "input4.txt" |
33 | | - r = coderunner.code(source_code, language, output, Input) |
34 | | - r.api(key=API_KEY) |
35 | | - r.run() |
36 | | - self.assertEqual(r.getStatus(), "Accepted", "Something Wrong") |
| 32 | +# # test for Python3 program |
37 | 33 |
|
38 | 34 |
|
39 | | -# test for Python3 program |
| 35 | +# class TestRunC(unittest.TestCase): |
| 36 | +# def test_run(self): |
| 37 | +# source_code = "testfiles/" + "test_python.py" |
| 38 | +# language = "Python3" |
| 39 | +# output = "testfiles/output/" + "output6.txt" |
| 40 | +# r = coderunner.code(source_code, language, output) |
| 41 | +# r.api(key=API_KEY) |
| 42 | +# r.run() |
| 43 | +# self.assertEqual(r.getStatus(), "Accepted", "Something Wrong") |
40 | 44 |
|
41 | 45 |
|
42 | | -class TestRunC(unittest.TestCase): |
43 | | - def test_run(self): |
44 | | - source_code = "testfiles/" + "test_python.py" |
45 | | - language = "Python3" |
46 | | - output = "testfiles/output/" + "output6.txt" |
47 | | - r = coderunner.code(source_code, language, output) |
48 | | - r.api(key=API_KEY) |
49 | | - r.run() |
50 | | - self.assertEqual(r.getStatus(), "Accepted", "Something Wrong") |
| 46 | +# # test for Python3 program with input |
51 | 47 |
|
52 | 48 |
|
53 | | -# test for Python3 program with input |
54 | | - |
55 | | - |
56 | | -class TestRunD(unittest.TestCase): |
57 | | - def test_run(self): |
58 | | - source_code = "testfiles/" + "test_python_input.py" |
59 | | - language = "Python3" |
60 | | - output = "testfiles/output/" + "output2.txt" |
61 | | - Input = "testfiles/input/" + "input.txt" |
62 | | - r = coderunner.code(source_code, language, output, Input) |
63 | | - r.api(key=API_KEY) |
64 | | - r.run() |
65 | | - self.assertEqual(r.getStatus(), "Accepted", "Something Wrong") |
| 49 | +# class TestRunD(unittest.TestCase): |
| 50 | +# def test_run(self): |
| 51 | +# source_code = "testfiles/" + "test_python_input.py" |
| 52 | +# language = "Python3" |
| 53 | +# output = "testfiles/output/" + "output2.txt" |
| 54 | +# Input = "testfiles/input/" + "input.txt" |
| 55 | +# r = coderunner.code(source_code, language, output, Input) |
| 56 | +# r.api(key=API_KEY) |
| 57 | +# r.run() |
| 58 | +# self.assertEqual(r.getStatus(), "Accepted", "Something Wrong") |
66 | 59 |
|
67 | 60 |
|
68 | | -# test for C program |
| 61 | +# # test for C program |
69 | 62 |
|
70 | 63 |
|
71 | | -class TestRunE(unittest.TestCase): |
72 | | - def test_run(self): |
73 | | - source_code = "testfiles/" + "test_c.c" |
74 | | - language = "C" |
75 | | - output = "testfiles/output/" + "output7.txt" |
76 | | - r = coderunner.code(source_code, language, output) |
77 | | - r.api(key=API_KEY) |
78 | | - r.run() |
79 | | - self.assertEqual(r.getStatus(), "Accepted", "Something Wrong") |
| 64 | +# class TestRunE(unittest.TestCase): |
| 65 | +# def test_run(self): |
| 66 | +# source_code = "testfiles/" + "test_c.c" |
| 67 | +# language = "C" |
| 68 | +# output = "testfiles/output/" + "output7.txt" |
| 69 | +# r = coderunner.code(source_code, language, output) |
| 70 | +# r.api(key=API_KEY) |
| 71 | +# r.run() |
| 72 | +# self.assertEqual(r.getStatus(), "Accepted", "Something Wrong") |
80 | 73 |
|
81 | 74 |
|
82 | | -# test for C program with input |
| 75 | +# # test for C program with input |
83 | 76 |
|
84 | 77 |
|
85 | | -class TestRunF(unittest.TestCase): |
86 | | - def test_run(self): |
87 | | - source_code = "testfiles/" + "test_c_input.c" |
88 | | - language = "C" |
89 | | - output = "testfiles/output/" + "output3.txt" |
90 | | - Input = "testfiles/input/" + "input2.txt" |
91 | | - r = coderunner.code(source_code, language, output, Input) |
92 | | - r.api(key=API_KEY) |
93 | | - r.run() |
94 | | - self.assertEqual(r.getStatus(), "Accepted", "Something Wrong") |
| 78 | +# class TestRunF(unittest.TestCase): |
| 79 | +# def test_run(self): |
| 80 | +# source_code = "testfiles/" + "test_c_input.c" |
| 81 | +# language = "C" |
| 82 | +# output = "testfiles/output/" + "output3.txt" |
| 83 | +# Input = "testfiles/input/" + "input2.txt" |
| 84 | +# r = coderunner.code(source_code, language, output, Input) |
| 85 | +# r.api(key=API_KEY) |
| 86 | +# r.run() |
| 87 | +# self.assertEqual(r.getStatus(), "Accepted", "Something Wrong") |
95 | 88 |
|
96 | 89 |
|
97 | | -# test for C++ program |
| 90 | +# # test for C++ program |
98 | 91 |
|
99 | 92 |
|
100 | | -class TestRunG(unittest.TestCase): |
101 | | - def test_run(self): |
102 | | - source_code = "testfiles/" + "test_c++.cpp" |
103 | | - language = "C++" |
104 | | - output = "testfiles/output/" + "output8.txt" |
105 | | - r = coderunner.code(source_code, language, output) |
106 | | - r.api(key=API_KEY) |
107 | | - r.run() |
108 | | - self.assertEqual(r.getStatus(), "Accepted", "Something Wrong") |
| 93 | +# class TestRunG(unittest.TestCase): |
| 94 | +# def test_run(self): |
| 95 | +# source_code = "testfiles/" + "test_c++.cpp" |
| 96 | +# language = "C++" |
| 97 | +# output = "testfiles/output/" + "output8.txt" |
| 98 | +# r = coderunner.code(source_code, language, output) |
| 99 | +# r.api(key=API_KEY) |
| 100 | +# r.run() |
| 101 | +# self.assertEqual(r.getStatus(), "Accepted", "Something Wrong") |
109 | 102 |
|
110 | 103 |
|
111 | | -# test for C++ program with input |
| 104 | +# # test for C++ program with input |
112 | 105 |
|
113 | 106 |
|
114 | | -class TestRunH(unittest.TestCase): |
115 | | - def test_run(self): |
116 | | - source_code = "testfiles/" + "test_c++_input.cpp" |
117 | | - language = "C++" |
118 | | - output = "testfiles/output/" + "output4.txt" |
119 | | - Input = "testfiles/input/" + "input3.txt" |
120 | | - r = coderunner.code(source_code, language, output, Input) |
121 | | - r.api(key=API_KEY) |
122 | | - r.run() |
123 | | - self.assertEqual(r.getStatus(), "Accepted", "Something Wrong") |
| 107 | +# class TestRunH(unittest.TestCase): |
| 108 | +# def test_run(self): |
| 109 | +# source_code = "testfiles/" + "test_c++_input.cpp" |
| 110 | +# language = "C++" |
| 111 | +# output = "testfiles/output/" + "output4.txt" |
| 112 | +# Input = "testfiles/input/" + "input3.txt" |
| 113 | +# r = coderunner.code(source_code, language, output, Input) |
| 114 | +# r.api(key=API_KEY) |
| 115 | +# r.run() |
| 116 | +# self.assertEqual(r.getStatus(), "Accepted", "Something Wrong") |
124 | 117 |
|
125 | 118 |
|
126 | 119 | # test to check ValueError exception |
@@ -167,15 +160,15 @@ def test_run(self): |
167 | 160 | # test to check Wrong Answer Status |
168 | 161 |
|
169 | 162 |
|
170 | | -class TestRunM(unittest.TestCase): |
171 | | - def test_run(self): |
172 | | - source_code = 'print("This will return Wrong Answer")' |
173 | | - language = "Python3" |
174 | | - output = "Wrong Answer" |
175 | | - r = coderunner.code(source_code, language, output, path=False) |
176 | | - r.api(key=API_KEY) |
177 | | - r.run() |
178 | | - self.assertEqual(r.getStatus(), "Wrong Answer", "Something Wrong") |
| 163 | +# class TestRunM(unittest.TestCase): |
| 164 | +# def test_run(self): |
| 165 | +# source_code = 'print("This will return Wrong Answer")' |
| 166 | +# language = "Python3" |
| 167 | +# output = "Wrong Answer" |
| 168 | +# r = coderunner.code(source_code, language, output, path=False) |
| 169 | +# r.api(key=API_KEY) |
| 170 | +# r.run() |
| 171 | +# self.assertEqual(r.getStatus(), "Wrong Answer", "Something Wrong") |
179 | 172 |
|
180 | 173 |
|
181 | 174 | # test to check invalid API url |
|
0 commit comments