default.pass.cpp (1244B)
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 UIntType, UIntType a, UIntType c, UIntType m> 13 // class linear_congruential_engine; 14 15 // linear_congruential_engine(); 16 17 #include <random> 18 #include <cassert> 19 20 template <class T, T a, T c, T m> 21 void 22 test1() 23 { 24 typedef std::linear_congruential_engine<T, a, c, m> LCE; 25 LCE e1; 26 LCE e2; 27 e2.seed(); 28 assert(e1 == e2); 29 } 30 31 template <class T> 32 void 33 test() 34 { 35 test1<T, 0, 0, 0>(); 36 test1<T, 0, 1, 2>(); 37 test1<T, 1, 1, 2>(); 38 const T M(static_cast<T>(-1)); 39 test1<T, 0, 0, M>(); 40 test1<T, 0, M-2, M>(); 41 test1<T, 0, M-1, M>(); 42 test1<T, M-2, 0, M>(); 43 test1<T, M-2, M-2, M>(); 44 test1<T, M-2, M-1, M>(); 45 test1<T, M-1, 0, M>(); 46 test1<T, M-1, M-2, M>(); 47 test1<T, M-1, M-1, M>(); 48 } 49 50 int main() 51 { 52 test<unsigned short>(); 53 test<unsigned int>(); 54 test<unsigned long>(); 55 test<unsigned long long>(); 56 }