[libc][NFC] Use ASSERT_FP_EQ to comapre NaN values in tests.

This commit is contained in:
Siva Chandra Reddy 2020-12-15 23:44:44 -08:00
parent eb66bf0802
commit 0524da67b4
13 changed files with 13 additions and 25 deletions

View File

@ -44,7 +44,7 @@ public:
ASSERT_FP_EQ(negZero, func(negZero, exp));
ASSERT_FP_EQ(inf, func(inf, exp));
ASSERT_FP_EQ(negInf, func(negInf, exp));
ASSERT_NE(isnan(func(nan, exp)), 0);
ASSERT_FP_EQ(nan, func(nan, exp));
}
}

View File

@ -26,8 +26,7 @@ TEST(CeilTest, SpecialNumbers) {
EXPECT_FP_EQ(inf, __llvm_libc::ceil(inf));
EXPECT_FP_EQ(negInf, __llvm_libc::ceil(negInf));
ASSERT_NE(isnan(aNaN), 0);
ASSERT_NE(isnan(__llvm_libc::ceil(aNaN)), 0);
EXPECT_FP_EQ(aNaN, __llvm_libc::ceil(aNaN));
}
TEST(CeilTest, RoundedNumbers) {

View File

@ -26,8 +26,7 @@ TEST(CeilfTest, SpecialNumbers) {
EXPECT_FP_EQ(inf, __llvm_libc::ceilf(inf));
EXPECT_FP_EQ(negInf, __llvm_libc::ceilf(negInf));
ASSERT_NE(isnan(aNaN), 0);
ASSERT_NE(isnan(__llvm_libc::ceilf(aNaN)), 0);
EXPECT_FP_EQ(aNaN, __llvm_libc::ceilf(aNaN));
}
TEST(CeilfTest, RoundedNumbers) {

View File

@ -26,8 +26,7 @@ TEST(CeillTest, SpecialNumbers) {
EXPECT_FP_EQ(inf, __llvm_libc::ceill(inf));
EXPECT_FP_EQ(negInf, __llvm_libc::ceill(negInf));
ASSERT_NE(isnan(aNaN), 0);
ASSERT_NE(isnan(__llvm_libc::ceill(aNaN)), 0);
EXPECT_FP_EQ(aNaN, __llvm_libc::ceill(aNaN));
}
TEST(CeillTest, RoundedNumbers) {

View File

@ -26,8 +26,7 @@ TEST(FloorTest, SpecialNumbers) {
EXPECT_FP_EQ(inf, __llvm_libc::floor(inf));
EXPECT_FP_EQ(negInf, __llvm_libc::floor(negInf));
ASSERT_NE(isnan(aNaN), 0);
ASSERT_NE(isnan(__llvm_libc::floor(aNaN)), 0);
EXPECT_FP_EQ(aNaN, __llvm_libc::floor(aNaN));
}
TEST(FloorTest, RoundedNumbers) {

View File

@ -26,8 +26,7 @@ TEST(FloorfTest, SpecialNumbers) {
EXPECT_FP_EQ(inf, __llvm_libc::floorf(inf));
EXPECT_FP_EQ(negInf, __llvm_libc::floorf(negInf));
ASSERT_NE(isnan(aNaN), 0);
ASSERT_NE(isnan(__llvm_libc::floorf(aNaN)), 0);
EXPECT_FP_EQ(aNaN, __llvm_libc::floorf(aNaN));
}
TEST(FloorfTest, RoundedNumbers) {

View File

@ -26,8 +26,7 @@ TEST(FloorlTest, SpecialNumbers) {
EXPECT_FP_EQ(inf, __llvm_libc::floorl(inf));
EXPECT_FP_EQ(negInf, __llvm_libc::floorl(negInf));
ASSERT_NE(isnan(aNaN), 0);
ASSERT_NE(isnan(__llvm_libc::floorl(aNaN)), 0);
EXPECT_FP_EQ(aNaN, __llvm_libc::floorl(aNaN));
}
TEST(FloorlTest, RoundedNumbers) {

View File

@ -26,8 +26,7 @@ TEST(RoundTest, SpecialNumbers) {
EXPECT_FP_EQ(inf, __llvm_libc::round(inf));
EXPECT_FP_EQ(negInf, __llvm_libc::round(negInf));
ASSERT_NE(isnan(aNaN), 0);
ASSERT_NE(isnan(__llvm_libc::round(aNaN)), 0);
EXPECT_FP_EQ(aNaN, __llvm_libc::round(aNaN));
}
TEST(RoundTest, RoundedNumbers) {

View File

@ -26,8 +26,7 @@ TEST(RoundfTest, SpecialNumbers) {
EXPECT_FP_EQ(inf, __llvm_libc::roundf(inf));
EXPECT_FP_EQ(negInf, __llvm_libc::roundf(negInf));
ASSERT_NE(isnan(aNaN), 0);
ASSERT_NE(isnan(__llvm_libc::roundf(aNaN)), 0);
EXPECT_FP_EQ(aNaN, __llvm_libc::roundf(aNaN));
}
TEST(RoundfTest, RoundedNumbers) {

View File

@ -26,8 +26,7 @@ TEST(RoundlTest, SpecialNumbers) {
EXPECT_FP_EQ(inf, __llvm_libc::roundl(inf));
EXPECT_FP_EQ(negInf, __llvm_libc::roundl(negInf));
ASSERT_NE(isnan(aNaN), 0);
ASSERT_NE(isnan(__llvm_libc::roundl(aNaN)), 0);
EXPECT_FP_EQ(aNaN, __llvm_libc::roundl(aNaN));
}
TEST(RoundlTest, RoundedNumbers) {

View File

@ -26,8 +26,7 @@ TEST(TruncTest, SpecialNumbers) {
EXPECT_FP_EQ(inf, __llvm_libc::trunc(inf));
EXPECT_FP_EQ(negInf, __llvm_libc::trunc(negInf));
ASSERT_NE(isnan(aNaN), 0);
ASSERT_NE(isnan(__llvm_libc::trunc(aNaN)), 0);
EXPECT_FP_EQ(aNaN, __llvm_libc::trunc(aNaN));
}
TEST(TruncTest, RoundedNumbers) {

View File

@ -26,8 +26,7 @@ TEST(TruncfTest, SpecialNumbers) {
EXPECT_FP_EQ(inf, __llvm_libc::truncf(inf));
EXPECT_FP_EQ(negInf, __llvm_libc::truncf(negInf));
ASSERT_NE(isnan(aNaN), 0);
ASSERT_NE(isnan(__llvm_libc::truncf(aNaN)), 0);
EXPECT_FP_EQ(aNaN, __llvm_libc::truncf(aNaN));
}
TEST(TruncfTest, RoundedNumbers) {

View File

@ -26,8 +26,7 @@ TEST(TrunclTest, SpecialNumbers) {
EXPECT_FP_EQ(inf, __llvm_libc::truncl(inf));
EXPECT_FP_EQ(negInf, __llvm_libc::truncl(negInf));
ASSERT_NE(isnan(aNaN), 0);
ASSERT_NE(isnan(__llvm_libc::truncl(aNaN)), 0);
EXPECT_FP_EQ(aNaN, __llvm_libc::truncl(aNaN));
}
TEST(TrunclTest, RoundedNumbers) {