aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorthecharlesblake2018-01-04 11:38:36 +0000
committerthecharlesblake2018-01-04 11:38:36 +0000
commit6ce3b5a142b3e357eeabde37368915e8ef916f3d (patch)
tree6d41af7022522e3afc3cbeefa86c529d3ee33f5c /src
parentMove game_state legal move gen into dedicated file (diff)
downloadmetasol-6ce3b5a142b3e357eeabde37368915e8ef916f3d.tar.gz
metasol-6ce3b5a142b3e357eeabde37368915e8ef916f3d.zip

Add json rules for fortunes favor

Diffstat (limited to 'src')
-rw-r--r--src/main/input-output/input/sol_preset_types.cpp22
-rw-r--r--src/test/fortunes_favor_test.cpp28
-rw-r--r--src/test/resources/fortunes_favor/ComplexSolvable.json7
-rw-r--r--src/test/resources/fortunes_favor/ComplexUnsolvable.json7
-rw-r--r--src/test/resources/fortunes_favor/SimpleSolvable.json7
-rw-r--r--src/test/resources/fortunes_favor/SimpleUnsolvable.json7
6 files changed, 67 insertions, 11 deletions
diff --git a/src/main/input-output/input/sol_preset_types.cpp b/src/main/input-output/input/sol_preset_types.cpp
index 3c9d295..96cbba9 100644
--- a/src/main/input-output/input/sol_preset_types.cpp
+++ b/src/main/input-output/input/sol_preset_types.cpp
@@ -147,32 +147,32 @@ std::map<string, string> sol_preset_types::mp = {
},
{
- "canfield",
+ "fortunes-favor",
R"(
{
"tableau piles": {
- "count": 4,
- "build policy": "red-black"
+ "count": 12,
+ "build policy": "same-suit"
},
- "reserve size": 14,
- "stock size": 34
+ "foundations initial card": true,
+ "stock size": 36
}
)"
},
{
- "simple-canfield",
+ "simple-fortunes-favor",
R"(
{
"tableau piles": {
- "count": 2,
- "build policy": "red-black"
+ "count": 3,
+ "build policy": "same-suit"
},
- "max rank": 2,
- "reserve size": 2,
- "stock size": 2
+ "max rank": 4,
+ "foundations initial card": true,
+ "stock size": 3
}
)"
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 <gtest/gtest.h>
+
+#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"]
+ ]
+}