aboutsummaryrefslogtreecommitdiffstats
path: root/tests_solver
diff options
context:
space:
mode:
authorMarianne Chevrot <blackmoor+git@devys.org>2020-05-09 23:16:40 +0200
committerMarianne Chevrot <blackmoor+git@devys.org>2020-05-09 23:16:40 +0200
commitcaf7494e8412336b74ca143dac1356870c39fe13 (patch)
tree3c91865ae497c8f80f7928dd40cff2eea352b8cb /tests_solver
parent478683385ace632366bc4541cdd6e1a84c4aa54e (diff)
downloadkana_quest_solver-caf7494e8412336b74ca143dac1356870c39fe13.tar.gz
kana_quest_solver-caf7494e8412336b74ca143dac1356870c39fe13.tar.bz2
kana_quest_solver-caf7494e8412336b74ca143dac1356870c39fe13.zip
Add support for empty arrows
- remove empt, fblk types, there are merged to their base type (norm and froz) - ar_*, norm and froz support having None for their kana property
Diffstat (limited to 'tests_solver')
-rw-r--r--tests_solver/level_test_ar_x.yaml2
-rw-r--r--tests_solver/level_test_type.yaml4
-rw-r--r--tests_solver/test_solver.py66
3 files changed, 36 insertions, 36 deletions
diff --git a/tests_solver/level_test_ar_x.yaml b/tests_solver/level_test_ar_x.yaml
index 633a843..45e50d1 100644
--- a/tests_solver/level_test_ar_x.yaml
+++ b/tests_solver/level_test_ar_x.yaml
@@ -3,6 +3,6 @@ size: [3, 1]
max_actions: 1
target_score: 2
grid: [
- [ar_r, su ], [empt, null], [norm, so ],
+ [ar_r, su ], [norm, null], [norm, so ],
]
# The kana 'no' need to be protected else the program convert it into False...
diff --git a/tests_solver/level_test_type.yaml b/tests_solver/level_test_type.yaml
index 0eec70a..f48634f 100644
--- a/tests_solver/level_test_type.yaml
+++ b/tests_solver/level_test_type.yaml
@@ -3,7 +3,7 @@ size: [6, 2]
max_actions: 6
target_score: 8
grid: [
- [ar_r, sa ], [empt, null], [norm, so ], [rock, se ], [myst, ka ], [ar_d, na ],
- [ar_u, su ], [ar_l, nu ], [void, null], [void, null], [void, null], [froz, ke ],
+ [ar_r, sa ], [norm, null], [norm, so ], [rock, se ], [myst, ka ], [ar_d, na ],
+ [ar_u, su ], [ar_l, nu ], [void, null], [void, null], [froz, null], [froz, ke ],
]
# The kana 'no' need to be protected else the program convert it into False...
diff --git a/tests_solver/test_solver.py b/tests_solver/test_solver.py
index 82aca73..03d68ed 100644
--- a/tests_solver/test_solver.py
+++ b/tests_solver/test_solver.py
@@ -13,8 +13,9 @@ def test_is_swappable():
swappable_grids = [
[Kana("norm", "su"), Kana("norm", "su")],
[Kana("froz", "su"), Kana("norm", "su")],
- [Kana("norm", "su"), Kana("empt" )],
- [Kana("empt" ), Kana("froz", "su")],
+ [Kana("norm", "su"), Kana("norm" )],
+ [Kana("norm" ), Kana("froz", "su")],
+ [Kana("norm" ), Kana("norm" )],
]
for swappable_grid in swappable_grids:
@@ -25,7 +26,6 @@ def test_is_swappable():
not_swappable_grids = [
[Kana("norm", "su"), Kana("rock", "su")],
[Kana("froz", "su"), Kana("froz", "su")],
- [Kana("empt" ), Kana("empt" )],
]
for not_swappable_grid in not_swappable_grids:
@@ -38,8 +38,8 @@ 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("froz", "se"), Kana("norm" ), Kana("norm" ), Kana("norm" ), Kana("froz", "so"),
+ Kana("froz", "ku"), Kana("norm" ), Kana("norm" ), Kana("norm" ), Kana("froz", "no"),
kana_void , kana_void , Kana("rock", "ka"), kana_void , kana_void ,
]
initial_grid_size = 5, 4
@@ -47,8 +47,8 @@ def test_kana_grid():
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("norm" ), Kana("norm" ), Kana("norm" ), Kana("froz", "se"), Kana("froz", "so"),
+ Kana("froz", "ku"), Kana("norm" ), Kana("norm" ), Kana("norm" ), Kana("froz", "no"),
kana_void , kana_void , Kana("rock", "ka"), kana_void , kana_void ,
]
@@ -66,9 +66,9 @@ def test_kana_grid():
def test_kana_arrow_swap():
- kanagrid_orig = KanaGrid((2, 1), [Kana("ar_r", "su"), Kana("empt",)])
+ kanagrid_orig = KanaGrid((2, 1), [Kana("ar_r", "su"), Kana("norm",)])
kanagrid_new = kanagrid_orig.action(pos=(0, 0), action_type="right")
- expected_grid = KanaGrid((2, 1), [Kana("empt",), Kana("ar_r", "su")])
+ expected_grid = KanaGrid((2, 1), [Kana("norm",), Kana("ar_r", "su")])
print("kanagrid_orig")
print(kanagrid_orig)
@@ -86,14 +86,14 @@ def test_kana_arrow_swap():
'other_move_ok': 'down',
'dest_pos': (1, 0),
'orig': KanaGrid((3, 3), [
- Kana("empt" ), Kana("empt" ), Kana("empt" ),
- Kana("empt" ), Kana("ar_u", "ko"), Kana("empt" ),
- Kana("empt" ), Kana("empt" ), Kana("empt" ),
+ Kana("void" ), Kana("norm" ), Kana("void" ),
+ Kana("norm" ), Kana("ar_u", "ko"), Kana("norm" ),
+ Kana("void" ), Kana("norm" ), Kana("void" ),
]),
'moved': KanaGrid((3, 3), [
- Kana("empt" ), Kana("ar_u", "ko"), Kana("empt" ),
- Kana("empt" ), Kana("empt" ), Kana("empt" ),
- Kana("empt" ), Kana("empt" ), Kana("empt" ),
+ Kana("void" ), Kana("ar_u", "ko"), Kana("void" ),
+ Kana("norm" ), Kana("norm" ), Kana("norm" ),
+ Kana("void" ), Kana("norm" ), Kana("void" ),
], action_count=1),
},
{
@@ -101,14 +101,14 @@ def test_kana_arrow_swap():
'other_move_ok': 'left',
'dest_pos': (2, 1),
'orig': KanaGrid((3, 3), [
- Kana("empt" ), Kana("empt" ), Kana("empt" ),
- Kana("empt" ), Kana("ar_r", "ko"), Kana("empt" ),
- Kana("empt" ), Kana("empt" ), Kana("empt" ),
+ Kana("void" ), Kana("norm" ), Kana("void" ),
+ Kana("norm" ), Kana("ar_r", "ko"), Kana("norm" ),
+ Kana("void" ), Kana("norm" ), Kana("void" ),
]),
'moved': KanaGrid((3, 3), [
- Kana("empt" ), Kana("empt" ), Kana("empt" ),
- Kana("empt" ), Kana("empt" ), Kana("ar_r", "ko"),
- Kana("empt" ), Kana("empt" ), Kana("empt" ),
+ Kana("void" ), Kana("norm" ), Kana("void" ),
+ Kana("norm" ), Kana("norm" ), Kana("ar_r", "ko"),
+ Kana("void" ), Kana("norm" ), Kana("void" ),
], action_count=1),
},
{
@@ -116,14 +116,14 @@ def test_kana_arrow_swap():
'other_move_ok': 'up',
'dest_pos': (1, 2),
'orig': KanaGrid((3, 3), [
- Kana("empt" ), Kana("empt" ), Kana("empt" ),
- Kana("empt" ), Kana("ar_d", "ko"), Kana("empt" ),
- Kana("empt" ), Kana("empt" ), Kana("empt" ),
+ Kana("void" ), Kana("norm" ), Kana("void" ),
+ Kana("norm" ), Kana("ar_d", "ko"), Kana("norm" ),
+ Kana("void" ), Kana("norm" ), Kana("void" ),
]),
'moved': KanaGrid((3, 3), [
- Kana("empt" ), Kana("empt" ), Kana("empt" ),
- Kana("empt" ), Kana("empt" ), Kana("empt" ),
- Kana("empt" ), Kana("ar_d", "ko"), Kana("empt" ),
+ Kana("void" ), Kana("norm" ), Kana("void" ),
+ Kana("norm" ), Kana("norm" ), Kana("norm" ),
+ Kana("void" ), Kana("ar_d", "ko"), Kana("void" ),
], action_count=1),
},
{
@@ -131,14 +131,14 @@ def test_kana_arrow_swap():
'other_move_ok': 'right',
'dest_pos': (0, 1),
'orig': KanaGrid((3, 3), [
- Kana("empt" ), Kana("empt" ), Kana("empt" ),
- Kana("empt" ), Kana("ar_l", "ko"), Kana("empt" ),
- Kana("empt" ), Kana("empt" ), Kana("empt" ),
+ Kana("void" ), Kana("norm" ), Kana("void" ),
+ Kana("norm" ), Kana("ar_l", "ko"), Kana("norm" ),
+ Kana("void" ), Kana("norm" ), Kana("void" ),
]),
'moved': KanaGrid((3, 3), [
- Kana("empt" ), Kana("empt" ), Kana("empt" ),
- Kana("ar_l", "ko"), Kana("empt" ), Kana("empt" ),
- Kana("empt" ), Kana("empt" ), Kana("empt" ),
+ Kana("void" ), Kana("norm" ), Kana("void" ),
+ Kana("ar_l", "ko"), Kana("norm" ), Kana("norm" ),
+ Kana("void" ), Kana("norm" ), Kana("void" ),
], action_count=1),
},
]