-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_gameTree.py
More file actions
27 lines (25 loc) · 950 Bytes
/
test_gameTree.py
File metadata and controls
27 lines (25 loc) · 950 Bytes
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
from unittest import TestCase
from gameTree import GameTree
from piece import Colour
from queen import Queen
from pawn import Pawn
from king import King
class GameTreeTestSuite(TestCase):
def test_game_progression(self):
board = (Pawn(Colour.WHITE, (0, 0)), Pawn(Colour.BLACK, (7, 7)))
for p in board:
p._moved = True
gt = GameTree(board, Colour.WHITE)
gt.generate(2)
self.assertEquals(len(gt.children), 1)
for p in gt.children[0].pieces:
if p.colour == Colour.WHITE:
self.assertEquals(p.position, (0, 1))
else:
self.assertEquals(p.position, (7, 7))
self.assertEquals(len(gt.children[0].children), 1)
for p in gt.children[0].children[0].pieces:
if p.colour == Colour.WHITE:
self.assertEquals(p.position, (0, 1))
else:
self.assertEquals(p.position, (7, 6))