Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test: improve coverage for float/float.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 `float/float.mbt`: 72.7% -> 100%
```
rami3l committed Jan 24, 2025

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
1 parent 5b7fef5 commit a1b92c9
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions float/float_test.mbt
Original file line number Diff line number Diff line change
@@ -115,3 +115,26 @@ test "@float.Float::is_nan" {
inspect!(@float.min_value.is_nan(), content="false")
inspect!(@float.min_positive.is_nan(), content="false")
}

test "default float 1" {
inspect!(Float::default(), content="0")
inspect!((Float::default() : Float), content="0")
}

test "Float::to_be_bytes with various values" {
let f1 : Float = 0.0
inspect!(f1.to_be_bytes(), content="b\"\\x00\\x00\\x00\\x00\"")
let f2 : Float = -1.0
inspect!(f2.to_be_bytes(), content="b\"\\xbf\\x80\\x00\\x00\"")
let f3 : Float = @float.infinity
inspect!(f3.to_be_bytes(), content="b\"\\x7f\\x80\\x00\\x00\"")
let f4 : Float = @float.not_a_number
inspect!(f4.to_be_bytes(), content="b\"\\x7f\\xc0\\x00\\x00\"")
}

test "to_le_bytes for zero" {
let f : Float = 0.0
let bytes = f.to_le_bytes()
inspect!(bytes.length(), content="4")
inspect!(bytes, content="b\"\\x00\\x00\\x00\\x00\"")
}

0 comments on commit a1b92c9

Please sign in to comment.