1 //===----------------------------------------------------------------------===//
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 //===----------------------------------------------------------------------===//
11 // bool operator==( const vector& lhs, const vector& rhs );
12 // bool operator!=( const vector& lhs, const vector& rhs );
13 // bool operator< ( const vector& lhs, const vector& rhs );
14 // bool operator<=( const vector& lhs, const vector& rhs );
15 // bool operator> ( const vector& lhs, const vector& rhs );
16 // bool operator>=( const vector& lhs, const vector& rhs );
21 #include "test_comparisons.h"
23 TEST_CONSTEXPR_CXX20
bool test() {
24 typedef std::vector
<bool> VB
;
27 assert(testComparisons(v1
, v2
, true, false));
32 assert(testComparisons(v1
, v2
, true, false));
35 const VB
v1(1, false);
37 assert(testComparisons(v1
, v2
, false, true));
40 const VB v1
, v2(1, true);
41 assert(testComparisons(v1
, v2
, false, true));
44 bool items1
[3] = {false, true, false};
45 bool items2
[3] = {false, true, true};
46 const VB
v1(items1
, items1
+ 3);
47 const VB
v2(items2
, items2
+ 3);
48 assert(testComparisons(v1
, v2
, false, true));
51 bool items1
[3] = {false, false, false};
52 bool items2
[3] = {false, true, false};
53 const VB
v1(items1
, items1
+ 3);
54 const VB
v2(items2
, items2
+ 3);
55 assert(testComparisons(v1
, v2
, false, true));
58 bool items1
[2] = {false, true};
59 bool items2
[3] = {false, true, false};
60 const VB
v1(items1
, items1
+ 2);
61 const VB
v2(items2
, items2
+ 3);
62 assert(testComparisons(v1
, v2
, false, true));
65 bool items
[3] = {false, true, false};
66 const VB
v1(items
, items
+ 3);
68 assert(testComparisons(v1
, v2
, false, true));
71 assert( (std::vector
<bool>() == std::vector
<bool>()));
72 assert(!(std::vector
<bool>() != std::vector
<bool>()));
73 assert(!(std::vector
<bool>() < std::vector
<bool>()));
74 assert( (std::vector
<bool>() <= std::vector
<bool>()));
75 assert(!(std::vector
<bool>() > std::vector
<bool>()));
76 assert( (std::vector
<bool>() >= std::vector
<bool>()));
82 int main(int, char**) {
85 static_assert(test());