Skip to content

Commit

Permalink
Fix tests for hashing Int64/Float64
Browse files Browse the repository at this point in the history
  • Loading branch information
dinfuehr committed Oct 23, 2024
1 parent cafd8bb commit f4d426c
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions tests/stdlib/num-hash.dora
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,12 @@ fn main() {
assert(true.hash() == 1i32);
assert(false.hash() == 0i32);
assert(1.toUInt8().hash() == 1i32);
assert(1.hash() == 1i32);
assert(1i32.hash() == 1i32);

assert(1i64.hash() == 1i32);
assert((1 << 32i).hash() == (1 ^ 0));
assert((1 << 31i).hash() == (1 << 31i));

assert(1.0f32.hash() == 1065353216i32);
// double needs a better hash implementation
assert(1.0.hash() == 0i32);
assert(1.0.hash() == 1072693248);
}

0 comments on commit f4d426c

Please sign in to comment.