[libc-commits] [libc] 6c3f53c - [libc][NFC] Move test related pieces from FPUtil to util/UnitTest.

Siva Chandra Reddy via libc-commits libc-commits at lists.llvm.org
Fri Oct 29 08:37:36 PDT 2021


Author: Siva Chandra Reddy
Date: 2021-10-29T15:37:30Z
New Revision: 6c3f53c7ba3c84a517339f735c8dbe0fd737168f

URL: https://github.com/llvm/llvm-project/commit/6c3f53c7ba3c84a517339f735c8dbe0fd737168f
DIFF: https://github.com/llvm/llvm-project/commit/6c3f53c7ba3c84a517339f735c8dbe0fd737168f.diff

LOG: [libc][NFC] Move test related pieces from FPUtil to util/UnitTest.

Reviewed By: michaelrj

Differential Revision: https://reviews.llvm.org/D112673

Added: 
    libc/utils/UnitTest/FPExceptMatcher.cpp
    libc/utils/UnitTest/FPExceptMatcher.h
    libc/utils/UnitTest/FPMatcher.cpp
    libc/utils/UnitTest/FPMatcher.h

Modified: 
    libc/src/__support/FPUtil/CMakeLists.txt
    libc/test/src/fenv/enabled_exceptions_test.cpp
    libc/test/src/fenv/feholdexcept_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/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/RoundTest.h
    libc/test/src/math/SqrtTest.h
    libc/test/src/math/TruncTest.h
    libc/test/src/math/cos_test.cpp
    libc/test/src/math/cosf_test.cpp
    libc/test/src/math/exp2f_test.cpp
    libc/test/src/math/expf_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/mod_k_pi_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/tan_test.cpp
    libc/utils/MPFRWrapper/MPFRUtils.cpp
    libc/utils/UnitTest/CMakeLists.txt

Removed: 
    libc/src/__support/FPUtil/FPExceptMatcher.cpp
    libc/src/__support/FPUtil/FPExceptMatcher.h
    libc/src/__support/FPUtil/TestHelpers.cpp
    libc/src/__support/FPUtil/TestHelpers.h


################################################################################
diff  --git a/libc/src/__support/FPUtil/CMakeLists.txt b/libc/src/__support/FPUtil/CMakeLists.txt
index f47b545181a87..01703e017b1bf 100644
--- a/libc/src/__support/FPUtil/CMakeLists.txt
+++ b/libc/src/__support/FPUtil/CMakeLists.txt
@@ -35,19 +35,3 @@ add_header_library(
     libc.src.__support.common
     libc.src.__support.CPP.standalone_cpp
 )
-
-add_library(
-  LibcFPTestHelpers
-    FPExceptMatcher.cpp
-    FPExceptMatcher.h
-    TestHelpers.cpp
-    TestHelpers.h
-)
-target_include_directories(LibcFPTestHelpers PUBLIC ${LIBC_SOURCE_DIR})
-target_link_libraries(LibcFPTestHelpers LibcUnitTest)
-add_dependencies(
-  LibcFPTestHelpers
-  LibcUnitTest
-  libc.src.__support.CPP.standalone_cpp
-  libc.src.__support.FPUtil.fputil
-)

diff  --git a/libc/test/src/fenv/enabled_exceptions_test.cpp b/libc/test/src/fenv/enabled_exceptions_test.cpp
index b971e717beed4..7b91e98b4e94d 100644
--- a/libc/test/src/fenv/enabled_exceptions_test.cpp
+++ b/libc/test/src/fenv/enabled_exceptions_test.cpp
@@ -11,7 +11,7 @@
 #include "src/fenv/fetestexcept.h"
 
 #include "src/__support/FPUtil/FEnvUtils.h"
-#include "src/__support/FPUtil/FPExceptMatcher.h"
+#include "utils/UnitTest/FPExceptMatcher.h"
 #include "utils/UnitTest/Test.h"
 
 #include <fenv.h>

diff  --git a/libc/test/src/fenv/feholdexcept_test.cpp b/libc/test/src/fenv/feholdexcept_test.cpp
index 3f8401f1bc781..be836a4c23ce6 100644
--- a/libc/test/src/fenv/feholdexcept_test.cpp
+++ b/libc/test/src/fenv/feholdexcept_test.cpp
@@ -9,7 +9,7 @@
 #include "src/fenv/feholdexcept.h"
 
 #include "src/__support/FPUtil/FEnvUtils.h"
