blob: 417e43183fdf473fabc68cb8cc9d7da49f36eccb [file] [log] [blame]
Howard Hinnant3e519522010-05-11 19:42:16 +00001//===----------------------------------------------------------------------===//
2//
Howard Hinnant5b08a8a2010-05-11 21:36:01 +00003// The LLVM Compiler Infrastructure
Howard Hinnant3e519522010-05-11 19:42:16 +00004//
5// This file is distributed under the University of Illinois Open Source
6// License. See LICENSE.TXT for details.
7//
8//===----------------------------------------------------------------------===//
9
10// <random>
11
12// template<class UIntType, size_t w, size_t s, size_t r>
13// class subtract_with_carry_engine
14// {
15// public:
16// // types
17// typedef UIntType result_type;
18//
19// // engine characteristics
20// static constexpr size_t word_size = w;
21// static constexpr size_t short_lag = s;
22// static constexpr size_t long_lag = r;
23// static constexpr result_type min() { return 0; }
24// static constexpr result_type max() { return m-1; }
25// static constexpr result_type default_seed = 19780503u;
26
27#include <random>
28#include <type_traits>
29#include <cassert>
30
31void
32test1()
33{
34 typedef std::ranlux24_base E;
35 static_assert((E::word_size == 24), "");
36 static_assert((E::short_lag == 10), "");
37 static_assert((E::long_lag == 24), "");
38 /*static_*/assert((E::min() == 0)/*, ""*/);
39 /*static_*/assert((E::max() == 0xFFFFFF)/*, ""*/);
40 static_assert((E::default_seed == 19780503u), "");
41}
42
43void
44test2()
45{
46 typedef std::ranlux48_base E;
47 static_assert((E::word_size == 48), "");
48 static_assert((E::short_lag == 5), "");
49 static_assert((E::long_lag == 12), "");
50 /*static_*/assert((E::min() == 0)/*, ""*/);
51 /*static_*/assert((E::max() == 0xFFFFFFFFFFFFull)/*, ""*/);
52 static_assert((E::default_seed == 19780503u), "");
53}
54
55int main()
56{
57 test1();
58 test2();
59}