]> gitweb.factorcode.org Git - factor.git/blob - extra/tetris/piece/piece-tests.factor
05e4faa68fd9a6dc3b806b0b0bf424c292fb6cd4
[factor.git] / extra / tetris / piece / piece-tests.factor
1 USING: accessors kernel tetris.tetromino tetris.piece tools.test sequences arrays namespaces ;
2
3 ! Tests for tetris.tetromino and tetris.piece, since there's not much to test in tetris.tetromino
4
5 ! these two tests rely on the first rotation 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> rotation>> ] 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