values.pass.cpp (1405B)
1 //===----------------------------------------------------------------------===// 2 // 3 // The LLVM Compiler Infrastructure 4 // 5 // This file is dual licensed under the MIT and the University of Illinois Open 6 // Source Licenses. See LICENSE.TXT for details. 7 // 8 //===----------------------------------------------------------------------===// 9 10 // <random> 11 12 // template<class Engine, size_t w, class UIntType> 13 // class independent_bits_engine 14 // { 15 // public: 16 // // types 17 // typedef UIntType result_type; 18 // 19 // // engine characteristics 20 // static constexpr result_type min() { return 0; } 21 // static constexpr result_type max() { return 2^w - 1; } 22 23 #include <random> 24 #include <type_traits> 25 #include <cassert> 26 27 #include "test_macros.h" 28 29 void 30 test1() 31 { 32 typedef std::independent_bits_engine<std::ranlux24, 32, unsigned> E; 33 #if TEST_STD_VER >= 11 34 static_assert((E::min() == 0), ""); 35 static_assert((E::max() == 0xFFFFFFFF), ""); 36 #else 37 assert((E::min() == 0)); 38 assert((E::max() == 0xFFFFFFFF)); 39 #endif 40 } 41 42 void 43 test2() 44 { 45 typedef std::independent_bits_engine<std::ranlux48, 64, unsigned long long> E; 46 #if TEST_STD_VER >= 11 47 static_assert((E::min() == 0), ""); 48 static_assert((E::max() == 0xFFFFFFFFFFFFFFFFull), ""); 49 #else 50 assert((E::min() == 0)); 51 assert((E::max() == 0xFFFFFFFFFFFFFFFFull)); 52 #endif 53 } 54 55 int main() 56 { 57 test1(); 58 test2(); 59 }