commit ec466c16ce6ae54adb005c0ee58dd9f546d1a943
parent e992ac0fa0d4b7c51fbffaca1d9825e04107213c
Author: Yuval Langer <yuvallangerontheroad@gmail.com>
Date: Wed, 22 Jul 2020 13:27:42 +0300
Add sokoban tests file.
Diffstat:
1 file changed, 34 insertions(+), 0 deletions(-)
diff --git a/html/sokoban/sokoban_tests.js b/html/sokoban/sokoban_tests.js
@@ -0,0 +1,34 @@
+console.log('tests start');
+
+console.log(sokoban);
+
+let game = sokoban.new_game();
+[
+ sokoban.action_step_right,
+ sokoban.action_step_right,
+ sokoban.action_step_right,
+ sokoban.action_step_right,
+ sokoban.action_step_right,
+ sokoban.action_step_right,
+ sokoban.action_step_right,
+ sokoban.action_step_right,
+ sokoban.action_next_level,
+].forEach(action_function=>{
+ let s = sokoban.game_to_text(game);
+ console.log(`before:
+${s}
+KAKAKAKAKAKAKAKAKAKAKAKAKAKAKAKA`
+ );
+ action_function(game);
+ s = sokoban.game_to_text(game);
+ console.log(`after:
+${s}
+KAKAKAKAKAKAKAKAKAKAKAKAKAKAKAKA`
+ );
+})
+sokoban.action_next_level(game);
+let s = sokoban.game_to_text(game);
+console.log(`after: ${s}`)
+sokoban.action_next_level(game);
+s = sokoban.game_to_text(game);
+console.log(`after: ${s}`)