//===----------------------------------------------------------------------===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// // // template // class linear_congruential_engine; // linear_congruential_engine(const linear_congruential_engine&); #include #include #include #include "test_macros.h" template void test1() { typedef std::linear_congruential_engine E; E e1; E e2 = e1; assert(e1 == e2); (void)e1(); (void)e2(); assert(e1 == e2); } template void test() { const int W = sizeof(T) * CHAR_BIT; const T M(static_cast(-1)); const T A(static_cast((static_cast(1) << (W / 2)) - 1)); // Cases where m = 0 test1(); test1(); test1(); test1(); // Cases where m = 2^n for n < w test1(); test1(); test1(); test1(); // Cases where m is odd and a = 0 test1(); test1(); test1(); // Cases where m is odd and m % a <= m / a (Schrage) test1(); test1(); test1(); } template void test_ext() { const T M(static_cast(-1)); // Cases where m is odd and m % a > m / a test1(); test1(); test1(); test1(); test1(); test1(); } int main(int, char**) { test(); test_ext(); test(); test_ext(); test(); // This isn't implemented on platforms without __int128 #ifndef TEST_HAS_NO_INT128 test_ext(); #endif test(); // This isn't implemented on platforms without __int128 #ifndef TEST_HAS_NO_INT128 test_ext(); #endif return 0; }