Changeset d7f0b3f7 in mainline for uspace/lib/cpp/src/internal/test/string.cpp
- Timestamp:
- 2018-07-05T21:41:18Z (7 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 2d302d6
- Parents:
- 27473fb8
- git-author:
- Jaroslav Jindrak <dzejrou@…> (2017-10-31 22:31:05)
- git-committer:
- Dzejrou <dzejrou@…> (2018-07-05 21:41:18)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/cpp/src/internal/test/string.cpp
r27473fb8 rd7f0b3f7 38 38 test_construction_and_assignment(); 39 39 test_append(); 40 test_insert(); 40 41 41 42 return true; … … 154 155 ); 155 156 } 157 158 void string_test::test_insert() 159 { 160 std::string check{"hello, world"}; 161 162 std::string str1{", world"}; 163 str1.insert(0, "hello"); 164 test_eq( 165 "insert at the beggining", 166 str1.begin(), str1.end(), 167 check.begin(), check.end() 168 ); 169 170 std::string str2{"hello,world"}; 171 str2.insert(str2.begin() + 6, ' '); 172 test_eq( 173 "insert char in the middle", 174 str2.begin(), str2.end(), 175 check.begin(), check.end() 176 ); 177 178 std::string str3{"heo, world"}; 179 str3.insert(str3.begin() + 2, 2ul, 'l'); 180 test_eq( 181 "insert n chars", 182 str3.begin(), str3.end(), 183 check.begin(), check.end() 184 ); 185 186 std::string str4{"h, world"}; 187 std::string insertee{"ello"}; 188 str4.insert(str4.begin() + 1, insertee.begin(), 189 insertee.end() - 1); 190 test_eq( 191 "insert iterator range", 192 str4.begin(), str4.end(), 193 check.begin(), check.end() 194 ); 195 /* std::printf("|%s|\n", str4.c_str()); */ 196 } 156 197 }
Note:
See TracChangeset
for help on using the changeset viewer.