Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[libc][NFC] Shorten type names in tests #75358

Merged
merged 1 commit into from
Dec 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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