summaryrefslogtreecommitdiff
path: root/lib/std/test/sleq.myr
blob: c15807fb663c3174accd1656ebd2caec76109673 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
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)
}