summaryrefslogtreecommitdiff
path: root/libstdc++-v3/testsuite/tr1/5_numerical_facilities/random
diff options
context:
space:
mode:
Diffstat (limited to 'libstdc++-v3/testsuite/tr1/5_numerical_facilities/random')
-rw-r--r--libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/bernoulli_distribution/requirements/typedefs.cc36
-rw-r--r--libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/binomial_distribution/requirements/typedefs.cc36
-rw-r--r--libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/discard_block/operators/equal.cc52
-rw-r--r--libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/discard_block/operators/not_equal.cc51
-rw-r--r--libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/discard_block/operators/serialize.cc54
-rw-r--r--libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/discard_block/requirements/constants.cc37
-rw-r--r--libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/discard_block/requirements/typedefs.cc39
-rw-r--r--libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/exponential_distribution/requirements/typedefs.cc36
-rw-r--r--libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/gamma_distribution/requirements/typedefs.cc36
-rw-r--r--libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/geometric_distribution/requirements/typedefs.cc36
-rw-r--r--libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/linear_congruential/cons/default.cc42
-rw-r--r--libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/linear_congruential/cons/gen1.cc51
-rw-r--r--libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/linear_congruential/cons/seed1.cc39
-rw-r--r--libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/linear_congruential/cons/seed2.cc39
-rw-r--r--libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/linear_congruential/operators/equal.cc43
-rw-r--r--libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/linear_congruential/operators/not_equal.cc43
-rw-r--r--libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/linear_congruential/operators/serialize.cc49
-rw-r--r--libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/linear_congruential/requirements/constants.cc38
-rw-r--r--libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/linear_congruential/requirements/non_uint_neg.cc31
-rw-r--r--libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/linear_congruential/requirements/typedefs.cc33
-rw-r--r--libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/mersenne_twister/cons/default.cc47
-rw-r--r--libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/mersenne_twister/cons/gen1.cc56
-rw-r--r--libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/mersenne_twister/cons/seed1.cc43
-rw-r--r--libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/mersenne_twister/cons/seed2.cc44
-rw-r--r--libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/mersenne_twister/operators/equal.cc52
-rw-r--r--libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/mersenne_twister/operators/not_equal.cc51
-rw-r--r--libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/mersenne_twister/operators/serialize.cc53
-rw-r--r--libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/mersenne_twister/requirements/constants.cc46
-rw-r--r--libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/mersenne_twister/requirements/typedefs.cc37
-rw-r--r--libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/minstd_rand.cc42
-rw-r--r--libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/minstd_rand0.cc42
-rw-r--r--libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/mt19937.cc42
-rw-r--r--libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/normal_distribution/requirements/typedefs.cc36
-rw-r--r--libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/poisson_distribution/requirements/typedefs.cc36
-rw-r--r--libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/random_device/cons/default.cc42
-rw-r--r--libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/random_device/cons/token.cc46
-rw-r--r--libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/random_device/requirements/typedefs.cc31
-rw-r--r--libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/ranlux3.cc43
-rw-r--r--libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/ranlux3_01.cc47
-rw-r--r--libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/ranlux4.cc42
-rw-r--r--libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/ranlux4_01.cc46
-rw-r--r--libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/subtract_with_carry/cons/default.cc42
-rw-r--r--libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/subtract_with_carry/cons/gen1.cc51
-rw-r--r--libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/subtract_with_carry/cons/seed1.cc39
-rw-r--r--libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/subtract_with_carry/cons/seed2.cc40
-rw-r--r--libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/subtract_with_carry/operators/equal.cc49
-rw-r--r--libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/subtract_with_carry/operators/not_equal.cc42
-rw-r--r--libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/subtract_with_carry/operators/serialize.cc50
-rw-r--r--libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/subtract_with_carry/requirements/constants.cc38
-rw-r--r--libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/subtract_with_carry/requirements/typedefs.cc34
-rw-r--r--libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/subtract_with_carry_01/cons/default.cc47
-rw-r--r--libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/subtract_with_carry_01/cons/gen1.cc51
-rw-r--r--libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/subtract_with_carry_01/cons/seed1.cc39
-rw-r--r--libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/subtract_with_carry_01/cons/seed2.cc40
-rw-r--r--libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/subtract_with_carry_01/operators/equal.cc49
-rw-r--r--libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/subtract_with_carry_01/operators/not_equal.cc42
-rw-r--r--libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/subtract_with_carry_01/operators/serialize.cc50
-rw-r--r--libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/subtract_with_carry_01/requirements/constants.cc38
-rw-r--r--libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/subtract_with_carry_01/requirements/typedefs.cc33
-rw-r--r--libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/uniform_int/33128.cc42
-rw-r--r--libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/uniform_int/cons/default.cc41
-rw-r--r--libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/uniform_int/cons/range.cc41
-rw-r--r--libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/uniform_int/requirements/typedefs.cc36
-rw-r--r--libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/uniform_real/requirements/typedefs.cc36
-rw-r--r--libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/variate_generator/37986.cc48
-rw-r--r--libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/variate_generator/requirements/typedefs.cc41
-rw-r--r--libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/xor_combine/cons/default.cc45
-rw-r--r--libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/xor_combine/operators/equal.cc52
-rw-r--r--libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/xor_combine/operators/not_equal.cc51
-rw-r--r--libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/xor_combine/operators/serialize.cc55
-rw-r--r--libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/xor_combine/requirements/constants.cc38
-rw-r--r--libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/xor_combine/requirements/typedefs.cc39
72 files changed, 3084 insertions, 0 deletions
diff --git a/libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/bernoulli_distribution/requirements/typedefs.cc b/libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/bernoulli_distribution/requirements/typedefs.cc
new file mode 100644
index 000000000..9fe0122ed
--- /dev/null
+++ b/libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/bernoulli_distribution/requirements/typedefs.cc
@@ -0,0 +1,36 @@
+// { dg-do compile }
+//
+// 2006-06-24 Paolo Carlini <pcarlini@suse.de>
+//
+// Copyright (C) 2006, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// 5.1.7.2 Class template bernoulli_distribution [tr.rand.dist.bern]
+// 5.1.1 [7] Table 17
+
+#include <tr1/random>
+
+void
+test01()
+{
+ using namespace std::tr1;
+
+ typedef bernoulli_distribution test_type;
+
+ typedef test_type::input_type input_type;
+ typedef test_type::result_type result_type;
+}
diff --git a/libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/binomial_distribution/requirements/typedefs.cc b/libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/binomial_distribution/requirements/typedefs.cc
new file mode 100644
index 000000000..af4537aee
--- /dev/null
+++ b/libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/binomial_distribution/requirements/typedefs.cc
@@ -0,0 +1,36 @@
+// { dg-do compile }
+//
+// 2006-08-18 Paolo Carlini <pcarlini@suse.de>
+//
+// Copyright (C) 2006, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// 5.1.7.5 Class template binomial_distribution [tr.rand.dist.bin]
+// 5.1.1 [7] Table 17
+
+#include <tr1/random>
+
+void
+test01()
+{
+ using namespace std::tr1;
+
+ typedef binomial_distribution<int, double> test_type;
+
+ typedef test_type::input_type input_type;
+ typedef test_type::result_type result_type;
+}
diff --git a/libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/discard_block/operators/equal.cc b/libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/discard_block/operators/equal.cc
new file mode 100644
index 000000000..146b502af
--- /dev/null
+++ b/libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/discard_block/operators/equal.cc
@@ -0,0 +1,52 @@
+// 2006-06-19 Paolo Carlini <pcarlini@suse.de>
+//
+// Copyright (C) 2006, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// 5.1.4.5 class template discard_block [tr.rand.eng.disc]
+// 5.1.1 Table 16
+
+#include <tr1/random>
+#include <testsuite_hooks.h>
+
+void
+test01()
+{
+ bool test __attribute__((unused)) = true;
+ using namespace std::tr1;
+
+ discard_block
+ <
+ subtract_with_carry<long, (1 << 24), 10, 24>,
+ 389, 24
+ > u, v;
+
+ VERIFY( u == v );
+
+ for (int i = 0; i < 100; ++i)
+ {
+ u();
+ v();
+ }
+ VERIFY( u == v );
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/discard_block/operators/not_equal.cc b/libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/discard_block/operators/not_equal.cc
new file mode 100644
index 000000000..0e3cb0fa5
--- /dev/null
+++ b/libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/discard_block/operators/not_equal.cc
@@ -0,0 +1,51 @@
+// 2006-06-19 Paolo Carlini <pcarlini@suse.de>
+//
+// Copyright (C) 2006, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// 5.1.4.5 class template discard_block [tr.rand.eng.disc]
+// 5.1.1 Table 16
+
+#include <tr1/random>
+#include <testsuite_hooks.h>
+
+void
+test01()
+{
+ bool test __attribute__((unused)) = true;
+ using namespace std::tr1;
+
+ discard_block
+ <
+ subtract_with_carry<long, (1 << 24), 10, 24>,
+ 389, 24
+ > u(1);
+
+ discard_block
+ <
+ subtract_with_carry<long, (1 << 24), 10, 24>,
+ 389, 24
+ > v(2);
+
+ VERIFY( u != v );
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/discard_block/operators/serialize.cc b/libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/discard_block/operators/serialize.cc
new file mode 100644
index 000000000..716a1d839
--- /dev/null
+++ b/libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/discard_block/operators/serialize.cc
@@ -0,0 +1,54 @@
+// 2006-06-19 Paolo Carlini <pcarlini@suse.de>
+//
+// Copyright (C) 2006, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// 5.1.4.5 class template discard_block [tr.rand.eng.disc]
+// 5.1.1 Table 16
+
+#include <sstream>
+#include <tr1/random>
+#include <testsuite_hooks.h>
+
+void
+test01()
+{
+ bool test __attribute__((unused)) = true;
+ using std::tr1::discard_block;
+ using std::tr1::subtract_with_carry;
+
+ std::stringstream str;
+ discard_block
+ <
+ subtract_with_carry<long, (1 << 24), 10, 24>,
+ 389, 24
+ > u, v;
+
+ u(); // advance
+ str << u;
+
+ VERIFY( u != v );
+
+ str >> v;
+ VERIFY( u == v );
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/discard_block/requirements/constants.cc b/libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/discard_block/requirements/constants.cc
new file mode 100644
index 000000000..be04a2c90
--- /dev/null
+++ b/libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/discard_block/requirements/constants.cc
@@ -0,0 +1,37 @@
+// { dg-do link }
+//
+// 2009-09-29 Paolo Carlini <paolo.carlini@oracle.com>
+//
+// Copyright (C) 2009, 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+#include <tr1/random>
+
+void test01()
+{
+ std::tr1::ranlux3 db;
+
+ const void* p = &db.block_size;
+ p = &db.used_block;
+ p = p; // Suppress unused warning.
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/discard_block/requirements/typedefs.cc b/libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/discard_block/requirements/typedefs.cc
new file mode 100644
index 000000000..6e138083f
--- /dev/null
+++ b/libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/discard_block/requirements/typedefs.cc
@@ -0,0 +1,39 @@
+// { dg-do compile }
+//
+// 2006-06-04 Stephen M. Webb <stephen.webb@bregmasoft.com>
+//
+// Copyright (C) 2006, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// 5.1.4.5 Class template linear_congruential
+// 5.1.1 [1] Table 15
+
+#include <tr1/random>
+
+void
+test01()
+{
+ using namespace std::tr1;
+
+ typedef discard_block
+ <
+ subtract_with_carry<long, (1 << 24), 10, 24>,
+ 389, 24
+ > test_type;
+
+ typedef test_type::result_type result_type;
+}
diff --git a/libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/exponential_distribution/requirements/typedefs.cc b/libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/exponential_distribution/requirements/typedefs.cc
new file mode 100644
index 000000000..72dfaf5d5
--- /dev/null
+++ b/libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/exponential_distribution/requirements/typedefs.cc
@@ -0,0 +1,36 @@
+// { dg-do compile }
+//
+// 2006-06-24 Paolo Carlini <pcarlini@suse.de>
+//
+// Copyright (C) 2006, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// 5.1.7.7 Class template exponential_distribution [tr.rand.dist.exp]
+// 5.1.1 [7] Table 17
+
+#include <tr1/random>
+
+void
+test01()
+{
+ using namespace std::tr1;
+
+ typedef exponential_distribution<double> test_type;
+
+ typedef test_type::input_type input_type;
+ typedef test_type::result_type result_type;
+}
diff --git a/libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/gamma_distribution/requirements/typedefs.cc b/libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/gamma_distribution/requirements/typedefs.cc
new file mode 100644
index 000000000..94da754d7
--- /dev/null
+++ b/libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/gamma_distribution/requirements/typedefs.cc
@@ -0,0 +1,36 @@
+// { dg-do compile }
+//
+// 2006-07-06 Paolo Carlini <pcarlini@suse.de>
+//
+// Copyright (C) 2006, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// 5.1.7.9 Class template gamma_distribution [tr.rand.dist.gamma]
+// 5.1.1 [7] Table 17
+
+#include <tr1/random>
+
+void
+test01()
+{
+ using namespace std::tr1;
+
+ typedef gamma_distribution<double> test_type;
+
+ typedef test_type::input_type input_type;
+ typedef test_type::result_type result_type;
+}
diff --git a/libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/geometric_distribution/requirements/typedefs.cc b/libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/geometric_distribution/requirements/typedefs.cc
new file mode 100644
index 000000000..b7d317e63
--- /dev/null
+++ b/libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/geometric_distribution/requirements/typedefs.cc
@@ -0,0 +1,36 @@
+// { dg-do compile }
+//
+// 2006-06-24 Paolo Carlini <pcarlini@suse.de>
+//
+// Copyright (C) 2006, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// 5.1.7.3 Class template geometric_distribution [tr.rand.dist.geom]
+// 5.1.1 [7] Table 17
+
+#include <tr1/random>
+
+void
+test01()
+{
+ using namespace std::tr1;
+
+ typedef geometric_distribution<int, double> test_type;
+
+ typedef test_type::input_type input_type;
+ typedef test_type::result_type result_type;
+}
diff --git a/libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/linear_congruential/cons/default.cc b/libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/linear_congruential/cons/default.cc
new file mode 100644
index 000000000..351b7b3f8
--- /dev/null
+++ b/libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/linear_congruential/cons/default.cc
@@ -0,0 +1,42 @@
+// 2006-06-04 Stephen M. Webb <stephen.webb@bregmasoft.com>
+//
+// Copyright (C) 2006, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// 5.1.4.1 class template linear_congruential [tr.rand.eng.lcong]
+// 5.1.4.1 [4]
+
+#include <tr1/random>
+#include <testsuite_hooks.h>
+
+void
+test01()
+{
+ bool test __attribute__((unused)) = true;
+ using namespace std::tr1;
+
+ linear_congruential<unsigned long, 48271, 0, 2147483647> x;
+ VERIFY( x.min() == 1 );
+ VERIFY( x.max() == 2147483647-1 );
+ VERIFY( x() == 48271 );
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/linear_congruential/cons/gen1.cc b/libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/linear_congruential/cons/gen1.cc
new file mode 100644
index 000000000..75181ff9c
--- /dev/null
+++ b/libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/linear_congruential/cons/gen1.cc
@@ -0,0 +1,51 @@
+// 2006-06-04 Stephen M. Webb <stephen.webb@bregmasoft.com>
+//
+// Copyright (C) 2006, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// 5.1.4.1 class template linear_congruential [tr.rand.eng.lcong]
+// 5.1.1 Table 16 line 3 template ctor(gen)
+
+// { dg-require-time "" }
+
+#include <ctime>
+#include <tr1/random>
+#include <testsuite_hooks.h>
+
+// a not untypical initialization function
+unsigned long
+gen()
+{
+ return std::time(0);
+}
+
+void
+test01()
+{
+ bool test __attribute__((unused)) = true;
+ using namespace std::tr1;
+
+ linear_congruential<unsigned long, 48271, 0, 2147483647> x(gen);
+ VERIFY( x.min() == 1 );
+ VERIFY( x.max() == 2147483647-1 );
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/linear_congruential/cons/seed1.cc b/libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/linear_congruential/cons/seed1.cc
new file mode 100644
index 000000000..0e87ec5ba
--- /dev/null
+++ b/libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/linear_congruential/cons/seed1.cc
@@ -0,0 +1,39 @@
+// 2006-06-04 Stephen M. Webb <stephen.webb@bregmasoft.com>
+//
+// Copyright (C) 2006, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// 5.1.4.1 class template linear_congruential [tr.rand.eng.lcong]
+// 5.1.1 [4] para 2
+
+#include <tr1/random>
+#include <testsuite_hooks.h>
+
+void
+test01()
+{
+ using namespace std::tr1;
+
+ unsigned long seed = 2;
+ linear_congruential<unsigned long, 48271, 0, 2147483647> x(seed);
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/linear_congruential/cons/seed2.cc b/libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/linear_congruential/cons/seed2.cc
new file mode 100644
index 000000000..7e8e2841c
--- /dev/null
+++ b/libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/linear_congruential/cons/seed2.cc
@@ -0,0 +1,39 @@
+// 2006-06-04 Stephen M. Webb <stephen.webb@bregmasoft.com>
+//
+// Copyright (C) 2006, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// 5.1.4.1 class template linear_congruential [tr.rand.eng.lcong]
+// 5.1.1 [4] para 2
+
+#include <tr1/random>
+#include <testsuite_hooks.h>
+
+void
+test01()
+{
+ using namespace std::tr1;
+
+ double seed = 2.0;
+ linear_congruential<unsigned long, 48271, 0, 2147483647> x(seed);
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/linear_congruential/operators/equal.cc b/libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/linear_congruential/operators/equal.cc
new file mode 100644
index 000000000..8ab90388c
--- /dev/null
+++ b/libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/linear_congruential/operators/equal.cc
@@ -0,0 +1,43 @@
+// 2006-06-04 Stephen M. Webb <stephen.webb@bregmasoft.com>
+//
+// Copyright (C) 2006, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// 5.1.4.1 Class template linear_congruential
+// 5.1 [3] Table 16
+
+#include <tr1/random>
+#include <testsuite_hooks.h>
+
+void
+test01()
+{
+ bool test __attribute__((unused)) = true;
+
+ std::tr1::minstd_rand0 a;
+ std::tr1::minstd_rand0 b;
+ std::tr1::minstd_rand0 c(120);
+
+ VERIFY( a == b );
+ VERIFY( !(a == c) );
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/linear_congruential/operators/not_equal.cc b/libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/linear_congruential/operators/not_equal.cc
new file mode 100644
index 000000000..325f530ea
--- /dev/null
+++ b/libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/linear_congruential/operators/not_equal.cc
@@ -0,0 +1,43 @@
+// 2006-06-04 Stephen M. Webb <stephen.webb@bregmasoft.com>
+//
+// Copyright (C) 2006, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// 5.1.4.1 Class template linear_congruential
+// 5.1 [3] Table 16
+
+#include <tr1/random>
+#include <testsuite_hooks.h>
+
+void
+test01()
+{
+ bool test __attribute__((unused)) = true;
+
+ std::tr1::minstd_rand0 a;
+ std::tr1::minstd_rand0 b;
+ std::tr1::minstd_rand0 c(120);
+
+ VERIFY( !(a != b) );
+ VERIFY( a != c );
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/linear_congruential/operators/serialize.cc b/libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/linear_congruential/operators/serialize.cc
new file mode 100644
index 000000000..6abdc1ed6
--- /dev/null
+++ b/libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/linear_congruential/operators/serialize.cc
@@ -0,0 +1,49 @@
+// 2006-06-04 Stephen M. Webb <stephen.webb@bregmasoft.com>
+//
+// Copyright (C) 2006, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// 5.1.4.1 Class template linear_congruential
+// 5.1 [3] Table 16
+
+#include <sstream>
+#include <tr1/random>
+#include <testsuite_hooks.h>
+
+void
+test01()
+{
+ bool test __attribute__((unused)) = true;
+
+ std::stringstream str;
+ std::tr1::minstd_rand0 a;
+ std::tr1::minstd_rand0 b;
+
+ a(); // advance
+ str << a;
+
+ VERIFY( a != b );
+
+ str >> b;
+ VERIFY( a == b );
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/linear_congruential/requirements/constants.cc b/libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/linear_congruential/requirements/constants.cc
new file mode 100644
index 000000000..bdc366ea7
--- /dev/null
+++ b/libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/linear_congruential/requirements/constants.cc
@@ -0,0 +1,38 @@
+// { dg-do link }
+//
+// 2009-09-29 Paolo Carlini <paolo.carlini@oracle.com>
+//
+// Copyright (C) 2009, 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+#include <tr1/random>
+
+void test01()
+{
+ std::tr1::minstd_rand0 lc;
+
+ const void* p = &lc.multiplier;
+ p = &lc.increment;
+ p = &lc.modulus;
+ p = p; // Suppress unused warning.
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/linear_congruential/requirements/non_uint_neg.cc b/libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/linear_congruential/requirements/non_uint_neg.cc
new file mode 100644
index 000000000..a8cdf2557
--- /dev/null
+++ b/libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/linear_congruential/requirements/non_uint_neg.cc
@@ -0,0 +1,31 @@
+// 2006-06-04 Stephen M. Webb <stephen.webb@bregmasoft.com>
+//
+// Copyright (C) 2006, 2007, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// { dg-do compile }
+// { dg-options "-D_GLIBCXX_CONCEPT_CHECKS" }
+// { dg-error "not a valid type" "" { target *-*-* } 30 }
+// { dg-error "invalid type" "" { target *-*-* } 30 }
+
+// 5.1.4.1 class template linear_congruential [tr.rand.eng.lcong]
+// 5.1.4.1 [4]
+
+#include <tr1/random>
+
+std::tr1::linear_congruential<double, 48271, 0, 2147483647> x;
+
diff --git a/libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/linear_congruential/requirements/typedefs.cc b/libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/linear_congruential/requirements/typedefs.cc
new file mode 100644
index 000000000..5b5f62d6b
--- /dev/null
+++ b/libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/linear_congruential/requirements/typedefs.cc
@@ -0,0 +1,33 @@
+// { dg-do compile }
+//
+// 2006-06-04 Stephen M. Webb <stephen.webb@bregmasoft.com>
+//
+// Copyright (C) 2006, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// 5.1.4.1 Class template linear_congruential
+// 5.1.1 [1] Table 15
+
+#include <tr1/random>
+
+void
+test01()
+{
+ typedef std::tr1::linear_congruential<unsigned long, 2, 0, 4> test_type;
+
+ typedef test_type::result_type result_type;
+}
diff --git a/libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/mersenne_twister/cons/default.cc b/libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/mersenne_twister/cons/default.cc
new file mode 100644
index 000000000..7df19f113
--- /dev/null
+++ b/libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/mersenne_twister/cons/default.cc
@@ -0,0 +1,47 @@
+// 2006-06-04 Stephen M. Webb <stephen.webb@bregmasoft.com>
+//
+// Copyright (C) 2006, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// 5.1.4.2 class template mersenne_twister [tr.rand.eng.mers]
+// 5.1.1 Table 16 line 1 default ctor
+
+#include <tr1/random>
+#include <testsuite_hooks.h>
+
+void
+test01()
+{
+ bool test __attribute__((unused)) = true;
+
+ using namespace std::tr1;
+ mersenne_twister<
+ unsigned long, 32, 624, 397, 31,
+ 0x9908b0dful, 11, 7,
+ 0x9d2c5680ul, 15,
+ 0xefc60000ul, 18> x;
+
+ VERIFY( x.min() == 0 );
+ VERIFY( x.max() == 4294967295ul );
+ VERIFY( x() == 3499211612ul );
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/mersenne_twister/cons/gen1.cc b/libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/mersenne_twister/cons/gen1.cc
new file mode 100644
index 000000000..8ca829b8d
--- /dev/null
+++ b/libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/mersenne_twister/cons/gen1.cc
@@ -0,0 +1,56 @@
+// 2006-06-04 Stephen M. Webb <stephen.webb@bregmasoft.com>
+//
+// Copyright (C) 2006, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// 5.1.4.2 class template mersenne_twister [tr.rand.eng.mers]
+// 5.1.1 Table 16 line 3 Gen ctor
+
+// { dg-require-time "" }
+
+#include <ctime>
+#include <tr1/random>
+#include <testsuite_hooks.h>
+
+// a not untypical initialization function
+unsigned long
+gen()
+{
+ return std::time(0);
+}
+
+void
+test01()
+{
+ bool test __attribute__((unused)) = true;
+ using namespace std::tr1;
+
+ mersenne_twister<
+ unsigned long, 32, 624, 397, 31,
+ 0x9908b0dful, 11, 7,
+ 0x9d2c5680ul, 15,
+ 0xefc60000ul, 18> x(gen);
+
+ VERIFY( x.min() == 0 );
+ VERIFY( x.max() == 4294967295ul );
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/mersenne_twister/cons/seed1.cc b/libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/mersenne_twister/cons/seed1.cc
new file mode 100644
index 000000000..4ed309204
--- /dev/null
+++ b/libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/mersenne_twister/cons/seed1.cc
@@ -0,0 +1,43 @@
+// 2006-06-04 Stephen M. Webb <stephen.webb@bregmasoft.com>
+//
+// Copyright (C) 2006, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// 5.1.4.2 class template mersenne_twister [tr.rand.eng.mers]
+// 5.1.1 Table 16 line 2 seed ctor
+
+#include <tr1/random>
+#include <testsuite_hooks.h>
+
+void
+test01()
+{
+ using namespace std::tr1;
+
+ unsigned long seed = 2;
+ mersenne_twister<
+ unsigned long, 32, 624, 397, 31,
+ 0x9908b0dful, 11, 7,
+ 0x9d2c5680ul, 15,
+ 0xefc60000ul, 18> x(seed);
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/mersenne_twister/cons/seed2.cc b/libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/mersenne_twister/cons/seed2.cc
new file mode 100644
index 000000000..1e24b48f2
--- /dev/null
+++ b/libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/mersenne_twister/cons/seed2.cc
@@ -0,0 +1,44 @@
+// 2006-06-04 Stephen M. Webb <stephen.webb@bregmasoft.com>
+//
+// Copyright (C) 2006, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// 5.1.4.2 class template mersenne_twister [tr.rand.eng.mers]
+// 5.1.1 Table 16 line 2 seed ctor
+// 5.1.1 (4) point 2: Gen is a fundamental type.
+
+#include <tr1/random>
+#include <testsuite_hooks.h>
+
+void
+test01()
+{
+ using namespace std::tr1;
+
+ double seed = 2.0;
+ mersenne_twister<
+ unsigned long, 32, 624, 397, 31,
+ 0x9908b0dful, 11, 7,
+ 0x9d2c5680ul, 15,
+ 0xefc60000ul, 18> x(seed);
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/mersenne_twister/operators/equal.cc b/libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/mersenne_twister/operators/equal.cc
new file mode 100644
index 000000000..6a6a2a571
--- /dev/null
+++ b/libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/mersenne_twister/operators/equal.cc
@@ -0,0 +1,52 @@
+// 2006-06-06 Paolo Carlini <pcarlini@suse.de>
+//
+// Copyright (C) 2006, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// 5.1.4.2 class template mersenne_twister [tr.rand.eng.mers]
+// 5.1.1 Table 16
+
+#include <tr1/random>
+#include <testsuite_hooks.h>
+
+void
+test01()
+{
+ bool test __attribute__((unused)) = true;
+ using namespace std::tr1;
+
+ mersenne_twister<
+ unsigned long, 32, 624, 397, 31,
+ 0x9908b0dful, 11, 7,
+ 0x9d2c5680ul, 15,
+ 0xefc60000ul, 18> u, v;
+
+ VERIFY( u == v );
+
+ for (int i = 0; i < 100; ++i)
+ {
+ u();
+ v();
+ }
+ VERIFY( u == v );
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/mersenne_twister/operators/not_equal.cc b/libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/mersenne_twister/operators/not_equal.cc
new file mode 100644
index 000000000..7d200e068
--- /dev/null
+++ b/libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/mersenne_twister/operators/not_equal.cc
@@ -0,0 +1,51 @@
+// 2006-06-06 Paolo Carlini <pcarlini@suse.de>
+//
+// Copyright (C) 2006, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// 5.1.4.2 class template mersenne_twister [tr.rand.eng.mers]
+// 5.1.1 Table 16
+
+#include <tr1/random>
+#include <testsuite_hooks.h>
+
+void
+test01()
+{
+ bool test __attribute__((unused)) = true;
+ using namespace std::tr1;
+
+ mersenne_twister<
+ unsigned long, 32, 624, 397, 31,
+ 0x9908b0dful, 11, 7,
+ 0x9d2c5680ul, 15,
+ 0xefc60000ul, 18> u(1);
+
+ mersenne_twister<
+ unsigned long, 32, 624, 397, 31,
+ 0x9908b0dful, 11, 7,
+ 0x9d2c5680ul, 15,
+ 0xefc60000ul, 18> v(2);
+
+ VERIFY( u != v );
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/mersenne_twister/operators/serialize.cc b/libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/mersenne_twister/operators/serialize.cc
new file mode 100644
index 000000000..335d23938
--- /dev/null
+++ b/libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/mersenne_twister/operators/serialize.cc
@@ -0,0 +1,53 @@
+// 2006-06-06 Paolo Carlini <pcarlini@suse.de>
+//
+// Copyright (C) 2006, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// 5.1.4.2 class template mersenne_twister [tr.rand.eng.mers]
+// 5.1.1 Table 16
+
+#include <sstream>
+#include <tr1/random>
+#include <testsuite_hooks.h>
+
+void
+test01()
+{
+ bool test __attribute__((unused)) = true;
+ using std::tr1::mersenne_twister;
+
+ std::stringstream str;
+ mersenne_twister<
+ unsigned long, 32, 624, 397, 31,
+ 0x9908b0dful, 11, 7,
+ 0x9d2c5680ul, 15,
+ 0xefc60000ul, 18> u, v;
+
+ u(); // advance
+ str << u;
+
+ VERIFY( u != v );
+
+ str >> v;
+ VERIFY( u == v );
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/mersenne_twister/requirements/constants.cc b/libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/mersenne_twister/requirements/constants.cc
new file mode 100644
index 000000000..52fd3a50b
--- /dev/null
+++ b/libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/mersenne_twister/requirements/constants.cc
@@ -0,0 +1,46 @@
+// { dg-do link }
+//
+// 2009-09-29 Paolo Carlini <paolo.carlini@oracle.com>
+//
+// Copyright (C) 2009, 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+#include <tr1/random>
+
+void test01()
+{
+ std::tr1::mt19937 mt;
+
+ const void* p = &mt.word_size;
+ p = &mt.state_size;
+ p = &mt.shift_size;
+ p = &mt.mask_bits;
+ p = &mt.parameter_a;
+ p = &mt.output_u;
+ p = &mt.output_s;
+ p = &mt.output_b;
+ p = &mt.output_t;
+ p = &mt.output_c;
+ p = &mt.output_l;
+ p = p; // Suppress unused warning.
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/mersenne_twister/requirements/typedefs.cc b/libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/mersenne_twister/requirements/typedefs.cc
new file mode 100644
index 000000000..dddb79d27
--- /dev/null
+++ b/libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/mersenne_twister/requirements/typedefs.cc
@@ -0,0 +1,37 @@
+// { dg-do compile }
+//
+// 2006-06-04 Stephen M. Webb <stephen.webb@bregmasoft.com>
+//
+// Copyright (C) 2006, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// 5.1.4.2 Class template mersenne_twister
+// 5.1.1 [1] Table 15
+
+#include <tr1/random>
+
+void
+test01()
+{
+ typedef std::tr1::mersenne_twister<unsigned long,
+ 32, 624, 397, 31,
+ 0x9908b0df, 11, 7,
+ 0x9d2c5680, 15,
+ 0xefc60000, 18> test_type;
+
+ typedef test_type::result_type result_type;
+}
diff --git a/libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/minstd_rand.cc b/libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/minstd_rand.cc
new file mode 100644
index 000000000..c75e164df
--- /dev/null
+++ b/libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/minstd_rand.cc
@@ -0,0 +1,42 @@
+// 2006-06-04 Stephen M. Webb <stephen.webb@bregmasoft.com>
+//
+// Copyright (C) 2006, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// 5.1.5 Engines with predefined parameters
+// 5.1.5 [1]
+
+#include <tr1/random>
+#include <testsuite_hooks.h>
+
+void
+test01()
+{
+ bool test __attribute__((unused)) = true;
+
+ std::tr1::minstd_rand a;
+ for (int i = 0; i < 9999; ++i)
+ a();
+
+ VERIFY( a() == 399268537 );
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/minstd_rand0.cc b/libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/minstd_rand0.cc
new file mode 100644
index 000000000..8438ee7e1
--- /dev/null
+++ b/libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/minstd_rand0.cc
@@ -0,0 +1,42 @@
+// 2006-06-04 Stephen M. Webb <stephen.webb@bregmasoft.com>
+//
+// Copyright (C) 2006, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// 5.1.5 Engines with predefined parameters
+// 5.1.5 [1]
+
+#include <tr1/random>
+#include <testsuite_hooks.h>
+
+void
+test01()
+{
+ bool test __attribute__((unused)) = true;
+
+ std::tr1::minstd_rand0 a;
+ for (int i = 0; i < 9999; ++i)
+ a();
+
+ VERIFY( a() == 1043618065 );
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/mt19937.cc b/libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/mt19937.cc
new file mode 100644
index 000000000..f3fb05323
--- /dev/null
+++ b/libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/mt19937.cc
@@ -0,0 +1,42 @@
+// 2006-06-04 Stephen M. Webb <stephen.webb@bregmasoft.com>
+//
+// Copyright (C) 2006, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// 5.1.5 Engines with predefined parameters
+// 5.1.5 [2]
+
+#include <tr1/random>
+#include <testsuite_hooks.h>
+
+void
+test01()
+{
+ bool test __attribute__((unused)) = true;
+
+ std::tr1::mt19937 a;
+ for (int i = 0; i < 9999; ++i)
+ a();
+
+ VERIFY( a() == 4123659995ul );
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/normal_distribution/requirements/typedefs.cc b/libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/normal_distribution/requirements/typedefs.cc
new file mode 100644
index 000000000..8c189eef7
--- /dev/null
+++ b/libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/normal_distribution/requirements/typedefs.cc
@@ -0,0 +1,36 @@
+// { dg-do compile }
+//
+// 2006-06-24 Paolo Carlini <pcarlini@suse.de>
+//
+// Copyright (C) 2006, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// 5.1.7.8 Class template normal_distribution [tr.rand.dist.norm]
+// 5.1.1 [7] Table 17
+
+#include <tr1/random>
+
+void
+test01()
+{
+ using namespace std::tr1;
+
+ typedef normal_distribution<double> test_type;
+
+ typedef test_type::input_type input_type;
+ typedef test_type::result_type result_type;
+}
diff --git a/libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/poisson_distribution/requirements/typedefs.cc b/libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/poisson_distribution/requirements/typedefs.cc
new file mode 100644
index 000000000..79d716b59
--- /dev/null
+++ b/libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/poisson_distribution/requirements/typedefs.cc
@@ -0,0 +1,36 @@
+// { dg-do compile }
+//
+// 2006-08-13 Paolo Carlini <pcarlini@suse.de>
+//
+// Copyright (C) 2006, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// 5.1.7.4 Class template poisson_distribution [tr.rand.dist.pois]
+// 5.1.1 [7] Table 17
+
+#include <tr1/random>
+
+void
+test01()
+{
+ using namespace std::tr1;
+
+ typedef poisson_distribution<int, double> test_type;
+
+ typedef test_type::input_type input_type;
+ typedef test_type::result_type result_type;
+}
diff --git a/libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/random_device/cons/default.cc b/libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/random_device/cons/default.cc
new file mode 100644
index 000000000..319113afd
--- /dev/null
+++ b/libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/random_device/cons/default.cc
@@ -0,0 +1,42 @@
+// 2006-06-09 Paolo Carlini <pcarlini@suse.de>
+//
+// Copyright (C) 2006, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// 5.1.6 class random_device [tr.rand.device]
+// 5.1.1 Table 15 default ctor
+
+#include <tr1/random>
+#include <testsuite_hooks.h>
+
+void
+test01()
+{
+ bool test __attribute__((unused)) = true;
+
+ using namespace std::tr1;
+ random_device x;
+
+ VERIFY( x.min() == std::numeric_limits<random_device::result_type>::min() );
+ VERIFY( x.max() == std::numeric_limits<random_device::result_type>::max() );
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/random_device/cons/token.cc b/libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/random_device/cons/token.cc
new file mode 100644
index 000000000..1e3c97e75
--- /dev/null
+++ b/libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/random_device/cons/token.cc
@@ -0,0 +1,46 @@
+// 2006-06-09 Paolo Carlini <pcarlini@suse.de>
+//
+// Copyright (C) 2006, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// 5.1.6 class random_device [tr.rand.device]
+// 5.1.6, p3
+
+#include <tr1/random>
+#include <testsuite_hooks.h>
+
+void
+test01()
+{
+ bool test __attribute__((unused)) = true;
+ using namespace std::tr1;
+
+#ifdef _GLIBCXX_USE_RANDOM_TR1
+ random_device x("/dev/random");
+#else
+ random_device x("0");
+#endif
+
+ VERIFY( x.min() == std::numeric_limits<random_device::result_type>::min() );
+ VERIFY( x.max() == std::numeric_limits<random_device::result_type>::max() );
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/random_device/requirements/typedefs.cc b/libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/random_device/requirements/typedefs.cc
new file mode 100644
index 000000000..cc1f63439
--- /dev/null
+++ b/libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/random_device/requirements/typedefs.cc
@@ -0,0 +1,31 @@
+// { dg-do compile }
+//
+// 2006-06-09 Paolo Carlini <pcarlini@suse.de>
+//
+// Copyright (C) 2006, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// 5.1.6 class random_device [tr.rand.device]
+
+#include <tr1/random>
+
+void
+test01()
+{
+ typedef std::tr1::random_device test_type;
+ typedef test_type::result_type result_type;
+}
diff --git a/libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/ranlux3.cc b/libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/ranlux3.cc
new file mode 100644
index 000000000..7e436b820
--- /dev/null
+++ b/libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/ranlux3.cc
@@ -0,0 +1,43 @@
+// 2006-06-04 Stephen M. Webb <stephen.webb@bregmasoft.com>
+//
+// Copyright (C) 2006, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// 5.1.5 Engines with predefined parameters
+// 5.1.5 [3]
+
+#include <iostream>
+#include <tr1/random>
+#include <testsuite_hooks.h>
+
+void
+test01()
+{
+ bool test __attribute__((unused)) = true;
+
+ std::tr1::ranlux3 a;
+ for (int i = 0; i < 9999; ++i)
+ a();
+
+ VERIFY( a() == 5957620 );
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/ranlux3_01.cc b/libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/ranlux3_01.cc
new file mode 100644
index 000000000..388e79efe
--- /dev/null
+++ b/libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/ranlux3_01.cc
@@ -0,0 +1,47 @@
+// 2006-08-22 Paolo Carlini <pcarlini@suse.de>
+//
+// Copyright (C) 2006, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// 5.1.5 Engines with predefined parameters
+// 5.1.5 [3]
+
+#include <iostream>
+#include <tr1/random>
+#include <testsuite_hooks.h>
+
+void
+test01()
+{
+ bool test __attribute__((unused)) = true;
+
+ std::tr1::ranlux3_01 a;
+ for (int i = 0; i < 9999; ++i)
+ a();
+
+#if _GLIBCXX_USE_C99_MATH_TR1
+ VERIFY( a() == 5957620 * std::tr1::ldexp(float(1), -24) );
+#else
+ VERIFY( a() == 5957620 * std::pow(float(2), -24) );
+#endif
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/ranlux4.cc b/libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/ranlux4.cc
new file mode 100644
index 000000000..6c61429dc
--- /dev/null
+++ b/libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/ranlux4.cc
@@ -0,0 +1,42 @@
+// 2006-06-04 Stephen M. Webb <stephen.webb@bregmasoft.com>
+//
+// Copyright (C) 2006, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// 5.1.5 Engines with predefined parameters
+// 5.1.5 [3]
+
+#include <tr1/random>
+#include <testsuite_hooks.h>
+
+void
+test01()
+{
+ bool test __attribute__((unused)) = true;
+
+ std::tr1::ranlux4 a;
+ for (int i = 0; i < 9999; ++i)
+ a();
+
+ VERIFY( a() == 8587295 );
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/ranlux4_01.cc b/libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/ranlux4_01.cc
new file mode 100644
index 000000000..8a5e3ff3b
--- /dev/null
+++ b/libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/ranlux4_01.cc
@@ -0,0 +1,46 @@
+// 2006-08-22 Paolo Carlini <pcarlini@suse.de>
+//
+// Copyright (C) 2006, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// 5.1.5 Engines with predefined parameters
+// 5.1.5 [3]
+
+#include <tr1/random>
+#include <testsuite_hooks.h>
+
+void
+test01()
+{
+ bool test __attribute__((unused)) = true;
+
+ std::tr1::ranlux4_01 a;
+ for (int i = 0; i < 9999; ++i)
+ a();
+
+#if _GLIBCXX_USE_C99_MATH_TR1
+ VERIFY( a() == 8587295 * std::tr1::ldexp(float(1), -24) );
+#else
+ VERIFY( a() == 8587295 * std::pow(float(2), -24) );
+#endif
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/subtract_with_carry/cons/default.cc b/libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/subtract_with_carry/cons/default.cc
new file mode 100644
index 000000000..5e439e7ce
--- /dev/null
+++ b/libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/subtract_with_carry/cons/default.cc
@@ -0,0 +1,42 @@
+// 2006-06-04 Stephen M. Webb <stephen.webb@bregmasoft.com>
+//
+// Copyright (C) 2006, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// 5.1.4.3 class template subtract_with_carry [tr.rand.eng.sub]
+// 5.1.1 Table 16 line 1 default ctor
+
+#include <tr1/random>
+#include <testsuite_hooks.h>
+
+void
+test01()
+{
+ bool test __attribute__((unused)) = true;
+ using namespace std::tr1;
+
+ subtract_with_carry<unsigned long, (1UL << 24), 10, 24> x;
+ VERIFY( x.min() == 0 );
+ VERIFY( x.max() == ((1UL << 24) - 1) );
+ VERIFY( x() == 15039276 );
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/subtract_with_carry/cons/gen1.cc b/libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/subtract_with_carry/cons/gen1.cc
new file mode 100644
index 000000000..9f33e765b
--- /dev/null
+++ b/libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/subtract_with_carry/cons/gen1.cc
@@ -0,0 +1,51 @@
+// 2006-06-04 Stephen M. Webb <stephen.webb@bregmasoft.com>
+//
+// Copyright (C) 2006, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// 5.1.4.3 class template subtract_with_carry [tr.rand.eng.sub]
+// 5.1.1 Table 16 line 3 Gen ctor
+
+// { dg-require-time "" }
+
+#include <ctime>
+#include <tr1/random>
+#include <testsuite_hooks.h>
+
+// a not untypical initialization function
+unsigned long
+gen()
+{
+ return std::time(0);
+}
+
+void
+test01()
+{
+ bool test __attribute__((unused)) = true;
+ using namespace std::tr1;
+
+ subtract_with_carry<unsigned long, (1UL << 24), 10, 24> x(gen);
+ VERIFY( x.min() == 0 );
+ VERIFY( x.max() == ((1UL << 24) - 1) );
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/subtract_with_carry/cons/seed1.cc b/libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/subtract_with_carry/cons/seed1.cc
new file mode 100644
index 000000000..217e1ab54
--- /dev/null
+++ b/libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/subtract_with_carry/cons/seed1.cc
@@ -0,0 +1,39 @@
+// 2006-06-04 Stephen M. Webb <stephen.webb@bregmasoft.com>
+//
+// Copyright (C) 2006, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// 5.1.4.3 class template subtract_with_carry [tr.rand.eng.sub]
+// 5.1.1 Table 16 line 2 seed ctor
+
+#include <tr1/random>
+#include <testsuite_hooks.h>
+
+void
+test01()
+{
+ using namespace std::tr1;
+
+ unsigned long seed = 2;
+ subtract_with_carry<unsigned long, (1UL << 24), 10, 24> x(seed);
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/subtract_with_carry/cons/seed2.cc b/libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/subtract_with_carry/cons/seed2.cc
new file mode 100644
index 000000000..08e672ab6
--- /dev/null
+++ b/libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/subtract_with_carry/cons/seed2.cc
@@ -0,0 +1,40 @@
+// 2006-06-04 Stephen M. Webb <stephen.webb@bregmasoft.com>
+//
+// Copyright (C) 2006, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// 5.1.4.3 class template subtract_with_carry [tr.rand.eng.sub]
+// 5.1.1 Table 16 line 2 seed ctor
+// 5.1.1 (4) point 2: Gen is a fundamental type.
+
+#include <tr1/random>
+#include <testsuite_hooks.h>
+
+void
+test01()
+{
+ using namespace std::tr1;
+
+ double seed = 2.0;
+ subtract_with_carry<unsigned long, (1UL << 24), 10, 24> x(seed);
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/subtract_with_carry/operators/equal.cc b/libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/subtract_with_carry/operators/equal.cc
new file mode 100644
index 000000000..11536132a
--- /dev/null
+++ b/libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/subtract_with_carry/operators/equal.cc
@@ -0,0 +1,49 @@
+// 2006-06-04 Stephen M. Webb <stephen.webb@bregmasoft.com>
+//
+// Copyright (C) 2006, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// 5.1.4.3 class template subtract_with_carry [tr.rand.eng.sub]
+// 5.1.1 Table 16
+
+#include <tr1/random>
+#include <testsuite_hooks.h>
+
+void
+test01()
+{
+ bool test __attribute__((unused)) = true;
+ using namespace std::tr1;
+
+ subtract_with_carry<unsigned long, (1UL << 24), 10, 24> u;
+ subtract_with_carry<unsigned long, (1UL << 24), 10, 24> v;
+
+ VERIFY( u == v );
+
+ for (int i = 0; i < 100; ++i)
+ {
+ u();
+ v();
+ }
+ VERIFY( u == v );
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/subtract_with_carry/operators/not_equal.cc b/libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/subtract_with_carry/operators/not_equal.cc
new file mode 100644
index 000000000..535701940
--- /dev/null
+++ b/libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/subtract_with_carry/operators/not_equal.cc
@@ -0,0 +1,42 @@
+// 2006-06-04 Stephen M. Webb <stephen.webb@bregmasoft.com>
+//
+// Copyright (C) 2006, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// 5.1.4.3 class template subtract_with_carry [tr.rand.eng.sub]
+// 5.1.1 Table 16
+
+#include <tr1/random>
+#include <testsuite_hooks.h>
+
+void
+test01()
+{
+ bool test __attribute__((unused)) = true;
+ using namespace std::tr1;
+
+ subtract_with_carry<unsigned long, (1UL << 24), 10, 24> u(1);
+ subtract_with_carry<unsigned long, (1UL << 24), 10, 24> v(2);
+
+ VERIFY( u != v );
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/subtract_with_carry/operators/serialize.cc b/libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/subtract_with_carry/operators/serialize.cc
new file mode 100644
index 000000000..6b52a1888
--- /dev/null
+++ b/libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/subtract_with_carry/operators/serialize.cc
@@ -0,0 +1,50 @@
+// 2006-06-04 Stephen M. Webb <stephen.webb@bregmasoft.com>
+//
+// Copyright (C) 2006, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// 5.1.4.3 class template subtract_with_carry [tr.rand.eng.sub]
+// 5.1.1 Table 16
+
+#include <sstream>
+#include <tr1/random>
+#include <testsuite_hooks.h>
+
+void
+test01()
+{
+ bool test __attribute__((unused)) = true;
+ using std::tr1::subtract_with_carry;
+
+ std::stringstream str;
+ subtract_with_carry<unsigned long, (1UL << 24), 10, 24> u;
+ subtract_with_carry<unsigned long, (1UL << 24), 10, 24> v;
+
+ u(); // advance
+ str << u;
+
+ VERIFY( u != v );
+
+ str >> v;
+ VERIFY( u == v );
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/subtract_with_carry/requirements/constants.cc b/libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/subtract_with_carry/requirements/constants.cc
new file mode 100644
index 000000000..a34938ee0
--- /dev/null
+++ b/libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/subtract_with_carry/requirements/constants.cc
@@ -0,0 +1,38 @@
+// { dg-do link }
+//
+// 2009-09-29 Paolo Carlini <paolo.carlini@oracle.com>
+//
+// Copyright (C) 2009, 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+#include <tr1/random>
+
+void test01()
+{
+ std::tr1::subtract_with_carry<unsigned long, (1UL << 24), 10, 24> swc;
+
+ const void* p = &swc.modulus;
+ p = &swc.long_lag;
+ p = &swc.short_lag;
+ p = p; // Suppress unused warning.
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/subtract_with_carry/requirements/typedefs.cc b/libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/subtract_with_carry/requirements/typedefs.cc
new file mode 100644
index 000000000..445083446
--- /dev/null
+++ b/libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/subtract_with_carry/requirements/typedefs.cc
@@ -0,0 +1,34 @@
+// { dg-do compile }
+//
+// 2006-06-04 Stephen M. Webb <stephen.webb@bregmasoft.com>
+//
+// Copyright (C) 2006, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// 5.1.4.3 Class template subtract_with_carry
+// 5.1.1 [1] Table 15
+
+#include <tr1/random>
+
+void
+test01()
+{
+ typedef std::tr1::subtract_with_carry<unsigned long, (1UL << 24), 10, 24>
+ test_type;
+
+ typedef test_type::result_type result_type;
+}
diff --git a/libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/subtract_with_carry_01/cons/default.cc b/libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/subtract_with_carry_01/cons/default.cc
new file mode 100644
index 000000000..a094c5521
--- /dev/null
+++ b/libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/subtract_with_carry_01/cons/default.cc
@@ -0,0 +1,47 @@
+// 2006-08-22 Paolo Carlini <pcarlini@suse.de>
+//
+// Copyright (C) 2006, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// 5.1.4.4 class template subtract_with_carry_01 [tr.rand.eng.sub1]
+// 5.1.1 Table 16 line 1 default ctor
+
+#include <tr1/random>
+#include <testsuite_hooks.h>
+
+void
+test01()
+{
+ bool test __attribute__((unused)) = true;
+ using namespace std::tr1;
+
+ subtract_with_carry_01<float, 24, 10, 24> x;
+ VERIFY( x.min() == 0.0 );
+ VERIFY( x.max() == 1.0 );
+
+#if _GLIBCXX_USE_C99_MATH_TR1
+ VERIFY( x() == 15039276 * std::tr1::ldexp(float(1), -24) );
+#else
+ VERIFY( x() == 15039276 * std::pow(float(2), -24) );
+#endif
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/subtract_with_carry_01/cons/gen1.cc b/libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/subtract_with_carry_01/cons/gen1.cc
new file mode 100644
index 000000000..138a1ef2c
--- /dev/null
+++ b/libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/subtract_with_carry_01/cons/gen1.cc
@@ -0,0 +1,51 @@
+// 2006-08-22 Paolo Carlini <pcarlini@suse.de>
+//
+// Copyright (C) 2006, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// 5.1.4.4 class template subtract_with_carry_01 [tr.rand.eng.sub1]
+// 5.1.1 Table 16 line 3 Gen ctor
+
+// { dg-require-time "" }
+
+#include <ctime>
+#include <tr1/random>
+#include <testsuite_hooks.h>
+
+// a not untypical initialization function
+unsigned long
+gen()
+{
+ return std::time(0);
+}
+
+void
+test01()
+{
+ bool test __attribute__((unused)) = true;
+ using namespace std::tr1;
+
+ subtract_with_carry_01<float, 24, 10, 24> x(gen);
+ VERIFY( x.min() == 0.0 );
+ VERIFY( x.max() == 1.0 );
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/subtract_with_carry_01/cons/seed1.cc b/libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/subtract_with_carry_01/cons/seed1.cc
new file mode 100644
index 000000000..b7f12d4bd
--- /dev/null
+++ b/libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/subtract_with_carry_01/cons/seed1.cc
@@ -0,0 +1,39 @@
+// 2006-08-22 Paolo Carlini <pcarlini@suse.de>
+//
+// Copyright (C) 2006, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// 5.1.4.4 class template subtract_with_carry_01 [tr.rand.eng.sub1]
+// 5.1.1 Table 16 line 2 seed ctor
+
+#include <tr1/random>
+#include <testsuite_hooks.h>
+
+void
+test01()
+{
+ using namespace std::tr1;
+
+ unsigned long seed = 2;
+ subtract_with_carry_01<float, 24, 10, 24> x(seed);
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/subtract_with_carry_01/cons/seed2.cc b/libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/subtract_with_carry_01/cons/seed2.cc
new file mode 100644
index 000000000..964bffe41
--- /dev/null
+++ b/libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/subtract_with_carry_01/cons/seed2.cc
@@ -0,0 +1,40 @@
+// 2006-08-22 Paolo Carlini <pcarlini@suse.de>
+//
+// Copyright (C) 2006, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// 5.1.4.4 class template subtract_with_carry_01 [tr.rand.eng.sub1]
+// 5.1.1 Table 16 line 2 seed ctor
+// 5.1.1 (4) point 2: Gen is a fundamental type.
+
+#include <tr1/random>
+#include <testsuite_hooks.h>
+
+void
+test01()
+{
+ using namespace std::tr1;
+
+ double seed = 2.0;
+ subtract_with_carry_01<float, 24, 10, 24> x(seed);
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/subtract_with_carry_01/operators/equal.cc b/libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/subtract_with_carry_01/operators/equal.cc
new file mode 100644
index 000000000..062d3fe56
--- /dev/null
+++ b/libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/subtract_with_carry_01/operators/equal.cc
@@ -0,0 +1,49 @@
+// 2006-08-22 Paolo Carlini <pcarlini@suse.de>
+//
+// Copyright (C) 2006, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// 5.1.4.4 class template subtract_with_carry_01 [tr.rand.eng.sub1]
+// 5.1.1 Table 16
+
+#include <tr1/random>
+#include <testsuite_hooks.h>
+
+void
+test01()
+{
+ bool test __attribute__((unused)) = true;
+ using namespace std::tr1;
+
+ subtract_with_carry_01<float, 24, 10, 24> u;
+ subtract_with_carry_01<float, 24, 10, 24> v;
+
+ VERIFY( u == v );
+
+ for (int i = 0; i < 100; ++i)
+ {
+ u();
+ v();
+ }
+ VERIFY( u == v );
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/subtract_with_carry_01/operators/not_equal.cc b/libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/subtract_with_carry_01/operators/not_equal.cc
new file mode 100644
index 000000000..25b4b4efe
--- /dev/null
+++ b/libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/subtract_with_carry_01/operators/not_equal.cc
@@ -0,0 +1,42 @@
+// 2006-08-22 Paolo Carlini <pcarlini@suse.de>
+//
+// Copyright (C) 2006, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// 5.1.4.4 class template subtract_with_carry_01 [tr.rand.eng.sub1]
+// 5.1.1 Table 16
+
+#include <tr1/random>
+#include <testsuite_hooks.h>
+
+void
+test01()
+{
+ bool test __attribute__((unused)) = true;
+ using namespace std::tr1;
+
+ subtract_with_carry_01<float, 24, 10, 24> u(1);
+ subtract_with_carry_01<float, 24, 10, 24> v(2);
+
+ VERIFY( u != v );
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/subtract_with_carry_01/operators/serialize.cc b/libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/subtract_with_carry_01/operators/serialize.cc
new file mode 100644
index 000000000..5ea668a99
--- /dev/null
+++ b/libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/subtract_with_carry_01/operators/serialize.cc
@@ -0,0 +1,50 @@
+// 2006-08-22 Paolo Carlini <pcarlini@suse.de>
+//
+// Copyright (C) 2006, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// 5.1.4.4 class template subtract_with_carry_01 [tr.rand.eng.sub1]
+// 5.1.1 Table 16
+
+#include <sstream>
+#include <tr1/random>
+#include <testsuite_hooks.h>
+
+void
+test01()
+{
+ bool test __attribute__((unused)) = true;
+ using std::tr1::subtract_with_carry_01;
+
+ std::stringstream str;
+ subtract_with_carry_01<float, 24, 10, 24> u;
+ subtract_with_carry_01<float, 24, 10, 24> v;
+
+ u(); // advance
+ str << u;
+
+ VERIFY( u != v );
+
+ str >> v;
+ VERIFY( u == v );
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/subtract_with_carry_01/requirements/constants.cc b/libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/subtract_with_carry_01/requirements/constants.cc
new file mode 100644
index 000000000..a0a360d73
--- /dev/null
+++ b/libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/subtract_with_carry_01/requirements/constants.cc
@@ -0,0 +1,38 @@
+// { dg-do link }
+//
+// 2009-09-29 Paolo Carlini <paolo.carlini@oracle.com>
+//
+// Copyright (C) 2009, 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+#include <tr1/random>
+
+void test01()
+{
+ std::tr1::ranlux_base_01 swc_01;
+
+ const void* p = &swc_01.word_size;
+ p = &swc_01.long_lag;
+ p = &swc_01.short_lag;
+ p = p; // Suppress unused warning.
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/subtract_with_carry_01/requirements/typedefs.cc b/libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/subtract_with_carry_01/requirements/typedefs.cc
new file mode 100644
index 000000000..7f49a918e
--- /dev/null
+++ b/libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/subtract_with_carry_01/requirements/typedefs.cc
@@ -0,0 +1,33 @@
+// { dg-do compile }
+//
+// 2006-08-22 Paolo Carlini <pcarlini@suse.de>
+//
+// Copyright (C) 2006, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// 5.1.4.4 Class template subtract_with_carry_01
+// 5.1.1 [1] Table 15
+
+#include <tr1/random>
+
+void
+test01()
+{
+ typedef std::tr1::subtract_with_carry_01<float, 24, 10, 24> test_type;
+
+ typedef test_type::result_type result_type;
+}
diff --git a/libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/uniform_int/33128.cc b/libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/uniform_int/33128.cc
new file mode 100644
index 000000000..715f0b78e
--- /dev/null
+++ b/libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/uniform_int/33128.cc
@@ -0,0 +1,42 @@
+// Copyright (C) 2007, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// 5.1.7.1 Class template uniform_int
+// 5.1.1 [7] Table 17
+
+#include <tr1/random>
+#include <testsuite_hooks.h>
+
+// libstdc++/33128
+void test01()
+{
+ bool test __attribute__((unused)) = true;
+
+ std::tr1::mt19937 rng;
+ std::tr1::uniform_int<> six(1,6);
+ std::tr1::variate_generator<std::tr1::mt19937, std::tr1::uniform_int<> >
+ die(rng, six);
+
+ int val = die();
+ VERIFY( val >= 1 && val <= 6 );
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/uniform_int/cons/default.cc b/libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/uniform_int/cons/default.cc
new file mode 100644
index 000000000..ede56698e
--- /dev/null
+++ b/libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/uniform_int/cons/default.cc
@@ -0,0 +1,41 @@
+// 2006-06-04 Stephen M. Webb <stephen.webb@bregmasoft.com>
+//
+// Copyright (C) 2006, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// 5.1.7.1 class template uniform_int
+// 5.1.7.1 [2] constructors and member functions
+
+#include <tr1/random>
+#include <testsuite_hooks.h>
+
+void
+test01()
+{
+ bool test __attribute__((unused)) = true;
+ using namespace std::tr1;
+
+ uniform_int<int> u;
+ VERIFY( u.min() == 0 );
+ VERIFY( u.max() == 9 );
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/uniform_int/cons/range.cc b/libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/uniform_int/cons/range.cc
new file mode 100644
index 000000000..837de2a85
--- /dev/null
+++ b/libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/uniform_int/cons/range.cc
@@ -0,0 +1,41 @@
+// 2006-06-04 Stephen M. Webb <stephen.webb@bregmasoft.com>
+//
+// Copyright (C) 2006, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// 5.1.7.1 class template uniform_int
+// 5.1.7.1 [2] constructors and member functions
+
+#include <tr1/random>
+#include <testsuite_hooks.h>
+
+void
+test01()
+{
+ bool test __attribute__((unused)) = true;
+ using namespace std::tr1;
+
+ uniform_int<int> u(1, 20);
+ VERIFY( u.min() == 1 );
+ VERIFY( u.max() == 20 );
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/uniform_int/requirements/typedefs.cc b/libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/uniform_int/requirements/typedefs.cc
new file mode 100644
index 000000000..b1a35b793
--- /dev/null
+++ b/libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/uniform_int/requirements/typedefs.cc
@@ -0,0 +1,36 @@
+// { dg-do compile }
+//
+// 2006-06-04 Stephen M. Webb <stephen.webb@bregmasoft.com>
+//
+// Copyright (C) 2006, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// 5.1.7.1 Class template uniform_int
+// 5.1.1 [7] Table 17
+
+#include <tr1/random>
+
+void
+test01()
+{
+ using namespace std::tr1;
+
+ typedef uniform_int<int> test_type;
+
+ typedef test_type::input_type input_type;
+ typedef test_type::result_type result_type;
+}
diff --git a/libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/uniform_real/requirements/typedefs.cc b/libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/uniform_real/requirements/typedefs.cc
new file mode 100644
index 000000000..40ce7a1d9
--- /dev/null
+++ b/libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/uniform_real/requirements/typedefs.cc
@@ -0,0 +1,36 @@
+// { dg-do compile }
+//
+// 2006-06-04 Stephen M. Webb <stephen.webb@bregmasoft.com>
+//
+// Copyright (C) 2006, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// 5.1.7.6 Class template uniform_real [tr.rand.dist.runif]
+// 5.1.1 [7] Table 17
+
+#include <tr1/random>
+
+void
+test01()
+{
+ using namespace std::tr1;
+
+ typedef uniform_real<double> test_type;
+
+ typedef test_type::input_type input_type;
+ typedef test_type::result_type result_type;
+}
diff --git a/libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/variate_generator/37986.cc b/libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/variate_generator/37986.cc
new file mode 100644
index 000000000..b32d9daea
--- /dev/null
+++ b/libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/variate_generator/37986.cc
@@ -0,0 +1,48 @@
+// { dg-do compile }
+//
+// Copyright (C) 2008, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// 5.1.3 class template variate_generator
+
+#include <tr1/random>
+
+// libtsdc++/37986
+void test01()
+{
+ std::tr1::mt19937 mt;
+ std::tr1::uniform_real<double> dist;
+
+ std::tr1::variate_generator<
+ std::tr1::mt19937,
+ std::tr1::uniform_real<double>
+ > g1(mt, dist);
+
+ std::tr1::variate_generator<
+ std::tr1::mt19937&,
+ std::tr1::uniform_real<double>
+ > g2(mt, dist);
+
+ std::tr1::variate_generator<
+ std::tr1::mt19937*,
+ std::tr1::uniform_real<double>
+ > g3(&mt, dist);
+
+ g1();
+ g2();
+ g3();
+}
diff --git a/libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/variate_generator/requirements/typedefs.cc b/libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/variate_generator/requirements/typedefs.cc
new file mode 100644
index 000000000..e0e7a54b2
--- /dev/null
+++ b/libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/variate_generator/requirements/typedefs.cc
@@ -0,0 +1,41 @@
+// { dg-do compile }
+//
+// 2006-06-04 Stephen M. Webb <stephen.webb@bregmasoft.com>
+//
+// Copyright (C) 2006, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// 5.1.3 class template variate_generator
+
+#include <tr1/random>
+
+void
+test01()
+{
+ using namespace std::tr1;
+
+ typedef variate_generator
+ <
+ linear_congruential<unsigned long, 16807 , 0 , 2147483647>,
+ uniform_int<int>
+ > test_type;
+
+ typedef test_type::engine_type engine_type;
+ typedef test_type::engine_value_type engine_value_type;
+ typedef test_type::distribution_type distribution_type;
+ typedef test_type::result_type result_type;
+}
diff --git a/libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/xor_combine/cons/default.cc b/libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/xor_combine/cons/default.cc
new file mode 100644
index 000000000..229434f60
--- /dev/null
+++ b/libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/xor_combine/cons/default.cc
@@ -0,0 +1,45 @@
+// 2006-06-15 Paolo Carlini <pcarlini@suse.de>
+//
+// Copyright (C) 2006, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// 5.1.4.6 Class template xor_combine [tr.rand.eng.xor]
+// 5.1.1 Table 15 default ctor
+
+#include <tr1/random>
+#include <testsuite_hooks.h>
+
+void
+test01()
+{
+ bool test __attribute__((unused)) = true;
+
+ using namespace std::tr1;
+ xor_combine
+ <
+ minstd_rand, 1,
+ minstd_rand0, 2
+ > x;
+
+ VERIFY( x() == 32644 );
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/xor_combine/operators/equal.cc b/libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/xor_combine/operators/equal.cc
new file mode 100644
index 000000000..298449c1a
--- /dev/null
+++ b/libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/xor_combine/operators/equal.cc
@@ -0,0 +1,52 @@
+// 2006-06-19 Paolo Carlini <pcarlini@suse.de>
+//
+// Copyright (C) 2006, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// 5.1.4.6 class template xor_combine [tr.rand.eng.xor]
+// 5.1.1 Table 16
+
+#include <tr1/random>
+#include <testsuite_hooks.h>
+
+void
+test01()
+{
+ bool test __attribute__((unused)) = true;
+ using namespace std::tr1;
+
+ xor_combine
+ <
+ minstd_rand, 1,
+ mt19937, 2
+ > u, v;
+
+ VERIFY( u == v );
+
+ for (int i = 0; i < 100; ++i)
+ {
+ u();
+ v();
+ }
+ VERIFY( u == v );
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/xor_combine/operators/not_equal.cc b/libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/xor_combine/operators/not_equal.cc
new file mode 100644
index 000000000..0d9d91789
--- /dev/null
+++ b/libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/xor_combine/operators/not_equal.cc
@@ -0,0 +1,51 @@
+// 2006-06-19 Paolo Carlini <pcarlini@suse.de>
+//
+// Copyright (C) 2006, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// 5.1.4.6 class template discard_block [tr.rand.eng.xor]
+// 5.1.1 Table 16
+
+#include <tr1/random>
+#include <testsuite_hooks.h>
+
+void
+test01()
+{
+ bool test __attribute__((unused)) = true;
+ using namespace std::tr1;
+
+ xor_combine
+ <
+ minstd_rand, 1,
+ mt19937, 2
+ > u(1);
+
+ xor_combine
+ <
+ minstd_rand, 1,
+ mt19937, 2
+ > v(2);
+
+ VERIFY( u != v );
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/xor_combine/operators/serialize.cc b/libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/xor_combine/operators/serialize.cc
new file mode 100644
index 000000000..85eb73c74
--- /dev/null
+++ b/libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/xor_combine/operators/serialize.cc
@@ -0,0 +1,55 @@
+// 2006-06-19 Paolo Carlini <pcarlini@suse.de>
+//
+// Copyright (C) 2006, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// 5.1.4.6 class template xor_combine [tr.rand.eng.xor]
+// 5.1.1 Table 16
+
+#include <sstream>
+#include <tr1/random>
+#include <testsuite_hooks.h>
+
+void
+test01()
+{
+ bool test __attribute__((unused)) = true;
+ using std::tr1::xor_combine;
+ using std::tr1::minstd_rand;
+ using std::tr1::mt19937;
+
+ std::stringstream str;
+ xor_combine
+ <
+ minstd_rand, 1,
+ mt19937, 2
+ > u, v;
+
+ u(); // advance
+ str << u;
+
+ VERIFY( u != v );
+
+ str >> v;
+ VERIFY( u == v );
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/xor_combine/requirements/constants.cc b/libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/xor_combine/requirements/constants.cc
new file mode 100644
index 000000000..3fbd55247
--- /dev/null
+++ b/libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/xor_combine/requirements/constants.cc
@@ -0,0 +1,38 @@
+// { dg-do link }
+//
+// 2009-09-29 Paolo Carlini <paolo.carlini@oracle.com>
+//
+// Copyright (C) 2009, 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+#include <tr1/random>
+
+void test01()
+{
+ std::tr1::xor_combine<std::tr1::minstd_rand, 1, std::tr1::mt19937, 2>
+ xor_c;
+
+ const void* p = &xor_c.shift1;
+ p = &xor_c.shift2;
+ p = p; // Suppress unused warning.
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/xor_combine/requirements/typedefs.cc b/libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/xor_combine/requirements/typedefs.cc
new file mode 100644
index 000000000..db36bdb97
--- /dev/null
+++ b/libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/xor_combine/requirements/typedefs.cc
@@ -0,0 +1,39 @@
+// { dg-do compile }
+//
+// 2006-06-04 Stephen M. Webb <stephen.webb@bregmasoft.com>
+//
+// Copyright (C) 2006, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// 5.1.4.6 Class template xor_combine
+// 5.1.1 [1] Table 15
+
+#include <tr1/random>
+
+void
+test01()
+{
+ using namespace std::tr1;
+
+ typedef xor_combine
+ <
+ minstd_rand, 1,
+ mt19937, 2
+ > test_type;
+
+ typedef test_type::result_type result_type;
+}