diff options
| author | Charlie Blake | 2017-12-28 10:10:46 +0000 |
|---|---|---|
| committer | GitHub | 2017-12-28 10:10:46 +0000 |
| commit | c6275f508b1ff142a1085ebda8ae9276ea7611c4 (patch) | |
| tree | 26b9855cf4a9ec808dae99b378fbbcfa7af4315f /src/test/test_helper.cpp | |
| parent | Merge pull request #25 from thecharlesblake/docs (diff) | |
| parent | Added fc tests - currently intract. (diff) | |
| download | metasol-c6275f508b1ff142a1085ebda8ae9276ea7611c4.tar.gz metasol-c6275f508b1ff142a1085ebda8ae9276ea7611c4.zip | |
Merge pull request #26 from thecharlesblake/deal-description-and-test
Deal description and test
Diffstat (limited to 'src/test/test_helper.cpp')
| -rw-r--r-- | src/test/test_helper.cpp | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/src/test/test_helper.cpp b/src/test/test_helper.cpp new file mode 100644 index 0000000..9c258a3 --- /dev/null +++ b/src/test/test_helper.cpp @@ -0,0 +1,23 @@ +// +// Created by thecharlesblake on 12/26/17. +// + +#include <rapidjson/document.h> + +#include "test_helper.h" +#include "../main/game/game_state.h" +#include "../main/solver/solver.h" +#include "../main/util/util.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 sol_rules rules = sol_rules::from_preset(preset_type); + + game_state gs(rules, in_doc); + solver sol(gs, rules); + + return sol.run() ? true : false; +} |
