예제 #1
0
파일: test.py 프로젝트: YMlvg/ChessGame
 def test_bishop_isvalid(self):
     '''Bishop move validation'''
     testdata = {Bishop('white'): [(2, 0), (0, 2), True],
             Bishop('white'): [(2, 0), (1, 2), False],
             }
     for piece, (start, end, ans) in testdata.items():
         result = piece.isvalid(start, end)
         self.assertEqual(result, ans)
예제 #2
0
 def testBishopClass(self):
     # test moves array
     self.assertEqual(Bishop.moves, [[1, 1], [1, -1], [-1, 1], [-1, -1]])
     b = Bishop()
     l = [found_position for found_position in b.possible_positions("D4")]
     self.assertEqual(l, [
         'E5', 'F6', 'G7', 'H8', 'E3', 'F2', 'G1', 'C5', 'B6', 'A7', 'C3',
         'B2', 'A1'
     ])