Skip to content

Commit

Permalink
test: improve coverage for builtin/hasher.mbt
Browse files Browse the repository at this point in the history
**Disclaimer:** This PR was generated by an LLM agent as part of an experiment.

## Summary

```
coverage of `builtin/hasher.mbt`: 69.4% -> 75.0%
```
  • Loading branch information
rami3l committed Jan 23, 2025
1 parent 59cba88 commit 29ffae8
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions builtin/hasher_test.mbt
Original file line number Diff line number Diff line change
Expand Up @@ -170,3 +170,30 @@ test "combine all" {
inspect!(hasher.finalize(), content="1982681228")
inspect!(hasher.finalize() == hasher.finalize(), content="true")
}

test "combine_unit" {
let hasher = @builtin.Hasher::new()
hasher.combine_unit()
let hash = hasher.finalize()
let hasher2 = @builtin.Hasher::new()
hasher2.combine_int(0)
let hash2 = hasher2.finalize()
inspect!(hash == hash2, content="true")
}

test "combine_bool" {
let hasher = @builtin.Hasher::new()
hasher.combine_bool(true)
let hash1 = hasher.finalize()
let hasher2 = @builtin.Hasher::new()
hasher2.combine_int(1)
let hash2 = hasher2.finalize()
assert_eq!(hash1, hash2)
let hasher3 = @builtin.Hasher::new()
hasher3.combine_bool(false)
let hash3 = hasher3.finalize()
let hasher4 = @builtin.Hasher::new()
hasher4.combine_int(0)
let hash4 = hasher4.finalize()
assert_eq!(hash3, hash4)
}

0 comments on commit 29ffae8

Please sign in to comment.