blob: 5aaf2f265dcea31451f729d9555172b7d39f9341 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
|
require printer.fs
\ === basic testing util === /
: test=
2dup = if
2drop
else
cr ." assert failed on line " sourceline# .
swap cr ." | got " . cr ." | expected " . cr
endif ;
\ array function tests
create za 2 , 6 , 7 , 10 , 15 , 80 , 81 ,
7 za 2 array-find -1 test= 0 test=
7 za 6 array-find -1 test= 1 test=
7 za 10 array-find -1 test= 3 test=
7 za 81 array-find -1 test= 6 test=
7 za 12 array-find 0 test= 4 test=
7 za 8 array-find 0 test= 3 test=
7 za 100 array-find 0 test= 7 test=
7 za 1 array-find 0 test= 0 test=
10 new-array
1 swap 0 5 array-insert
2 swap 1 7 array-insert
3 swap 3 12 array-insert
4 swap 4 15 array-insert
5 swap 5 20 array-insert
dup 0 cells + @ 5 test=
dup 1 cells + @ 7 test=
dup 2 cells + @ 10 test=
dup 3 cells + @ 12 test=
dup 4 cells + @ 15 test=
dup 5 cells + @ 20 test=
\ MalType tests
MalList new MalList new = 0 test=
MalList new dup MalList/car 5 swap ! MalList/car @ 5 test=
\ Protocol tests
mal-nil
42 MalInt. mal-nil conj
10 MalInt. mal-nil conj conj
20 MalInt. swap conj
23 MalInt. mal-nil conj conj conj
pr-str s" (nil (20 (42) 10) 23)" str= -1 test=
|