summaryrefslogtreecommitdiff
path: root/libstdc++-v3/testsuite/tr1/6_containers/array/requirements
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/tr1/6_containers/array/requirements
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/tr1/6_containers/array/requirements')
-rw-r--r--libstdc++-v3/testsuite/tr1/6_containers/array/requirements/assign.cc46
-rw-r--r--libstdc++-v3/testsuite/tr1/6_containers/array/requirements/contiguous.cc46
-rw-r--r--libstdc++-v3/testsuite/tr1/6_containers/array/requirements/explicit_instantiation.cc27
-rw-r--r--libstdc++-v3/testsuite/tr1/6_containers/array/requirements/member_swap.cc48
-rw-r--r--libstdc++-v3/testsuite/tr1/6_containers/array/requirements/typedefs.cc40
-rw-r--r--libstdc++-v3/testsuite/tr1/6_containers/array/requirements/zero_sized_arrays.cc61
6 files changed, 268 insertions, 0 deletions
diff --git a/libstdc++-v3/testsuite/tr1/6_containers/array/requirements/assign.cc b/libstdc++-v3/testsuite/tr1/6_containers/array/requirements/assign.cc
new file mode 100644
index 000000000..5925cc796
--- /dev/null
+++ b/libstdc++-v3/testsuite/tr1/6_containers/array/requirements/assign.cc
@@ -0,0 +1,46 @@
+// 2006-02-24 Paolo Carlini <pcarlini@suse.de>
+//
+// Copyright (C) 2006, 2007, 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/>.
+
+// 6.2.2 Class template array
+
+#include <tr1/array>
+#include <testsuite_hooks.h>
+
+void
+test01()
+{
+ bool test __attribute__((unused)) = true;
+
+ const size_t len = 3;
+ typedef std::tr1::array<int, len> array_type;
+
+ array_type a = { { 0, 1, 2 } };
+ const int value = 5;
+
+ a.assign(value);
+ VERIFY( a[0] == value );
+ VERIFY( a[1] == value );
+ VERIFY( a[2] == value );
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/tr1/6_containers/array/requirements/contiguous.cc b/libstdc++-v3/testsuite/tr1/6_containers/array/requirements/contiguous.cc
new file mode 100644
index 000000000..e22b96cbe
--- /dev/null
+++ b/libstdc++-v3/testsuite/tr1/6_containers/array/requirements/contiguous.cc
@@ -0,0 +1,46 @@
+// 2004-10-20 Benjamin Kosnik <bkoz@redhat.com>
+//
+// Copyright (C) 2004, 2005, 2006, 2007, 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/>.
+
+// 6.2.2 Class template array
+
+#include <tr1/array>
+#include <testsuite_hooks.h>
+
+void
+test01()
+{
+ const size_t len = 5;
+ typedef std::tr1::array<int, len> array_type;
+ bool test __attribute__((unused)) = true;
+ array_type a = { { 0, 1, 2, 3, 4 } };
+
+ // &a[n] == &a[0] + n for all 0 <= n < N.
+ for (size_t i = 0; i < len; ++i)
+ {
+ VERIFY( &a[i] == &a[0] + i );
+ }
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
+
diff --git a/libstdc++-v3/testsuite/tr1/6_containers/array/requirements/explicit_instantiation.cc b/libstdc++-v3/testsuite/tr1/6_containers/array/requirements/explicit_instantiation.cc
new file mode 100644
index 000000000..0074de7cb
--- /dev/null
+++ b/libstdc++-v3/testsuite/tr1/6_containers/array/requirements/explicit_instantiation.cc
@@ -0,0 +1,27 @@
+// { dg-do compile }
+
+// 2004-10-20 Benjamin Kosnik <bkoz@redhat.com>
+//
+// Copyright (C) 2004, 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/>.
+
+
+// 6.2.2 Class template array
+
+#include <tr1/array>
+
+template class std::tr1::array<int, 5>;
diff --git a/libstdc++-v3/testsuite/tr1/6_containers/array/requirements/member_swap.cc b/libstdc++-v3/testsuite/tr1/6_containers/array/requirements/member_swap.cc
new file mode 100644
index 000000000..ea663bf71
--- /dev/null
+++ b/libstdc++-v3/testsuite/tr1/6_containers/array/requirements/member_swap.cc
@@ -0,0 +1,48 @@
+// 2006-02-24 Paolo Carlini <pcarlini@suse.de>
+//
+// Copyright (C) 2006, 2007, 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/>.
+
+// 6.2.2 Class template array
+
+#include <tr1/array>
+#include <testsuite_hooks.h>
+
+void
+test01()
+{
+ bool test __attribute__((unused)) = true;
+
+ const size_t len = 5;
+ typedef std::tr1::array<int, len> array_type;
+
+ array_type a = { { 0, 1, 2, 3, 4 } };
+ const array_type a_ref = a;
+
+ array_type b = { { 4, 3, 2, 1, 0 } };
+ const array_type b_ref = b;
+
+ a.swap(b);
+ VERIFY( a == b_ref );
+ VERIFY( b == a_ref );
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/tr1/6_containers/array/requirements/typedefs.cc b/libstdc++-v3/testsuite/tr1/6_containers/array/requirements/typedefs.cc
new file mode 100644
index 000000000..9f616ee75
--- /dev/null
+++ b/libstdc++-v3/testsuite/tr1/6_containers/array/requirements/typedefs.cc
@@ -0,0 +1,40 @@
+// { dg-do compile }
+
+// 2004-10-20 Benjamin Kosnik <bkoz@redhat.com>
+//
+// Copyright (C) 2004, 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/>.
+
+
+// 6.2.2 Class template array
+
+#include <tr1/array>
+
+void test01()
+{
+ // Check for required typedefs
+ typedef std::tr1::array<int, 5> test_type;
+ typedef test_type::reference reference;
+ typedef test_type::const_reference const_reference;
+ typedef test_type::iterator iterator;
+ typedef test_type::const_iterator const_iterator;
+ typedef test_type::size_type size_type;
+ typedef test_type::difference_type difference_type;
+ typedef test_type::value_type value_type;
+ typedef test_type::reverse_iterator reverse_iterator;
+ typedef test_type::const_reverse_iterator const_reverse_iterator;
+}
diff --git a/libstdc++-v3/testsuite/tr1/6_containers/array/requirements/zero_sized_arrays.cc b/libstdc++-v3/testsuite/tr1/6_containers/array/requirements/zero_sized_arrays.cc
new file mode 100644
index 000000000..1ea4f8aee
--- /dev/null
+++ b/libstdc++-v3/testsuite/tr1/6_containers/array/requirements/zero_sized_arrays.cc
@@ -0,0 +1,61 @@
+// 2004-10-20 Benjamin Kosnik <bkoz@redhat.com>
+//
+// Copyright (C) 2004, 2005, 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/>.
+
+// 6.2.2.4 Zero sized arrays
+
+#include <tr1/array>
+#include <testsuite_hooks.h>
+
+void
+test01()
+{
+ const size_t len = 0;
+ typedef std::tr1::array<int, len> array_type;
+ bool test __attribute__((unused)) = true;
+
+ // 1: ?
+ array_type a = { };
+
+ // 2
+ array_type b;
+
+ // 3
+ // begin() == end()
+ VERIFY( a.begin() == a.end() );
+ VERIFY( b.begin() == b.end() );
+
+ // 4: ?
+ // begin() == end() == unique value.
+ {
+ typedef std::tr1::array<long, len> array_type1;
+ typedef std::tr1::array<char, len> array_type2;
+ array_type1 one;
+ array_type2 two;
+ void* v1 = one.begin();
+ void* v2 = two.begin();
+ VERIFY( v1 != v2 );
+ }
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
+