summaryrefslogtreecommitdiff
path: root/libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/discard_block
diff options
context:
space:
mode:
Diffstat (limited to 'libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/discard_block')
-rw-r--r--libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/discard_block/operators/equal.cc52
-rw-r--r--libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/discard_block/operators/not_equal.cc51
-rw-r--r--libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/discard_block/operators/serialize.cc54
-rw-r--r--libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/discard_block/requirements/constants.cc37
-rw-r--r--libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/discard_block/requirements/typedefs.cc39
5 files changed, 233 insertions, 0 deletions
diff --git a/libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/discard_block/operators/equal.cc b/libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/discard_block/operators/equal.cc
new file mode 100644
index 000000000..146b502af
--- /dev/null
+++ b/libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/discard_block/operators/equal.cc
@@ -0,0 +1,52 @@
+// 2006-06-19 Paolo Carlini <pcarlini@suse.de>
+//
+// Copyright (C) 2006, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// 5.1.4.5 class template discard_block [tr.rand.eng.disc]
+// 5.1.1 Table 16
+
+#include <tr1/random>
+#include <testsuite_hooks.h>
+
+void
+test01()
+{
+ bool test __attribute__((unused)) = true;
+ using namespace std::tr1;
+
+ discard_block
+ <
+ subtract_with_carry<long, (1 << 24), 10, 24>,
+ 389, 24
+ > u, v;
+
+ VERIFY( u == v );
+
+ for (int i = 0; i < 100; ++i)
+ {
+ u();
+ v();
+ }
+ VERIFY( u == v );
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/discard_block/operators/not_equal.cc b/libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/discard_block/operators/not_equal.cc
new file mode 100644
index 000000000..0e3cb0fa5
--- /dev/null
+++ b/libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/discard_block/operators/not_equal.cc
@@ -0,0 +1,51 @@
+// 2006-06-19 Paolo Carlini <pcarlini@suse.de>
+//
+// Copyright (C) 2006, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// 5.1.4.5 class template discard_block [tr.rand.eng.disc]
+// 5.1.1 Table 16
+
+#include <tr1/random>
+#include <testsuite_hooks.h>
+
+void
+test01()
+{
+ bool test __attribute__((unused)) = true;
+ using namespace std::tr1;
+
+ discard_block
+ <
+ subtract_with_carry<long, (1 << 24), 10, 24>,
+ 389, 24
+ > u(1);
+
+ discard_block
+ <
+ subtract_with_carry<long, (1 << 24), 10, 24>,
+ 389, 24
+ > v(2);
+
+ VERIFY( u != v );
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/discard_block/operators/serialize.cc b/libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/discard_block/operators/serialize.cc
new file mode 100644
index 000000000..716a1d839
--- /dev/null
+++ b/libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/discard_block/operators/serialize.cc
@@ -0,0 +1,54 @@
+// 2006-06-19 Paolo Carlini <pcarlini@suse.de>
+//
+// Copyright (C) 2006, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// 5.1.4.5 class template discard_block [tr.rand.eng.disc]
+// 5.1.1 Table 16
+
+#include <sstream>
+#include <tr1/random>
+#include <testsuite_hooks.h>
+
+void
+test01()
+{
+ bool test __attribute__((unused)) = true;
+ using std::tr1::discard_block;
+ using std::tr1::subtract_with_carry;
+
+ std::stringstream str;
+ discard_block
+ <
+ subtract_with_carry<long, (1 << 24), 10, 24>,
+ 389, 24
+ > u, v;
+
+ u(); // advance
+ str << u;
+
+ VERIFY( u != v );
+
+ str >> v;
+ VERIFY( u == v );
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/discard_block/requirements/constants.cc b/libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/discard_block/requirements/constants.cc
new file mode 100644
index 000000000..be04a2c90
--- /dev/null
+++ b/libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/discard_block/requirements/constants.cc
@@ -0,0 +1,37 @@
+// { dg-do link }
+//
+// 2009-09-29 Paolo Carlini <paolo.carlini@oracle.com>
+//
+// Copyright (C) 2009, 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+#include <tr1/random>
+
+void test01()
+{
+ std::tr1::ranlux3 db;
+
+ const void* p = &db.block_size;
+ p = &db.used_block;
+ p = p; // Suppress unused warning.
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/discard_block/requirements/typedefs.cc b/libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/discard_block/requirements/typedefs.cc
new file mode 100644
index 000000000..6e138083f
--- /dev/null
+++ b/libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/discard_block/requirements/typedefs.cc
@@ -0,0 +1,39 @@
+// { dg-do compile }
+//
+// 2006-06-04 Stephen M. Webb <stephen.webb@bregmasoft.com>
+//
+// Copyright (C) 2006, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// 5.1.4.5 Class template linear_congruential
+// 5.1.1 [1] Table 15
+
+#include <tr1/random>
+
+void
+test01()
+{
+ using namespace std::tr1;
+
+ typedef discard_block
+ <
+ subtract_with_carry<long, (1 << 24), 10, 24>,
+ 389, 24
+ > test_type;
+
+ typedef test_type::result_type result_type;
+}