]> gitweb.factorcode.org Git - factor.git/commitdiff
sokoban: fix test failures
authorJohn Benediktsson <mrjbq7@gmail.com>
Mon, 1 Aug 2022 05:17:34 +0000 (22:17 -0700)
committerJohn Benediktsson <mrjbq7@gmail.com>
Mon, 1 Aug 2022 05:17:34 +0000 (22:17 -0700)
extra/sokoban/board/board-tests.factor
extra/sokoban/game/game-tests.factor
extra/sokoban/piece/piece-tests.factor [deleted file]

index bbcff3c955350d1c56818c9a1f6b0296ccfd4a5d..2d25adeb719646eaf1b935fe89efa4dc2d8d4207 100644 (file)
@@ -1,4 +1,4 @@
-USING: accessors arrays colors colors.constants kernel sokoban.board sokoban.piece tools.test ;
+USING: accessors arrays colors kernel sokoban.board sokoban.piece tools.test ;
 
 { { { f f } { f f } { f f } } } [ 2 3 make-rows ] unit-test
 { { { f f } { f f } { f f } } } [ 2 3 <board> rows>> ] unit-test
@@ -18,6 +18,6 @@ USING: accessors arrays colors colors.constants kernel sokoban.board sokoban.pie
 { f } [ 2 3 <board> dup { 1 1 } COLOR: red set-block { 1 1 } location-valid? ] unit-test
 ! { t } [ 10 10 <board> 10 <random-piece> piece-valid? ] unit-test
 ! { f } [ 2 3 <board> 10 <random-piece> { 1 2 } >>location piece-valid? ] unit-test
-{ { { f } { f } } } [ 1 1 <board> add-row rows>> ] unit-test
-{ { { f } } } [ 1 2 <board> dup { 0 1 } COLOR: red set-block remove-full-rows rows>> ] unit-test
-{ { { f } { f } } } [ 1 2 <board> dup { 0 1 } COLOR: red set-block dup check-rows drop rows>> ] unit-test
+{ { { f } { f } } } [ 1 1 <board> add-row rows>> ] unit-test
+{ { { f } } } [ 1 2 <board> dup { 0 1 } COLOR: red set-block remove-full-rows rows>> ] unit-test
+{ { { f } { f } } } [ 1 2 <board> dup { 0 1 } COLOR: red set-block dup check-rows drop rows>> ] unit-test
index b5e973660803798542fdd5a93747daaf04bef80a..190677f6c3d84516bdfd246ade1f079fef92ac03 100644 (file)
@@ -1,15 +1,15 @@
 USING: accessors kernel sokoban.game sokoban.board sokoban.piece tools.test
 sequences ;
 
-{ t } [ <default-sokoban> [ current-piece ] [ next-piece ] bi and t f ? ] unit-test
-{ t } [ <default-sokoban> { 1 1 } can-move? ] unit-test
+{ t } [ <default-sokoban> [ current-piece ] [ next-piece ] bi and t f ? ] unit-test
+{ t } [ <default-sokoban> { 1 1 } can-move? ] unit-test
 { t } [ <default-sokoban> { 1 1 } sokoban-move ] unit-test
-{ 1 } [ <default-sokoban> dup { 1 1 } sokoban-move drop current-piece location>> second ] unit-test
-{ 1 } [ <default-sokoban> level ] unit-test
-{ 1 } [ <default-sokoban> 9 >>rows level ] unit-test
-{ 2 } [ <default-sokoban> 10 >>rows level ] unit-test
-{ 0 } [ 3 0 rows-score ] unit-test
-{ 80 } [ 1 1 rows-score ] unit-test
-{ 4800 } [ 3 4 rows-score ] unit-test
-{ 1 } [ <default-sokoban> dup 3 score-rows dup 3 score-rows dup 3 score-rows level ] unit-test
-{ 2 } [ <default-sokoban> dup 4 score-rows dup 4 score-rows dup 2 score-rows level ] unit-test
+{ 1 } [ <default-sokoban> dup { 1 1 } sokoban-move drop current-piece location>> second ] unit-test
+{ 1 } [ <default-sokoban> level>> ] unit-test
+{ 1 } [ <default-sokoban> 9 >>rows level>> ] unit-test
+{ 2 } [ <default-sokoban> 10 >>rows level>> ] unit-test
+{ 0 } [ 3 0 rows-score ] unit-test
+{ 80 } [ 1 1 rows-score ] unit-test
+{ 4800 } [ 3 4 rows-score ] unit-test
+{ 1 } [ <default-sokoban> dup 3 score-rows dup 3 score-rows dup 3 score-rows level ] unit-test
+{ 2 } [ <default-sokoban> dup 4 score-rows dup 4 score-rows dup 2 score-rows level ] unit-test
diff --git a/extra/sokoban/piece/piece-tests.factor b/extra/sokoban/piece/piece-tests.factor
deleted file mode 100644 (file)
index aff8ba1..0000000
+++ /dev/null
@@ -1,23 +0,0 @@
-USING: accessors kernel sokoban.tetromino sokoban.piece tools.test sequences arrays namespaces ;
-
-! Tests for sokoban.tetromino and sokoban.piece, since there's not much to test in sokoban.tetromino
-
-! these two tests rely on the first level_num of the first tetromino being the
-! 'I' tetromino in its vertical orientation.
-{ 4 } [ tetrominoes get first states>> first blocks-width ] unit-test
-{ 1 } [ tetrominoes get first states>> first blocks-height ] unit-test
-
-! { { 0 0 } } [ random-tetromino <piece> location>> ] unit-test
-! { 0 } [ 10 <random-piece> level_num>> ] unit-test
-
-{ { { 0 0 } { 1 0 } { 2 0 } { 3 0 } } }
-[ tetrominoes get first <piece> piece-blocks ] unit-test
-
-{ { { 0 0 } { 0 1 } { 0 2 } { 0 3 } } }
-[ tetrominoes get first <piece> 1 rotate-piece piece-blocks ] unit-test
-
-{ { { 1 1 } { 2 1 } { 3 1 } { 4 1 } } }
-[ tetrominoes get first <piece> { 1 1 } move-piece piece-blocks ] unit-test
-
-{ 3 } [ tetrominoes get second <piece> piece-width ] unit-test
-{ 2 } [ tetrominoes get second <piece> 1 rotate-piece piece-width ] unit-test