74 lines · cpp
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-exception6//7//===----------------------------------------------------------------------===//8 9// <random>10 11// template<class Engine, size_t p, size_t r>12// class discard_block_engine13// {14// public:15// // types16// typedef typename Engine::result_type result_type;17//18// // engine characteristics19// 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 33void34test1()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 >= 1140 static_assert((E::min() == 0), "");41 static_assert((E::max() == 0xFFFFFF), "");42#else43 assert((E::min() == 0));44 assert((E::max() == 0xFFFFFF));45#endif46 where(E::block_size);47 where(E::used_block);48}49 50void51test2()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 >= 1157 static_assert((E::min() == 0), "");58 static_assert((E::max() == 0xFFFFFFFFFFFFull), "");59#else60 assert((E::min() == 0));61 assert((E::max() == 0xFFFFFFFFFFFFull));62#endif63 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