From 8c2327e430ca63349c28816b47d04147873c1aca Mon Sep 17 00:00:00 2001 From: Leo Tenenbaum Date: Sat, 2 May 2020 15:39:50 -0400 Subject: &&, || --- tests/bools.toc | 22 ++++++++++++++++++++++ tests/bools_expected | 2 ++ 2 files changed, 24 insertions(+) create mode 100644 tests/bools.toc create mode 100644 tests/bools_expected (limited to 'tests') 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 -- cgit v1.2.3