diff options
author | Dimitry Andric <dim@FreeBSD.org> | 2015-09-06 18:46:46 +0000 |
---|---|---|
committer | Dimitry Andric <dim@FreeBSD.org> | 2015-09-06 18:46:46 +0000 |
commit | 61b9a7258a7693d7f3674a5a1daf7b036ff1d382 (patch) | |
tree | ec41ed70ffca97240e76f9a78bb2dedba28f310c /test/std/numerics/rand/rand.predef | |
parent | f857581820d15e410e9945d2fcd5f7163be25a96 (diff) |
Notes
Diffstat (limited to 'test/std/numerics/rand/rand.predef')
10 files changed, 232 insertions, 0 deletions
diff --git a/test/std/numerics/rand/rand.predef/default_random_engine.pass.cpp b/test/std/numerics/rand/rand.predef/default_random_engine.pass.cpp new file mode 100644 index 0000000000000..426586007c1aa --- /dev/null +++ b/test/std/numerics/rand/rand.predef/default_random_engine.pass.cpp @@ -0,0 +1,22 @@ +//===----------------------------------------------------------------------===// +// +// 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> + +// typedef minstd_rand0 default_random_engine; + +#include <random> +#include <cassert> + +int main() +{ + std::default_random_engine e; + e.discard(9999); + assert(e() == 399268537u); +} diff --git a/test/std/numerics/rand/rand.predef/knuth_b.pass.cpp b/test/std/numerics/rand/rand.predef/knuth_b.pass.cpp new file mode 100644 index 0000000000000..69627d79e907e --- /dev/null +++ b/test/std/numerics/rand/rand.predef/knuth_b.pass.cpp @@ -0,0 +1,22 @@ +//===----------------------------------------------------------------------===// +// +// 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> + +// typedef shuffle_order_engine<minstd_rand0, 256> knuth_b; + +#include <random> +#include <cassert> + +int main() +{ + std::knuth_b e; + e.discard(9999); + assert(e() == 1112339016u); +} diff --git a/test/std/numerics/rand/rand.predef/minstd_rand.pass.cpp b/test/std/numerics/rand/rand.predef/minstd_rand.pass.cpp new file mode 100644 index 0000000000000..891e5cce6d85d --- /dev/null +++ b/test/std/numerics/rand/rand.predef/minstd_rand.pass.cpp @@ -0,0 +1,23 @@ +//===----------------------------------------------------------------------===// +// +// 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> + +// typedef linear_congruential_engine<uint_fast32_t, 48271, 0, 2147483647> +// minstd_rand; + +#include <random> +#include <cassert> + +int main() +{ + std::minstd_rand e; + e.discard(9999); + assert(e() == 399268537u); +} diff --git a/test/std/numerics/rand/rand.predef/minstd_rand0.pass.cpp b/test/std/numerics/rand/rand.predef/minstd_rand0.pass.cpp new file mode 100644 index 0000000000000..63848cf950652 --- /dev/null +++ b/test/std/numerics/rand/rand.predef/minstd_rand0.pass.cpp @@ -0,0 +1,23 @@ +//===----------------------------------------------------------------------===// +// +// 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> + +// typedef linear_congruential_engine<uint_fast32_t, 16807, 0, 2147483647> +// minstd_rand0; + +#include <random> +#include <cassert> + +int main() +{ + std::minstd_rand0 e; + e.discard(9999); + assert(e() == 1043618065u); +} diff --git a/test/std/numerics/rand/rand.predef/mt19937.pass.cpp b/test/std/numerics/rand/rand.predef/mt19937.pass.cpp new file mode 100644 index 0000000000000..e3a79364a1f5a --- /dev/null +++ b/test/std/numerics/rand/rand.predef/mt19937.pass.cpp @@ -0,0 +1,27 @@ +//===----------------------------------------------------------------------===// +// +// 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> + +// typedef mersenne_twister_engine<uint_fast32_t, 32, 624, 397, 31, +// 0x9908b0df, +// 11, 0xffffffff, +// 7, 0x9d2c5680, +// 15, 0xefc60000, +// 18, 1812433253> mt19937; + +#include <random> +#include <cassert> + +int main() +{ + std::mt19937 e; + e.discard(9999); + assert(e() == 4123659995u); +} diff --git a/test/std/numerics/rand/rand.predef/mt19937_64.pass.cpp b/test/std/numerics/rand/rand.predef/mt19937_64.pass.cpp new file mode 100644 index 0000000000000..67896d2260f44 --- /dev/null +++ b/test/std/numerics/rand/rand.predef/mt19937_64.pass.cpp @@ -0,0 +1,27 @@ +//===----------------------------------------------------------------------===// +// +// 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> + +// typedef mersenne_twister_engine<uint_fast64_t, 64, 312, 156, 31, +// 0xb5026f5aa96619e9, +// 29, 0x5555555555555555, +// 17, 0x71d67fffeda60000, +// 37, 0xfff7eee000000000, +// 43, 6364136223846793005> mt19937_64; + +#include <random> +#include <cassert> + +int main() +{ + std::mt19937_64 e; + e.discard(9999); + assert(e() == 9981545732273789042ull); +} diff --git a/test/std/numerics/rand/rand.predef/ranlux24.pass.cpp b/test/std/numerics/rand/rand.predef/ranlux24.pass.cpp new file mode 100644 index 0000000000000..529586af9f424 --- /dev/null +++ b/test/std/numerics/rand/rand.predef/ranlux24.pass.cpp @@ -0,0 +1,22 @@ +//===----------------------------------------------------------------------===// +// +// 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> + +// typedef discard_block_engine<ranlux24_base, 223, 23> ranlux24; + +#include <random> +#include <cassert> + +int main() +{ + std::ranlux24 e; + e.discard(9999); + assert(e() == 9901578u); +} diff --git a/test/std/numerics/rand/rand.predef/ranlux24_base.pass.cpp b/test/std/numerics/rand/rand.predef/ranlux24_base.pass.cpp new file mode 100644 index 0000000000000..f7311469dcbfa --- /dev/null +++ b/test/std/numerics/rand/rand.predef/ranlux24_base.pass.cpp @@ -0,0 +1,22 @@ +//===----------------------------------------------------------------------===// +// +// 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> + +// typedef subtract_with_carry_engine<uint_fast32_t, 24, 10, 24> ranlux24_base; + +#include <random> +#include <cassert> + +int main() +{ + std::ranlux24_base e; + e.discard(9999); + assert(e() == 7937952u); +} diff --git a/test/std/numerics/rand/rand.predef/ranlux48.pass.cpp b/test/std/numerics/rand/rand.predef/ranlux48.pass.cpp new file mode 100644 index 0000000000000..f15dfd5493e2f --- /dev/null +++ b/test/std/numerics/rand/rand.predef/ranlux48.pass.cpp @@ -0,0 +1,22 @@ +//===----------------------------------------------------------------------===// +// +// 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> + +// typedef discard_block_engine<ranlux48_base, 389, 11> ranlux48; + +#include <random> +#include <cassert> + +int main() +{ + std::ranlux48 e; + e.discard(9999); + assert(e() == 249142670248501ull); +} diff --git a/test/std/numerics/rand/rand.predef/ranlux48_base.pass.cpp b/test/std/numerics/rand/rand.predef/ranlux48_base.pass.cpp new file mode 100644 index 0000000000000..4c3df3e1dce89 --- /dev/null +++ b/test/std/numerics/rand/rand.predef/ranlux48_base.pass.cpp @@ -0,0 +1,22 @@ +//===----------------------------------------------------------------------===// +// +// 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> + +// typedef subtract_with_carry_engine<uint_fast64_t, 48, 5, 12> ranlux48_base; + +#include <random> +#include <cassert> + +int main() +{ + std::ranlux48_base e; + e.discard(9999); + assert(e() == 61839128582725ull); +} |