Move test into test/std subdirectory.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@224658 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
19
test/std/utilities/ratio/ratio.arithmetic/ratio_add.fail.cpp
Normal file
19
test/std/utilities/ratio/ratio.arithmetic/ratio_add.fail.cpp
Normal file
@@ -0,0 +1,19 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
// test ratio_add
|
||||
|
||||
#include <ratio>
|
||||
|
||||
int main()
|
||||
{
|
||||
typedef std::ratio<0x7FFFFFFFFFFFFFFFLL, 1> R1;
|
||||
typedef std::ratio<1, 1> R2;
|
||||
typedef std::ratio_add<R1, R2>::type R;
|
||||
}
|
76
test/std/utilities/ratio/ratio.arithmetic/ratio_add.pass.cpp
Normal file
76
test/std/utilities/ratio/ratio.arithmetic/ratio_add.pass.cpp
Normal file
@@ -0,0 +1,76 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
// test ratio_add
|
||||
|
||||
#include <ratio>
|
||||
|
||||
int main()
|
||||
{
|
||||
{
|
||||
typedef std::ratio<1, 1> R1;
|
||||
typedef std::ratio<1, 1> R2;
|
||||
typedef std::ratio_add<R1, R2>::type R;
|
||||
static_assert(R::num == 2 && R::den == 1, "");
|
||||
}
|
||||
{
|
||||
typedef std::ratio<1, 2> R1;
|
||||
typedef std::ratio<1, 1> R2;
|
||||
typedef std::ratio_add<R1, R2>::type R;
|
||||
static_assert(R::num == 3 && R::den == 2, "");
|
||||
}
|
||||
{
|
||||
typedef std::ratio<-1, 2> R1;
|
||||
typedef std::ratio<1, 1> R2;
|
||||
typedef std::ratio_add<R1, R2>::type R;
|
||||
static_assert(R::num == 1 && R::den == 2, "");
|
||||
}
|
||||
{
|
||||
typedef std::ratio<1, -2> R1;
|
||||
typedef std::ratio<1, 1> R2;
|
||||
typedef std::ratio_add<R1, R2>::type R;
|
||||
static_assert(R::num == 1 && R::den == 2, "");
|
||||
}
|
||||
{
|
||||
typedef std::ratio<1, 2> R1;
|
||||
typedef std::ratio<-1, 1> R2;
|
||||
typedef std::ratio_add<R1, R2>::type R;
|
||||
static_assert(R::num == -1 && R::den == 2, "");
|
||||
}
|
||||
{
|
||||
typedef std::ratio<1, 2> R1;
|
||||
typedef std::ratio<1, -1> R2;
|
||||
typedef std::ratio_add<R1, R2>::type R;
|
||||
static_assert(R::num == -1 && R::den == 2, "");
|
||||
}
|
||||
{
|
||||
typedef std::ratio<56987354, 467584654> R1;
|
||||
typedef std::ratio<544668, 22145> R2;
|
||||
typedef std::ratio_add<R1, R2>::type R;
|
||||
static_assert(R::num == 127970191639601LL && R::den == 5177331081415LL, "");
|
||||
}
|
||||
{
|
||||
typedef std::ratio<0> R1;
|
||||
typedef std::ratio<0> R2;
|
||||
typedef std::ratio_add<R1, R2>::type R;
|
||||
static_assert(R::num == 0 && R::den == 1, "");
|
||||
}
|
||||
{
|
||||
typedef std::ratio<1> R1;
|
||||
typedef std::ratio<0> R2;
|
||||
typedef std::ratio_add<R1, R2>::type R;
|
||||
static_assert(R::num == 1 && R::den == 1, "");
|
||||
}
|
||||
{
|
||||
typedef std::ratio<0> R1;
|
||||
typedef std::ratio<1> R2;
|
||||
typedef std::ratio_add<R1, R2>::type R;
|
||||
static_assert(R::num == 1 && R::den == 1, "");
|
||||
}
|
||||
}
|
@@ -0,0 +1,19 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
// test ratio_divide
|
||||
|
||||
#include <ratio>
|
||||
|
||||
int main()
|
||||
{
|
||||
typedef std::ratio<0x7FFFFFFFFFFFFFFFLL, 1> R1;
|
||||
typedef std::ratio<1, 2> R2;
|
||||
typedef std::ratio_divide<R1, R2>::type R;
|
||||
}
|
@@ -0,0 +1,58 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
// test ratio_divide
|
||||
|
||||
#include <ratio>
|
||||
|
||||
int main()
|
||||
{
|
||||
{
|
||||
typedef std::ratio<1, 1> R1;
|
||||
typedef std::ratio<1, 1> R2;
|
||||
typedef std::ratio_divide<R1, R2>::type R;
|
||||
static_assert(R::num == 1 && R::den == 1, "");
|
||||
}
|
||||
{
|
||||
typedef std::ratio<1, 2> R1;
|
||||
typedef std::ratio<1, 1> R2;
|
||||
typedef std::ratio_divide<R1, R2>::type R;
|
||||
static_assert(R::num == 1 && R::den == 2, "");
|
||||
}
|
||||
{
|
||||
typedef std::ratio<-1, 2> R1;
|
||||
typedef std::ratio<1, 1> R2;
|
||||
typedef std::ratio_divide<R1, R2>::type R;
|
||||
static_assert(R::num == -1 && R::den == 2, "");
|
||||
}
|
||||
{
|
||||
typedef std::ratio<1, -2> R1;
|
||||
typedef std::ratio<1, 1> R2;
|
||||
typedef std::ratio_divide<R1, R2>::type R;
|
||||
static_assert(R::num == -1 && R::den == 2, "");
|
||||
}
|
||||
{
|
||||
typedef std::ratio<1, 2> R1;
|
||||
typedef std::ratio<-1, 1> R2;
|
||||
typedef std::ratio_divide<R1, R2>::type R;
|
||||
static_assert(R::num == -1 && R::den == 2, "");
|
||||
}
|
||||
{
|
||||
typedef std::ratio<1, 2> R1;
|
||||
typedef std::ratio<1, -1> R2;
|
||||
typedef std::ratio_divide<R1, R2>::type R;
|
||||
static_assert(R::num == -1 && R::den == 2, "");
|
||||
}
|
||||
{
|
||||
typedef std::ratio<56987354, 467584654> R1;
|
||||
typedef std::ratio<544668, 22145> R2;
|
||||
typedef std::ratio_divide<R1, R2>::type R;
|
||||
static_assert(R::num == 630992477165LL && R::den == 127339199162436LL, "");
|
||||
}
|
||||
}
|
@@ -0,0 +1,19 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
// test ratio_multiply
|
||||
|
||||
#include <ratio>
|
||||
|
||||
int main()
|
||||
{
|
||||
typedef std::ratio<0x7FFFFFFFFFFFFFFFLL, 1> R1;
|
||||
typedef std::ratio<2, 1> R2;
|
||||
typedef std::ratio_multiply<R1, R2>::type R;
|
||||
}
|
@@ -0,0 +1,58 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
// test ratio_multiply
|
||||
|
||||
#include <ratio>
|
||||
|
||||
int main()
|
||||
{
|
||||
{
|
||||
typedef std::ratio<1, 1> R1;
|
||||
typedef std::ratio<1, 1> R2;
|
||||
typedef std::ratio_multiply<R1, R2>::type R;
|
||||
static_assert(R::num == 1 && R::den == 1, "");
|
||||
}
|
||||
{
|
||||
typedef std::ratio<1, 2> R1;
|
||||
typedef std::ratio<1, 1> R2;
|
||||
typedef std::ratio_multiply<R1, R2>::type R;
|
||||
static_assert(R::num == 1 && R::den == 2, "");
|
||||
}
|
||||
{
|
||||
typedef std::ratio<-1, 2> R1;
|
||||
typedef std::ratio<1, 1> R2;
|
||||
typedef std::ratio_multiply<R1, R2>::type R;
|
||||
static_assert(R::num == -1 && R::den == 2, "");
|
||||
}
|
||||
{
|
||||
typedef std::ratio<1, -2> R1;
|
||||
typedef std::ratio<1, 1> R2;
|
||||
typedef std::ratio_multiply<R1, R2>::type R;
|
||||
static_assert(R::num == -1 && R::den == 2, "");
|
||||
}
|
||||
{
|
||||
typedef std::ratio<1, 2> R1;
|
||||
typedef std::ratio<-1, 1> R2;
|
||||
typedef std::ratio_multiply<R1, R2>::type R;
|
||||
static_assert(R::num == -1 && R::den == 2, "");
|
||||
}
|
||||
{
|
||||
typedef std::ratio<1, 2> R1;
|
||||
typedef std::ratio<1, -1> R2;
|
||||
typedef std::ratio_multiply<R1, R2>::type R;
|
||||
static_assert(R::num == -1 && R::den == 2, "");
|
||||
}
|
||||
{
|
||||
typedef std::ratio<56987354, 467584654> R1;
|
||||
typedef std::ratio<544668, 22145> R2;
|
||||
typedef std::ratio_multiply<R1, R2>::type R;
|
||||
static_assert(R::num == 15519594064236LL && R::den == 5177331081415LL, "");
|
||||
}
|
||||
}
|
@@ -0,0 +1,19 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
// test ratio_subtract
|
||||
|
||||
#include <ratio>
|
||||
|
||||
int main()
|
||||
{
|
||||
typedef std::ratio<-0x7FFFFFFFFFFFFFFFLL, 1> R1;
|
||||
typedef std::ratio<1, 1> R2;
|
||||
typedef std::ratio_subtract<R1, R2>::type R;
|
||||
}
|
@@ -0,0 +1,76 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
// test ratio_subtract
|
||||
|
||||
#include <ratio>
|
||||
|
||||
int main()
|
||||
{
|
||||
{
|
||||
typedef std::ratio<1, 1> R1;
|
||||
typedef std::ratio<1, 1> R2;
|
||||
typedef std::ratio_subtract<R1, R2>::type R;
|
||||
static_assert(R::num == 0 && R::den == 1, "");
|
||||
}
|
||||
{
|
||||
typedef std::ratio<1, 2> R1;
|
||||
typedef std::ratio<1, 1> R2;
|
||||
typedef std::ratio_subtract<R1, R2>::type R;
|
||||
static_assert(R::num == -1 && R::den == 2, "");
|
||||
}
|
||||
{
|
||||
typedef std::ratio<-1, 2> R1;
|
||||
typedef std::ratio<1, 1> R2;
|
||||
typedef std::ratio_subtract<R1, R2>::type R;
|
||||
static_assert(R::num == -3 && R::den == 2, "");
|
||||
}
|
||||
{
|
||||
typedef std::ratio<1, -2> R1;
|
||||
typedef std::ratio<1, 1> R2;
|
||||
typedef std::ratio_subtract<R1, R2>::type R;
|
||||
static_assert(R::num == -3 && R::den == 2, "");
|
||||
}
|
||||
{
|
||||
typedef std::ratio<1, 2> R1;
|
||||
typedef std::ratio<-1, 1> R2;
|
||||
typedef std::ratio_subtract<R1, R2>::type R;
|
||||
static_assert(R::num == 3 && R::den == 2, "");
|
||||
}
|
||||
{
|
||||
typedef std::ratio<1, 2> R1;
|
||||
typedef std::ratio<1, -1> R2;
|
||||
typedef std::ratio_subtract<R1, R2>::type R;
|
||||
static_assert(R::num == 3 && R::den == 2, "");
|
||||
}
|
||||
{
|
||||
typedef std::ratio<56987354, 467584654> R1;
|
||||
typedef std::ratio<544668, 22145> R2;
|
||||
typedef std::ratio_subtract<R1, R2>::type R;
|
||||
static_assert(R::num == -126708206685271LL && R::den == 5177331081415LL, "");
|
||||
}
|
||||
{
|
||||
typedef std::ratio<0> R1;
|
||||
typedef std::ratio<0> R2;
|
||||
typedef std::ratio_subtract<R1, R2>::type R;
|
||||
static_assert(R::num == 0 && R::den == 1, "");
|
||||
}
|
||||
{
|
||||
typedef std::ratio<1> R1;
|
||||
typedef std::ratio<0> R2;
|
||||
typedef std::ratio_subtract<R1, R2>::type R;
|
||||
static_assert(R::num == 1 && R::den == 1, "");
|
||||
}
|
||||
{
|
||||
typedef std::ratio<0> R1;
|
||||
typedef std::ratio<1> R2;
|
||||
typedef std::ratio_subtract<R1, R2>::type R;
|
||||
static_assert(R::num == -1 && R::den == 1, "");
|
||||
}
|
||||
}
|
@@ -0,0 +1,56 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
// test ratio_equal
|
||||
|
||||
#include <ratio>
|
||||
|
||||
int main()
|
||||
{
|
||||
{
|
||||
typedef std::ratio<1, 1> R1;
|
||||
typedef std::ratio<1, 1> R2;
|
||||
static_assert((std::ratio_equal<R1, R2>::value), "");
|
||||
}
|
||||
{
|
||||
typedef std::ratio<0x7FFFFFFFFFFFFFFFLL, 1> R1;
|
||||
typedef std::ratio<0x7FFFFFFFFFFFFFFFLL, 1> R2;
|
||||
static_assert((std::ratio_equal<R1, R2>::value), "");
|
||||
}
|
||||
{
|
||||
typedef std::ratio<-0x7FFFFFFFFFFFFFFFLL, 1> R1;
|
||||
typedef std::ratio<-0x7FFFFFFFFFFFFFFFLL, 1> R2;
|
||||
static_assert((std::ratio_equal<R1, R2>::value), "");
|
||||
}
|
||||
{
|
||||
typedef std::ratio<1, 0x7FFFFFFFFFFFFFFFLL> R1;
|
||||
typedef std::ratio<1, 0x7FFFFFFFFFFFFFFFLL> R2;
|
||||
static_assert((std::ratio_equal<R1, R2>::value), "");
|
||||
}
|
||||
{
|
||||
typedef std::ratio<1, 1> R1;
|
||||
typedef std::ratio<1, -1> R2;
|
||||
static_assert((!std::ratio_equal<R1, R2>::value), "");
|
||||
}
|
||||
{
|
||||
typedef std::ratio<0x7FFFFFFFFFFFFFFFLL, 1> R1;
|
||||
typedef std::ratio<-0x7FFFFFFFFFFFFFFFLL, 1> R2;
|
||||
static_assert((!std::ratio_equal<R1, R2>::value), "");
|
||||
}
|
||||
{
|
||||
typedef std::ratio<-0x7FFFFFFFFFFFFFFFLL, 1> R1;
|
||||
typedef std::ratio<0x7FFFFFFFFFFFFFFFLL, 1> R2;
|
||||
static_assert((!std::ratio_equal<R1, R2>::value), "");
|
||||
}
|
||||
{
|
||||
typedef std::ratio<1, 0x7FFFFFFFFFFFFFFFLL> R1;
|
||||
typedef std::ratio<1, -0x7FFFFFFFFFFFFFFFLL> R2;
|
||||
static_assert((!std::ratio_equal<R1, R2>::value), "");
|
||||
}
|
||||
}
|
@@ -0,0 +1,56 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
// test ratio_greater
|
||||
|
||||
#include <ratio>
|
||||
|
||||
int main()
|
||||
{
|
||||
{
|
||||
typedef std::ratio<1, 1> R1;
|
||||
typedef std::ratio<1, 1> R2;
|
||||
static_assert((!std::ratio_greater<R1, R2>::value), "");
|
||||
}
|
||||
{
|
||||
typedef std::ratio<0x7FFFFFFFFFFFFFFFLL, 1> R1;
|
||||
typedef std::ratio<0x7FFFFFFFFFFFFFFFLL, 1> R2;
|
||||
static_assert((!std::ratio_greater<R1, R2>::value), "");
|
||||
}
|
||||
{
|
||||
typedef std::ratio<-0x7FFFFFFFFFFFFFFFLL, 1> R1;
|
||||
typedef std::ratio<-0x7FFFFFFFFFFFFFFFLL, 1> R2;
|
||||
static_assert((!std::ratio_greater<R1, R2>::value), "");
|
||||
}
|
||||
{
|
||||
typedef std::ratio<1, 0x7FFFFFFFFFFFFFFFLL> R1;
|
||||
typedef std::ratio<1, 0x7FFFFFFFFFFFFFFFLL> R2;
|
||||
static_assert((!std::ratio_greater<R1, R2>::value), "");
|
||||
}
|
||||
{
|
||||
typedef std::ratio<1, 1> R1;
|
||||
typedef std::ratio<1, -1> R2;
|
||||
static_assert((std::ratio_greater<R1, R2>::value), "");
|
||||
}
|
||||
{
|
||||
typedef std::ratio<0x7FFFFFFFFFFFFFFFLL, 1> R1;
|
||||
typedef std::ratio<-0x7FFFFFFFFFFFFFFFLL, 1> R2;
|
||||
static_assert((std::ratio_greater<R1, R2>::value), "");
|
||||
}
|
||||
{
|
||||
typedef std::ratio<-0x7FFFFFFFFFFFFFFFLL, 1> R1;
|
||||
typedef std::ratio<0x7FFFFFFFFFFFFFFFLL, 1> R2;
|
||||
static_assert((!std::ratio_greater<R1, R2>::value), "");
|
||||
}
|
||||
{
|
||||
typedef std::ratio<1, 0x7FFFFFFFFFFFFFFFLL> R1;
|
||||
typedef std::ratio<1, -0x7FFFFFFFFFFFFFFFLL> R2;
|
||||
static_assert((std::ratio_greater<R1, R2>::value), "");
|
||||
}
|
||||
}
|
@@ -0,0 +1,56 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
// test ratio_greater_equal
|
||||
|
||||
#include <ratio>
|
||||
|
||||
int main()
|
||||
{
|
||||
{
|
||||
typedef std::ratio<1, 1> R1;
|
||||
typedef std::ratio<1, 1> R2;
|
||||
static_assert((std::ratio_greater_equal<R1, R2>::value), "");
|
||||
}
|
||||
{
|
||||
typedef std::ratio<0x7FFFFFFFFFFFFFFFLL, 1> R1;
|
||||
typedef std::ratio<0x7FFFFFFFFFFFFFFFLL, 1> R2;
|
||||
static_assert((std::ratio_greater_equal<R1, R2>::value), "");
|
||||
}
|
||||
{
|
||||
typedef std::ratio<-0x7FFFFFFFFFFFFFFFLL, 1> R1;
|
||||
typedef std::ratio<-0x7FFFFFFFFFFFFFFFLL, 1> R2;
|
||||
static_assert((std::ratio_greater_equal<R1, R2>::value), "");
|
||||
}
|
||||
{
|
||||
typedef std::ratio<1, 0x7FFFFFFFFFFFFFFFLL> R1;
|
||||
typedef std::ratio<1, 0x7FFFFFFFFFFFFFFFLL> R2;
|
||||
static_assert((std::ratio_greater_equal<R1, R2>::value), "");
|
||||
}
|
||||
{
|
||||
typedef std::ratio<1, 1> R1;
|
||||
typedef std::ratio<1, -1> R2;
|
||||
static_assert((std::ratio_greater_equal<R1, R2>::value), "");
|
||||
}
|
||||
{
|
||||
typedef std::ratio<0x7FFFFFFFFFFFFFFFLL, 1> R1;
|
||||
typedef std::ratio<-0x7FFFFFFFFFFFFFFFLL, 1> R2;
|
||||
static_assert((std::ratio_greater_equal<R1, R2>::value), "");
|
||||
}
|
||||
{
|
||||
typedef std::ratio<-0x7FFFFFFFFFFFFFFFLL, 1> R1;
|
||||
typedef std::ratio<0x7FFFFFFFFFFFFFFFLL, 1> R2;
|
||||
static_assert((!std::ratio_greater_equal<R1, R2>::value), "");
|
||||
}
|
||||
{
|
||||
typedef std::ratio<1, 0x7FFFFFFFFFFFFFFFLL> R1;
|
||||
typedef std::ratio<1, -0x7FFFFFFFFFFFFFFFLL> R2;
|
||||
static_assert((std::ratio_greater_equal<R1, R2>::value), "");
|
||||
}
|
||||
}
|
@@ -0,0 +1,86 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
// test ratio_less
|
||||
|
||||
#include <ratio>
|
||||
|
||||
int main()
|
||||
{
|
||||
{
|
||||
typedef std::ratio<1, 1> R1;
|
||||
typedef std::ratio<1, 1> R2;
|
||||
static_assert((!std::ratio_less<R1, R2>::value), "");
|
||||
}
|
||||
{
|
||||
typedef std::ratio<0x7FFFFFFFFFFFFFFFLL, 1> R1;
|
||||
typedef std::ratio<0x7FFFFFFFFFFFFFFFLL, 1> R2;
|
||||
static_assert((!std::ratio_less<R1, R2>::value), "");
|
||||
}
|
||||
{
|
||||
typedef std::ratio<-0x7FFFFFFFFFFFFFFFLL, 1> R1;
|
||||
typedef std::ratio<-0x7FFFFFFFFFFFFFFFLL, 1> R2;
|
||||
static_assert((!std::ratio_less<R1, R2>::value), "");
|
||||
}
|
||||
{
|
||||
typedef std::ratio<1, 0x7FFFFFFFFFFFFFFFLL> R1;
|
||||
typedef std::ratio<1, 0x7FFFFFFFFFFFFFFFLL> R2;
|
||||
static_assert((!std::ratio_less<R1, R2>::value), "");
|
||||
}
|
||||
{
|
||||
typedef std::ratio<1, 1> R1;
|
||||
typedef std::ratio<1, -1> R2;
|
||||
static_assert((!std::ratio_less<R1, R2>::value), "");
|
||||
}
|
||||
{
|
||||
typedef std::ratio<0x7FFFFFFFFFFFFFFFLL, 1> R1;
|
||||
typedef std::ratio<-0x7FFFFFFFFFFFFFFFLL, 1> R2;
|
||||
static_assert((!std::ratio_less<R1, R2>::value), "");
|
||||
}
|
||||
{
|
||||
typedef std::ratio<-0x7FFFFFFFFFFFFFFFLL, 1> R1;
|
||||
typedef std::ratio<0x7FFFFFFFFFFFFFFFLL, 1> R2;
|
||||
static_assert((std::ratio_less<R1, R2>::value), "");
|
||||
}
|
||||
{
|
||||
typedef std::ratio<1, 0x7FFFFFFFFFFFFFFFLL> R1;
|
||||
typedef std::ratio<1, -0x7FFFFFFFFFFFFFFFLL> R2;
|
||||
static_assert((!std::ratio_less<R1, R2>::value), "");
|
||||
}
|
||||
{
|
||||
typedef std::ratio<0x7FFFFFFFFFFFFFFFLL, 0x7FFFFFFFFFFFFFFELL> R1;
|
||||
typedef std::ratio<0x7FFFFFFFFFFFFFFDLL, 0x7FFFFFFFFFFFFFFCLL> R2;
|
||||
static_assert((std::ratio_less<R1, R2>::value), "");
|
||||
}
|
||||
{
|
||||
typedef std::ratio<0x7FFFFFFFFFFFFFFDLL, 0x7FFFFFFFFFFFFFFCLL> R1;
|
||||
typedef std::ratio<0x7FFFFFFFFFFFFFFFLL, 0x7FFFFFFFFFFFFFFELL> R2;
|
||||
static_assert((!std::ratio_less<R1, R2>::value), "");
|
||||
}
|
||||
{
|
||||
typedef std::ratio<-0x7FFFFFFFFFFFFFFDLL, 0x7FFFFFFFFFFFFFFCLL> R1;
|
||||
typedef std::ratio<-0x7FFFFFFFFFFFFFFFLL, 0x7FFFFFFFFFFFFFFELL> R2;
|
||||
static_assert((std::ratio_less<R1, R2>::value), "");
|
||||
}
|
||||
{
|
||||
typedef std::ratio<0x7FFFFFFFFFFFFFFFLL, 0x7FFFFFFFFFFFFFFELL> R1;
|
||||
typedef std::ratio<0x7FFFFFFFFFFFFFFELL, 0x7FFFFFFFFFFFFFFDLL> R2;
|
||||
static_assert((std::ratio_less<R1, R2>::value), "");
|
||||
}
|
||||
{
|
||||
typedef std::ratio<641981, 1339063> R1;
|
||||
typedef std::ratio<1291640, 2694141LL> R2;
|
||||
static_assert((!std::ratio_less<R1, R2>::value), "");
|
||||
}
|
||||
{
|
||||
typedef std::ratio<1291640, 2694141LL> R1;
|
||||
typedef std::ratio<641981, 1339063> R2;
|
||||
static_assert((std::ratio_less<R1, R2>::value), "");
|
||||
}
|
||||
}
|
@@ -0,0 +1,56 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
// test ratio_less_equal
|
||||
|
||||
#include <ratio>
|
||||
|
||||
int main()
|
||||
{
|
||||
{
|
||||
typedef std::ratio<1, 1> R1;
|
||||
typedef std::ratio<1, 1> R2;
|
||||
static_assert((std::ratio_less_equal<R1, R2>::value), "");
|
||||
}
|
||||
{
|
||||
typedef std::ratio<0x7FFFFFFFFFFFFFFFLL, 1> R1;
|
||||
typedef std::ratio<0x7FFFFFFFFFFFFFFFLL, 1> R2;
|
||||
static_assert((std::ratio_less_equal<R1, R2>::value), "");
|
||||
}
|
||||
{
|
||||
typedef std::ratio<-0x7FFFFFFFFFFFFFFFLL, 1> R1;
|
||||
typedef std::ratio<-0x7FFFFFFFFFFFFFFFLL, 1> R2;
|
||||
static_assert((std::ratio_less_equal<R1, R2>::value), "");
|
||||
}
|
||||
{
|
||||
typedef std::ratio<1, 0x7FFFFFFFFFFFFFFFLL> R1;
|
||||
typedef std::ratio<1, 0x7FFFFFFFFFFFFFFFLL> R2;
|
||||
static_assert((std::ratio_less_equal<R1, R2>::value), "");
|
||||
}
|
||||
{
|
||||
typedef std::ratio<1, 1> R1;
|
||||
typedef std::ratio<1, -1> R2;
|
||||
static_assert((!std::ratio_less_equal<R1, R2>::value), "");
|
||||
}
|
||||
{
|
||||
typedef std::ratio<0x7FFFFFFFFFFFFFFFLL, 1> R1;
|
||||
typedef std::ratio<-0x7FFFFFFFFFFFFFFFLL, 1> R2;
|
||||
static_assert((!std::ratio_less_equal<R1, R2>::value), "");
|
||||
}
|
||||
{
|
||||
typedef std::ratio<-0x7FFFFFFFFFFFFFFFLL, 1> R1;
|
||||
typedef std::ratio<0x7FFFFFFFFFFFFFFFLL, 1> R2;
|
||||
static_assert((std::ratio_less_equal<R1, R2>::value), "");
|
||||
}
|
||||
{
|
||||
typedef std::ratio<1, 0x7FFFFFFFFFFFFFFFLL> R1;
|
||||
typedef std::ratio<1, -0x7FFFFFFFFFFFFFFFLL> R2;
|
||||
static_assert((!std::ratio_less_equal<R1, R2>::value), "");
|
||||
}
|
||||
}
|
@@ -0,0 +1,56 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
// test ratio_not_equal
|
||||
|
||||
#include <ratio>
|
||||
|
||||
int main()
|
||||
{
|
||||
{
|
||||
typedef std::ratio<1, 1> R1;
|
||||
typedef std::ratio<1, 1> R2;
|
||||
static_assert((!std::ratio_not_equal<R1, R2>::value), "");
|
||||
}
|
||||
{
|
||||
typedef std::ratio<0x7FFFFFFFFFFFFFFFLL, 1> R1;
|
||||
typedef std::ratio<0x7FFFFFFFFFFFFFFFLL, 1> R2;
|
||||
static_assert((!std::ratio_not_equal<R1, R2>::value), "");
|
||||
}
|
||||
{
|
||||
typedef std::ratio<-0x7FFFFFFFFFFFFFFFLL, 1> R1;
|
||||
typedef std::ratio<-0x7FFFFFFFFFFFFFFFLL, 1> R2;
|
||||
static_assert((!std::ratio_not_equal<R1, R2>::value), "");
|
||||
}
|
||||
{
|
||||
typedef std::ratio<1, 0x7FFFFFFFFFFFFFFFLL> R1;
|
||||
typedef std::ratio<1, 0x7FFFFFFFFFFFFFFFLL> R2;
|
||||
static_assert((!std::ratio_not_equal<R1, R2>::value), "");
|
||||
}
|
||||
{
|
||||
typedef std::ratio<1, 1> R1;
|
||||
typedef std::ratio<1, -1> R2;
|
||||
static_assert((std::ratio_not_equal<R1, R2>::value), "");
|
||||
}
|
||||
{
|
||||
typedef std::ratio<0x7FFFFFFFFFFFFFFFLL, 1> R1;
|
||||
typedef std::ratio<-0x7FFFFFFFFFFFFFFFLL, 1> R2;
|
||||
static_assert((std::ratio_not_equal<R1, R2>::value), "");
|
||||
}
|
||||
{
|
||||
typedef std::ratio<-0x7FFFFFFFFFFFFFFFLL, 1> R1;
|
||||
typedef std::ratio<0x7FFFFFFFFFFFFFFFLL, 1> R2;
|
||||
static_assert((std::ratio_not_equal<R1, R2>::value), "");
|
||||
}
|
||||
{
|
||||
typedef std::ratio<1, 0x7FFFFFFFFFFFFFFFLL> R1;
|
||||
typedef std::ratio<1, -0x7FFFFFFFFFFFFFFFLL> R2;
|
||||
static_assert((std::ratio_not_equal<R1, R2>::value), "");
|
||||
}
|
||||
}
|
44
test/std/utilities/ratio/ratio.ratio/ratio.pass.cpp
Normal file
44
test/std/utilities/ratio/ratio.ratio/ratio.pass.cpp
Normal file
@@ -0,0 +1,44 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
// test ratio: The static data members num and den shall have thcommon
|
||||
// divisor of the absolute values of N and D:
|
||||
|
||||
#include <ratio>
|
||||
|
||||
template <long long N, long long D, long long eN, long long eD>
|
||||
void test()
|
||||
{
|
||||
static_assert((std::ratio<N, D>::num == eN), "");
|
||||
static_assert((std::ratio<N, D>::den == eD), "");
|
||||
}
|
||||
|
||||
int main()
|
||||
{
|
||||
test<1, 1, 1, 1>();
|
||||
test<1, 10, 1, 10>();
|
||||
test<10, 10, 1, 1>();
|
||||
test<10, 1, 10, 1>();
|
||||
test<12, 4, 3, 1>();
|
||||
test<12, -4, -3, 1>();
|
||||
test<-12, 4, -3, 1>();
|
||||
test<-12, -4, 3, 1>();
|
||||
test<4, 12, 1, 3>();
|
||||
test<4, -12, -1, 3>();
|
||||
test<-4, 12, -1, 3>();
|
||||
test<-4, -12, 1, 3>();
|
||||
test<222, 333, 2, 3>();
|
||||
test<222, -333, -2, 3>();
|
||||
test<-222, 333, -2, 3>();
|
||||
test<-222, -333, 2, 3>();
|
||||
test<0x7FFFFFFFFFFFFFFFLL, 127, 72624976668147841LL, 1>();
|
||||
test<-0x7FFFFFFFFFFFFFFFLL, 127, -72624976668147841LL, 1>();
|
||||
test<0x7FFFFFFFFFFFFFFFLL, -127, -72624976668147841LL, 1>();
|
||||
test<-0x7FFFFFFFFFFFFFFFLL, -127, 72624976668147841LL, 1>();
|
||||
}
|
18
test/std/utilities/ratio/ratio.ratio/ratio1.fail.cpp
Normal file
18
test/std/utilities/ratio/ratio.ratio/ratio1.fail.cpp
Normal file
@@ -0,0 +1,18 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
// test ratio: The template argument D shall not be zero
|
||||
|
||||
#include <ratio>
|
||||
#include <cstdint>
|
||||
|
||||
int main()
|
||||
{
|
||||
const std::intmax_t t1 = std::ratio<1, 0>::num;
|
||||
}
|
19
test/std/utilities/ratio/ratio.ratio/ratio2.fail.cpp
Normal file
19
test/std/utilities/ratio/ratio.ratio/ratio2.fail.cpp
Normal file
@@ -0,0 +1,19 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
// test ratio: the absolute values of the template arguments N and D
|
||||
// shall be representable by type intmax_t.
|
||||
|
||||
#include <ratio>
|
||||
#include <cstdint>
|
||||
|
||||
int main()
|
||||
{
|
||||
const std::intmax_t t1 = std::ratio<0x8000000000000000ULL, 1>::num;
|
||||
}
|
19
test/std/utilities/ratio/ratio.ratio/ratio3.fail.cpp
Normal file
19
test/std/utilities/ratio/ratio.ratio/ratio3.fail.cpp
Normal file
@@ -0,0 +1,19 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
// test ratio: the absolute values of the template arguments N and D
|
||||
// shall be representable by type intmax_t.
|
||||
|
||||
#include <ratio>
|
||||
#include <cstdint>
|
||||
|
||||
int main()
|
||||
{
|
||||
const std::intmax_t t1 = std::ratio<1, 0x8000000000000000ULL>::num;
|
||||
}
|
12
test/std/utilities/ratio/ratio.si/nothing_to_do.pass.cpp
Normal file
12
test/std/utilities/ratio/ratio.si/nothing_to_do.pass.cpp
Normal file
@@ -0,0 +1,12 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
int main()
|
||||
{
|
||||
}
|
32
test/std/utilities/ratio/typedefs.pass.cpp
Normal file
32
test/std/utilities/ratio/typedefs.pass.cpp
Normal file
@@ -0,0 +1,32 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
// test ratio typedef's
|
||||
|
||||
#include <ratio>
|
||||
|
||||
int main()
|
||||
{
|
||||
static_assert(std::atto::num == 1 && std::atto::den == 1000000000000000000ULL, "");
|
||||
static_assert(std::femto::num == 1 && std::femto::den == 1000000000000000ULL, "");
|
||||
static_assert(std::pico::num == 1 && std::pico::den == 1000000000000ULL, "");
|
||||
static_assert(std::nano::num == 1 && std::nano::den == 1000000000ULL, "");
|
||||
static_assert(std::micro::num == 1 && std::micro::den == 1000000ULL, "");
|
||||
static_assert(std::milli::num == 1 && std::milli::den == 1000ULL, "");
|
||||
static_assert(std::centi::num == 1 && std::centi::den == 100ULL, "");
|
||||
static_assert(std::deci::num == 1 && std::deci::den == 10ULL, "");
|
||||
static_assert(std::deca::num == 10ULL && std::deca::den == 1, "");
|
||||
static_assert(std::hecto::num == 100ULL && std::hecto::den == 1, "");
|
||||
static_assert(std::kilo::num == 1000ULL && std::kilo::den == 1, "");
|
||||
static_assert(std::mega::num == 1000000ULL && std::mega::den == 1, "");
|
||||
static_assert(std::giga::num == 1000000000ULL && std::giga::den == 1, "");
|
||||
static_assert(std::tera::num == 1000000000000ULL && std::tera::den == 1, "");
|
||||
static_assert(std::peta::num == 1000000000000000ULL && std::peta::den == 1, "");
|
||||
static_assert(std::exa::num == 1000000000000000000ULL && std::exa::den == 1, "");
|
||||
}
|
20
test/std/utilities/ratio/version.pass.cpp
Normal file
20
test/std/utilities/ratio/version.pass.cpp
Normal file
@@ -0,0 +1,20 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
// <ratio>
|
||||
|
||||
#include <ratio>
|
||||
|
||||
#ifndef _LIBCPP_VERSION
|
||||
#error _LIBCPP_VERSION not defined
|
||||
#endif
|
||||
|
||||
int main()
|
||||
{
|
||||
}
|
Reference in New Issue
Block a user