xref: /titanic_52/usr/src/common/ficl/test/ficltest.fr (revision a1bf3f785ae05c419b339c3a2061f2b18c024f61)
1*a1bf3f78SToomas Soome\ test file for ficl
2*a1bf3f78SToomas Soome\ test ANSI CORE stuff first...
3*a1bf3f78SToomas Soome-1 set-order
4*a1bf3f78SToomas Soome
5*a1bf3f78SToomas Soome\ set up local variable regressions before { gets redefined!
6*a1bf3f78SToomas Soome: local1 { a b c | clr -- c b a 0 }
7*a1bf3f78SToomas Soome    c b a clr
8*a1bf3f78SToomas Soome;
9*a1bf3f78SToomas Soome
10*a1bf3f78SToomas Soome: local2 { | clr -- 0 } clr ;
11*a1bf3f78SToomas Soome: local3 { a b | c }
12*a1bf3f78SToomas Soome    a to c
13*a1bf3f78SToomas Soome    b to a
14*a1bf3f78SToomas Soome    c to b
15*a1bf3f78SToomas Soome    a b
16*a1bf3f78SToomas Soome;
17*a1bf3f78SToomas Soome
18*a1bf3f78SToomas Soomeinclude tester.fr
19*a1bf3f78SToomas Soomeinclude core.fr
20*a1bf3f78SToomas Soome
21*a1bf3f78SToomas Soome{ -> }
22*a1bf3f78SToomas Soome\ test double stuff
23*a1bf3f78SToomas Soometesting 2>r 2r> 2r@
24*a1bf3f78SToomas Soome: 2r1  2>r r> r> swap ;
25*a1bf3f78SToomas Soome: 2r2  swap >r >r 2r> ;
26*a1bf3f78SToomas Soome: 2r3  2>r 2r@ R> R> 2DUP >R >R SWAP 2r> ;
27*a1bf3f78SToomas Soome
28*a1bf3f78SToomas Soome{ 1 2 2r1 -> 1 2 }
29*a1bf3f78SToomas Soome{ 1 2 2r2 -> 1 2 }
30*a1bf3f78SToomas Soome{ 1 2 2r3 -> 1 2 1 2 1 2 }
31*a1bf3f78SToomas Soome{ -> }
32*a1bf3f78SToomas Soome
33*a1bf3f78SToomas Soome\ Now test ficl extras and optional word-sets
34*a1bf3f78SToomas Soometesting locals
35*a1bf3f78SToomas Soome{ 1 2 3 local1 -> 3 2 1 0 }
36*a1bf3f78SToomas Soome{ local2 -> 0 }
37*a1bf3f78SToomas Soome{ 1 local2 -> 1 0 }
38*a1bf3f78SToomas Soome{ 1 2 local3 -> 2 1 }
39*a1bf3f78SToomas Soome
40*a1bf3f78SToomas Soometesting :noname
41*a1bf3f78SToomas Soome{ :noname 1 ; execute -> 1 }
42*a1bf3f78SToomas Soome{ 1 2 3 -rot -> 3 1 2 }
43*a1bf3f78SToomas Soome
44*a1bf3f78SToomas Soometesting default search order
45*a1bf3f78SToomas Soome{ get-order -> forth-wordlist 1 }
46*a1bf3f78SToomas Soome{ only definitions get-order -> forth-wordlist 1 }
47*a1bf3f78SToomas Soome
48*a1bf3f78SToomas Soometesting forget
49*a1bf3f78SToomas Soomehere constant fence
50*a1bf3f78SToomas Soome{ fence forget fence -> here }
51*a1bf3f78SToomas Soome
52*a1bf3f78SToomas Soometesting within
53*a1bf3f78SToomas Soome{ -1 1 0    within -> true }
54*a1bf3f78SToomas Soome{  0 1s 2   within -> true }
55*a1bf3f78SToomas Soome{ -100 0 -1 within -> true }
56*a1bf3f78SToomas Soome{ -1 1 2    within -> false }
57*a1bf3f78SToomas Soome{ -1 1 -2   within -> false }
58*a1bf3f78SToomas Soome{ 1 -5 5    within -> true }
59*a1bf3f78SToomas Soome{ 33000 32000 34000 within -> true }
60*a1bf3f78SToomas Soome{ 0x80000000 0x7f000000 0x81000000 within -> true }
61*a1bf3f78SToomas Soome
62*a1bf3f78SToomas Soometesting exception words
63*a1bf3f78SToomas Soome: exc1 1 throw ;
64*a1bf3f78SToomas Soome: exctest1 [ ' exc1 ] literal catch ;
65*a1bf3f78SToomas Soome: exc2 exctest1 1 = if 2 throw endif ;
66*a1bf3f78SToomas Soome: exctest2 [ ' exc2 ] literal catch ;
67*a1bf3f78SToomas Soome: exctest? ' catch ;
68*a1bf3f78SToomas Soome
69*a1bf3f78SToomas Soome{ exctest1 -> 1 }
70*a1bf3f78SToomas Soome{ exctest2 -> 2 }
71*a1bf3f78SToomas Soome{ exctest? abort -> -1 }
72*a1bf3f78SToomas Soome
73*a1bf3f78SToomas Soometesting refill
74*a1bf3f78SToomas Soome\ from file loading
75*a1bf3f78SToomas Soome0 [if]
76*a1bf3f78SToomas Soome.( Error )
77*a1bf3f78SToomas Soome[else]
78*a1bf3f78SToomas Soome1 [if]
79*a1bf3f78SToomas Soome[else]
80*a1bf3f78SToomas Soome.( Error )
81*a1bf3f78SToomas Soome[then]
82*a1bf3f78SToomas Soome[then]
83*a1bf3f78SToomas Soome
84*a1bf3f78SToomas Soome\ refill from evaluate string
85*a1bf3f78SToomas Soome{ -> }
86*a1bf3f78SToomas Soome{ s" 1 refill 2 " evaluate -> 1 0 2 }
87*a1bf3f78SToomas Soome
88*a1bf3f78SToomas Soome
89*a1bf3f78SToomas Soometesting prefixes
90*a1bf3f78SToomas Soome{ 0x10 -> decimal 16 }
91*a1bf3f78SToomas Soome{ hex 0d10 -> decimal 10 }
92*a1bf3f78SToomas Soome{ hex 100
93*a1bf3f78SToomas Soome-> decimal 256 }
94*a1bf3f78SToomas Soome
95*a1bf3f78SToomas Soometesting number builder
96*a1bf3f78SToomas Soome{ 1 -> 1 }
97*a1bf3f78SToomas Soome{ 3. -> 3 0 }
98*a1bf3f78SToomas Soome
99*a1bf3f78SToomas Soome
100*a1bf3f78SToomas Soomes" ficlwin" environment?
101*a1bf3f78SToomas Soome[if]
102*a1bf3f78SToomas Soomedrop
103*a1bf3f78SToomas Soometesting OOP support
104*a1bf3f78SToomas Soomeinclude ooptest.fr
105*a1bf3f78SToomas Soome[endif]
106