Skip to content

Commit 7371bb3

Browse files
committed
test: improve coverage for float/float.mbt
**Disclaimer:** This PR was generated by an LLM agent as part of an experiment. ## Summary ``` coverage of `float/float.mbt`: 72.7% -> 100% ```
1 parent 5b7fef5 commit 7371bb3

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed

float/float_test.mbt

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,3 +115,33 @@ test "@float.Float::is_nan" {
115115
inspect!(@float.min_value.is_nan(), content="false")
116116
inspect!(@float.min_positive.is_nan(), content="false")
117117
}
118+
119+
test "Float::default()" {
120+
inspect!(Float::default(), content="0")
121+
}
122+
123+
test "Float::to_be_bytes with various values" {
124+
let f1 : Float = 0.0
125+
inspect!(f1.to_be_bytes(), content="b\"\\x00\\x00\\x00\\x00\"")
126+
let f2 : Float = -1.0
127+
inspect!(f2.to_be_bytes(), content="b\"\\xbf\\x80\\x00\\x00\"")
128+
let f3 : Float = @float.infinity
129+
inspect!(f3.to_be_bytes(), content="b\"\\x7f\\x80\\x00\\x00\"")
130+
let f4 : Float = @float.not_a_number
131+
inspect!(f4.to_be_bytes(), content="b\"\\x7f\\xc0\\x00\\x00\"")
132+
}
133+
134+
test "to_le_bytes for zero" {
135+
inspect!(
136+
(0.0 : Float).to_le_bytes(),
137+
content=
138+
#|b"\x00\x00\x00\x00"
139+
,
140+
)
141+
inspect!(
142+
(-0.0 : Float).to_le_bytes(),
143+
content=
144+
#|b"\x00\x00\x00\x80"
145+
,
146+
)
147+
}

0 commit comments

Comments
 (0)