diff options
| author | Eugen Wissner <belka@caraus.de> | 2026-08-21 00:05:03 +0200 |
|---|---|---|
| committer | Eugen Wissner <belka@caraus.de> | 2026-08-21 00:05:03 +0200 |
| commit | 39269cc68a32f6e1a7524b00da36a1fe4cc7fb8b (patch) | |
| tree | 9558cd6107d60e22127faeddbdeac5031ee2fdbe /testsuite | |
| parent | 4f77ad5d019618893c59a0f8d5bfa6b98e50a3be (diff) | |
| download | elna-39269cc68a32f6e1a7524b00da36a1fe4cc7fb8b.tar.gz | |
Implement Single and Double floats
Diffstat (limited to 'testsuite')
| -rw-r--r-- | testsuite/compilable/double_literals.elna | 9 | ||||
| -rw-r--r-- | testsuite/compilable/float_literals.elna | 9 | ||||
| -rw-r--r-- | testsuite/compilable/single_literals.elna | 9 | ||||
| -rw-r--r-- | testsuite/fail_compilation/float_remainder.elna | 8 | ||||
| -rw-r--r-- | testsuite/runnable/float_arithmetic.elna | 13 |
5 files changed, 39 insertions, 9 deletions
diff --git a/testsuite/compilable/double_literals.elna b/testsuite/compilable/double_literals.elna new file mode 100644 index 0000000..9e8a73d --- /dev/null +++ b/testsuite/compilable/double_literals.elna @@ -0,0 +1,9 @@ +proc f() +var + x: const Double := 3.14 + y: const Double := 1e10 + z: const Double := 4.567e8 + t: const Double := 2.5E-3 +return + +end. diff --git a/testsuite/compilable/float_literals.elna b/testsuite/compilable/float_literals.elna deleted file mode 100644 index 77af6b1..0000000 --- a/testsuite/compilable/float_literals.elna +++ /dev/null @@ -1,9 +0,0 @@ -proc f() -var - x: const Float := 3.14 - y: const Float := 1e10 - z: const Float := 4.567e8 - t: const Float := 2.5E-3 -return - -end. diff --git a/testsuite/compilable/single_literals.elna b/testsuite/compilable/single_literals.elna new file mode 100644 index 0000000..ac03623 --- /dev/null +++ b/testsuite/compilable/single_literals.elna @@ -0,0 +1,9 @@ +proc f() +var + x: const Single := 3.14f + y: const Single := 1e10f + z: const Single := 4.567e8f + t: const Single := 2.5E-3f +return + +end. diff --git a/testsuite/fail_compilation/float_remainder.elna b/testsuite/fail_compilation/float_remainder.elna new file mode 100644 index 0000000..ec6c9e2 --- /dev/null +++ b/testsuite/fail_compilation/float_remainder.elna @@ -0,0 +1,8 @@ +proc f() +var + x: Double +begin + x := 5.0 % 2.0 (* @Error Invalid operands of type 'Double' and 'Double' for operator % *) +return + +end. diff --git a/testsuite/runnable/float_arithmetic.elna b/testsuite/runnable/float_arithmetic.elna new file mode 100644 index 0000000..73072f2 --- /dev/null +++ b/testsuite/runnable/float_arithmetic.elna @@ -0,0 +1,13 @@ +begin + assert(6.0 / 2.0 = 3.0); + assert(5.0 / 2.0 = 2.5); + assert(3.0 * 0.5 = 1.5); + assert(-3.0 + 1.0 = -2.0); + assert(10.0 - 4.0 = 6.0); + + assert(6.0f / 2.0f = 3.0f); + assert(5.0f / 2.0f = 2.5f); + assert(3.0f * 0.5f = 1.5f); + assert(1.0f / 4.0f = 0.25f); + assert(-3.14f < 0.0f) +end. |
