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 //===----------------------------------------------------------------------===//
8 // UNSUPPORTED: c++03, c++11, c++14, c++17
12 // class vector<bool, Allocator>
14 // template<class T, class Allocator>
15 // constexpr synth-three-way-result<T> operator<=>(const vector<T, Allocator>& x,
16 // const vector<T, Allocator>& y);
21 #include "test_comparisons.h"
23 constexpr bool test_sequence_container_spaceship_vectorbool() {
28 assert(testOrder(l1
, l2
, std::strong_ordering::equivalent
));
32 std::vector
<bool> t1
{true, true};
33 std::vector
<bool> t2
{true, true};
34 assert(testOrder(t1
, t2
, std::strong_ordering::equivalent
));
36 std::vector
<bool> f1
{false, false};
37 std::vector
<bool> f2
{false, false};
38 assert(testOrder(f1
, f2
, std::strong_ordering::equivalent
));
40 // Less, due to contained values
42 std::vector
<bool> l1
{true, false};
43 std::vector
<bool> l2
{true, true};
44 assert(testOrder(l1
, l2
, std::strong_ordering::less
));
46 // Greater, due to contained values
48 std::vector
<bool> l1
{true, true};
49 std::vector
<bool> l2
{true, false};
50 assert(testOrder(l1
, l2
, std::strong_ordering::greater
));
54 std::vector
<bool> l1
{true};
55 std::vector
<bool> l2
{true, false};
56 assert(testOrder(l1
, l2
, std::strong_ordering::less
));
58 std::vector
<bool> t1
{true};
59 std::vector
<bool> t2
{true, true};
60 assert(testOrder(t1
, t2
, std::strong_ordering::less
));
62 std::vector
<bool> f1
{false};
63 std::vector
<bool> f2
{false, false};
64 assert(testOrder(f1
, f2
, std::strong_ordering::less
));
67 assert(testOrder(e
, t1
, std::strong_ordering::less
));
68 assert(testOrder(e
, f1
, std::strong_ordering::less
));
72 std::vector
<bool> l1
{true, false};
73 std::vector
<bool> l2
{true};
74 assert(testOrder(l1
, l2
, std::strong_ordering::greater
));
76 std::vector
<bool> t1
{true, true};
77 std::vector
<bool> t2
{true};
78 assert(testOrder(t1
, t2
, std::strong_ordering::greater
));
80 std::vector
<bool> f1
{false, false};
81 std::vector
<bool> f2
{false};
82 assert(testOrder(f1
, f2
, std::strong_ordering::greater
));
85 assert(testOrder(t2
, e
, std::strong_ordering::greater
));
86 assert(testOrder(f2
, e
, std::strong_ordering::greater
));
92 int main(int, char**) {
93 assert(test_sequence_container_spaceship_vectorbool());
94 static_assert(test_sequence_container_spaceship_vectorbool());