]>
git.ipfire.org Git - thirdparty/gcc.git/blob - libstdc++-v3/testsuite/23_containers/array/comparison_operators/96851.cc
1 // Copyright (C) 2020-2024 Free Software Foundation, Inc.
3 // This file is part of the GNU ISO C++ Library. This library is free
4 // software; you can redistribute it and/or modify it under the
5 // terms of the GNU General Public License as published by the
6 // Free Software Foundation; either version 3, or (at your option)
9 // This library is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 // GNU General Public License for more details.
14 // You should have received a copy of the GNU General Public License along
15 // with this library; see the file COPYING3. If not see
16 // <http://www.gnu.org/licenses/>.
18 // { dg-do run { target c++20 } }
21 #include <testsuite_hooks.h>
27 std::array
<T
, 2> a
{ T
{1}, t
};
28 std::array
<T
, 2> b
{ T
{1}, T
{2} };
35 static_assert( cmp_array((unsigned char)1) < 0 );
36 static_assert( cmp_array((unsigned char)2) == 0 );
37 static_assert( cmp_array((unsigned char)3) > 0 );
39 static_assert( cmp_array((signed char)-1) < 0 );
40 static_assert( cmp_array((signed char)2) == 0 );
41 static_assert( cmp_array((signed char)3) > 0 );
43 static_assert( cmp_array(std::byte
{1}) < 0 );
44 static_assert( cmp_array(std::byte
{2}) == 0 );
45 static_assert( cmp_array(std::byte
{3}) > 0 );
47 static_assert( cmp_array((unsigned int)1) < 0 );
48 static_assert( cmp_array((unsigned int)2) == 0 );
49 static_assert( cmp_array((unsigned int)333) > 0 );
50 static_assert( cmp_array((unsigned int)4444) > 0 );
51 static_assert( cmp_array((unsigned int)55555) > 0 );
52 static_assert( cmp_array((unsigned int)0x66666666) > 0 );
54 static_assert( cmp_array((signed int)-1) < 0 );
55 static_assert( cmp_array((signed int)2) == 0 );
56 static_assert( cmp_array((signed int)333) > 0 );
57 static_assert( cmp_array((signed int)-4444) < 0 );
58 static_assert( cmp_array((signed int)55555) > 0 );
59 static_assert( cmp_array((signed int)-0x66666666) < 0 );
66 VERIFY( cmp_array(uc
) < 0 );
68 VERIFY( cmp_array(uc
) == 0 );
70 VERIFY( cmp_array(uc
) > 0 );
73 VERIFY( cmp_array(sc
) < 0 );
75 VERIFY( cmp_array(sc
) == 0 );
77 VERIFY( cmp_array(sc
) > 0 );
80 VERIFY( cmp_array(b
) < 0 );
82 VERIFY( cmp_array(b
) == 0 );
84 VERIFY( cmp_array(b
) > 0 );
87 VERIFY( cmp_array(ui
) < 0 );
89 VERIFY( cmp_array(ui
) == 0 );
91 VERIFY( cmp_array(ui
) > 0 );
93 VERIFY( cmp_array(ui
) > 0 );
95 VERIFY( cmp_array(ui
) > 0 );
97 VERIFY( cmp_array(ui
) > 0 );
100 VERIFY( cmp_array(si
) < 0 );
102 VERIFY( cmp_array(si
) == 0 );
104 VERIFY( cmp_array(si
) > 0 );
106 VERIFY( cmp_array(si
) < 0 );
108 VERIFY( cmp_array(si
) > 0 );
110 VERIFY( cmp_array(si
) < 0 );