| 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 k> |
| 12 |
// class shuffle_order_engine |
| 13 |
// { |
| 14 |
// public: |
| 15 |
// // types |
| 16 |
// typedef typename Engine::result_type result_type; |
| 17 |
// |
| 18 |
// // engine characteristics |
| 19 |
// static constexpr size_t table_size = k; |
| 20 |
// static constexpr result_type min() { return Engine::min; } |
| 21 |
// static constexpr result_type max() { return Engine::max; } |
| 22 |
|
| 23 |
#include <random> |
| 24 |
#include <type_traits> |
| 25 |
#include <cassert> |
| 26 |
|
| 27 |
#include "test_macros.h" |
| 28 |
|
| 29 |
template <class T> |
| 30 |
void where(const T &) {} |
| 31 |
|
| 32 |
void |
| 33 |
test1() |
| 34 |
{ |
| 35 |
typedef std::knuth_b E; |
| 36 |
static_assert(E::table_size == 256, ""); |
| 37 |
#if TEST_STD_VER >= 11 |
| 38 |
static_assert((E::min() == 1), ""); |
| 39 |
static_assert((E::max() == 2147483646), ""); |
| 40 |
#else |
| 41 |
assert((E::min() == 1)); |
| 42 |
assert((E::max() == 2147483646)); |
| 43 |
#endif |
| 44 |
where(E::table_size); |
| 45 |
} |
| 46 |
|
| 47 |
int main(int, char**) |
| 48 |
{ |
| 49 |
test1(); |
| 50 |
|
| 51 |
return 0; |
| 52 |
} |