[libc-commits] [PATCH] D153682: [libc][math] Clean up exhaustive tests implementations.
Siva Chandra via Phabricator via libc-commits
libc-commits at lists.llvm.org
Sun Jun 25 23:01:11 PDT 2023
sivachandra added inline comments.
================
Comment at: libc/test/src/math/exhaustive/exhaustive_test.h:35
+
+template <typename Op>
struct LlvmLibcExhaustiveTest : public __llvm_libc::testing::Test {
----------------
Can this be more specific like:
```
template <typename FloatType>
using FuncType = FloatType(FloatType);
template <typename FloatType, __llvm_libc::testing::mpfr::Operation Op, FuncType<FloatType> Func>
struct LlvmLibcExhaustiveMathTest ... {
...
static constexpr FuncType<FloatType> *FUNC = Func;
uint64_t check(...) {
bool correct = TEST_MPFR_MATCH_ROUNDING_SILENTLY(Op, x, FUNC(x), 0.5, rounding);
}
...
}
```
For `erff`, you can do:
```
using LlvmLibcErffExhaustiveTest : publicLlvmLibcExhaustiveTest<float, mpfr::Operation::ErfOp, __llvm_libc::erff>;
```
================
Comment at: libc/test/src/math/exhaustive/exhaustive_test.h:44
+ // Check in a range, return the number of failures.
+ virtual uint64_t check(UIntType start, UIntType stop,
+ mpfr::RoundingMode rounding) {
----------------
Why is this `virtual`?
================
Comment at: libc/test/src/math/exhaustive/exhaustive_test.h:55
+ bool correct = TEST_MPFR_MATCH_ROUNDING_SILENTLY(
+ Op::Operation, x, Op::func(x), 0.5, rounding);
+ failed += (!correct);
----------------
Do we tolerate errors?
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D153682/new/
https://reviews.llvm.org/D153682
More information about the libc-commits
mailing list