diff options
| author | Eugen Wissner <belka@caraus.de> | 2026-07-14 01:45:58 +0200 |
|---|---|---|
| committer | Eugen Wissner <belka@caraus.de> | 2026-07-14 01:45:58 +0200 |
| commit | 51e2f98e33ae10fc3052335cc6847bc93d0784fa (patch) | |
| tree | 7588effe2778d38d19adbf83cf23b5429df93691 /testsuite/runnable | |
| parent | 8ceb48a4e60b8ff89f28372da4f66cd152e2e0fe (diff) | |
| download | elna-51e2f98e33ae10fc3052335cc6847bc93d0784fa.tar.gz | |
Add static array initializer
Diffstat (limited to 'testsuite/runnable')
| -rw-r--r-- | testsuite/runnable/array_constructor.elna | 12 | ||||
| -rw-r--r-- | testsuite/runnable/record_construction.elna | 12 |
2 files changed, 24 insertions, 0 deletions
diff --git a/testsuite/runnable/array_constructor.elna b/testsuite/runnable/array_constructor.elna new file mode 100644 index 0000000..2ce3578 --- /dev/null +++ b/testsuite/runnable/array_constructor.elna @@ -0,0 +1,12 @@ +var + a: [3]Int := [3]Int{1, 2, 3} + b: [2]Int := [2]Int{4} + +begin + assert(a[1] = 1 & a[2] = 2 & a[3] = 3); + assert(b[1] = 4 & b[2] = 0); + + a := [3]Int{5, 6, 7}; + assert(a[1] = 5 & a[2] = 6 & a[3] = 7) +return 0 +end. diff --git a/testsuite/runnable/record_construction.elna b/testsuite/runnable/record_construction.elna new file mode 100644 index 0000000..00e60db --- /dev/null +++ b/testsuite/runnable/record_construction.elna @@ -0,0 +1,12 @@ +type + R = record + x, y: Int + end + +var + r: R := R{x: 1, y: 2} + +begin + assert(r.x = 1 & r.y = 2) +return 0 +end. |
