/
test-atrium.py
60 lines (50 loc) · 1.74 KB
/
test-atrium.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
56
57
58
59
60
import unittest
from Atrium import Atrium
from Bishop import Bishop
class TestAtrium(unittest.TestCase):
def test_centre(self):
peter = Bishop(76);
self.assertEqual(peter.coords(), [8 ,4])
def test_top(self):
peter = Bishop(8);
self.assertEqual(peter.type(), 'T')
def test_top(self):
peter = Bishop(151);
self.assertEqual(peter.type(), 'B')
def test_left(self):
peter = Bishop(102);
self.assertEqual(peter.type(), 'L')
def test_middle(self):
peter = Bishop(76);
self.assertEqual(peter.type(), 'M')
def test_corners(self):
peter = Bishop(0);
self.assertEqual(peter.type(), 'a')
peter = Bishop(16);
self.assertEqual(peter.type(), 'b')
peter = Bishop(136);
self.assertEqual(peter.type(), 'c')
peter = Bishop(152);
self.assertEqual(peter.type(), 'd')
def test_print_start(self):
peter = Bishop(76);
atrium = Atrium(peter, 'RSA 2048', 'MD5');
emptyAtrium = open('blank_atrium.txt', 'r').read()
self.assertEqual(str(atrium), emptyAtrium)
def test_print_single_move(self):
peter = Bishop(76);
atrium = Atrium(peter, 'RSA 2048', 'MD5');
atrium.move(0)
dottyAtrium = open('atrium_single_move.txt', 'r').read()
self.assertEqual(str(atrium), dottyAtrium)
def test_print_repeated_move(self):
peter = Bishop(76);
atrium = Atrium(peter, 'RSA 2048', 'MD5');
atrium.move(0)
atrium.move(3)
atrium.move(0)
atrium.move(3)
atrium.move(0)
atrium.move(3)
dottyAtrium = open('atrium_multiple_move.txt', 'r').read()
self.assertEqual(str(atrium), dottyAtrium)