]> gitweb.factorcode.org Git - factor.git/blob - extra/sokoban/piece/piece-tests.factor
ui.gadgets.panes: relayout when changing label contents
[factor.git] / extra / sokoban / piece / piece-tests.factor
1 USING: accessors kernel sokoban.tetromino sokoban.piece tools.test sequences arrays namespaces ;
2
3 ! Tests for sokoban.tetromino and sokoban.piece, since there's not much to test in sokoban.tetromino
4
5 ! these two tests rely on the first level_num of the first tetromino being the
6 ! 'I' tetromino in its vertical orientation.
7 { 4 } [ tetrominoes get first states>> first blocks-width ] unit-test
8 { 1 } [ tetrominoes get first states>> first blocks-height ] unit-test
9
10 ! { { 0 0 } } [ random-tetromino <piece> location>> ] unit-test
11 ! { 0 } [ 10 <random-piece> level_num>> ] unit-test
12
13 { { { 0 0 } { 1 0 } { 2 0 } { 3 0 } } }
14 [ tetrominoes get first <piece> piece-blocks ] unit-test
15
16 { { { 0 0 } { 0 1 } { 0 2 } { 0 3 } } }
17 [ tetrominoes get first <piece> 1 rotate-piece piece-blocks ] unit-test
18
19 { { { 1 1 } { 2 1 } { 3 1 } { 4 1 } } }
20 [ tetrominoes get first <piece> { 1 1 } move-piece piece-blocks ] unit-test
21
22 { 3 } [ tetrominoes get second <piece> piece-width ] unit-test
23 { 2 } [ tetrominoes get second <piece> 1 rotate-piece piece-width ] unit-test