Skip to content

Commit c150b87

Browse files
committed
Add more explicit tests
1 parent 8b78f72 commit c150b87

File tree

1 file changed

+17
-2
lines changed

1 file changed

+17
-2
lines changed

src/float/add.rs

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -219,10 +219,25 @@ mod test {
219219

220220
// More tests for special float values
221221

222+
#[test]
223+
fn test_float_tiny_plus_tiny() {
224+
let tiny = <f32 as Float>::from_repr(1);
225+
let r = super::__addsf3(tiny, tiny);
226+
assert_eq!(r, tiny + tiny);
227+
}
228+
229+
#[test]
230+
fn test_float_small_plus_small() {
231+
let a = <f32 as Float>::from_repr(327);
232+
let b = <f32 as Float>::from_repr(256);
233+
let r = super::__addsf3(a, b);
234+
assert_eq!(r, a + b);
235+
}
236+
222237
#[test]
223238
fn test_float_one_plus_one() {
224-
let r = super::__addsf3(<f32 as Float>::from_repr(1), <f32 as Float>::from_repr(1));
225-
assert_eq!(r, <f32 as Float>::from_repr(1) + <f32 as Float>::from_repr(1));
239+
let r = super::__addsf3(1f32, 1f32);
240+
assert_eq!(r, 1f32 + 1f32);
226241
}
227242

228243
#[test]

0 commit comments

Comments
 (0)