summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorLeo Tenenbaum <pommicket@gmail.com>2020-05-02 15:39:50 -0400
committerLeo Tenenbaum <pommicket@gmail.com>2020-05-02 15:39:50 -0400
commit8c2327e430ca63349c28816b47d04147873c1aca (patch)
treeea8771d94fe7fa6656c6f6b3795b8c17acbc63a9 /tests
parent5c1bc458fbeb1c65c5f39ad9f3389f5dcf1e0c8a (diff)
&&, ||
Diffstat (limited to 'tests')
-rw-r--r--tests/bools.toc22
-rw-r--r--tests/bools_expected2
2 files changed, 24 insertions, 0 deletions
diff --git a/tests/bools.toc b/tests/bools.toc
new file mode 100644
index 0000000..b181972
--- /dev/null
+++ b/tests/bools.toc
@@ -0,0 +1,22 @@
+#include "std/io.toc";
+
+foo ::= fn() total := 0{
+ if "foo" || (1/0) {
+ total += 1;
+ }
+ if !"foo" && (1/0) {
+ total += 100;
+ }
+ if "foo" || "bar" && 0 {
+ total += 10;
+ }
+ if !"foo" || !"bar" {
+ total += 1000;
+ }
+}
+main ::= fn() {
+ a := foo();
+ b ::= foo();
+ puti(a);
+ puti(b);
+}
diff --git a/tests/bools_expected b/tests/bools_expected
new file mode 100644
index 0000000..47e3206
--- /dev/null
+++ b/tests/bools_expected
@@ -0,0 +1,2 @@
+11
+11