2 // 2003-02-03 Volker Reichelt <reichelt@igpm.rwth-aachen.de>
4 // Copyright (C) 2003-2017 Free Software Foundation, Inc.
6 // This file is part of the GNU ISO C++ Library. This library is free
7 // software; you can redistribute it and/or modify it under the
8 // terms of the GNU General Public License as published by the
9 // Free Software Foundation; either version 3, or (at your option)
12 // This library is distributed in the hope that it will be useful,
13 // but WITHOUT ANY WARRANTY; without even the implied warranty of
14 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 // GNU General Public License for more details.
17 // You should have received a copy of the GNU General Public License along
18 // with this library; see the file COPYING3. If not see
19 // <http://www.gnu.org/licenses/>.
22 #include <testsuite_hooks.h>
24 void test01() // check unary operators
26 std::valarray
<int> u(1);
29 VERIFY( (+u
)[0] == +1 );
30 VERIFY( (-u
)[0] == -1 );
31 VERIFY( (!u
)[0] == !1 );
32 VERIFY( (~u
)[0] == ~1 );
35 void test02() // check binary operators
37 std::valarray
<int> u(1), v(1);
41 VERIFY( (u
+ v
)[0] == (1+ 3) );
42 VERIFY( (u
- v
)[0] == (1- 3) );
43 VERIFY( (u
* v
)[0] == (1* 3) );
44 VERIFY( (u
/ v
)[0] == (1/ 3) );
45 VERIFY( (u
% v
)[0] == (1% 3) );
46 VERIFY( (u
^ v
)[0] == (1^ 3) );
47 VERIFY( (u
& v
)[0] == (1& 3) );
48 VERIFY( (u
| v
)[0] == (1| 3) );
49 VERIFY( (u
<<v
)[0] == (1<<3) );
50 VERIFY( (u
>>v
)[0] == (1>>3) );
51 VERIFY( (u
&&v
)[0] == (1&&3) );
52 VERIFY( (u
||v
)[0] == (1||3) );
53 VERIFY( (u
==v
)[0] == (1==3) );
54 VERIFY( (u
!=v
)[0] == (1!=3) );
55 VERIFY( (u
< v
)[0] == (1< 3) );
56 VERIFY( (u
> v
)[0] == (1> 3) );
57 VERIFY( (u
<=v
)[0] == (1<=3) );
58 VERIFY( (u
>=v
)[0] == (1>=3) );