summaryrefslogtreecommitdiff
path: root/libstdc++-v3/testsuite/23_containers/forward_list/cons
diff options
context:
space:
mode:
authorupstream source tree <ports@midipix.org>2015-03-15 20:14:05 -0400
committerupstream source tree <ports@midipix.org>2015-03-15 20:14:05 -0400
commit554fd8c5195424bdbcabf5de30fdc183aba391bd (patch)
tree976dc5ab7fddf506dadce60ae936f43f58787092 /libstdc++-v3/testsuite/23_containers/forward_list/cons
downloadcbb-gcc-4.6.4-554fd8c5195424bdbcabf5de30fdc183aba391bd.tar.bz2
cbb-gcc-4.6.4-554fd8c5195424bdbcabf5de30fdc183aba391bd.tar.xz
obtained gcc-4.6.4.tar.bz2 from upstream website;upstream
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.
Diffstat (limited to 'libstdc++-v3/testsuite/23_containers/forward_list/cons')
-rw-r--r--libstdc++-v3/testsuite/23_containers/forward_list/cons/1.cc40
-rw-r--r--libstdc++-v3/testsuite/23_containers/forward_list/cons/2.cc45
-rw-r--r--libstdc++-v3/testsuite/23_containers/forward_list/cons/3.cc43
-rw-r--r--libstdc++-v3/testsuite/23_containers/forward_list/cons/4.cc40
-rw-r--r--libstdc++-v3/testsuite/23_containers/forward_list/cons/5.cc40
-rw-r--r--libstdc++-v3/testsuite/23_containers/forward_list/cons/6.cc43
-rw-r--r--libstdc++-v3/testsuite/23_containers/forward_list/cons/7.cc44
-rw-r--r--libstdc++-v3/testsuite/23_containers/forward_list/cons/8.cc44
-rw-r--r--libstdc++-v3/testsuite/23_containers/forward_list/cons/9.cc40
-rw-r--r--libstdc++-v3/testsuite/23_containers/forward_list/cons/cons_size.cc40
-rw-r--r--libstdc++-v3/testsuite/23_containers/forward_list/cons/moveable.cc47
11 files changed, 466 insertions, 0 deletions
diff --git a/libstdc++-v3/testsuite/23_containers/forward_list/cons/1.cc b/libstdc++-v3/testsuite/23_containers/forward_list/cons/1.cc
new file mode 100644
index 000000000..7dec2a4b4
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/forward_list/cons/1.cc
@@ -0,0 +1,40 @@
+// { dg-options "-std=gnu++0x" }
+
+// Copyright (C) 2008, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// 23.2.3.n forward_list xxx [lib.forward_list.xxx]
+
+#include <forward_list>
+#include <testsuite_hooks.h>
+
+bool test __attribute__((unused)) = true;
+
+// This test verifies the following:
+// Default construction
+void
+test01()
+{
+ std::forward_list<double> fld;
+}
+
+int
+main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/23_containers/forward_list/cons/2.cc b/libstdc++-v3/testsuite/23_containers/forward_list/cons/2.cc
new file mode 100644
index 000000000..eb447274b
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/forward_list/cons/2.cc
@@ -0,0 +1,45 @@
+// { dg-options "-std=gnu++0x" }
+
+// Copyright (C) 2008, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// 23.2.3.n forward_list xxx [lib.forward_list.xxx]
+
+#include <forward_list>
+#include <testsuite_hooks.h>
+
+bool test __attribute__((unused)) = true;
+
+// This test verifies the following:
+// Construction from iterator range
+// Copy construction with allocator
+void
+test01()
+{
+ const int ni = 10;
+ int i[ni] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
+
+ std::forward_list<int> flccin(i, i+ni);
+ std::forward_list<int> flcc(flccin, std::allocator<int>());
+}
+
+int
+main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/23_containers/forward_list/cons/3.cc b/libstdc++-v3/testsuite/23_containers/forward_list/cons/3.cc
new file mode 100644
index 000000000..6197731cb
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/forward_list/cons/3.cc
@@ -0,0 +1,43 @@
+// { dg-options "-std=gnu++0x" }
+
+// Copyright (C) 2008, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// 23.2.3.n forward_list xxx [lib.forward_list.xxx]
+
+#include <forward_list>
+#include <testsuite_hooks.h>
+
+bool test __attribute__((unused)) = true;
+
+// This test verifies the following:
+// Move construction with allocator
+void
+test01()
+{
+ const int ni = 10;
+ int i[ni] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
+
+ std::forward_list<int> flmc(std::forward_list<int>(i, i+ni), std::allocator<int>());
+}
+
+int
+main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/23_containers/forward_list/cons/4.cc b/libstdc++-v3/testsuite/23_containers/forward_list/cons/4.cc
new file mode 100644
index 000000000..3d23719ca
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/forward_list/cons/4.cc
@@ -0,0 +1,40 @@
+// { dg-options "-std=gnu++0x" }
+
+// Copyright (C) 2008, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// 23.2.3.n forward_list xxx [lib.forward_list.xxx]
+
+#include <forward_list>
+#include <testsuite_hooks.h>
+
+bool test __attribute__((unused)) = true;
+
+// This test verifies the following:
+// Construction from given number of default item
+void
+test01()
+{
+ std::forward_list<double> flvd(10);
+}
+
+int
+main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/23_containers/forward_list/cons/5.cc b/libstdc++-v3/testsuite/23_containers/forward_list/cons/5.cc
new file mode 100644
index 000000000..ca7b5f7e6
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/forward_list/cons/5.cc
@@ -0,0 +1,40 @@
+// { dg-options "-std=gnu++0x" }
+
+// Copyright (C) 2008, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// 23.2.3.n forward_list xxx [lib.forward_list.xxx]
+
+#include <forward_list>
+#include <testsuite_hooks.h>
+
+bool test __attribute__((unused)) = true;
+
+// This test verifies the following:
+// Construction from given number of given item
+void
+test01()
+{
+ std::forward_list<float> flv(10, 5.0F);
+}
+
+int
+main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/23_containers/forward_list/cons/6.cc b/libstdc++-v3/testsuite/23_containers/forward_list/cons/6.cc
new file mode 100644
index 000000000..f385661f2
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/forward_list/cons/6.cc
@@ -0,0 +1,43 @@
+// { dg-options "-std=gnu++0x" }
+
+// Copyright (C) 2008, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// 23.2.3.n forward_list xxx [lib.forward_list.xxx]
+
+#include <forward_list>
+#include <testsuite_hooks.h>
+
+bool test __attribute__((unused)) = true;
+
+// This test verifies the following:
+// Construction from iterator range
+void
+test01()
+{
+ const int ni = 10;
+ int i[ni] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
+
+ std::forward_list<int> fl(i, i+ni);
+}
+
+int
+main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/23_containers/forward_list/cons/7.cc b/libstdc++-v3/testsuite/23_containers/forward_list/cons/7.cc
new file mode 100644
index 000000000..f03779134
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/forward_list/cons/7.cc
@@ -0,0 +1,44 @@
+// { dg-options "-std=gnu++0x" }
+
+// Copyright (C) 2008, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// 23.2.3.n forward_list xxx [lib.forward_list.xxx]
+
+#include <forward_list>
+#include <testsuite_hooks.h>
+
+bool test __attribute__((unused)) = true;
+
+// This test verifies the following:
+// Copy construction
+void
+test01()
+{
+ const int ni = 10;
+ int i[ni] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
+
+ std::forward_list<int> fl(i, i+ni);
+ std::forward_list<int> flc(fl);
+}
+
+int
+main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/23_containers/forward_list/cons/8.cc b/libstdc++-v3/testsuite/23_containers/forward_list/cons/8.cc
new file mode 100644
index 000000000..3cf4288f4
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/forward_list/cons/8.cc
@@ -0,0 +1,44 @@
+// { dg-options "-std=gnu++0x" }
+
+// Copyright (C) 2008, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// 23.2.3.n forward_list xxx [lib.forward_list.xxx]
+
+#include <forward_list>
+#include <testsuite_hooks.h>
+
+bool test __attribute__((unused)) = true;
+
+// This test verifies the following:
+// Move construction
+void
+test01()
+{
+ const int ni = 10;
+ int i[ni] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
+
+ std::forward_list<int> fl(i, i+ni);
+ std::forward_list<int> flm(std::move(fl));
+}
+
+int
+main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/23_containers/forward_list/cons/9.cc b/libstdc++-v3/testsuite/23_containers/forward_list/cons/9.cc
new file mode 100644
index 000000000..ce7bb8597
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/forward_list/cons/9.cc
@@ -0,0 +1,40 @@
+// { dg-options "-std=gnu++0x" }
+
+// Copyright (C) 2008, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// 23.2.3.n forward_list xxx [lib.forward_list.xxx]
+
+#include <forward_list>
+#include <testsuite_hooks.h>
+
+bool test __attribute__((unused)) = true;
+
+// This test verifies the following.
+// Construction from initializer list
+void
+test01()
+{
+ std::forward_list<double> flil({1.0, 2.0, 3.0, 4.0, 5.0});
+}
+
+int
+main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/23_containers/forward_list/cons/cons_size.cc b/libstdc++-v3/testsuite/23_containers/forward_list/cons/cons_size.cc
new file mode 100644
index 000000000..3d07f6720
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/forward_list/cons/cons_size.cc
@@ -0,0 +1,40 @@
+// { dg-options "-std=gnu++0x" }
+
+// 2010-02-01 Paolo Carlini <paolo.carlini@oracle.com>
+
+// Copyright (C) 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 <forward_list>
+#include <testsuite_hooks.h>
+#include <testsuite_api.h>
+
+void test01()
+{
+ bool test __attribute__((unused)) = true;
+
+ std::forward_list<__gnu_test::NonCopyConstructible> fl(1000);
+ VERIFY( std::distance(fl.begin(), fl.end()) == 1000 );
+ for(auto it = fl.begin(); it != fl.end(); ++it)
+ VERIFY( *it == -1 );
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/23_containers/forward_list/cons/moveable.cc b/libstdc++-v3/testsuite/23_containers/forward_list/cons/moveable.cc
new file mode 100644
index 000000000..e680d3c8e
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/forward_list/cons/moveable.cc
@@ -0,0 +1,47 @@
+// { dg-options "-std=gnu++0x" }
+
+// Copyright (C) 2008, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+
+// NOTE: This makes use of the fact that we know how moveable
+// is implemented on list (via swap). If the implementation changed
+// this test may begin to fail.
+
+#include <forward_list>
+#include <utility>
+#include <testsuite_hooks.h>
+
+bool test __attribute__((unused)) = true;
+
+int main()
+{
+ std::forward_list<int> a, b;
+ a.push_front(1);
+
+ b = std::move(a);
+ VERIFY(b.empty() == false);
+ VERIFY(*b.begin() == 1);
+ VERIFY(a.empty() == true);
+
+ std::forward_list<int> c(std::move(b));
+ VERIFY(c.empty() == false);
+ (*c.begin() == 1 );
+ VERIFY( b.empty() == true );
+
+ return 0;
+}