-
Notifications
You must be signed in to change notification settings - Fork 12.3k
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
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@llvm/pr-subscribers-libc Author: Guillaume Chatelet (gchatelet) ChangesFull diff: https://github.com/llvm/llvm-project/pull/75358.diff 10 Files Affected:
diff --git a/libc/test/src/math/FDimTest.h b/libc/test/src/math/FDimTest.h
index 3118c3661013e7..3fb82ed8bca2ce 100644
--- a/libc/test/src/math/FDimTest.h
+++ b/libc/test/src/math/FDimTest.h
@@ -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());
};
diff --git a/libc/test/src/math/FmaTest.h b/libc/test/src/math/FmaTest.h
index c2573d03792692..94412b7021df37 100644
--- a/libc/test/src/math/FmaTest.h
+++ b/libc/test/src/math/FmaTest.h
@@ -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};
diff --git a/libc/test/src/math/ILogbTest.h b/libc/test/src/math/ILogbTest.h
index e51a5d7a2544cd..9e12b4515c2852 100644
--- a/libc/test/src/math/ILogbTest.h
+++ b/libc/test/src/math/ILogbTest.h
@@ -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>
diff --git a/libc/test/src/math/LdExpTest.h b/libc/test/src/math/LdExpTest.h
index a75c8ef31a2cf8..ce0896ec2f4c25 100644
--- a/libc/test/src/math/LdExpTest.h
+++ b/libc/test/src/math/LdExpTest.h
@@ -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);
diff --git a/libc/test/src/math/RemQuoTest.h b/libc/test/src/math/RemQuoTest.h
index 6da0756c3a1b3d..a345e8b72e78d0 100644
--- a/libc/test/src/math/RemQuoTest.h
+++ b/libc/test/src/math/RemQuoTest.h
@@ -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 *);
diff --git a/libc/test/src/math/smoke/FDimTest.h b/libc/test/src/math/smoke/FDimTest.h
index 3118c3661013e7..3fb82ed8bca2ce 100644
--- a/libc/test/src/math/smoke/FDimTest.h
+++ b/libc/test/src/math/smoke/FDimTest.h
@@ -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());
};
diff --git a/libc/test/src/math/smoke/FmaTest.h b/libc/test/src/math/smoke/FmaTest.h
index 3c1c120d77d450..1da9652bfee155 100644
--- a/libc/test/src/math/smoke/FmaTest.h
+++ b/libc/test/src/math/smoke/FmaTest.h
@@ -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) {
diff --git a/libc/test/src/math/smoke/ILogbTest.h b/libc/test/src/math/smoke/ILogbTest.h
index e51a5d7a2544cd..9e12b4515c2852 100644
--- a/libc/test/src/math/smoke/ILogbTest.h
+++ b/libc/test/src/math/smoke/ILogbTest.h
@@ -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>
diff --git a/libc/test/src/math/smoke/LdExpTest.h b/libc/test/src/math/smoke/LdExpTest.h
index a75c8ef31a2cf8..ce0896ec2f4c25 100644
--- a/libc/test/src/math/smoke/LdExpTest.h
+++ b/libc/test/src/math/smoke/LdExpTest.h
@@ -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);
diff --git a/libc/test/src/math/smoke/RemQuoTest.h b/libc/test/src/math/smoke/RemQuoTest.h
index 5a5d1437775023..514190b6b31caa 100644
--- a/libc/test/src/math/smoke/RemQuoTest.h
+++ b/libc/test/src/math/smoke/RemQuoTest.h
@@ -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 *);
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
No description provided.