remove math.blas.syntax and merge parsing words into math.blas.vectors/matrices
[factor/jcg.git] / extra / tetris / board / board-tests.factor
blob518b5544e9137bc173b8523c920e6f476fe96d0e
1 USING: accessors arrays colors kernel tetris.board tetris.piece tools.test ;
3 [ { { f f } { f f } { f f } } ] [ 2 3 make-rows ] unit-test
4 [ { { f f } { f f } { f f } } ] [ 2 3 <board> rows>> ] unit-test
5 [ 1 { f f } ] [ 2 3 <board> { 1 1 } board@block ] unit-test
6 [ f ] [ 2 3 <board> { 1 1 } block ] unit-test
7 [ 2 3 <board> { 2 3 } block ] must-fail
8 red 1array [ 2 3 <board> dup { 1 1 } red set-block { 1 1 } block ] unit-test
9 [ t ] [ 2 3 <board> { 1 1 } block-free? ] unit-test
10 [ f ] [ 2 3 <board> dup { 1 1 } red set-block { 1 1 } block-free? ] unit-test
11 [ t ] [ 2 3 <board> dup { 1 1 } red set-block { 1 2 } block-free? ] unit-test
12 [ t ] [ 2 3 <board> dup { 1 1 } red set-block { 0 1 } block-free? ] unit-test
13 [ t ] [ 2 3 <board> { 0 0 } block-in-bounds? ] unit-test
14 [ f ] [ 2 3 <board> { -1 0 } block-in-bounds? ] unit-test
15 [ t ] [ 2 3 <board> { 1 2 } block-in-bounds? ] unit-test
16 [ f ] [ 2 3 <board> { 2 2 } block-in-bounds? ] unit-test
17 [ t ] [ 2 3 <board> { 1 1 } location-valid? ] unit-test
18 [ f ] [ 2 3 <board> dup { 1 1 } red set-block { 1 1 } location-valid? ] unit-test
19 [ t ] [ 10 10 <board> 10 <random-piece> piece-valid? ] unit-test
20 [ f ] [ 2 3 <board> 10 <random-piece> { 1 2 } >>location piece-valid? ] unit-test
21 [ { { f } { f } } ] [ 1 1 <board> add-row rows>> ] unit-test
22 [ { { f } } ] [ 1 2 <board> dup { 0 1 } red set-block remove-full-rows rows>> ] unit-test
23 [ { { f } { f } } ] [ 1 2 <board> dup { 0 1 } red set-block dup check-rows drop rows>> ] unit-test