From 9ad093dc713f5464181b1018e80ec359ca381bb3 Mon Sep 17 00:00:00 2001 From: thecharlesblake Date: Tue, 2 Jan 2018 11:27:27 +0000 Subject: Add json rules for bakers dozen --- src/test/bakers_dozen_test.cpp | 28 ++++++++++++++++++++++ .../resources/bakers_dozen/ComplexSolvable.json | 7 ++++++ .../resources/bakers_dozen/ComplexUnsolvable.json | 7 ++++++ .../resources/bakers_dozen/SimpleSolvable.json | 7 ++++++ .../resources/bakers_dozen/SimpleUnsolvable.json | 7 ++++++ 5 files changed, 56 insertions(+) create mode 100644 src/test/bakers_dozen_test.cpp create mode 100644 src/test/resources/bakers_dozen/ComplexSolvable.json create mode 100644 src/test/resources/bakers_dozen/ComplexUnsolvable.json create mode 100644 src/test/resources/bakers_dozen/SimpleSolvable.json create mode 100644 src/test/resources/bakers_dozen/SimpleUnsolvable.json (limited to 'src/test') diff --git a/src/test/bakers_dozen_test.cpp b/src/test/bakers_dozen_test.cpp new file mode 100644 index 0000000..8973a53 --- /dev/null +++ b/src/test/bakers_dozen_test.cpp @@ -0,0 +1,28 @@ +// +// Created by thecharlesblake on 10/4/17. +// + +#include + +#include "test_helper.h" + +typedef test_helper th; + +const static std::string path = "resources/spanish_patience/"; +const static std::string type = "simple-spanish-patience"; + +TEST(SpanishPatience, SimpleSolvable) { + EXPECT_TRUE(th::is_solvable(path + "SimpleSolvable.json", type)); +} + +TEST(SpanishPatience, ComplexSolvable) { + EXPECT_TRUE(th::is_solvable(path + "ComplexSolvable.json", type)); +} + +TEST(SpanishPatience, SimpleUnsolvable) { + EXPECT_FALSE(th::is_solvable(path + "SimpleUnsolvable.json", type)); +} + +TEST(SpanishPatience, ComplexUnsolvable) { + EXPECT_FALSE(th::is_solvable(path + "ComplexUnsolvable.json", type)); +} diff --git a/src/test/resources/bakers_dozen/ComplexSolvable.json b/src/test/resources/bakers_dozen/ComplexSolvable.json new file mode 100644 index 0000000..c48ce47 --- /dev/null +++ b/src/test/resources/bakers_dozen/ComplexSolvable.json @@ -0,0 +1,7 @@ +{ + "tableau piles": [ + ["AS", "2S", "AH"], + ["AD", "2D", "2H"], + ["2C", "AC"] + ] +} diff --git a/src/test/resources/bakers_dozen/ComplexUnsolvable.json b/src/test/resources/bakers_dozen/ComplexUnsolvable.json new file mode 100644 index 0000000..ba9be59 --- /dev/null +++ b/src/test/resources/bakers_dozen/ComplexUnsolvable.json @@ -0,0 +1,7 @@ +{ + "tableau piles": [ + ["AS", "2S", "AH"], + ["AD", "2D", "2H"], + ["AC", "2C"] + ] +} diff --git a/src/test/resources/bakers_dozen/SimpleSolvable.json b/src/test/resources/bakers_dozen/SimpleSolvable.json new file mode 100644 index 0000000..eacad0e --- /dev/null +++ b/src/test/resources/bakers_dozen/SimpleSolvable.json @@ -0,0 +1,7 @@ +{ + "tableau piles": [ + ["2S", "AS", "AD"], + ["2D", "2H", "AH"], + ["2C", "AC"] + ] +} diff --git a/src/test/resources/bakers_dozen/SimpleUnsolvable.json b/src/test/resources/bakers_dozen/SimpleUnsolvable.json new file mode 100644 index 0000000..99a3140 --- /dev/null +++ b/src/test/resources/bakers_dozen/SimpleUnsolvable.json @@ -0,0 +1,7 @@ +{ + "tableau piles": [ + ["AS", "2S", "2D"], + ["AD", "AH", "2H"], + ["AC", "2C"] + ] +} -- cgit v1.2.1 From 19d51fbeb4298c3319e5c78f3f2c7f16adbe6388 Mon Sep 17 00:00:00 2001 From: thecharlesblake Date: Tue, 2 Jan 2018 11:28:12 +0000 Subject: Add unit tests for bakers dozen --- src/test/bakers_dozen_test.cpp | 12 ++++++------ src/test/resources/bakers_dozen/ComplexSolvable.json | 8 ++++---- src/test/resources/bakers_dozen/ComplexUnsolvable.json | 8 ++++---- src/test/resources/bakers_dozen/SimpleSolvable.json | 6 +++--- src/test/resources/bakers_dozen/SimpleUnsolvable.json | 6 +++--- 5 files changed, 20 insertions(+), 20 deletions(-) (limited to 'src/test') diff --git a/src/test/bakers_dozen_test.cpp b/src/test/bakers_dozen_test.cpp index 8973a53..0af0669 100644 --- a/src/test/bakers_dozen_test.cpp +++ b/src/test/bakers_dozen_test.cpp @@ -8,21 +8,21 @@ typedef test_helper th; -const static std::string path = "resources/spanish_patience/"; -const static std::string type = "simple-spanish-patience"; +const static std::string path = "resources/bakers_dozen/"; +const static std::string type = "simple-bakers-dozen"; -TEST(SpanishPatience, SimpleSolvable) { +TEST(BakersDozen, SimpleSolvable) { EXPECT_TRUE(th::is_solvable(path + "SimpleSolvable.json", type)); } -TEST(SpanishPatience, ComplexSolvable) { +TEST(BakersDozen, ComplexSolvable) { EXPECT_TRUE(th::is_solvable(path + "ComplexSolvable.json", type)); } -TEST(SpanishPatience, SimpleUnsolvable) { +TEST(BakersDozen, SimpleUnsolvable) { EXPECT_FALSE(th::is_solvable(path + "SimpleUnsolvable.json", type)); } -TEST(SpanishPatience, ComplexUnsolvable) { +TEST(BakersDozen, ComplexUnsolvable) { EXPECT_FALSE(th::is_solvable(path + "ComplexUnsolvable.json", type)); } diff --git a/src/test/resources/bakers_dozen/ComplexSolvable.json b/src/test/resources/bakers_dozen/ComplexSolvable.json index c48ce47..b953413 100644 --- a/src/test/resources/bakers_dozen/ComplexSolvable.json +++ b/src/test/resources/bakers_dozen/ComplexSolvable.json @@ -1,7 +1,7 @@ { "tableau piles": [ - ["AS", "2S", "AH"], - ["AD", "2D", "2H"], - ["2C", "AC"] + ["AC","2S","AS","3H"], + ["AD","2D","2H","AH"], + ["3D","3C","2C","3S"] ] -} +} \ No newline at end of file diff --git a/src/test/resources/bakers_dozen/ComplexUnsolvable.json b/src/test/resources/bakers_dozen/ComplexUnsolvable.json index ba9be59..a8247c4 100644 --- a/src/test/resources/bakers_dozen/ComplexUnsolvable.json +++ b/src/test/resources/bakers_dozen/ComplexUnsolvable.json @@ -1,7 +1,7 @@ { "tableau piles": [ - ["AS", "2S", "AH"], - ["AD", "2D", "2H"], - ["AC", "2C"] + ["AC","2S","AS","3C"], + ["AD","2D","2H","AH"], + ["3D","3H","2C","3S"] ] -} +} \ No newline at end of file diff --git a/src/test/resources/bakers_dozen/SimpleSolvable.json b/src/test/resources/bakers_dozen/SimpleSolvable.json index eacad0e..7c00a71 100644 --- a/src/test/resources/bakers_dozen/SimpleSolvable.json +++ b/src/test/resources/bakers_dozen/SimpleSolvable.json @@ -1,7 +1,7 @@ { "tableau piles": [ - ["2S", "AS", "AD"], - ["2D", "2H", "AH"], - ["2C", "AC"] + ["3S","2S","AS","AD"], + ["3H","2D","2H","AH"], + ["3D","3C","2C","AC"] ] } diff --git a/src/test/resources/bakers_dozen/SimpleUnsolvable.json b/src/test/resources/bakers_dozen/SimpleUnsolvable.json index 99a3140..0b39a8d 100644 --- a/src/test/resources/bakers_dozen/SimpleUnsolvable.json +++ b/src/test/resources/bakers_dozen/SimpleUnsolvable.json @@ -1,7 +1,7 @@ { "tableau piles": [ - ["AS", "2S", "2D"], - ["AD", "AH", "2H"], - ["AC", "2C"] + ["AS","2S","2D","3S"], + ["AD","AH","2H","3H"], + ["AC","2C","3C","3D"] ] } -- cgit v1.2.1 From 77a7aeba7854d15b140cc6dc3c69b15ed5f3b936 Mon Sep 17 00:00:00 2001 From: thecharlesblake Date: Wed, 3 Jan 2018 12:30:14 +0000 Subject: Major refactor, putting pile logic into game_state Much of the logic that was in the pile class was beginning to seem out of place. A lot of the rules have fairly arbitrary interactons *between* piles, which weren't best represented in the pile classes themselves, which were getting unweildy and inefficient. Hence, much of this logic has been moved to the game state class. --- src/test/resources/black_hole/ComplexSolvable.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/test') diff --git a/src/test/resources/black_hole/ComplexSolvable.json b/src/test/resources/black_hole/ComplexSolvable.json index 8d0249d..15488e9 100644 --- a/src/test/resources/black_hole/ComplexSolvable.json +++ b/src/test/resources/black_hole/ComplexSolvable.json @@ -1,8 +1,8 @@ { "tableau piles": [ ["5D","4D","3D","2D","AD"], - ["5C","4C","3C","2C","4H","5H"], - ["AC","AH","2H","3H"], + ["5C","4C","3C","2C","4H"], + ["AC","AH","2H","3H","5H"], ["2S","5S","4S","3S"] ], "hole": "AS" -- cgit v1.2.1 From fa40f6facc5c500cae8bf890e66a7bf5d490387e Mon Sep 17 00:00:00 2001 From: thecharlesblake Date: Wed, 3 Jan 2018 12:39:06 +0000 Subject: Rename util to json_helper --- src/test/test_helper.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/test') diff --git a/src/test/test_helper.cpp b/src/test/test_helper.cpp index 9c258a3..59e7584 100644 --- a/src/test/test_helper.cpp +++ b/src/test/test_helper.cpp @@ -7,13 +7,13 @@ #include "test_helper.h" #include "../main/game/game_state.h" #include "../main/solver/solver.h" -#include "../main/util/util.h" +#include "../main/input-output/json_helper.h" using namespace rapidjson; using namespace std; bool test_helper::is_solvable(const std::string& input_file, const std::string& preset_type) { - const Document in_doc = util::get_file_json(input_file); + const Document in_doc = json_helper::get_file_json(input_file); const sol_rules rules = sol_rules::from_preset(preset_type); game_state gs(rules, in_doc); -- cgit v1.2.1 From 758d919cb5d600a421636ce54df9f28b6fc832ba Mon Sep 17 00:00:00 2001 From: thecharlesblake Date: Wed, 3 Jan 2018 12:51:47 +0000 Subject: Refactor sol_rules into seperate parser class --- src/test/test_helper.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src/test') diff --git a/src/test/test_helper.cpp b/src/test/test_helper.cpp index 59e7584..117273c 100644 --- a/src/test/test_helper.cpp +++ b/src/test/test_helper.cpp @@ -8,16 +8,17 @@ #include "../main/game/game_state.h" #include "../main/solver/solver.h" #include "../main/input-output/json_helper.h" +#include "../main/input-output/rules_parser.h" using namespace rapidjson; using namespace std; bool test_helper::is_solvable(const std::string& input_file, const std::string& preset_type) { const Document in_doc = json_helper::get_file_json(input_file); - const sol_rules rules = sol_rules::from_preset(preset_type); + const sol_rules rules = rules_parser::from_preset(preset_type); game_state gs(rules, in_doc); solver sol(gs, rules); - return sol.run() ? true : false; + return sol.run(); } -- cgit v1.2.1 From 7f4712b292632becfc83bc0e887271b25fefd21a Mon Sep 17 00:00:00 2001 From: thecharlesblake Date: Wed, 3 Jan 2018 13:05:31 +0000 Subject: Refactor io dir structure --- src/test/test_helper.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/test') diff --git a/src/test/test_helper.cpp b/src/test/test_helper.cpp index 117273c..14218f7 100644 --- a/src/test/test_helper.cpp +++ b/src/test/test_helper.cpp @@ -7,8 +7,8 @@ #include "test_helper.h" #include "../main/game/game_state.h" #include "../main/solver/solver.h" -#include "../main/input-output/json_helper.h" -#include "../main/input-output/rules_parser.h" +#include "../main/input-output/input/json-parsing/json_helper.h" +#include "../main/input-output/input/json-parsing/rules_parser.h" using namespace rapidjson; using namespace std; -- cgit v1.2.1 From 6ce3b5a142b3e357eeabde37368915e8ef916f3d Mon Sep 17 00:00:00 2001 From: thecharlesblake Date: Thu, 4 Jan 2018 11:38:36 +0000 Subject: Add json rules for fortunes favor --- src/test/fortunes_favor_test.cpp | 28 ++++++++++++++++++++++ .../resources/fortunes_favor/ComplexSolvable.json | 7 ++++++ .../fortunes_favor/ComplexUnsolvable.json | 7 ++++++ .../resources/fortunes_favor/SimpleSolvable.json | 7 ++++++ .../resources/fortunes_favor/SimpleUnsolvable.json | 7 ++++++ 5 files changed, 56 insertions(+) create mode 100644 src/test/fortunes_favor_test.cpp create mode 100644 src/test/resources/fortunes_favor/ComplexSolvable.json create mode 100644 src/test/resources/fortunes_favor/ComplexUnsolvable.json create mode 100644 src/test/resources/fortunes_favor/SimpleSolvable.json create mode 100644 src/test/resources/fortunes_favor/SimpleUnsolvable.json (limited to 'src/test') diff --git a/src/test/fortunes_favor_test.cpp b/src/test/fortunes_favor_test.cpp new file mode 100644 index 0000000..8973a53 --- /dev/null +++ b/src/test/fortunes_favor_test.cpp @@ -0,0 +1,28 @@ +// +// Created by thecharlesblake on 10/4/17. +// + +#include + +#include "test_helper.h" + +typedef test_helper th; + +const static std::string path = "resources/spanish_patience/"; +const static std::string type = "simple-spanish-patience"; + +TEST(SpanishPatience, SimpleSolvable) { + EXPECT_TRUE(th::is_solvable(path + "SimpleSolvable.json", type)); +} + +TEST(SpanishPatience, ComplexSolvable) { + EXPECT_TRUE(th::is_solvable(path + "ComplexSolvable.json", type)); +} + +TEST(SpanishPatience, SimpleUnsolvable) { + EXPECT_FALSE(th::is_solvable(path + "SimpleUnsolvable.json", type)); +} + +TEST(SpanishPatience, ComplexUnsolvable) { + EXPECT_FALSE(th::is_solvable(path + "ComplexUnsolvable.json", type)); +} diff --git a/src/test/resources/fortunes_favor/ComplexSolvable.json b/src/test/resources/fortunes_favor/ComplexSolvable.json new file mode 100644 index 0000000..c48ce47 --- /dev/null +++ b/src/test/resources/fortunes_favor/ComplexSolvable.json @@ -0,0 +1,7 @@ +{ + "tableau piles": [ + ["AS", "2S", "AH"], + ["AD", "2D", "2H"], + ["2C", "AC"] + ] +} diff --git a/src/test/resources/fortunes_favor/ComplexUnsolvable.json b/src/test/resources/fortunes_favor/ComplexUnsolvable.json new file mode 100644 index 0000000..ba9be59 --- /dev/null +++ b/src/test/resources/fortunes_favor/ComplexUnsolvable.json @@ -0,0 +1,7 @@ +{ + "tableau piles": [ + ["AS", "2S", "AH"], + ["AD", "2D", "2H"], + ["AC", "2C"] + ] +} diff --git a/src/test/resources/fortunes_favor/SimpleSolvable.json b/src/test/resources/fortunes_favor/SimpleSolvable.json new file mode 100644 index 0000000..eacad0e --- /dev/null +++ b/src/test/resources/fortunes_favor/SimpleSolvable.json @@ -0,0 +1,7 @@ +{ + "tableau piles": [ + ["2S", "AS", "AD"], + ["2D", "2H", "AH"], + ["2C", "AC"] + ] +} diff --git a/src/test/resources/fortunes_favor/SimpleUnsolvable.json b/src/test/resources/fortunes_favor/SimpleUnsolvable.json new file mode 100644 index 0000000..99a3140 --- /dev/null +++ b/src/test/resources/fortunes_favor/SimpleUnsolvable.json @@ -0,0 +1,7 @@ +{ + "tableau piles": [ + ["AS", "2S", "2D"], + ["AD", "AH", "2H"], + ["AC", "2C"] + ] +} -- cgit v1.2.1 From 21a73053795c19a78de30304115a89d7b8c20e4b Mon Sep 17 00:00:00 2001 From: thecharlesblake Date: Thu, 4 Jan 2018 11:39:32 +0000 Subject: Add unit tests for fortunes favor --- src/test/fortunes_favor_test.cpp | 12 ++++++------ src/test/resources/fortunes_favor/ComplexSolvable.json | 9 +++++---- src/test/resources/fortunes_favor/ComplexUnsolvable.json | 9 +++++---- src/test/resources/fortunes_favor/SimpleSolvable.json | 9 +++++---- src/test/resources/fortunes_favor/SimpleUnsolvable.json | 9 +++++---- 5 files changed, 26 insertions(+), 22 deletions(-) (limited to 'src/test') diff --git a/src/test/fortunes_favor_test.cpp b/src/test/fortunes_favor_test.cpp index 8973a53..eab2e7e 100644 --- a/src/test/fortunes_favor_test.cpp +++ b/src/test/fortunes_favor_test.cpp @@ -8,21 +8,21 @@ typedef test_helper th; -const static std::string path = "resources/spanish_patience/"; -const static std::string type = "simple-spanish-patience"; +const static std::string path = "resources/fortunes_favor/"; +const static std::string type = "simple-fortunes-favor"; -TEST(SpanishPatience, SimpleSolvable) { +TEST(FortunesFavor, SimpleSolvable) { EXPECT_TRUE(th::is_solvable(path + "SimpleSolvable.json", type)); } -TEST(SpanishPatience, ComplexSolvable) { +TEST(FortunesFavor, ComplexSolvable) { EXPECT_TRUE(th::is_solvable(path + "ComplexSolvable.json", type)); } -TEST(SpanishPatience, SimpleUnsolvable) { +TEST(FortunesFavor, SimpleUnsolvable) { EXPECT_FALSE(th::is_solvable(path + "SimpleUnsolvable.json", type)); } -TEST(SpanishPatience, ComplexUnsolvable) { +TEST(FortunesFavor, ComplexUnsolvable) { EXPECT_FALSE(th::is_solvable(path + "ComplexUnsolvable.json", type)); } diff --git a/src/test/resources/fortunes_favor/ComplexSolvable.json b/src/test/resources/fortunes_favor/ComplexSolvable.json index c48ce47..f00d600 100644 --- a/src/test/resources/fortunes_favor/ComplexSolvable.json +++ b/src/test/resources/fortunes_favor/ComplexSolvable.json @@ -1,7 +1,8 @@ { "tableau piles": [ - ["AS", "2S", "AH"], - ["AD", "2D", "2H"], - ["2C", "AC"] - ] + ["2C","2D","4H"], + ["4C","3D","3H"], + ["2S","3C","4D"] + ], + "stock": ["2H","3S","4S"] } diff --git a/src/test/resources/fortunes_favor/ComplexUnsolvable.json b/src/test/resources/fortunes_favor/ComplexUnsolvable.json index ba9be59..4f54b94 100644 --- a/src/test/resources/fortunes_favor/ComplexUnsolvable.json +++ b/src/test/resources/fortunes_favor/ComplexUnsolvable.json @@ -1,7 +1,8 @@ { "tableau piles": [ - ["AS", "2S", "AH"], - ["AD", "2D", "2H"], - ["AC", "2C"] - ] + ["2H","2D","4H"], + ["2C","3D","3H"], + ["2S","3C","4D"] + ], + "stock": ["4C","3S","4S"] } diff --git a/src/test/resources/fortunes_favor/SimpleSolvable.json b/src/test/resources/fortunes_favor/SimpleSolvable.json index eacad0e..0891746 100644 --- a/src/test/resources/fortunes_favor/SimpleSolvable.json +++ b/src/test/resources/fortunes_favor/SimpleSolvable.json @@ -1,7 +1,8 @@ { "tableau piles": [ - ["2S", "AS", "AD"], - ["2D", "2H", "AH"], - ["2C", "AC"] - ] + ["2C","2D","2H"], + ["3C","3D","3H"], + ["4C","4D","4H"] + ], + "stock": ["4S","3S","2S"] } diff --git a/src/test/resources/fortunes_favor/SimpleUnsolvable.json b/src/test/resources/fortunes_favor/SimpleUnsolvable.json index 99a3140..44d7359 100644 --- a/src/test/resources/fortunes_favor/SimpleUnsolvable.json +++ b/src/test/resources/fortunes_favor/SimpleUnsolvable.json @@ -1,7 +1,8 @@ { "tableau piles": [ - ["AS", "2S", "2D"], - ["AD", "AH", "2H"], - ["AC", "2C"] - ] + ["2C","2D","3C"], + ["2H","3D","3H"], + ["2S","4D","4H"] + ], + "stock": ["4C","3S","4S"] } -- cgit v1.2.1 From e28645b3a2b610c1c95ed8f7553e336354b7d17f Mon Sep 17 00:00:00 2001 From: thecharlesblake Date: Thu, 4 Jan 2018 11:48:41 +0000 Subject: Add fortunes favor to benchmark script --- src/test/flower_garden_test.cpp | 28 ++++++++++++++++++++++ .../resources/flower_garden/ComplexSolvable.json | 8 +++++++ .../resources/flower_garden/ComplexUnsolvable.json | 8 +++++++ .../resources/flower_garden/SimpleSolvable.json | 8 +++++++ .../resources/flower_garden/SimpleUnsolvable.json | 8 +++++++ 5 files changed, 60 insertions(+) create mode 100644 src/test/flower_garden_test.cpp create mode 100644 src/test/resources/flower_garden/ComplexSolvable.json create mode 100644 src/test/resources/flower_garden/ComplexUnsolvable.json create mode 100644 src/test/resources/flower_garden/SimpleSolvable.json create mode 100644 src/test/resources/flower_garden/SimpleUnsolvable.json (limited to 'src/test') diff --git a/src/test/flower_garden_test.cpp b/src/test/flower_garden_test.cpp new file mode 100644 index 0000000..eab2e7e --- /dev/null +++ b/src/test/flower_garden_test.cpp @@ -0,0 +1,28 @@ +// +// Created by thecharlesblake on 10/4/17. +// + +#include + +#include "test_helper.h" + +typedef test_helper th; + +const static std::string path = "resources/fortunes_favor/"; +const static std::string type = "simple-fortunes-favor"; + +TEST(FortunesFavor, SimpleSolvable) { + EXPECT_TRUE(th::is_solvable(path + "SimpleSolvable.json", type)); +} + +TEST(FortunesFavor, ComplexSolvable) { + EXPECT_TRUE(th::is_solvable(path + "ComplexSolvable.json", type)); +} + +TEST(FortunesFavor, SimpleUnsolvable) { + EXPECT_FALSE(th::is_solvable(path + "SimpleUnsolvable.json", type)); +} + +TEST(FortunesFavor, ComplexUnsolvable) { + EXPECT_FALSE(th::is_solvable(path + "ComplexUnsolvable.json", type)); +} diff --git a/src/test/resources/flower_garden/ComplexSolvable.json b/src/test/resources/flower_garden/ComplexSolvable.json new file mode 100644 index 0000000..f00d600 --- /dev/null +++ b/src/test/resources/flower_garden/ComplexSolvable.json @@ -0,0 +1,8 @@ +{ + "tableau piles": [ + ["2C","2D","4H"], + ["4C","3D","3H"], + ["2S","3C","4D"] + ], + "stock": ["2H","3S","4S"] +} diff --git a/src/test/resources/flower_garden/ComplexUnsolvable.json b/src/test/resources/flower_garden/ComplexUnsolvable.json new file mode 100644 index 0000000..4f54b94 --- /dev/null +++ b/src/test/resources/flower_garden/ComplexUnsolvable.json @@ -0,0 +1,8 @@ +{ + "tableau piles": [ + ["2H","2D","4H"], + ["2C","3D","3H"], + ["2S","3C","4D"] + ], + "stock": ["4C","3S","4S"] +} diff --git a/src/test/resources/flower_garden/SimpleSolvable.json b/src/test/resources/flower_garden/SimpleSolvable.json new file mode 100644 index 0000000..0891746 --- /dev/null +++ b/src/test/resources/flower_garden/SimpleSolvable.json @@ -0,0 +1,8 @@ +{ + "tableau piles": [ + ["2C","2D","2H"], + ["3C","3D","3H"], + ["4C","4D","4H"] + ], + "stock": ["4S","3S","2S"] +} diff --git a/src/test/resources/flower_garden/SimpleUnsolvable.json b/src/test/resources/flower_garden/SimpleUnsolvable.json new file mode 100644 index 0000000..44d7359 --- /dev/null +++ b/src/test/resources/flower_garden/SimpleUnsolvable.json @@ -0,0 +1,8 @@ +{ + "tableau piles": [ + ["2C","2D","3C"], + ["2H","3D","3H"], + ["2S","4D","4H"] + ], + "stock": ["4C","3S","4S"] +} -- cgit v1.2.1 From 1a262ef15c0f00ec756aa40952a3281204636ad9 Mon Sep 17 00:00:00 2001 From: thecharlesblake Date: Thu, 4 Jan 2018 15:45:23 +0000 Subject: Add unit tests for flower garden --- src/test/flower_garden_test.cpp | 12 ++++++------ src/test/resources/flower_garden/ComplexSolvable.json | 8 ++++---- src/test/resources/flower_garden/ComplexUnsolvable.json | 8 ++++---- src/test/resources/flower_garden/SimpleSolvable.json | 8 ++++---- src/test/resources/flower_garden/SimpleUnsolvable.json | 10 +++++----- 5 files changed, 23 insertions(+), 23 deletions(-) (limited to 'src/test') diff --git a/src/test/flower_garden_test.cpp b/src/test/flower_garden_test.cpp index eab2e7e..b1aee9e 100644 --- a/src/test/flower_garden_test.cpp +++ b/src/test/flower_garden_test.cpp @@ -8,21 +8,21 @@ typedef test_helper th; -const static std::string path = "resources/fortunes_favor/"; -const static std::string type = "simple-fortunes-favor"; +const static std::string path = "resources/flower_garden/"; +const static std::string type = "simple-flower-garden"; -TEST(FortunesFavor, SimpleSolvable) { +TEST(FlowerGarden, SimpleSolvable) { EXPECT_TRUE(th::is_solvable(path + "SimpleSolvable.json", type)); } -TEST(FortunesFavor, ComplexSolvable) { +TEST(FlowerGarden, ComplexSolvable) { EXPECT_TRUE(th::is_solvable(path + "ComplexSolvable.json", type)); } -TEST(FortunesFavor, SimpleUnsolvable) { +TEST(FlowerGarden, SimpleUnsolvable) { EXPECT_FALSE(th::is_solvable(path + "SimpleUnsolvable.json", type)); } -TEST(FortunesFavor, ComplexUnsolvable) { +TEST(FlowerGarden, ComplexUnsolvable) { EXPECT_FALSE(th::is_solvable(path + "ComplexUnsolvable.json", type)); } diff --git a/src/test/resources/flower_garden/ComplexSolvable.json b/src/test/resources/flower_garden/ComplexSolvable.json index f00d600..1f1a6e6 100644 --- a/src/test/resources/flower_garden/ComplexSolvable.json +++ b/src/test/resources/flower_garden/ComplexSolvable.json @@ -1,8 +1,8 @@ { "tableau piles": [ - ["2C","2D","4H"], - ["4C","3D","3H"], - ["2S","3C","4D"] + ["AH","2D","AC"], + ["AD","2C","3D"], + ["2H","AS","3H"] ], - "stock": ["2H","3S","4S"] + "reserve": ["3C","2S","3S"] } diff --git a/src/test/resources/flower_garden/ComplexUnsolvable.json b/src/test/resources/flower_garden/ComplexUnsolvable.json index 4f54b94..be0ca64 100644 --- a/src/test/resources/flower_garden/ComplexUnsolvable.json +++ b/src/test/resources/flower_garden/ComplexUnsolvable.json @@ -1,8 +1,8 @@ { "tableau piles": [ - ["2H","2D","4H"], - ["2C","3D","3H"], - ["2S","3C","4D"] + ["2H","2D","AC"], + ["AD","2C","3D"], + ["AH","AS","3H"] ], - "stock": ["4C","3S","4S"] + "reserve": ["3C","2S","3S"] } diff --git a/src/test/resources/flower_garden/SimpleSolvable.json b/src/test/resources/flower_garden/SimpleSolvable.json index 0891746..18c680d 100644 --- a/src/test/resources/flower_garden/SimpleSolvable.json +++ b/src/test/resources/flower_garden/SimpleSolvable.json @@ -1,8 +1,8 @@ { "tableau piles": [ - ["2C","2D","2H"], - ["3C","3D","3H"], - ["4C","4D","4H"] + ["3C","2C","AC"], + ["3D","2D","AD"], + ["3H","3S","AH"] ], - "stock": ["4S","3S","2S"] + "reserve": ["2H","2S","AS"] } diff --git a/src/test/resources/flower_garden/SimpleUnsolvable.json b/src/test/resources/flower_garden/SimpleUnsolvable.json index 44d7359..e57e9ca 100644 --- a/src/test/resources/flower_garden/SimpleUnsolvable.json +++ b/src/test/resources/flower_garden/SimpleUnsolvable.json @@ -1,8 +1,8 @@ { "tableau piles": [ - ["2C","2D","3C"], - ["2H","3D","3H"], - ["2S","4D","4H"] + ["AC","2C","3C"], + ["AD","2D","3D"], + ["AH","AS","3H"] ], - "stock": ["4C","3S","4S"] -} + "reserve": ["2H","2S","3S"] +} \ No newline at end of file -- cgit v1.2.1 From e9678bfc154aaf59c9c7c965d99fd50de8532cce Mon Sep 17 00:00:00 2001 From: thecharlesblake Date: Fri, 5 Jan 2018 15:54:04 +0000 Subject: Add unit tests for canfield --- src/test/canfield_test.cpp | 28 ++++++++++++++++++++++ src/test/resources/canfield/ComplexSolvable.json | 9 +++++++ src/test/resources/canfield/ComplexUnsolvable.json | 9 +++++++ src/test/resources/canfield/SimpleSolvable.json | 9 +++++++ src/test/resources/canfield/SimpleUnsolvable.json | 9 +++++++ 5 files changed, 64 insertions(+) create mode 100644 src/test/canfield_test.cpp create mode 100644 src/test/resources/canfield/ComplexSolvable.json create mode 100644 src/test/resources/canfield/ComplexUnsolvable.json create mode 100644 src/test/resources/canfield/SimpleSolvable.json create mode 100644 src/test/resources/canfield/SimpleUnsolvable.json (limited to 'src/test') diff --git a/src/test/canfield_test.cpp b/src/test/canfield_test.cpp new file mode 100644 index 0000000..63fd615 --- /dev/null +++ b/src/test/canfield_test.cpp @@ -0,0 +1,28 @@ +// +// Created by thecharlesblake on 10/4/17. +// + +#include + +#include "test_helper.h" + +typedef test_helper th; + +const static std::string path = "resources/canfield/"; +const static std::string type = "simple-canfield"; + +TEST(Canfield, SimpleSolvable) { + EXPECT_TRUE(th::is_solvable(path + "SimpleSolvable.json", type)); +} + +TEST(Canfield, ComplexSolvable) { + EXPECT_TRUE(th::is_solvable(path + "ComplexSolvable.json", type)); +} + +TEST(Canfield, SimpleUnsolvable) { + EXPECT_FALSE(th::is_solvable(path + "SimpleUnsolvable.json", type)); +} + +TEST(Canfield, ComplexUnsolvable) { + EXPECT_FALSE(th::is_solvable(path + "ComplexUnsolvable.json", type)); +} diff --git a/src/test/resources/canfield/ComplexSolvable.json b/src/test/resources/canfield/ComplexSolvable.json new file mode 100644 index 0000000..b5c9253 --- /dev/null +++ b/src/test/resources/canfield/ComplexSolvable.json @@ -0,0 +1,9 @@ +{ + "tableau piles": [ + ["AC","2C","3C"], + ["AD","2D","3D"], + ["3S","AS","3H"] + ], + "stock": ["2H"], + "reserve": ["AH","2S"] +} \ No newline at end of file diff --git a/src/test/resources/canfield/ComplexUnsolvable.json b/src/test/resources/canfield/ComplexUnsolvable.json new file mode 100644 index 0000000..9391caf --- /dev/null +++ b/src/test/resources/canfield/ComplexUnsolvable.json @@ -0,0 +1,9 @@ +{ + "tableau piles": [ + ["AC","2H","2D"], + ["AD","3D","3C"], + ["2S","AS","3H"] + ], + "stock": ["2C"], + "reserve": ["AH","3S"] +} \ No newline at end of file diff --git a/src/test/resources/canfield/SimpleSolvable.json b/src/test/resources/canfield/SimpleSolvable.json new file mode 100644 index 0000000..4e998ea --- /dev/null +++ b/src/test/resources/canfield/SimpleSolvable.json @@ -0,0 +1,9 @@ +{ + "tableau piles": [ + ["3C","2C","AC"], + ["3D","2D","AD"], + ["3H","3S","AH"] + ], + "stock": ["2H"], + "reserve": ["2S","AS"] +} diff --git a/src/test/resources/canfield/SimpleUnsolvable.json b/src/test/resources/canfield/SimpleUnsolvable.json new file mode 100644 index 0000000..e8a1e3e --- /dev/null +++ b/src/test/resources/canfield/SimpleUnsolvable.json @@ -0,0 +1,9 @@ +{ + "tableau piles": [ + ["AC","2C","3C"], + ["AD","2D","3D"], + ["AH","AS","3H"] + ], + "stock": ["2H"], + "reserve": ["2S","3S"] +} \ No newline at end of file -- cgit v1.2.1 From cc9a9721d3a7bdbbcc055986c014a0665d5b3e63 Mon Sep 17 00:00:00 2001 From: thecharlesblake Date: Fri, 5 Jan 2018 18:01:17 +0000 Subject: Add unit tests for somerset --- src/test/resources/somerset/ComplexSolvable.json | 8 +++++++ src/test/resources/somerset/ComplexUnsolvable.json | 8 +++++++ src/test/resources/somerset/SimpleSolvable.json | 8 +++++++ src/test/resources/somerset/SimpleUnsolvable.json | 8 +++++++ src/test/somerset_test.cpp | 28 ++++++++++++++++++++++ 5 files changed, 60 insertions(+) create mode 100644 src/test/resources/somerset/ComplexSolvable.json create mode 100644 src/test/resources/somerset/ComplexUnsolvable.json create mode 100644 src/test/resources/somerset/SimpleSolvable.json create mode 100644 src/test/resources/somerset/SimpleUnsolvable.json create mode 100644 src/test/somerset_test.cpp (limited to 'src/test') diff --git a/src/test/resources/somerset/ComplexSolvable.json b/src/test/resources/somerset/ComplexSolvable.json new file mode 100644 index 0000000..b316c50 --- /dev/null +++ b/src/test/resources/somerset/ComplexSolvable.json @@ -0,0 +1,8 @@ +{ + "tableau piles": [ + ["2S","2C","AC"], + ["2D","AD"], + ["2H","AH"], + ["AS"] + ] +} diff --git a/src/test/resources/somerset/ComplexUnsolvable.json b/src/test/resources/somerset/ComplexUnsolvable.json new file mode 100644 index 0000000..09d7864 --- /dev/null +++ b/src/test/resources/somerset/ComplexUnsolvable.json @@ -0,0 +1,8 @@ +{ + "tableau piles": [ + ["AS","AC","2C"], + ["AD","2D"], + ["AH","2H"], + ["2S"] + ] +} diff --git a/src/test/resources/somerset/SimpleSolvable.json b/src/test/resources/somerset/SimpleSolvable.json new file mode 100644 index 0000000..b316c50 --- /dev/null +++ b/src/test/resources/somerset/SimpleSolvable.json @@ -0,0 +1,8 @@ +{ + "tableau piles": [ + ["2S","2C","AC"], + ["2D","AD"], + ["2H","AH"], + ["AS"] + ] +} diff --git a/src/test/resources/somerset/SimpleUnsolvable.json b/src/test/resources/somerset/SimpleUnsolvable.json new file mode 100644 index 0000000..09d7864 --- /dev/null +++ b/src/test/resources/somerset/SimpleUnsolvable.json @@ -0,0 +1,8 @@ +{ + "tableau piles": [ + ["AS","AC","2C"], + ["AD","2D"], + ["AH","2H"], + ["2S"] + ] +} diff --git a/src/test/somerset_test.cpp b/src/test/somerset_test.cpp new file mode 100644 index 0000000..22cfe5a --- /dev/null +++ b/src/test/somerset_test.cpp @@ -0,0 +1,28 @@ +// +// Created by thecharlesblake on 10/4/17. +// + +#include + +#include "test_helper.h" + +typedef test_helper th; + +const static std::string path = "resources/somerset/"; +const static std::string type = "simple-somerset"; + +TEST(Somerset, SimpleSolvable) { + EXPECT_TRUE(th::is_solvable(path + "SimpleSolvable.json", type)); +} + +TEST(Somerset, ComplexSolvable) { + EXPECT_TRUE(th::is_solvable(path + "ComplexSolvable.json", type)); +} + +TEST(Somerset, SimpleUnsolvable) { + EXPECT_FALSE(th::is_solvable(path + "SimpleUnsolvable.json", type)); +} + +TEST(Somerset, ComplexUnsolvable) { + EXPECT_FALSE(th::is_solvable(path + "ComplexUnsolvable.json", type)); +} -- cgit v1.2.1 From 02e332eb50cbf8115f28f3277c3938fe317fae65 Mon Sep 17 00:00:00 2001 From: thecharlesblake Date: Mon, 8 Jan 2018 18:57:33 +0000 Subject: Add unit tests for alpha star --- src/test/alpha_star_test.cpp | 28 ++++++++++++++++++++++ src/test/resources/alpha_star/ComplexSolvable.json | 7 ++++++ .../resources/alpha_star/ComplexUnsolvable.json | 7 ++++++ src/test/resources/alpha_star/SimpleSolvable.json | 7 ++++++ .../resources/alpha_star/SimpleUnsolvable.json | 7 ++++++ 5 files changed, 56 insertions(+) create mode 100644 src/test/alpha_star_test.cpp create mode 100644 src/test/resources/alpha_star/ComplexSolvable.json create mode 100644 src/test/resources/alpha_star/ComplexUnsolvable.json create mode 100644 src/test/resources/alpha_star/SimpleSolvable.json create mode 100644 src/test/resources/alpha_star/SimpleUnsolvable.json (limited to 'src/test') diff --git a/src/test/alpha_star_test.cpp b/src/test/alpha_star_test.cpp new file mode 100644 index 0000000..eeff1be --- /dev/null +++ b/src/test/alpha_star_test.cpp @@ -0,0 +1,28 @@ +// +// Created by thecharlesblake on 10/4/17. +// + +#include + +#include "test_helper.h" + +typedef test_helper th; + +const static std::string path = "resources/alpha_star/"; +const static std::string type = "simple-alpha-star"; + +TEST(AlphaStar, SimpleSolvable) { + EXPECT_TRUE(th::is_solvable(path + "SimpleSolvable.json", type)); +} + +TEST(AlphaStar, ComplexSolvable) { + EXPECT_TRUE(th::is_solvable(path + "ComplexSolvable.json", type)); +} + +TEST(AlphaStar, SimpleUnsolvable) { + EXPECT_FALSE(th::is_solvable(path + "SimpleUnsolvable.json", type)); +} + +TEST(AlphaStar, ComplexUnsolvable) { + EXPECT_FALSE(th::is_solvable(path + "ComplexUnsolvable.json", type)); +} diff --git a/src/test/resources/alpha_star/ComplexSolvable.json b/src/test/resources/alpha_star/ComplexSolvable.json new file mode 100644 index 0000000..e7eedd5 --- /dev/null +++ b/src/test/resources/alpha_star/ComplexSolvable.json @@ -0,0 +1,7 @@ +{ + "tableau piles": [ + ["3S","2C","3C","5C","5H","4H"], + ["4S","4C","5S","2D","5D"], + ["2S","2H","3H","4D","3D"] + ] +} \ No newline at end of file diff --git a/src/test/resources/alpha_star/ComplexUnsolvable.json b/src/test/resources/alpha_star/ComplexUnsolvable.json new file mode 100644 index 0000000..a01f2b5 --- /dev/null +++ b/src/test/resources/alpha_star/ComplexUnsolvable.json @@ -0,0 +1,7 @@ +{ + "tableau piles": [ + ["2S","2C","3C","5C","5H","4H"], + ["4S","4C","5S","2D","5D"], + ["3S","2H","3H","4D","3D"] + ] +} diff --git a/src/test/resources/alpha_star/SimpleSolvable.json b/src/test/resources/alpha_star/SimpleSolvable.json new file mode 100644 index 0000000..d160e42 --- /dev/null +++ b/src/test/resources/alpha_star/SimpleSolvable.json @@ -0,0 +1,7 @@ +{ + "tableau piles": [ + ["5S","5C","4C","3C","2S","2C"], + ["5D","4D","3S","3D","2D"], + ["5H","4S","4H","3H","2H"] + ] +} diff --git a/src/test/resources/alpha_star/SimpleUnsolvable.json b/src/test/resources/alpha_star/SimpleUnsolvable.json new file mode 100644 index 0000000..1097473 --- /dev/null +++ b/src/test/resources/alpha_star/SimpleUnsolvable.json @@ -0,0 +1,7 @@ +{ + "tableau piles": [ + ["2S","2C","3C","4C","5S","5C"], + ["2D","3D","4S","4D","5D"], + ["2H","3S","3H","4H","5H"] + ] +} \ No newline at end of file -- cgit v1.2.1 From 2a05e7357744331b7a0c316a72c01508f0199d6a Mon Sep 17 00:00:00 2001 From: thecharlesblake Date: Tue, 9 Jan 2018 08:51:43 +0000 Subject: Add unit tests for spider --- src/test/resources/spider/ComplexSolvable.json | 13 +++++++++++ src/test/resources/spider/ComplexUnsolvable.json | 13 +++++++++++ src/test/resources/spider/SimpleSolvable.json | 14 ++++++++++++ src/test/resources/spider/SimpleUnsolvable.json | 13 +++++++++++ src/test/spider_test.cpp | 28 ++++++++++++++++++++++++ 5 files changed, 81 insertions(+) create mode 100644 src/test/resources/spider/ComplexSolvable.json create mode 100644 src/test/resources/spider/ComplexUnsolvable.json create mode 100644 src/test/resources/spider/SimpleSolvable.json create mode 100644 src/test/resources/spider/SimpleUnsolvable.json create mode 100644 src/test/spider_test.cpp (limited to 'src/test') diff --git a/src/test/resources/spider/ComplexSolvable.json b/src/test/resources/spider/ComplexSolvable.json new file mode 100644 index 0000000..3591805 --- /dev/null +++ b/src/test/resources/spider/ComplexSolvable.json @@ -0,0 +1,13 @@ +{ + "tableau piles": [ + ["2D","AD","3D"], + ["AC","2C","3C"], + ["AS","2S","3S"], + ["AH","2H","3H"] + ], + "stock": [ + "2C","2D","2H","2S", + "AC","AD","AH","AS", + "3C","3D","3H","3S" + ] +} diff --git a/src/test/resources/spider/ComplexUnsolvable.json b/src/test/resources/spider/ComplexUnsolvable.json new file mode 100644 index 0000000..8fce03d --- /dev/null +++ b/src/test/resources/spider/ComplexUnsolvable.json @@ -0,0 +1,13 @@ +{ + "tableau piles": [ + ["2D","AD","3D"], + ["AC","AC","3C"], + ["AS","AS","3S"], + ["AH","AH","3H"] + ], + "stock": [ + "2C","2D","2H","2S", + "AC","2D","2H","2S", + "3C","3D","3H","3S" + ] +} diff --git a/src/test/resources/spider/SimpleSolvable.json b/src/test/resources/spider/SimpleSolvable.json new file mode 100644 index 0000000..f0b9b00 --- /dev/null +++ b/src/test/resources/spider/SimpleSolvable.json @@ -0,0 +1,14 @@ +{ + "tableau piles": [ + ["3C","2C","AC"], + ["3D","2D","AD"], + ["3H","2H","AH"], + ["3S","2S","AS"] + ], + "stock": [ + "3C","2C","AC", + "3D","2D","AD", + "3H","2H","AH", + "3S","2S","AS" + ] +} diff --git a/src/test/resources/spider/SimpleUnsolvable.json b/src/test/resources/spider/SimpleUnsolvable.json new file mode 100644 index 0000000..d11a6dd --- /dev/null +++ b/src/test/resources/spider/SimpleUnsolvable.json @@ -0,0 +1,13 @@ +{ + "tableau piles": [ + ["AC","AC","2C"], + ["AD","AD","2D"], + ["AH","AH","2H"], + ["AS","AS","2S"] + ], + "stock": [ + "3C","3D","3H","3S", + "2C","2D","2H","2S", + "3C","3D","3H","3S" + ] +} diff --git a/src/test/spider_test.cpp b/src/test/spider_test.cpp new file mode 100644 index 0000000..0e21f86 --- /dev/null +++ b/src/test/spider_test.cpp @@ -0,0 +1,28 @@ +// +// Created by thecharlesblake on 10/4/17. +// + +#include + +#include "test_helper.h" + +typedef test_helper th; + +const static std::string path = "resources/spider/"; +const static std::string type = "simple-spider"; + +TEST(Spider, SimpleSolvable) { + EXPECT_TRUE(th::is_solvable(path + "SimpleSolvable.json", type)); +} + +TEST(Spider, ComplexSolvable) { + EXPECT_TRUE(th::is_solvable(path + "ComplexSolvable.json", type)); +} + +TEST(Spider, SimpleUnsolvable) { + EXPECT_FALSE(th::is_solvable(path + "SimpleUnsolvable.json", type)); +} + +TEST(Spider, ComplexUnsolvable) { + EXPECT_FALSE(th::is_solvable(path + "ComplexUnsolvable.json", type)); +} -- cgit v1.2.1