Skip to content

Commit ab3034b

Browse files
committed
Add explicit tests for doubles
1 parent 2332290 commit ab3034b

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

src/float/add.rs

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -226,6 +226,13 @@ mod test {
226226
assert_eq!(r, tiny + tiny);
227227
}
228228

229+
#[test]
230+
fn test_double_tiny_plus_tiny() {
231+
let tiny = f64::from_repr(1);
232+
let r = super::__adddf3(tiny, tiny);
233+
assert_eq!(r, tiny + tiny);
234+
}
235+
229236
#[test]
230237
fn test_float_small_plus_small() {
231238
let a = f32::from_repr(327);
@@ -234,12 +241,26 @@ mod test {
234241
assert_eq!(r, a + b);
235242
}
236243

244+
#[test]
245+
fn test_double_small_plus_small() {
246+
let a = f64::from_repr(327);
247+
let b = f64::from_repr(256);
248+
let r = super::__adddf3(a, b);
249+
assert_eq!(r, a + b);
250+
}
251+
237252
#[test]
238253
fn test_float_one_plus_one() {
239254
let r = super::__addsf3(1f32, 1f32);
240255
assert_eq!(r, 1f32 + 1f32);
241256
}
242257

258+
#[test]
259+
fn test_double_one_plus_one() {
260+
let r = super::__adddf3(1f64, 1f64);
261+
assert_eq!(r, 1f64 + 1f64);
262+
}
263+
243264
#[test]
244265
fn test_float_nan() {
245266
let r = super::__addsf3(f32::NAN, 1.23);

0 commit comments

Comments
 (0)