remove math.blas.syntax and merge parsing words into math.blas.vectors/matrices
[factor/jcg.git] / basis / tools / walker / walker-tests.factor
blobf8026765830160e95a7d10b151bac86c2d4e6da2
1 USING: tools.walker io io.streams.string kernel math
2 math.private namespaces prettyprint sequences tools.test
3 continuations math.parser threads arrays tools.walker.debug
4 generic.standard sequences.private kernel.private ;
5 IN: tools.walker.tests
7 [ { } ] [
8     [ ] test-walker
9 ] unit-test
11 [ { 1 } ] [
12     [ 1 ] test-walker
13 ] unit-test
15 [ { 1 2 3 } ] [
16     [ 1 2 3 ] test-walker
17 ] unit-test
19 [ { "Yo" 2 } ] [
20     [ 2 [ "Yo" ] dip ] test-walker
21 ] unit-test
23 [ { "Yo" 2 3 } ] [
24     [ 2 [ "Yo" ] dip 3 ] test-walker
25 ] unit-test
27 [ { 2 } ] [
28     [ t [ 2 ] [ "hi" ] if ] test-walker
29 ] unit-test
31 [ { "hi" } ] [
32     [ f [ 2 ] [ "hi" ] if ] test-walker
33 ] unit-test
35 [ { 4 } ] [
36     [ 2 2 fixnum+ ] test-walker
37 ] unit-test
39 : foo 2 2 fixnum+ ;
41 [ { 8 } ] [
42     [ foo 4 fixnum+ ] test-walker
43 ] unit-test
45 [ { C{ 1 1.5 } { } C{ 1 1.5 } { } } ] [
46     [ C{ 1 1.5 } { } 2dup ] test-walker
47 ] unit-test
49 [ { t } ] [
50     [ 5 5 number= ] test-walker
51 ] unit-test
53 [ { f } ] [
54     [ 5 6 number= ] test-walker
55 ] unit-test
57 [ { 0 } ] [
58     [ 0 { array-capacity } declare ] test-walker
59 ] unit-test
61 [ { f } ] [
62     [ "XYZ" "XYZ" mismatch ] test-walker
63 ] unit-test
65 [ { t } ] [
66     [ "XYZ" "XYZ" sequence= ] test-walker
67 ] unit-test
69 [ { t } ] [
70     [ "XYZ" "XYZ" = ] test-walker
71 ] unit-test
73 [ { f } ] [
74     [ "XYZ" "XuZ" = ] test-walker
75 ] unit-test
77 [ { 4 } ] [
78     [ 2 2 + ] test-walker
79 ] unit-test
81 [ { 3 } ] [
82     [ [ 3 "x" set "x" get ] with-scope ] test-walker
83 ] unit-test
85 [ { "hi\n" } ] [
86     [ [ "hi" print ] with-string-writer ] test-walker
87 ] unit-test
89 [ { "4\n" } ] [
90     [ [ 2 2 + number>string print ] with-string-writer ] test-walker
91 ] unit-test
92                                                             
93 [ { 1 2 3 } ] [
94     [ { 1 2 3 } set-datastack ] test-walker
95 ] unit-test
97 [ { 6 } ]
98 [ [ 3 [ nip continue ] callcc0 2 * ] test-walker ] unit-test
100 [ { 6 } ]
101 [ [ [ 3 swap continue-with ] callcc1 2 * ] test-walker ] unit-test
103 [ { } ]
104 [ [ [ ] [ ] recover ] test-walker ] unit-test
106 [ { 6 } ]
107 [ [ [ 3 throw ] [ 2 * ] recover ] test-walker ] unit-test
109 [ { T{ no-method f + nth } } ]
110 [ [ [ 0 \ + nth ] [ ] recover ] test-walker ] unit-test
112 [ { } ] [
113     [ "a" "b" set "c" "d" set [ ] test-walker ] with-scope
114 ] unit-test