commit 0b65d3224ec9fd9d69366275b7dbe37c052ed2da
parent 71c508537f45ac3915f42a0282b3aac345f15e14
Author: Drew DeVault <sir@cmpwn.com>
Date: Tue, 4 May 2021 10:29:50 -0400
hare::types: add more hash tests
Signed-off-by: Drew DeVault <sir@cmpwn.com>
Diffstat:
1 file changed, 28 insertions(+), 0 deletions(-)
diff --git a/hare/types/hash.ha b/hare/types/hash.ha
@@ -168,4 +168,32 @@ export fn hash(t: *_type) u32 = {
},
};
assert(hash(&sample) == 1072721578);
+
+ let sample = _type {
+ flags = flags::NONE,
+ _type = [
+ tuple_value {
+ offs = 0,
+ _type = &_int,
+ },
+ tuple_value {
+ offs = 4,
+ _type = &_int,
+ },
+ tuple_value {
+ offs = 8,
+ _type = &_int,
+ },
+ ],
+ };
+ assert(hash(&sample) == 4136455899);
+
+ let sample = _type {
+ flags = flags::NONE,
+ _type = array {
+ length = 5,
+ member = &_int,
+ },
+ };
+ assert(hash(&sample) == 1353959835);
};