diff options
| author | Eugen Wissner <belka@caraus.de> | 2026-10-07 17:33:40 +0200 |
|---|---|---|
| committer | Eugen Wissner <belka@caraus.de> | 2026-10-07 17:45:20 +0200 |
| commit | 12e304fd56f054ba7296ab538eecd4280a67832a (patch) | |
| tree | 218f37dc04fa14323d2ca7704e47a830dcd98b22 /testsuite/runnable | |
| parent | f547dae96d770cc7bc27d3790d0d87bb8e37963d (diff) | |
| download | elna-12e304fd56f054ba7296ab538eecd4280a67832a.tar.gz | |
Allow assigning contants to enumeration members
Diffstat (limited to 'testsuite/runnable')
| -rw-r--r-- | testsuite/runnable/enumeration_members.elna | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/testsuite/runnable/enumeration_members.elna b/testsuite/runnable/enumeration_members.elna new file mode 100644 index 0000000..b865f98 --- /dev/null +++ b/testsuite/runnable/enumeration_members.elna @@ -0,0 +1,19 @@ +program() +type + E1 = (one, two, three, four) + E2 = (zero = 0, one, two, three) + E3 = (minus = -5, two = 2, ten = 10) + +begin + assert(cast(E1.one: Int) = 1); + assert(cast(E1.two: Int) = 2); + assert(cast(E1.four: Int) = 4); + + assert(cast(E2.zero: Int) = 0); + assert(cast(E2.one: Int) = 1); + assert(cast(E2.three: Int) = 3); + + assert(cast(E3.minus: Int) = -5); + assert(cast(E3.two: Int) = 2); + assert(cast(E3.ten: Int) = 10) +end. |
