• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 w, class UIntType>
12 // class independent_bits_engine
13 // {
14 // public:
15 //     // types
16 //     typedef UIntType result_type;
17 //
18 //     // engine characteristics
19 //     static constexpr result_type min() { return 0; }
20 //     static constexpr result_type max() { return 2^w - 1; }
21 
22 #include <random>
23 #include <type_traits>
24 #include <cassert>
25 
26 #include "test_macros.h"
27 
28 void
test1()29 test1()
30 {
31     typedef std::independent_bits_engine<std::ranlux24, 32, unsigned> E;
32 #if TEST_STD_VER >= 11
33     static_assert((E::min() == 0), "");
34     static_assert((E::max() == 0xFFFFFFFF), "");
35 #else
36     assert((E::min() == 0));
37     assert((E::max() == 0xFFFFFFFF));
38 #endif
39 }
40 
41 void
test2()42 test2()
43 {
44     typedef std::independent_bits_engine<std::ranlux48, 64, unsigned long long> E;
45 #if TEST_STD_VER >= 11
46     static_assert((E::min() == 0), "");
47     static_assert((E::max() == 0xFFFFFFFFFFFFFFFFull), "");
48 #else
49     assert((E::min() == 0));
50     assert((E::max() == 0xFFFFFFFFFFFFFFFFull));
51 #endif
52 }
53 
main(int,char **)54 int main(int, char**)
55 {
56     test1();
57     test2();
58 
59   return 0;
60 }
61