-#include "src/__support/FPUtil/FPExceptMatcher.h"
+#include "utils/UnitTest/FPExceptMatcher.h"
 #include "utils/UnitTest/Test.h"
 
 #include <fenv.h>

diff  --git a/libc/test/src/math/CeilTest.h b/libc/test/src/math/CeilTest.h
index e8933c6458988..8c1f0d6d757e4 100644
--- a/libc/test/src/math/CeilTest.h
+++ b/libc/test/src/math/CeilTest.h
@@ -6,8 +6,8 @@
 //
 //===----------------------------------------------------------------------===//
 
-#include "src/__support/FPUtil/TestHelpers.h"
 #include "utils/MPFRWrapper/MPFRUtils.h"
+#include "utils/UnitTest/FPMatcher.h"
 #include "utils/UnitTest/Test.h"
 
 #include <math.h>

diff  --git a/libc/test/src/math/CopySignTest.h b/libc/test/src/math/CopySignTest.h
index 7bc6f5994c768..aab7e39841390 100644
--- a/libc/test/src/math/CopySignTest.h
+++ b/libc/test/src/math/CopySignTest.h
@@ -6,8 +6,8 @@
 //
 //===----------------------------------------------------------------------===//
 
-#include "src/__support/FPUtil/TestHelpers.h"
 #include "utils/MPFRWrapper/MPFRUtils.h"
+#include "utils/UnitTest/FPMatcher.h"
 #include "utils/UnitTest/Test.h"
 
 #include <math.h>

diff  --git a/libc/test/src/math/FAbsTest.h b/libc/test/src/math/FAbsTest.h
index 5065b68a6cce8..18c9737fc25ee 100644
--- a/libc/test/src/math/FAbsTest.h
+++ b/libc/test/src/math/FAbsTest.h
@@ -6,8 +6,8 @@
 //
 //===----------------------------------------------------------------------===//
 
-#include "src/__support/FPUtil/TestHelpers.h"
 #include "utils/MPFRWrapper/MPFRUtils.h"
+#include "utils/UnitTest/FPMatcher.h"
 #include "utils/UnitTest/Test.h"
 
 #include <math.h>

diff  --git a/libc/test/src/math/FDimTest.h b/libc/test/src/math/FDimTest.h
index 12702a58affb0..a0f241fce87f2 100644
--- a/libc/test/src/math/FDimTest.h
+++ b/libc/test/src/math/FDimTest.h
@@ -8,7 +8,7 @@
 
 #include "src/__support/FPUtil/BasicOperations.h"
 #include "src/__support/FPUtil/FPBits.h"
-#include "src/__support/FPUtil/TestHelpers.h"
+#include "utils/UnitTest/FPMatcher.h"
 #include "utils/UnitTest/Test.h"
 #include <math.h>
 

diff  --git a/libc/test/src/math/FMaxTest.h b/libc/test/src/math/FMaxTest.h
index c3f1b2fb2aafd..6bdb4c7bd3c90 100644
--- a/libc/test/src/math/FMaxTest.h
+++ b/libc/test/src/math/FMaxTest.h
@@ -6,8 +6,8 @@
 //
 //===----------------------------------------------------------------------===//
 
-#include "src/__support/FPUtil/TestHelpers.h"
 #include "utils/MPFRWrapper/MPFRUtils.h"
+#include "utils/UnitTest/FPMatcher.h"
 #include "utils/UnitTest/Test.h"
 
 #include <math.h>

diff  --git a/libc/test/src/math/FMinTest.h b/libc/test/src/math/FMinTest.h
index 7faaf3460f7b8..3f6b258cf837f 100644
--- a/libc/test/src/math/FMinTest.h
+++ b/libc/test/src/math/FMinTest.h
@@ -6,8 +6,8 @@
 //
 //===----------------------------------------------------------------------===//
 
-#include "src/__support/FPUtil/TestHelpers.h"
 #include "utils/MPFRWrapper/MPFRUtils.h"
+#include "utils/UnitTest/FPMatcher.h"
 #include "utils/UnitTest/Test.h"
 
 #include <math.h>

diff  --git a/libc/test/src/math/FloorTest.h b/libc/test/src/math/FloorTest.h
index b38f7ee20eb8c..e0f9015551c82 100644
--- a/libc/test/src/math/FloorTest.h
+++ b/libc/test/src/math/FloorTest.h
@@ -6,8 +6,8 @@
 //
 //===----------------------------------------------------------------------===//
 
