-
Notifications
You must be signed in to change notification settings - Fork 0
/
CFTesterTest.py
55 lines (39 loc) · 1.6 KB
/
CFTesterTest.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
46
47
48
49
50
51
52
53
54
55
from CFTester import CFTester
import unittest
class CFTesterTest(unittest.TestCase):
def setUp(self):
self.obj = CFTester()
def test_run(self):
self.obj.set_command1('python test1.py')
self.obj.set_command2('python test2.py')
def f():
yield "0 0 0"
yield "1 2 3"
yield "-1 -3 -5"
yield "-2 -3 -5"
self.obj.set_generator(f)
self.assertEqual(0,self.obj.run())
def test_generate_input(self):
f = 'function'
self.assertEqual(0,self.obj.set_generator(f))
self.assertEqual(f,self.obj.get_generator())
def test_get_command1(self):
self.obj.set_command1('python test1.py')
self.assertEqual('python test1.py',self.obj.get_command1())
def test_set_command1(self):
self.assertEqual(0,self.obj.set_command1('python test1.py'))
def test_get_command2(self):
self.obj.set_command2('python test2.py')
self.assertEqual('python test2.py',self.obj.get_command2())
def test_set_command2(self):
self.assertEqual(0,self.obj.set_command2('python test2.py'))
def test_run_test1(self):
self.assertEqual(0,self.obj.set_command1('python test1.py'))
self.assertEqual('0.0',self.obj.run_test1('0 0 0'))
self.assertEqual('5.0',self.obj.run_test1('3 4 0'))
def test_run_test2(self):
self.assertEqual(0,self.obj.set_command2('python test2.py'))
self.assertEqual('0.0',self.obj.run_test2('0 0 0'))
self.assertEqual('5.0',self.obj.run_test2('3 4 0'))
if __name__=='__main__':
unittest.main()