aboutsummaryrefslogtreecommitdiff
path: root/libstdc++-v3/testsuite/26_numerics/valarray
diff options
context:
space:
mode:
Diffstat (limited to 'libstdc++-v3/testsuite/26_numerics/valarray')
-rw-r--r--libstdc++-v3/testsuite/26_numerics/valarray/27867.cc53
-rw-r--r--libstdc++-v3/testsuite/26_numerics/valarray/28277.cc44
-rw-r--r--libstdc++-v3/testsuite/26_numerics/valarray/30416.cc190
-rw-r--r--libstdc++-v3/testsuite/26_numerics/valarray/33084.cc48
-rw-r--r--libstdc++-v3/testsuite/26_numerics/valarray/algo.cc40
-rw-r--r--libstdc++-v3/testsuite/26_numerics/valarray/binary_closure.cc37
-rw-r--r--libstdc++-v3/testsuite/26_numerics/valarray/const_bracket.cc48
-rw-r--r--libstdc++-v3/testsuite/26_numerics/valarray/dr543.cc40
-rw-r--r--libstdc++-v3/testsuite/26_numerics/valarray/name_lookup.cc142
-rw-r--r--libstdc++-v3/testsuite/26_numerics/valarray/operators.cc69
-rw-r--r--libstdc++-v3/testsuite/26_numerics/valarray/requirements/explicit_instantiation.cc34
-rw-r--r--libstdc++-v3/testsuite/26_numerics/valarray/requirements/typedefs.cc39
-rw-r--r--libstdc++-v3/testsuite/26_numerics/valarray/subset_assignment.cc87
13 files changed, 871 insertions, 0 deletions
diff --git a/libstdc++-v3/testsuite/26_numerics/valarray/27867.cc b/libstdc++-v3/testsuite/26_numerics/valarray/27867.cc
new file mode 100644
index 00000000000..7c208f4b100
--- /dev/null
+++ b/libstdc++-v3/testsuite/26_numerics/valarray/27867.cc
@@ -0,0 +1,53 @@
+// Copyright (C) 2006 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 2, 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 COPYING. If not, write to the Free
+// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
+// USA.
+
+// As a special exception, you may use this file as part of a free software
+// library without restriction. Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License. This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+#include <valarray>
+#include <testsuite_hooks.h>
+
+// libstdc++/27867
+void test01()
+{
+ bool test __attribute__((unused)) = true;
+
+ std::valarray<int> v1(100, 1);
+ std::valarray<int> v2(100, 1);
+ std::valarray<bool> v3(true, 1);
+
+ std::valarray<bool> resl(1);
+ resl = ((v1 == v2) == v3);
+ VERIFY( resl[0] == true );
+
+ std::valarray<bool> resr(1);
+ resr = (v3 == (v1 == v2));
+ VERIFY( resr[0] == true );
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/26_numerics/valarray/28277.cc b/libstdc++-v3/testsuite/26_numerics/valarray/28277.cc
new file mode 100644
index 00000000000..52f4c714085
--- /dev/null
+++ b/libstdc++-v3/testsuite/26_numerics/valarray/28277.cc
@@ -0,0 +1,44 @@
+// 2006-07-15 Paolo Carlini <pcarlini@suse.de>
+
+// Copyright (C) 2006 Free Software Foundation
+//
+// 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 2, 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 COPYING. If not, write to the Free
+// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
+// USA.
+
+#include <valarray>
+#include <testsuite_hooks.h>
+
+// libstdc++/28277
+void test01()
+{
+ bool test __attribute__((unused)) = true;
+
+ const std::valarray<int> v1(1, 5000000);
+
+ const std::valarray<int> v2 = v1.shift(1);
+ VERIFY( v2.size() == v1.size() );
+ VERIFY( v2[v1.size() - 1] == 0 );
+
+ const std::valarray<int> v3 = v2.cshift(-1);
+ VERIFY( v3.size() == v2.size() );
+ VERIFY( v3[0] == 0 );
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/26_numerics/valarray/30416.cc b/libstdc++-v3/testsuite/26_numerics/valarray/30416.cc
new file mode 100644
index 00000000000..c51329221d5
--- /dev/null
+++ b/libstdc++-v3/testsuite/26_numerics/valarray/30416.cc
@@ -0,0 +1,190 @@
+// 2007-01-11 Paolo Carlini <pcarlini@suse.de>
+
+// Copyright (C) 2007 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 2, 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 COPYING. If not, write to the Free
+// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
+// USA.
+
+// As a special exception, you may use this file as part of a free software
+// library without restriction. Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License. This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+#include <valarray>
+#include <testsuite_hooks.h>
+
+bool
+comp_vala(const std::valarray<int>& v1, const std::valarray<int>& v2)
+{
+ if (v1.size() == v2.size())
+ {
+ for (size_t i = 0; i < v1.size(); ++i)
+ if (v1[i] != v2[i])
+ return false;
+ return true;
+ }
+ return false;
+}
+
+void
+init_vala(std::valarray<int>& v, size_t first, size_t last, int val)
+{
+ for (size_t i = first; i <= last; ++i)
+ v[i] = val++;
+}
+
+// libstdc++/30416
+void test01()
+{
+ bool test __attribute__((unused)) = true;
+ using namespace std;
+
+ // shift
+ valarray<int> v1;
+ valarray<int> v1_ris(v1.shift(0));
+ VERIFY( comp_vala(v1, v1_ris) );
+
+ valarray<int> v2;
+ valarray<int> v2_ris(v2.shift(10));
+ VERIFY( comp_vala(v2, v2_ris) );
+
+ valarray<int> v3;
+ valarray<int> v3_ris(v3.shift(-10));
+ VERIFY( comp_vala(v3, v3_ris) );
+
+ valarray<int> v4(10);
+ valarray<int> v4_ris(v4.shift(0));
+ VERIFY( comp_vala(v4, v4_ris) );
+
+ valarray<int> v5(10);
+ init_vala(v5, 0, 9, 1);
+ valarray<int> v5_ref(10);
+
+ valarray<int> v5_ris(v5.shift(16));
+ VERIFY( comp_vala(v5_ris, v5_ref) );
+
+ valarray<int> v6(10);
+ init_vala(v6, 0, 9, 1);
+ valarray<int> v6_ref(10);
+
+ valarray<int> v6_ris(v6.shift(-16));
+ VERIFY( comp_vala(v6_ris, v6_ref) );
+
+ valarray<int> v7(10);
+ init_vala(v7, 0, 9, 1);
+ valarray<int> v7_ref(10);
+
+ valarray<int> v7_ris(v7.shift(10));
+ VERIFY( comp_vala(v7_ris, v7_ref) );
+
+ valarray<int> v8(10);
+ init_vala(v8, 0, 9, 1);
+ valarray<int> v8_ref(10);
+
+ valarray<int> v8_ris(v8.shift(-10));
+ VERIFY( comp_vala(v8_ris, v8_ref) );
+
+ valarray<int> v9(10);
+ init_vala(v9, 0, 9, 1);
+ valarray<int> v9_ref(10);
+ init_vala(v9_ref, 0, 3, 7);
+
+ valarray<int> v9_ris(v9.shift(6));
+ VERIFY( comp_vala(v9_ris, v9_ref) );
+
+ valarray<int> v10(10);
+ init_vala(v10, 0, 9, 1);
+ valarray<int> v10_ref(10);
+ init_vala(v10_ref, 6, 9, 1);
+
+ valarray<int> v10_ris(v10.shift(-6));
+ VERIFY( comp_vala(v10_ris, v10_ref) );
+
+ // cshift
+ valarray<int> v11;
+ valarray<int> v11_ris(v11.cshift(0));
+ VERIFY( comp_vala(v11, v11_ris) );
+
+ valarray<int> v12;
+ valarray<int> v12_ris(v12.cshift(10));
+ VERIFY( comp_vala(v12, v12_ris) );
+
+ valarray<int> v13;
+ valarray<int> v13_ris(v13.cshift(-10));
+ VERIFY( comp_vala(v13, v13_ris) );
+
+ valarray<int> v14(10);
+ valarray<int> v14_ris(v14.cshift(0));
+ VERIFY( comp_vala(v14, v14_ris) );
+
+ valarray<int> v15(10);
+ init_vala(v15, 0, 9, 1);
+ valarray<int> v15_ref(10);
+ init_vala(v15_ref, 0, 3, 7);
+ init_vala(v15_ref, 4, 9, 1);
+
+ valarray<int> v15_ris(v15.cshift(16));
+ VERIFY( comp_vala(v15_ris, v15_ref) );
+
+ valarray<int> v16(10);
+ init_vala(v16, 0, 9, 1);
+ valarray<int> v16_ref(10);
+ init_vala(v16_ref, 0, 5, 5);
+ init_vala(v16_ref, 6, 9, 1);
+
+ valarray<int> v16_ris(v16.cshift(-16));
+ VERIFY( comp_vala(v16_ris, v16_ref) );
+
+ valarray<int> v17(10);
+ init_vala(v17, 0, 9, 1);
+
+ valarray<int> v17_ris(v15.cshift(10));
+ VERIFY( comp_vala(v17, v17_ris) );
+
+ valarray<int> v18(10);
+ init_vala(v18, 0, 9, 1);
+
+ valarray<int> v18_ris(v18.cshift(-10));
+ VERIFY( comp_vala(v18, v18_ris) );
+
+ valarray<int> v19(10);
+ init_vala(v19, 0, 9, 1);
+ valarray<int> v19_ref(10);
+ init_vala(v19_ref, 0, 3, 7);
+ init_vala(v19_ref, 4, 9, 1);
+
+ valarray<int> v19_ris(v15.cshift(6));
+ VERIFY( comp_vala(v19_ris, v19_ref) );
+
+ valarray<int> v20(10);
+ init_vala(v20, 0, 9, 1);
+ valarray<int> v20_ref(10);
+ init_vala(v20_ref, 0, 5, 5);
+ init_vala(v20_ref, 6, 9, 1);
+
+ valarray<int> v20_ris(v20.cshift(-6));
+ VERIFY( comp_vala(v20_ris, v20_ref) );
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/26_numerics/valarray/33084.cc b/libstdc++-v3/testsuite/26_numerics/valarray/33084.cc
new file mode 100644
index 00000000000..aaacfe7ee59
--- /dev/null
+++ b/libstdc++-v3/testsuite/26_numerics/valarray/33084.cc
@@ -0,0 +1,48 @@
+// Copyright (C) 2007 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 2, 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 COPYING. If not, write to the Free
+// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
+// USA.
+
+// As a special exception, you may use this file as part of a free software
+// library without restriction. Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License. This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+// { dg-do compile }
+
+#include <valarray>
+
+// libstdc++/33084
+void test01()
+{
+ std::valarray<char> vc(char(0), 10);
+ std::valarray<bool> res(10);
+ char c(0);
+
+ res = vc == vc;
+ res = vc == c;
+ res = c == vc;
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/26_numerics/valarray/algo.cc b/libstdc++-v3/testsuite/26_numerics/valarray/algo.cc
new file mode 100644
index 00000000000..a69ce65e079
--- /dev/null
+++ b/libstdc++-v3/testsuite/26_numerics/valarray/algo.cc
@@ -0,0 +1,40 @@
+// 19990404 gdr
+
+// Copyright (C) 1999, 2000 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 2, 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 COPYING. If not, write to the Free
+// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
+// USA.
+
+// As a special exception, you may use this file as part of a free software
+// library without restriction. Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License. This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+#include <valarray>
+
+int main()
+{
+ // 02: algo
+ using std::valarray;
+ valarray<double> b, c;
+ double m __attribute__((unused)) = std::abs(b - c).max();
+
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/26_numerics/valarray/binary_closure.cc b/libstdc++-v3/testsuite/26_numerics/valarray/binary_closure.cc
new file mode 100644
index 00000000000..7dbcfbd5228
--- /dev/null
+++ b/libstdc++-v3/testsuite/26_numerics/valarray/binary_closure.cc
@@ -0,0 +1,37 @@
+// 19990805 gdr
+//
+// XXX: to impove later.
+// Origin: Andreas Amann <amann@physik.tu-berlin.de>
+// CXXFLAGS: -g
+
+#include <iostream>
+#include <valarray>
+
+
+int main()
+{
+ std::valarray<double> a(10), b(10), c(10), d(10);
+
+ a = 1.2;
+ b = 3.1;
+
+ c = 4.0;
+
+ d = ( 2.0 * b + a ); // works
+ std::cout << "d[4] = " << d[4] << std::endl;
+
+ d = (a * 2.0 + b ); // works
+ std::cout << "d[4] = " << d[4] << std::endl;
+
+ d = (a + b * 2.0 ); // segfaults!
+ std::cout << "d[4] = " << d[4] << std::endl;
+ d = (a + 2.0* b );
+
+ std::cout << "d[4] = " << d[4] << std::endl;
+ d = (a + 2.0* b );
+ std::cout << "d[4] = " << d[4] << std::endl;
+ d = (a + 2.0* b );
+
+ std::cout << "d[4] = " << d[4] << std::endl;
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/26_numerics/valarray/const_bracket.cc b/libstdc++-v3/testsuite/26_numerics/valarray/const_bracket.cc
new file mode 100644
index 00000000000..512cbafd3ce
--- /dev/null
+++ b/libstdc++-v3/testsuite/26_numerics/valarray/const_bracket.cc
@@ -0,0 +1,48 @@
+// 20010518 gdr
+
+// Copyright (C) 2001 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 2, 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 COPYING. If not, write to the Free
+// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
+// USA.
+
+// As a special exception, you may use this file as part of a free software
+// library without restriction. Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License. This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+#include <valarray>
+
+// dg-do compile
+
+template<typename P>
+ void copy(P, std::size_t) { }
+
+template<typename T>
+ void test(const std::valarray<T>& v)
+ {
+ copy(&v[0], v.size());
+ }
+
+int main()
+{
+ std::valarray<double> v(190);
+ test(v);
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/26_numerics/valarray/dr543.cc b/libstdc++-v3/testsuite/26_numerics/valarray/dr543.cc
new file mode 100644
index 00000000000..9afa93a4b83
--- /dev/null
+++ b/libstdc++-v3/testsuite/26_numerics/valarray/dr543.cc
@@ -0,0 +1,40 @@
+// Copyright (C) 2006 Free Software Foundation
+//
+// 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 2, 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 COPYING. If not, write to the Free
+// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
+// USA.
+
+#include <valarray>
+#include <testsuite_hooks.h>
+
+// DR 543. valarray slice default constructor
+void test01()
+{
+ bool test __attribute__((unused)) = true;
+
+ std::valarray<int> v1(10);
+ std::valarray<int> v2 = v1[std::slice()];
+ VERIFY( v2.size() == 0 );
+
+ std::valarray<int> v3(10);
+ std::valarray<int> v4 = v3[std::gslice()];
+ VERIFY( v4.size() == 0 );
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/26_numerics/valarray/name_lookup.cc b/libstdc++-v3/testsuite/26_numerics/valarray/name_lookup.cc
new file mode 100644
index 00000000000..735f65f5df7
--- /dev/null
+++ b/libstdc++-v3/testsuite/26_numerics/valarray/name_lookup.cc
@@ -0,0 +1,142 @@
+// 2002-08-02 gdr
+
+// Copyright (C) 2002, 2003 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 2, 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 COPYING. If not, write to the Free
+// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
+// USA.
+
+// As a special exception, you may use this file as part of a free software
+// library without restriction. Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License. This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+// Test name lookup resolutions for standard functions applied to an
+// array expression.
+// { dg-do compile }
+
+#include <valarray>
+
+namespace My
+{
+ struct Number
+ {
+ operator bool() const;
+ };
+
+ Number operator+(Number);
+ Number operator-(Number);
+ Number operator~(Number);
+
+ bool operator!(Number);
+
+ Number operator+(Number, Number);
+ Number operator-(Number, Number);
+ Number operator*(Number, Number);
+ Number operator/(Number, Number);
+ Number operator%(Number, Number);
+
+ Number operator^(Number, Number);
+ Number operator&(Number, Number);
+ Number operator|(Number, Number);
+
+ Number operator<<(Number, Number);
+ Number operator>>(Number, Number);
+
+ bool operator==(Number, Number);
+ bool operator!=(Number, Number);
+ bool operator<(Number, Number);
+ bool operator<=(Number, Number);
+ bool operator>(Number, Number);
+ bool operator>=(Number, Number);
+
+ Number abs(Number);
+
+ Number cos(Number);
+ Number cosh(Number);
+ Number acos(Number);
+
+ Number sin(Number);
+ Number sinh(Number);
+ Number asin(Number);
+
+ Number tan(Number);
+ Number tanh(Number);
+ Number atan(Number);
+
+ Number exp(Number);
+ Number log(Number);
+ Number log10(Number);
+ Number sqrt(Number);
+
+ Number atan2(Number, Number);
+ Number pow(Number, Number);
+}
+
+int main()
+{
+ typedef std::valarray<My::Number> Array;
+ Array u(10), v(10);
+ v = +u;
+ v = -u;
+ v = ~u;
+ std::valarray<bool> z = !u;
+
+ v = abs(u);
+
+ v = cos(u);
+ v = cosh(u);
+ v = acos(u);
+
+ v = sin(u);
+ v = sinh(u);
+ v = asin(u);
+
+ v = tan(u);
+ v = tanh(u);
+ v = atan(u);
+
+ v = exp(u);
+ v = log(u);
+ v = log10(u);
+ v = sqrt(u);
+
+ Array w = u + v;
+ w = u - v;
+ w = u * v;
+ w = u / v;
+ w = u % v;
+
+ w = u ^ v;
+ w = u & v;
+ w = u | v;
+
+ w = u << v;
+ w = u >> v;
+
+ z = u == v;
+ z = u != v;
+ z = u < v;
+ z = u <= v;
+ z = u > v;
+ z = u >= v;
+
+ w = atan2(u, v);
+ w = pow(u, v);
+}
diff --git a/libstdc++-v3/testsuite/26_numerics/valarray/operators.cc b/libstdc++-v3/testsuite/26_numerics/valarray/operators.cc
new file mode 100644
index 00000000000..70ad0b0e788
--- /dev/null
+++ b/libstdc++-v3/testsuite/26_numerics/valarray/operators.cc
@@ -0,0 +1,69 @@
+// { dg-do run }
+// 2003-02-03 Volker Reichelt <reichelt@igpm.rwth-aachen.de>
+
+// Copyright (C) 2003 Free Software Foundation
+//
+// 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 2, 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 COPYING. If not, write to the Free
+// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
+// USA.
+
+#include <valarray>
+#include <testsuite_hooks.h>
+
+void test01() // check unary operators
+{
+ bool test __attribute__((unused)) = true;
+ std::valarray<int> u(1);
+ u[0]=1;
+
+ VERIFY( (+u)[0] == +1 );
+ VERIFY( (-u)[0] == -1 );
+ VERIFY( (!u)[0] == !1 );
+ VERIFY( (~u)[0] == ~1 );
+}
+
+void test02() // check binary operators
+{
+ bool test __attribute__((unused)) = true;
+ std::valarray<int> u(1), v(1);
+ u[0]=1;
+ v[0]=3;
+
+ VERIFY( (u+ v)[0] == (1+ 3) );
+ VERIFY( (u- v)[0] == (1- 3) );
+ VERIFY( (u* v)[0] == (1* 3) );
+ VERIFY( (u/ v)[0] == (1/ 3) );
+ VERIFY( (u% v)[0] == (1% 3) );
+ VERIFY( (u^ v)[0] == (1^ 3) );
+ VERIFY( (u& v)[0] == (1& 3) );
+ VERIFY( (u| v)[0] == (1| 3) );
+ VERIFY( (u<<v)[0] == (1<<3) );
+ VERIFY( (u>>v)[0] == (1>>3) );
+ VERIFY( (u&&v)[0] == (1&&3) );
+ VERIFY( (u||v)[0] == (1||3) );
+ VERIFY( (u==v)[0] == (1==3) );
+ VERIFY( (u!=v)[0] == (1!=3) );
+ VERIFY( (u< v)[0] == (1< 3) );
+ VERIFY( (u> v)[0] == (1> 3) );
+ VERIFY( (u<=v)[0] == (1<=3) );
+ VERIFY( (u>=v)[0] == (1>=3) );
+}
+
+int main()
+{
+ test01();
+ test02();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/26_numerics/valarray/requirements/explicit_instantiation.cc b/libstdc++-v3/testsuite/26_numerics/valarray/requirements/explicit_instantiation.cc
new file mode 100644
index 00000000000..d4d5e283048
--- /dev/null
+++ b/libstdc++-v3/testsuite/26_numerics/valarray/requirements/explicit_instantiation.cc
@@ -0,0 +1,34 @@
+// { dg-do compile }
+
+// Copyright (C) 2007 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 2, 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 COPYING. If not, write to
+// the Free Software Foundation, 51 Franklin Street, Fifth Floor,
+// Boston, MA 02110-1301, USA.
+
+// As a special exception, you may use this file as part of a free software
+// library without restriction. Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License. This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+// This file tests explicit instantiation of library containers.
+
+#include <valarray>
+
+template class std::valarray<short>;
diff --git a/libstdc++-v3/testsuite/26_numerics/valarray/requirements/typedefs.cc b/libstdc++-v3/testsuite/26_numerics/valarray/requirements/typedefs.cc
new file mode 100644
index 00000000000..a6f28dc41a6
--- /dev/null
+++ b/libstdc++-v3/testsuite/26_numerics/valarray/requirements/typedefs.cc
@@ -0,0 +1,39 @@
+// { dg-do compile }
+
+// Copyright (C) 2007 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 2, 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 COPYING. If not, write to the Free
+// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
+// USA.
+
+// As a special exception, you may use this file as part of a free software
+// library without restriction. Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License. This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+// 6.2.2 Class template array
+
+#include <valarray>
+
+void test01()
+{
+ // Check for required typedefs
+ typedef std::valarray<int> test_type;
+ typedef test_type::value_type value_type;
+}
diff --git a/libstdc++-v3/testsuite/26_numerics/valarray/subset_assignment.cc b/libstdc++-v3/testsuite/26_numerics/valarray/subset_assignment.cc
new file mode 100644
index 00000000000..4ce22afb31a
--- /dev/null
+++ b/libstdc++-v3/testsuite/26_numerics/valarray/subset_assignment.cc
@@ -0,0 +1,87 @@
+// 2004-01-03 Jerry Quinn <jlquinn@optonline.net>
+
+// Copyright (C) 2004 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 2, 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 COPYING. If not, write to the Free
+// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
+// USA.
+
+// As a special exception, you may use this file as part of a free software
+// library without restriction. Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License. This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+// PR 3247
+
+// This is DR-253. Test for accessible assignment-operators.
+#include <valarray>
+#include <testsuite_hooks.h>
+
+bool check_array(std::valarray<double>& a, double b[])
+{
+ for (unsigned int i=0; i < a.size(); i++)
+ if (a[i] != b[i]) return false;
+ return true;
+}
+
+int main()
+{
+ std::valarray<double> val_d(10); // 0 1 2 3 4 5 6 7 8 9
+ std::valarray<double> val_d1(10); // 10 9 8 7 6 5 4 3 2 1
+
+ for (int i=0; i< 10; i++) { val_d[i] = 10; val_d1[i] = i; }
+ std::valarray<double> val_c(val_d);
+ std::valarray<double> val_f(val_d);
+ std::valarray<double> val_g(val_d);
+
+ std::slice slc(1, 3, 3); // 1 4 7
+ val_d[slc] = val_d1[slc];
+
+ double ans1[10] = {10, 1, 10, 10, 4, 10, 10, 7, 10, 10};
+ VERIFY(check_array(val_d, ans1));
+
+ std::valarray<std::size_t> val_size(2);
+ std::valarray<std::size_t> val_stride(2);
+ val_size[0] = 2; val_size[1] = 3;
+ val_stride[0] = 4; val_stride[1] = 1;
+
+ std::gslice gslc(1, val_size, val_stride);
+ val_c[gslc] = val_d1[gslc];
+
+ double ans2[10] = {10, 1, 2, 3, 10, 5, 6, 7, 10, 10};
+ VERIFY(check_array(val_c, ans2));
+
+ std::valarray<bool> val_b(false, 10);
+ val_b[2] = val_b[6] = val_b[9] = true;
+ val_f[val_b] = val_d1[val_b];
+
+ double ans3[10] = {10, 10, 2, 10, 10, 10, 6, 10, 10, 9};
+ VERIFY(check_array(val_f, ans3));
+
+ size_t addr[] = {1, 2, 3, 4, 5};
+ size_t addr1[] = {2, 7, 1, 9, 4};
+ std::valarray<std::size_t> val_indirect(addr, 5);
+ std::valarray<std::size_t> val_indirect1(addr1, 5);
+ val_g[val_indirect] = val_d1[val_indirect1];
+
+ double ans4[10] = {10, 2, 7, 1, 9, 4, 10, 10, 10, 10};
+ VERIFY(check_array(val_g, ans4));
+
+ return 0;
+};