[RISCV] Fix mgather -> riscv.masked.strided.load combine not extending indices (...
[llvm-project.git] / libcxx / test / std / containers / sequences / vector.bool / compare.three_way.pass.cpp
blob142589eabf45b4878d7ac861f8903d7f8db8d70a
1 //===----------------------------------------------------------------------===//
2 //
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
6 //
7 //===----------------------------------------------------------------------===//
8 // UNSUPPORTED: c++03, c++11, c++14, c++17
10 // <vector>
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);
18 #include <cassert>
19 #include <vector>
21 #include "test_comparisons.h"
23 constexpr bool test_sequence_container_spaceship_vectorbool() {
24 // Empty containers
26 std::vector<bool> l1;
27 std::vector<bool> l2;
28 assert(testOrder(l1, l2, std::strong_ordering::equivalent));
30 // Identical contents
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));
52 // Shorter list
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));
66 std::vector<bool> e;
67 assert(testOrder(e, t1, std::strong_ordering::less));
68 assert(testOrder(e, f1, std::strong_ordering::less));
70 // Longer list
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));
84 std::vector<bool> e;
85 assert(testOrder(t2, e, std::strong_ordering::greater));
86 assert(testOrder(f2, e, std::strong_ordering::greater));
89 return true;
92 int main(int, char**) {
93 assert(test_sequence_container_spaceship_vectorbool());
94 static_assert(test_sequence_container_spaceship_vectorbool());
95 return 0;