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:
56
test/std/numerics/rand/rand.eng/rand.eng.sub/assign.pass.cpp
Normal file
56
test/std/numerics/rand/rand.eng/rand.eng.sub/assign.pass.cpp
Normal file
@@ -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.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
// <random>
|
||||
|
||||
// template<class UIntType, size_t w, size_t s, size_t r>
|
||||
// class subtract_with_carry_engine;
|
||||
|
||||
// subtract_with_carry_engine& operator=(const subtract_with_carry_engine&);
|
||||
|
||||
#include <random>
|
||||
#include <cassert>
|
||||
|
||||
void
|
||||
test1()
|
||||
{
|
||||
typedef std::ranlux24_base E;
|
||||
E e1(2);
|
||||
e1();
|
||||
E e2(5);
|
||||
e2 = e1;
|
||||
assert(e1 == e2);
|
||||
assert(e1() == e2());
|
||||
E::result_type k = e1();
|
||||
assert(e1 != e2);
|
||||
assert(e2() == k);
|
||||
assert(e1 == e2);
|
||||
}
|
||||
|
||||
void
|
||||
test2()
|
||||
{
|
||||
typedef std::ranlux48_base E;
|
||||
E e1(3);
|
||||
e1();
|
||||
E e2(5);
|
||||
e2 = e1;
|
||||
assert(e1 == e2);
|
||||
assert(e1() == e2());
|
||||
E::result_type k = e1();
|
||||
assert(e1 != e2);
|
||||
assert(e2() == k);
|
||||
assert(e1 == e2);
|
||||
}
|
||||
|
||||
int main()
|
||||
{
|
||||
test1();
|
||||
test2();
|
||||
}
|
54
test/std/numerics/rand/rand.eng/rand.eng.sub/copy.pass.cpp
Normal file
54
test/std/numerics/rand/rand.eng/rand.eng.sub/copy.pass.cpp
Normal file
@@ -0,0 +1,54 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// 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.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
// <random>
|
||||
|
||||
// template<class UIntType, size_t w, size_t s, size_t r>
|
||||
// class subtract_with_carry_engine;
|
||||
|
||||
// subtract_with_carry_engine(const subtract_with_carry_engine&);
|
||||
|
||||
#include <random>
|
||||
#include <cassert>
|
||||
|
||||
void
|
||||
test1()
|
||||
{
|
||||
typedef std::ranlux24_base E;
|
||||
E e1;
|
||||
e1();
|
||||
E e2 = e1;
|
||||
assert(e1 == e2);
|
||||
assert(e1() == e2());
|
||||
E::result_type k = e1();
|
||||
assert(e1 != e2);
|
||||
assert(e2() == k);
|
||||
assert(e1 == e2);
|
||||
}
|
||||
|
||||
void
|
||||
test2()
|
||||
{
|
||||
typedef std::ranlux48_base E;
|
||||
E e1;
|
||||
e1();
|
||||
E e2(e1);
|
||||
assert(e1 == e2);
|
||||
assert(e1() == e2());
|
||||
E::result_type k = e1();
|
||||
assert(e1 != e2);
|
||||
assert(e2() == k);
|
||||
assert(e1 == e2);
|
||||
}
|
||||
|
||||
int main()
|
||||
{
|
||||
test1();
|
||||
test2();
|
||||
}
|
@@ -0,0 +1,51 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// 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.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
// <random>
|
||||
|
||||
// template<class UIntType, size_t w, size_t s, size_t r>
|
||||
// class subtract_with_carry_engine;
|
||||
|
||||
// explicit subtract_with_carry_engine(result_type s = default_seed);
|
||||
|
||||
#include <random>
|
||||
#include <sstream>
|
||||
#include <cassert>
|
||||
|
||||
void
|
||||
test1()
|
||||
{
|
||||
const char* a = "15136306 8587749 2346244 16479026 15515802 9510553 "
|
||||
"16090340 14501685 13839944 10789678 11581259 9590790 5840316 5953700 "
|
||||
"13398366 8134459 16629731 6851902 15583892 1317475 4231148 9092691 "
|
||||
"5707268 2355175 0";
|
||||
std::ranlux24_base e1(0);
|
||||
std::ostringstream os;
|
||||
os << e1;
|
||||
assert(os.str() == a);
|
||||
}
|
||||
|
||||
void
|
||||
test2()
|
||||
{
|
||||
const char* a = "10880375256626 126660097854724 33643165434010 "
|
||||
"78293780235492 179418984296008 96783156950859 238199764491708 "
|
||||
"34339434557790 155299155394531 29014415493780 209265474179052 "
|
||||
"263777435457028 0";
|
||||
std::ranlux48_base e1(0);
|
||||
std::ostringstream os;
|
||||
os << e1;
|
||||
assert(os.str() == a);
|
||||
}
|
||||
|
||||
int main()
|
||||
{
|
||||
test1();
|
||||
test2();
|
||||
}
|
@@ -0,0 +1,55 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// 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.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
// <random>
|
||||
|
||||
// template<class UIntType, size_t w, size_t s, size_t r>
|
||||
// class subtract_with_carry_engine;
|
||||
|
||||
// template<class Sseq> explicit subtract_with_carry_engine(Sseq& q);
|
||||
|
||||
#include <random>
|
||||
#include <sstream>
|
||||
#include <cassert>
|
||||
|
||||
void
|
||||
test1()
|
||||
{
|
||||
const char* a = "13604817 711567 9760686 13278398 3323440 175548 5553651 "
|
||||
"3028863 10748297 2216688 275779 14778841 14438394 9483441 4229545 "
|
||||
"14657301 12636508 15978210 1653340 1718567 9272421 14302862 7940348 "
|
||||
"889045 0";
|
||||
unsigned as[] = {3, 5, 7};
|
||||
std::seed_seq sseq(as, as+3);
|
||||
std::ranlux24_base e1(sseq);
|
||||
std::ostringstream os;
|
||||
os << e1;
|
||||
assert(os.str() == a);
|
||||
}
|
||||
|
||||
void
|
||||
test2()
|
||||
{
|
||||
const char* a = "241408498702289 172342669275054 191026374555184 "
|
||||
"61020585639411 231929771458953 142769679250755 198672786411514 "
|
||||
"183712717244841 227473912549724 62843577252444 68782400568421 "
|
||||
"159248704678140 0";
|
||||
unsigned as[] = {3, 5, 7};
|
||||
std::seed_seq sseq(as, as+3);
|
||||
std::ranlux48_base e1(sseq);
|
||||
std::ostringstream os;
|
||||
os << e1;
|
||||
assert(os.str() == a);
|
||||
}
|
||||
|
||||
int main()
|
||||
{
|
||||
test1();
|
||||
test2();
|
||||
}
|
@@ -0,0 +1,42 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// 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.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
// <random>
|
||||
|
||||
// template<class UIntType, size_t w, size_t s, size_t r>
|
||||
// class subtract_with_carry_engine;
|
||||
|
||||
// explicit subtract_with_carry_engine();
|
||||
|
||||
#include <random>
|
||||
#include <cassert>
|
||||
|
||||
void
|
||||
test1()
|
||||
{
|
||||
std::ranlux24_base e1;
|
||||
std::ranlux24_base e2(std::ranlux24_base::default_seed);
|
||||
assert(e1 == e2);
|
||||
assert(e1() == 15039276);
|
||||
}
|
||||
|
||||
void
|
||||
test2()
|
||||
{
|
||||
std::ranlux48_base e1;
|
||||
std::ranlux48_base e2(std::ranlux48_base::default_seed);
|
||||
assert(e1 == e2);
|
||||
assert(e1() == 23459059301164ull);
|
||||
}
|
||||
|
||||
int main()
|
||||
{
|
||||
test1();
|
||||
test2();
|
||||
}
|
@@ -0,0 +1,52 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// 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.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
// <random>
|
||||
|
||||
// template<class UIntType, size_t w, size_t s, size_t r>
|
||||
// class subtract_with_carry_engine;
|
||||
|
||||
// void discard(unsigned long long z);
|
||||
|
||||
#include <random>
|
||||
#include <cassert>
|
||||
|
||||
void
|
||||
test1()
|
||||
{
|
||||
std::ranlux24_base e1;
|
||||
std::ranlux24_base e2 = e1;
|
||||
assert(e1 == e2);
|
||||
e1.discard(3);
|
||||
assert(e1 != e2);
|
||||
e2();
|
||||
e2();
|
||||
e2();
|
||||
assert(e1 == e2);
|
||||
}
|
||||
|
||||
void
|
||||
test2()
|
||||
{
|
||||
std::ranlux48_base e1;
|
||||
std::ranlux48_base e2 = e1;
|
||||
assert(e1 == e2);
|
||||
e1.discard(3);
|
||||
assert(e1 != e2);
|
||||
e2();
|
||||
e2();
|
||||
e2();
|
||||
assert(e1 == e2);
|
||||
}
|
||||
|
||||
int main()
|
||||
{
|
||||
test1();
|
||||
test2();
|
||||
}
|
42
test/std/numerics/rand/rand.eng/rand.eng.sub/eval.pass.cpp
Normal file
42
test/std/numerics/rand/rand.eng/rand.eng.sub/eval.pass.cpp
Normal file
@@ -0,0 +1,42 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// 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.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
// <random>
|
||||
|
||||
// template<class UIntType, size_t w, size_t s, size_t r>
|
||||
// class subtract_with_carry_engine;
|
||||
|
||||
// result_type operator()();
|
||||
|
||||
#include <random>
|
||||
#include <cassert>
|
||||
|
||||
void
|
||||
test1()
|
||||
{
|
||||
std::ranlux24_base e;
|
||||
assert(e() == 15039276u);
|
||||
assert(e() == 16323925u);
|
||||
assert(e() == 14283486u);
|
||||
}
|
||||
|
||||
void
|
||||
test2()
|
||||
{
|
||||
std::ranlux48_base e;
|
||||
assert(e() == 23459059301164ull);
|
||||
assert(e() == 28639057539807ull);
|
||||
assert(e() == 276846226770426ull);
|
||||
}
|
||||
|
||||
int main()
|
||||
{
|
||||
test1();
|
||||
test2();
|
||||
}
|
63
test/std/numerics/rand/rand.eng/rand.eng.sub/io.pass.cpp
Normal file
63
test/std/numerics/rand/rand.eng/rand.eng.sub/io.pass.cpp
Normal file
@@ -0,0 +1,63 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// 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.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
// <random>
|
||||
|
||||
// template<class UIntType, size_t w, size_t s, size_t r>
|
||||
// class subtract_with_carry_engine;
|
||||
|
||||
// template <class charT, class traits,
|
||||
// class UIntType, size_t w, size_t s, size_t r>
|
||||
// basic_ostream<charT, traits>&
|
||||
// operator<<(basic_ostream<charT, traits>& os,
|
||||
// const subtract_with_carry_engine<UIntType, w, s, r>& x);
|
||||
//
|
||||
// template <class charT, class traits,
|
||||
// class UIntType, size_t w, size_t s, size_t r>
|
||||
// basic_istream<charT, traits>&
|
||||
// operator>>(basic_istream<charT, traits>& is,
|
||||
// subtract_with_carry_engine<UIntType, w, s, r>& x);
|
||||
|
||||
#include <random>
|
||||
#include <sstream>
|
||||
#include <cassert>
|
||||
|
||||
void
|
||||
test1()
|
||||
{
|
||||
typedef std::ranlux24_base E;
|
||||
E e1;
|
||||
e1.discard(100);
|
||||
std::ostringstream os;
|
||||
os << e1;
|
||||
std::istringstream is(os.str());
|
||||
E e2;
|
||||
is >> e2;
|
||||
assert(e1 == e2);
|
||||
}
|
||||
|
||||
void
|
||||
test2()
|
||||
{
|
||||
typedef std::ranlux48_base E;
|
||||
E e1;
|
||||
e1.discard(100);
|
||||
std::ostringstream os;
|
||||
os << e1;
|
||||
std::istringstream is(os.str());
|
||||
E e2;
|
||||
is >> e2;
|
||||
assert(e1 == e2);
|
||||
}
|
||||
|
||||
int main()
|
||||
{
|
||||
test1();
|
||||
test2();
|
||||
}
|
@@ -0,0 +1,42 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// 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.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
// <random>
|
||||
|
||||
// template<class UIntType, size_t w, size_t s, size_t r>
|
||||
// class subtract_with_carry_engine
|
||||
// {
|
||||
// public:
|
||||
// // types
|
||||
// typedef UIntType result_type;
|
||||
|
||||
#include <random>
|
||||
#include <type_traits>
|
||||
|
||||
void
|
||||
test1()
|
||||
{
|
||||
static_assert((std::is_same<
|
||||
std::ranlux24_base::result_type,
|
||||
std::uint_fast32_t>::value), "");
|
||||
}
|
||||
|
||||
void
|
||||
test2()
|
||||
{
|
||||
static_assert((std::is_same<
|
||||
std::ranlux48_base::result_type,
|
||||
std::uint_fast64_t>::value), "");
|
||||
}
|
||||
|
||||
int main()
|
||||
{
|
||||
test1();
|
||||
test2();
|
||||
}
|
@@ -0,0 +1,50 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// 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.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
// <random>
|
||||
|
||||
// template<class UIntType, size_t w, size_t s, size_t r>
|
||||
// class subtract_with_carry_engine;
|
||||
|
||||
// void seed(result_type s = default_seed);
|
||||
|
||||
#include <random>
|
||||
#include <cassert>
|
||||
|
||||
void
|
||||
test1()
|
||||
{
|
||||
for (int s = 0; s < 20; ++s)
|
||||
{
|
||||
typedef std::ranlux24_base E;
|
||||
E e1(s);
|
||||
E e2;
|
||||
e2.seed(s);
|
||||
assert(e1 == e2);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
test2()
|
||||
{
|
||||
for (int s = 0; s < 20; ++s)
|
||||
{
|
||||
typedef std::ranlux48_base E;
|
||||
E e1(s);
|
||||
E e2;
|
||||
e2.seed(s);
|
||||
assert(e1 == e2);
|
||||
}
|
||||
}
|
||||
|
||||
int main()
|
||||
{
|
||||
test1();
|
||||
test2();
|
||||
}
|
@@ -0,0 +1,48 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// 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.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
// <random>
|
||||
|
||||
// template<class UIntType, size_t w, size_t s, size_t r>
|
||||
// class subtract_with_carry_engine;
|
||||
|
||||
// template<class Sseq> void seed(Sseq& q);
|
||||
|
||||
#include <random>
|
||||
#include <cassert>
|
||||
|
||||
void
|
||||
test1()
|
||||
{
|
||||
unsigned a[] = {3, 5, 7};
|
||||
std::seed_seq sseq(a, a+3);
|
||||
std::ranlux24_base e1;
|
||||
std::ranlux24_base e2(sseq);
|
||||
assert(e1 != e2);
|
||||
e1.seed(sseq);
|
||||
assert(e1 == e2);
|
||||
}
|
||||
|
||||
void
|
||||
test2()
|
||||
{
|
||||
unsigned a[] = {3, 5, 7};
|
||||
std::seed_seq sseq(a, a+3);
|
||||
std::ranlux48_base e1;
|
||||
std::ranlux48_base e2(sseq);
|
||||
assert(e1 != e2);
|
||||
e1.seed(sseq);
|
||||
assert(e1 == e2);
|
||||
}
|
||||
|
||||
int main()
|
||||
{
|
||||
test1();
|
||||
test2();
|
||||
}
|
70
test/std/numerics/rand/rand.eng/rand.eng.sub/values.pass.cpp
Normal file
70
test/std/numerics/rand/rand.eng/rand.eng.sub/values.pass.cpp
Normal file
@@ -0,0 +1,70 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// 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.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
// <random>
|
||||
|
||||
// template<class UIntType, size_t w, size_t s, size_t r>
|
||||
// class subtract_with_carry_engine
|
||||
// {
|
||||
// public:
|
||||
// // types
|
||||
// typedef UIntType result_type;
|
||||
//
|
||||
// // engine characteristics
|
||||
// static constexpr size_t word_size = w;
|
||||
// static constexpr size_t short_lag = s;
|
||||
// static constexpr size_t long_lag = r;
|
||||
// static constexpr result_type min() { return 0; }
|
||||
// static constexpr result_type max() { return m-1; }
|
||||
// static constexpr result_type default_seed = 19780503u;
|
||||
|
||||
#include <random>
|
||||
#include <type_traits>
|
||||
#include <cassert>
|
||||
|
||||
template <class _Tp>
|
||||
void where(const _Tp &) {}
|
||||
|
||||
void
|
||||
test1()
|
||||
{
|
||||
typedef std::ranlux24_base E;
|
||||
static_assert((E::word_size == 24), "");
|
||||
static_assert((E::short_lag == 10), "");
|
||||
static_assert((E::long_lag == 24), "");
|
||||
/*static_*/assert((E::min() == 0)/*, ""*/);
|
||||
/*static_*/assert((E::max() == 0xFFFFFF)/*, ""*/);
|
||||
static_assert((E::default_seed == 19780503u), "");
|
||||
where(E::word_size);
|
||||
where(E::short_lag);
|
||||
where(E::long_lag);
|
||||
where(E::default_seed);
|
||||
}
|
||||
|
||||
void
|
||||
test2()
|
||||
{
|
||||
typedef std::ranlux48_base E;
|
||||
static_assert((E::word_size == 48), "");
|
||||
static_assert((E::short_lag == 5), "");
|
||||
static_assert((E::long_lag == 12), "");
|
||||
/*static_*/assert((E::min() == 0)/*, ""*/);
|
||||
/*static_*/assert((E::max() == 0xFFFFFFFFFFFFull)/*, ""*/);
|
||||
static_assert((E::default_seed == 19780503u), "");
|
||||
where(E::word_size);
|
||||
where(E::short_lag);
|
||||
where(E::long_lag);
|
||||
where(E::default_seed);
|
||||
}
|
||||
|
||||
int main()
|
||||
{
|
||||
test1();
|
||||
test2();
|
||||
}
|
Reference in New Issue
Block a user