[libc-commits] [libc] [libc][test] adds errno clearer test fixture, gtest-style errno and fp except assertions (PR #91608)

via libc-commits libc-commits at lists.llvm.org
Thu May 9 08:39:19 PDT 2024


github-actions[bot] wrote:

<!--LLVM CODE FORMAT COMMENT: {clang-format}-->


:warning: C/C++ code formatter, clang-format found issues in your code. :warning:

<details>
<summary>
You can test this locally with the following command:
</summary>

``````````bash
git-clang-format --diff aa9d467abaeb440dc70b64c0f35b8d5e731f3a19 f058e2fc125685d937eb6e6d1fffd144a6cbbc82 -- libc/test/UnitTest/ErrnoSafeTest.h libc/test/UnitTest/FPTest.h libc/test/UnitTest/ErrnoSetterMatcher.h libc/test/UnitTest/FEnvSafeTest.h libc/test/UnitTest/FPExceptMatcher.cpp libc/test/UnitTest/FPExceptMatcher.h libc/test/UnitTest/FPMatcher.h libc/test/UnitTest/LibcTest.h libc/test/src/__support/FPUtil/dyadic_float_test.cpp libc/test/src/math/CeilTest.h libc/test/src/math/CopySignTest.h libc/test/src/math/FAbsTest.h libc/test/src/math/FDimTest.h libc/test/src/math/FMaxTest.h libc/test/src/math/FMinTest.h libc/test/src/math/FModTest.h libc/test/src/math/FloorTest.h libc/test/src/math/FmaTest.h libc/test/src/math/FrexpTest.h libc/test/src/math/HypotTest.h libc/test/src/math/LdExpTest.h libc/test/src/math/LogbTest.h libc/test/src/math/ModfTest.h libc/test/src/math/NextAfterTest.h libc/test/src/math/RIntTest.h libc/test/src/math/RemQuoTest.h libc/test/src/math/RoundEvenTest.h libc/test/src/math/RoundTest.h libc/test/src/math/RoundToIntegerTest.h libc/test/src/math/SqrtTest.h libc/test/src/math/TruncTest.h libc/test/src/math/acosf_test.cpp libc/test/src/math/acoshf_test.cpp libc/test/src/math/asinf_test.cpp libc/test/src/math/asinhf_test.cpp libc/test/src/math/atan2f_test.cpp libc/test/src/math/atanf_test.cpp libc/test/src/math/atanhf_test.cpp libc/test/src/math/cos_test.cpp libc/test/src/math/cosf_test.cpp libc/test/src/math/coshf_test.cpp libc/test/src/math/erff_test.cpp libc/test/src/math/exhaustive/exhaustive_test.h libc/test/src/math/exhaustive/fmod_generic_impl_test.cpp libc/test/src/math/exhaustive/hypotf_test.cpp libc/test/src/math/exp10_test.cpp libc/test/src/math/exp10f_test.cpp libc/test/src/math/exp2_test.cpp libc/test/src/math/exp2f_test.cpp libc/test/src/math/exp2m1f_test.cpp libc/test/src/math/exp_test.cpp libc/test/src/math/expf_test.cpp libc/test/src/math/explogxf_test.cpp libc/test/src/math/expm1_test.cpp libc/test/src/math/expm1f_test.cpp libc/test/src/math/fdim_test.cpp libc/test/src/math/fdimf_test.cpp libc/test/src/math/fdiml_test.cpp libc/test/src/math/ilogb_test.cpp libc/test/src/math/ilogbf_test.cpp libc/test/src/math/ilogbl_test.cpp libc/test/src/math/log10_test.cpp libc/test/src/math/log10f_test.cpp libc/test/src/math/log1p_test.cpp libc/test/src/math/log1pf_test.cpp libc/test/src/math/log2_test.cpp libc/test/src/math/log2f_test.cpp libc/test/src/math/log_test.cpp libc/test/src/math/logf_test.cpp libc/test/src/math/powf_test.cpp libc/test/src/math/sin_test.cpp libc/test/src/math/sincosf_test.cpp libc/test/src/math/sinf_test.cpp libc/test/src/math/sinhf_test.cpp libc/test/src/math/smoke/CanonicalizeTest.h libc/test/src/math/smoke/CeilTest.h libc/test/src/math/smoke/CopySignTest.h libc/test/src/math/smoke/FAbsTest.h libc/test/src/math/smoke/FDimTest.h libc/test/src/math/smoke/FMaxTest.h libc/test/src/math/smoke/FMaximumMagNumTest.h libc/test/src/math/smoke/FMaximumMagTest.h libc/test/src/math/smoke/FMaximumNumTest.h libc/test/src/math/smoke/FMaximumTest.h libc/test/src/math/smoke/FMinTest.h libc/test/src/math/smoke/FMinimumMagNumTest.h libc/test/src/math/smoke/FMinimumMagTest.h libc/test/src/math/smoke/FMinimumNumTest.h libc/test/src/math/smoke/FMinimumTest.h libc/test/src/math/smoke/FModTest.h libc/test/src/math/smoke/FloorTest.h libc/test/src/math/smoke/FmaTest.h libc/test/src/math/smoke/FrexpTest.h libc/test/src/math/smoke/FromfpTest.h libc/test/src/math/smoke/FromfpxTest.h libc/test/src/math/smoke/HypotTest.h libc/test/src/math/smoke/LdExpTest.h libc/test/src/math/smoke/LogbTest.h libc/test/src/math/smoke/ModfTest.h libc/test/src/math/smoke/NearbyIntTest.h libc/test/src/math/smoke/NextAfterTest.h libc/test/src/math/smoke/NextDownTest.h libc/test/src/math/smoke/NextTowardTest.h libc/test/src/math/smoke/NextUpTest.h libc/test/src/math/smoke/RIntTest.h libc/test/src/math/smoke/RemQuoTest.h libc/test/src/math/smoke/RoundEvenTest.h libc/test/src/math/smoke/RoundTest.h libc/test/src/math/smoke/RoundToIntegerTest.h libc/test/src/math/smoke/SqrtTest.h libc/test/src/math/smoke/TruncTest.h libc/test/src/math/smoke/UfromfpTest.h libc/test/src/math/smoke/UfromfpxTest.h libc/test/src/math/smoke/acosf_test.cpp libc/test/src/math/smoke/acoshf_test.cpp libc/test/src/math/smoke/asinf_test.cpp libc/test/src/math/smoke/asinhf_test.cpp libc/test/src/math/smoke/atan2f_test.cpp libc/test/src/math/smoke/atanf_test.cpp libc/test/src/math/smoke/atanhf_test.cpp libc/test/src/math/smoke/cosf_test.cpp libc/test/src/math/smoke/coshf_test.cpp libc/test/src/math/smoke/erff_test.cpp libc/test/src/math/smoke/exp10_test.cpp libc/test/src/math/smoke/exp10f_test.cpp libc/test/src/math/smoke/exp2_test.cpp libc/test/src/math/smoke/exp2f_test.cpp libc/test/src/math/smoke/exp2m1f_test.cpp libc/test/src/math/smoke/exp_test.cpp libc/test/src/math/smoke/expf_test.cpp libc/test/src/math/smoke/expm1_test.cpp libc/test/src/math/smoke/expm1f_test.cpp libc/test/src/math/smoke/log10_test.cpp libc/test/src/math/smoke/log10f_test.cpp libc/test/src/math/smoke/log1p_test.cpp libc/test/src/math/smoke/log1pf_test.cpp libc/test/src/math/smoke/log2_test.cpp libc/test/src/math/smoke/log2f_test.cpp libc/test/src/math/smoke/log_test.cpp libc/test/src/math/smoke/logf_test.cpp libc/test/src/math/smoke/nan_test.cpp libc/test/src/math/smoke/nanf128_test.cpp libc/test/src/math/smoke/nanf_test.cpp libc/test/src/math/smoke/nanl_test.cpp libc/test/src/math/smoke/powf_test.cpp libc/test/src/math/smoke/sincosf_test.cpp libc/test/src/math/smoke/sinf_test.cpp libc/test/src/math/smoke/sinhf_test.cpp libc/test/src/math/smoke/tanf_test.cpp libc/test/src/math/smoke/tanhf_test.cpp libc/test/src/math/tan_test.cpp libc/test/src/math/tanf_test.cpp libc/test/src/math/tanhf_test.cpp libc/test/src/stdfix/ExpTest.h libc/test/src/stdfix/ISqrtTest.h libc/test/src/stdio/sscanf_test.cpp libc/test/src/stdlib/strtof_test.cpp
``````````

</details>

<details>
<summary>
View the diff from clang-format here.
</summary>

``````````diff
diff --git a/libc/test/UnitTest/FPTest.h b/libc/test/UnitTest/FPTest.h
index 0d530cdff9..1dea867870 100644
--- a/libc/test/UnitTest/FPTest.h
+++ b/libc/test/UnitTest/FPTest.h
@@ -12,11 +12,11 @@
 #include "src/__support/CPP/utility.h"
 #include "src/__support/FPUtil/FEnvImpl.h"
 #include "src/__support/FPUtil/FPBits.h"
-#include "test/UnitTest/ErrnoSafeTest.h" // Test fixture for clearing errno
+#include "test/UnitTest/ErrnoSafeTest.h"      // Test fixture for clearing errno
 #include "test/UnitTest/ErrnoSetterMatcher.h" // Per-assertion clear/check errno
-#include "test/UnitTest/FEnvSafeTest.h" // Test fixture for resetting fenv
+#include "test/UnitTest/FEnvSafeTest.h"       // Test fixture for resetting fenv
 #include "test/UnitTest/FPExceptMatcher.h" // Per-assertion clear/check fp exns
-#include "test/UnitTest/FPMatcher.h" // Matchers/assertions for fp values
+#include "test/UnitTest/FPMatcher.h"       // Matchers/assertions for fp values
 #include "test/UnitTest/Test.h"
 
 #define DECLARE_SPECIAL_CONSTANTS(T)                                           \
diff --git a/libc/test/UnitTest/LibcTest.h b/libc/test/UnitTest/LibcTest.h
index d2372f6d57..0137d41abd 100644
--- a/libc/test/UnitTest/LibcTest.h
+++ b/libc/test/UnitTest/LibcTest.h
@@ -192,8 +192,7 @@ protected:
                          const char *LHSStr, const char *RHSStr,
                          internal::Location Loc);
 
