|
4 | 4 | # # test for Java program |
5 | 5 |
|
6 | 6 |
|
7 | | -# class TestRunA(unittest.TestCase): |
8 | | -# def test_run(self): |
9 | | -# source_code = "testfiles/" + "test_java.java" |
10 | | -# language = "Java" |
11 | | -# output = "testfiles/output/" + "output.txt" |
12 | | -# r = coderunner.code(source_code, language, output) |
13 | | -# r.run() |
14 | | -# self.assertEqual(r.getStatus(), "Accepted", "Something Wrong") |
| 7 | +class TestRunA(unittest.TestCase): |
| 8 | + def test_run(self): |
| 9 | + source_code = "testfiles/" + "test_java.java" |
| 10 | + language = "Java" |
| 11 | + output = "testfiles/output/" + "output.txt" |
| 12 | + r = coderunner.code(source_code, language, output) |
| 13 | + r.run() |
| 14 | + self.assertEqual(r.getStatus(), "Accepted", "Something Wrong") |
15 | 15 |
|
16 | 16 |
|
17 | | -# # test for Java program with input |
| 17 | +# test for Java program with input |
18 | 18 |
|
19 | 19 |
|
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.run() |
28 | | -# self.assertEqual(r.getStatus(), "Accepted", "Something Wrong") |
| 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.run() |
| 28 | + self.assertEqual(r.getStatus(), "Accepted", "Something Wrong") |
29 | 29 |
|
30 | 30 |
|
31 | | -# # test for Python3 program |
| 31 | +# test for Python3 program |
32 | 32 |
|
33 | 33 |
|
34 | | -# class TestRunC(unittest.TestCase): |
35 | | -# def test_run(self): |
36 | | -# source_code = "testfiles/" + "test_python.py" |
37 | | -# language = "Python3" |
38 | | -# output = "testfiles/output/" + "output6.txt" |
39 | | -# r = coderunner.code(source_code, language, output) |
40 | | -# r.run() |
41 | | -# self.assertEqual(r.getStatus(), "Accepted", "Something Wrong") |
| 34 | +class TestRunC(unittest.TestCase): |
| 35 | + def test_run(self): |
| 36 | + source_code = "testfiles/" + "test_python.py" |
| 37 | + language = "Python3" |
| 38 | + output = "testfiles/output/" + "output6.txt" |
| 39 | + r = coderunner.code(source_code, language, output) |
| 40 | + r.run() |
| 41 | + self.assertEqual(r.getStatus(), "Accepted", "Something Wrong") |
42 | 42 |
|
43 | 43 |
|
44 | | -# # test for Python3 program with input |
| 44 | +# test for Python3 program with input |
45 | 45 |
|
46 | 46 |
|
47 | | -# class TestRunD(unittest.TestCase): |
48 | | -# def test_run(self): |
49 | | -# source_code = "testfiles/" + "test_python_input.py" |
50 | | -# language = "Python3" |
51 | | -# output = "testfiles/output/" + "output2.txt" |
52 | | -# Input = "testfiles/input/" + "input.txt" |
53 | | -# r = coderunner.code(source_code, language, output, Input) |
54 | | -# r.run() |
55 | | -# self.assertEqual(r.getStatus(), "Accepted", "Something Wrong") |
| 47 | +class TestRunD(unittest.TestCase): |
| 48 | + def test_run(self): |
| 49 | + source_code = "testfiles/" + "test_python_input.py" |
| 50 | + language = "Python3" |
| 51 | + output = "testfiles/output/" + "output2.txt" |
| 52 | + Input = "testfiles/input/" + "input.txt" |
| 53 | + r = coderunner.code(source_code, language, output, Input) |
| 54 | + r.run() |
| 55 | + self.assertEqual(r.getStatus(), "Accepted", "Something Wrong") |
56 | 56 |
|
57 | 57 |
|
58 | | -# # test for C program |
| 58 | +# test for C program |
59 | 59 |
|
60 | 60 |
|
61 | | -# class TestRunE(unittest.TestCase): |
62 | | -# def test_run(self): |
63 | | -# source_code = "testfiles/" + "test_c.c" |
64 | | -# language = "C" |
65 | | -# output = "testfiles/output/" + "output7.txt" |
66 | | -# r = coderunner.code(source_code, language, output) |
67 | | -# r.run() |
68 | | -# self.assertEqual(r.getStatus(), "Accepted", "Something Wrong") |
| 61 | +class TestRunE(unittest.TestCase): |
| 62 | + def test_run(self): |
| 63 | + source_code = "testfiles/" + "test_c.c" |
| 64 | + language = "C" |
| 65 | + output = "testfiles/output/" + "output7.txt" |
| 66 | + r = coderunner.code(source_code, language, output) |
| 67 | + r.run() |
| 68 | + self.assertEqual(r.getStatus(), "Accepted", "Something Wrong") |
69 | 69 |
|
70 | 70 |
|
71 | | -# # test for C program with input |
| 71 | +# test for C program with input |
72 | 72 |
|
73 | 73 |
|
74 | | -# class TestRunF(unittest.TestCase): |
75 | | -# def test_run(self): |
76 | | -# source_code = "testfiles/" + "test_c_input.c" |
77 | | -# language = "C" |
78 | | -# output = "testfiles/output/" + "output3.txt" |
79 | | -# Input = "testfiles/input/" + "input2.txt" |
80 | | -# r = coderunner.code(source_code, language, output, Input) |
81 | | -# r.run() |
82 | | -# self.assertEqual(r.getStatus(), "Accepted", "Something Wrong") |
| 74 | +class TestRunF(unittest.TestCase): |
| 75 | + def test_run(self): |
| 76 | + source_code = "testfiles/" + "test_c_input.c" |
| 77 | + language = "C" |
| 78 | + output = "testfiles/output/" + "output3.txt" |
| 79 | + Input = "testfiles/input/" + "input2.txt" |
| 80 | + r = coderunner.code(source_code, language, output, Input) |
| 81 | + r.run() |
| 82 | + self.assertEqual(r.getStatus(), "Accepted", "Something Wrong") |
83 | 83 |
|
84 | 84 |
|
85 | | -# # test for C++ program |
| 85 | +# test for C++ program |
86 | 86 |
|
87 | 87 |
|
88 | | -# class TestRunG(unittest.TestCase): |
89 | | -# def test_run(self): |
90 | | -# source_code = "testfiles/" + "test_c++.cpp" |
91 | | -# language = "C++" |
92 | | -# output = "testfiles/output/" + "output8.txt" |
93 | | -# r = coderunner.code(source_code, language, output) |
94 | | -# r.run() |
95 | | -# self.assertEqual(r.getStatus(), "Accepted", "Something Wrong") |
| 88 | +class TestRunG(unittest.TestCase): |
| 89 | + def test_run(self): |
| 90 | + source_code = "testfiles/" + "test_c++.cpp" |
| 91 | + language = "C++" |
| 92 | + output = "testfiles/output/" + "output8.txt" |
| 93 | + r = coderunner.code(source_code, language, output) |
| 94 | + r.run() |
| 95 | + self.assertEqual(r.getStatus(), "Accepted", "Something Wrong") |
96 | 96 |
|
97 | 97 |
|
98 | | -# # test for C++ program with input |
| 98 | +# test for C++ program with input |
99 | 99 |
|
100 | 100 |
|
101 | | -# class TestRunH(unittest.TestCase): |
102 | | -# def test_run(self): |
103 | | -# source_code = "testfiles/" + "test_c++_input.cpp" |
104 | | -# language = "C++" |
105 | | -# output = "testfiles/output/" + "output4.txt" |
106 | | -# Input = "testfiles/input/" + "input3.txt" |
107 | | -# r = coderunner.code(source_code, language, output, Input) |
108 | | -# r.run() |
109 | | -# self.assertEqual(r.getStatus(), "Accepted", "Something Wrong") |
| 101 | +class TestRunH(unittest.TestCase): |
| 102 | + def test_run(self): |
| 103 | + source_code = "testfiles/" + "test_c++_input.cpp" |
| 104 | + language = "C++" |
| 105 | + output = "testfiles/output/" + "output4.txt" |
| 106 | + Input = "testfiles/input/" + "input3.txt" |
| 107 | + r = coderunner.code(source_code, language, output, Input) |
| 108 | + r.run() |
| 109 | + self.assertEqual(r.getStatus(), "Accepted", "Something Wrong") |
110 | 110 |
|
111 | 111 |
|
112 | | -# # test to check ValueError exception |
| 112 | +# test to check ValueError exception |
113 | 113 |
|
114 | 114 |
|
115 | | -# class TestRunI(unittest.TestCase): |
116 | | -# def test_run(self): |
117 | | -# with self.assertRaises(ValueError): |
118 | | -# coderunner.code("Hello World", "fgbh", "Hello World", path=False) |
| 115 | +class TestRunI(unittest.TestCase): |
| 116 | + def test_run(self): |
| 117 | + with self.assertRaises(ValueError): |
| 118 | + coderunner.code("Hello World", "fgbh", "Hello World", path=False) |
119 | 119 |
|
120 | 120 |
|
121 | | -# # test to check OSError exception |
| 121 | +# test to check OSError exception |
122 | 122 |
|
123 | 123 |
|
124 | | -# class TestRunJ(unittest.TestCase): |
125 | | -# def test_run(self): |
126 | | -# with self.assertRaises(OSError): |
127 | | -# coderunner.code("Hello World", "C++", "Hello World") |
| 124 | +class TestRunJ(unittest.TestCase): |
| 125 | + def test_run(self): |
| 126 | + with self.assertRaises(OSError): |
| 127 | + coderunner.code("Hello World", "C++", "Hello World") |
128 | 128 |
|
129 | 129 |
|
130 | | -# # test to check OSError exception |
| 130 | +# test to check OSError exception |
131 | 131 |
|
132 | 132 |
|
133 | | -# class TestRunK(unittest.TestCase): |
134 | | -# def test_run(self): |
135 | | -# with self.assertRaises(OSError): |
136 | | -# coderunner.code("testfiles/" + "test_c++.cpp", "C++", "Hello World") |
| 133 | +class TestRunK(unittest.TestCase): |
| 134 | + def test_run(self): |
| 135 | + with self.assertRaises(OSError): |
| 136 | + coderunner.code("testfiles/" + "test_c++.cpp", "C++", "Hello World") |
137 | 137 |
|
138 | 138 |
|
139 | | -# # test to check OSError exception |
| 139 | +# test to check OSError exception |
140 | 140 |
|
141 | 141 |
|
142 | | -# class TestRunL(unittest.TestCase): |
143 | | -# def test_run(self): |
144 | | -# with self.assertRaises(OSError): |
145 | | -# coderunner.code( |
146 | | -# "testfiles/" + "test_c++.cpp", |
147 | | -# "C++", |
148 | | -# "testfiles/output/" + "output4.txt", |
149 | | -# "my_input", |
150 | | -# ) |
| 142 | +class TestRunL(unittest.TestCase): |
| 143 | + def test_run(self): |
| 144 | + with self.assertRaises(OSError): |
| 145 | + coderunner.code( |
| 146 | + "testfiles/" + "test_c++.cpp", |
| 147 | + "C++", |
| 148 | + "testfiles/output/" + "output4.txt", |
| 149 | + "my_input", |
| 150 | + ) |
151 | 151 |
|
152 | 152 |
|
153 | 153 | # # test to check Wrong Answer Status |
|
0 commit comments