aboutsummaryrefslogtreecommitdiff
path: root/src/test/integration_tests
diff options
context:
space:
mode:
authorCharlie Blake2018-07-24 12:00:04 +0100
committerCharlie Blake2018-07-24 12:00:04 +0100
commit2acab3e51cabd8ba80738b1faf791980d2abf724 (patch)
treecb3841d736ff353c5d8aea6a4faf81861ef83f5c /src/test/integration_tests
parentSmall bug fixes inc found. base card & whole piles (diff)
downloadmetasol-2acab3e51cabd8ba80738b1faf791980d2abf724.tar.gz
metasol-2acab3e51cabd8ba80738b1faf791980d2abf724.zip

Fix canfield to pass all unit tests

Diffstat (limited to 'src/test/integration_tests')
-rw-r--r--src/test/integration_tests/canfield_test.cpp26
1 files changed, 17 insertions, 9 deletions
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<move> actual_moves = gs.get_legal_moves();
- vector<move> exp_moves = {
- move(move::mtype::regular, 6, 8, 1)
- };
+ vector<move> exp_moves = {};
ASSERT_TRUE(test_helper::moves_eq(exp_moves, actual_moves)) << actual_moves;
+
+ boost::optional<move> actual_dom_move = gs.get_dominance_move();
+ boost::optional<move> 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<move> actual_moves = gs.get_legal_moves();
vector<move> 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<move> actual_dom_move = gs.get_dominance_move();
+ boost::optional<move> exp_dom_move = boost::none;
+
+ ASSERT_EQ(exp_dom_move, actual_dom_move) << *actual_dom_move;
}