Skip to content

Commit e20d7b4

Browse files
committed
coretests: add abs() and copysign() tests, and remove now-unnecessary ui test
1 parent 4e6b364 commit e20d7b4

File tree

2 files changed

+14
-46
lines changed

2 files changed

+14
-46
lines changed

library/coretests/tests/num/mod.rs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -918,6 +918,20 @@ macro_rules! test_float {
918918
}
919919
}
920920
#[test]
921+
fn abs() {
922+
$fassert!((-1.0 as $fty).abs(), 1.0);
923+
$fassert!((1.0 as $fty).abs(), 1.0);
924+
$fassert!(<$fty>::NEG_INFINITY.abs(), <$fty>::INFINITY);
925+
$fassert!(<$fty>::INFINITY.abs(), <$fty>::INFINITY);
926+
}
927+
#[test]
928+
fn copysign() {
929+
$fassert!((1.0 as $fty).copysign(-2.0), -1.0);
930+
$fassert!((-1.0 as $fty).copysign(2.0), 1.0);
931+
$fassert!(<$fty>::INFINITY.copysign(-0.0), <$fty>::NEG_INFINITY);
932+
$fassert!(<$fty>::NEG_INFINITY.copysign(0.0), <$fty>::INFINITY);
933+
}
934+
#[test]
921935
fn rem_euclid() {
922936
// FIXME: Use $fassert when rem_euclid becomes const
923937
assert!(<$fty>::INFINITY.rem_euclid((42.0 as $fty)).is_nan());

tests/ui/consts/const-eval/float_methods.rs

Lines changed: 0 additions & 46 deletions
This file was deleted.

0 commit comments

Comments
 (0)