Move size-of to unmaintained until help-lint is fixed
[factor/jcg.git] / unmaintained / trees / trees-tests.factor
blobfd26b37c704c5afa1d7c255e5486397fd0ec5201
1 USING: trees assocs tools.test kernel sequences ;
2 IN: trees.tests
4 : test-tree ( -- tree )
5     TREE{
6         { 7 "seven" }
7         { 9 "nine" }
8         { 4 "four" } 
9         { 4 "replaced four" } 
10         { 7 "replaced seven" }
11     } clone ;
13 ! test set-at, at, at*
14 [ "seven" ] [ <tree> "seven" 7 pick set-at 7 swap at ] unit-test
15 [ "seven" t ] [ <tree> "seven" 7 pick set-at 7 swap at* ] unit-test
16 [ f f ] [ <tree> "seven" 7 pick set-at 8 swap at* ] unit-test
17 [ "seven" ] [ <tree> "seven" 7 pick set-at 7 swap at ] unit-test
18 [ "replacement" ] [ <tree> "seven" 7 pick set-at "replacement" 7 pick set-at 7 swap at ] unit-test
19 [ "replaced four" ] [ test-tree 4 swap at ] unit-test
20 [ "nine" ] [ test-tree 9 swap at ] unit-test
22 ! test delete-at
23 [ f ] [ test-tree 9 over delete-at 9 swap at ] unit-test
24 [ "replaced seven" ] [ test-tree 9 over delete-at 7 swap at ] unit-test
25 [ "replaced four" ] [ test-tree 9 over delete-at 4 swap at ] unit-test
26 [ "nine" "replaced four" ] [ test-tree 7 over delete-at 9 over at 4 rot at ] unit-test
27 [ "nine" ] [ test-tree 7 over delete-at 4 over delete-at 9 swap at ] unit-test