commit 021c68a81db9f554bc728a0cd924c3b990e74090
parent 831218a320a0ba436deb87f7aff9c0e508a1b873
Author: Drew DeVault <sir@cmpwn.com>
Date: Thu, 4 Feb 2021 14:20:35 -0500
bytes::equal: add test
Diffstat:
1 file changed, 12 insertions(+), 0 deletions(-)
diff --git a/bytes/equal.ha b/bytes/equal.ha
@@ -10,3 +10,15 @@ export fn equal(a: []u8, b: []u8) bool = {
};
return true;
};
+
+@test fn equal() void = {
+ let a: []u8 = [1u8, 2u8, 3u8];
+ let b: []u8 = [1u8, 2u8, 3u8];
+ let c: []u8 = [1u8, 4u8, 5u8];
+ let d: []u8 = [1u8, 2u8, 3u8, 4u8];
+ let e: []u8 = [1u8, 2u8];
+ assert(equal(a, b));
+ assert(!equal(a, c));
+ assert(!equal(a, d));
+ assert(!equal(a, e));
+};