diff options
author | Bad Diode <bd@badd10de.dev> | 2021-10-10 12:11:45 +0200 |
---|---|---|
committer | Bad Diode <bd@badd10de.dev> | 2021-10-10 12:11:45 +0200 |
commit | 4673fde605090320fbab227e56bb085eec97362a (patch) | |
tree | 5d510484d5543b4b11fd62b42a4b1e14672ff2cd /examples/booleans.bdl | |
parent | c2bfb5368e603d686190fdc9f3ddbafbda075a9c (diff) | |
download | bdl-4673fde605090320fbab227e56bb085eec97362a.tar.gz bdl-4673fde605090320fbab227e56bb085eec97362a.zip |
Add boolean primitives and more (better) tests
Diffstat (limited to 'examples/booleans.bdl')
-rw-r--r-- | examples/booleans.bdl | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/examples/booleans.bdl b/examples/booleans.bdl new file mode 100644 index 0000000..d248bf8 --- /dev/null +++ b/examples/booleans.bdl | |||
@@ -0,0 +1,45 @@ | |||
1 | ;; | ||
2 | ;; Boolean primitives. | ||
3 | ;; | ||
4 | |||
5 | ;; Boolean test. | ||
6 | (print "(boolean? true) -> ") (boolean? true) | ||
7 | (print "(boolean? false) -> ") (boolean? false) | ||
8 | (print "(boolean? 1) -> ") (boolean? 1) | ||
9 | (print "(boolean? 5) -> ") (boolean? 5) | ||
10 | (print "(boolean? \"string\") -> ") (boolean? "string") | ||
11 | (print "(boolean? (+ 1 2 3)) -> ") (boolean? (+ 1 2 3)) | ||
12 | (print "(boolean? (not 1)) -> ") (boolean? (not 1)) | ||
13 | |||
14 | ;; Not. | ||
15 | (print "(not true) -> ") (not true) | ||
16 | (print "(not false) -> ") (not false) | ||
17 | (print "(not (not true)) -> ") (not (not true)) | ||
18 | (print "(not (not false)) -> ") (not (not false)) | ||
19 | (print "(not 1) -> ") (not 1) | ||
20 | (print "(not (not 1)) -> ") (not (not 1)) | ||
21 | (print "(not \"string\") -> ") (not "string") | ||
22 | (print "(not (not \"string\")) -> ") (not (not "string")) | ||
23 | |||
24 | ;; And. | ||
25 | (print "(and 1 \"string\" 4 true) -> ") (and 1 "string" 4 true) | ||
26 | (print "(and true true true) -> ") (and true true true) | ||
27 | (print "(and (+ 1 2 3)) -> ") (and (+ 1 2 3)) | ||
28 | (print "(and false false false) -> ") (and false false false) | ||
29 | (print "(and true false false) -> ") (and true false false) | ||
30 | (print "(and false true false) -> ") (and false true false) | ||
31 | (print "(and false true true) -> ") (and false true true) | ||
32 | (print "(and (not false) true true) -> ") (and (not false) true true) | ||
33 | |||
34 | ;; Or. | ||
35 | (print "(or 1 \"string\" 4 true) -> ") (or 1 "string" 4 true) | ||
36 | (print "(or false 1) -> ") (or false 1) | ||
37 | (print "(or false \"string\") -> ") (or false "string") | ||
38 | (print "(or false) -> ") (or false) | ||
39 | (print "(or true true true) -> ") (or true true true) | ||
40 | (print "(or false false false) -> ") (or false false false) | ||
41 | (print "(or true false false) -> ") (or true false false) | ||
42 | (print "(or false true false) -> ") (or false true false) | ||
43 | (print "(or false true true) -> ") (or false true true) | ||
44 | (print "(or (not false) true true) -> ") (or (not false) true true) | ||
45 | (print "(or (not true) false) -> ") (or (not true) false) | ||