-#include "src/__support/FPUtil/TestHelpers.h"
 #include "utils/MPFRWrapper/MPFRUtils.h"
+#include "utils/UnitTest/FPMatcher.h"
 #include "utils/UnitTest/Test.h"
 
 #include <math.h>

diff  --git a/libc/test/src/math/FmaTest.h b/libc/test/src/math/FmaTest.h
index 20e6c34b46705..a2178e33cd2c6 100644
--- a/libc/test/src/math/FmaTest.h
+++ b/libc/test/src/math/FmaTest.h
@@ -10,8 +10,8 @@
 #define LLVM_LIBC_TEST_SRC_MATH_FMATEST_H
 
 #include "src/__support/FPUtil/FPBits.h"
-#include "src/__support/FPUtil/TestHelpers.h"
 #include "utils/MPFRWrapper/MPFRUtils.h"
+#include "utils/UnitTest/FPMatcher.h"
 #include "utils/UnitTest/Test.h"
 #include "utils/testutils/RandUtils.h"
 

diff  --git a/libc/test/src/math/FrexpTest.h b/libc/test/src/math/FrexpTest.h
index 4a3efb495bff7..edbcb614b521b 100644
--- a/libc/test/src/math/FrexpTest.h
+++ b/libc/test/src/math/FrexpTest.h
@@ -7,8 +7,8 @@
 //===----------------------------------------------------------------------===//
 
 #include "src/__support/FPUtil/BasicOperations.h"
-#include "src/__support/FPUtil/TestHelpers.h"
 #include "utils/MPFRWrapper/MPFRUtils.h"
+#include "utils/UnitTest/FPMatcher.h"
 #include "utils/UnitTest/Test.h"
 
 #include <math.h>

diff  --git a/libc/test/src/math/HypotTest.h b/libc/test/src/math/HypotTest.h
index 45d71159cd07e..11adc2f5191aa 100644
--- a/libc/test/src/math/HypotTest.h
+++ b/libc/test/src/math/HypotTest.h
@@ -11,8 +11,8 @@
 
 #include "src/__support/FPUtil/FPBits.h"
 #include "src/__support/FPUtil/Hypot.h"
-#include "src/__support/FPUtil/TestHelpers.h"
 #include "utils/MPFRWrapper/MPFRUtils.h"
+#include "utils/UnitTest/FPMatcher.h"
 #include "utils/UnitTest/Test.h"
 
 #include <math.h>

diff  --git a/libc/test/src/math/LdExpTest.h b/libc/test/src/math/LdExpTest.h
index e015e6e5fd111..3112d97435be4 100644
--- a/libc/test/src/math/LdExpTest.h
+++ b/libc/test/src/math/LdExpTest.h
@@ -11,7 +11,7 @@
 
 #include "src/__support/FPUtil/FPBits.h"
 #include "src/__support/FPUtil/NormalFloat.h"
-#include "src/__support/FPUtil/TestHelpers.h"
+#include "utils/UnitTest/FPMatcher.h"
 #include "utils/UnitTest/Test.h"
 
 #include <limits.h>

diff  --git a/libc/test/src/math/LogbTest.h b/libc/test/src/math/LogbTest.h
index 4db547575570e..4d820f6c73222 100644
--- a/libc/test/src/math/LogbTest.h
+++ b/libc/test/src/math/LogbTest.h
@@ -7,8 +7,8 @@
 //===----------------------------------------------------------------------===//
 
 #include "src/__support/FPUtil/ManipulationFunctions.h"
-#include "src/__support/FPUtil/TestHelpers.h"
 #include "utils/MPFRWrapper/MPFRUtils.h"
+#include "utils/UnitTest/FPMatcher.h"
 #include "utils/UnitTest/Test.h"
 
 #include <math.h>

diff  --git a/libc/test/src/math/ModfTest.h b/libc/test/src/math/ModfTest.h
index 59e854b603e7b..8cc62aafedfbd 100644
--- a/libc/test/src/math/ModfTest.h
+++ b/libc/test/src/math/ModfTest.h
@@ -8,8 +8,8 @@
 
 #include "src/__support/FPUtil/BasicOperations.h"
 #include "src/__support/FPUtil/NearestIntegerOperations.h"
-#include "src/__support/FPUtil/TestHelpers.h"
 #include "utils/MPFRWrapper/MPFRUtils.h"
+#include "utils/UnitTest/FPMatcher.h"
 #include "utils/UnitTest/Test.h"
 
 #include <math.h>

