From 2acab3e51cabd8ba80738b1faf791980d2abf724 Mon Sep 17 00:00:00 2001 From: Charlie Blake Date: Tue, 24 Jul 2018 12:00:04 +0100 Subject: Fix canfield to pass all unit tests --- src/test/integration_tests/canfield_test.cpp | 26 +++++++++++++++++--------- 1 file changed, 17 insertions(+), 9 deletions(-) (limited to 'src/test/integration_tests') diff --git a/src/test/integration_tests/canfield_test.cpp b/src/test/integration_tests/canfield_test.cpp index cdb6d98..006f4fb 100644 --- a/src/test/integration_tests/canfield_test.cpp +++ b/src/test/integration_tests/canfield_test.cpp @@ -97,18 +97,21 @@ TEST(Canfield, AutoReserve) { sol_rules sr = rules_parser::from_preset("simple-canfield"); game_state gs(sr, string_il{ - {"3C"},{},{},{}, // Foundations - {"3D"},{"2D"}, // Stock-waste + {"2C"},{},{},{}, // Foundations + {"3D","2D"},{}, // Stock-waste {"3H"}, // Reserve {"2H","3S","AH"},{},{"AC"} // Tableau piles }); vector actual_moves = gs.get_legal_moves(); - vector exp_moves = { - move(move::mtype::regular, 6, 8, 1) - }; + vector exp_moves = {}; ASSERT_TRUE(test_helper::moves_eq(exp_moves, actual_moves)) << actual_moves; + + boost::optional actual_dom_move = gs.get_dominance_move(); + boost::optional exp_dom_move = move(move::mtype::dominance, 6, 8, 1); + + ASSERT_EQ(exp_dom_move, actual_dom_move) << *actual_dom_move; } TEST(Canfield, AutoReserveThenWaste) { @@ -116,16 +119,21 @@ TEST(Canfield, AutoReserveThenWaste) { game_state gs(sr, string_il{ {"3C"},{},{},{}, // Foundations - {"3D"},{"3H"}, // Stock-waste + {"2D"},{"2S"}, // Stock-waste {}, // Reserve - {"2H","3S","AH"},{},{"AC"} // Tableau piles + {"2H","3S","AH"},{},{"AD"} // Tableau piles }); vector actual_moves = gs.get_legal_moves(); vector exp_moves = { - move(move::mtype::stock_k_plus, 4, 8, 1), - move(move::mtype::stock_k_plus, 4, 8, 2), + move(move::mtype::stock_k_plus, 4, 8, 0), + move(move::mtype::stock_k_plus, 4, 8, 1) }; ASSERT_TRUE(test_helper::moves_eq(exp_moves, actual_moves)) << actual_moves; + + boost::optional actual_dom_move = gs.get_dominance_move(); + boost::optional exp_dom_move = boost::none; + + ASSERT_EQ(exp_dom_move, actual_dom_move) << *actual_dom_move; } -- cgit v1.2.1