//===----------------------------------------------------------------------===// // // The LLVM Compiler Infrastructure // // This file is dual licensed under the MIT and the University of Illinois Open // Source Licenses. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// // // template // class linear_congruential_engine; // explicit linear_congruential_engine(result_type s = default_seed); #include #include #include template void test1() { // c % m != 0 && s % m != 0 { typedef std::linear_congruential_engine E; E e(5); std::ostringstream os; os << e; assert(os.str() == "5"); } { typedef std::linear_congruential_engine E; E e(5); std::ostringstream os; os << e; assert(os.str() == "5"); } { typedef std::linear_congruential_engine E; E e(5); std::ostringstream os; os << e; assert(os.str() == "1"); } } template void test2() { // c % m != 0 && s % m == 0 { typedef std::linear_congruential_engine E; E e(7); std::ostringstream os; os << e; assert(os.str() == "0"); } { typedef std::linear_congruential_engine E; E e(0); std::ostringstream os; os << e; assert(os.str() == "0"); } { typedef std::linear_congruential_engine E; E e(4); std::ostringstream os; os << e; assert(os.str() == "0"); } } template void test3() { // c % m == 0 && s % m != 0 { typedef std::linear_congruential_engine E; E e(3); std::ostringstream os; os << e; assert(os.str() == "3"); } { typedef std::linear_congruential_engine E; E e(5); std::ostringstream os; os << e; assert(os.str() == "5"); } { typedef std::linear_congruential_engine E; E e(7); std::ostringstream os; os << e; assert(os.str() == "3"); } } template void test4() { // c % m == 0 && s % m == 0 { typedef std::linear_congruential_engine E; E e(7); std::ostringstream os; os << e; assert(os.str() == "1"); } { typedef std::linear_congruential_engine E; E e(0); std::ostringstream os; os << e; assert(os.str() == "1"); } { typedef std::linear_congruential_engine E; E e(8); std::ostringstream os; os << e; assert(os.str() == "1"); } } int main() { test1(); test1(); test1(); test1(); test2(); test2(); test2(); test2(); test3(); test3(); test3(); test3(); test4(); test4(); test4(); test4(); }