diff  --git a/libc/test/src/math/NextAfterTest.h b/libc/test/src/math/NextAfterTest.h
index 262fcb88adb27..73eb601bf619d 100644
--- a/libc/test/src/math/NextAfterTest.h
+++ b/libc/test/src/math/NextAfterTest.h
@@ -12,7 +12,7 @@
 #include "src/__support/CPP/TypeTraits.h"
 #include "src/__support/FPUtil/BasicOperations.h"
 #include "src/__support/FPUtil/FPBits.h"
-#include "src/__support/FPUtil/TestHelpers.h"
+#include "utils/UnitTest/FPMatcher.h"
 #include "utils/UnitTest/Test.h"
 #include <math.h>
 

diff  --git a/libc/test/src/math/RIntTest.h b/libc/test/src/math/RIntTest.h
index eef39c695e090..dbe2fe3a50823 100644
--- a/libc/test/src/math/RIntTest.h
+++ b/libc/test/src/math/RIntTest.h
@@ -11,8 +11,8 @@
 
 #include "src/__support/FPUtil/FEnvUtils.h"
 #include "src/__support/FPUtil/FPBits.h"
-#include "src/__support/FPUtil/TestHelpers.h"
 #include "utils/MPFRWrapper/MPFRUtils.h"
+#include "utils/UnitTest/FPMatcher.h"
 #include "utils/UnitTest/Test.h"
 
 #include <fenv.h>

diff  --git a/libc/test/src/math/RemQuoTest.h b/libc/test/src/math/RemQuoTest.h
index 80880f42086ea..ce77be1535c98 100644
--- a/libc/test/src/math/RemQuoTest.h
+++ b/libc/test/src/math/RemQuoTest.h
@@ -11,8 +11,8 @@
 
 #include "src/__support/FPUtil/BasicOperations.h"
 #include "src/__support/FPUtil/FPBits.h"
-#include "src/__support/FPUtil/TestHelpers.h"
 #include "utils/MPFRWrapper/MPFRUtils.h"
+#include "utils/UnitTest/FPMatcher.h"
 #include "utils/UnitTest/Test.h"
 #include <math.h>
 

diff  --git a/libc/test/src/math/RoundTest.h b/libc/test/src/math/RoundTest.h
index 1bc224bb3c536..928268e719a19 100644
--- a/libc/test/src/math/RoundTest.h
+++ b/libc/test/src/math/RoundTest.h
@@ -6,8 +6,8 @@
 //
 //===----------------------------------------------------------------------===//
 
-#include "src/__support/FPUtil/TestHelpers.h"
 #include "utils/MPFRWrapper/MPFRUtils.h"
+#include "utils/UnitTest/FPMatcher.h"
 #include "utils/UnitTest/Test.h"
 
 #include <math.h>

diff  --git a/libc/test/src/math/SqrtTest.h b/libc/test/src/math/SqrtTest.h
index 469c2871e8d46..02aeb42f1ad8c 100644
--- a/libc/test/src/math/SqrtTest.h
+++ b/libc/test/src/math/SqrtTest.h
@@ -6,8 +6,8 @@
 //
 //===----------------------------------------------------------------------===//
 
-#include "src/__support/FPUtil/TestHelpers.h"
 #include "utils/MPFRWrapper/MPFRUtils.h"
+#include "utils/UnitTest/FPMatcher.h"
 #include "utils/UnitTest/Test.h"
 
 #include <math.h>

diff  --git a/libc/test/src/math/TruncTest.h b/libc/test/src/math/TruncTest.h
index 15a44b508288f..9f4ff50bebd18 100644
--- a/libc/test/src/math/TruncTest.h
+++ b/libc/test/src/math/TruncTest.h
@@ -6,8 +6,8 @@
 //
 //===----------------------------------------------------------------------===//
 
-#include "src/__support/FPUtil/TestHelpers.h"
 #include "utils/MPFRWrapper/MPFRUtils.h"
+#include "utils/UnitTest/FPMatcher.h"
 #include "utils/UnitTest/Test.h"
 
 #include <math.h>

diff  --git a/libc/test/src/math/cos_test.cpp b/libc/test/src/math/cos_test.cpp
index 6c9aea382c718..e99cb39ad1e86 100644
--- a/libc/test/src/math/cos_test.cpp
+++ b/libc/test/src/math/cos_test.cpp
@@ -6,9 +6,9 @@
 //
 //===----------------------------------------------------------------------===//
 
