Add legal move tests and fix pawn promo tests
All checks were successful
Python tests (make) / test (push) Successful in 11s

This commit is contained in:
2025-08-19 15:32:56 -04:00
parent 5b4a901f8d
commit 1ba87368b5
2 changed files with 4 additions and 4 deletions

View File

@@ -60,7 +60,7 @@ class TestLegalMoveGen(ChessLibTestBase):
self.assertEqual(n, 44) self.assertEqual(n, 44)
def test_pert_position_5(self): def test_pert_position_6(self):
fen = "r4rk1/1pp1qppp/p1np1n2/2b1p1B1/2B1P1b1/P1NP1N2/1PP1QPPP/R4RK1 w - - 0 10" fen = "r4rk1/1pp1qppp/p1np1n2/2b1p1B1/2B1P1b1/P1NP1N2/1PP1QPPP/R4RK1 w - - 0 10"
b = Board(); self.load_fen(fen, board=b) b = Board(); self.load_fen(fen, board=b)

View File

@@ -253,7 +253,7 @@ class TestPseudoMoveGeneration(ChessLibTestBase):
def test_quiet_pawn_promotions_white(self): def test_quiet_pawn_promotions_white(self):
cases = [ cases = [
("8/PPPPPPPP/8/8/8/8/8/8 w - - 0 1", 8, "all open on 7th rank"), ("8/PPPPPPPP/8/8/8/8/8/8 w - - 0 1", 32, "all open on 7th rank"),
("8/8/7P/8/8/8/8/8 w - - 0 1", 0, "no promotions"), ("8/8/7P/8/8/8/8/8 w - - 0 1", 0, "no promotions"),
("7n/7P/8/8/8/8/8/8 w - - 0 1", 0, "blocked by enemy"), ("7n/7P/8/8/8/8/8/8 w - - 0 1", 0, "blocked by enemy"),
("7N/7P/8/8/8/8/8/8 w - - 0 1", 0, "blocked by friendly"), ("7N/7P/8/8/8/8/8/8 w - - 0 1", 0, "blocked by friendly"),
@@ -263,8 +263,8 @@ class TestPseudoMoveGeneration(ChessLibTestBase):
def test_capture_pawn_promotions_white(self): def test_capture_pawn_promotions_white(self):
cases = [ cases = [
("6n1/7P/8/8/8/8/8/8 w - - 0 1", 1, "one capture"), ("6n1/7P/8/8/8/8/8/8 w - - 0 1", 4, "one capture"),
("5n1n/6P1/8/8/8/8/8/8 w - - 0 1", 2, "two captures"), ("5n1n/6P1/8/8/8/8/8/8 w - - 0 1", 8, "two captures"),
("8/7P/8/8/8/8/8/8 w - - 0 1", 0, "no capture"), ("8/7P/8/8/8/8/8/8 w - - 0 1", 0, "no capture"),
] ]
self.run_subtests(cases, gen_white_pawn_capture_promotions) self.run_subtests(cases, gen_white_pawn_capture_promotions)