diff options
Diffstat (limited to 'src/test/unit_tests')
| -rw-r--r-- | src/test/unit_tests/built_group_move_gen_test.cpp | 56 | ||||
| -rw-r--r-- | src/test/unit_tests/face_up_cards_test.cpp | 321 | ||||
| -rw-r--r-- | src/test/unit_tests/global_cache_test.cpp | 55 | ||||
| -rw-r--r-- | src/test/unit_tests/legal_move_gen_test.cpp | 33 |
4 files changed, 394 insertions, 71 deletions
diff --git a/src/test/unit_tests/built_group_move_gen_test.cpp b/src/test/unit_tests/built_group_move_gen_test.cpp index 34e2b07..37a2cf0 100644 --- a/src/test/unit_tests/built_group_move_gen_test.cpp +++ b/src/test/unit_tests/built_group_move_gen_test.cpp @@ -20,13 +20,13 @@ TEST(BuiltGroupMoveGen, SameSuitEmpty) { sr.built_group_pol = pol::SAME_SUIT; sr.move_built_group = true; - test_helper::run_built_group_test( + test_helper::expected_moves_test( sr, { {}, - {"3C","2C","AC"}, // Same suit - {"3H","2S","AH"}, // Red black - {"3D","2D","AS"}, // Any suit + {"3C", "2C", "AC"}, // Same suit + {"3H", "2S", "AH"}, // Red black + {"3D", "2D", "AS"}, // Any suit {} }, { @@ -53,13 +53,13 @@ TEST(BuiltGroupMoveGen, RedBlackEmpty) { sr.built_group_pol = pol::RED_BLACK; sr.move_built_group = true; - test_helper::run_built_group_test( + test_helper::expected_moves_test( sr, { {}, - {"3C","2C","AC"}, // Same suit - {"3H","2S","AH"}, // Red black - {"3D","2D","AS"}, // Any suit + {"3C", "2C", "AC"}, // Same suit + {"3H", "2S", "AH"}, // Red black + {"3D", "2D", "AS"}, // Any suit {} }, { @@ -89,13 +89,13 @@ TEST(BuiltGroupMoveGen, AnySuitEmpty) { sr.built_group_pol = pol::ANY_SUIT; sr.move_built_group = true; - test_helper::run_built_group_test( + test_helper::expected_moves_test( sr, { {}, - {"3C","2C","AC"}, // Same suit - {"3H","2S","AH"}, // Red black - {"3D","2D","AS"}, // Any suit + {"3C", "2C", "AC"}, // Same suit + {"3H", "2S", "AH"}, // Red black + {"3D", "2D", "AS"}, // Any suit {} }, { @@ -132,13 +132,13 @@ TEST(BuiltGroupMoveGen, CantMove) { sr.built_group_pol = pol::ANY_SUIT; sr.move_built_group = false; - test_helper::run_built_group_test( + test_helper::expected_moves_test( sr, { {}, - {"3C","2C","AC"}, // Same suit - {"3H","2S","AH"}, // Red black - {"3D","2D","AS"}, // Any suit + {"3C", "2C", "AC"}, // Same suit + {"3H", "2S", "AH"}, // Red black + {"3D", "2D", "AS"}, // Any suit {} }, { @@ -159,13 +159,13 @@ TEST(BuiltGroupMoveGen, SameSuitOccupied) { sr.built_group_pol = pol::SAME_SUIT; sr.move_built_group = true; - test_helper::run_built_group_test( + test_helper::expected_moves_test( sr, { {"4C"}, - {"3C","2C","AC"}, // Same suit - {"3H","2S","AH"}, // Red black - {"3D","2D","AS"}, // Any suit + {"3C", "2C", "AC"}, // Same suit + {"3H", "2S", "AH"}, // Red black + {"3D", "2D", "AS"}, // Any suit {} }, { @@ -189,13 +189,13 @@ TEST(BuiltGroupMoveGen, RedBlackOccupied) { sr.built_group_pol = pol::RED_BLACK; sr.move_built_group = true; - test_helper::run_built_group_test( + test_helper::expected_moves_test( sr, { {"4C"}, - {"3C","2C","AC"}, // Same suit - {"3H","2S","AH"}, // Red black - {"3D","2D","AS"}, // Any suit + {"3C", "2C", "AC"}, // Same suit + {"3H", "2S", "AH"}, // Red black + {"3D", "2D", "AS"}, // Any suit {} }, { @@ -220,13 +220,13 @@ TEST(BuiltGroupMoveGen, AnySuitOccupied) { sr.built_group_pol = pol::ANY_SUIT; sr.move_built_group = true; - test_helper::run_built_group_test( + test_helper::expected_moves_test( sr, { {"4C"}, - {"3C","2C","AC"}, // Same suit - {"3H","2S","AH"}, // Red black - {"3D","2D","AS"}, // Any suit + {"3C", "2C", "AC"}, // Same suit + {"3H", "2S", "AH"}, // Red black + {"3D", "2D", "AS"}, // Any suit {} }, { diff --git a/src/test/unit_tests/face_up_cards_test.cpp b/src/test/unit_tests/face_up_cards_test.cpp new file mode 100644 index 0000000..5bf65cb --- /dev/null +++ b/src/test/unit_tests/face_up_cards_test.cpp @@ -0,0 +1,321 @@ +// +// Created by thecharlesblake on 1/11/18. +// + +#include <gtest/gtest.h> + +#include "../test_helper.h" +#include "../../main/game/search-state/game_state.h" +#include "../../main/game/sol_rules.h" +#include "../../main/game/global_cache.h" + +typedef sol_rules::build_policy pol; +typedef sol_rules::face_up_policy fu; +typedef move::mtype mt; + +using std::vector; +using std::ostream; + +typedef std::initializer_list<std::initializer_list<std::string>> string_il; + +#define ASSERT_FACE_UP(card) ASSERT_FALSE(card.is_face_down()) << card.to_string() << " should be face up" +#define ASSERT_FACE_DOWN(card) ASSERT_TRUE(card.is_face_down()) << card.to_string() << " should be face down" + + +TEST(FaceUpCards, CapsFaceUpIfFaceUpNotAll) { + sol_rules sr; + sr.tableau_pile_count = 3; + sr.built_group_pol = pol::SAME_SUIT; + sr.build_pol = pol::SAME_SUIT; + sr.move_built_group = true; + sr.face_up = fu::TOP_CARDS; + + string_il piles = { + {"3S"}, + {"2s","AS"}, + {} + }; + + game_state gs(sr, piles); + + ASSERT_FACE_UP(gs.get_data()[0][0]); + ASSERT_FACE_UP(gs.get_data()[1][0]); + ASSERT_FACE_DOWN(gs.get_data()[1][1]); +} + +TEST(FaceUpCards, IgnoreCapsIfFaceUpAll) { + sol_rules sr; + sr.tableau_pile_count = 3; + sr.built_group_pol = pol::SAME_SUIT; + sr.build_pol = pol::SAME_SUIT; + sr.move_built_group = true; + sr.face_up = fu::ALL; + + string_il piles = { + {"3S"}, + {"2s","AS"}, + {} + }; + + game_state gs(sr, piles); + + ASSERT_FACE_UP(gs.get_data()[0][0]); + ASSERT_FACE_UP(gs.get_data()[1][0]); + ASSERT_FACE_UP(gs.get_data()[1][1]); +} + +TEST(FaceUpCards, MoveTurnsFaceUp) { + sol_rules sr; + sr.tableau_pile_count = 3; + sr.built_group_pol = pol::SAME_SUIT; + sr.build_pol = pol::SAME_SUIT; + sr.move_built_group = true; + sr.face_up = fu::TOP_CARDS; + + string_il piles = { + {"3S"}, + {"2s","AS"}, // from + {} // to + }; + + test_helper::expected_moves_test( + sr, + piles, + { + // Regular moves + move(move::mtype::regular, 0, 2, 1, false), + move(move::mtype::regular, 1, 2, 1, true) + } + ); + + game_state gs(sr, piles); + gs.make_move(move(mt::regular, 1, 2, 1, true)); + + ASSERT_FACE_UP(gs.get_data()[0][0]); + ASSERT_FACE_UP(gs.get_data()[1][0]); + ASSERT_FACE_UP(gs.get_data()[2][0]); +} + +TEST(FaceUpCards, BuiltGroupMoveTurnsFaceUp) { + sol_rules sr; + sr.tableau_pile_count = 2; + sr.built_group_pol = pol::SAME_SUIT; + sr.build_pol = pol::SAME_SUIT; + sr.move_built_group = true; + sr.face_up = fu::TOP_CARDS; + + string_il piles = { + {"3s","2S","AS"}, // from + {} // to + }; + + test_helper::expected_moves_test( + sr, + piles, + { + // Regular moves + move(move::mtype::regular, 0, 1, 1, false), + // Built-group moves + move(move::mtype::built_group, 0, 1, 2, true) + } + ); + + game_state gs(sr, piles); + gs.make_move(move(mt::built_group, 0, 1, 2, true)); + + ASSERT_FACE_UP(gs.get_data()[0][0]); + ASSERT_FACE_UP(gs.get_data()[1][0]); + ASSERT_FACE_UP(gs.get_data()[1][1]); +} + +TEST(FaceUpCards, MoveAlreadyFaceUpNoChange) { + sol_rules sr; + sr.tableau_pile_count = 3; + sr.built_group_pol = pol::SAME_SUIT; + sr.build_pol = pol::SAME_SUIT; + sr.move_built_group = true; + sr.face_up = fu::TOP_CARDS; + + string_il piles = { + {"3S"}, + {"2s","AS"}, // from + {} // to + }; + + test_helper::expected_moves_test( + sr, + piles, + { + // Regular moves + move(move::mtype::regular, 0, 2, 1, false), + move(move::mtype::regular, 1, 2, 1, true) + } + ); + + game_state gs(sr, piles); + gs.make_move(move(mt::regular, 1, 2, 1, true)); + + ASSERT_FACE_UP(gs.get_data()[0][0]); + ASSERT_FACE_UP(gs.get_data()[1][0]); + ASSERT_FACE_UP(gs.get_data()[2][0]); +} + +TEST(FaceUpCards, FaceDownNoBuiltGroup) { + sol_rules sr; + sr.tableau_pile_count = 3; + sr.built_group_pol = pol::SAME_SUIT; + sr.build_pol = pol::SAME_SUIT; + sr.move_built_group = true; + sr.face_up = fu::TOP_CARDS; + + test_helper::expected_moves_test( + sr, + { + {"3S"}, + {"2s","AS"}, + {} + }, + { + // Regular moves + move(move::mtype::regular, 0, 2, 1, false), + move(move::mtype::regular, 1, 2, 1, true), + } + ); +} + +TEST(FaceUpCards, FaceUpBuiltGroup) { + sol_rules sr; + sr.tableau_pile_count = 3; + sr.built_group_pol = pol::SAME_SUIT; + sr.build_pol = pol::SAME_SUIT; + sr.move_built_group = true; + sr.face_up = fu::TOP_CARDS; + + test_helper::expected_moves_test( + sr, + { + {"3S"}, + {"2S","AS"}, + {} + }, + { + // Regular moves + move(mt::regular, 0, 2, 1), + move(mt::regular, 1, 2, 1), + + // Built group moves + move(mt::built_group, 1, 0, 2), + move(mt::built_group, 1, 2, 2) + } + ); +} + +TEST(FaceUpCards, FaceUpBuiltGroup2Not3) { + sol_rules sr; + sr.tableau_pile_count = 3; + sr.built_group_pol = pol::SAME_SUIT; + sr.build_pol = pol::SAME_SUIT; + sr.move_built_group = true; + sr.face_up = fu::TOP_CARDS; + + test_helper::expected_moves_test( + sr, + { + {"4S"}, + {"3s","2S","AS"}, + {} + }, + { + // Regular moves + move(mt::regular, 0, 2, 1, false), + move(mt::regular, 1, 2, 1, false), + + // Built group moves + move(mt::built_group, 1, 2, 2, true) + } + ); +} + +TEST(FaceUpCards, UndoTurnsBackFaceDown) { + sol_rules sr; + sr.tableau_pile_count = 3; + sr.built_group_pol = pol::SAME_SUIT; + sr.build_pol = pol::SAME_SUIT; + sr.move_built_group = true; + sr.face_up = fu::TOP_CARDS; + + string_il piles = { + {"3S"}, + {"2s","AS"}, // from + {} // to + }; + + game_state gs(sr, piles); + move m = move(mt::regular, 1, 2, 1, true); + gs.make_move(m); + gs.undo_move(m); + + ASSERT_FACE_UP(gs.get_data()[0][0]); + ASSERT_FACE_UP(gs.get_data()[1][0]); + ASSERT_FACE_DOWN(gs.get_data()[1][1]); +} + +TEST(FaceUpCards, UndoBuiltGroupTurnsBackFaceDown) { + sol_rules sr; + sr.tableau_pile_count = 3; + sr.built_group_pol = pol::SAME_SUIT; + sr.build_pol = pol::SAME_SUIT; + sr.move_built_group = true; + sr.face_up = fu::TOP_CARDS; + + string_il piles = { + {"4S"}, + {"3s","2S","AS"}, // from + {} // to + }; + + game_state gs(sr, piles); + move m = move(mt::built_group, 1, 2, 2, true); + gs.make_move(m); + gs.undo_move(m); + + ASSERT_FACE_UP(gs.get_data()[0][0]); + ASSERT_FACE_UP(gs.get_data()[1][0]); + ASSERT_FACE_UP(gs.get_data()[1][1]); + ASSERT_FACE_DOWN(gs.get_data()[1][2]); +} + +TEST(FaceUpCards, CacheEncodesFaceDown) { + sol_rules sr; + sr.tableau_pile_count = 3; + sr.built_group_pol = pol::RED_BLACK; + sr.build_pol = pol::RED_BLACK; + sr.move_built_group = true; + sr.face_up = fu::TOP_CARDS; + + string_il piles = { + {"2C"}, + {"2s","AH"}, + {} + }; + + game_state gs(sr, piles); + lru_cache cache(gs, 1000); + bool new_state; + + gs.make_move(move(mt::regular, 1, 2, 1, true)); + new_state = cache.insert(gs).second; + ASSERT_TRUE(new_state) << "AH to empty pile"; + + gs.make_move(move(mt::regular, 2, 1, 1, false)); + new_state = cache.insert(gs).second; + ASSERT_TRUE(new_state) << "AH back to face-up 2S"; + + gs.make_move(move(mt::regular, 1, 0, 1, false)); + new_state = cache.insert(gs).second; + ASSERT_TRUE(new_state) << "AH to 2C"; + + gs.make_move(move(mt::regular, 0, 1, 1, false)); + new_state = cache.insert(gs).second; + ASSERT_FALSE(new_state) << "AH to 2S"; +} diff --git a/src/test/unit_tests/global_cache_test.cpp b/src/test/unit_tests/global_cache_test.cpp index cd3c686..93ef105 100644 --- a/src/test/unit_tests/global_cache_test.cpp +++ b/src/test/unit_tests/global_cache_test.cpp @@ -9,69 +9,70 @@ #include "../../main/game/global_cache.h" typedef sol_rules::build_policy pol; +typedef std::initializer_list<std::initializer_list<std::string>> string_il; TEST(GlobalCache, CommutativeTableauPiles) { sol_rules rules; rules.tableau_pile_count = 3; rules.build_pol = sol_rules::build_policy::SAME_SUIT; - game_state gs(rules, std::initializer_list<pile>{{},{},{}}); + game_state gs(rules, string_il{{},{},{}}); lru_cache cache(gs, 1000); - cache.insert (game_state(rules, {{card("AC")},{card("2D")},{card("3H")}})); - ASSERT_TRUE (cache.contains(game_state(rules, {{card("2D")},{card("3H")},{card("AC")}}))); - ASSERT_FALSE(cache.contains(game_state(rules, {{card("3H")},{card("2D")},{card("3H")}}))); + cache.insert (game_state(rules, {{"AC"},{"2D"},{"3H"}})); + ASSERT_TRUE (cache.contains(game_state(rules, {{"2D"},{"3H"},{"AC"}}))); + ASSERT_FALSE(cache.contains(game_state(rules, {{"3H"},{"2D"},{"3H"}}))); // Test with empty piles cache.clear(); - cache.insert (game_state(rules, {{card("4C")},{card("5D")},{}})); - ASSERT_TRUE (cache.contains(game_state(rules, {{},{card("4C")},{card("5D")}}))); - ASSERT_FALSE(cache.contains(game_state(rules, {{},{card("4C")},{}}))); + cache.insert (game_state(rules, {{"4C"},{"5D"},{}})); + ASSERT_TRUE (cache.contains(game_state(rules, {{},{"4C"},{"5D"}}))); + ASSERT_FALSE(cache.contains(game_state(rules, {{},{"4C"},{}}))); // Test with piles of size > 1 cache.clear(); - cache.insert (game_state(rules, {{card("6C"),card("7D")},{card("8C")},{card("9D")}})); - ASSERT_TRUE (cache.contains(game_state(rules, {{card("8C")},{card("6C"),card("7D")},{card("9D")}}))); - ASSERT_FALSE(cache.contains(game_state(rules, {{card("8C")},{card("6C"),card("KD")},{card("9D")}}))); + cache.insert (game_state(rules, {{"6C","7D"},{"8C"},{"9D"}})); + ASSERT_TRUE (cache.contains(game_state(rules, {{"8C"},{"6C","7D"},{"9D"}}))); + ASSERT_FALSE(cache.contains(game_state(rules, {{"8C"},{"6C","KD"},{"9D"}}))); } TEST(GlobalCache, CommutativeReserve) { sol_rules rules; rules.reserve_size = 3; rules.build_pol = sol_rules::build_policy::SAME_SUIT; - game_state gs(rules, std::initializer_list<pile>{{},{},{}}); + game_state gs(rules, string_il{{},{},{}}); lru_cache cache(gs, 1000); - cache.insert (game_state(rules, {{card("AC")},{card("2D")},{card("3H")}})); - ASSERT_TRUE (cache.contains(game_state(rules, {{card("2D")},{card("3H")},{card("AC")}}))); - ASSERT_FALSE(cache.contains(game_state(rules, {{card("3H")},{card("2D")},{card("3H")}}))); + cache.insert (game_state(rules, {{"AC"},{"2D"},{"3H"}})); + ASSERT_TRUE (cache.contains(game_state(rules, {{"2D"},{"3H"},{"AC"}}))); + ASSERT_FALSE(cache.contains(game_state(rules, {{"3H"},{"2D"},{"3H"}}))); // Test with empty piles cache.clear(); - cache.insert (game_state(rules, {{card("4C")},{card("5D")},{}})); - ASSERT_TRUE (cache.contains(game_state(rules, {{},{card("4C")},{card("5D")}}))); - ASSERT_FALSE(cache.contains(game_state(rules, {{},{card("4C")},{}}))); + cache.insert (game_state(rules, {{"4C"},{"5D"},{}})); + ASSERT_TRUE (cache.contains(game_state(rules, {{},{"4C"},{"5D"}}))); + ASSERT_FALSE(cache.contains(game_state(rules, {{},{"4C"},{}}))); // Test with piles of size > 1 cache.clear(); - cache.insert (game_state(rules, {{card("6C"),card("7D")},{card("8C")},{card("9D")}})); - ASSERT_TRUE (cache.contains(game_state(rules, {{card("8C")},{card("6C"),card("7D")},{card("9D")}}))); - ASSERT_FALSE(cache.contains(game_state(rules, {{card("8C")},{card("6C"),card("KD")},{card("9D")}}))); + cache.insert (game_state(rules, {{"6C","7D"},{"8C"},{"9D"}})); + ASSERT_TRUE (cache.contains(game_state(rules, {{"8C"},{"6C","7D"},{"9D"}}))); + ASSERT_FALSE(cache.contains(game_state(rules, {{"8C"},{"6C","KD"},{"9D"}}))); } TEST(GlobalCache, CommutativeCells) { sol_rules rules; rules.cells = 3; rules.build_pol = sol_rules::build_policy::SAME_SUIT; - game_state gs(rules, std::initializer_list<pile>{{},{},{}}); + game_state gs(rules, string_il{{},{},{}}); lru_cache cache(gs, 1000); - cache.insert (game_state(rules, {{card("AC")},{card("2D")},{card("3H")}})); - ASSERT_TRUE (cache.contains(game_state(rules, {{card("2D")},{card("3H")},{card("AC")}}))); - ASSERT_FALSE(cache.contains(game_state(rules, {{card("3H")},{card("2D")},{card("3H")}}))); + cache.insert (game_state(rules, {{"AC"},{"2D"},{"3H"}})); + ASSERT_TRUE (cache.contains(game_state(rules, {{"2D"},{"3H"},{"AC"}}))); + ASSERT_FALSE(cache.contains(game_state(rules, {{"3H"},{"2D"},{"3H"}}))); // Test with empty piles cache.clear(); - cache.insert (game_state(rules, {{card("4C")},{card("5D")},{}})); - ASSERT_TRUE (cache.contains(game_state(rules, {{},{card("4C")},{card("5D")}}))); - ASSERT_FALSE(cache.contains(game_state(rules, {{},{card("4C")},{}}))); + cache.insert (game_state(rules, {{"4C"},{"5D"},{}})); + ASSERT_TRUE (cache.contains(game_state(rules, {{},{"4C"},{"5D"}}))); + ASSERT_FALSE(cache.contains(game_state(rules, {{},{"4C"},{}}))); } diff --git a/src/test/unit_tests/legal_move_gen_test.cpp b/src/test/unit_tests/legal_move_gen_test.cpp index f9ff52e..6ea73d5 100644 --- a/src/test/unit_tests/legal_move_gen_test.cpp +++ b/src/test/unit_tests/legal_move_gen_test.cpp @@ -15,14 +15,16 @@ typedef sol_rules::stock_deal_type sdt; using std::vector; using std::ostream; -using std::initializer_list; + +typedef std::initializer_list<std::initializer_list<std::string>> string_il; + TEST(LegalMoveGen, BuildPolAnySuit) { sol_rules sr; sr.build_pol = pol::ANY_SUIT; sr.tableau_pile_count = 5; - game_state gs(sr, initializer_list<pile>{ + game_state gs(sr, string_il{ {"2C"}, {"2H"}, {"2D"}, @@ -46,7 +48,7 @@ TEST(LegalMoveGen, BuildPolRedBlack) { sr.build_pol = pol::RED_BLACK; sr.tableau_pile_count = 5; - game_state gs(sr, initializer_list<pile>{ + game_state gs(sr, string_il{ {"2C"}, {"2H"}, {"2S"}, @@ -68,7 +70,7 @@ TEST(LegalMoveGen, BuildPolSameSuit) { sr.build_pol = pol::SAME_SUIT; sr.tableau_pile_count = 5; - game_state gs(sr, initializer_list<pile>{ + game_state gs(sr, string_il{ {"2C"}, {"2H"}, {"2S"}, @@ -89,7 +91,7 @@ TEST(LegalMoveGen, BuildPolNoBuild) { sr.build_pol = pol::NO_BUILD; sr.tableau_pile_count = 5; - game_state gs(sr, initializer_list<pile>{ + game_state gs(sr, string_il{ {"2C"}, {"2H"}, {"2S"}, @@ -109,7 +111,7 @@ TEST(LegalMoveGen, SpacesPolAny) { sr.spaces_pol = s_pol::ANY; sr.tableau_pile_count = 2; - game_state gs(sr, initializer_list<pile>{ + game_state gs(sr, string_il{ {}, {"AC"} }); @@ -127,7 +129,7 @@ TEST(LegalMoveGen, SpacesPolKings) { sr.spaces_pol = s_pol::KINGS; sr.tableau_pile_count = 3; - game_state gs(sr, initializer_list<pile>{ + game_state gs(sr, string_il{ {}, {"AC"}, {"KD"} @@ -146,7 +148,7 @@ TEST(LegalMoveGen, SpacesPolNoBuild) { sr.spaces_pol = s_pol::NO_BUILD; sr.tableau_pile_count = 2; - game_state gs(sr, initializer_list<pile>{ + game_state gs(sr, string_il{ {}, {"AC"} }); @@ -163,7 +165,7 @@ TEST(LegalMoveGen, MoveBuiltGroupTrue) { sr.move_built_group = true; sr.tableau_pile_count = 2; - game_state gs(sr, initializer_list<pile>{ + game_state gs(sr, string_il{ {}, {"2C", "AC"} }); @@ -182,7 +184,7 @@ TEST(LegalMoveGen, MoveBuiltGroupFalse) { sr.move_built_group = false; sr.tableau_pile_count = 2; - game_state gs(sr, initializer_list<pile>{ + game_state gs(sr, string_il{ {}, {"AC", "2C"} }); @@ -200,7 +202,7 @@ TEST(LegalMoveGen, Foundations) { sr.foundations = true; sr.tableau_pile_count = 4; - game_state gs(sr, initializer_list<pile>{ + game_state gs(sr, string_il{ {}, {}, {}, {}, {"AC"}, {"AH"}, @@ -225,7 +227,7 @@ TEST(LegalMoveGen, FoundationsRemovable) { sr.foundations_removable = true; sr.tableau_pile_count = 1; - game_state gs(sr, initializer_list<pile>{ + game_state gs(sr, string_il{ {"AC","2C","3C"}, // Without a few cards here dominance logic blocks {}, // removing from foundation {}, @@ -246,14 +248,13 @@ TEST(LegalMoveGen, Cells) { sr.cells = 2; sr.tableau_pile_count = 1; - game_state gs(sr, initializer_list<pile>{ + game_state gs(sr, string_il{ {"3D"}, {}, // The cells {"4H"} }); vector<move> actual_moves = gs.get_legal_moves(); vector<move> exp_moves = { - move(move::mtype::regular, 0, 1), move(move::mtype::regular, 0, 2), move(move::mtype::regular, 2, 1) }; @@ -268,7 +269,7 @@ TEST(LegalMoveGen, StockDealToWaste) { sr.stock_size = 2; sr.stock_deal_t = sdt::WASTE; - game_state gs(sr, initializer_list<pile>{ + game_state gs(sr, string_il{ {}, {}, {}, {}, // The foundations {"AC", "AD"}, // The stock {}, // The waste @@ -290,7 +291,7 @@ TEST(LegalMoveGen, StockDealToTableau) { sr.stock_size = 2; sr.stock_deal_t = sdt::TABLEAU_PILES; - game_state gs(sr, initializer_list<pile>{ + game_state gs(sr, string_il{ {}, {}, {}, {}, // The foundations {"AC", "AD"}, // The stock {"3H"}, {"5D"}, {"7C"} // The tableau piles |