-#include "src/__support/FPUtil/TestHelpers.h"
 #include "src/math/cos.h"
 #include "utils/MPFRWrapper/MPFRUtils.h"
+#include "utils/UnitTest/FPMatcher.h"
 #include "utils/UnitTest/Test.h"
 
 #include <math.h>

diff  --git a/libc/test/src/math/cosf_test.cpp b/libc/test/src/math/cosf_test.cpp
index de7d5db4d0fcb..92f193b50c751 100644
--- a/libc/test/src/math/cosf_test.cpp
+++ b/libc/test/src/math/cosf_test.cpp
@@ -8,10 +8,10 @@
 
 #include "src/__support/CPP/Array.h"
 #include "src/__support/FPUtil/FPBits.h"
-#include "src/__support/FPUtil/TestHelpers.h"
 #include "src/math/cosf.h"
 #include "test/src/math/sdcomp26094.h"
 #include "utils/MPFRWrapper/MPFRUtils.h"
+#include "utils/UnitTest/FPMatcher.h"
 #include "utils/UnitTest/Test.h"
 #include <math.h>
 

diff  --git a/libc/test/src/math/exp2f_test.cpp b/libc/test/src/math/exp2f_test.cpp
index b3ff9fd02acbe..16811fb664a6b 100644
--- a/libc/test/src/math/exp2f_test.cpp
+++ b/libc/test/src/math/exp2f_test.cpp
@@ -7,9 +7,9 @@
 //===----------------------------------------------------------------------===//
 
 #include "src/__support/FPUtil/FPBits.h"
-#include "src/__support/FPUtil/TestHelpers.h"
 #include "src/math/exp2f.h"
 #include "utils/MPFRWrapper/MPFRUtils.h"
+#include "utils/UnitTest/FPMatcher.h"
 #include "utils/UnitTest/Test.h"
 #include <math.h>
 

diff  --git a/libc/test/src/math/expf_test.cpp b/libc/test/src/math/expf_test.cpp
index 3b85927229479..b06b560a70852 100644
--- a/libc/test/src/math/expf_test.cpp
+++ b/libc/test/src/math/expf_test.cpp
@@ -7,9 +7,9 @@
 //===----------------------------------------------------------------------===//
 
 #include "src/__support/FPUtil/FPBits.h"
-#include "src/__support/FPUtil/TestHelpers.h"
 #include "src/math/expf.h"
 #include "utils/MPFRWrapper/MPFRUtils.h"
+#include "utils/UnitTest/FPMatcher.h"
 #include "utils/UnitTest/Test.h"
 #include <math.h>
 

diff  --git a/libc/test/src/math/expm1f_test.cpp b/libc/test/src/math/expm1f_test.cpp
index c49e5f51aa118..523b1951ad117 100644
--- a/libc/test/src/math/expm1f_test.cpp
+++ b/libc/test/src/math/expm1f_test.cpp
@@ -7,9 +7,9 @@
 //===----------------------------------------------------------------------===//
 
 #include "src/__support/FPUtil/FPBits.h"
-#include "src/__support/FPUtil/TestHelpers.h"
 #include "src/math/expm1f.h"
 #include "utils/MPFRWrapper/MPFRUtils.h"
+#include "utils/UnitTest/FPMatcher.h"
 #include "utils/UnitTest/Test.h"
 #include <math.h>
 

diff  --git a/libc/test/src/math/fdim_test.cpp b/libc/test/src/math/fdim_test.cpp
index 7aa2948d76682..a4726f28a3827 100644
--- a/libc/test/src/math/fdim_test.cpp
+++ b/libc/test/src/math/fdim_test.cpp
@@ -9,8 +9,8 @@
 #include "FDimTest.h"
 
 #include "src/__support/FPUtil/FPBits.h"
-#include "src/__support/FPUtil/TestHelpers.h"
 #include "src/math/fdim.h"
+#include "utils/UnitTest/FPMatcher.h"
 #include "utils/UnitTest/Test.h"
 #include <math.h>
 

diff  --git a/libc/test/src/math/fdimf_test.cpp b/libc/test/src/math/fdimf_test.cpp
index 7c646aaef881a..45f960cc8955b 100644
--- a/libc/test/src/math/fdimf_test.cpp
+++ b/libc/test/src/math/fdimf_test.cpp
@@ -9,8 +9,8 @@
 #include "FDimTest.h"
 
 #include "src/__support/FPUtil/FPBits.h"
