aboutsummaryrefslogtreecommitdiffstats
path: root/tests_solver
diff options
context:
space:
mode:
authorMarianne Chevrot <blackmoor+git@devys.org>2020-04-28 19:01:37 +0200
committerMarianne Chevrot <blackmoor+git@devys.org>2020-04-28 19:01:37 +0200
commit19dd05dc43771162e26dc57762f0ad4bfc4b6706 (patch)
tree838a7b64646334f36a0bcca93a3fc2e1a14c2e7d /tests_solver
parentfab8ec28831922692915fe7cd506edf98693d334 (diff)
downloadkana_quest_solver-19dd05dc43771162e26dc57762f0ad4bfc4b6706.tar.gz
kana_quest_solver-19dd05dc43771162e26dc57762f0ad4bfc4b6706.tar.bz2
kana_quest_solver-19dd05dc43771162e26dc57762f0ad4bfc4b6706.zip
Isolate and correct tests
Diffstat (limited to 'tests_solver')
-rw-r--r--tests_solver/test_solver.py49
1 files changed, 49 insertions, 0 deletions
diff --git a/tests_solver/test_solver.py b/tests_solver/test_solver.py
new file mode 100644
index 0000000..e2b45a5
--- /dev/null
+++ b/tests_solver/test_solver.py
@@ -0,0 +1,49 @@
+#!/usr/bin/env python3
+
+import os
+import sys
+
+sys.path.append(os.getcwd())
+
+from solver import *
+
+def test_is_swappable():
+ assert is_swappable(Kana("norm", "su"), Kana("norm", "su"))
+ assert is_swappable(Kana("froz", "su"), Kana("norm", "su"))
+ assert is_swappable(Kana("norm", "su"), Kana("empt"))
+ assert is_swappable(Kana("empt"), Kana("froz", "su"))
+ assert not is_swappable(Kana("norm", "su"), Kana("rock", "su"))
+ assert not is_swappable(Kana("froz", "su"), Kana("froz", "su"))
+ assert not is_swappable(Kana("empt"), Kana("empt"))
+
+
+def test_kana_grid():
+
+ initial_grid = [
+ kana_void , Kana("myst", "su"), kana_void , Kana("myst", "ko"), kana_void ,
+ Kana("froz", "se"), Kana("empt" ), Kana("empt" ), Kana("empt" ), Kana("froz", "so"),
+ Kana("froz", "ku"), Kana("empt" ), Kana("empt" ), Kana("empt" ), Kana("froz", "no"),
+ kana_void , kana_void , Kana("rock", "ka"), kana_void , kana_void ,
+ ]
+ initial_grid_size = 5, 4
+ chain_target = 7
+
+ expected_grid = [
+ kana_void , Kana("myst", "su"), kana_void , Kana("myst", "ko"), kana_void ,
+ Kana("empt" ), Kana("empt" ), Kana("empt" ), Kana("froz", "se"), Kana("froz", "so"),
+ Kana("froz", "ku"), Kana("empt" ), Kana("empt" ), Kana("empt" ), Kana("froz", "no"),
+ kana_void , kana_void , Kana("rock", "ka"), kana_void , kana_void ,
+ ]
+
+ kanagrid_orig = KanaGrid(initial_grid_size, initial_grid)
+ kanagrid_new = kanagrid_orig.action(pos=(0, 1), action_type="right")
+
+ print("kanagrid_orig")
+ print(kanagrid_orig)
+ print("kanagrid_new")
+ print(kanagrid_new)
+ print("expected_grid")
+ display_grid(expected_grid, initial_grid_size)
+
+ assert kanagrid_new.grid == expected_grid
+