summaryrefslogtreecommitdiff
path: root/lib/std/test
diff options
context:
space:
mode:
authorS. Gilles <sgilles@math.umd.edu>2017-11-09 19:51:58 -0500
committerOri Bernstein <ori@eigenstate.org>2017-11-09 19:30:12 -0800
commit6aab6b7b0d8fb0e37f7021f17714efbe02a227bb (patch)
tree893b44991e872dd2fe22902172c5cf27bbd47553 /lib/std/test
parent76fc43acecea75b362d7e56557a0466cbda94572 (diff)
downloadmc-6aab6b7b0d8fb0e37f7021f17714efbe02a227bb.tar.gz
Allow sleq to read far enough into the array to compare wide types
Diffstat (limited to 'lib/std/test')
-rw-r--r--lib/std/test/sleq.myr25
1 files changed, 25 insertions, 0 deletions
diff --git a/lib/std/test/sleq.myr b/lib/std/test/sleq.myr
new file mode 100644
index 0000000..c15807f
--- /dev/null
+++ b/lib/std/test/sleq.myr
@@ -0,0 +1,25 @@
+use std
+
+use testr
+
+const main = {
+ testr.run([
+ [.name = "wider-than-byte", .fn = wide],
+ [.name = "slices", .fn = slices],
+ ][:])
+}
+
+const wide = {c
+ var a : uint[3] = [ 0, 1, 2]
+ var b : uint[3] = [ 0, 1, 3]
+ testr.check(c, !std.sleq(a[:], b[:]), "expected {} != {} as uint[:]", a, b)
+}
+
+const slices = {c
+ var a : int8[8] = [ 0, 0, 3, 1, 0, 3, 1, 2 ]
+ var b : int8[3] = [ 1, 0, 3]
+ testr.check(c, std.sleq(a[1:4], a[4:7]), "expected {} = {}", a[1:4], a[4:7])
+ testr.check(c, !std.sleq(a[0:4], a[3:7]), "expected {} = {}", a[0:4], a[3:7])
+ testr.check(c, !std.sleq(a[:], b[:]), "expected {} = {}", a, b)
+ testr.check(c, !std.sleq(a[3:7], b[:]), "expected {} = {}", a[3:7], b)
+}