aboutsummaryrefslogtreecommitdiff
path: root/testsuite/runnable/slice_slice.elna
diff options
context:
space:
mode:
Diffstat (limited to 'testsuite/runnable/slice_slice.elna')
-rw-r--r--testsuite/runnable/slice_slice.elna13
1 files changed, 13 insertions, 0 deletions
diff --git a/testsuite/runnable/slice_slice.elna b/testsuite/runnable/slice_slice.elna
new file mode 100644
index 0000000..d6f309f
--- /dev/null
+++ b/testsuite/runnable/slice_slice.elna
@@ -0,0 +1,13 @@
+var
+ array: [5]Int := [5]Int{ 2, 4, 6, 8, 10 }
+ slice1, slice2: []Int
+
+begin
+ slice1 := array.ptr[1 to array.length];
+ slice2 := slice1[2 to 4];
+
+ assert(slice2.length = 3u);
+ assert(slice2[1] = 4);
+ assert(slice2[2] = 6);
+ assert(slice2[3] = 8)
+end.