xref: /illumos-gate/usr/src/common/ficl/test/testcase.fr (revision c5bab7026b8e0ac44b25ee08507ea360f177d844)
1
2
31 2 3
4.s-simple
5cr
6
7: test-case ( n -- )
8	case
9		0 of
10			." zero"
11			endof
12		1 of
13			." one"
14			endof
15		." something else"
16	endcase
17	cr
18	;
19
20
21see test-case
22
23.( You should see [3] 1 2 3 -> )
24.s-simple
25.( <-) cr
26
27.( You should see "zero": )
280 test-case
29
30.( You should see "one": )
311 test-case
32
33.( You should see "something else": )
34324 test-case
35
36.( You should still see [3] 1 2 3 -> )
37.s-simple
38.( <-) cr
39
40
41: test-case-2 ( n -- )
42	case
43		0 of
44			." zero"
45			fallthrough
46		1 of
47			." one"
48			endof
49		2 of
50			." two"
51			fallthrough
52		." something else"
53	endcase
54	cr
55	;
56
57
58see test-case-2
59
60cr
61
62.( You should once more see [3] 1 2 3 -> )
63.s-simple
64.( <-) cr
65
66.( You should see "zeroone": )
670 test-case-2
68
69.( You should see "one": )
701 test-case-2
71
72.( You should see "two": )
732 test-case-2
74
75.( You should see "something else": )
76324 test-case-2
77
78.( You should still see [3] 1 2 3 -> )
79.s-simple
80.( <-) cr
81
82
83
84bye
85