aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorthecharlesblake2017-12-27 00:23:07 +0000
committerthecharlesblake2017-12-27 00:23:07 +0000
commit6c4bdf37d6bebe3562df9c9b459e6b7036f21dea (patch)
treefef9ac5455397b700df3ca3db161a718efdda114 /src
parentFirst sp test working (diff)
downloadmetasol-6c4bdf37d6bebe3562df9c9b459e6b7036f21dea.tar.gz
metasol-6c4bdf37d6bebe3562df9c9b459e6b7036f21dea.zip

All basic sp tests complete

Diffstat (limited to 'src')
-rw-r--r--src/test/resources/spanish_patience/ComplexSolvable.json7
-rw-r--r--src/test/resources/spanish_patience/ComplexUnsolvable.json7
-rw-r--r--src/test/resources/spanish_patience/SimpleSolvable.json (renamed from src/test/resources/SPTestName.json)2
-rw-r--r--src/test/resources/spanish_patience/SimpleUnsolvable.json7
-rw-r--r--src/test/spanish_patience_test.cpp17
-rw-r--r--src/test/test_helper.cpp2
6 files changed, 38 insertions, 4 deletions
diff --git a/src/test/resources/spanish_patience/ComplexSolvable.json b/src/test/resources/spanish_patience/ComplexSolvable.json
new file mode 100644
index 0000000..c48ce47
--- /dev/null
+++ b/src/test/resources/spanish_patience/ComplexSolvable.json
@@ -0,0 +1,7 @@
+{
+ "tableau piles": [
+ ["AS", "2S", "AH"],
+ ["AD", "2D", "2H"],
+ ["2C", "AC"]
+ ]
+}
diff --git a/src/test/resources/spanish_patience/ComplexUnsolvable.json b/src/test/resources/spanish_patience/ComplexUnsolvable.json
new file mode 100644
index 0000000..ba9be59
--- /dev/null
+++ b/src/test/resources/spanish_patience/ComplexUnsolvable.json
@@ -0,0 +1,7 @@
+{
+ "tableau piles": [
+ ["AS", "2S", "AH"],
+ ["AD", "2D", "2H"],
+ ["AC", "2C"]
+ ]
+}
diff --git a/src/test/resources/SPTestName.json b/src/test/resources/spanish_patience/SimpleSolvable.json
index 6d1586c..eacad0e 100644
--- a/src/test/resources/SPTestName.json
+++ b/src/test/resources/spanish_patience/SimpleSolvable.json
@@ -4,4 +4,4 @@
["2D", "2H", "AH"],
["2C", "AC"]
]
-} \ No newline at end of file
+}
diff --git a/src/test/resources/spanish_patience/SimpleUnsolvable.json b/src/test/resources/spanish_patience/SimpleUnsolvable.json
new file mode 100644
index 0000000..99a3140
--- /dev/null
+++ b/src/test/resources/spanish_patience/SimpleUnsolvable.json
@@ -0,0 +1,7 @@
+{
+ "tableau piles": [
+ ["AS", "2S", "2D"],
+ ["AD", "AH", "2H"],
+ ["AC", "2C"]
+ ]
+}
diff --git a/src/test/spanish_patience_test.cpp b/src/test/spanish_patience_test.cpp
index 4168193..8973a53 100644
--- a/src/test/spanish_patience_test.cpp
+++ b/src/test/spanish_patience_test.cpp
@@ -8,8 +8,21 @@
typedef test_helper th;
+const static std::string path = "resources/spanish_patience/";
const static std::string type = "simple-spanish-patience";
-TEST(SpanishPatience, SPTestName) {
- EXPECT_TRUE(th::is_solvable("SPTestName", type));
+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/test_helper.cpp b/src/test/test_helper.cpp
index 2e08829..9c258a3 100644
--- a/src/test/test_helper.cpp
+++ b/src/test/test_helper.cpp
@@ -13,7 +13,7 @@ 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("resources/" + input_file + ".json");
+ const Document in_doc = util::get_file_json(input_file);
const sol_rules rules = sol_rules::from_preset(preset_type);
game_state gs(rules, in_doc);