Skip to content

Commit 7080596

Browse files
committed
write more tests
1 parent 282f3d6 commit 7080596

5 files changed

Lines changed: 27 additions & 15 deletions

File tree

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ pip install -r requirements.txt
1717
```
1818
4. Run tests.
1919
```bash
20-
python3 test.py
20+
python3 tests.py
2121
```
2222

2323
### Usage

test.py

Lines changed: 0 additions & 13 deletions
This file was deleted.

testfiles/input.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
world
1+
World

testfiles/output2.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Hello, World

tests.py

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
import unittest
2+
from judge import run
3+
4+
class TestRunA(unittest.TestCase):
5+
def test_run(self):
6+
program_name = "testfiles/" + "test_java.java"
7+
language = "Java"
8+
output = "testfiles/" + "output.txt"
9+
self.assertEqual(run(program_name, language, output),
10+
"Accepted", "Something Wrong")
11+
12+
13+
class TestRunB(unittest.TestCase):
14+
def test_run(self):
15+
program_name = "testfiles/" + "test_python.py"
16+
language = "Python"
17+
output = "testfiles/" + "output2.txt"
18+
Input = "testfiles/" + "input.txt"
19+
self.assertEqual(run(program_name, language, output, Input),
20+
"Accepted", "Something Wrong")
21+
22+
23+
if __name__ == '__main__':
24+
unittest.main()

0 commit comments

Comments
 (0)