diff options
Diffstat (limited to 'libc/test/src/math')
-rw-r--r-- | libc/test/src/math/FmaTest.h | 7 | ||||
-rw-r--r-- | libc/test/src/math/HypotTest.h | 5 | ||||
-rw-r--r-- | libc/test/src/math/smoke/CMakeLists.txt | 5 | ||||
-rw-r--r-- | libc/test/src/math/smoke/nan_test.cpp | 5 | ||||
-rw-r--r-- | libc/test/src/math/smoke/nanf128_test.cpp | 5 | ||||
-rw-r--r-- | libc/test/src/math/smoke/nanf16_test.cpp | 5 | ||||
-rw-r--r-- | libc/test/src/math/smoke/nanf_test.cpp | 5 | ||||
-rw-r--r-- | libc/test/src/math/smoke/nanl_test.cpp | 5 |
8 files changed, 17 insertions, 25 deletions
diff --git a/libc/test/src/math/FmaTest.h b/libc/test/src/math/FmaTest.h index 5c5419c..902ff04 100644 --- a/libc/test/src/math/FmaTest.h +++ b/libc/test/src/math/FmaTest.h @@ -48,7 +48,8 @@ class FmaTestTemplate : public LIBC_NAMESPACE::testing::FEnvSafeTest { InStorageType get_random_bit_pattern() { InStorageType bits{0}; for (InStorageType i = 0; i < sizeof(InStorageType) / 2; ++i) { - bits = (bits << 2) + static_cast<uint16_t>(LIBC_NAMESPACE::rand()); + bits = static_cast<InStorageType>( + (bits << 2) + static_cast<uint16_t>(LIBC_NAMESPACE::rand())); } return bits; } @@ -57,7 +58,7 @@ public: using FmaFunc = OutType (*)(InType, InType, InType); void test_subnormal_range(FmaFunc func) { - constexpr InStorageType COUNT = 100'001; + constexpr InStorageType COUNT = 10'001; constexpr InStorageType RAW_STEP = (IN_MAX_SUBNORMAL_U - IN_MIN_SUBNORMAL_U) / COUNT; constexpr InStorageType STEP = (RAW_STEP == 0 ? 1 : RAW_STEP); @@ -75,7 +76,7 @@ public: } void test_normal_range(FmaFunc func) { - constexpr InStorageType COUNT = 100'001; + constexpr InStorageType COUNT = 10'001; constexpr InStorageType RAW_STEP = (IN_MAX_NORMAL_U - IN_MIN_NORMAL_U) / COUNT; constexpr InStorageType STEP = (RAW_STEP == 0 ? 1 : RAW_STEP); diff --git a/libc/test/src/math/HypotTest.h b/libc/test/src/math/HypotTest.h index dc73581..b37abf7 100644 --- a/libc/test/src/math/HypotTest.h +++ b/libc/test/src/math/HypotTest.h @@ -71,8 +71,9 @@ public: void test_subnormal_range(Func func) { constexpr StorageType COUNT = 10'001; - for (unsigned scale = 0; scale < 4; ++scale) { - StorageType max_value = MAX_SUBNORMAL << scale; + constexpr unsigned SCALE = (sizeof(T) < 4) ? 1 : 4; + for (unsigned scale = 0; scale < SCALE; ++scale) { + StorageType max_value = static_cast<StorageType>(MAX_SUBNORMAL << scale); StorageType step = (max_value - MIN_SUBNORMAL) / COUNT + 1; for (int signs = 0; signs < 4; ++signs) { for (StorageType v = MIN_SUBNORMAL, w = max_value; diff --git a/libc/test/src/math/smoke/CMakeLists.txt b/libc/test/src/math/smoke/CMakeLists.txt index 4aafe03..ec4c09c 100644 --- a/libc/test/src/math/smoke/CMakeLists.txt +++ b/libc/test/src/math/smoke/CMakeLists.txt @@ -3169,7 +3169,6 @@ add_fp_unittest( libc.hdr.signal_macros libc.src.math.nanf libc.src.__support.FPUtil.fp_bits - libc.src.__support.macros.sanitizer # FIXME: The nan tests currently have death tests, which aren't supported for # hermetic tests. UNIT_TEST_ONLY @@ -3185,7 +3184,6 @@ add_fp_unittest( libc.hdr.signal_macros libc.src.math.nan libc.src.__support.FPUtil.fp_bits - libc.src.__support.macros.sanitizer # FIXME: The nan tests currently have death tests, which aren't supported for # hermetic tests. UNIT_TEST_ONLY @@ -3201,7 +3199,6 @@ add_fp_unittest( libc.hdr.signal_macros libc.src.math.nanl libc.src.__support.FPUtil.fp_bits - libc.src.__support.macros.sanitizer # FIXME: The nan tests currently have death tests, which aren't supported for # hermetic tests. UNIT_TEST_ONLY @@ -3217,7 +3214,6 @@ add_fp_unittest( libc.hdr.signal_macros libc.src.math.nanf16 libc.src.__support.FPUtil.fp_bits - libc.src.__support.macros.sanitizer # FIXME: The nan tests currently have death tests, which aren't supported for # hermetic tests. UNIT_TEST_ONLY @@ -3233,7 +3229,6 @@ add_fp_unittest( libc.hdr.signal_macros libc.src.math.nanf128 libc.src.__support.FPUtil.fp_bits - libc.src.__support.macros.sanitizer # FIXME: The nan tests currently have death tests, which aren't supported for # hermetic tests. UNIT_TEST_ONLY diff --git a/libc/test/src/math/smoke/nan_test.cpp b/libc/test/src/math/smoke/nan_test.cpp index e8376c0..9010b74 100644 --- a/libc/test/src/math/smoke/nan_test.cpp +++ b/libc/test/src/math/smoke/nan_test.cpp @@ -8,7 +8,6 @@ #include "hdr/signal_macros.h" #include "src/__support/FPUtil/FPBits.h" -#include "src/__support/macros/sanitizer.h" #include "src/math/nan.h" #include "test/UnitTest/FEnvSafeTest.h" #include "test/UnitTest/FPMatcher.h" @@ -44,8 +43,8 @@ TEST_F(LlvmLibcNanTest, RandomString) { run_test("123 ", 0x7ff8000000000000); } -#if defined(LIBC_ADD_NULL_CHECKS) && !defined(LIBC_HAS_SANITIZER) +#if defined(LIBC_ADD_NULL_CHECKS) TEST_F(LlvmLibcNanTest, InvalidInput) { EXPECT_DEATH([] { LIBC_NAMESPACE::nan(nullptr); }, WITH_SIGNAL(-1)); } -#endif // LIBC_HAS_ADDRESS_SANITIZER +#endif // LIBC_ADD_NULL_CHECKS diff --git a/libc/test/src/math/smoke/nanf128_test.cpp b/libc/test/src/math/smoke/nanf128_test.cpp index a63ce88..40b347d 100644 --- a/libc/test/src/math/smoke/nanf128_test.cpp +++ b/libc/test/src/math/smoke/nanf128_test.cpp @@ -8,7 +8,6 @@ #include "hdr/signal_macros.h" #include "src/__support/FPUtil/FPBits.h" -#include "src/__support/macros/sanitizer.h" #include "src/__support/uint128.h" #include "src/math/nanf128.h" #include "test/UnitTest/FEnvSafeTest.h" @@ -55,8 +54,8 @@ TEST_F(LlvmLibcNanf128Test, RandomString) { QUIET_NAN); } -#if defined(LIBC_ADD_NULL_CHECKS) && !defined(LIBC_HAS_SANITIZER) +#if defined(LIBC_ADD_NULL_CHECKS) TEST_F(LlvmLibcNanf128Test, InvalidInput) { EXPECT_DEATH([] { LIBC_NAMESPACE::nanf128(nullptr); }, WITH_SIGNAL(-1)); } -#endif // LIBC_HAS_ADDRESS_SANITIZER +#endif // LIBC_ADD_NULL_CHECKS diff --git a/libc/test/src/math/smoke/nanf16_test.cpp b/libc/test/src/math/smoke/nanf16_test.cpp index 694470b..e05f79c 100644 --- a/libc/test/src/math/smoke/nanf16_test.cpp +++ b/libc/test/src/math/smoke/nanf16_test.cpp @@ -8,7 +8,6 @@ #include "hdr/signal_macros.h" #include "src/__support/FPUtil/FPBits.h" -#include "src/__support/macros/sanitizer.h" #include "src/math/nanf16.h" #include "test/UnitTest/FEnvSafeTest.h" #include "test/UnitTest/FPMatcher.h" @@ -43,8 +42,8 @@ TEST_F(LlvmLibcNanf16Test, RandomString) { run_test("123 ", 0x7e00); } -#if defined(LIBC_ADD_NULL_CHECKS) && !defined(LIBC_HAS_SANITIZER) +#if defined(LIBC_ADD_NULL_CHECKS) TEST_F(LlvmLibcNanf16Test, InvalidInput) { EXPECT_DEATH([] { LIBC_NAMESPACE::nanf16(nullptr); }, WITH_SIGNAL(-1)); } -#endif // LIBC_HAS_ADDRESS_SANITIZER +#endif // LIBC_ADD_NULL_CHECKS diff --git a/libc/test/src/math/smoke/nanf_test.cpp b/libc/test/src/math/smoke/nanf_test.cpp index cb57f65..c2fef72 100644 --- a/libc/test/src/math/smoke/nanf_test.cpp +++ b/libc/test/src/math/smoke/nanf_test.cpp @@ -8,7 +8,6 @@ #include "hdr/signal_macros.h" #include "src/__support/FPUtil/FPBits.h" -#include "src/__support/macros/sanitizer.h" #include "src/math/nanf.h" #include "test/UnitTest/FEnvSafeTest.h" #include "test/UnitTest/FPMatcher.h" @@ -43,8 +42,8 @@ TEST_F(LlvmLibcNanfTest, RandomString) { run_test("123 ", 0x7fc00000); } -#if defined(LIBC_ADD_NULL_CHECKS) && !defined(LIBC_HAS_SANITIZER) +#if defined(LIBC_ADD_NULL_CHECKS) TEST_F(LlvmLibcNanfTest, InvalidInput) { EXPECT_DEATH([] { LIBC_NAMESPACE::nanf(nullptr); }, WITH_SIGNAL(-1)); } -#endif // LIBC_HAS_ADDRESS_SANITIZER +#endif // LIBC_ADD_NULL_CHECKS diff --git a/libc/test/src/math/smoke/nanl_test.cpp b/libc/test/src/math/smoke/nanl_test.cpp index 3bcb914..b1d46df 100644 --- a/libc/test/src/math/smoke/nanl_test.cpp +++ b/libc/test/src/math/smoke/nanl_test.cpp @@ -8,7 +8,6 @@ #include "hdr/signal_macros.h" #include "src/__support/FPUtil/FPBits.h" -#include "src/__support/macros/sanitizer.h" #include "src/math/nanl.h" #include "test/UnitTest/FEnvSafeTest.h" #include "test/UnitTest/FPMatcher.h" @@ -71,8 +70,8 @@ TEST_F(LlvmLibcNanlTest, RandomString) { run_test("123 ", expected); } -#if defined(LIBC_ADD_NULL_CHECKS) && !defined(LIBC_HAS_SANITIZER) +#if defined(LIBC_ADD_NULL_CHECKS) TEST_F(LlvmLibcNanlTest, InvalidInput) { EXPECT_DEATH([] { LIBC_NAMESPACE::nanl(nullptr); }, WITH_SIGNAL(-1)); } -#endif // LIBC_HAS_ADDRESS_SANITIZER +#endif // LIBC_ADD_NULL_CHECKS |