summaryrefslogtreecommitdiff
path: root/lib/std/test/slcp.myr
diff options
context:
space:
mode:
authorOri Bernstein <ori@eigenstate.org>2016-01-26 21:55:41 -0800
committerOri Bernstein <ori@eigenstate.org>2016-01-26 21:55:41 -0800
commitecf804181e6f13348bd04382fd4c1cb3b60431be (patch)
treedbc07846b80b879da88ef1ed69c5f4a149a9f5b0 /lib/std/test/slcp.myr
parent56273857e915a16847c703d77ac812779299612d (diff)
downloadmc-ecf804181e6f13348bd04382fd4c1cb3b60431be.tar.gz
Add test for byte subrange copies.
Diffstat (limited to 'lib/std/test/slcp.myr')
-rw-r--r--lib/std/test/slcp.myr10
1 files changed, 10 insertions, 0 deletions
diff --git a/lib/std/test/slcp.myr b/lib/std/test/slcp.myr
index 5c7ecdc..07381c3 100644
--- a/lib/std/test/slcp.myr
+++ b/lib/std/test/slcp.myr
@@ -3,12 +3,22 @@ use std
const main = {
var a = [1,2,3,4,5]
var b = [6,7,8,9,10]
+ var c : byte[16] = [
+ 0, 1, 2, 3, 4, 5, 6, 7,
+ 8, 9, 10, 11, 12, 13, 14, 15
+ ]
var a_cped = [3, 4, 5, 4, 5]
var b_cped = [6, 7, 6, 7, 8]
+ var c_cped : byte[16] = [
+ 0, 0, 1, 2, 3, 4, 5, 6,
+ 7, 8, 9, 10, 11, 12, 13, 15
+ ]
std.slcp(a[:a.len-2], a[2:])
std.slcp(b[2:], b[:b.len-2])
+ std.slcp(c[1:15], c[0:14])
std.assert(std.sleq(a[:], a_cped[:]), "slcp of a failed: got {}, wanted {}", a[:], a_cped[:])
std.assert(std.sleq(b[:], b_cped[:]), "slcp of b failed: got {}, wanted {}", b[:], b_cped[:])
+ std.assert(std.sleq(c[:], c_cped[:]), "slcp of b failed: got {r}, wanted {r}", c[:], c_cped[:])
}