From 582040e5d3f6a5fb5b9046964b6823891d2802dd Mon Sep 17 00:00:00 2001 From: Eugen Wissner Date: Sun, 13 Oct 2024 12:59:47 +0200 Subject: Implement comparison operators --- tests/vm/printi_if_greater.elna | 6 ++++++ tests/vm/printi_if_greater_equal.elna | 6 ++++++ tests/vm/printi_if_less.elna | 6 ++++++ tests/vm/printi_if_less_equal.elna | 6 ++++++ tests/vm/printi_if_not.elna | 6 ++++++ tests/vm/printi_if_not_compound.elna | 9 +++++++++ 6 files changed, 39 insertions(+) create mode 100644 tests/vm/printi_if_greater.elna create mode 100644 tests/vm/printi_if_greater_equal.elna create mode 100644 tests/vm/printi_if_less.elna create mode 100644 tests/vm/printi_if_less_equal.elna create mode 100644 tests/vm/printi_if_not.elna create mode 100644 tests/vm/printi_if_not_compound.elna (limited to 'tests/vm') diff --git a/tests/vm/printi_if_greater.elna b/tests/vm/printi_if_greater.elna new file mode 100644 index 0000000..57d5ba5 --- /dev/null +++ b/tests/vm/printi_if_greater.elna @@ -0,0 +1,6 @@ +proc main() { + if ((1 + 1) > 2) + printi(3); + else + printi(5); +} diff --git a/tests/vm/printi_if_greater_equal.elna b/tests/vm/printi_if_greater_equal.elna new file mode 100644 index 0000000..95eb503 --- /dev/null +++ b/tests/vm/printi_if_greater_equal.elna @@ -0,0 +1,6 @@ +proc main() { + if ((1 + 1) >= (2 + 3)) + printi(3); + else + printi(5); +} diff --git a/tests/vm/printi_if_less.elna b/tests/vm/printi_if_less.elna new file mode 100644 index 0000000..2cee6d8 --- /dev/null +++ b/tests/vm/printi_if_less.elna @@ -0,0 +1,6 @@ +proc main() { + if (1 < 2) + printi(3); + else + printi(5); +} diff --git a/tests/vm/printi_if_less_equal.elna b/tests/vm/printi_if_less_equal.elna new file mode 100644 index 0000000..06a162d --- /dev/null +++ b/tests/vm/printi_if_less_equal.elna @@ -0,0 +1,6 @@ +proc main() { + if (2 <= (2 + 1)) + printi(3); + else + printi(5); +} diff --git a/tests/vm/printi_if_not.elna b/tests/vm/printi_if_not.elna new file mode 100644 index 0000000..aafe182 --- /dev/null +++ b/tests/vm/printi_if_not.elna @@ -0,0 +1,6 @@ +proc main() { + if (1 # 2) + printi(3); + else + printi(5); +} diff --git a/tests/vm/printi_if_not_compound.elna b/tests/vm/printi_if_not_compound.elna new file mode 100644 index 0000000..1149a35 --- /dev/null +++ b/tests/vm/printi_if_not_compound.elna @@ -0,0 +1,9 @@ +proc main() { + if (1 # 2) { + printi(3); + printi(7); + } else { + printi(5); + printi(9); + } +} -- cgit v1.2.3