2008-10-01 21:12:46 -04:00
|
|
|
USING: accessors kernel tetris.tetromino tetris.piece tools.test sequences arrays namespaces ;
|
|
|
|
|
|
|
|
! Tests for tetris.tetromino and tetris.piece, since there's not much to test in tetris.tetromino
|
|
|
|
|
|
|
|
! these two tests rely on the first rotation of the first tetromino being the
|
|
|
|
! 'I' tetromino in its vertical orientation.
|
2015-07-03 12:39:59 -04:00
|
|
|
{ 4 } [ tetrominoes get first states>> first blocks-width ] unit-test
|
|
|
|
{ 1 } [ tetrominoes get first states>> first blocks-height ] unit-test
|
2008-10-01 21:12:46 -04:00
|
|
|
|
2015-07-03 12:39:59 -04:00
|
|
|
{ { 0 0 } } [ random-tetromino <piece> location>> ] unit-test
|
|
|
|
{ 0 } [ 10 <random-piece> rotation>> ] unit-test
|
2008-10-01 21:12:46 -04:00
|
|
|
|
2015-07-03 12:39:59 -04:00
|
|
|
{ { { 0 0 } { 1 0 } { 2 0 } { 3 0 } } }
|
2008-10-01 21:12:46 -04:00
|
|
|
[ tetrominoes get first <piece> piece-blocks ] unit-test
|
|
|
|
|
2015-07-03 12:39:59 -04:00
|
|
|
{ { { 0 0 } { 0 1 } { 0 2 } { 0 3 } } }
|
2008-10-01 21:12:46 -04:00
|
|
|
[ tetrominoes get first <piece> 1 rotate-piece piece-blocks ] unit-test
|
|
|
|
|
2015-07-03 12:39:59 -04:00
|
|
|
{ { { 1 1 } { 2 1 } { 3 1 } { 4 1 } } }
|
2008-10-01 21:12:46 -04:00
|
|
|
[ tetrominoes get first <piece> { 1 1 } move-piece piece-blocks ] unit-test
|
|
|
|
|
2015-07-03 12:39:59 -04:00
|
|
|
{ 3 } [ tetrominoes get second <piece> piece-width ] unit-test
|
|
|
|
{ 2 } [ tetrominoes get second <piece> 1 rotate-piece piece-width ] unit-test
|