]> gitweb.factorcode.org Git - factor.git/blob - basis/vlists/vlists-tests.factor
Resolved merge.
[factor.git] / basis / vlists / vlists-tests.factor
1 USING: vlists kernel persistent.sequences arrays tools.test
2 namespaces accessors sequences assocs ;
3 IN: vlists.tests
4
5 [ { "hi" "there" } ]
6 [ VL{ } "hi" swap ppush "there" swap ppush >array ] unit-test
7
8 [ VL{ "hi" "there" "foo" } VL{ "hi" "there" "bar" } t ]
9 [
10     VL{ } "hi" swap ppush "there" swap ppush "v" set
11     "foo" "v" get ppush
12     "bar" "v" get ppush
13     dup "baz" over ppush [ vector>> ] bi@ eq?
14 ] unit-test
15
16 [ "foo" VL{ "hi" "there" } t ]
17 [
18     VL{ "hi" "there" "foo" } dup "v" set
19     [ last ] [ ppop ] bi
20     dup "v" get [ vector>> ] bi@ eq?
21 ] unit-test
22
23 [ VL{ } 3 over push ] must-fail
24
25 [ 4 VL{ "hi" } set-first ] must-fail
26
27 [ 5 t ] [
28     "rice" VA{ { "rice" 5 } { "beans" 10 } } at*
29 ] unit-test
30
31 [ 6 t ] [
32     "rice" VA{ { "rice" 5 } { "beans" 10 } { "rice" 6 } } at*
33 ] unit-test
34
35 [ 3 ] [
36     VA{ { "rice" 5 } { "beans" 10 } { "rice" 6 } } assoc-size
37 ] unit-test
38
39 [ f f ] [
40     "meat" VA{ { "rice" 5 } { "beans" 10 } { "rice" 6 } } at*
41 ] unit-test