-  template <typename Func>
-  testutils::FunctionCaller *createCallable(Func f) {
+  template <typename Func> testutils::FunctionCaller *createCallable(Func f) {
     struct Callable : public testutils::FunctionCaller {
       Func f;
       Callable(Func f) : f(f) {}
diff --git a/libc/test/src/math/smoke/cosf_test.cpp b/libc/test/src/math/smoke/cosf_test.cpp
index 82589b1263..a738512edd 100644
--- a/libc/test/src/math/smoke/cosf_test.cpp
+++ b/libc/test/src/math/smoke/cosf_test.cpp
@@ -17,9 +17,8 @@
 
 using LlvmLibcCosfTest = LIBC_NAMESPACE::testing::FPTest<float>;
 
-TEST_F(LlvmLibcCosfTest, SpecialNumbers) {  
-  EXPECT_NO_ERRNO_FP_EXCEPT(
-      EXPECT_FP_EQ(aNaN, LIBC_NAMESPACE::cosf(aNaN)));
+TEST_F(LlvmLibcCosfTest, SpecialNumbers) {
+  EXPECT_NO_ERRNO_FP_EXCEPT(EXPECT_FP_EQ(aNaN, LIBC_NAMESPACE::cosf(aNaN)));
 
   EXPECT_NO_ERRNO_FP_EXCEPT_ALL_ROUNDING(
       EXPECT_FP_EQ(1.0f, LIBC_NAMESPACE::cosf(0.0f)));

``````````

</details>


https://github.com/llvm/llvm-project/pull/91608


More information about the libc-commits mailing list