diff options
Diffstat (limited to 'test/std/utilities/ratio/ratio.comparison/ratio_less_equal.pass.cpp')
| -rw-r--r-- | test/std/utilities/ratio/ratio.comparison/ratio_less_equal.pass.cpp | 27 |
1 files changed, 19 insertions, 8 deletions
diff --git a/test/std/utilities/ratio/ratio.comparison/ratio_less_equal.pass.cpp b/test/std/utilities/ratio/ratio.comparison/ratio_less_equal.pass.cpp index 5b148f0e1435..7b224ab7c892 100644 --- a/test/std/utilities/ratio/ratio.comparison/ratio_less_equal.pass.cpp +++ b/test/std/utilities/ratio/ratio.comparison/ratio_less_equal.pass.cpp @@ -11,46 +11,57 @@ #include <ratio> +#include "test_macros.h" + +template <class Rat1, class Rat2, bool result> +void test() +{ + static_assert((result == std::ratio_less_equal<Rat1, Rat2>::value), ""); +#if TEST_STD_VER > 14 + static_assert((result == std::ratio_less_equal_v<Rat1, Rat2>), ""); +#endif +} + int main() { { typedef std::ratio<1, 1> R1; typedef std::ratio<1, 1> R2; - static_assert((std::ratio_less_equal<R1, R2>::value), ""); + test<R1, R2, true>(); } { typedef std::ratio<0x7FFFFFFFFFFFFFFFLL, 1> R1; typedef std::ratio<0x7FFFFFFFFFFFFFFFLL, 1> R2; - static_assert((std::ratio_less_equal<R1, R2>::value), ""); + test<R1, R2, true>(); } { typedef std::ratio<-0x7FFFFFFFFFFFFFFFLL, 1> R1; typedef std::ratio<-0x7FFFFFFFFFFFFFFFLL, 1> R2; - static_assert((std::ratio_less_equal<R1, R2>::value), ""); + test<R1, R2, true>(); } { typedef std::ratio<1, 0x7FFFFFFFFFFFFFFFLL> R1; typedef std::ratio<1, 0x7FFFFFFFFFFFFFFFLL> R2; - static_assert((std::ratio_less_equal<R1, R2>::value), ""); + test<R1, R2, true>(); } { typedef std::ratio<1, 1> R1; typedef std::ratio<1, -1> R2; - static_assert((!std::ratio_less_equal<R1, R2>::value), ""); + test<R1, R2, false>(); } { typedef std::ratio<0x7FFFFFFFFFFFFFFFLL, 1> R1; typedef std::ratio<-0x7FFFFFFFFFFFFFFFLL, 1> R2; - static_assert((!std::ratio_less_equal<R1, R2>::value), ""); + test<R1, R2, false>(); } { typedef std::ratio<-0x7FFFFFFFFFFFFFFFLL, 1> R1; typedef std::ratio<0x7FFFFFFFFFFFFFFFLL, 1> R2; - static_assert((std::ratio_less_equal<R1, R2>::value), ""); + test<R1, R2, true>(); } { typedef std::ratio<1, 0x7FFFFFFFFFFFFFFFLL> R1; typedef std::ratio<1, -0x7FFFFFFFFFFFFFFFLL> R2; - static_assert((!std::ratio_less_equal<R1, R2>::value), ""); + test<R1, R2, false>(); } } |
