1 //===----------------------------------------------------------------------===//
2 //
3 // The LLVM Compiler Infrastructure
4 //
5 // This file is dual licensed under the MIT and the University of Illinois Open
6 // Source Licenses. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9
10 // <random>
11
12 // template<class Engine, size_t p, size_t r>
13 // class discard_block_engine
14 // {
15 // public:
16 // // types
17 // typedef typename Engine::result_type result_type;
18 //
19 // // engine characteristics
20 // static constexpr size_t block_size = p;
21 // static constexpr size_t used_block = r;
22 // static constexpr result_type min() { return Engine::min(); }
23 // static constexpr result_type max() { return Engine::max(); }
24
25 #include <random>
26 #include <type_traits>
27 #include <cassert>
28
29 template <class _Tp>
where(const _Tp &)30 void where(const _Tp &) {}
31
32 void
test1()33 test1()
34 {
35 typedef std::ranlux24 E;
36 static_assert((E::block_size == 223), "");
37 static_assert((E::used_block == 23), "");
38 #if TEST_STD_VER >= 11
39 static_assert((E::min() == 0), "");
40 static_assert((E::max() == 0xFFFFFF), "");
41 #else
42 assert((E::min() == 0));
43 assert((E::max() == 0xFFFFFF));
44 #endif
45 where(E::block_size);
46 where(E::used_block);
47 }
48
49 void
test2()50 test2()
51 {
52 typedef std::ranlux48 E;
53 static_assert((E::block_size == 389), "");
54 static_assert((E::used_block == 11), "");
55 #if TEST_STD_VER >= 11
56 static_assert((E::min() == 0), "");
57 static_assert((E::max() == 0xFFFFFFFFFFFFull), "");
58 #else
59 assert((E::min() == 0));
60 assert((E::max() == 0xFFFFFFFFFFFFull));
61 #endif
62 where(E::block_size);
63 where(E::used_block);
64 }
65
main()66 int main()
67 {
68 test1();
69 test2();
70 }
71