aboutsummaryrefslogtreecommitdiff
path: root/testsuite/runnable/slice_slice.elna
diff options
context:
space:
mode:
authorEugen Wissner <belka@caraus.de>2026-07-21 21:27:03 +0200
committerEugen Wissner <belka@caraus.de>2026-07-21 21:27:03 +0200
commit5cc2947143f2a6ebd4ef1ae4d25ab956b87de808 (patch)
tree0d4489b298da3be04ed4bce117f616468146a0f8 /testsuite/runnable/slice_slice.elna
parent44d6e8a27294e5ca7300ab11900011b73d9336d4 (diff)
downloadelna-cpp.tar.gz
Redefine strings as slice of constant charactersHEADcpp
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.