aboutsummaryrefslogtreecommitdiffstats
path: root/tests_solver
diff options
context:
space:
mode:
Diffstat (limited to 'tests_solver')
-rw-r--r--tests_solver/test_solver.py33
1 files changed, 33 insertions, 0 deletions
diff --git a/tests_solver/test_solver.py b/tests_solver/test_solver.py
index 1f178cc..1d441ff 100644
--- a/tests_solver/test_solver.py
+++ b/tests_solver/test_solver.py
@@ -195,3 +195,36 @@ def test_kana_arrow_swap():
else:
assert kanagrid_test is None
+
+def test_solver_load_and_type_1():
+ # ./solver.py tests_solver/level_test_type.yaml
+
+ kanagrid_orig = KanaGrid((6, 2), [
+ Kana("ar_r", "sa"), Kana("norm" ), Kana("norm", "so"), Kana("rock", "se"), Kana("myst", "ka"), Kana("ar_d", "na"),
+ Kana("ar_u", "su"), Kana("ar_l", "nu"), Kana("void" ), Kana("void" ), Kana("froz" ), Kana("froz", "ke"),
+ ])
+
+ expected_grid = KanaGrid((6, 2), [
+ Kana("ar_u", "su"), Kana("ar_r", "sa"), Kana("norm", "so"), Kana("rock", "se"), Kana("froz", "ke"), Kana("norm", "ka"),
+ Kana("ar_l", "nu"), Kana("norm" ), Kana("void" ), Kana("void" ), Kana("froz" ), Kana("ar_d", "na"),
+ ], action_count=6, score=8)
+
+ type_yaml_level_file = 'tests_solver/level_test_type.yaml'
+ with open(type_yaml_level_file, encoding='utf8') as stream:
+ input_dict = yaml.safe_load(stream)
+ loaded_grid = KanaGrid.load(input_dict)
+ target_score = input_dict['target_score']
+ max_actions = input_dict['max_actions']
+
+ mock_args = {'--help': False,
+ '--print': False,
+ '-p': False,
+ 'YAML_GRID': type_yaml_level_file,
+ }
+
+ assert loaded_grid == kanagrid_orig
+
+ kanagrid_new = search_all_solution(mock_args, loaded_grid, target_score, max_actions)
+
+ assert kanagrid_new == expected_grid
+