From 554fd8c5195424bdbcabf5de30fdc183aba391bd Mon Sep 17 00:00:00 2001 From: upstream source tree Date: Sun, 15 Mar 2015 20:14:05 -0400 Subject: obtained gcc-4.6.4.tar.bz2 from upstream website; verified gcc-4.6.4.tar.bz2.sig; imported gcc-4.6.4 source tree from verified upstream tarball. downloading a git-generated archive based on the 'upstream' tag should provide you with a source tree that is binary identical to the one extracted from the above tarball. if you have obtained the source via the command 'git clone', however, do note that line-endings of files in your working directory might differ from line-endings of the respective files in the upstream repository. --- .../requirements/typedefs.cc | 36 ++++++++++++++ .../binomial_distribution/requirements/typedefs.cc | 36 ++++++++++++++ .../random/discard_block/operators/equal.cc | 52 ++++++++++++++++++++ .../random/discard_block/operators/not_equal.cc | 51 ++++++++++++++++++++ .../random/discard_block/operators/serialize.cc | 54 +++++++++++++++++++++ .../random/discard_block/requirements/constants.cc | 37 ++++++++++++++ .../random/discard_block/requirements/typedefs.cc | 39 +++++++++++++++ .../requirements/typedefs.cc | 36 ++++++++++++++ .../gamma_distribution/requirements/typedefs.cc | 36 ++++++++++++++ .../requirements/typedefs.cc | 36 ++++++++++++++ .../random/linear_congruential/cons/default.cc | 42 ++++++++++++++++ .../random/linear_congruential/cons/gen1.cc | 51 ++++++++++++++++++++ .../random/linear_congruential/cons/seed1.cc | 39 +++++++++++++++ .../random/linear_congruential/cons/seed2.cc | 39 +++++++++++++++ .../random/linear_congruential/operators/equal.cc | 43 +++++++++++++++++ .../linear_congruential/operators/not_equal.cc | 43 +++++++++++++++++ .../linear_congruential/operators/serialize.cc | 49 +++++++++++++++++++ .../linear_congruential/requirements/constants.cc | 38 +++++++++++++++ .../requirements/non_uint_neg.cc | 31 ++++++++++++ .../linear_congruential/requirements/typedefs.cc | 33 +++++++++++++ .../random/mersenne_twister/cons/default.cc | 47 ++++++++++++++++++ .../random/mersenne_twister/cons/gen1.cc | 56 ++++++++++++++++++++++ .../random/mersenne_twister/cons/seed1.cc | 43 +++++++++++++++++ .../random/mersenne_twister/cons/seed2.cc | 44 +++++++++++++++++ .../random/mersenne_twister/operators/equal.cc | 52 ++++++++++++++++++++ .../random/mersenne_twister/operators/not_equal.cc | 51 ++++++++++++++++++++ .../random/mersenne_twister/operators/serialize.cc | 53 ++++++++++++++++++++ .../mersenne_twister/requirements/constants.cc | 46 ++++++++++++++++++ .../mersenne_twister/requirements/typedefs.cc | 37 ++++++++++++++ .../5_numerical_facilities/random/minstd_rand.cc | 42 ++++++++++++++++ .../5_numerical_facilities/random/minstd_rand0.cc | 42 ++++++++++++++++ .../tr1/5_numerical_facilities/random/mt19937.cc | 42 ++++++++++++++++ .../normal_distribution/requirements/typedefs.cc | 36 ++++++++++++++ .../poisson_distribution/requirements/typedefs.cc | 36 ++++++++++++++ .../random/random_device/cons/default.cc | 42 ++++++++++++++++ .../random/random_device/cons/token.cc | 46 ++++++++++++++++++ .../random/random_device/requirements/typedefs.cc | 31 ++++++++++++ .../tr1/5_numerical_facilities/random/ranlux3.cc | 43 +++++++++++++++++ .../5_numerical_facilities/random/ranlux3_01.cc | 47 ++++++++++++++++++ .../tr1/5_numerical_facilities/random/ranlux4.cc | 42 ++++++++++++++++ .../5_numerical_facilities/random/ranlux4_01.cc | 46 ++++++++++++++++++ .../random/subtract_with_carry/cons/default.cc | 42 ++++++++++++++++ .../random/subtract_with_carry/cons/gen1.cc | 51 ++++++++++++++++++++ .../random/subtract_with_carry/cons/seed1.cc | 39 +++++++++++++++ .../random/subtract_with_carry/cons/seed2.cc | 40 ++++++++++++++++ .../random/subtract_with_carry/operators/equal.cc | 49 +++++++++++++++++++ .../subtract_with_carry/operators/not_equal.cc | 42 ++++++++++++++++ .../subtract_with_carry/operators/serialize.cc | 50 +++++++++++++++++++ .../subtract_with_carry/requirements/constants.cc | 38 +++++++++++++++ .../subtract_with_carry/requirements/typedefs.cc | 34 +++++++++++++ .../random/subtract_with_carry_01/cons/default.cc | 47 ++++++++++++++++++ .../random/subtract_with_carry_01/cons/gen1.cc | 51 ++++++++++++++++++++ .../random/subtract_with_carry_01/cons/seed1.cc | 39 +++++++++++++++ .../random/subtract_with_carry_01/cons/seed2.cc | 40 ++++++++++++++++ .../subtract_with_carry_01/operators/equal.cc | 49 +++++++++++++++++++ .../subtract_with_carry_01/operators/not_equal.cc | 42 ++++++++++++++++ .../subtract_with_carry_01/operators/serialize.cc | 50 +++++++++++++++++++ .../requirements/constants.cc | 38 +++++++++++++++ .../requirements/typedefs.cc | 33 +++++++++++++ .../random/uniform_int/33128.cc | 42 ++++++++++++++++ .../random/uniform_int/cons/default.cc | 41 ++++++++++++++++ .../random/uniform_int/cons/range.cc | 41 ++++++++++++++++ .../random/uniform_int/requirements/typedefs.cc | 36 ++++++++++++++ .../random/uniform_real/requirements/typedefs.cc | 36 ++++++++++++++ .../random/variate_generator/37986.cc | 48 +++++++++++++++++++ .../variate_generator/requirements/typedefs.cc | 41 ++++++++++++++++ .../random/xor_combine/cons/default.cc | 45 +++++++++++++++++ .../random/xor_combine/operators/equal.cc | 52 ++++++++++++++++++++ .../random/xor_combine/operators/not_equal.cc | 51 ++++++++++++++++++++ .../random/xor_combine/operators/serialize.cc | 55 +++++++++++++++++++++ .../random/xor_combine/requirements/constants.cc | 38 +++++++++++++++ .../random/xor_combine/requirements/typedefs.cc | 39 +++++++++++++++ 72 files changed, 3084 insertions(+) create mode 100644 libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/bernoulli_distribution/requirements/typedefs.cc create mode 100644 libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/binomial_distribution/requirements/typedefs.cc create mode 100644 libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/discard_block/operators/equal.cc create mode 100644 libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/discard_block/operators/not_equal.cc create mode 100644 libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/discard_block/operators/serialize.cc create mode 100644 libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/discard_block/requirements/constants.cc create mode 100644 libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/discard_block/requirements/typedefs.cc create mode 100644 libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/exponential_distribution/requirements/typedefs.cc create mode 100644 libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/gamma_distribution/requirements/typedefs.cc create mode 100644 libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/geometric_distribution/requirements/typedefs.cc create mode 100644 libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/linear_congruential/cons/default.cc create mode 100644 libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/linear_congruential/cons/gen1.cc create mode 100644 libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/linear_congruential/cons/seed1.cc create mode 100644 libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/linear_congruential/cons/seed2.cc create mode 100644 libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/linear_congruential/operators/equal.cc create mode 100644 libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/linear_congruential/operators/not_equal.cc create mode 100644 libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/linear_congruential/operators/serialize.cc create mode 100644 libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/linear_congruential/requirements/constants.cc create mode 100644 libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/linear_congruential/requirements/non_uint_neg.cc create mode 100644 libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/linear_congruential/requirements/typedefs.cc create mode 100644 libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/mersenne_twister/cons/default.cc create mode 100644 libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/mersenne_twister/cons/gen1.cc create mode 100644 libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/mersenne_twister/cons/seed1.cc create mode 100644 libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/mersenne_twister/cons/seed2.cc create mode 100644 libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/mersenne_twister/operators/equal.cc create mode 100644 libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/mersenne_twister/operators/not_equal.cc create mode 100644 libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/mersenne_twister/operators/serialize.cc create mode 100644 libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/mersenne_twister/requirements/constants.cc create mode 100644 libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/mersenne_twister/requirements/typedefs.cc create mode 100644 libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/minstd_rand.cc create mode 100644 libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/minstd_rand0.cc create mode 100644 libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/mt19937.cc create mode 100644 libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/normal_distribution/requirements/typedefs.cc create mode 100644 libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/poisson_distribution/requirements/typedefs.cc create mode 100644 libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/random_device/cons/default.cc create mode 100644 libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/random_device/cons/token.cc create mode 100644 libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/random_device/requirements/typedefs.cc create mode 100644 libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/ranlux3.cc create mode 100644 libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/ranlux3_01.cc create mode 100644 libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/ranlux4.cc create mode 100644 libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/ranlux4_01.cc create mode 100644 libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/subtract_with_carry/cons/default.cc create mode 100644 libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/subtract_with_carry/cons/gen1.cc create mode 100644 libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/subtract_with_carry/cons/seed1.cc create mode 100644 libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/subtract_with_carry/cons/seed2.cc create mode 100644 libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/subtract_with_carry/operators/equal.cc create mode 100644 libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/subtract_with_carry/operators/not_equal.cc create mode 100644 libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/subtract_with_carry/operators/serialize.cc create mode 100644 libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/subtract_with_carry/requirements/constants.cc create mode 100644 libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/subtract_with_carry/requirements/typedefs.cc create mode 100644 libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/subtract_with_carry_01/cons/default.cc create mode 100644 libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/subtract_with_carry_01/cons/gen1.cc create mode 100644 libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/subtract_with_carry_01/cons/seed1.cc create mode 100644 libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/subtract_with_carry_01/cons/seed2.cc create mode 100644 libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/subtract_with_carry_01/operators/equal.cc create mode 100644 libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/subtract_with_carry_01/operators/not_equal.cc create mode 100644 libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/subtract_with_carry_01/operators/serialize.cc create mode 100644 libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/subtract_with_carry_01/requirements/constants.cc create mode 100644 libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/subtract_with_carry_01/requirements/typedefs.cc create mode 100644 libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/uniform_int/33128.cc create mode 100644 libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/uniform_int/cons/default.cc create mode 100644 libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/uniform_int/cons/range.cc create mode 100644 libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/uniform_int/requirements/typedefs.cc create mode 100644 libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/uniform_real/requirements/typedefs.cc create mode 100644 libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/variate_generator/37986.cc create mode 100644 libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/variate_generator/requirements/typedefs.cc create mode 100644 libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/xor_combine/cons/default.cc create mode 100644 libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/xor_combine/operators/equal.cc create mode 100644 libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/xor_combine/operators/not_equal.cc create mode 100644 libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/xor_combine/operators/serialize.cc create mode 100644 libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/xor_combine/requirements/constants.cc create mode 100644 libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/xor_combine/requirements/typedefs.cc (limited to 'libstdc++-v3/testsuite/tr1/5_numerical_facilities/random') 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 +// +// 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 +// . + +// 5.1.7.2 Class template bernoulli_distribution [tr.rand.dist.bern] +// 5.1.1 [7] Table 17 + +#include + +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 +// +// 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 +// . + +// 5.1.7.5 Class template binomial_distribution [tr.rand.dist.bin] +// 5.1.1 [7] Table 17 + +#include + +void +test01() +{ + using namespace std::tr1; + + typedef binomial_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/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 +// +// 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 +// . + +// 5.1.4.5 class template discard_block [tr.rand.eng.disc] +// 5.1.1 Table 16 + +#include +#include + +void +test01() +{ + bool test __attribute__((unused)) = true; + using namespace std::tr1; + + discard_block + < + subtract_with_carry, + 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 +// +// 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 +// . + +// 5.1.4.5 class template discard_block [tr.rand.eng.disc] +// 5.1.1 Table 16 + +#include +#include + +void +test01() +{ + bool test __attribute__((unused)) = true; + using namespace std::tr1; + + discard_block + < + subtract_with_carry, + 389, 24 + > u(1); + + discard_block + < + subtract_with_carry, + 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 +// +// 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 +// . + +// 5.1.4.5 class template discard_block [tr.rand.eng.disc] +// 5.1.1 Table 16 + +#include +#include +#include + +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, + 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 +// +// 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 +// . + +#include + +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 +// +// 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 +// . + +// 5.1.4.5 Class template linear_congruential +// 5.1.1 [1] Table 15 + +#include + +void +test01() +{ + using namespace std::tr1; + + typedef discard_block + < + subtract_with_carry, + 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 +// +// 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 +// . + +// 5.1.7.7 Class template exponential_distribution [tr.rand.dist.exp] +// 5.1.1 [7] Table 17 + +#include + +void +test01() +{ + using namespace std::tr1; + + typedef exponential_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/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 +// +// 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 +// . + +// 5.1.7.9 Class template gamma_distribution [tr.rand.dist.gamma] +// 5.1.1 [7] Table 17 + +#include + +void +test01() +{ + using namespace std::tr1; + + typedef gamma_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/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 +// +// 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 +// . + +// 5.1.7.3 Class template geometric_distribution [tr.rand.dist.geom] +// 5.1.1 [7] Table 17 + +#include + +void +test01() +{ + using namespace std::tr1; + + typedef geometric_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/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 +// +// 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 +// . + +// 5.1.4.1 class template linear_congruential [tr.rand.eng.lcong] +// 5.1.4.1 [4] + +#include +#include + +void +test01() +{ + bool test __attribute__((unused)) = true; + using namespace std::tr1; + + linear_congruential 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 +// +// 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 +// . + +// 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 +#include +#include + +// 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 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 +// +// 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 +// . + +// 5.1.4.1 class template linear_congruential [tr.rand.eng.lcong] +// 5.1.1 [4] para 2 + +#include +#include + +void +test01() +{ + using namespace std::tr1; + + unsigned long seed = 2; + linear_congruential 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 +// +// 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 +// . + +// 5.1.4.1 class template linear_congruential [tr.rand.eng.lcong] +// 5.1.1 [4] para 2 + +#include +#include + +void +test01() +{ + using namespace std::tr1; + + double seed = 2.0; + linear_congruential 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 +// +// 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 +// . + +// 5.1.4.1 Class template linear_congruential +// 5.1 [3] Table 16 + +#include +#include + +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 +// +// 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 +// . + +// 5.1.4.1 Class template linear_congruential +// 5.1 [3] Table 16 + +#include +#include + +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 +// +// 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 +// . + +// 5.1.4.1 Class template linear_congruential +// 5.1 [3] Table 16 + +#include +#include +#include + +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 +// +// 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 +// . + +#include + +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 +// +// 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 +// . + +// { 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 + +std::tr1::linear_congruential 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 +// +// 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 +// . + +// 5.1.4.1 Class template linear_congruential +// 5.1.1 [1] Table 15 + +#include + +void +test01() +{ + typedef std::tr1::linear_congruential 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 +// +// 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 +// . + +// 5.1.4.2 class template mersenne_twister [tr.rand.eng.mers] +// 5.1.1 Table 16 line 1 default ctor + +#include +#include + +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 +// +// 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 +// . + +// 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 +#include +#include + +// 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 +// +// 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 +// . + +// 5.1.4.2 class template mersenne_twister [tr.rand.eng.mers] +// 5.1.1 Table 16 line 2 seed ctor + +#include +#include + +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 +// +// 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 +// . + +// 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 +#include + +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 +// +// 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 +// . + +// 5.1.4.2 class template mersenne_twister [tr.rand.eng.mers] +// 5.1.1 Table 16 + +#include +#include + +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 +// +// 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 +// . + +// 5.1.4.2 class template mersenne_twister [tr.rand.eng.mers] +// 5.1.1 Table 16 + +#include +#include + +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 +// +// 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 +// . + +// 5.1.4.2 class template mersenne_twister [tr.rand.eng.mers] +// 5.1.1 Table 16 + +#include +#include +#include + +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 +// +// 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 +// . + +#include + +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 +// +// 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 +// . + +// 5.1.4.2 Class template mersenne_twister +// 5.1.1 [1] Table 15 + +#include + +void +test01() +{ + typedef std::tr1::mersenne_twister 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 +// +// 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 +// . + +// 5.1.5 Engines with predefined parameters +// 5.1.5 [1] + +#include +#include + +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 +// +// 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 +// . + +// 5.1.5 Engines with predefined parameters +// 5.1.5 [1] + +#include +#include + +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 +// +// 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 +// . + +// 5.1.5 Engines with predefined parameters +// 5.1.5 [2] + +#include +#include + +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 +// +// 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 +// . + +// 5.1.7.8 Class template normal_distribution [tr.rand.dist.norm] +// 5.1.1 [7] Table 17 + +#include + +void +test01() +{ + using namespace std::tr1; + + typedef normal_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/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 +// +// 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 +// . + +// 5.1.7.4 Class template poisson_distribution [tr.rand.dist.pois] +// 5.1.1 [7] Table 17 + +#include + +void +test01() +{ + using namespace std::tr1; + + typedef poisson_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/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 +// +// 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 +// . + +// 5.1.6 class random_device [tr.rand.device] +// 5.1.1 Table 15 default ctor + +#include +#include + +void +test01() +{ + bool test __attribute__((unused)) = true; + + using namespace std::tr1; + random_device x; + + VERIFY( x.min() == std::numeric_limits::min() ); + VERIFY( x.max() == std::numeric_limits::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 +// +// 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 +// . + +// 5.1.6 class random_device [tr.rand.device] +// 5.1.6, p3 + +#include +#include + +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::min() ); + VERIFY( x.max() == std::numeric_limits::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 +// +// 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 +// . + +// 5.1.6 class random_device [tr.rand.device] + +#include + +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 +// +// 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 +// . + +// 5.1.5 Engines with predefined parameters +// 5.1.5 [3] + +#include +#include +#include + +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 +// +// 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 +// . + +// 5.1.5 Engines with predefined parameters +// 5.1.5 [3] + +#include +#include +#include + +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 +// +// 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 +// . + +// 5.1.5 Engines with predefined parameters +// 5.1.5 [3] + +#include +#include + +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 +// +// 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 +// . + +// 5.1.5 Engines with predefined parameters +// 5.1.5 [3] + +#include +#include + +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 +// +// 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 +// . + +// 5.1.4.3 class template subtract_with_carry [tr.rand.eng.sub] +// 5.1.1 Table 16 line 1 default ctor + +#include +#include + +void +test01() +{ + bool test __attribute__((unused)) = true; + using namespace std::tr1; + + subtract_with_carry 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 +// +// 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 +// . + +// 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 +#include +#include + +// 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 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 +// +// 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 +// . + +// 5.1.4.3 class template subtract_with_carry [tr.rand.eng.sub] +// 5.1.1 Table 16 line 2 seed ctor + +#include +#include + +void +test01() +{ + using namespace std::tr1; + + unsigned long seed = 2; + subtract_with_carry 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 +// +// 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 +// . + +// 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 +#include + +void +test01() +{ + using namespace std::tr1; + + double seed = 2.0; + subtract_with_carry 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 +// +// 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 +// . + +// 5.1.4.3 class template subtract_with_carry [tr.rand.eng.sub] +// 5.1.1 Table 16 + +#include +#include + +void +test01() +{ + bool test __attribute__((unused)) = true; + using namespace std::tr1; + + subtract_with_carry u; + subtract_with_carry 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 +// +// 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 +// . + +// 5.1.4.3 class template subtract_with_carry [tr.rand.eng.sub] +// 5.1.1 Table 16 + +#include +#include + +void +test01() +{ + bool test __attribute__((unused)) = true; + using namespace std::tr1; + + subtract_with_carry u(1); + subtract_with_carry 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 +// +// 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 +// . + +// 5.1.4.3 class template subtract_with_carry [tr.rand.eng.sub] +// 5.1.1 Table 16 + +#include +#include +#include + +void +test01() +{ + bool test __attribute__((unused)) = true; + using std::tr1::subtract_with_carry; + + std::stringstream str; + subtract_with_carry u; + subtract_with_carry 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 +// +// 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 +// . + +#include + +void test01() +{ + std::tr1::subtract_with_carry 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 +// +// 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 +// . + +// 5.1.4.3 Class template subtract_with_carry +// 5.1.1 [1] Table 15 + +#include + +void +test01() +{ + typedef std::tr1::subtract_with_carry + 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 +// +// 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 +// . + +// 5.1.4.4 class template subtract_with_carry_01 [tr.rand.eng.sub1] +// 5.1.1 Table 16 line 1 default ctor + +#include +#include + +void +test01() +{ + bool test __attribute__((unused)) = true; + using namespace std::tr1; + + subtract_with_carry_01 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 +// +// 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 +// . + +// 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 +#include +#include + +// 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 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 +// +// 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 +// . + +// 5.1.4.4 class template subtract_with_carry_01 [tr.rand.eng.sub1] +// 5.1.1 Table 16 line 2 seed ctor + +#include +#include + +void +test01() +{ + using namespace std::tr1; + + unsigned long seed = 2; + subtract_with_carry_01 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 +// +// 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 +// . + +// 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 +#include + +void +test01() +{ + using namespace std::tr1; + + double seed = 2.0; + subtract_with_carry_01 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 +// +// 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 +// . + +// 5.1.4.4 class template subtract_with_carry_01 [tr.rand.eng.sub1] +// 5.1.1 Table 16 + +#include +#include + +void +test01() +{ + bool test __attribute__((unused)) = true; + using namespace std::tr1; + + subtract_with_carry_01 u; + subtract_with_carry_01 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 +// +// 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 +// . + +// 5.1.4.4 class template subtract_with_carry_01 [tr.rand.eng.sub1] +// 5.1.1 Table 16 + +#include +#include + +void +test01() +{ + bool test __attribute__((unused)) = true; + using namespace std::tr1; + + subtract_with_carry_01 u(1); + subtract_with_carry_01 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 +// +// 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 +// . + +// 5.1.4.4 class template subtract_with_carry_01 [tr.rand.eng.sub1] +// 5.1.1 Table 16 + +#include +#include +#include + +void +test01() +{ + bool test __attribute__((unused)) = true; + using std::tr1::subtract_with_carry_01; + + std::stringstream str; + subtract_with_carry_01 u; + subtract_with_carry_01 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 +// +// 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 +// . + +#include + +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 +// +// 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 +// . + +// 5.1.4.4 Class template subtract_with_carry_01 +// 5.1.1 [1] Table 15 + +#include + +void +test01() +{ + typedef std::tr1::subtract_with_carry_01 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 +// . + +// 5.1.7.1 Class template uniform_int +// 5.1.1 [7] Table 17 + +#include +#include + +// libstdc++/33128 +void test01() +{ + bool test __attribute__((unused)) = true; + + std::tr1::mt19937 rng; + std::tr1::uniform_int<> six(1,6); + std::tr1::variate_generator > + 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 +// +// 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 +// . + +// 5.1.7.1 class template uniform_int +// 5.1.7.1 [2] constructors and member functions + +#include +#include + +void +test01() +{ + bool test __attribute__((unused)) = true; + using namespace std::tr1; + + uniform_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 +// +// 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 +// . + +// 5.1.7.1 class template uniform_int +// 5.1.7.1 [2] constructors and member functions + +#include +#include + +void +test01() +{ + bool test __attribute__((unused)) = true; + using namespace std::tr1; + + uniform_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 +// +// 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 +// . + +// 5.1.7.1 Class template uniform_int +// 5.1.1 [7] Table 17 + +#include + +void +test01() +{ + using namespace std::tr1; + + typedef uniform_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 +// +// 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 +// . + +// 5.1.7.6 Class template uniform_real [tr.rand.dist.runif] +// 5.1.1 [7] Table 17 + +#include + +void +test01() +{ + using namespace std::tr1; + + typedef uniform_real 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 +// . + +// 5.1.3 class template variate_generator + +#include + +// libtsdc++/37986 +void test01() +{ + std::tr1::mt19937 mt; + std::tr1::uniform_real dist; + + std::tr1::variate_generator< + std::tr1::mt19937, + std::tr1::uniform_real + > g1(mt, dist); + + std::tr1::variate_generator< + std::tr1::mt19937&, + std::tr1::uniform_real + > g2(mt, dist); + + std::tr1::variate_generator< + std::tr1::mt19937*, + std::tr1::uniform_real + > 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 +// +// 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 +// . + +// 5.1.3 class template variate_generator + +#include + +void +test01() +{ + using namespace std::tr1; + + typedef variate_generator + < + linear_congruential, + uniform_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 +// +// 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 +// . + +// 5.1.4.6 Class template xor_combine [tr.rand.eng.xor] +// 5.1.1 Table 15 default ctor + +#include +#include + +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 +// +// 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 +// . + +// 5.1.4.6 class template xor_combine [tr.rand.eng.xor] +// 5.1.1 Table 16 + +#include +#include + +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 +// +// 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 +// . + +// 5.1.4.6 class template discard_block [tr.rand.eng.xor] +// 5.1.1 Table 16 + +#include +#include + +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 +// +// 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 +// . + +// 5.1.4.6 class template xor_combine [tr.rand.eng.xor] +// 5.1.1 Table 16 + +#include +#include +#include + +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 +// +// 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 +// . + +#include + +void test01() +{ + std::tr1::xor_combine + 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 +// +// 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 +// . + +// 5.1.4.6 Class template xor_combine +// 5.1.1 [1] Table 15 + +#include + +void +test01() +{ + using namespace std::tr1; + + typedef xor_combine + < + minstd_rand, 1, + mt19937, 2 + > test_type; + + typedef test_type::result_type result_type; +} -- cgit v1.2.3