From 4ddfaea7732ea6bee32c615d9bf1dc27d07b4e7a Mon Sep 17 00:00:00 2001 From: Marshall Clow Date: Mon, 30 Nov 2015 05:04:22 +0000 Subject: [PATCH] Implement more of P0006; Type Traits Variable Templates. llvm-svn: 254285 --- .../ratio.comparison/ratio_equal.pass.cpp | 27 +++++++++---- .../ratio.comparison/ratio_greater.pass.cpp | 27 +++++++++---- .../ratio_greater_equal.pass.cpp | 27 +++++++++---- .../ratio.comparison/ratio_less.pass.cpp | 39 ++++++++++++------- .../ratio_less_equal.pass.cpp | 27 +++++++++---- .../ratio.comparison/ratio_not_equal.pass.cpp | 27 +++++++++---- 6 files changed, 120 insertions(+), 54 deletions(-) diff --git a/libcxx/test/std/utilities/ratio/ratio.comparison/ratio_equal.pass.cpp b/libcxx/test/std/utilities/ratio/ratio.comparison/ratio_equal.pass.cpp index 78027f7e48b8..9331b7094f48 100644 --- a/libcxx/test/std/utilities/ratio/ratio.comparison/ratio_equal.pass.cpp +++ b/libcxx/test/std/utilities/ratio/ratio.comparison/ratio_equal.pass.cpp @@ -11,46 +11,57 @@ #include +#include "test_macros.h" + +template +void test() +{ + static_assert((result == std::ratio_equal::value), ""); +#if TEST_STD_VER > 14 + static_assert((result == std::ratio_equal_v), ""); +#endif +} + int main() { { typedef std::ratio<1, 1> R1; typedef std::ratio<1, 1> R2; - static_assert((std::ratio_equal::value), ""); + test(); } { typedef std::ratio<0x7FFFFFFFFFFFFFFFLL, 1> R1; typedef std::ratio<0x7FFFFFFFFFFFFFFFLL, 1> R2; - static_assert((std::ratio_equal::value), ""); + test(); } { typedef std::ratio<-0x7FFFFFFFFFFFFFFFLL, 1> R1; typedef std::ratio<-0x7FFFFFFFFFFFFFFFLL, 1> R2; - static_assert((std::ratio_equal::value), ""); + test(); } { typedef std::ratio<1, 0x7FFFFFFFFFFFFFFFLL> R1; typedef std::ratio<1, 0x7FFFFFFFFFFFFFFFLL> R2; - static_assert((std::ratio_equal::value), ""); + test(); } { typedef std::ratio<1, 1> R1; typedef std::ratio<1, -1> R2; - static_assert((!std::ratio_equal::value), ""); + test(); } { typedef std::ratio<0x7FFFFFFFFFFFFFFFLL, 1> R1; typedef std::ratio<-0x7FFFFFFFFFFFFFFFLL, 1> R2; - static_assert((!std::ratio_equal::value), ""); + test(); } { typedef std::ratio<-0x7FFFFFFFFFFFFFFFLL, 1> R1; typedef std::ratio<0x7FFFFFFFFFFFFFFFLL, 1> R2; - static_assert((!std::ratio_equal::value), ""); + test(); } { typedef std::ratio<1, 0x7FFFFFFFFFFFFFFFLL> R1; typedef std::ratio<1, -0x7FFFFFFFFFFFFFFFLL> R2; - static_assert((!std::ratio_equal::value), ""); + test(); } } diff --git a/libcxx/test/std/utilities/ratio/ratio.comparison/ratio_greater.pass.cpp b/libcxx/test/std/utilities/ratio/ratio.comparison/ratio_greater.pass.cpp index 9182a9ec503c..7f7a74068299 100644 --- a/libcxx/test/std/utilities/ratio/ratio.comparison/ratio_greater.pass.cpp +++ b/libcxx/test/std/utilities/ratio/ratio.comparison/ratio_greater.pass.cpp @@ -11,46 +11,57 @@ #include +#include "test_macros.h" + +template +void test() +{ + static_assert((result == std::ratio_greater::value), ""); +#if TEST_STD_VER > 14 + static_assert((result == std::ratio_greater_v), ""); +#endif +} + int main() { { typedef std::ratio<1, 1> R1; typedef std::ratio<1, 1> R2; - static_assert((!std::ratio_greater::value), ""); + test(); } { typedef std::ratio<0x7FFFFFFFFFFFFFFFLL, 1> R1; typedef std::ratio<0x7FFFFFFFFFFFFFFFLL, 1> R2; - static_assert((!std::ratio_greater::value), ""); + test(); } { typedef std::ratio<-0x7FFFFFFFFFFFFFFFLL, 1> R1; typedef std::ratio<-0x7FFFFFFFFFFFFFFFLL, 1> R2; - static_assert((!std::ratio_greater::value), ""); + test(); } { typedef std::ratio<1, 0x7FFFFFFFFFFFFFFFLL> R1; typedef std::ratio<1, 0x7FFFFFFFFFFFFFFFLL> R2; - static_assert((!std::ratio_greater::value), ""); + test(); } { typedef std::ratio<1, 1> R1; typedef std::ratio<1, -1> R2; - static_assert((std::ratio_greater::value), ""); + test(); } { typedef std::ratio<0x7FFFFFFFFFFFFFFFLL, 1> R1; typedef std::ratio<-0x7FFFFFFFFFFFFFFFLL, 1> R2; - static_assert((std::ratio_greater::value), ""); + test(); } { typedef std::ratio<-0x7FFFFFFFFFFFFFFFLL, 1> R1; typedef std::ratio<0x7FFFFFFFFFFFFFFFLL, 1> R2; - static_assert((!std::ratio_greater::value), ""); + test(); } { typedef std::ratio<1, 0x7FFFFFFFFFFFFFFFLL> R1; typedef std::ratio<1, -0x7FFFFFFFFFFFFFFFLL> R2; - static_assert((std::ratio_greater::value), ""); + test(); } } diff --git a/libcxx/test/std/utilities/ratio/ratio.comparison/ratio_greater_equal.pass.cpp b/libcxx/test/std/utilities/ratio/ratio.comparison/ratio_greater_equal.pass.cpp index a1f5a185e621..db78557ec4c1 100644 --- a/libcxx/test/std/utilities/ratio/ratio.comparison/ratio_greater_equal.pass.cpp +++ b/libcxx/test/std/utilities/ratio/ratio.comparison/ratio_greater_equal.pass.cpp @@ -11,46 +11,57 @@ #include +#include "test_macros.h" + +template +void test() +{ + static_assert((result == std::ratio_greater_equal::value), ""); +#if TEST_STD_VER > 14 + static_assert((result == std::ratio_greater_equal_v), ""); +#endif +} + int main() { { typedef std::ratio<1, 1> R1; typedef std::ratio<1, 1> R2; - static_assert((std::ratio_greater_equal::value), ""); + test(); } { typedef std::ratio<0x7FFFFFFFFFFFFFFFLL, 1> R1; typedef std::ratio<0x7FFFFFFFFFFFFFFFLL, 1> R2; - static_assert((std::ratio_greater_equal::value), ""); + test(); } { typedef std::ratio<-0x7FFFFFFFFFFFFFFFLL, 1> R1; typedef std::ratio<-0x7FFFFFFFFFFFFFFFLL, 1> R2; - static_assert((std::ratio_greater_equal::value), ""); + test(); } { typedef std::ratio<1, 0x7FFFFFFFFFFFFFFFLL> R1; typedef std::ratio<1, 0x7FFFFFFFFFFFFFFFLL> R2; - static_assert((std::ratio_greater_equal::value), ""); + test(); } { typedef std::ratio<1, 1> R1; typedef std::ratio<1, -1> R2; - static_assert((std::ratio_greater_equal::value), ""); + test(); } { typedef std::ratio<0x7FFFFFFFFFFFFFFFLL, 1> R1; typedef std::ratio<-0x7FFFFFFFFFFFFFFFLL, 1> R2; - static_assert((std::ratio_greater_equal::value), ""); + test(); } { typedef std::ratio<-0x7FFFFFFFFFFFFFFFLL, 1> R1; typedef std::ratio<0x7FFFFFFFFFFFFFFFLL, 1> R2; - static_assert((!std::ratio_greater_equal::value), ""); + test(); } { typedef std::ratio<1, 0x7FFFFFFFFFFFFFFFLL> R1; typedef std::ratio<1, -0x7FFFFFFFFFFFFFFFLL> R2; - static_assert((std::ratio_greater_equal::value), ""); + test(); } } diff --git a/libcxx/test/std/utilities/ratio/ratio.comparison/ratio_less.pass.cpp b/libcxx/test/std/utilities/ratio/ratio.comparison/ratio_less.pass.cpp index db53ab0ad448..a428be28aa56 100644 --- a/libcxx/test/std/utilities/ratio/ratio.comparison/ratio_less.pass.cpp +++ b/libcxx/test/std/utilities/ratio/ratio.comparison/ratio_less.pass.cpp @@ -11,76 +11,87 @@ #include +#include "test_macros.h" + +template +void test() +{ + static_assert((result == std::ratio_less::value), ""); +#if TEST_STD_VER > 14 + static_assert((result == std::ratio_less_v), ""); +#endif +} + int main() { { typedef std::ratio<1, 1> R1; typedef std::ratio<1, 1> R2; - static_assert((!std::ratio_less::value), ""); + test(); } { typedef std::ratio<0x7FFFFFFFFFFFFFFFLL, 1> R1; typedef std::ratio<0x7FFFFFFFFFFFFFFFLL, 1> R2; - static_assert((!std::ratio_less::value), ""); + test(); } { typedef std::ratio<-0x7FFFFFFFFFFFFFFFLL, 1> R1; typedef std::ratio<-0x7FFFFFFFFFFFFFFFLL, 1> R2; - static_assert((!std::ratio_less::value), ""); + test(); } { typedef std::ratio<1, 0x7FFFFFFFFFFFFFFFLL> R1; typedef std::ratio<1, 0x7FFFFFFFFFFFFFFFLL> R2; - static_assert((!std::ratio_less::value), ""); + test(); } { typedef std::ratio<1, 1> R1; typedef std::ratio<1, -1> R2; - static_assert((!std::ratio_less::value), ""); + test(); } { typedef std::ratio<0x7FFFFFFFFFFFFFFFLL, 1> R1; typedef std::ratio<-0x7FFFFFFFFFFFFFFFLL, 1> R2; - static_assert((!std::ratio_less::value), ""); + test(); } { typedef std::ratio<-0x7FFFFFFFFFFFFFFFLL, 1> R1; typedef std::ratio<0x7FFFFFFFFFFFFFFFLL, 1> R2; - static_assert((std::ratio_less::value), ""); + test(); } { typedef std::ratio<1, 0x7FFFFFFFFFFFFFFFLL> R1; typedef std::ratio<1, -0x7FFFFFFFFFFFFFFFLL> R2; - static_assert((!std::ratio_less::value), ""); + test(); } { typedef std::ratio<0x7FFFFFFFFFFFFFFFLL, 0x7FFFFFFFFFFFFFFELL> R1; typedef std::ratio<0x7FFFFFFFFFFFFFFDLL, 0x7FFFFFFFFFFFFFFCLL> R2; - static_assert((std::ratio_less::value), ""); + test(); } { typedef std::ratio<0x7FFFFFFFFFFFFFFDLL, 0x7FFFFFFFFFFFFFFCLL> R1; typedef std::ratio<0x7FFFFFFFFFFFFFFFLL, 0x7FFFFFFFFFFFFFFELL> R2; - static_assert((!std::ratio_less::value), ""); + test(); } { typedef std::ratio<-0x7FFFFFFFFFFFFFFDLL, 0x7FFFFFFFFFFFFFFCLL> R1; typedef std::ratio<-0x7FFFFFFFFFFFFFFFLL, 0x7FFFFFFFFFFFFFFELL> R2; - static_assert((std::ratio_less::value), ""); + test(); } { typedef std::ratio<0x7FFFFFFFFFFFFFFFLL, 0x7FFFFFFFFFFFFFFELL> R1; typedef std::ratio<0x7FFFFFFFFFFFFFFELL, 0x7FFFFFFFFFFFFFFDLL> R2; - static_assert((std::ratio_less::value), ""); + test(); } { typedef std::ratio<641981, 1339063> R1; typedef std::ratio<1291640, 2694141LL> R2; - static_assert((!std::ratio_less::value), ""); + test(); } { typedef std::ratio<1291640, 2694141LL> R1; typedef std::ratio<641981, 1339063> R2; - static_assert((std::ratio_less::value), ""); + test(); } } diff --git a/libcxx/test/std/utilities/ratio/ratio.comparison/ratio_less_equal.pass.cpp b/libcxx/test/std/utilities/ratio/ratio.comparison/ratio_less_equal.pass.cpp index 5b148f0e1435..7b224ab7c892 100644 --- a/libcxx/test/std/utilities/ratio/ratio.comparison/ratio_less_equal.pass.cpp +++ b/libcxx/test/std/utilities/ratio/ratio.comparison/ratio_less_equal.pass.cpp @@ -11,46 +11,57 @@ #include +#include "test_macros.h" + +template +void test() +{ + static_assert((result == std::ratio_less_equal::value), ""); +#if TEST_STD_VER > 14 + static_assert((result == std::ratio_less_equal_v), ""); +#endif +} + int main() { { typedef std::ratio<1, 1> R1; typedef std::ratio<1, 1> R2; - static_assert((std::ratio_less_equal::value), ""); + test(); } { typedef std::ratio<0x7FFFFFFFFFFFFFFFLL, 1> R1; typedef std::ratio<0x7FFFFFFFFFFFFFFFLL, 1> R2; - static_assert((std::ratio_less_equal::value), ""); + test(); } { typedef std::ratio<-0x7FFFFFFFFFFFFFFFLL, 1> R1; typedef std::ratio<-0x7FFFFFFFFFFFFFFFLL, 1> R2; - static_assert((std::ratio_less_equal::value), ""); + test(); } { typedef std::ratio<1, 0x7FFFFFFFFFFFFFFFLL> R1; typedef std::ratio<1, 0x7FFFFFFFFFFFFFFFLL> R2; - static_assert((std::ratio_less_equal::value), ""); + test(); } { typedef std::ratio<1, 1> R1; typedef std::ratio<1, -1> R2; - static_assert((!std::ratio_less_equal::value), ""); + test(); } { typedef std::ratio<0x7FFFFFFFFFFFFFFFLL, 1> R1; typedef std::ratio<-0x7FFFFFFFFFFFFFFFLL, 1> R2; - static_assert((!std::ratio_less_equal::value), ""); + test(); } { typedef std::ratio<-0x7FFFFFFFFFFFFFFFLL, 1> R1; typedef std::ratio<0x7FFFFFFFFFFFFFFFLL, 1> R2; - static_assert((std::ratio_less_equal::value), ""); + test(); } { typedef std::ratio<1, 0x7FFFFFFFFFFFFFFFLL> R1; typedef std::ratio<1, -0x7FFFFFFFFFFFFFFFLL> R2; - static_assert((!std::ratio_less_equal::value), ""); + test(); } } diff --git a/libcxx/test/std/utilities/ratio/ratio.comparison/ratio_not_equal.pass.cpp b/libcxx/test/std/utilities/ratio/ratio.comparison/ratio_not_equal.pass.cpp index ebf930746585..fcd31207fdbf 100644 --- a/libcxx/test/std/utilities/ratio/ratio.comparison/ratio_not_equal.pass.cpp +++ b/libcxx/test/std/utilities/ratio/ratio.comparison/ratio_not_equal.pass.cpp @@ -11,46 +11,57 @@ #include +#include "test_macros.h" + +template +void test() +{ + static_assert((result == std::ratio_not_equal::value), ""); +#if TEST_STD_VER > 14 + static_assert((result == std::ratio_not_equal_v), ""); +#endif +} + int main() { { typedef std::ratio<1, 1> R1; typedef std::ratio<1, 1> R2; - static_assert((!std::ratio_not_equal::value), ""); + test(); } { typedef std::ratio<0x7FFFFFFFFFFFFFFFLL, 1> R1; typedef std::ratio<0x7FFFFFFFFFFFFFFFLL, 1> R2; - static_assert((!std::ratio_not_equal::value), ""); + test(); } { typedef std::ratio<-0x7FFFFFFFFFFFFFFFLL, 1> R1; typedef std::ratio<-0x7FFFFFFFFFFFFFFFLL, 1> R2; - static_assert((!std::ratio_not_equal::value), ""); + test(); } { typedef std::ratio<1, 0x7FFFFFFFFFFFFFFFLL> R1; typedef std::ratio<1, 0x7FFFFFFFFFFFFFFFLL> R2; - static_assert((!std::ratio_not_equal::value), ""); + test(); } { typedef std::ratio<1, 1> R1; typedef std::ratio<1, -1> R2; - static_assert((std::ratio_not_equal::value), ""); + test(); } { typedef std::ratio<0x7FFFFFFFFFFFFFFFLL, 1> R1; typedef std::ratio<-0x7FFFFFFFFFFFFFFFLL, 1> R2; - static_assert((std::ratio_not_equal::value), ""); + test(); } { typedef std::ratio<-0x7FFFFFFFFFFFFFFFLL, 1> R1; typedef std::ratio<0x7FFFFFFFFFFFFFFFLL, 1> R2; - static_assert((std::ratio_not_equal::value), ""); + test(); } { typedef std::ratio<1, 0x7FFFFFFFFFFFFFFFLL> R1; typedef std::ratio<1, -0x7FFFFFFFFFFFFFFFLL> R2; - static_assert((std::ratio_not_equal::value), ""); + test(); } }