From 12e304fd56f054ba7296ab538eecd4280a67832a Mon Sep 17 00:00:00 2001 From: Eugen Wissner Date: Wed, 7 Oct 2026 17:33:40 +0200 Subject: Allow assigning contants to enumeration members --- testsuite/runnable/enumeration_members.elna | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 testsuite/runnable/enumeration_members.elna (limited to 'testsuite') 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. -- cgit v1.2.3