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/expectations/printi_if_greater.txt | 1 + tests/expectations/printi_if_greater_equal.txt | 1 + tests/expectations/printi_if_less.txt | 1 + tests/expectations/printi_if_less_equal.txt | 1 + tests/expectations/printi_if_not.txt | 1 + tests/expectations/printi_if_not_compound.txt | 2 ++ 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 +++++++++ 12 files changed, 46 insertions(+) create mode 100644 tests/expectations/printi_if_greater.txt create mode 100644 tests/expectations/printi_if_greater_equal.txt create mode 100644 tests/expectations/printi_if_less.txt create mode 100644 tests/expectations/printi_if_less_equal.txt create mode 100644 tests/expectations/printi_if_not.txt create mode 100644 tests/expectations/printi_if_not_compound.txt 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') diff --git a/tests/expectations/printi_if_greater.txt b/tests/expectations/printi_if_greater.txt new file mode 100644 index 0000000..7ed6ff8 --- /dev/null +++ b/tests/expectations/printi_if_greater.txt @@ -0,0 +1 @@ +5 diff --git a/tests/expectations/printi_if_greater_equal.txt b/tests/expectations/printi_if_greater_equal.txt new file mode 100644 index 0000000..7ed6ff8 --- /dev/null +++ b/tests/expectations/printi_if_greater_equal.txt @@ -0,0 +1 @@ +5 diff --git a/tests/expectations/printi_if_less.txt b/tests/expectations/printi_if_less.txt new file mode 100644 index 0000000..00750ed --- /dev/null +++ b/tests/expectations/printi_if_less.txt @@ -0,0 +1 @@ +3 diff --git a/tests/expectations/printi_if_less_equal.txt b/tests/expectations/printi_if_less_equal.txt new file mode 100644 index 0000000..00750ed --- /dev/null +++ b/tests/expectations/printi_if_less_equal.txt @@ -0,0 +1 @@ +3 diff --git a/tests/expectations/printi_if_not.txt b/tests/expectations/printi_if_not.txt new file mode 100644 index 0000000..00750ed --- /dev/null +++ b/tests/expectations/printi_if_not.txt @@ -0,0 +1 @@ +3 diff --git a/tests/expectations/printi_if_not_compound.txt b/tests/expectations/printi_if_not_compound.txt new file mode 100644 index 0000000..dde5d5d --- /dev/null +++ b/tests/expectations/printi_if_not_compound.txt @@ -0,0 +1,2 @@ +3 +7 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