-#include "src/__support/FPUtil/TestHelpers.h"
 #include "src/math/fdimf.h"
+#include "utils/UnitTest/FPMatcher.h"
 #include "utils/UnitTest/Test.h"
 #include <math.h>
 

diff  --git a/libc/test/src/math/fdiml_test.cpp b/libc/test/src/math/fdiml_test.cpp
index 7368b452e00fb..b82819395b35f 100644
--- a/libc/test/src/math/fdiml_test.cpp
+++ b/libc/test/src/math/fdiml_test.cpp
@@ -9,8 +9,8 @@
 #include "FDimTest.h"
 
 #include "src/__support/FPUtil/FPBits.h"
-#include "src/__support/FPUtil/TestHelpers.h"
 #include "src/math/fdiml.h"
+#include "utils/UnitTest/FPMatcher.h"
 #include "utils/UnitTest/Test.h"
 #include <math.h>
 

diff  --git a/libc/test/src/math/ilogb_test.cpp b/libc/test/src/math/ilogb_test.cpp
index 8b46c16adddf4..8b8b51cb41be0 100644
--- a/libc/test/src/math/ilogb_test.cpp
+++ b/libc/test/src/math/ilogb_test.cpp
@@ -10,8 +10,8 @@
 
 #include "src/__support/FPUtil/FPBits.h"
 #include "src/__support/FPUtil/ManipulationFunctions.h"
-#include "src/__support/FPUtil/TestHelpers.h"
 #include "src/math/ilogb.h"
+#include "utils/UnitTest/FPMatcher.h"
 #include "utils/UnitTest/Test.h"
 #include <math.h>
 

diff  --git a/libc/test/src/math/ilogbf_test.cpp b/libc/test/src/math/ilogbf_test.cpp
index 104c00fb486b6..9fabc01ea9696 100644
--- a/libc/test/src/math/ilogbf_test.cpp
+++ b/libc/test/src/math/ilogbf_test.cpp
@@ -10,8 +10,8 @@
 
 #include "src/__support/FPUtil/FPBits.h"
 #include "src/__support/FPUtil/ManipulationFunctions.h"
-#include "src/__support/FPUtil/TestHelpers.h"
 #include "src/math/ilogbf.h"
+#include "utils/UnitTest/FPMatcher.h"
 #include "utils/UnitTest/Test.h"
 #include <math.h>
 

diff  --git a/libc/test/src/math/ilogbl_test.cpp b/libc/test/src/math/ilogbl_test.cpp
index f31e5693151cd..f36746b6f64fb 100644
--- a/libc/test/src/math/ilogbl_test.cpp
+++ b/libc/test/src/math/ilogbl_test.cpp
@@ -10,8 +10,8 @@
 
 #include "src/__support/FPUtil/FPBits.h"
 #include "src/__support/FPUtil/ManipulationFunctions.h"
-#include "src/__support/FPUtil/TestHelpers.h"
 #include "src/math/ilogbl.h"
+#include "utils/UnitTest/FPMatcher.h"
 #include "utils/UnitTest/Test.h"
 #include <math.h>
 

diff  --git a/libc/test/src/math/mod_k_pi_test.cpp b/libc/test/src/math/mod_k_pi_test.cpp
index 008e93da9519b..12d915b3612f3 100644
--- a/libc/test/src/math/mod_k_pi_test.cpp
+++ b/libc/test/src/math/mod_k_pi_test.cpp
@@ -6,9 +6,9 @@
 //
 //===----------------------------------------------------------------------===//
 
-#include "src/__support/FPUtil/TestHelpers.h"
 #include "src/math/generic/dp_trig.h"
 #include "utils/MPFRWrapper/MPFRUtils.h"
+#include "utils/UnitTest/FPMatcher.h"
 #include "utils/UnitTest/Test.h"
 
 #include <math.h>

diff  --git a/libc/test/src/math/sin_test.cpp b/libc/test/src/math/sin_test.cpp
index b0485a533d4b2..bce7a72a8438c 100644
--- a/libc/test/src/math/sin_test.cpp
+++ b/libc/test/src/math/sin_test.cpp
@@ -7,9 +7,9 @@
 //===----------------------------------------------------------------------===//
 
 #include "src/__support/FPUtil/FPBits.h"
-#include "src/__support/FPUtil/TestHelpers.h"
 #include "src/math/sin.h"
 #include "utils/MPFRWrapper/MPFRUtils.h"
