61 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 w, class UIntType>12// class independent_bits_engine13// {14// public:15// // types16// typedef UIntType result_type;17//18// // engine characteristics19// 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 28void29test1()30{31 typedef std::independent_bits_engine<std::ranlux24, 32, unsigned> E;32#if TEST_STD_VER >= 1133 static_assert((E::min() == 0), "");34 static_assert((E::max() == 0xFFFFFFFF), "");35#else36 assert((E::min() == 0));37 assert((E::max() == 0xFFFFFFFF));38#endif39}40 41void42test2()43{44 typedef std::independent_bits_engine<std::ranlux48, 64, unsigned long long> E;45#if TEST_STD_VER >= 1146 static_assert((E::min() == 0), "");47 static_assert((E::max() == 0xFFFFFFFFFFFFFFFFull), "");48#else49 assert((E::min() == 0));50 assert((E::max() == 0xFFFFFFFFFFFFFFFFull));51#endif52}53 54int main(int, char**)55{56 test1();57 test2();58 59 return 0;60}61