[PowerPC][NFC] Cleanup PPCCTRLoopsVerify pass
[llvm-project.git] / libcxx / test / std / strings / basic.string / string.iterators / iterators.pass.cpp
blobfe467116e9a6804cf14ae2a514c16ddf52a88396
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 // UNSUPPORTED: c++03, c++11
11 // <string>
13 // iterator begin();
14 // iterator end();
15 // const_iterator begin() const;
16 // const_iterator end() const;
17 // const_iterator cbegin() const;
18 // const_iterator cend() const;
20 #include <string>
21 #include <cassert>
23 #include "test_macros.h"
25 int main(int, char**)
27 { // N3644 testing
28 typedef std::string C;
29 C::iterator ii1{}, ii2{};
30 C::iterator ii4 = ii1;
31 C::const_iterator cii{};
32 assert ( ii1 == ii2 );
33 assert ( ii1 == ii4 );
34 assert ( ii1 == cii );
35 assert ( !(ii1 != ii2 ));
36 assert ( !(ii1 != cii ));
39 { // N3644 testing
40 typedef std::wstring C;
41 C::iterator ii1{}, ii2{};
42 C::iterator ii4 = ii1;
43 C::const_iterator cii{};
44 assert ( ii1 == ii2 );
45 assert ( ii1 == ii4 );
46 assert ( ii1 == cii );
47 assert ( !(ii1 != ii2 ));
48 assert ( !(ii1 != cii ));
51 #if defined(__cpp_lib_char8_t) && __cpp_lib_char8_t >= 201811L
53 typedef std::u8string C;
54 C::iterator ii1{}, ii2{};
55 C::iterator ii4 = ii1;
56 C::const_iterator cii{};
57 assert ( ii1 == ii2 );
58 assert ( ii1 == ii4 );
59 assert ( ii1 == cii );
60 assert ( !(ii1 != ii2 ));
61 assert ( !(ii1 != cii ));
63 #endif
65 { // N3644 testing
66 typedef std::u16string C;
67 C::iterator ii1{}, ii2{};
68 C::iterator ii4 = ii1;
69 C::const_iterator cii{};
70 assert ( ii1 == ii2 );
71 assert ( ii1 == ii4 );
72 assert ( ii1 == cii );
73 assert ( !(ii1 != ii2 ));
74 assert ( !(ii1 != cii ));
77 { // N3644 testing
78 typedef std::u32string C;
79 C::iterator ii1{}, ii2{};
80 C::iterator ii4 = ii1;
81 C::const_iterator cii{};
82 assert ( ii1 == ii2 );
83 assert ( ii1 == ii4 );
84 assert ( ii1 == cii );
85 assert ( !(ii1 != ii2 ));
86 assert ( !(ii1 != cii ));
89 return 0;