+#include "utils/UnitTest/FPMatcher.h"
 #include "utils/UnitTest/Test.h"
 
 #include <math.h>

diff  --git a/libc/test/src/math/sincosf_test.cpp b/libc/test/src/math/sincosf_test.cpp
index 77fe3778eec51..7812fbe6d9c34 100644
--- a/libc/test/src/math/sincosf_test.cpp
+++ b/libc/test/src/math/sincosf_test.cpp
@@ -8,10 +8,10 @@
 
 #include "src/__support/CPP/Array.h"
 #include "src/__support/FPUtil/FPBits.h"
-#include "src/__support/FPUtil/TestHelpers.h"
 #include "src/math/sincosf.h"
 #include "test/src/math/sdcomp26094.h"
 #include "utils/MPFRWrapper/MPFRUtils.h"
+#include "utils/UnitTest/FPMatcher.h"
 #include "utils/UnitTest/Test.h"
 #include <math.h>
 

diff  --git a/libc/test/src/math/sinf_test.cpp b/libc/test/src/math/sinf_test.cpp
index a3620eff98440..6770e47f6da3e 100644
--- a/libc/test/src/math/sinf_test.cpp
+++ b/libc/test/src/math/sinf_test.cpp
@@ -8,10 +8,10 @@
 
 #include "src/__support/CPP/Array.h"
 #include "src/__support/FPUtil/FPBits.h"
-#include "src/__support/FPUtil/TestHelpers.h"
 #include "src/math/sinf.h"
 #include "test/src/math/sdcomp26094.h"
 #include "utils/MPFRWrapper/MPFRUtils.h"
+#include "utils/UnitTest/FPMatcher.h"
 #include "utils/UnitTest/Test.h"
 #include <math.h>
 

diff  --git a/libc/test/src/math/tan_test.cpp b/libc/test/src/math/tan_test.cpp
index 52798e2c13e22..de3d6f16b76e8 100644
--- a/libc/test/src/math/tan_test.cpp
+++ b/libc/test/src/math/tan_test.cpp
@@ -6,9 +6,9 @@
 //
 //===----------------------------------------------------------------------===//
 
-#include "src/__support/FPUtil/TestHelpers.h"
 #include "src/math/tan.h"
 #include "utils/MPFRWrapper/MPFRUtils.h"
+#include "utils/UnitTest/FPMatcher.h"
 #include "utils/UnitTest/Test.h"
 
 #include <math.h>

diff  --git a/libc/utils/MPFRWrapper/MPFRUtils.cpp b/libc/utils/MPFRWrapper/MPFRUtils.cpp
index 8bcaa13d92534..9a2a125d301b7 100644
--- a/libc/utils/MPFRWrapper/MPFRUtils.cpp
+++ b/libc/utils/MPFRWrapper/MPFRUtils.cpp
@@ -10,7 +10,7 @@
 
 #include "src/__support/CPP/StringView.h"
 #include "src/__support/FPUtil/FPBits.h"
-#include "src/__support/FPUtil/TestHelpers.h"
+#include "utils/UnitTest/FPMatcher.h"
 
 #include <cmath>
 #include <memory>

diff  --git a/libc/utils/UnitTest/CMakeLists.txt b/libc/utils/UnitTest/CMakeLists.txt
index 4140c6daa5d95..2870fb2553f45 100644
--- a/libc/utils/UnitTest/CMakeLists.txt
+++ b/libc/utils/UnitTest/CMakeLists.txt
@@ -17,3 +17,18 @@ target_include_directories(LibcUnitTestMain PUBLIC ${LIBC_SOURCE_DIR})
 add_dependencies(LibcUnitTestMain LibcUnitTest libc.src.__support.CPP.standalone_cpp)
 target_link_libraries(LibcUnitTestMain PUBLIC LibcUnitTest libc_test_utils)
 
+add_library(
+  LibcFPTestHelpers
+    FPExceptMatcher.cpp
+    FPExceptMatcher.h
+    FPMatcher.cpp
+    FPMatcher.h
+)
+target_include_directories(LibcFPTestHelpers PUBLIC ${LIBC_SOURCE_DIR})
+target_link_libraries(LibcFPTestHelpers LibcUnitTest)
+add_dependencies(
+  LibcFPTestHelpers
+  LibcUnitTest
+  libc.src.__support.CPP.standalone_cpp
+  libc.src.__support.FPUtil.fputil
+)

