aboutsummaryrefslogtreecommitdiff
path: root/testsuite/runnable/for_each_slice.elna
diff options
context:
space:
mode:
Diffstat (limited to 'testsuite/runnable/for_each_slice.elna')
-rw-r--r--testsuite/runnable/for_each_slice.elna15
1 files changed, 15 insertions, 0 deletions
diff --git a/testsuite/runnable/for_each_slice.elna b/testsuite/runnable/for_each_slice.elna
new file mode 100644
index 0000000..efdf961
--- /dev/null
+++ b/testsuite/runnable/for_each_slice.elna
@@ -0,0 +1,15 @@
+var
+ actual: [4]Word := [4]Word{}
+ input: [4]Word := [4]Word{ 2u, 4u, 6u, 8u }
+ slice: []Word
+ i: Word := 1u
+
+begin
+ slice := input[1u to input.length];
+
+ for element of slice do
+ actual[i] := element^ * 2u;
+ i := i + 1u
+ end;
+ assert(actual = [4]Word{ 4u, 8u, 12u, 16u })
+end.