]>
Commit | Line | Data |
---|---|---|
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 | ||
23 | using std::weak_ordering; | |
24 | ||
25 | static_assert( weak_ordering::less == weak_ordering::less ); | |
26 | static_assert( weak_ordering::less != weak_ordering::equivalent ); | |
27 | static_assert( weak_ordering::less != weak_ordering::greater ); | |
28 | static_assert( weak_ordering::equivalent == weak_ordering::equivalent ); | |
29 | static_assert( weak_ordering::equivalent != weak_ordering::greater ); | |
30 | static_assert( weak_ordering::greater == weak_ordering::greater ); | |
31 | ||
32 | static_assert( ! (weak_ordering::less == 0) ); | |
33 | static_assert( weak_ordering::less < 0 ); | |
34 | static_assert( ! (weak_ordering::less > 0) ); | |
35 | static_assert( weak_ordering::less <= 0 ); | |
36 | static_assert( ! (weak_ordering::less >= 0) ); | |
37 | static_assert( ! (0 == weak_ordering::less) ); | |
38 | static_assert( ! (0 < weak_ordering::less) ); | |
39 | static_assert( 0 > weak_ordering::less ); | |
40 | static_assert( ! (0 <= weak_ordering::less) ); | |
41 | static_assert( 0 >= weak_ordering::less ); | |
42 | static_assert( (weak_ordering::less <=> 0) == weak_ordering::less ); | |
43 | static_assert( (0 <=> weak_ordering::less) == weak_ordering::greater ); | |
44 | ||
45 | static_assert( (weak_ordering::equivalent == 0) ); | |
46 | static_assert( ! (weak_ordering::equivalent < 0) ); | |
47 | static_assert( ! (weak_ordering::equivalent > 0) ); | |
48 | static_assert( weak_ordering::equivalent <= 0 ); | |
49 | static_assert( weak_ordering::equivalent >= 0 ); | |
50 | static_assert( 0 == weak_ordering::equivalent ); | |
51 | static_assert( ! (0 < weak_ordering::equivalent) ); | |
52 | static_assert( ! (0 > weak_ordering::equivalent) ); | |
53 | static_assert( 0 <= weak_ordering::equivalent ); | |
54 | static_assert( 0 >= weak_ordering::equivalent ); | |
55 | static_assert( (weak_ordering::equivalent <=> 0) == weak_ordering::equivalent ); | |
56 | static_assert( (0 <=> weak_ordering::equivalent) == weak_ordering::equivalent ); | |
57 | ||
58 | static_assert( ! (weak_ordering::greater == 0) ); | |
59 | static_assert( ! (weak_ordering::greater < 0) ); | |
60 | static_assert( weak_ordering::greater > 0 ); | |
61 | static_assert( ! (weak_ordering::greater <= 0) ); | |
62 | static_assert( weak_ordering::greater >= 0 ); | |
63 | static_assert( ! (0 == weak_ordering::greater) ); | |
64 | static_assert( 0 < weak_ordering::greater ); | |
65 | static_assert( ! (0 > weak_ordering::greater) ); | |
66 | static_assert( 0 <= weak_ordering::greater ); | |
67 | static_assert( ! (0 >= weak_ordering::greater) ); | |
68 | static_assert( (weak_ordering::greater <=> 0) == weak_ordering::greater ); | |
69 | static_assert( (0 <=> weak_ordering::greater) == weak_ordering::less ); | |
70 | ||
71 | // Conversions | |
72 | using std::partial_ordering; | |
73 | static_assert( partial_ordering(weak_ordering::less) == partial_ordering::less ); | |
74 | static_assert( partial_ordering(weak_ordering::equivalent) == partial_ordering::equivalent ); | |
75 | static_assert( partial_ordering(weak_ordering::greater) == partial_ordering::greater ); |