diff  --git a/libc/src/__support/FPUtil/FPExceptMatcher.cpp b/libc/utils/UnitTest/FPExceptMatcher.cpp
similarity index 100%
rename from libc/src/__support/FPUtil/FPExceptMatcher.cpp
rename to libc/utils/UnitTest/FPExceptMatcher.cpp

diff  --git a/libc/src/__support/FPUtil/FPExceptMatcher.h b/libc/utils/UnitTest/FPExceptMatcher.h
similarity index 92%
rename from libc/src/__support/FPUtil/FPExceptMatcher.h
rename to libc/utils/UnitTest/FPExceptMatcher.h
index fd51fa050bbc2..23fd945019c08 100644
--- a/libc/src/__support/FPUtil/FPExceptMatcher.h
+++ b/libc/utils/UnitTest/FPExceptMatcher.h
@@ -6,8 +6,8 @@
 //
 //===----------------------------------------------------------------------===//
 
-#ifndef LLVM_LIBC_SRC_SUPPORT_FPUTIL_FP_EXCEPT_MATCHER_H
-#define LLVM_LIBC_SRC_SUPPORT_FPUTIL_FP_EXCEPT_MATCHER_H
+#ifndef LLVM_LIBC_UTILS_UNITTEST_FPEXCEPTMATCHER_H
+#define LLVM_LIBC_UTILS_UNITTEST_FPEXCEPTMATCHER_H
 
 #ifndef LLVM_LIBC_TEST_USE_FUCHSIA
 
@@ -64,4 +64,4 @@ class FPExceptMatcher : public __llvm_libc::testing::Matcher<bool> {
 #define ASSERT_RAISES_FP_EXCEPT(func) ASSERT_DEATH(func, WITH_SIGNAL(SIGFPE))
 #endif // LLVM_LIBC_TEST_USE_FUCHSIA
 
-#endif // LLVM_LIBC_SRC_SUPPORT_FPUTIL_FP_EXCEPT_MATCHER_H
+#endif // LLVM_LIBC_UTILS_UNITTEST_FPEXCEPTMATCHER_H

diff  --git a/libc/src/__support/FPUtil/TestHelpers.cpp b/libc/utils/UnitTest/FPMatcher.cpp
similarity index 97%
rename from libc/src/__support/FPUtil/TestHelpers.cpp
rename to libc/utils/UnitTest/FPMatcher.cpp
index 2c7614e93053f..8f19f11d382b0 100644
--- a/libc/src/__support/FPUtil/TestHelpers.cpp
+++ b/libc/utils/UnitTest/FPMatcher.cpp
@@ -6,9 +6,9 @@
 //
 //===----------------------------------------------------------------------===//
 
-#include "TestHelpers.h"
+#include "FPMatcher.h"
 
-#include "FPBits.h"
+#include "src/__support/FPUtil/FPBits.h"
 
 #include <string>
 

diff  --git a/libc/src/__support/FPUtil/TestHelpers.h b/libc/utils/UnitTest/FPMatcher.h
similarity index 95%
rename from libc/src/__support/FPUtil/TestHelpers.h
rename to libc/utils/UnitTest/FPMatcher.h
index 4ee0bb9091f1f..ff383d56868f9 100644
--- a/libc/src/__support/FPUtil/TestHelpers.h
+++ b/libc/utils/UnitTest/FPMatcher.h
@@ -6,10 +6,10 @@
 //
 //===----------------------------------------------------------------------===//
 
-#ifndef LLVM_LIBC_SRC_SUPPORT_FPUTIL_TEST_HELPERS_H
-#define LLVM_LIBC_SRC_SUPPORT_FPUTIL_TEST_HELPERS_H
+#ifndef LLVM_LIBC_UTILS_UNITTEST_FPMATCHER_H
+#define LLVM_LIBC_UTILS_UNITTEST_FPMATCHER_H
 
-#include "FPBits.h"
+#include "src/__support/FPUtil/FPBits.h"
 
 #include "utils/UnitTest/Test.h"
 
@@ -98,4 +98,4 @@ FPMatcher<T, C> getMatcher(T expectedValue) {
       __llvm_libc::fputil::testing::getMatcher<__llvm_libc::testing::Cond_NE>( \
           expected))
 
-#endif // LLVM_LIBC_SRC_SUPPORT_FPUTIL_TEST_HELPERS_H
+#endif // LLVM_LIBC_UTILS_UNITTEST_FPMATCHER_H


        


More information about the libc-commits mailing list