]> git.ipfire.org Git - thirdparty/gcc.git/blame - libstdc++-v3/testsuite/18_support/comparisons/categories/weakord.cc
Update copyright years.
[thirdparty/gcc.git] / libstdc++-v3 / testsuite / 18_support / comparisons / categories / weakord.cc
CommitLineData
7adcbafe 1// Copyright (C) 2020-2022 Free Software Foundation, Inc.
0d57370c
JW
2//
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)
7// any later version.
8
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.
13
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/>.
17
18// { dg-options "-std=gnu++2a" }
19// { dg-do compile { target c++2a } }
20
21#include <compare>
22
23using std::weak_ordering;
24
25static_assert( weak_ordering::less == weak_ordering::less );
26static_assert( weak_ordering::less != weak_ordering::equivalent );
27static_assert( weak_ordering::less != weak_ordering::greater );
28static_assert( weak_ordering::equivalent == weak_ordering::equivalent );
29static_assert( weak_ordering::equivalent != weak_ordering::greater );
30static_assert( weak_ordering::greater == weak_ordering::greater );
31
32static_assert( ! (weak_ordering::less == 0) );
33static_assert( weak_ordering::less < 0 );
34static_assert( ! (weak_ordering::less > 0) );
35static_assert( weak_ordering::less <= 0 );
36static_assert( ! (weak_ordering::less >= 0) );
37static_assert( ! (0 == weak_ordering::less) );
38static_assert( ! (0 < weak_ordering::less) );
39static_assert( 0 > weak_ordering::less );
40static_assert( ! (0 <= weak_ordering::less) );
41static_assert( 0 >= weak_ordering::less );
42static_assert( (weak_ordering::less <=> 0) == weak_ordering::less );
43static_assert( (0 <=> weak_ordering::less) == weak_ordering::greater );
44
45static_assert( (weak_ordering::equivalent == 0) );
46static_assert( ! (weak_ordering::equivalent < 0) );
47static_assert( ! (weak_ordering::equivalent > 0) );
48static_assert( weak_ordering::equivalent <= 0 );
49static_assert( weak_ordering::equivalent >= 0 );
50static_assert( 0 == weak_ordering::equivalent );
51static_assert( ! (0 < weak_ordering::equivalent) );
52static_assert( ! (0 > weak_ordering::equivalent) );
53static_assert( 0 <= weak_ordering::equivalent );
54static_assert( 0 >= weak_ordering::equivalent );
55static_assert( (weak_ordering::equivalent <=> 0) == weak_ordering::equivalent );
56static_assert( (0 <=> weak_ordering::equivalent) == weak_ordering::equivalent );
57
58static_assert( ! (weak_ordering::greater == 0) );
59static_assert( ! (weak_ordering::greater < 0) );
60static_assert( weak_ordering::greater > 0 );
61static_assert( ! (weak_ordering::greater <= 0) );
62static_assert( weak_ordering::greater >= 0 );
63static_assert( ! (0 == weak_ordering::greater) );
64static_assert( 0 < weak_ordering::greater );
65static_assert( ! (0 > weak_ordering::greater) );
66static_assert( 0 <= weak_ordering::greater );
67static_assert( ! (0 >= weak_ordering::greater) );
68static_assert( (weak_ordering::greater <=> 0) == weak_ordering::greater );
69static_assert( (0 <=> weak_ordering::greater) == weak_ordering::less );
70
71// Conversions
72using std::partial_ordering;
73static_assert( partial_ordering(weak_ordering::less) == partial_ordering::less );
74static_assert( partial_ordering(weak_ordering::equivalent) == partial_ordering::equivalent );
75static_assert( partial_ordering(weak_ordering::greater) == partial_ordering::greater );