diff --git a/libc/test/src/math/exhaustive/exhaustive_test.h b/libc/test/src/math/exhaustive/exhaustive_test.h --- a/libc/test/src/math/exhaustive/exhaustive_test.h +++ b/libc/test/src/math/exhaustive/exhaustive_test.h @@ -22,5 +22,6 @@ void test_full_range(T start, T stop, int nthreads, mpfr::RoundingMode rounding); - virtual void check(T start, T stop, mpfr::RoundingMode rounding) = 0; + virtual void check(T start, T stop, mpfr::RoundingMode rounding, + bool &result) = 0; }; diff --git a/libc/test/src/math/exhaustive/exhaustive_test.cpp b/libc/test/src/math/exhaustive/exhaustive_test.cpp --- a/libc/test/src/math/exhaustive/exhaustive_test.cpp +++ b/libc/test/src/math/exhaustive/exhaustive_test.cpp @@ -32,10 +32,12 @@ std::cout << msg.str(); msg.str(""); - check(begin, end, rounding); + bool result; + check(begin, end, rounding, result); msg << "** Finished testing from " << std::dec << begin << " to " << end - << " [0x" << std::hex << begin << ", 0x" << end << ")" << std::endl; + << " [0x" << std::hex << begin << ", 0x" << end + << ") : " << (result ? "PASSED" : "FAILED") << std::endl; std::cout << msg.str(); }); begin += increment; diff --git a/libc/test/src/math/exhaustive/expf_test.cpp b/libc/test/src/math/exhaustive/expf_test.cpp --- a/libc/test/src/math/exhaustive/expf_test.cpp +++ b/libc/test/src/math/exhaustive/expf_test.cpp @@ -17,16 +17,18 @@ namespace mpfr = __llvm_libc::testing::mpfr; struct LlvmLibcExpfExhaustiveTest : public LlvmLibcExhaustiveTest { - void check(uint32_t start, uint32_t stop, - mpfr::RoundingMode rounding) override { + void check(uint32_t start, uint32_t stop, mpfr::RoundingMode rounding, + bool &result) override { mpfr::ForceRoundingMode r(rounding); uint32_t bits = start; + result = false; do { FPBits xbits(bits); float x = float(xbits); EXPECT_MPFR_MATCH(mpfr::Operation::Exp, x, __llvm_libc::expf(x), 0.5, rounding); } while (bits++ < stop); + result = true; } }; diff --git a/libc/test/src/math/exhaustive/hypotf_test.cpp b/libc/test/src/math/exhaustive/hypotf_test.cpp --- a/libc/test/src/math/exhaustive/hypotf_test.cpp +++ b/libc/test/src/math/exhaustive/hypotf_test.cpp @@ -18,14 +18,15 @@ namespace mpfr = __llvm_libc::testing::mpfr; struct LlvmLibcHypotfExhaustiveTest : public LlvmLibcExhaustiveTest { - void check(uint32_t start, uint32_t stop, - mpfr::RoundingMode rounding) override { + void check(uint32_t start, uint32_t stop, mpfr::RoundingMode rounding, + bool &result) override { // Range of the second input: [2^37, 2^48). constexpr uint32_t Y_START = (37U + 127U) << 23; constexpr uint32_t Y_STOP = (48U + 127U) << 23; mpfr::ForceRoundingMode r(rounding); uint32_t xbits = start; + result = false; do { float x = float(FPBits(xbits)); uint32_t ybits = Y_START; @@ -40,6 +41,7 @@ // rounding); } while (ybits++ < Y_STOP); } while (xbits++ < stop); + result = true; } }; diff --git a/libc/test/src/math/exhaustive/log10f_test.cpp b/libc/test/src/math/exhaustive/log10f_test.cpp --- a/libc/test/src/math/exhaustive/log10f_test.cpp +++ b/libc/test/src/math/exhaustive/log10f_test.cpp @@ -17,16 +17,18 @@ namespace mpfr = __llvm_libc::testing::mpfr; struct LlvmLibcLog10fExhaustiveTest : public LlvmLibcExhaustiveTest { - void check(uint32_t start, uint32_t stop, - mpfr::RoundingMode rounding) override { + void check(uint32_t start, uint32_t stop, mpfr::RoundingMode rounding, + bool &result) override { mpfr::ForceRoundingMode r(rounding); uint32_t bits = start; + result = false; do { FPBits xbits(bits); float x = float(xbits); EXPECT_MPFR_MATCH(mpfr::Operation::Log10, x, __llvm_libc::log10f(x), 0.5, rounding); } while (bits++ < stop); + result = true; } }; diff --git a/libc/test/src/math/exhaustive/log1pf_test.cpp b/libc/test/src/math/exhaustive/log1pf_test.cpp --- a/libc/test/src/math/exhaustive/log1pf_test.cpp +++ b/libc/test/src/math/exhaustive/log1pf_test.cpp @@ -17,16 +17,18 @@ namespace mpfr = __llvm_libc::testing::mpfr; struct LlvmLibclog1pfExhaustiveTest : public LlvmLibcExhaustiveTest { - void check(uint32_t start, uint32_t stop, - mpfr::RoundingMode rounding) override { + void check(uint32_t start, uint32_t stop, mpfr::RoundingMode rounding, + bool &result) override { mpfr::ForceRoundingMode r(rounding); uint32_t bits = start; + result = false; do { FPBits xbits(bits); float x = float(xbits); EXPECT_MPFR_MATCH(mpfr::Operation::Log1p, x, __llvm_libc::log1pf(x), 0.5, rounding); } while (bits++ < stop); + result = true; } }; diff --git a/libc/test/src/math/exhaustive/log2f_test.cpp b/libc/test/src/math/exhaustive/log2f_test.cpp --- a/libc/test/src/math/exhaustive/log2f_test.cpp +++ b/libc/test/src/math/exhaustive/log2f_test.cpp @@ -17,16 +17,18 @@ namespace mpfr = __llvm_libc::testing::mpfr; struct LlvmLibcLog2fExhaustiveTest : public LlvmLibcExhaustiveTest { - void check(uint32_t start, uint32_t stop, - mpfr::RoundingMode rounding) override { + void check(uint32_t start, uint32_t stop, mpfr::RoundingMode rounding, + bool &result) override { mpfr::ForceRoundingMode r(rounding); uint32_t bits = start; + result = false; do { FPBits xbits(bits); float x = float(xbits); EXPECT_MPFR_MATCH(mpfr::Operation::Log2, x, __llvm_libc::log2f(x), 0.5, rounding); } while (bits++ < stop); + result = true; } }; diff --git a/libc/test/src/math/exhaustive/logf_test.cpp b/libc/test/src/math/exhaustive/logf_test.cpp --- a/libc/test/src/math/exhaustive/logf_test.cpp +++ b/libc/test/src/math/exhaustive/logf_test.cpp @@ -17,16 +17,18 @@ namespace mpfr = __llvm_libc::testing::mpfr; struct LlvmLibcLogfExhaustiveTest : public LlvmLibcExhaustiveTest { - void check(uint32_t start, uint32_t stop, - mpfr::RoundingMode rounding) override { + void check(uint32_t start, uint32_t stop, mpfr::RoundingMode rounding, + bool &result) override { mpfr::ForceRoundingMode r(rounding); uint32_t bits = start; + result = false; do { FPBits xbits(bits); float x = float(xbits); EXPECT_MPFR_MATCH(mpfr::Operation::Log, x, __llvm_libc::logf(x), 0.5, rounding); } while (bits++ < stop); + result = true; } };