A new test matcher class MPFRMatcher is added along with helper macros
EXPECT|ASSERT_MPFR_MATCH.
New type traits classes RemoveCV and IsFloatingPointType have been
added and used to implement the above class and its helpers.
Paths
| Differential D79256
[libc] Improve information printed on failure of a math test which uses MPFR. ClosedPublic Authored by sivachandra on May 1 2020, 12:30 PM.
Details Summary A new test matcher class MPFRMatcher is added along with helper macros New type traits classes RemoveCV and IsFloatingPointType have been
Diff Detail
Event TimelineComment Actions Remove the long double instantiation. sivachandra added a child revision: D79278: [libc] Fix how math results are compared with MPFR results..May 1 2020, 5:29 PM Comment Actions I don't want to make any suggestions yet because I don't fully understand why we need a MPFR_TEST. Would you mind clarifying the need for TEST_WITH_BASE_CLASS? Instead of MPFR_TEST could we have TEST_EXTENSION's first argument take a class with compare, would that simplify it? I'm by no means a gtest expert, I'm not sure how someone would use gtest to fill these kinds of needs. Maybe they would make their own macros which end up calling FAIL or using matchers. We aren't limited to that though so perhaps these would end up being more complicated than this solution.
Comment Actions
Huh! I totally missed that we have matchers now with which we can do the exact same thing as in this patch. Will change it to use the matcher API and update soon. sivachandra marked 3 inline comments as done. Comment Actions
This revision is now accepted and ready to land.May 4 2020, 10:42 PM Closed by commit rGd69cbd826a8f: [libc] Improve information printed on failure of a math test which uses MPFR. (authored by sivachandra). · Explain WhyMay 5 2020, 10:47 AM This revision was automatically updated to reflect the committed changes.
Revision Contents
Diff 261944 libc/test/src/math/cosf_test.cpp
libc/test/src/math/sincosf_test.cpp
libc/test/src/math/sinf_test.cpp
libc/utils/CPP/TypeTraits.h
libc/utils/MPFRWrapper/CMakeLists.txt
libc/utils/MPFRWrapper/MPFRUtils.h
libc/utils/MPFRWrapper/MPFRUtils.cpp
libc/utils/testutils/StreamWrapper.cpp
|
type -> Type
On that note, we could make an analog to std::type_identity and make this
template <typename T> struct RemoveCV : TypeIdentity<T> {};. No strong preference though.