[libcxx] r254285 - Implement more of P0006; Type Traits Variable Templates. <ratio>
Marshall Clow via cfe-commits
cfe-commits at lists.llvm.org
Sun Nov 29 21:04:23 PST 2015
Author: marshall
Date: Sun Nov 29 23:04:22 2015
New Revision: 254285
URL: http://llvm.org/viewvc/llvm-project?rev=254285&view=rev
Log:
Implement more of P0006; Type Traits Variable Templates. <ratio>
Modified:
libcxx/trunk/test/std/utilities/ratio/ratio.comparison/ratio_equal.pass.cpp
libcxx/trunk/test/std/utilities/ratio/ratio.comparison/ratio_greater.pass.cpp
libcxx/trunk/test/std/utilities/ratio/ratio.comparison/ratio_greater_equal.pass.cpp
libcxx/trunk/test/std/utilities/ratio/ratio.comparison/ratio_less.pass.cpp
libcxx/trunk/test/std/utilities/ratio/ratio.comparison/ratio_less_equal.pass.cpp
libcxx/trunk/test/std/utilities/ratio/ratio.comparison/ratio_not_equal.pass.cpp
Modified: libcxx/trunk/test/std/utilities/ratio/ratio.comparison/ratio_equal.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/utilities/ratio/ratio.comparison/ratio_equal.pass.cpp?rev=254285&r1=254284&r2=254285&view=diff
==============================================================================
--- libcxx/trunk/test/std/utilities/ratio/ratio.comparison/ratio_equal.pass.cpp (original)
+++ libcxx/trunk/test/std/utilities/ratio/ratio.comparison/ratio_equal.pass.cpp Sun Nov 29 23:04:22 2015
@@ -11,46 +11,57 @@
#include <ratio>
+#include "test_macros.h"
+
+template <class Rat1, class Rat2, bool result>
+void test()
+{
+ static_assert((result == std::ratio_equal<Rat1, Rat2>::value), "");
+#if TEST_STD_VER > 14
+ static_assert((result == std::ratio_equal_v<Rat1, Rat2>), "");
+#endif
+}
+
int main()
{
{
typedef std::ratio<1, 1> R1;
typedef std::ratio<1, 1> R2;
- static_assert((std::ratio_equal<R1, R2>::value), "");
+ test<R1, R2, true>();
}
{
typedef std::ratio<0x7FFFFFFFFFFFFFFFLL, 1> R1;
typedef std::ratio<0x7FFFFFFFFFFFFFFFLL, 1> R2;
- static_assert((std::ratio_equal<R1, R2>::value), "");
+ test<R1, R2, true>();
}
{
typedef std::ratio<-0x7FFFFFFFFFFFFFFFLL, 1> R1;
typedef std::ratio<-0x7FFFFFFFFFFFFFFFLL, 1> R2;
- static_assert((std::ratio_equal<R1, R2>::value), "");
+ test<R1, R2, true>();
}
{
typedef std::ratio<1, 0x7FFFFFFFFFFFFFFFLL> R1;
typedef std::ratio<1, 0x7FFFFFFFFFFFFFFFLL> R2;
- static_assert((std::ratio_equal<R1, R2>::value), "");
+ test<R1, R2, true>();
}
{
typedef std::ratio<1, 1> R1;
typedef std::ratio<1, -1> R2;
- static_assert((!std::ratio_equal<R1, R2>::value), "");
+ test<R1, R2, false>();
}
{
typedef std::ratio<0x7FFFFFFFFFFFFFFFLL, 1> R1;
typedef std::ratio<-0x7FFFFFFFFFFFFFFFLL, 1> R2;
- static_assert((!std::ratio_equal<R1, R2>::value), "");
+ test<R1, R2, false>();
}
{
typedef std::ratio<-0x7FFFFFFFFFFFFFFFLL, 1> R1;
typedef std::ratio<0x7FFFFFFFFFFFFFFFLL, 1> R2;
- static_assert((!std::ratio_equal<R1, R2>::value), "");
+ test<R1, R2, false>();
}
{
typedef std::ratio<1, 0x7FFFFFFFFFFFFFFFLL> R1;
typedef std::ratio<1, -0x7FFFFFFFFFFFFFFFLL> R2;
- static_assert((!std::ratio_equal<R1, R2>::value), "");
+ test<R1, R2, false>();
}
}
Modified: libcxx/trunk/test/std/utilities/ratio/ratio.comparison/ratio_greater.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/utilities/ratio/ratio.comparison/ratio_greater.pass.cpp?rev=254285&r1=254284&r2=254285&view=diff
==============================================================================
--- libcxx/trunk/test/std/utilities/ratio/ratio.comparison/ratio_greater.pass.cpp (original)
+++ libcxx/trunk/test/std/utilities/ratio/ratio.comparison/ratio_greater.pass.cpp Sun Nov 29 23:04:22 2015
@@ -11,46 +11,57 @@
#include <ratio>
+#include "test_macros.h"
+
+template <class Rat1, class Rat2, bool result>
+void test()
+{
+ static_assert((result == std::ratio_greater<Rat1, Rat2>::value), "");
+#if TEST_STD_VER > 14
+ static_assert((result == std::ratio_greater_v<Rat1, Rat2>), "");
+#endif
+}
+
int main()
{
{
typedef std::ratio<1, 1> R1;
typedef std::ratio<1, 1> R2;
- static_assert((!std::ratio_greater<R1, R2>::value), "");
+ test<R1, R2, false>();
}
{
typedef std::ratio<0x7FFFFFFFFFFFFFFFLL, 1> R1;
typedef std::ratio<0x7FFFFFFFFFFFFFFFLL, 1> R2;
- static_assert((!std::ratio_greater<R1, R2>::value), "");
+ test<R1, R2, false>();
}
{
typedef std::ratio<-0x7FFFFFFFFFFFFFFFLL, 1> R1;
typedef std::ratio<-0x7FFFFFFFFFFFFFFFLL, 1> R2;
- static_assert((!std::ratio_greater<R1, R2>::value), "");
+ test<R1, R2, false>();
}
{
typedef std::ratio<1, 0x7FFFFFFFFFFFFFFFLL> R1;
typedef std::ratio<1, 0x7FFFFFFFFFFFFFFFLL> R2;
- static_assert((!std::ratio_greater<R1, R2>::value), "");
+ test<R1, R2, false>();
}
{
typedef std::ratio<1, 1> R1;
typedef std::ratio<1, -1> R2;
- static_assert((std::ratio_greater<R1, R2>::value), "");
+ test<R1, R2, true>();
}
{
typedef std::ratio<0x7FFFFFFFFFFFFFFFLL, 1> R1;
typedef std::ratio<-0x7FFFFFFFFFFFFFFFLL, 1> R2;
- static_assert((std::ratio_greater<R1, R2>::value), "");
+ test<R1, R2, true>();
}
{
typedef std::ratio<-0x7FFFFFFFFFFFFFFFLL, 1> R1;
typedef std::ratio<0x7FFFFFFFFFFFFFFFLL, 1> R2;
- static_assert((!std::ratio_greater<R1, R2>::value), "");
+ test<R1, R2, false>();
}
{
typedef std::ratio<1, 0x7FFFFFFFFFFFFFFFLL> R1;
typedef std::ratio<1, -0x7FFFFFFFFFFFFFFFLL> R2;
- static_assert((std::ratio_greater<R1, R2>::value), "");
+ test<R1, R2, true>();
}
}
Modified: libcxx/trunk/test/std/utilities/ratio/ratio.comparison/ratio_greater_equal.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/utilities/ratio/ratio.comparison/ratio_greater_equal.pass.cpp?rev=254285&r1=254284&r2=254285&view=diff
==============================================================================
--- libcxx/trunk/test/std/utilities/ratio/ratio.comparison/ratio_greater_equal.pass.cpp (original)
+++ libcxx/trunk/test/std/utilities/ratio/ratio.comparison/ratio_greater_equal.pass.cpp Sun Nov 29 23:04:22 2015
@@ -11,46 +11,57 @@
#include <ratio>
+#include "test_macros.h"
+
+template <class Rat1, class Rat2, bool result>
+void test()
+{
+ static_assert((result == std::ratio_greater_equal<Rat1, Rat2>::value), "");
+#if TEST_STD_VER > 14
+ static_assert((result == std::ratio_greater_equal_v<Rat1, Rat2>), "");
+#endif
+}
+
int main()
{
{
typedef std::ratio<1, 1> R1;
typedef std::ratio<1, 1> R2;
- static_assert((std::ratio_greater_equal<R1, R2>::value), "");
+ test<R1, R2, true>();
}
{
typedef std::ratio<0x7FFFFFFFFFFFFFFFLL, 1> R1;
typedef std::ratio<0x7FFFFFFFFFFFFFFFLL, 1> R2;
- static_assert((std::ratio_greater_equal<R1, R2>::value), "");
+ test<R1, R2, true>();
}
{
typedef std::ratio<-0x7FFFFFFFFFFFFFFFLL, 1> R1;
typedef std::ratio<-0x7FFFFFFFFFFFFFFFLL, 1> R2;
- static_assert((std::ratio_greater_equal<R1, R2>::value), "");
+ test<R1, R2, true>();
}
{
typedef std::ratio<1, 0x7FFFFFFFFFFFFFFFLL> R1;
typedef std::ratio<1, 0x7FFFFFFFFFFFFFFFLL> R2;
- static_assert((std::ratio_greater_equal<R1, R2>::value), "");
+ test<R1, R2, true>();
}
{
typedef std::ratio<1, 1> R1;
typedef std::ratio<1, -1> R2;
- static_assert((std::ratio_greater_equal<R1, R2>::value), "");
+ test<R1, R2, true>();
}
{
typedef std::ratio<0x7FFFFFFFFFFFFFFFLL, 1> R1;
typedef std::ratio<-0x7FFFFFFFFFFFFFFFLL, 1> R2;
- static_assert((std::ratio_greater_equal<R1, R2>::value), "");
+ test<R1, R2, true>();
}
{
typedef std::ratio<-0x7FFFFFFFFFFFFFFFLL, 1> R1;
typedef std::ratio<0x7FFFFFFFFFFFFFFFLL, 1> R2;
- static_assert((!std::ratio_greater_equal<R1, R2>::value), "");
+ test<R1, R2, false>();
}
{
typedef std::ratio<1, 0x7FFFFFFFFFFFFFFFLL> R1;
typedef std::ratio<1, -0x7FFFFFFFFFFFFFFFLL> R2;
- static_assert((std::ratio_greater_equal<R1, R2>::value), "");
+ test<R1, R2, true>();
}
}
Modified: libcxx/trunk/test/std/utilities/ratio/ratio.comparison/ratio_less.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/utilities/ratio/ratio.comparison/ratio_less.pass.cpp?rev=254285&r1=254284&r2=254285&view=diff
==============================================================================
--- libcxx/trunk/test/std/utilities/ratio/ratio.comparison/ratio_less.pass.cpp (original)
+++ libcxx/trunk/test/std/utilities/ratio/ratio.comparison/ratio_less.pass.cpp Sun Nov 29 23:04:22 2015
@@ -11,76 +11,87 @@
#include <ratio>
+#include "test_macros.h"
+
+template <class Rat1, class Rat2, bool result>
+void test()
+{
+ static_assert((result == std::ratio_less<Rat1, Rat2>::value), "");
+#if TEST_STD_VER > 14
+ static_assert((result == std::ratio_less_v<Rat1, Rat2>), "");
+#endif
+}
+
int main()
{
{
typedef std::ratio<1, 1> R1;
typedef std::ratio<1, 1> R2;
- static_assert((!std::ratio_less<R1, R2>::value), "");
+ test<R1, R2, false>();
}
{
typedef std::ratio<0x7FFFFFFFFFFFFFFFLL, 1> R1;
typedef std::ratio<0x7FFFFFFFFFFFFFFFLL, 1> R2;
- static_assert((!std::ratio_less<R1, R2>::value), "");
+ test<R1, R2, false>();
}
{
typedef std::ratio<-0x7FFFFFFFFFFFFFFFLL, 1> R1;
typedef std::ratio<-0x7FFFFFFFFFFFFFFFLL, 1> R2;
- static_assert((!std::ratio_less<R1, R2>::value), "");
+ test<R1, R2, false>();
}
{
typedef std::ratio<1, 0x7FFFFFFFFFFFFFFFLL> R1;
typedef std::ratio<1, 0x7FFFFFFFFFFFFFFFLL> R2;
- static_assert((!std::ratio_less<R1, R2>::value), "");
+ test<R1, R2, false>();
}
{
typedef std::ratio<1, 1> R1;
typedef std::ratio<1, -1> R2;
- static_assert((!std::ratio_less<R1, R2>::value), "");
+ test<R1, R2, false>();
}
{
typedef std::ratio<0x7FFFFFFFFFFFFFFFLL, 1> R1;
typedef std::ratio<-0x7FFFFFFFFFFFFFFFLL, 1> R2;
- static_assert((!std::ratio_less<R1, R2>::value), "");
+ test<R1, R2, false>();
}
{
typedef std::ratio<-0x7FFFFFFFFFFFFFFFLL, 1> R1;
typedef std::ratio<0x7FFFFFFFFFFFFFFFLL, 1> R2;
- static_assert((std::ratio_less<R1, R2>::value), "");
+ test<R1, R2, true>();
}
{
typedef std::ratio<1, 0x7FFFFFFFFFFFFFFFLL> R1;
typedef std::ratio<1, -0x7FFFFFFFFFFFFFFFLL> R2;
- static_assert((!std::ratio_less<R1, R2>::value), "");
+ test<R1, R2, false>();
}
{
typedef std::ratio<0x7FFFFFFFFFFFFFFFLL, 0x7FFFFFFFFFFFFFFELL> R1;
typedef std::ratio<0x7FFFFFFFFFFFFFFDLL, 0x7FFFFFFFFFFFFFFCLL> R2;
- static_assert((std::ratio_less<R1, R2>::value), "");
+ test<R1, R2, true>();
}
{
typedef std::ratio<0x7FFFFFFFFFFFFFFDLL, 0x7FFFFFFFFFFFFFFCLL> R1;
typedef std::ratio<0x7FFFFFFFFFFFFFFFLL, 0x7FFFFFFFFFFFFFFELL> R2;
- static_assert((!std::ratio_less<R1, R2>::value), "");
+ test<R1, R2, false>();
}
{
typedef std::ratio<-0x7FFFFFFFFFFFFFFDLL, 0x7FFFFFFFFFFFFFFCLL> R1;
typedef std::ratio<-0x7FFFFFFFFFFFFFFFLL, 0x7FFFFFFFFFFFFFFELL> R2;
- static_assert((std::ratio_less<R1, R2>::value), "");
+ test<R1, R2, true>();
}
{
typedef std::ratio<0x7FFFFFFFFFFFFFFFLL, 0x7FFFFFFFFFFFFFFELL> R1;
typedef std::ratio<0x7FFFFFFFFFFFFFFELL, 0x7FFFFFFFFFFFFFFDLL> R2;
- static_assert((std::ratio_less<R1, R2>::value), "");
+ test<R1, R2, true>();
}
{
typedef std::ratio<641981, 1339063> R1;
typedef std::ratio<1291640, 2694141LL> R2;
- static_assert((!std::ratio_less<R1, R2>::value), "");
+ test<R1, R2, false>();
}
{
typedef std::ratio<1291640, 2694141LL> R1;
typedef std::ratio<641981, 1339063> R2;
- static_assert((std::ratio_less<R1, R2>::value), "");
+ test<R1, R2, true>();
}
}
Modified: libcxx/trunk/test/std/utilities/ratio/ratio.comparison/ratio_less_equal.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/utilities/ratio/ratio.comparison/ratio_less_equal.pass.cpp?rev=254285&r1=254284&r2=254285&view=diff
==============================================================================
--- libcxx/trunk/test/std/utilities/ratio/ratio.comparison/ratio_less_equal.pass.cpp (original)
+++ libcxx/trunk/test/std/utilities/ratio/ratio.comparison/ratio_less_equal.pass.cpp Sun Nov 29 23:04:22 2015
@@ -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>();
}
}
Modified: libcxx/trunk/test/std/utilities/ratio/ratio.comparison/ratio_not_equal.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/utilities/ratio/ratio.comparison/ratio_not_equal.pass.cpp?rev=254285&r1=254284&r2=254285&view=diff
==============================================================================
--- libcxx/trunk/test/std/utilities/ratio/ratio.comparison/ratio_not_equal.pass.cpp (original)
+++ libcxx/trunk/test/std/utilities/ratio/ratio.comparison/ratio_not_equal.pass.cpp Sun Nov 29 23:04:22 2015
@@ -11,46 +11,57 @@
#include <ratio>
+#include "test_macros.h"
+
+template <class Rat1, class Rat2, bool result>
+void test()
+{
+ static_assert((result == std::ratio_not_equal<Rat1, Rat2>::value), "");
+#if TEST_STD_VER > 14
+ static_assert((result == std::ratio_not_equal_v<Rat1, Rat2>), "");
+#endif
+}
+
int main()
{
{
typedef std::ratio<1, 1> R1;
typedef std::ratio<1, 1> R2;
- static_assert((!std::ratio_not_equal<R1, R2>::value), "");
+ test<R1, R2, false>();
}
{
typedef std::ratio<0x7FFFFFFFFFFFFFFFLL, 1> R1;
typedef std::ratio<0x7FFFFFFFFFFFFFFFLL, 1> R2;
- static_assert((!std::ratio_not_equal<R1, R2>::value), "");
+ test<R1, R2, false>();
}
{
typedef std::ratio<-0x7FFFFFFFFFFFFFFFLL, 1> R1;
typedef std::ratio<-0x7FFFFFFFFFFFFFFFLL, 1> R2;
- static_assert((!std::ratio_not_equal<R1, R2>::value), "");
+ test<R1, R2, false>();
}
{
typedef std::ratio<1, 0x7FFFFFFFFFFFFFFFLL> R1;
typedef std::ratio<1, 0x7FFFFFFFFFFFFFFFLL> R2;
- static_assert((!std::ratio_not_equal<R1, R2>::value), "");
+ test<R1, R2, false>();
}
{
typedef std::ratio<1, 1> R1;
typedef std::ratio<1, -1> R2;
- static_assert((std::ratio_not_equal<R1, R2>::value), "");
+ test<R1, R2, true>();
}
{
typedef std::ratio<0x7FFFFFFFFFFFFFFFLL, 1> R1;
typedef std::ratio<-0x7FFFFFFFFFFFFFFFLL, 1> R2;
- static_assert((std::ratio_not_equal<R1, R2>::value), "");
+ test<R1, R2, true>();
}
{
typedef std::ratio<-0x7FFFFFFFFFFFFFFFLL, 1> R1;
typedef std::ratio<0x7FFFFFFFFFFFFFFFLL, 1> R2;
- static_assert((std::ratio_not_equal<R1, R2>::value), "");
+ test<R1, R2, true>();
}
{
typedef std::ratio<1, 0x7FFFFFFFFFFFFFFFLL> R1;
typedef std::ratio<1, -0x7FFFFFFFFFFFFFFFLL> R2;
- static_assert((std::ratio_not_equal<R1, R2>::value), "");
+ test<R1, R2, true>();
}
}
More information about the cfe-commits
mailing list