aboutsummaryrefslogtreecommitdiff
path: root/src/test/test_helper.cpp
blob: 117273c4246721abf2dadb39aa5c446e471c5b78 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
//
// 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/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 = rules_parser::from_preset(preset_type);

    game_state gs(rules, in_doc);
    solver sol(gs, rules);

    return sol.run();
}