Changeset f988834 for tests/collections/string-api-coverage.cfa
- Timestamp:
- Jan 19, 2024, 2:44:41 AM (20 months ago)
- Branches:
- master
- Children:
- ac939461
- Parents:
- 59c8dff (diff), e8b3717 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)
links above to see all the changes relative to each parent. - File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
tests/collections/string-api-coverage.cfa
r59c8dff rf988834 51 51 sout | (s == "hello") | (s == "world"); 52 52 sout | (s != "world") | (s != "hello"); 53 sout | ( frag == s(1, 4) ) | ( s3 == s(1,4) );54 sout | ( s3 != s(1, 4) ) | ( frag != s(1,4) );55 sout | ( s2(1, 4) == s(1,4) ) | ( s3(1,4) == s(1,4) );56 sout | ( s3(1, 4) != s(1,4) ) | ( s2(1,4) != s(1,4) );57 sout | ( s(1, 4) == frag ) | ( s(1,4) == s3 );58 sout | ( s(1, 4) != s3 ) | ( s(1,4) != frag );59 sout | ( s(1, 4) == "ell" ) | ( s(1,4) == "world" );60 sout | ( s(1, 4) != "world" ) | ( s(1,4) != "ell" );53 sout | ( frag == s(1,3) ) | ( s3 == s(1,3) ); 54 sout | ( s3 != s(1,3) ) | ( frag != s(1,3) ); 55 sout | ( s2(1,3) == s(1,3) ) | ( s3(1,3) == s(1,3) ); 56 sout | ( s3(1,3) != s(1,3) ) | ( s2(1,3) != s(1,3) ); 57 sout | ( s(1,3) == frag ) | ( s(1,3) == s3 ); 58 sout | ( s(1,3) != s3 ) | ( s(1,3) != frag ); 59 sout | ( s(1,3) == "ell" ) | ( s(1,3) == "world" ); 60 sout | ( s(1,3) != "world" ) | ( s(1,3) != "ell" ); 61 61 62 62 … … 66 66 // 67 67 { 68 string b1 = { "1234567", 3 }; 69 sout | b1; // 123 68 string b1 = "1234567"; 69 sout | b1; // 1234567 70 71 string b1x = { "1234567", 3 }; 72 sout | b1x; // 123 70 73 71 74 string b2 = s; 72 75 sout | b2; // hello 76 77 string b2x = { s, 4 }; 78 sout | b2x; // hell 73 79 74 80 // todo: a plain string & … … 88 94 b4 = s_constref; 89 95 sout | b4; // world 96 97 string b5 = 'Q'; 98 sout | b5; // Q 99 100 90 101 } 91 102 assertWellFormedHandleList( 10 ); 103 // 104 // Assignments 105 // 106 { 107 string b = "xxx"; 108 109 b = "1234567"; 110 sout | b; // 1234567 111 112 b = "xxx"; 113 b = s; 114 sout | b; // hello 115 116 b = "xxx"; 117 b = 'Q'; 118 sout | b; // Q 119 120 b = "xxx"; 121 assign( b, "1234567", 3 ); 122 sout | b; // 123 123 124 b = "xxx"; 125 assign( b, s, 4 ); 126 sout | b; // hell 127 128 b = "xxx"; 129 strcpy(b, "1234567"); 130 sout | b; // 1234567 131 132 b = "xxx"; 133 strcpy(b, s); 134 sout | b; // hello 135 136 b = "xxx"; 137 strncpy( b, "1234567", 3 ); 138 sout | b; // 123 139 140 b = "xxx"; 141 strncpy( b, s, 4 ); 142 sout | b; // hell 143 } 144 assertWellFormedHandleList( 10 ); 145 146 92 147 93 148 sout | size(s); // 5 … … 126 181 sout | sx; // bye, friend 127 182 183 sx = "o"; 184 strcat( sx, s ); 185 sout | sx; // ohello 186 187 sx = "o"; 188 append( sx, s, 4 ); 189 sout | sx; // ohell 190 191 sx = "o"; 192 strncat( sx, s, 4 ); 193 sout | sx; // ohell 194 195 sx = "o"; 196 strcat( sx, "mydarling" ); 197 sout | sx; // omydarling 198 199 sx = "o"; 200 append( sx, "mydarling", 2 ); 201 sout | sx; // omy 202 203 sx = "o"; 204 strncat( sx, "mydarling", 2 ); 205 sout | sx; // omy 206 128 207 // 129 208 // repetition 130 209 // 210 211 sx = s; 212 sx *= 4; 213 sout | sx; // hellohellohellohello 214 131 215 sx = s * 3; 132 216 sout | sx; // hellohellohello … … 142 226 // 143 227 144 //... 228 // Range cases treated thoroughly in "string-overwrite" test. 229 // Composability with comparison and search are demoed above and below. 230 // Coverage here adds the single-argument ("rest of string") overload. 231 232 sx = s; 233 sout | sx(3); // lo 234 sx(3) = "iocentric"; 235 sout | s | sx; // hello heliocentric 145 236 146 237 // … … 244 335 | find( alphabet , "def") // 3 245 336 | find( alphabet( 0, 26), "def") // 3 246 | find( alphabet( 2, 2 6), "def") // 1247 | find( alphabet( 3, 2 6), "def") // 0248 | find( alphabet( 4, 2 6), "def") // 22, not found249 | find( alphabet( 4, 2 6), "ef") // 0337 | find( alphabet( 2, 24), "def") // 1 338 | find( alphabet( 3, 23), "def") // 0 339 | find( alphabet( 4, 22), "def") // 22, not found 340 | find( alphabet( 4, 22), "ef") // 0 250 341 | find( alphabet( 0, 6), "def") // 3 251 342 | find( alphabet( 0, 5), "def") // 5, not found … … 255 346 | includes( alphabet , "def") // true 256 347 | includes( alphabet( 0, 26), "def") // true 257 | includes( alphabet( 2, 2 6), "def") // true258 | includes( alphabet( 3, 2 6), "def") // true259 | includes( alphabet( 4, 2 6), "def") // false260 | includes( alphabet( 4, 2 6), "ef") // true348 | includes( alphabet( 2, 24), "def") // true 349 | includes( alphabet( 3, 23), "def") // true 350 | includes( alphabet( 4, 22), "def") // false 351 | includes( alphabet( 4, 22), "ef") // true 261 352 | includes( alphabet( 0, 6), "def") // true 262 353 | includes( alphabet( 0, 5), "def") // false … … 266 357 | startsWith( alphabet , "abc") // true 267 358 | startsWith( alphabet( 0, 26), "abc") // true 268 | startsWith( alphabet( 1, 2 6), "abc") // false269 | startsWith( alphabet( 1, 2 6), "bc") // true359 | startsWith( alphabet( 1, 25), "abc") // false 360 | startsWith( alphabet( 1, 25), "bc") // true 270 361 | startsWith( alphabet( 0, 26), "abc") // true 271 362 | startsWith( alphabet( 0, 4), "abc") // true … … 281 372 | endsWith( alphabet( 0, 25), "xy" ) // true 282 373 | endsWith( alphabet( 0, 26), "xyz") // true 283 | endsWith( alphabet(23, 26), "xyz") // true284 | endsWith( alphabet(24, 26), "xyz") // false285 | endsWith( alphabet(24, 26), "yz") // true374 | endsWith( alphabet(23, 3), "xyz") // true 375 | endsWith( alphabet(24, 2), "xyz") // false 376 | endsWith( alphabet(24, 2), "yz") // true 286 377 | endsWith( alphabet , "abc"); // false 287 378
Note:
See TracChangeset
for help on using the changeset viewer.