forked from OSchip/llvm-project
Implement more of P0006; Type Traits Variable Templates. <ratio>
llvm-svn: 254285
This commit is contained in:
parent
803a8bb105
commit
4ddfaea773
|
@ -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>();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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>();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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>();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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>();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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>();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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>();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue