1//===----------------------------------------------------------------------===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8
9// <random>
10
11// template<class Engine, size_t p, size_t r>
12// class discard_block_engine
13// {
14// public:
15// // types
16// typedef typename Engine::result_type result_type;
17//
18// // engine characteristics
19// static constexpr size_t block_size = p;
20// static constexpr size_t used_block = r;
21// static constexpr result_type min() { return Engine::min(); }
22// static constexpr result_type max() { return Engine::max(); }
23
24#include <random>
25#include <type_traits>
26#include <cassert>
27
28#include "test_macros.h"
29
30template <class T>
31void where(const T &) {}
32
33void
34test1()
35{
36 typedef std::ranlux24 E;
37 static_assert((E::block_size == 223), "");
38 static_assert((E::used_block == 23), "");
39#if TEST_STD_VER >= 11
40 static_assert((E::min() == 0), "");
41 static_assert((E::max() == 0xFFFFFF), "");
42#else
43 assert((E::min() == 0));
44 assert((E::max() == 0xFFFFFF));
45#endif
46 where(E::block_size);
47 where(E::used_block);
48}
49
50void
51test2()
52{
53 typedef std::ranlux48 E;
54 static_assert((E::block_size == 389), "");
55 static_assert((E::used_block == 11), "");
56#if TEST_STD_VER >= 11
57 static_assert((E::min() == 0), "");
58 static_assert((E::max() == 0xFFFFFFFFFFFFull), "");
59#else
60 assert((E::min() == 0));
61 assert((E::max() == 0xFFFFFFFFFFFFull));
62#endif
63 where(E::block_size);
64 where(E::used_block);
65}
66
67int main(int, char**)
68{
69 test1();
70 test2();
71
72 return 0;
73}
74

source code of libcxx/test/std/numerics/rand/rand.adapt/rand.adapt.disc/values.pass.cpp