As I've been plowing through the <chrono> stuff, I found myself writing tests to make sure that the comparisons for a bunch of different types are "sane".
So I factored them out into something that can be used over and over.
Differential D49773
Add new file test/support/test_comparisons.h mclow.lists on Jul 24 2018, 7:00 PM. Authored by
Details
Diff Detail Event TimelineComment Actions Usage looks like this: AssertComparisons6AreNoexcept<month>(); AssertComparisons6ReturnBool<month>(); static_assert(testComparisons6Values<month>( 5U, 5U), ""); static_assert(testComparisons6Values<month>( 5U, 10U), ""); Comment Actions Some of this stuff is marked constexpr despite it requiring C++14 constexpr semantics. Can they be non-constexpr in C++11 and still function? Or should the header explicitly require C++14 to be included? Comment Actions Otherwise, I'm quite happy with this patch. The only downside I see is if testComparisons6 fails, it will report the source of the failure as being in the header, and not provide information about the callee. |