- Timestamp:
- Jan 19, 2024, 2:44:41 AM (21 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. - Location:
- tests
- Files:
-
- 5 added
- 15 edited
Legend:
- Unmodified
- Added
- Removed
-
tests/Makefile.am
r59c8dff rf988834 92 92 concurrency/channels/parallel_harness.hfa \ 93 93 array-collections/dimexpr-match.hfa \ 94 array-collections/dimexpr-match-detail.sh 94 array-collections/dimexpr-match-detail.sh \ 95 array-collections/array-raii.hfa 95 96 96 97 dist-hook: -
tests/collections/.expect/string-api-coverage.txt
r59c8dff rf988834 14 14 true false 15 15 true false 16 1234567 16 17 123 17 18 hello 19 hell 18 20 hello 19 21 world 20 22 hello 21 23 world 24 Q 25 1234567 26 hello 27 Q 28 123 29 hell 30 1234567 31 hello 32 123 33 hell 22 34 5 23 35 helloworld … … 29 41 hello, friend 30 42 bye, friend 43 ohello 44 ohell 45 ohell 46 omydarling 47 omy 48 omy 49 hellohellohellohello 31 50 hellohellohello 32 51 QQQ 33 52 asdfasdfasdf 53 lo 54 hello heliocentric 34 55 e 35 56 help!!!o -
tests/collections/.expect/string-compare.txt
r59c8dff rf988834 1 1 ------- string ------- 2 ( cmp(s_, s_) == 0) ok2 (strcmp(s_, s_) == 0) ok 3 3 (s_ == s_) ok 4 4 !(s_ != s_) ok … … 7 7 (s_ <= s_) ok 8 8 !(s_ < s_) ok 9 ( cmp("", s_) == 0) ok9 (strcmp("", s_) == 0) ok 10 10 ("" == s_) ok 11 11 !("" != s_) ok … … 14 14 ("" <= s_) ok 15 15 !("" < s_) ok 16 ( cmp(s_, "") == 0) ok16 (strcmp(s_, "") == 0) ok 17 17 (s_ == "") ok 18 18 !(s_ != "") ok … … 21 21 (s_ <= "") ok 22 22 !(s_ < "") ok 23 ( cmp(s_, s_a) < 0) ok23 (strcmp(s_, s_a) < 0) ok 24 24 !(s_ == s_a) ok 25 25 (s_ != s_a) ok … … 28 28 (s_ <= s_a) ok 29 29 (s_ < s_a) ok 30 ( cmp("", s_a) < 0) ok30 (strcmp("", s_a) < 0) ok 31 31 !("" == s_a) ok 32 32 ("" != s_a) ok … … 35 35 ("" <= s_a) ok 36 36 ("" < s_a) ok 37 ( cmp(s_, "a") < 0) ok37 (strcmp(s_, "a") < 0) ok 38 38 !(s_ == "a") ok 39 39 (s_ != "a") ok … … 42 42 (s_ <= "a") ok 43 43 (s_ < "a") ok 44 ( cmp(s_a, s_) > 0) ok44 (strcmp(s_a, s_) > 0) ok 45 45 !(s_a == s_) ok 46 46 (s_a != s_) ok … … 49 49 !(s_a <= s_) ok 50 50 !(s_a < s_) ok 51 ( cmp("a", s_) > 0) ok51 (strcmp("a", s_) > 0) ok 52 52 !("a" == s_) ok 53 53 ("a" != s_) ok … … 56 56 !("a" <= s_) ok 57 57 !("a" < s_) ok 58 ( cmp(s_a, "") > 0) ok58 (strcmp(s_a, "") > 0) ok 59 59 !(s_a == "") ok 60 60 (s_a != "") ok … … 63 63 !(s_a <= "") ok 64 64 !(s_a < "") ok 65 ( cmp(s_, s_aa) < 0) ok65 (strcmp(s_, s_aa) < 0) ok 66 66 !(s_ == s_aa) ok 67 67 (s_ != s_aa) ok … … 70 70 (s_ <= s_aa) ok 71 71 (s_ < s_aa) ok 72 ( cmp("", s_aa) < 0) ok72 (strcmp("", s_aa) < 0) ok 73 73 !("" == s_aa) ok 74 74 ("" != s_aa) ok … … 77 77 ("" <= s_aa) ok 78 78 ("" < s_aa) ok 79 ( cmp(s_, "aa") < 0) ok79 (strcmp(s_, "aa") < 0) ok 80 80 !(s_ == "aa") ok 81 81 (s_ != "aa") ok … … 84 84 (s_ <= "aa") ok 85 85 (s_ < "aa") ok 86 ( cmp(s_aa, s_) > 0) ok86 (strcmp(s_aa, s_) > 0) ok 87 87 !(s_aa == s_) ok 88 88 (s_aa != s_) ok … … 91 91 !(s_aa <= s_) ok 92 92 !(s_aa < s_) ok 93 ( cmp("aa", s_) > 0) ok93 (strcmp("aa", s_) > 0) ok 94 94 !("aa" == s_) ok 95 95 ("aa" != s_) ok … … 98 98 !("aa" <= s_) ok 99 99 !("aa" < s_) ok 100 ( cmp(s_aa, "") > 0) ok100 (strcmp(s_aa, "") > 0) ok 101 101 !(s_aa == "") ok 102 102 (s_aa != "") ok … … 105 105 !(s_aa <= "") ok 106 106 !(s_aa < "") ok 107 ( cmp(s_a, s_aa) < 0) ok107 (strcmp(s_a, s_aa) < 0) ok 108 108 !(s_a == s_aa) ok 109 109 (s_a != s_aa) ok … … 112 112 (s_a <= s_aa) ok 113 113 (s_a < s_aa) ok 114 ( cmp("a", s_aa) < 0) ok114 (strcmp("a", s_aa) < 0) ok 115 115 !("a" == s_aa) ok 116 116 ("a" != s_aa) ok … … 119 119 ("a" <= s_aa) ok 120 120 ("a" < s_aa) ok 121 ( cmp(s_a, "aa") < 0) ok121 (strcmp(s_a, "aa") < 0) ok 122 122 !(s_a == "aa") ok 123 123 (s_a != "aa") ok … … 126 126 (s_a <= "aa") ok 127 127 (s_a < "aa") ok 128 ( cmp(s_aa, s_a) > 0) ok128 (strcmp(s_aa, s_a) > 0) ok 129 129 !(s_aa == s_a) ok 130 130 (s_aa != s_a) ok … … 133 133 !(s_aa <= s_a) ok 134 134 !(s_aa < s_a) ok 135 ( cmp("aa", s_a) > 0) ok135 (strcmp("aa", s_a) > 0) ok 136 136 !("aa" == s_a) ok 137 137 ("aa" != s_a) ok … … 140 140 !("aa" <= s_a) ok 141 141 !("aa" < s_a) ok 142 ( cmp(s_aa, "a") > 0) ok142 (strcmp(s_aa, "a") > 0) ok 143 143 !(s_aa == "a") ok 144 144 (s_aa != "a") ok … … 147 147 !(s_aa <= "a") ok 148 148 !(s_aa < "a") ok 149 ( cmp(s_a, s_a) == 0) ok149 (strcmp(s_a, s_a) == 0) ok 150 150 (s_a == s_a) ok 151 151 !(s_a != s_a) ok … … 154 154 (s_a <= s_a) ok 155 155 !(s_a < s_a) ok 156 ( cmp("a", s_a) == 0) ok156 (strcmp("a", s_a) == 0) ok 157 157 ("a" == s_a) ok 158 158 !("a" != s_a) ok … … 161 161 ("a" <= s_a) ok 162 162 !("a" < s_a) ok 163 ( cmp(s_a, "a") == 0) ok163 (strcmp(s_a, "a") == 0) ok 164 164 (s_a == "a") ok 165 165 !(s_a != "a") ok … … 168 168 (s_a <= "a") ok 169 169 !(s_a < "a") ok 170 ( cmp(s_aa, s_aa) == 0) ok170 (strcmp(s_aa, s_aa) == 0) ok 171 171 (s_aa == s_aa) ok 172 172 !(s_aa != s_aa) ok … … 175 175 (s_aa <= s_aa) ok 176 176 !(s_aa < s_aa) ok 177 ( cmp("aa", s_aa) == 0) ok177 (strcmp("aa", s_aa) == 0) ok 178 178 ("aa" == s_aa) ok 179 179 !("aa" != s_aa) ok … … 182 182 ("aa" <= s_aa) ok 183 183 !("aa" < s_aa) ok 184 ( cmp(s_aa, "aa") == 0) ok184 (strcmp(s_aa, "aa") == 0) ok 185 185 (s_aa == "aa") ok 186 186 !(s_aa != "aa") ok … … 189 189 (s_aa <= "aa") ok 190 190 !(s_aa < "aa") ok 191 ( cmp(s_a, s_b) < 0) ok191 (strcmp(s_a, s_b) < 0) ok 192 192 !(s_a == s_b) ok 193 193 (s_a != s_b) ok … … 196 196 (s_a <= s_b) ok 197 197 (s_a < s_b) ok 198 ( cmp("a", s_b) < 0) ok198 (strcmp("a", s_b) < 0) ok 199 199 !("a" == s_b) ok 200 200 ("a" != s_b) ok … … 203 203 ("a" <= s_b) ok 204 204 ("a" < s_b) ok 205 ( cmp(s_a, "b") < 0) ok205 (strcmp(s_a, "b") < 0) ok 206 206 !(s_a == "b") ok 207 207 (s_a != "b") ok … … 210 210 (s_a <= "b") ok 211 211 (s_a < "b") ok 212 ( cmp(s_b, s_a) > 0) ok212 (strcmp(s_b, s_a) > 0) ok 213 213 !(s_b == s_a) ok 214 214 (s_b != s_a) ok … … 217 217 !(s_b <= s_a) ok 218 218 !(s_b < s_a) ok 219 ( cmp("b", s_a) > 0) ok219 (strcmp("b", s_a) > 0) ok 220 220 !("b" == s_a) ok 221 221 ("b" != s_a) ok … … 224 224 !("b" <= s_a) ok 225 225 !("b" < s_a) ok 226 ( cmp(s_b, "a") > 0) ok226 (strcmp(s_b, "a") > 0) ok 227 227 !(s_b == "a") ok 228 228 (s_b != "a") ok … … 231 231 !(s_b <= "a") ok 232 232 !(s_b < "a") ok 233 ( cmp(s_a, s_ba) < 0) ok233 (strcmp(s_a, s_ba) < 0) ok 234 234 !(s_a == s_ba) ok 235 235 (s_a != s_ba) ok … … 238 238 (s_a <= s_ba) ok 239 239 (s_a < s_ba) ok 240 ( cmp("a", s_ba) < 0) ok240 (strcmp("a", s_ba) < 0) ok 241 241 !("a" == s_ba) ok 242 242 ("a" != s_ba) ok … … 245 245 ("a" <= s_ba) ok 246 246 ("a" < s_ba) ok 247 ( cmp(s_a, "ba") < 0) ok247 (strcmp(s_a, "ba") < 0) ok 248 248 !(s_a == "ba") ok 249 249 (s_a != "ba") ok … … 252 252 (s_a <= "ba") ok 253 253 (s_a < "ba") ok 254 ( cmp(s_ba, s_a) > 0) ok254 (strcmp(s_ba, s_a) > 0) ok 255 255 !(s_ba == s_a) ok 256 256 (s_ba != s_a) ok … … 259 259 !(s_ba <= s_a) ok 260 260 !(s_ba < s_a) ok 261 ( cmp("ba", s_a) > 0) ok261 (strcmp("ba", s_a) > 0) ok 262 262 !("ba" == s_a) ok 263 263 ("ba" != s_a) ok … … 266 266 !("ba" <= s_a) ok 267 267 !("ba" < s_a) ok 268 ( cmp(s_ba, "a") > 0) ok268 (strcmp(s_ba, "a") > 0) ok 269 269 !(s_ba == "a") ok 270 270 (s_ba != "a") ok … … 273 273 !(s_ba <= "a") ok 274 274 !(s_ba < "a") ok 275 ( cmp(s_aa, s_ab) < 0) ok275 (strcmp(s_aa, s_ab) < 0) ok 276 276 !(s_aa == s_ab) ok 277 277 (s_aa != s_ab) ok … … 280 280 (s_aa <= s_ab) ok 281 281 (s_aa < s_ab) ok 282 ( cmp("aa", s_ab) < 0) ok282 (strcmp("aa", s_ab) < 0) ok 283 283 !("aa" == s_ab) ok 284 284 ("aa" != s_ab) ok … … 287 287 ("aa" <= s_ab) ok 288 288 ("aa" < s_ab) ok 289 ( cmp(s_aa, "ab") < 0) ok289 (strcmp(s_aa, "ab") < 0) ok 290 290 !(s_aa == "ab") ok 291 291 (s_aa != "ab") ok … … 294 294 (s_aa <= "ab") ok 295 295 (s_aa < "ab") ok 296 ( cmp(s_ab, s_aa) > 0) ok296 (strcmp(s_ab, s_aa) > 0) ok 297 297 !(s_ab == s_aa) ok 298 298 (s_ab != s_aa) ok … … 301 301 !(s_ab <= s_aa) ok 302 302 !(s_ab < s_aa) ok 303 ( cmp("ab", s_aa) > 0) ok303 (strcmp("ab", s_aa) > 0) ok 304 304 !("ab" == s_aa) ok 305 305 ("ab" != s_aa) ok … … 308 308 !("ab" <= s_aa) ok 309 309 !("ab" < s_aa) ok 310 ( cmp(s_ab, "aa") > 0) ok310 (strcmp(s_ab, "aa") > 0) ok 311 311 !(s_ab == "aa") ok 312 312 (s_ab != "aa") ok … … 315 315 !(s_ab <= "aa") ok 316 316 !(s_ab < "aa") ok 317 ( cmp(s_ba, s_bb) < 0) ok317 (strcmp(s_ba, s_bb) < 0) ok 318 318 !(s_ba == s_bb) ok 319 319 (s_ba != s_bb) ok … … 322 322 (s_ba <= s_bb) ok 323 323 (s_ba < s_bb) ok 324 ( cmp("ba", s_bb) < 0) ok324 (strcmp("ba", s_bb) < 0) ok 325 325 !("ba" == s_bb) ok 326 326 ("ba" != s_bb) ok … … 329 329 ("ba" <= s_bb) ok 330 330 ("ba" < s_bb) ok 331 ( cmp(s_ba, "bb") < 0) ok331 (strcmp(s_ba, "bb") < 0) ok 332 332 !(s_ba == "bb") ok 333 333 (s_ba != "bb") ok … … 336 336 (s_ba <= "bb") ok 337 337 (s_ba < "bb") ok 338 ( cmp(s_bb, s_ba) > 0) ok338 (strcmp(s_bb, s_ba) > 0) ok 339 339 !(s_bb == s_ba) ok 340 340 (s_bb != s_ba) ok … … 343 343 !(s_bb <= s_ba) ok 344 344 !(s_bb < s_ba) ok 345 ( cmp("bb", s_ba) > 0) ok345 (strcmp("bb", s_ba) > 0) ok 346 346 !("bb" == s_ba) ok 347 347 ("bb" != s_ba) ok … … 350 350 !("bb" <= s_ba) ok 351 351 !("bb" < s_ba) ok 352 ( cmp(s_bb, "ba") > 0) ok352 (strcmp(s_bb, "ba") > 0) ok 353 353 !(s_bb == "ba") ok 354 354 (s_bb != "ba") ok … … 357 357 !(s_bb <= "ba") ok 358 358 !(s_bb < "ba") ok 359 ( cmp(s_aa, s_b) < 0) ok359 (strcmp(s_aa, s_b) < 0) ok 360 360 !(s_aa == s_b) ok 361 361 (s_aa != s_b) ok … … 364 364 (s_aa <= s_b) ok 365 365 (s_aa < s_b) ok 366 ( cmp("aa", s_b) < 0) ok366 (strcmp("aa", s_b) < 0) ok 367 367 !("aa" == s_b) ok 368 368 ("aa" != s_b) ok … … 371 371 ("aa" <= s_b) ok 372 372 ("aa" < s_b) ok 373 ( cmp(s_aa, "b") < 0) ok373 (strcmp(s_aa, "b") < 0) ok 374 374 !(s_aa == "b") ok 375 375 (s_aa != "b") ok … … 378 378 (s_aa <= "b") ok 379 379 (s_aa < "b") ok 380 ( cmp(s_b, s_aa) > 0) ok380 (strcmp(s_b, s_aa) > 0) ok 381 381 !(s_b == s_aa) ok 382 382 (s_b != s_aa) ok … … 385 385 !(s_b <= s_aa) ok 386 386 !(s_b < s_aa) ok 387 ( cmp("b", s_aa) > 0) ok387 (strcmp("b", s_aa) > 0) ok 388 388 !("b" == s_aa) ok 389 389 ("b" != s_aa) ok … … 392 392 !("b" <= s_aa) ok 393 393 !("b" < s_aa) ok 394 ( cmp(s_b, "aa") > 0) ok394 (strcmp(s_b, "aa") > 0) ok 395 395 !(s_b == "aa") ok 396 396 (s_b != "aa") ok … … 400 400 !(s_b < "aa") ok 401 401 ------- string_res ------- 402 ( cmp(s_, s_) == 0) ok402 (strcmp(s_, s_) == 0) ok 403 403 (s_ == s_) ok 404 404 !(s_ != s_) ok … … 407 407 (s_ <= s_) ok 408 408 !(s_ < s_) ok 409 ( cmp("", s_) == 0) ok409 (strcmp("", s_) == 0) ok 410 410 ("" == s_) ok 411 411 !("" != s_) ok … … 414 414 ("" <= s_) ok 415 415 !("" < s_) ok 416 ( cmp(s_, "") == 0) ok416 (strcmp(s_, "") == 0) ok 417 417 (s_ == "") ok 418 418 !(s_ != "") ok … … 421 421 (s_ <= "") ok 422 422 !(s_ < "") ok 423 ( cmp(s_, s_a) < 0) ok423 (strcmp(s_, s_a) < 0) ok 424 424 !(s_ == s_a) ok 425 425 (s_ != s_a) ok … … 428 428 (s_ <= s_a) ok 429 429 (s_ < s_a) ok 430 ( cmp("", s_a) < 0) ok430 (strcmp("", s_a) < 0) ok 431 431 !("" == s_a) ok 432 432 ("" != s_a) ok … … 435 435 ("" <= s_a) ok 436 436 ("" < s_a) ok 437 ( cmp(s_, "a") < 0) ok437 (strcmp(s_, "a") < 0) ok 438 438 !(s_ == "a") ok 439 439 (s_ != "a") ok … … 442 442 (s_ <= "a") ok 443 443 (s_ < "a") ok 444 ( cmp(s_a, s_) > 0) ok444 (strcmp(s_a, s_) > 0) ok 445 445 !(s_a == s_) ok 446 446 (s_a != s_) ok … … 449 449 !(s_a <= s_) ok 450 450 !(s_a < s_) ok 451 ( cmp("a", s_) > 0) ok451 (strcmp("a", s_) > 0) ok 452 452 !("a" == s_) ok 453 453 ("a" != s_) ok … … 456 456 !("a" <= s_) ok 457 457 !("a" < s_) ok 458 ( cmp(s_a, "") > 0) ok458 (strcmp(s_a, "") > 0) ok 459 459 !(s_a == "") ok 460 460 (s_a != "") ok … … 463 463 !(s_a <= "") ok 464 464 !(s_a < "") ok 465 ( cmp(s_, s_aa) < 0) ok465 (strcmp(s_, s_aa) < 0) ok 466 466 !(s_ == s_aa) ok 467 467 (s_ != s_aa) ok … … 470 470 (s_ <= s_aa) ok 471 471 (s_ < s_aa) ok 472 ( cmp("", s_aa) < 0) ok472 (strcmp("", s_aa) < 0) ok 473 473 !("" == s_aa) ok 474 474 ("" != s_aa) ok … … 477 477 ("" <= s_aa) ok 478 478 ("" < s_aa) ok 479 ( cmp(s_, "aa") < 0) ok479 (strcmp(s_, "aa") < 0) ok 480 480 !(s_ == "aa") ok 481 481 (s_ != "aa") ok … … 484 484 (s_ <= "aa") ok 485 485 (s_ < "aa") ok 486 ( cmp(s_aa, s_) > 0) ok486 (strcmp(s_aa, s_) > 0) ok 487 487 !(s_aa == s_) ok 488 488 (s_aa != s_) ok … … 491 491 !(s_aa <= s_) ok 492 492 !(s_aa < s_) ok 493 ( cmp("aa", s_) > 0) ok493 (strcmp("aa", s_) > 0) ok 494 494 !("aa" == s_) ok 495 495 ("aa" != s_) ok … … 498 498 !("aa" <= s_) ok 499 499 !("aa" < s_) ok 500 ( cmp(s_aa, "") > 0) ok500 (strcmp(s_aa, "") > 0) ok 501 501 !(s_aa == "") ok 502 502 (s_aa != "") ok … … 505 505 !(s_aa <= "") ok 506 506 !(s_aa < "") ok 507 ( cmp(s_a, s_aa) < 0) ok507 (strcmp(s_a, s_aa) < 0) ok 508 508 !(s_a == s_aa) ok 509 509 (s_a != s_aa) ok … … 512 512 (s_a <= s_aa) ok 513 513 (s_a < s_aa) ok 514 ( cmp("a", s_aa) < 0) ok514 (strcmp("a", s_aa) < 0) ok 515 515 !("a" == s_aa) ok 516 516 ("a" != s_aa) ok … … 519 519 ("a" <= s_aa) ok 520 520 ("a" < s_aa) ok 521 ( cmp(s_a, "aa") < 0) ok521 (strcmp(s_a, "aa") < 0) ok 522 522 !(s_a == "aa") ok 523 523 (s_a != "aa") ok … … 526 526 (s_a <= "aa") ok 527 527 (s_a < "aa") ok 528 ( cmp(s_aa, s_a) > 0) ok528 (strcmp(s_aa, s_a) > 0) ok 529 529 !(s_aa == s_a) ok 530 530 (s_aa != s_a) ok … … 533 533 !(s_aa <= s_a) ok 534 534 !(s_aa < s_a) ok 535 ( cmp("aa", s_a) > 0) ok535 (strcmp("aa", s_a) > 0) ok 536 536 !("aa" == s_a) ok 537 537 ("aa" != s_a) ok … … 540 540 !("aa" <= s_a) ok 541 541 !("aa" < s_a) ok 542 ( cmp(s_aa, "a") > 0) ok542 (strcmp(s_aa, "a") > 0) ok 543 543 !(s_aa == "a") ok 544 544 (s_aa != "a") ok … … 547 547 !(s_aa <= "a") ok 548 548 !(s_aa < "a") ok 549 ( cmp(s_a, s_a) == 0) ok549 (strcmp(s_a, s_a) == 0) ok 550 550 (s_a == s_a) ok 551 551 !(s_a != s_a) ok … … 554 554 (s_a <= s_a) ok 555 555 !(s_a < s_a) ok 556 ( cmp("a", s_a) == 0) ok556 (strcmp("a", s_a) == 0) ok 557 557 ("a" == s_a) ok 558 558 !("a" != s_a) ok … … 561 561 ("a" <= s_a) ok 562 562 !("a" < s_a) ok 563 ( cmp(s_a, "a") == 0) ok563 (strcmp(s_a, "a") == 0) ok 564 564 (s_a == "a") ok 565 565 !(s_a != "a") ok … … 568 568 (s_a <= "a") ok 569 569 !(s_a < "a") ok 570 ( cmp(s_aa, s_aa) == 0) ok570 (strcmp(s_aa, s_aa) == 0) ok 571 571 (s_aa == s_aa) ok 572 572 !(s_aa != s_aa) ok … … 575 575 (s_aa <= s_aa) ok 576 576 !(s_aa < s_aa) ok 577 ( cmp("aa", s_aa) == 0) ok577 (strcmp("aa", s_aa) == 0) ok 578 578 ("aa" == s_aa) ok 579 579 !("aa" != s_aa) ok … … 582 582 ("aa" <= s_aa) ok 583 583 !("aa" < s_aa) ok 584 ( cmp(s_aa, "aa") == 0) ok584 (strcmp(s_aa, "aa") == 0) ok 585 585 (s_aa == "aa") ok 586 586 !(s_aa != "aa") ok … … 589 589 (s_aa <= "aa") ok 590 590 !(s_aa < "aa") ok 591 ( cmp(s_a, s_b) < 0) ok591 (strcmp(s_a, s_b) < 0) ok 592 592 !(s_a == s_b) ok 593 593 (s_a != s_b) ok … … 596 596 (s_a <= s_b) ok 597 597 (s_a < s_b) ok 598 ( cmp("a", s_b) < 0) ok598 (strcmp("a", s_b) < 0) ok 599 599 !("a" == s_b) ok 600 600 ("a" != s_b) ok … … 603 603 ("a" <= s_b) ok 604 604 ("a" < s_b) ok 605 ( cmp(s_a, "b") < 0) ok605 (strcmp(s_a, "b") < 0) ok 606 606 !(s_a == "b") ok 607 607 (s_a != "b") ok … … 610 610 (s_a <= "b") ok 611 611 (s_a < "b") ok 612 ( cmp(s_b, s_a) > 0) ok612 (strcmp(s_b, s_a) > 0) ok 613 613 !(s_b == s_a) ok 614 614 (s_b != s_a) ok … … 617 617 !(s_b <= s_a) ok 618 618 !(s_b < s_a) ok 619 ( cmp("b", s_a) > 0) ok619 (strcmp("b", s_a) > 0) ok 620 620 !("b" == s_a) ok 621 621 ("b" != s_a) ok … … 624 624 !("b" <= s_a) ok 625 625 !("b" < s_a) ok 626 ( cmp(s_b, "a") > 0) ok626 (strcmp(s_b, "a") > 0) ok 627 627 !(s_b == "a") ok 628 628 (s_b != "a") ok … … 631 631 !(s_b <= "a") ok 632 632 !(s_b < "a") ok 633 ( cmp(s_a, s_ba) < 0) ok633 (strcmp(s_a, s_ba) < 0) ok 634 634 !(s_a == s_ba) ok 635 635 (s_a != s_ba) ok … … 638 638 (s_a <= s_ba) ok 639 639 (s_a < s_ba) ok 640 ( cmp("a", s_ba) < 0) ok640 (strcmp("a", s_ba) < 0) ok 641 641 !("a" == s_ba) ok 642 642 ("a" != s_ba) ok … … 645 645 ("a" <= s_ba) ok 646 646 ("a" < s_ba) ok 647 ( cmp(s_a, "ba") < 0) ok647 (strcmp(s_a, "ba") < 0) ok 648 648 !(s_a == "ba") ok 649 649 (s_a != "ba") ok … … 652 652 (s_a <= "ba") ok 653 653 (s_a < "ba") ok 654 ( cmp(s_ba, s_a) > 0) ok654 (strcmp(s_ba, s_a) > 0) ok 655 655 !(s_ba == s_a) ok 656 656 (s_ba != s_a) ok … … 659 659 !(s_ba <= s_a) ok 660 660 !(s_ba < s_a) ok 661 ( cmp("ba", s_a) > 0) ok661 (strcmp("ba", s_a) > 0) ok 662 662 !("ba" == s_a) ok 663 663 ("ba" != s_a) ok … … 666 666 !("ba" <= s_a) ok 667 667 !("ba" < s_a) ok 668 ( cmp(s_ba, "a") > 0) ok668 (strcmp(s_ba, "a") > 0) ok 669 669 !(s_ba == "a") ok 670 670 (s_ba != "a") ok … … 673 673 !(s_ba <= "a") ok 674 674 !(s_ba < "a") ok 675 ( cmp(s_aa, s_ab) < 0) ok675 (strcmp(s_aa, s_ab) < 0) ok 676 676 !(s_aa == s_ab) ok 677 677 (s_aa != s_ab) ok … … 680 680 (s_aa <= s_ab) ok 681 681 (s_aa < s_ab) ok 682 ( cmp("aa", s_ab) < 0) ok682 (strcmp("aa", s_ab) < 0) ok 683 683 !("aa" == s_ab) ok 684 684 ("aa" != s_ab) ok … … 687 687 ("aa" <= s_ab) ok 688 688 ("aa" < s_ab) ok 689 ( cmp(s_aa, "ab") < 0) ok689 (strcmp(s_aa, "ab") < 0) ok 690 690 !(s_aa == "ab") ok 691 691 (s_aa != "ab") ok … … 694 694 (s_aa <= "ab") ok 695 695 (s_aa < "ab") ok 696 ( cmp(s_ab, s_aa) > 0) ok696 (strcmp(s_ab, s_aa) > 0) ok 697 697 !(s_ab == s_aa) ok 698 698 (s_ab != s_aa) ok … … 701 701 !(s_ab <= s_aa) ok 702 702 !(s_ab < s_aa) ok 703 ( cmp("ab", s_aa) > 0) ok703 (strcmp("ab", s_aa) > 0) ok 704 704 !("ab" == s_aa) ok 705 705 ("ab" != s_aa) ok … … 708 708 !("ab" <= s_aa) ok 709 709 !("ab" < s_aa) ok 710 ( cmp(s_ab, "aa") > 0) ok710 (strcmp(s_ab, "aa") > 0) ok 711 711 !(s_ab == "aa") ok 712 712 (s_ab != "aa") ok … … 715 715 !(s_ab <= "aa") ok 716 716 !(s_ab < "aa") ok 717 ( cmp(s_ba, s_bb) < 0) ok717 (strcmp(s_ba, s_bb) < 0) ok 718 718 !(s_ba == s_bb) ok 719 719 (s_ba != s_bb) ok … … 722 722 (s_ba <= s_bb) ok 723 723 (s_ba < s_bb) ok 724 ( cmp("ba", s_bb) < 0) ok724 (strcmp("ba", s_bb) < 0) ok 725 725 !("ba" == s_bb) ok 726 726 ("ba" != s_bb) ok … … 729 729 ("ba" <= s_bb) ok 730 730 ("ba" < s_bb) ok 731 ( cmp(s_ba, "bb") < 0) ok731 (strcmp(s_ba, "bb") < 0) ok 732 732 !(s_ba == "bb") ok 733 733 (s_ba != "bb") ok … … 736 736 (s_ba <= "bb") ok 737 737 (s_ba < "bb") ok 738 ( cmp(s_bb, s_ba) > 0) ok738 (strcmp(s_bb, s_ba) > 0) ok 739 739 !(s_bb == s_ba) ok 740 740 (s_bb != s_ba) ok … … 743 743 !(s_bb <= s_ba) ok 744 744 !(s_bb < s_ba) ok 745 ( cmp("bb", s_ba) > 0) ok745 (strcmp("bb", s_ba) > 0) ok 746 746 !("bb" == s_ba) ok 747 747 ("bb" != s_ba) ok … … 750 750 !("bb" <= s_ba) ok 751 751 !("bb" < s_ba) ok 752 ( cmp(s_bb, "ba") > 0) ok752 (strcmp(s_bb, "ba") > 0) ok 753 753 !(s_bb == "ba") ok 754 754 (s_bb != "ba") ok … … 757 757 !(s_bb <= "ba") ok 758 758 !(s_bb < "ba") ok 759 ( cmp(s_aa, s_b) < 0) ok759 (strcmp(s_aa, s_b) < 0) ok 760 760 !(s_aa == s_b) ok 761 761 (s_aa != s_b) ok … … 764 764 (s_aa <= s_b) ok 765 765 (s_aa < s_b) ok 766 ( cmp("aa", s_b) < 0) ok766 (strcmp("aa", s_b) < 0) ok 767 767 !("aa" == s_b) ok 768 768 ("aa" != s_b) ok … … 771 771 ("aa" <= s_b) ok 772 772 ("aa" < s_b) ok 773 ( cmp(s_aa, "b") < 0) ok773 (strcmp(s_aa, "b") < 0) ok 774 774 !(s_aa == "b") ok 775 775 (s_aa != "b") ok … … 778 778 (s_aa <= "b") ok 779 779 (s_aa < "b") ok 780 ( cmp(s_b, s_aa) > 0) ok780 (strcmp(s_b, s_aa) > 0) ok 781 781 !(s_b == s_aa) ok 782 782 (s_b != s_aa) ok … … 785 785 !(s_b <= s_aa) ok 786 786 !(s_b < s_aa) ok 787 ( cmp("b", s_aa) > 0) ok787 (strcmp("b", s_aa) > 0) ok 788 788 !("b" == s_aa) ok 789 789 ("b" != s_aa) ok … … 792 792 !("b" <= s_aa) ok 793 793 !("b" < s_aa) ok 794 ( cmp(s_b, "aa") > 0) ok794 (strcmp(s_b, "aa") > 0) ok 795 795 !(s_b == "aa") ok 796 796 (s_b != "aa") ok -
tests/collections/.expect/string-istream-manip.txt
r59c8dff rf988834 69 69 13 wwwwwwww 70 70 14 cccc 71 15 q71 15 72 72 1 yyyyyyyyyyyyyyyyyyyy 73 73 2 abcxxx … … 84 84 13 wwwwwwww 85 85 14 cccc 86 15 q86 15 -
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 -
tests/collections/string-compare.cfa
r59c8dff rf988834 3 3 4 4 #define test_eq_(l, r) \ 5 chk( ( cmp(l, r) == 0) ) \5 chk( (strcmp(l, r) == 0) ) \ 6 6 chk( (l == r) ) \ 7 7 chk( !(l != r) ) \ … … 17 17 18 18 #define test_lt_(l, r) \ 19 chk( ( cmp(l, r) < 0) ) \19 chk( (strcmp(l, r) < 0) ) \ 20 20 chk( !(l == r) ) \ 21 21 chk( (l != r) ) \ … … 26 26 27 27 #define test_gt_(l, r) \ 28 chk( ( cmp(l, r) > 0) ) \28 chk( (strcmp(l, r) > 0) ) \ 29 29 chk( !(l == r) ) \ 30 30 chk( (l != r) ) \ -
tests/collections/string-overwrite.cfa
r59c8dff rf988834 9 9 MS = modifier start 10 10 ME = modifier end 11 ML = modifier length 11 12 WS = witness start 12 13 WE = witness end 14 WL = witness length 13 15 14 16 The test does: … … 71 73 72 74 73 void showOneReplacement(string & s, int ms, int me, int ws, int we, const char* replaceWith) { 75 void showOneReplacement(string & s, int ms, int ml, int ws, int wl, const char* replaceWith) { 76 77 int me = ms + ml; 78 int we = ws + wl; 74 79 75 80 assert( ms >= 0 && ms <= me && me <= size(s) ); 76 81 assert( ws >= 0 && ws <= we && we <= size(s) ); 77 82 78 string mod = s(ms, m e)`shareEdits;79 string wit = s(ws, w e)`shareEdits;83 string mod = s(ms, ml)`shareEdits; 84 string wit = s(ws, wl)`shareEdits; 80 85 81 86 string modOld = mod; … … 118 123 void runReplaceCases() { 119 124 char * alphabetTemplate = "abcdefghijklmnopqrstuvwxyz"; 120 struct { int ms; int m e; int ws; int we; char *replaceWith; char *label; } cases[] = {121 { 12, 14, 10, 20, "xxxxx", "warmup" },122 { 10, 10, 10, 10, "=====", "1" },123 { 10, 10, 10, 10, "==" , "" },124 { 10, 10, 10, 10, "=" , "" },125 { 10, 10, 10, 10, "" , "" },126 { 10, 12, 12, 12, "=====", "2" },127 { 10, 12, 12, 12, "==" , "" },128 { 10, 12, 12, 12, "=" , "" },129 { 10, 12, 12, 12, "" , "" },130 { 12, 12, 10, 12, "=====", "3" },131 { 12, 12, 10, 12, "==" , "" },132 { 12, 12, 10, 12, "=" , "" },133 { 12, 12, 10, 12, "" , "" },134 { 10, 10, 12, 12, "=====", "4" },135 { 10, 10, 12, 12, "==" , "" },136 { 10, 10, 12, 12, "=" , "" },137 { 10, 10, 12, 12, "" , "" },138 { 12, 12, 10, 10, "=====", "5" },139 { 12, 12, 10, 10, "==" , "" },140 { 12, 12, 10, 10, "=" , "" },141 { 12, 12, 10, 10, "" , "" },142 { 10, 12, 10, 12, "=====", "6" },143 { 10, 12, 10, 12, "==" , "" },144 { 10, 12, 10, 12, "=" , "" },145 { 10, 12, 10, 12, "" , "" },146 { 10, 12, 10, 10, "=====", "7" },147 { 10, 12, 10, 10, "==" , "" },148 { 10, 12, 10, 10, "=" , "" },149 { 10, 12, 10, 10, "" , "" },150 { 10, 10, 10, 12, "=====", "8" },151 { 10, 10, 10, 12, "==" , "" },152 { 10, 10, 10, 12, "=" , "" },153 { 10, 10, 10, 12, "" , "" },154 { 10, 12, 14, 14, "=====", "9" },155 { 10, 12, 14, 14, "==" , "" },156 { 10, 12, 14, 14, "=" , "" },157 { 10, 12, 14, 14, "" , "" },158 { 10, 14, 12, 14, "=====", "10" },159 { 10, 14, 12, 14, "==" , "" },160 { 10, 14, 12, 14, "=" , "" }, // FORMERLY unrunnable bug: tries to print seemingly infinite string161 { 10, 14, 12, 14, "" , "" }, // ditto162 { 14, 14, 10, 12, "=====", "11" },163 { 14, 14, 10, 12, "==" , "" },164 { 14, 14, 10, 12, "=" , "" },165 { 14, 14, 10, 12, "" , "" },166 { 12, 14, 10, 14, "=====", "12" }, // correctness observation: watching klmn while mn |-> xxx gives klxxx because the mn is inside what I'm watching167 { 12, 14, 10, 14, "==" , "" },168 { 12, 14, 10, 14, "=" , "" },169 { 12, 14, 10, 14, "" , "" },170 { 10, 12, 12, 14, "=====", "13" },171 { 10, 12, 12, 14, "==" , "" },172 { 10, 12, 12, 14, "=" , "" },173 { 10, 12, 12, 14, "" , "" },174 { 10, 14, 12, 12, "=====", "14" },175 { 10, 14, 12, 12, "==" , "" },176 { 10, 14, 12, 12, "=" , "" },177 { 10, 14, 12, 12, "" , "" },178 { 12, 14, 10, 12, "=====", "15" },179 { 12, 14, 10, 12, "==" , "" },180 { 12, 14, 10, 12, "=" , "" },181 { 12, 14, 10, 12, "" , "" },182 { 12, 12, 10, 14, "=====", "16" },183 { 12, 12, 10, 14, "==" , "" },184 { 12, 12, 10, 14, "=" , "" },185 { 12, 12, 10, 14, "" , "" },186 { 10, 14, 10, 12, "=====", "17" },187 { 10, 14, 10, 12, "==" , "" },188 { 10, 14, 10, 12, "=" , "" },189 { 10, 14, 10, 12, "" , "" },190 { 10, 10, 12, 14, "=====", "18" },191 { 10, 10, 12, 14, "==" , "" },192 { 10, 10, 12, 14, "=" , "" },193 { 10, 10, 12, 14, "" , "" },194 { 10, 12, 10, 14, "=====", "19" },195 { 10, 12, 10, 14, "==" , "" },196 { 10, 12, 10, 14, "=" , "" },197 { 10, 12, 10, 14, "" , "" },198 { 12, 14, 10, 10, "=====", "20" },199 { 12, 14, 10, 10, "==" , "" },200 { 12, 14, 10, 10, "=" , "" },201 { 12, 14, 10, 10, "" , "" },202 { 10, 12, 14, 16, "=====", "21" },203 { 10, 12, 14, 16, "==" , "" },204 { 10, 12, 14, 16, "=" , "" },205 { 10, 12, 14, 16, "" , "" },206 { 10, 14, 12, 16, "=====", "22" },207 { 10, 14, 12, 16, "==" , "" },208 { 10, 14, 12, 16, "=" , "" },209 { 10, 14, 12, 16, "" , "" },210 { 10, 16, 12, 14, "=====", "23" },211 { 10, 16, 12, 14, "==" , "" },212 { 10, 16, 12, 14, "=" , "" },213 { 10, 16, 12, 14, "" , "" },214 { 14, 16, 10, 12, "=====", "24" },215 { 14, 16, 10, 12, "==" , "" },216 { 14, 16, 10, 12, "=" , "" },217 { 14, 16, 10, 12, "" , "" },218 { 12, 16, 10, 14, "=====", "25" },219 { 12, 16, 10, 14, "==" , "" },220 { 12, 16, 10, 14, "=" , "" },221 { 12, 16, 10, 14, "" , "" },222 { 12, 14, 10, 16, "=====", "26" },223 { 12, 14, 10, 16, "==" , "" },224 { 12, 14, 10, 16, "=" , "" },225 { 12, 14, 10, 16, "" , "" },125 struct { int ms; int ml; int ws; int wl; char *replaceWith; char *label; } cases[] = { 126 { 12, 2, 10, 10, "xxxxx", "warmup" }, 127 { 10, 0, 10, 0, "=====", "1" }, 128 { 10, 0, 10, 0, "==" , "" }, 129 { 10, 0, 10, 0, "=" , "" }, 130 { 10, 0, 10, 0, "" , "" }, 131 { 10, 2, 12, 0, "=====", "2" }, 132 { 10, 2, 12, 0, "==" , "" }, 133 { 10, 2, 12, 0, "=" , "" }, 134 { 10, 2, 12, 0, "" , "" }, 135 { 12, 0, 10, 2, "=====", "3" }, 136 { 12, 0, 10, 2, "==" , "" }, 137 { 12, 0, 10, 2, "=" , "" }, 138 { 12, 0, 10, 2, "" , "" }, 139 { 10, 0, 12, 0, "=====", "4" }, 140 { 10, 0, 12, 0, "==" , "" }, 141 { 10, 0, 12, 0, "=" , "" }, 142 { 10, 0, 12, 0, "" , "" }, 143 { 12, 0, 10, 0, "=====", "5" }, 144 { 12, 0, 10, 0, "==" , "" }, 145 { 12, 0, 10, 0, "=" , "" }, 146 { 12, 0, 10, 0, "" , "" }, 147 { 10, 2, 10, 2, "=====", "6" }, 148 { 10, 2, 10, 2, "==" , "" }, 149 { 10, 2, 10, 2, "=" , "" }, 150 { 10, 2, 10, 2, "" , "" }, 151 { 10, 2, 10, 0, "=====", "7" }, 152 { 10, 2, 10, 0, "==" , "" }, 153 { 10, 2, 10, 0, "=" , "" }, 154 { 10, 2, 10, 0, "" , "" }, 155 { 10, 0, 10, 2, "=====", "8" }, 156 { 10, 0, 10, 2, "==" , "" }, 157 { 10, 0, 10, 2, "=" , "" }, 158 { 10, 0, 10, 2, "" , "" }, 159 { 10, 2, 14, 0, "=====", "9" }, 160 { 10, 2, 14, 0, "==" , "" }, 161 { 10, 2, 14, 0, "=" , "" }, 162 { 10, 2, 14, 0, "" , "" }, 163 { 10, 4, 12, 2, "=====", "10" }, 164 { 10, 4, 12, 2, "==" , "" }, 165 { 10, 4, 12, 2, "=" , "" }, // FORMERLY unrunnable bug: tries to print seemingly infinite string 166 { 10, 4, 12, 2, "" , "" }, // ditto 167 { 14, 0, 10, 2, "=====", "11" }, 168 { 14, 0, 10, 2, "==" , "" }, 169 { 14, 0, 10, 2, "=" , "" }, 170 { 14, 0, 10, 2, "" , "" }, 171 { 12, 2, 10, 4, "=====", "12" }, // correctness observation: watching klmn while mn |-> xxx gives klxxx because the mn is inside what I'm watching 172 { 12, 2, 10, 4, "==" , "" }, 173 { 12, 2, 10, 4, "=" , "" }, 174 { 12, 2, 10, 4, "" , "" }, 175 { 10, 2, 12, 2, "=====", "13" }, 176 { 10, 2, 12, 2, "==" , "" }, 177 { 10, 2, 12, 2, "=" , "" }, 178 { 10, 2, 12, 2, "" , "" }, 179 { 10, 4, 12, 0, "=====", "14" }, 180 { 10, 4, 12, 0, "==" , "" }, 181 { 10, 4, 12, 0, "=" , "" }, 182 { 10, 4, 12, 0, "" , "" }, 183 { 12, 2, 10, 2, "=====", "15" }, 184 { 12, 2, 10, 2, "==" , "" }, 185 { 12, 2, 10, 2, "=" , "" }, 186 { 12, 2, 10, 2, "" , "" }, 187 { 12, 0, 10, 4, "=====", "16" }, 188 { 12, 0, 10, 4, "==" , "" }, 189 { 12, 0, 10, 4, "=" , "" }, 190 { 12, 0, 10, 4, "" , "" }, 191 { 10, 4, 10, 2, "=====", "17" }, 192 { 10, 4, 10, 2, "==" , "" }, 193 { 10, 4, 10, 2, "=" , "" }, 194 { 10, 4, 10, 2, "" , "" }, 195 { 10, 0, 12, 2, "=====", "18" }, 196 { 10, 0, 12, 2, "==" , "" }, 197 { 10, 0, 12, 2, "=" , "" }, 198 { 10, 0, 12, 2, "" , "" }, 199 { 10, 2, 10, 4, "=====", "19" }, 200 { 10, 2, 10, 4, "==" , "" }, 201 { 10, 2, 10, 4, "=" , "" }, 202 { 10, 2, 10, 4, "" , "" }, 203 { 12, 2, 10, 0, "=====", "20" }, 204 { 12, 2, 10, 0, "==" , "" }, 205 { 12, 2, 10, 0, "=" , "" }, 206 { 12, 2, 10, 0, "" , "" }, 207 { 10, 2, 14, 2, "=====", "21" }, 208 { 10, 2, 14, 2, "==" , "" }, 209 { 10, 2, 14, 2, "=" , "" }, 210 { 10, 2, 14, 2, "" , "" }, 211 { 10, 4, 12, 4, "=====", "22" }, 212 { 10, 4, 12, 4, "==" , "" }, 213 { 10, 4, 12, 4, "=" , "" }, 214 { 10, 4, 12, 4, "" , "" }, 215 { 10, 6, 12, 2, "=====", "23" }, 216 { 10, 6, 12, 2, "==" , "" }, 217 { 10, 6, 12, 2, "=" , "" }, 218 { 10, 6, 12, 2, "" , "" }, 219 { 14, 2, 10, 2, "=====", "24" }, 220 { 14, 2, 10, 2, "==" , "" }, 221 { 14, 2, 10, 2, "=" , "" }, 222 { 14, 2, 10, 2, "" , "" }, 223 { 12, 4, 10, 4, "=====", "25" }, 224 { 12, 4, 10, 4, "==" , "" }, 225 { 12, 4, 10, 4, "=" , "" }, 226 { 12, 4, 10, 4, "" , "" }, 227 { 12, 2, 10, 6, "=====", "26" }, 228 { 12, 2, 10, 6, "==" , "" }, 229 { 12, 2, 10, 6, "=" , "" }, 230 { 12, 2, 10, 6, "" , "" }, 226 231 }; 227 232 for ( i; sizeof(cases)/sizeof(cases[0]) ) { 228 233 sout | "------------------------------------------------------------------------" | cases[i].label; 229 234 string replaceIn = alphabetTemplate; 230 showOneReplacement( replaceIn, cases[i].ms, cases[i].m e, cases[i].ws, cases[i].we, cases[i].replaceWith );235 showOneReplacement( replaceIn, cases[i].ms, cases[i].ml, cases[i].ws, cases[i].wl, cases[i].replaceWith ); 231 236 } 232 237 } … … 244 249 string s = "abcdefghijklmnopqrstuvwxyz"; 245 250 246 s(5, 10) = "qqqqq"; // start=5, end=10, len=5247 248 sout | s; 249 250 251 s(5, 5) = "-----"; // start=5, end=5, len=0251 s(5,5) = "qqqqq"; // start=5, end=10, len=5 252 253 sout | s; 254 255 256 s(5,0) = "-----"; // start=5, end=5, len=0 252 257 253 258 sout | s; -
tests/concurrency/examples/quickSort.cfa
r59c8dff rf988834 11 11 // Created On : Wed Dec 6 12:15:52 2017 12 12 // Last Modified By : Peter A. Buhr 13 // Last Modified On : Wed Feb 12 18:24:47 2020 14 // Update Count : 177 15 // 16 17 #include <fstream.hfa> 18 #include <stdlib.hfa> 19 #include <kernel.hfa> 13 // Last Modified On : Mon Jan 1 12:07:59 2024 14 // Update Count : 188 15 // 16 17 #include <fstream.hfa> // sin/sout 18 #include <stdlib.hfa> // convert 20 19 #include <thread.hfa> 20 #include <math.hfa> // sqrt 21 21 #include <string.h> // strcmp 22 22 … … 82 82 } // main 83 83 84 85 bool convert( int & val, const char * nptr ) { // convert C string to integer 86 char * eptr; 87 int temp = strto( nptr, &eptr, 10 ); // do not change val on false 88 // true => entire string valid with no extra characters 89 return *nptr != '\0' && *eptr == '\0' ? val = temp, true : false; 90 } // convert 91 92 void usage( char * argv[] ) { 93 sout | "Usage:" | argv[0] | "( -s unsorted-file [ sorted-file ] | -t size (>= 0) [ depth (>= 0) ] )"; 94 exit( EXIT_FAILURE ); // TERMINATE! 95 } // usage 96 84 // convert(...) throws out_of_range or invalid_argument 85 ExceptionDecl( cmd_error ); 97 86 98 87 int main( int argc, char * argv[] ) { 99 ifstream & unsortedfile = sin;100 ofstream & sortedfile = sout; // default value101 int depth = 0, size;102 103 i f ( argc != 1 ) { // do not use defaults104 if ( argc < 2 || argc > 4 ) usage( argv ); // wrong number of options 105 if ( strcmp( argv[1], "-t" ) == 0 ) { // timing ?106 &unsortedfile = (ifstream *)0; // no input88 ifstream unsortedfile = sin; // default values 89 ofstream sortedfile = sout; 90 // Must be signed because of the conversion routine. 91 intmax_t depth = 0; 92 intmax_t size = -1; // -1 means time mode not activated 93 94 try { 95 if ( 1 < argc && strcmp( argv[1], "-t" ) == 0 ) { // time mode ? 107 96 choose ( argc ) { 108 97 case 4: 109 if ( ! convert( depth, argv[3] ) || depth < 0 ) usage( argv ); 98 depth = convert( argv[3] ); // invalid integer ? 99 if ( depth < 0 ) throw ExceptionInst( cmd_error ); 110 100 fallthrough; 111 101 case 3: 112 if ( ! convert( size, argv[2] ) || size < 0 ) usage( argv ); 102 size = convert( argv[2] ); // invalid integer ? 103 if ( size < 0 ) throw ExceptionInst( cmd_error ); 104 default: // wrong number of options 105 throw ExceptionInst( cmd_error ); 113 106 } // choose 114 107 } else { // sort file 115 108 choose ( argc ) { 116 case 3: 117 &sortedfile = new( (const char *)argv[2] ); // open the output file 118 if ( fail( sortedfile ) ) { 119 serr | "Error! Could not open sorted output file \"" | argv[2] | "\""; 120 usage( argv ); 109 case 4: 110 depth = convert( argv[3] ); // invalid integer ? 111 if ( depth < 0 ) throw ExceptionInst( cmd_error ); 112 fallthrough; 113 case 3: case 2: 114 if ( strcmp( argv[1], "d" ) != 0 ) { 115 try { // open input file first as output creates file 116 open( unsortedfile, argv[1] ); 117 } catch( open_failure * ) { // open failed ? 118 serr | "Error! Could not open unsorted input file \"" | argv[1] | "\""; 119 throw ExceptionInst( cmd_error ); 120 } // try 121 } // if 122 if ( argc > 2 && strcmp( argv[2], "d" ) != 0 ) { 123 try { 124 open( sortedfile, argv[2] ); 125 } catch( open_failure * ) { // open failed ? 126 serr | "Error! Could not open sorted output file \"" | argv[2] | "\""; 127 throw ExceptionInst( cmd_error ); 128 } // try 121 129 } // if 122 130 fallthrough; 123 case 2: 124 &unsortedfile = new( (const char *)argv[1] ); // open the input file 125 if ( fail( unsortedfile ) ) { 126 serr | "Error! Could not open unsorted input file \"" | argv[1] | "\""; 127 usage( argv ); 128 } // if 131 case 1: ; // defaults 132 default: // wrong number of options 133 throw ExceptionInst( cmd_error ); 129 134 } // choose 130 135 } // if 131 } // if 136 } catch( exception_t * ) { // catch any 137 exit | "Usage: " | argv[0] | // TERMINATE 138 " ( [ unsorted-file | 'd' [ sorted-file | 'd' [ depth (>= 0) ] ] ]" 139 " | -t size (>= 0) [ depth (>= 0) ] )"; 140 } // try 141 142 enum { ValuesPerLine = 22 }; // number of values printed per line 143 132 144 sortedfile | nlOff; // turn off auto newline 133 145 134 enum { ValuesPerLine = 22 }; // number of values printed per line 135 136 if ( &unsortedfile ) { // generate output ? 146 if ( size == -1 ) { // generate output ? 137 147 for () { 138 148 unsortedfile | size; // read number of elements in the list 139 149 if ( eof( unsortedfile ) ) break; 140 int * values = alloc( size ); // values to be sorted, too large to put on stack 150 151 int * values = aalloc( size ); // values to be sorted, too large to put on stack 141 152 for ( counter; size ) { // read unsorted numbers 142 153 unsortedfile | values[counter]; … … 146 157 } // for 147 158 sortedfile | nl; 159 148 160 if ( size > 0 ) { // values to sort ? 149 161 Quicksort QS = { values, size - 1, 0 }; // sort values … … 158 170 delete( values ); 159 171 } // for 160 if ( &unsortedfile != &sin ) delete( &unsortedfile ); // close input/output files 161 if ( &sortedfile != &sout ) delete( &sortedfile ); 162 } else { 172 } else { // timing 173 PRNG prng; 163 174 processor processors[ (1 << depth) - 1 ] __attribute__(( unused )); // create 2^depth-1 kernel threads 164 165 int * values = alloc( size ); // values to be sorted, too large to put on stack 175 int * values = aalloc( size ); // values to be sorted, too large to put on stack 176 166 177 for ( counter; size ) { // generate unsorted numbers 167 178 values[counter] = size - counter; // descending values 168 179 } // for 169 for ( i; 200 ) { // random shuffle a few values 170 swap( values[rand() % size], values[rand() % size] ); 180 181 unsigned int times = sqrt( size ); 182 for ( unsigned int counter = 0; counter < times; counter += 1 ) { 183 swap( values[0], values[prng(size)] ); // randomize unsorted numbers 171 184 } // for 172 185 { -
tests/exceptions/hotpotato.cfa
r59c8dff rf988834 5 5 6 6 struct Potato { 7 8 unsigned int deadline;// when timer goes off9 unsigned int timer;// up counter to deadline7 PRNG & prng; 8 unsigned int deadline; // when timer goes off 9 unsigned int timer; // up counter to deadline 10 10 }; // Potato 11 11 … … 16 16 &potato.prng = &prng; 17 17 reset( potato, maxTicks ); 18 } // Potato18 } // Potato 19 19 20 20 coroutine Player { 21 22 int id;// player identity23 Potato & potato;// potato being tossed24 Player * partner[2];// left and right player21 PRNG & prng; 22 int id; // player identity 23 Potato & potato; // potato being tossed 24 Player * partner[2]; // left and right player 25 25 }; // Player 26 26 … … 29 29 player.id = id; 30 30 &player.potato = &potato; 31 } // Player31 } // Player 32 32 33 33 Player & umpire; … … 39 39 40 40 void reset( Potato & potato, unsigned int maxTicks ) with(potato) { 41 41 if ( maxTicks < 2 ) abort( "Hot Potato initialized with less than 2 ticks" ); // optional 42 42 deadline = prng( prng, 1, maxTicks ); 43 43 timer = 0; … … 60 60 enum { LEFT = 0, RIGHT = 1 }; 61 61 62 static void vote( Player & player, Election & election ) { 63 62 static void vote( Player & player, Election & election ) { // cause partner to vote 63 resumeAt( player, election ); 64 64 resume( player ); 65 65 } // vote … … 76 76 77 77 void main( Player & player ) with(player) { 78 suspend;// return immediately after establishing starter78 suspend; // return immediately after establishing starter 79 79 try { 80 81 poll();// check for non-local exceptions before proceeding82 83 84 85 86 87 88 countdown( potato );// player is eliminated if countdown() returned true89 90 91 92 resume( *partner[ side ] );// random toss left/right93 80 for ( ;; ) { 81 poll(); // check for non-local exceptions before proceeding 82 83 if ( partner[LEFT] == &player ) { // stop when only one player 84 sout | id | " wins the Match!"; 85 return; 86 } // exit 87 88 countdown( potato ); // player is eliminated if countdown() returned true 89 90 size_t side = prng( prng, 2 ); 91 sout | id | " -> " | nonl; 92 resume( *partner[ side ] ); // random toss left/right 93 } // for 94 94 } catchResume( Terminate * v ) { 95 95 v->victim->partner[LEFT]->partner[RIGHT] = v->victim->partner[RIGHT]; // unlink node 96 96 v->victim->partner[RIGHT]->partner[LEFT] = v->victim->partner[LEFT]; 97 97 delete( v->victim ); 98 98 reset( potato ); 99 99 sout | "U " | nonl; // start new game … … 102 102 sout | "election"; 103 103 sout | " -> " | id | nonl; 104 if ( id > getId( umpire ) ) &umpire = &player; 104 if ( id > getId( umpire ) ) &umpire = &player; // set umpire to highest id so far 105 105 vote( *partner[RIGHT], *election ); 106 106 } catchResume ( Explode * ) { 107 108 109 id = -1;// remove from election110 vote( *partner[RIGHT], ExceptionInst( Election ) );// start election111 112 113 114 115 resume( umpire );// resume umpire to terminate this player116 assert( false );// no return117 107 sout | id | " is eliminated"; 108 if ( &player == &umpire ) { 109 id = -1; // remove from election 110 vote( *partner[RIGHT], ExceptionInst( Election ) ); // start election 111 try { poll(); } catchResume( Election * election ) {} // handle end of election 112 sout | " : umpire " | getId( umpire ); 113 } // if 114 resumeAt( umpire, ExceptionInst( Terminate, &player ) ); 115 resume( umpire ); // resume umpire to terminate this player 116 assert( false ); // no return 117 } // try 118 118 } // main 119 119 … … 151 151 case 1: ; // defaults 152 152 default: // too many arguments 153 throw ExceptionInst( cmd_error );153 throw ExceptionInst( cmd_error ); 154 154 } // choose 155 155 } catch( exception_t * ) { // catch any 156 156 exit | "Usage: " | argv[0] 157 158 159 157 | " [ games (>=0) | 'd' (default " | DefaultGames 158 | ") [ players (>=2) | 'd' (random " | MinNoPlayers | "-" | MaxNoPlayers 159 | ") [ seed (>0) | 'd' (random) ] ] ]"; 160 160 } // try 161 161 sout | numGames | numPlayers | seed; -
tests/exceptions/hotpotato_checked.cfa
r59c8dff rf988834 5 5 6 6 struct Potato { 7 8 unsigned int deadline;// when timer goes off9 unsigned int timer;// up counter to deadline7 PRNG & prng; 8 unsigned int deadline; // when timer goes off 9 unsigned int timer; // up counter to deadline 10 10 }; // Potato 11 11 … … 16 16 &potato.prng = &prng; 17 17 reset( potato, maxTicks ); 18 } // Potato18 } // Potato 19 19 20 20 coroutine Player { 21 22 int id;// player identity23 Potato & potato;// potato being tossed24 Player * partner[2];// left and right player21 PRNG & prng; 22 int id; // player identity 23 Potato & potato; // potato being tossed 24 Player * partner[2]; // left and right player 25 25 }; // Player 26 26 … … 29 29 player.id = id; 30 30 &player.potato = &potato; 31 } // Player31 } // Player 32 32 33 33 Player & umpire; … … 39 39 40 40 void reset( Potato & potato, unsigned int maxTicks ) with(potato) { 41 41 if ( maxTicks < 2 ) abort( "Hot Potato initialized with less than 2 ticks" ); // optional 42 42 deadline = prng( prng, 1, maxTicks ); 43 43 timer = 0; … … 66 66 static void terminate( Player & player ) { // resume umpire 67 67 resume( player ); 68 69 68 checked_poll(); 69 sout | "THIS SHOULD NOT BE REACHED"; 70 70 } // terminate 71 71 … … 74 74 partner[RIGHT] = &rp; 75 75 resume( player ); // establish main as starter for termination 76 76 checked_poll(); 77 77 } // init 78 78 … … 82 82 83 83 void toss( Player & player ) { // tossed the potato 84 84 resume( player ); 85 85 checked_poll(); 86 86 } // toss … … 88 88 void main( Player & player ) with(player) { 89 89 try { 90 enable_ehm();// allow delivery of nonlocal exceptions91 suspend;// return immediately after establishing starter92 93 94 95 96 97 98 99 100 101 countdown( potato );// player is eliminated if countdown() returned true102 103 104 105 toss( *partner[ side ] );// random toss left/right106 107 90 enable_ehm(); // allow delivery of nonlocal exceptions 91 suspend; // return immediately after establishing starter 92 checked_poll(); 93 94 for ( ;; ) { 95 checked_poll(); 96 if ( partner[LEFT] == &player ) { // stop when only one player 97 sout | id | " wins the Match!"; 98 return; 99 } // exit 100 101 countdown( potato ); // player is eliminated if countdown() returned true 102 103 size_t side = prng( prng, 2 ); 104 sout | id | " -> " | nonl; 105 toss( *partner[ side ] ); // random toss left/right 106 } // for 107 disable_ehm(); 108 108 } catchResume( Terminate * v ) { 109 109 v->victim->partner[LEFT]->partner[RIGHT] = v->victim->partner[RIGHT]; // unlink node 110 110 v->victim->partner[RIGHT]->partner[LEFT] = v->victim->partner[LEFT]; 111 111 delete( v->victim ); 112 112 reset( potato ); 113 113 sout | "U " | nonl; // start new game … … 116 116 sout | "election"; 117 117 sout | " -> " | id | nonl; 118 if ( id > getId( umpire ) ) &umpire = &player; 119 120 disable_ehm();// disable ehm since we can't handle execption thrown in vote here and want to poll later118 if ( id > getId( umpire ) ) &umpire = &player; // set umpire to highest id so far 119 resumeAt( *partner[RIGHT], *election ); 120 disable_ehm(); // disable ehm since we can't handle execption thrown in vote here and want to poll later 121 121 vote( *partner[RIGHT] ); 122 enable_ehm();// enable after vote122 enable_ehm(); // enable after vote 123 123 } catchResume( Explode * ) { 124 125 126 127 id = -1;// remove from election128 129 vote( *partner[RIGHT] );// start election130 131 132 133 134 135 136 137 assert( false );// no return138 124 sout | id | " is eliminated"; 125 if ( &player == &umpire ) { 126 try { 127 id = -1; // remove from election 128 resumeAt( *partner[RIGHT], ExceptionInst( Election ) ); 129 vote( *partner[RIGHT] ); // start election 130 checked_poll(); 131 } catchResume( Election * election ) { 132 sout | " : umpire " | getId( umpire ); 133 } // try 134 } // if 135 resumeAt( umpire, ExceptionInst( Terminate, &player ) ); 136 terminate( umpire ); 137 assert( false ); // no return 138 } // try 139 139 } // main 140 140 … … 172 172 case 1: ; // defaults 173 173 default: // too many arguments 174 throw ExceptionInst( cmd_error );174 throw ExceptionInst( cmd_error ); 175 175 } // choose 176 176 } catch( exception_t * ) { // catch any 177 177 exit | "Usage: " | argv[0] 178 179 180 178 | " [ games (>=0) | 'd' (default " | DefaultGames 179 | ") [ players (>=2) | 'd' (random " | MinNoPlayers | "-" | MaxNoPlayers 180 | ") [ seed (>0) | 'd' (random) ] ] ]"; 181 181 } // try 182 182 sout | numGames | numPlayers | seed; -
tests/io/.expect/manipulatorsInput.arm64.txt
r59c8dff rf988834 20 20 14 rc=1, cccc 21 21 15 rc=0, q 22 16 get this line 23 17 @# this line 1)-{} 24 18 abc 25 19 abc 26 20 d d 27 28 d 29 21 ZC44% 22 30 1 yyyyyyyyyyyyyyyyyyyy 23 31 2 abcxxx … … 35 43 14 cccc 36 44 15 45 16 get this line 46 17 @# this line 1)-{} 47 18 abc 48 19 abc 49 20 d d 50 51 d 52 21 ZC44% 37 53 a 38 54 a -
tests/io/.expect/manipulatorsInput.x64.txt
r59c8dff rf988834 20 20 14 rc=1, cccc 21 21 15 rc=0, q 22 16 get this line 23 17 @# this line 1)-{} 24 18 abc 25 19 abc 26 20 d d 27 28 d 29 21 ZC44% 22 30 1 yyyyyyyyyyyyyyyyyyyy 23 31 2 abcxxx … … 35 43 14 cccc 36 44 15 45 16 get this line 46 17 @# this line 1)-{} 47 18 abc 48 19 abc 49 20 d d 50 51 d 52 21 ZC44% 37 53 a 38 54 a -
tests/io/.expect/manipulatorsInput.x86.txt
r59c8dff rf988834 20 20 14 rc=1, cccc 21 21 15 rc=0, q 22 16 get this line 23 17 @# this line 1)-{} 24 18 abc 25 19 abc 26 20 d d 27 28 d 29 21 ZC44% 22 30 1 yyyyyyyyyyyyyyyyyyyy 23 31 2 abcxxx … … 35 43 14 cccc 36 44 15 45 16 get this line 46 17 @# this line 1)-{} 47 18 abc 48 19 abc 49 20 d d 50 51 d 52 21 ZC44% 37 53 a 38 54 a -
tests/io/.in/manipulatorsInput.txt
r59c8dff rf988834 10 10 aaaaaaaaxxxxxxxxaabbccbbdddwwwbbbbbbbbwwwwwwwwaaaaaaaawwwwwwww 11 11 uuuuuccccuuuuu 12 get this line 13 @# this line 1)-{}% 14 "abc" 15 'abc ' 16 { d d 17 18 d } 19 X ZC44%Y 12 20 abc 13 21 cccccb … … 17 25 aaaaaaaaxxxxxxxxaabbccbbdddwwwbbbbbbbbwwwwwwwwaaaaaaaawwwwwwww 18 26 uuuuuccccuuuuu 27 get this line 28 @# this line 1)-{}% 29 "abc" 30 'abc ' 31 { d d 32 33 d } 34 X ZC44%Y 19 35 ab 20 36 0xff 017 15-15 -
tests/io/manipulatorsInput.cfa
r59c8dff rf988834 7 7 // Created On : Sat Jun 8 17:58:54 2019 8 8 // Last Modified By : Peter A. Buhr 9 // Last Modified On : Sat Sep 2 14:27:46 202310 // Update Count : 659 // Last Modified On : Wed Jan 3 11:15:04 2024 10 // Update Count : 103 11 11 // 12 12 … … 77 77 s[0] = 'q'; s[1] = '\0'; rc = 99; 78 78 rc = scanf( "%[^u]", s ); printf( "15 rc=%d, %s\n", rc, s ); 79 scanf( "%*[u]" ); 80 scanf("\n"); 79 scanf( "%*[u]\n" ); 80 scanf( "%[^\n]\n", s ); printf( "16 %s\n", s ); 81 scanf( "%[^%%]%%\n", s ); printf( "17 %s\n", s ); 82 83 scanf( "%*[ \f\n\r\t\v]" ); // ignore whitespace 84 scanf( "\"%[^\"]\"", s ); printf( "18 %s\n", s ); 85 scanf( "%*[ \f\n\r\t\v]" ); // ignore whitespace 86 scanf( "'%[^']'", s ); printf( "19 %s\n", s ); 87 scanf( "%*[ \f\n\r\t\v]" ); // ignore whitespace 88 scanf( "{%[^}]}", s ); printf( "20 %s\n", s ); 89 scanf( "%*[ \f\n\r\t\v]" ); // ignore whitespace 90 scanf( "X%[^Y]Y", s ); printf( "21 %s\n", s ); 91 scanf( "\n" ); // must start next line 81 92 } 82 93 { … … 102 113 s[0] = 'q'; s[1] = '\0'; 103 114 sin | excl( "u", wdi( sizeof(s), s ) ); sout | "15" | s; 104 sin | skip( "u" ); 105 sin | "\n"; 106 } 107 /* Keep harmonized with collections/string-istream-manip */ 115 sin | skip( "u" ) | "\n"; 116 sin | getline( wdi( sizeof(s), s ) ); sout | "16" | s; 117 sin | getline( wdi( sizeof(s), s ), '%' ) | "\n"; sout | "17" | s; 118 119 sin | quoted( wdi( sizeof(s), s ) ); sout | "18" | s; 120 sin | quoted( wdi( sizeof(s), s ), '\'' ); sout | "19" | s; 121 sin | quoted( wdi( sizeof(s), s ), '{', '}' ); sout | "20" | s; 122 sin | quoted( wdi( sizeof(s), s ), 'X', 'Y' ); sout | "21" | s; 123 } 124 // Keep harmonized with collections/string-istream-manip 108 125 { 109 126 char c;
Note:
See TracChangeset
for help on using the changeset viewer.