Skip to content

Commit

Permalink
[libc][NFC] Shorten type names in tests (llvm#75358)
Browse files Browse the repository at this point in the history
  • Loading branch information
gchatelet authored Dec 13, 2023
1 parent f3dcc23 commit 6b37d8b
Show file tree
Hide file tree
Showing 10 changed files with 52 additions and 58 deletions.
10 changes: 5 additions & 5 deletions libc/test/src/math/FDimTest.h
Original file line number Diff line number Diff line change
Expand Up @@ -74,9 +74,9 @@ class FDimTestTemplate : public LIBC_NAMESPACE::testing::Test {
private:
// constexpr does not work on FPBits yet, so we cannot have these constants as
// static.
const T nan = T(LIBC_NAMESPACE::fputil::FPBits<T>::build_quiet_nan(1));
const T inf = T(LIBC_NAMESPACE::fputil::FPBits<T>::inf());
const T neg_inf = T(LIBC_NAMESPACE::fputil::FPBits<T>::neg_inf());
const T zero = T(LIBC_NAMESPACE::fputil::FPBits<T>::zero());
const T neg_zero = T(LIBC_NAMESPACE::fputil::FPBits<T>::neg_zero());
const T nan = T(FPBits::build_quiet_nan(1));
const T inf = T(FPBits::inf());
const T neg_inf = T(FPBits::neg_inf());
const T zero = T(FPBits::zero());
const T neg_zero = T(FPBits::neg_zero());
};
10 changes: 5 additions & 5 deletions libc/test/src/math/FmaTest.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,11 @@ class FmaTestTemplate : public LIBC_NAMESPACE::testing::Test {
using Func = T (*)(T, T, T);
using FPBits = LIBC_NAMESPACE::fputil::FPBits<T>;
using UIntType = typename FPBits::UIntType;
const T nan = T(LIBC_NAMESPACE::fputil::FPBits<T>::build_quiet_nan(1));
const T inf = T(LIBC_NAMESPACE::fputil::FPBits<T>::inf());
const T neg_inf = T(LIBC_NAMESPACE::fputil::FPBits<T>::neg_inf());
const T zero = T(LIBC_NAMESPACE::fputil::FPBits<T>::zero());
const T neg_zero = T(LIBC_NAMESPACE::fputil::FPBits<T>::neg_zero());
const T nan = T(FPBits::build_quiet_nan(1));
const T inf = T(FPBits::inf());
const T neg_inf = T(FPBits::neg_inf());
const T zero = T(FPBits::zero());
const T neg_zero = T(FPBits::neg_zero());

UIntType get_random_bit_pattern() {
UIntType bits{0};
Expand Down
15 changes: 6 additions & 9 deletions libc/test/src/math/ILogbTest.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,12 @@ class LlvmLibcILogbTest : public LIBC_NAMESPACE::testing::Test {

template <typename T>
void test_special_numbers(typename ILogbFunc<T>::Func func) {
EXPECT_EQ(FP_ILOGB0, func(T(LIBC_NAMESPACE::fputil::FPBits<T>::zero())));
EXPECT_EQ(FP_ILOGB0,
func(T(LIBC_NAMESPACE::fputil::FPBits<T>::neg_zero())));

EXPECT_EQ(FP_ILOGBNAN,
func(T(LIBC_NAMESPACE::fputil::FPBits<T>::build_quiet_nan(1))));

EXPECT_EQ(INT_MAX, func(T(LIBC_NAMESPACE::fputil::FPBits<T>::inf())));
EXPECT_EQ(INT_MAX, func(T(LIBC_NAMESPACE::fputil::FPBits<T>::neg_inf())));
using FPBits = LIBC_NAMESPACE::fputil::FPBits<T>;
EXPECT_EQ(FP_ILOGB0, func(T(FPBits::zero())));
EXPECT_EQ(FP_ILOGB0, func(T(FPBits::neg_zero())));
EXPECT_EQ(FP_ILOGBNAN, func(T(FPBits::build_quiet_nan(1))));
EXPECT_EQ(INT_MAX, func(T(FPBits::inf())));
EXPECT_EQ(INT_MAX, func(T(FPBits::neg_inf())));
}

template <typename T>
Expand Down
10 changes: 5 additions & 5 deletions libc/test/src/math/LdExpTest.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,11 @@ class LdExpTestTemplate : public LIBC_NAMESPACE::testing::Test {
// A normalized mantissa to be used with tests.
static constexpr UIntType MANTISSA = NormalFloat::ONE + 0x1234;

const T zero = T(LIBC_NAMESPACE::fputil::FPBits<T>::zero());
const T neg_zero = T(LIBC_NAMESPACE::fputil::FPBits<T>::neg_zero());
const T inf = T(LIBC_NAMESPACE::fputil::FPBits<T>::inf());
const T neg_inf = T(LIBC_NAMESPACE::fputil::FPBits<T>::neg_inf());
const T nan = T(LIBC_NAMESPACE::fputil::FPBits<T>::build_quiet_nan(1));
const T zero = T(FPBits::zero());
const T neg_zero = T(FPBits::neg_zero());
const T inf = T(FPBits::inf());
const T neg_inf = T(FPBits::neg_inf());
const T nan = T(FPBits::build_quiet_nan(1));

public:
typedef T (*LdExpFunc)(T, int);
Expand Down
10 changes: 5 additions & 5 deletions libc/test/src/math/RemQuoTest.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,11 @@ class RemQuoTestTemplate : public LIBC_NAMESPACE::testing::Test {
using FPBits = LIBC_NAMESPACE::fputil::FPBits<T>;
using UIntType = typename FPBits::UIntType;

const T zero = T(LIBC_NAMESPACE::fputil::FPBits<T>::zero());
const T neg_zero = T(LIBC_NAMESPACE::fputil::FPBits<T>::neg_zero());
const T inf = T(LIBC_NAMESPACE::fputil::FPBits<T>::inf());
const T neg_inf = T(LIBC_NAMESPACE::fputil::FPBits<T>::neg_inf());
const T nan = T(LIBC_NAMESPACE::fputil::FPBits<T>::build_quiet_nan(1));
const T zero = T(FPBits::zero());
const T neg_zero = T(FPBits::neg_zero());
const T inf = T(FPBits::inf());
const T neg_inf = T(FPBits::neg_inf());
const T nan = T(FPBits::build_quiet_nan(1));

public:
typedef T (*RemQuoFunc)(T, T, int *);
Expand Down
10 changes: 5 additions & 5 deletions libc/test/src/math/smoke/FDimTest.h
Original file line number Diff line number Diff line change
Expand Up @@ -74,9 +74,9 @@ class FDimTestTemplate : public LIBC_NAMESPACE::testing::Test {
private:
// constexpr does not work on FPBits yet, so we cannot have these constants as
// static.
const T nan = T(LIBC_NAMESPACE::fputil::FPBits<T>::build_quiet_nan(1));
const T inf = T(LIBC_NAMESPACE::fputil::FPBits<T>::inf());
const T neg_inf = T(LIBC_NAMESPACE::fputil::FPBits<T>::neg_inf());
const T zero = T(LIBC_NAMESPACE::fputil::FPBits<T>::zero());
const T neg_zero = T(LIBC_NAMESPACE::fputil::FPBits<T>::neg_zero());
const T nan = T(FPBits::build_quiet_nan(1));
const T inf = T(FPBits::inf());
const T neg_inf = T(FPBits::neg_inf());
const T zero = T(FPBits::zero());
const T neg_zero = T(FPBits::neg_zero());
};
10 changes: 5 additions & 5 deletions libc/test/src/math/smoke/FmaTest.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@ class FmaTestTemplate : public LIBC_NAMESPACE::testing::Test {
using Func = T (*)(T, T, T);
using FPBits = LIBC_NAMESPACE::fputil::FPBits<T>;
using UIntType = typename FPBits::UIntType;
const T nan = T(LIBC_NAMESPACE::fputil::FPBits<T>::build_quiet_nan(1));
const T inf = T(LIBC_NAMESPACE::fputil::FPBits<T>::inf());
const T neg_inf = T(LIBC_NAMESPACE::fputil::FPBits<T>::neg_inf());
const T zero = T(LIBC_NAMESPACE::fputil::FPBits<T>::zero());
const T neg_zero = T(LIBC_NAMESPACE::fputil::FPBits<T>::neg_zero());
const T nan = T(FPBits::build_quiet_nan(1));
const T inf = T(FPBits::inf());
const T neg_inf = T(FPBits::neg_inf());
const T zero = T(FPBits::zero());
const T neg_zero = T(FPBits::neg_zero());

public:
void test_special_numbers(Func func) {
Expand Down
15 changes: 6 additions & 9 deletions libc/test/src/math/smoke/ILogbTest.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,12 @@ class LlvmLibcILogbTest : public LIBC_NAMESPACE::testing::Test {

template <typename T>
void test_special_numbers(typename ILogbFunc<T>::Func func) {
EXPECT_EQ(FP_ILOGB0, func(T(LIBC_NAMESPACE::fputil::FPBits<T>::zero())));
EXPECT_EQ(FP_ILOGB0,
func(T(LIBC_NAMESPACE::fputil::FPBits<T>::neg_zero())));

EXPECT_EQ(FP_ILOGBNAN,
func(T(LIBC_NAMESPACE::fputil::FPBits<T>::build_quiet_nan(1))));

EXPECT_EQ(INT_MAX, func(T(LIBC_NAMESPACE::fputil::FPBits<T>::inf())));
EXPECT_EQ(INT_MAX, func(T(LIBC_NAMESPACE::fputil::FPBits<T>::neg_inf())));
using FPBits = LIBC_NAMESPACE::fputil::FPBits<T>;
EXPECT_EQ(FP_ILOGB0, func(T(FPBits::zero())));
EXPECT_EQ(FP_ILOGB0, func(T(FPBits::neg_zero())));
EXPECT_EQ(FP_ILOGBNAN, func(T(FPBits::build_quiet_nan(1))));
EXPECT_EQ(INT_MAX, func(T(FPBits::inf())));
EXPECT_EQ(INT_MAX, func(T(FPBits::neg_inf())));
}

template <typename T>
Expand Down
10 changes: 5 additions & 5 deletions libc/test/src/math/smoke/LdExpTest.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,11 @@ class LdExpTestTemplate : public LIBC_NAMESPACE::testing::Test {
// A normalized mantissa to be used with tests.
static constexpr UIntType MANTISSA = NormalFloat::ONE + 0x1234;

const T zero = T(LIBC_NAMESPACE::fputil::FPBits<T>::zero());
const T neg_zero = T(LIBC_NAMESPACE::fputil::FPBits<T>::neg_zero());
const T inf = T(LIBC_NAMESPACE::fputil::FPBits<T>::inf());
const T neg_inf = T(LIBC_NAMESPACE::fputil::FPBits<T>::neg_inf());
const T nan = T(LIBC_NAMESPACE::fputil::FPBits<T>::build_quiet_nan(1));
const T zero = T(FPBits::zero());
const T neg_zero = T(FPBits::neg_zero());
const T inf = T(FPBits::inf());
const T neg_inf = T(FPBits::neg_inf());
const T nan = T(FPBits::build_quiet_nan(1));

public:
typedef T (*LdExpFunc)(T, int);
Expand Down
10 changes: 5 additions & 5 deletions libc/test/src/math/smoke/RemQuoTest.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@ class RemQuoTestTemplate : public LIBC_NAMESPACE::testing::Test {
using FPBits = LIBC_NAMESPACE::fputil::FPBits<T>;
using UIntType = typename FPBits::UIntType;

const T zero = T(LIBC_NAMESPACE::fputil::FPBits<T>::zero());
const T neg_zero = T(LIBC_NAMESPACE::fputil::FPBits<T>::neg_zero());
const T inf = T(LIBC_NAMESPACE::fputil::FPBits<T>::inf());
const T neg_inf = T(LIBC_NAMESPACE::fputil::FPBits<T>::neg_inf());
const T nan = T(LIBC_NAMESPACE::fputil::FPBits<T>::build_quiet_nan(1));
const T zero = T(FPBits::zero());
const T neg_zero = T(FPBits::neg_zero());
const T inf = T(FPBits::inf());
const T neg_inf = T(FPBits::neg_inf());
const T nan = T(FPBits::build_quiet_nan(1));

public:
typedef T (*RemQuoFunc)(T, T, int *);
Expand Down

0 comments on commit 6b37d8b

Please sign in to comment.