1 | test_check = ->
|
2 | if DEBUG then console.log "test_check ----------------------------"
|
3 |
|
4 | run_test [
|
5 |
|
6 | # note how check can turn an assignment
|
7 | # into a test, so in this case a is not
|
8 | # assigned anything
|
9 |
|
10 | "check(a=b)",
|
11 | "testeq(a,b)",
|
12 |
|
13 | "a",
|
14 | "a",
|
15 |
|
16 | "check(a=a)",
|
17 | "1",
|
18 |
|
19 | "check(a==a)",
|
20 | "1",
|
21 |
|
22 | "check(a===a)",
|
23 | "check(a=== ? a)\nStop: syntax error",
|
24 |
|
25 | "check(a+1=a)",
|
26 | "0",
|
27 |
|
28 | "check(a+1==a)",
|
29 | "0",
|
30 |
|
31 | "check(a+1===a)",
|
32 | "check(a+1=== ? a)\nStop: syntax error",
|
33 |
|
34 | "check(1)",
|
35 | "1",
|
36 |
|
37 | "check(0)",
|
38 | "0",
|
39 |
|
40 | "check(and(1,0))",
|
41 | "0",
|
42 |
|
43 | "check(and(1,1))",
|
44 | "1",
|
45 |
|
46 | # if not a predicate, just return
|
47 | # what passed
|
48 | "check(pi)",
|
49 | "pi",
|
50 |
|
51 | ]
|