[PowerPC][NFC] Cleanup PPCCTRLoopsVerify pass
[llvm-project.git] / libcxx / test / std / containers / sequences / vector.bool / iterators.pass.cpp
blob7714e53b2cd5fdad0661d57bb8cb6e7e34b98e07
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 //===----------------------------------------------------------------------===//
9 // <vector>
11 // iterator begin();
12 // iterator end();
13 // const_iterator begin() const;
14 // const_iterator end() const;
15 // const_iterator cbegin() const;
16 // const_iterator cend() const;
18 #include <vector>
19 #include <cassert>
20 #include <iterator>
22 #include "test_macros.h"
23 #include "min_allocator.h"
25 int main(int, char**)
28 typedef bool T;
29 typedef std::vector<T> C;
30 C c;
31 C::iterator i = c.begin();
32 C::iterator j = c.end();
33 assert(std::distance(i, j) == 0);
34 assert(i == j);
37 typedef bool T;
38 typedef std::vector<T> C;
39 const C c;
40 C::const_iterator i = c.begin();
41 C::const_iterator j = c.end();
42 assert(std::distance(i, j) == 0);
43 assert(i == j);
46 typedef bool T;
47 typedef std::vector<T> C;
48 C c;
49 C::const_iterator i = c.cbegin();
50 C::const_iterator j = c.cend();
51 assert(std::distance(i, j) == 0);
52 assert(i == j);
53 assert(i == c.end());
56 typedef bool T;
57 typedef std::vector<T> C;
58 C::iterator i;
59 C::const_iterator j;
61 #if TEST_STD_VER >= 11
63 typedef bool T;
64 typedef std::vector<T, min_allocator<T>> C;
65 C c;
66 C::iterator i = c.begin();
67 C::iterator j = c.end();
68 assert(std::distance(i, j) == 0);
69 assert(i == j);
72 typedef bool T;
73 typedef std::vector<T, min_allocator<T>> C;
74 const C c;
75 C::const_iterator i = c.begin();
76 C::const_iterator j = c.end();
77 assert(std::distance(i, j) == 0);
78 assert(i == j);
81 typedef bool T;
82 typedef std::vector<T, min_allocator<T>> C;
83 C c;
84 C::const_iterator i = c.cbegin();
85 C::const_iterator j = c.cend();
86 assert(std::distance(i, j) == 0);
87 assert(i == j);
88 assert(i == c.end());
91 typedef bool T;
92 typedef std::vector<T, min_allocator<T>> C;
93 C::iterator i;
94 C::const_iterator j;
96 #endif
97 #if TEST_STD_VER > 11
98 { // N3644 testing
99 std::vector<bool>::iterator ii1{}, ii2{};
100 std::vector<bool>::iterator ii4 = ii1;
101 std::vector<bool>::const_iterator cii{};
102 assert ( ii1 == ii2 );
103 assert ( ii1 == ii4 );
105 assert (!(ii1 != ii2 ));
107 assert ( (ii1 == cii ));
108 assert ( (cii == ii1 ));
109 assert (!(ii1 != cii ));
110 assert (!(cii != ii1 ));
111 assert (!(ii1 < cii ));
112 assert (!(cii < ii1 ));
113 assert ( (ii1 <= cii ));
114 assert ( (cii <= ii1 ));
115 assert (!(ii1 > cii ));
116 assert (!(cii > ii1 ));
117 assert ( (ii1 >= cii ));
118 assert ( (cii >= ii1 ));
119 assert (cii - ii1 == 0);
120 assert (ii1 - cii == 0);
122 #endif
124 return 0;