[libc][NFC][Obvious] Use the new macro to declare special constants in tests.

This commit is contained in:
Siva Chandra Reddy 2020-10-31 22:28:44 -07:00
parent 0fca651711
commit 50c2f2b6f0
28 changed files with 31 additions and 125 deletions

View File

@ -17,11 +17,7 @@ using FPBits = __llvm_libc::fputil::FPBits<double>;
namespace mpfr = __llvm_libc::testing::mpfr;
static const double zero = FPBits::zero();
static const double negZero = FPBits::negZero();
static const double nan = FPBits::buildNaN(1);
static const double inf = FPBits::inf();
static const double negInf = FPBits::negInf();
DECLARE_SPECIAL_CONSTANTS(double)
TEST(CeilTest, SpecialNumbers) {
EXPECT_FP_EQ(zero, __llvm_libc::ceil(zero));

View File

@ -17,11 +17,7 @@ using FPBits = __llvm_libc::fputil::FPBits<float>;
namespace mpfr = __llvm_libc::testing::mpfr;
static const float zero = FPBits::zero();
static const float negZero = FPBits::negZero();
static const float nan = FPBits::buildNaN(1);
static const float inf = FPBits::inf();
static const float negInf = FPBits::negInf();
DECLARE_SPECIAL_CONSTANTS(float)
TEST(CeilfTest, SpecialNumbers) {
EXPECT_FP_EQ(zero, __llvm_libc::ceilf(zero));

View File

@ -17,11 +17,7 @@ using FPBits = __llvm_libc::fputil::FPBits<long double>;
namespace mpfr = __llvm_libc::testing::mpfr;
static const long double zero = FPBits::zero();
static const long double negZero = FPBits::negZero();
static const long double nan = FPBits::buildNaN(1);
static const long double inf = FPBits::inf();
static const long double negInf = FPBits::negInf();
DECLARE_SPECIAL_CONSTANTS(long double)
TEST(CeillTest, SpecialNumbers) {
EXPECT_FP_EQ(zero, __llvm_libc::ceill(zero));

View File

@ -14,11 +14,7 @@
using FPBits = __llvm_libc::fputil::FPBits<double>;
static const double zero = FPBits::zero();
static const double negZero = FPBits::negZero();
static const double nan = FPBits::buildNaN(1);
static const double inf = FPBits::inf();
static const double negInf = FPBits::negInf();
DECLARE_SPECIAL_CONSTANTS(double)
TEST(CopySignTest, SpecialNumbers) {
EXPECT_FP_EQ(nan, __llvm_libc::copysign(nan, -1.0));

View File

@ -14,11 +14,7 @@
using FPBits = __llvm_libc::fputil::FPBits<float>;
static const float zero = FPBits::zero();
static const float negZero = FPBits::negZero();
static const float nan = FPBits::buildNaN(1);
static const float inf = FPBits::inf();
static const float negInf = FPBits::negInf();
DECLARE_SPECIAL_CONSTANTS(float)
TEST(CopySinfTest, SpecialNumbers) {
EXPECT_FP_EQ(nan, __llvm_libc::copysignf(nan, -1.0));

View File

@ -14,11 +14,7 @@
using FPBits = __llvm_libc::fputil::FPBits<long double>;
static const long double zero = FPBits::zero();
static const long double negZero = FPBits::negZero();
static const long double nan = FPBits::buildNaN(1);
static const long double inf = FPBits::inf();
static const long double negInf = FPBits::negInf();
DECLARE_SPECIAL_CONSTANTS(long double)
TEST(CopySinlTest, SpecialNumbers) {
EXPECT_FP_EQ(nan, __llvm_libc::copysignl(nan, -1.0));

View File

@ -15,11 +15,7 @@
using FPBits = __llvm_libc::fputil::FPBits<double>;
static const double zero = FPBits::zero();
static const double negZero = FPBits::negZero();
static const double nan = FPBits::buildNaN(1);
static const double inf = FPBits::inf();
static const double negInf = FPBits::negInf();
DECLARE_SPECIAL_CONSTANTS(double)
namespace mpfr = __llvm_libc::testing::mpfr;

View File

@ -15,11 +15,7 @@
using FPBits = __llvm_libc::fputil::FPBits<float>;
static const float zero = FPBits::zero();
static const float negZero = FPBits::negZero();
static const float nan = FPBits::buildNaN(1);
static const float inf = FPBits::inf();
static const float negInf = FPBits::negInf();
DECLARE_SPECIAL_CONSTANTS(float)
namespace mpfr = __llvm_libc::testing::mpfr;

View File

@ -15,11 +15,7 @@
using FPBits = __llvm_libc::fputil::FPBits<long double>;
static const long double zero = FPBits::zero();
static const long double negZero = FPBits::negZero();
static const long double nan = FPBits::buildNaN(1);
static const long double inf = FPBits::inf();
static const long double negInf = FPBits::negInf();
DECLARE_SPECIAL_CONSTANTS(long double)
namespace mpfr = __llvm_libc::testing::mpfr;

View File

@ -15,13 +15,9 @@
using FPBits = __llvm_libc::fputil::FPBits<double>;
namespace mpfr = __llvm_libc::testing::mpfr;
DECLARE_SPECIAL_CONSTANTS(double)
static const double zero = FPBits::zero();
static const double negZero = FPBits::negZero();
static const double nan = FPBits::buildNaN(1);
static const double inf = FPBits::inf();
static const double negInf = FPBits::negInf();
namespace mpfr = __llvm_libc::testing::mpfr;
TEST(FloorTest, SpecialNumbers) {
EXPECT_FP_EQ(zero, __llvm_libc::floor(zero));

View File

@ -15,13 +15,9 @@
using FPBits = __llvm_libc::fputil::FPBits<float>;
namespace mpfr = __llvm_libc::testing::mpfr;
DECLARE_SPECIAL_CONSTANTS(float)
static const float zero = FPBits::zero();
static const float negZero = FPBits::negZero();
static const float nan = FPBits::buildNaN(1);
static const float inf = FPBits::inf();
static const float negInf = FPBits::negInf();
namespace mpfr = __llvm_libc::testing::mpfr;
TEST(FloorfTest, SpecialNumbers) {
EXPECT_FP_EQ(zero, __llvm_libc::floorf(zero));

View File

@ -15,13 +15,9 @@
using FPBits = __llvm_libc::fputil::FPBits<long double>;
namespace mpfr = __llvm_libc::testing::mpfr;
DECLARE_SPECIAL_CONSTANTS(long double)
static const long double zero = FPBits::zero();
static const long double negZero = FPBits::negZero();
static const long double nan = FPBits::buildNaN(1);
static const long double inf = FPBits::inf();
static const long double negInf = FPBits::negInf();
namespace mpfr = __llvm_libc::testing::mpfr;
TEST(FloorlTest, SpecialNumbers) {
EXPECT_FP_EQ(zero, __llvm_libc::floorl(zero));

View File

@ -14,9 +14,7 @@
using FPBits = __llvm_libc::fputil::FPBits<double>;
double nan = FPBits::buildNaN(1);
double inf = FPBits::inf();
double negInf = FPBits::negInf();
DECLARE_SPECIAL_CONSTANTS(double)
TEST(FmaxTest, NaNArg) {
EXPECT_FP_EQ(inf, __llvm_libc::fmax(nan, inf));

View File

@ -14,9 +14,7 @@
using FPBits = __llvm_libc::fputil::FPBits<float>;
float nan = FPBits::buildNaN(1);
float inf = FPBits::inf();
float negInf = FPBits::negInf();
DECLARE_SPECIAL_CONSTANTS(float)
TEST(FmaxfTest, NaNArg) {
EXPECT_FP_EQ(inf, __llvm_libc::fmaxf(nan, inf));

View File

@ -14,9 +14,7 @@
using FPBits = __llvm_libc::fputil::FPBits<long double>;
long double nan = FPBits::buildNaN(1);
long double inf = FPBits::inf();
long double negInf = FPBits::negInf();
DECLARE_SPECIAL_CONSTANTS(long double)
TEST(FmaxlTest, NaNArg) {
EXPECT_FP_EQ(inf, __llvm_libc::fmaxl(nan, inf));

View File

@ -14,9 +14,7 @@
using FPBits = __llvm_libc::fputil::FPBits<double>;
double nan = static_cast<double>(FPBits::buildNaN(1));
double inf = static_cast<double>(FPBits::inf());
double negInf = static_cast<double>(FPBits::negInf());
DECLARE_SPECIAL_CONSTANTS(double)
TEST(FminTest, NaNArg) {
EXPECT_FP_EQ(inf, __llvm_libc::fmin(nan, inf));

View File

@ -14,9 +14,7 @@
using FPBits = __llvm_libc::fputil::FPBits<float>;
float nan = static_cast<float>(FPBits::buildNaN(1));
float inf = static_cast<float>(FPBits::inf());
float negInf = static_cast<float>(FPBits::negInf());
DECLARE_SPECIAL_CONSTANTS(float)
TEST(FminfTest, NaNArg) {
EXPECT_FP_EQ(inf, __llvm_libc::fminf(nan, inf));

View File

@ -14,9 +14,7 @@
using FPBits = __llvm_libc::fputil::FPBits<long double>;
long double nan = static_cast<long double>(FPBits::buildNaN(1));
long double inf = static_cast<long double>(FPBits::inf());
long double negInf = static_cast<long double>(FPBits::negInf());
DECLARE_SPECIAL_CONSTANTS(long double)
TEST(FminlTest, NaNArg) {
EXPECT_FP_EQ(inf, __llvm_libc::fminl(nan, inf));

View File

@ -18,11 +18,7 @@ using UIntType = FPBits::UIntType;
namespace mpfr = __llvm_libc::testing::mpfr;
static const float zero = FPBits::zero();
static const float negZero = FPBits::negZero();
static const float nan = FPBits::buildNaN(1);
static const float inf = FPBits::inf();
static const float negInf = FPBits::negInf();
DECLARE_SPECIAL_CONSTANTS(float)
TEST(HypotfTest, SpecialNumbers) {
EXPECT_FP_EQ(__llvm_libc::hypotf(inf, nan), inf);

View File

@ -17,11 +17,7 @@ using FPBits = __llvm_libc::fputil::FPBits<double>;
namespace mpfr = __llvm_libc::testing::mpfr;
static const double zero = FPBits::zero();
static const double negZero = FPBits::negZero();
static const double nan = FPBits::buildNaN(1);
static const double inf = FPBits::inf();
static const double negInf = FPBits::negInf();
DECLARE_SPECIAL_CONSTANTS(double)
TEST(RoundTest, SpecialNumbers) {
EXPECT_FP_EQ(zero, __llvm_libc::round(zero));

View File

@ -17,11 +17,7 @@ using FPBits = __llvm_libc::fputil::FPBits<float>;
namespace mpfr = __llvm_libc::testing::mpfr;
static const float zero = FPBits::zero();
static const float negZero = FPBits::negZero();
static const float nan = FPBits::buildNaN(1);
static const float inf = FPBits::inf();
static const float negInf = FPBits::negInf();
DECLARE_SPECIAL_CONSTANTS(float)
TEST(RoundfTest, SpecialNumbers) {
EXPECT_FP_EQ(zero, __llvm_libc::roundf(zero));

View File

@ -17,11 +17,7 @@ using FPBits = __llvm_libc::fputil::FPBits<long double>;
namespace mpfr = __llvm_libc::testing::mpfr;
static const long double zero = FPBits::zero();
static const long double negZero = FPBits::negZero();
static const long double nan = FPBits::buildNaN(1);
static const long double inf = FPBits::inf();
static const long double negInf = FPBits::negInf();
DECLARE_SPECIAL_CONSTANTS(long double)
TEST(RoundlTest, SpecialNumbers) {
EXPECT_FP_EQ(zero, __llvm_libc::roundl(zero));

View File

@ -20,9 +20,7 @@ namespace mpfr = __llvm_libc::testing::mpfr;
constexpr UIntType HiddenBit =
UIntType(1) << __llvm_libc::fputil::MantissaWidth<double>::value;
double nan = FPBits::buildNaN(1);
double inf = FPBits::inf();
double negInf = FPBits::negInf();
DECLARE_SPECIAL_CONSTANTS(double)
TEST(SqrtTest, SpecialValues) {
ASSERT_FP_EQ(nan, __llvm_libc::sqrt(nan));

View File

@ -20,9 +20,7 @@ namespace mpfr = __llvm_libc::testing::mpfr;
constexpr UIntType HiddenBit =
UIntType(1) << __llvm_libc::fputil::MantissaWidth<float>::value;
float nan = FPBits::buildNaN(1);
float inf = FPBits::inf();
float negInf = FPBits::negInf();
DECLARE_SPECIAL_CONSTANTS(float)
TEST(SqrtfTest, SpecialValues) {
ASSERT_FP_EQ(nan, __llvm_libc::sqrtf(nan));

View File

@ -20,9 +20,7 @@ namespace mpfr = __llvm_libc::testing::mpfr;
constexpr UIntType HiddenBit =
UIntType(1) << __llvm_libc::fputil::MantissaWidth<long double>::value;
long double nan = FPBits::buildNaN(1);
long double inf = FPBits::inf();
long double negInf = FPBits::negInf();
DECLARE_SPECIAL_CONSTANTS(long double)
TEST(SqrtlTest, SpecialValues) {
ASSERT_FP_EQ(nan, __llvm_libc::sqrtl(nan));

View File

@ -17,11 +17,7 @@ using FPBits = __llvm_libc::fputil::FPBits<double>;
namespace mpfr = __llvm_libc::testing::mpfr;
static const double zero = FPBits::zero();
static const double negZero = FPBits::negZero();
static const double nan = FPBits::buildNaN(1);
static const double inf = FPBits::inf();
static const double negInf = FPBits::negInf();
DECLARE_SPECIAL_CONSTANTS(double)
TEST(TruncTest, SpecialNumbers) {
EXPECT_FP_EQ(zero, __llvm_libc::trunc(zero));

View File

@ -17,11 +17,7 @@ using FPBits = __llvm_libc::fputil::FPBits<float>;
namespace mpfr = __llvm_libc::testing::mpfr;
static const float zero = FPBits::zero();
static const float negZero = FPBits::negZero();
static const float nan = FPBits::buildNaN(1);
static const float inf = FPBits::inf();
static const float negInf = FPBits::negInf();
DECLARE_SPECIAL_CONSTANTS(float)
TEST(TruncfTest, SpecialNumbers) {
EXPECT_FP_EQ(zero, __llvm_libc::truncf(zero));

View File

@ -17,11 +17,7 @@ using FPBits = __llvm_libc::fputil::FPBits<long double>;
namespace mpfr = __llvm_libc::testing::mpfr;
static const long double zero = FPBits::zero();
static const long double negZero = FPBits::negZero();
static const long double nan = FPBits::buildNaN(1);
static const long double inf = FPBits::inf();
static const long double negInf = FPBits::negInf();
DECLARE_SPECIAL_CONSTANTS(long double)
TEST(TrunclTest, SpecialNumbers) {
EXPECT_FP_EQ(zero, __llvm_libc::truncl(zero));