-
Notifications
You must be signed in to change notification settings - Fork 0
/
step2_eval.py
45 lines (32 loc) · 1.01 KB
/
step2_eval.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
# GENERATED by make_pyunitt.py with step2_eval.mal as input
import unittest
import repl
import printer
class REPLTest(unittest.TestCase):
def setUp(self):
pass
def tearDown(self):
pass
def test0(self):
assert(repl.repl("(+ 1 2)") == "3")
def test1(self):
assert(repl.repl("(+ 5 (* 2 3))") == "11")
def test2(self):
assert(repl.repl("(- (+ 5 (* 2 3)) 3)") == "8")
def test3(self):
assert(repl.repl("(/ (- (+ 5 (* 2 3)) 3) 4)") == "2")
def test4(self):
assert(repl.repl("(/ (- (+ 515 (* 87 311)) 302) 27)") == "1010")
def test5(self):
assert(repl.repl("(* -3 6)") == "-18")
def test6(self):
assert(repl.repl("(/ (- (+ 515 (* -87 311)) 296) 27)") == "-994")
def test7(self):
try:
self.assertRaises(RuntimeError, repl.repl("(abc 1 2 3)"))
except RuntimeError:
pass
def test8(self):
assert(repl.repl("()") == "()")
if __name__ == "__main__":
unittest.main()