def test_full_overlap(self): pieces = [] for black in (True, False): for tall in (True, False): for hole in (True, False): for square in (True, False): pieces.append( Piece.from_attributes(black, tall, hole, square)) for piece in pieces: overlaps = 0 for other_piece in pieces: if piece == other_piece: continue if Piece.overlap(piece, other_piece): overlaps += 1 self.assertEqual(overlaps, 14)
def test_no_overlap(self): a = Piece.from_attributes(True, True, False, True) b = Piece.from_attributes(True, False, True, True) c = Piece.from_attributes(False, True, False, False) d = Piece.from_attributes(True, False, False, False) self.assertFalse(Piece.overlap(a, b, c, d))
def test_piece_overlap(self): standard_piece = Piece.from_attributes() opposite_piece = Piece.from_attributes(True, True, False, True) self.assertTrue(Piece.overlap(standard_piece, opposite_piece))