libsheepyCSmallStringTest.c (418645B)
1 #include <stdlib.h> 2 #include <stdio.h> 3 #include <check.h> 4 5 //START MEM TEST ANCHOR 6 7 #include "../libsheepy.h" 8 #include "../libsheepyObject.h" 9 10 #ifdef __GNUC__ 11 #define UNUSED __attribute__ ((unused)) 12 #else 13 #define UNUSED 14 #endif 15 16 // TODO redirect stderr 17 18 19 START_TEST(initiateSmallStringT) 20 21 smallStringt self; 22 23 initiateSmallString(&self); 24 25 END_TEST 26 27 28 START_TEST(initiateAllocateSmallStringT) 29 30 smallStringt *self = null; 31 32 initiateAllocateSmallString(&self); 33 terminateO(self); 34 35 END_TEST 36 37 38 START_TEST(allocSmallStringT) 39 40 smallStringt* r; 41 42 r = allocSmallString("qwe"); 43 ck_assert_ptr_ne(r, null); 44 char *s = toStringO(r); 45 ck_assert_str_eq(s, "qwe"); 46 free(s); 47 terminateO(r); 48 49 END_TEST 50 51 52 START_TEST(createSFT) 53 54 smallStringt* r; 55 56 r = createS("qwe", "123", "!@#"); 57 ck_assert_ptr_ne(r, null); 58 char *s = toStringO(r); 59 ck_assert_str_eq(s, "qwe123!@#"); 60 free(s); 61 terminateO(r); 62 63 64 END_TEST 65 66 67 START_TEST(freeSmallStringT) 68 69 smallStringt *self = allocG("qwe"); 70 71 freeO(self); 72 ck_assert_ptr_eq(toStringO(self), null); 73 terminateO(self); 74 75 END_TEST 76 77 78 START_TEST(terminateSmallStringT) 79 80 smallStringt *self = allocG(""); 81 82 terminateO(self); 83 ck_assert_ptr_eq(self, null); 84 85 END_TEST 86 87 88 START_TEST(toStringSmallStringT) 89 90 char* r; 91 smallStringt *self = allocG("qwe"); 92 93 r = toStringO(self); 94 ck_assert_str_eq(r, "qwe"); 95 free(r); 96 freeO(self); 97 ck_assert_ptr_eq(toStringO(self), null); 98 terminateO(self); 99 100 END_TEST 101 102 103 START_TEST(duplicateSmallStringT) 104 105 smallStringt* r; 106 smallStringt *self = allocG("qwe"); 107 108 r = duplicateO(self); 109 ck_assert_ptr_ne(r, null); 110 char *s = toStringO(r); 111 ck_assert_str_eq(s, "qwe"); 112 free(s); 113 terminateO(r); 114 // empty object 115 freeO(self); 116 r = duplicateO(self); 117 ck_assert_ptr_ne(r, null); 118 ck_assert_ptr_eq(toStringO(r), null); 119 terminateO(r); 120 terminateO(self); 121 122 END_TEST 123 124 125 START_TEST(smashSmallStringT) 126 127 smallStringt *self = allocG(""); 128 129 freeO(self); 130 smashO(self); 131 132 END_TEST 133 134 135 START_TEST(finishSmallStringT) 136 137 smallStringt *self = allocG(""); 138 139 freeO(self); 140 finishO(self); 141 142 END_TEST 143 144 145 START_TEST(getSmallStringT) 146 147 char* r; 148 smallStringt *self = allocG(""); 149 150 r = getValO(self); 151 ck_assert_ptr_ne(r, null); 152 ck_assert_str_eq(r, ""); 153 // empty object 154 freeO(self); 155 r = getValO(self); 156 ck_assert_ptr_eq(r, null); 157 terminateO(self); 158 159 END_TEST 160 161 162 START_TEST(setSmallStringT) 163 164 smallStringt* r; 165 smallStringt *self = allocG(""); 166 167 r = setValO(self, "qwe"); 168 ck_assert_ptr_ne(r, null); 169 char *s = toStringO(r); 170 ck_assert_str_eq(s, "qwe"); 171 free(s); 172 // null 173 r = setValO(self, null); 174 ck_assert_ptr_eq(r, null); 175 terminateO(self); 176 177 END_TEST 178 179 180 START_TEST(setCharSmallStringT) 181 182 smallStringt* r; 183 smallStringt *self = allocG(""); 184 185 r = self->f->setChar(self, 'q'); 186 ck_assert_ptr_ne(r, null); 187 char *s = toStringO(r); 188 ck_assert_str_eq(s, "q"); 189 free(s); 190 terminateO(self); 191 192 END_TEST 193 194 195 START_TEST(setBoolSmallStringT) 196 197 smallStringt* r; 198 smallStringt* self = allocG(""); 199 200 r = self->f->setBool(self, false); 201 ck_assert_ptr_ne(r, null); 202 char *s = toStringO(r); 203 ck_assert_str_eq(s, "false"); 204 free(s); 205 r = self->f->setBool(self, true); 206 ck_assert_ptr_ne(r, null); 207 s = toStringO(r); 208 ck_assert_str_eq(s, "true"); 209 free(s); 210 terminateO(self); 211 212 END_TEST 213 214 215 START_TEST(setDoubleSmallStringT) 216 217 smallStringt* r; 218 smallStringt* self = allocG(""); 219 220 r = self->f->setDouble(self, 2.2); 221 ck_assert_ptr_ne(r, null); 222 char *s = toStringO(r); 223 ck_assert_str_eq(s, "2.200000e+00"); 224 free(s); 225 terminateO(self); 226 227 END_TEST 228 229 230 START_TEST(setInt64SmallStringT) 231 232 smallStringt* r; 233 smallStringt* self = allocG(""); 234 235 r = self->f->setInt64(self, 2); 236 ck_assert_ptr_ne(r, null); 237 char *s = toStringO(r); 238 ck_assert_str_eq(s, "2"); 239 free(s); 240 terminateO(self); 241 242 END_TEST 243 244 245 START_TEST(setInt32SmallStringT) 246 247 smallStringt* r; 248 smallStringt* self = allocG(""); 249 250 r = self->f->setInt32(self, 2); 251 ck_assert_ptr_ne(r, null); 252 char *s = toStringO(r); 253 ck_assert_str_eq(s, "2"); 254 free(s); 255 terminateO(self); 256 257 END_TEST 258 259 260 START_TEST(setUint32SmallStringT) 261 262 smallStringt* r; 263 smallStringt* self = allocG(""); 264 265 r = self->f->setUint32(self, 2); 266 ck_assert_ptr_ne(r, null); 267 char *s = toStringO(r); 268 ck_assert_str_eq(s, "2"); 269 free(s); 270 terminateO(self); 271 272 END_TEST 273 274 275 START_TEST(setUint64SmallStringT) 276 277 smallStringt* r; 278 smallStringt* self = allocG(""); 279 280 r = self->f->setUint64(self, 2); 281 ck_assert_ptr_ne(r, null); 282 char *s = toStringO(r); 283 ck_assert_str_eq(s, "2"); 284 free(s); 285 terminateO(self); 286 287 END_TEST 288 289 290 START_TEST(setSmallArraySmallStringT) 291 292 smallStringt* r; 293 smallStringt* self = allocG(""); 294 smallArrayt* p2 = allocSmallArray(); 295 296 p2->f->pushS(p2, "asd"); 297 r = self->f->setSmallArray(self, p2); 298 ck_assert_ptr_ne(r, null); 299 char *s = toStringO(r); 300 ck_assert_str_eq(s, "[\"asd\"]"); 301 free(s); 302 terminateO(p2); 303 // not smallArray object 304 p2 = (smallArrayt*) allocSmallInt(1); 305 r = self->f->setSmallArray(self, p2); 306 ck_assert_ptr_eq(r, null); 307 terminateO(p2); 308 // null parameter 309 r = self->f->setSmallArray(self, null); 310 ck_assert_ptr_eq(r, null); 311 terminateO(self); 312 313 END_TEST 314 315 316 START_TEST(setFromSmallDictSmallStringT) 317 318 smallStringt* r; 319 smallStringt* self = allocG(""); 320 smallDictt* p2 = allocSmallDict(); 321 322 p2->f->setS(p2, "1", "asd"); 323 r = self->f->setFromSmallDict(self, p2); 324 ck_assert_ptr_ne(r, null); 325 char *s = toStringO(r); 326 ck_assert_str_eq(s, "{\"1\":\"asd\"}"); 327 free(s); 328 terminateO(p2); 329 // not smallDict object 330 p2 = (smallDictt*) allocSmallInt(1); 331 r = self->f->setFromSmallDict(self, p2); 332 ck_assert_ptr_eq(r, null); 333 terminateO(p2); 334 // null parameter 335 r = self->f->setFromSmallDict(self, null); 336 ck_assert_ptr_eq(r, null); 337 terminateO(self); 338 339 END_TEST 340 341 342 START_TEST(setFromSmallJsonSmallStringT) 343 344 smallStringt* r; 345 smallStringt* self = allocG(""); 346 smallJsont* p2 = allocSmallJson(); 347 348 p2->f->setS(p2, "1", "asd"); 349 r = self->f->setFromSmallJson(self, p2); 350 ck_assert_ptr_ne(r, null); 351 char *s = toStringO(r); 352 ck_assert_str_eq(s, "{\"1\":\"asd\"}"); 353 free(s); 354 terminateO(p2); 355 // not smallJson object 356 p2 = (smallJsont*) allocSmallInt(1); 357 r = self->f->setFromSmallJson(self, p2); 358 ck_assert_ptr_eq(r, null); 359 terminateO(p2); 360 // null parameter 361 r = self->f->setFromSmallJson(self, null); 362 ck_assert_ptr_eq(r, null); 363 terminateO(self); 364 365 END_TEST 366 367 368 START_TEST(setSmallBoolSmallStringT) 369 370 smallStringt* r; 371 smallStringt* self = allocG(""); 372 smallBoolt* p2 = allocSmallBool(true); 373 374 r = self->f->setSmallBool(self, p2); 375 ck_assert_ptr_ne(r, null); 376 char *s = toStringO(r); 377 ck_assert_str_eq(s, "true"); 378 free(s); 379 terminateO(p2); 380 // not smallBool object 381 p2 = (smallBoolt*) allocSmallInt(1); 382 r = self->f->setSmallBool(self, p2); 383 ck_assert_ptr_eq(r, null); 384 terminateO(p2); 385 // null parameter 386 r = self->f->setSmallBool(self, null); 387 ck_assert_ptr_eq(r, null); 388 terminateO(self); 389 390 END_TEST 391 392 393 START_TEST(setSmallDoubleSmallStringT) 394 395 smallStringt* r; 396 smallStringt* self = allocG(""); 397 smallDoublet* p2 = allocSmallDouble(2.2); 398 399 r = self->f->setSmallDouble(self, p2); 400 ck_assert_ptr_ne(r, null); 401 char *s = toStringO(r); 402 ck_assert_str_eq(s, "2.200000e+00"); 403 free(s); 404 terminateO(p2); 405 // not smallDouble object 406 p2 = (smallDoublet*) allocSmallInt(1); 407 r = self->f->setSmallDouble(self, p2); 408 ck_assert_ptr_eq(r, null); 409 terminateO(p2); 410 // null parameter 411 r = self->f->setSmallDouble(self, null); 412 ck_assert_ptr_eq(r, null); 413 terminateO(self); 414 415 END_TEST 416 417 418 START_TEST(setSmallIntSmallStringT) 419 420 smallStringt* r; 421 smallStringt* self = allocG(""); 422 smallIntt* p2 = allocSmallInt(2); 423 424 r = self->f->setSmallInt(self, p2); 425 ck_assert_ptr_ne(r, null); 426 char *s = toStringO(r); 427 ck_assert_str_eq(s, "2"); 428 free(s); 429 terminateO(p2); 430 // not smallInt object 431 p2 = (smallIntt*) allocSmallJson(); 432 r = self->f->setSmallInt(self, p2); 433 ck_assert_ptr_eq(r, null); 434 terminateO(p2); 435 // null parameter 436 r = self->f->setSmallInt(self, null); 437 ck_assert_ptr_eq(r, null); 438 terminateO(self); 439 440 END_TEST 441 442 443 START_TEST(setSmallJsonSmallStringT) 444 445 smallStringt* r; 446 smallStringt* self = allocG("qwe"); 447 smallJsont* p2 = allocSmallJson(); 448 449 // undefined 450 createUndefined(u); 451 setTopO(p2, (baset*)&u); 452 r = self->f->setSmallJson(self, p2); 453 ck_assert_ptr_ne(r, null); 454 char *s = toStringO(r); 455 ck_assert_str_eq(s, "qwe"); 456 free(s); 457 freeO(p2); 458 // bool 459 setTopBoolO(p2, true); 460 r = self->f->setSmallJson(self, p2); 461 ck_assert_ptr_ne(r, null); 462 s = toStringO(r); 463 ck_assert_str_eq(s, "true"); 464 free(s); 465 freeO(p2); 466 // double 467 setTopDoubleO(p2, 2.2); 468 r = self->f->setSmallJson(self, p2); 469 ck_assert_ptr_ne(r, null); 470 s = toStringO(r); 471 ck_assert_str_eq(s, "2.200000e+00"); 472 free(s); 473 freeO(p2); 474 // int 475 setTopIntO(p2, 2); 476 r = self->f->setSmallJson(self, p2); 477 ck_assert_ptr_ne(r, null); 478 s = toStringO(r); 479 ck_assert_str_eq(s, "2"); 480 free(s); 481 freeO(p2); 482 // string 483 setTopStringO(p2, "qwe"); 484 r = self->f->setSmallJson(self, p2); 485 ck_assert_ptr_ne(r, null); 486 s = toStringO(r); 487 ck_assert_str_eq(s, "qwe"); 488 free(s); 489 freeO(p2); 490 // dict 491 createSmallDict(d); 492 setTopDictO(p2, &d); 493 r = self->f->setSmallJson(self, p2); 494 ck_assert_ptr_ne(r, null); 495 s = toStringO(r); 496 ck_assert_str_eq(s, "{}"); 497 free(s); 498 freeO(p2); 499 // array 500 createSmallArray(a); 501 setTopArrayO(p2, &a); 502 r = self->f->setSmallJson(self, p2); 503 ck_assert_ptr_ne(r, null); 504 s = toStringO(r); 505 ck_assert_str_eq(s, "[]"); 506 free(s); 507 freeO(p2); 508 // empty p2 object 509 r = self->f->setSmallJson(self, p2); 510 ck_assert_ptr_ne(r, null); 511 s = toStringO(r); 512 ck_assert_str_eq(s, "[]"); 513 free(s); 514 finishO(p2); 515 // not smallJson object 516 p2 = (smallJsont*) allocSmallInt(1); 517 r = self->f->setSmallJson(self, p2); 518 ck_assert_ptr_eq(r, null); 519 terminateO(p2); 520 // null parameter 521 r = self->f->setSmallJson(self, null); 522 ck_assert_ptr_eq(r, null); 523 terminateO(self); 524 525 END_TEST 526 527 528 START_TEST(setSmallStringSmallStringT) 529 530 smallStringt* r; 531 smallStringt* self = allocG(""); 532 smallStringt* p2 = allocSmallString("qwe"); 533 534 r = self->f->setSmallString(self, p2); 535 ck_assert_ptr_ne(r, null); 536 char *s = toStringO(r); 537 ck_assert_str_eq(s, "qwe"); 538 free(s); 539 terminateO(p2); 540 // not smallString object 541 p2 = (smallStringt*) allocSmallInt(1); 542 r = self->f->setSmallString(self, p2); 543 ck_assert_ptr_eq(r, null); 544 terminateO(p2); 545 // null parameter 546 r = self->f->setSmallString(self, null); 547 ck_assert_ptr_eq(r, null); 548 terminateO(self); 549 550 END_TEST 551 552 553 START_TEST(setNFreeSmallStringT) 554 555 smallStringt* r; 556 smallStringt *self = allocG(""); 557 558 r = self->f->setNFree(self, strdup("qwe")); 559 ck_assert_ptr_ne(r, null); 560 char *s = toStringO(r); 561 ck_assert_str_eq(s, "qwe"); 562 free(s); 563 // null parameter 564 r = self->f->setNFree(self, null); 565 ck_assert_ptr_eq(r, null); 566 terminateO(self); 567 568 END_TEST 569 570 571 START_TEST(appendSmallStringT) 572 573 smallStringt* r; 574 smallStringt *self = allocG("qwe"); 575 smallStringt *string = allocSmallString("!@#"); 576 577 r = appendO(self, string); 578 ck_assert_ptr_ne(r, null); 579 char *s = toStringO(r); 580 ck_assert_str_eq(s, "qwe!@#"); 581 free(s); 582 // empty string 583 setValO(string, ""); 584 r = appendO(self, string); 585 ck_assert_ptr_ne(r, null); 586 s = toStringO(r); 587 ck_assert_str_eq(s, "qwe!@#"); 588 free(s); 589 freeO(string); 590 r = appendO(self, string); 591 ck_assert_ptr_ne(r, null); 592 s = toStringO(r); 593 ck_assert_str_eq(s, "qwe!@#"); 594 free(s); 595 // empty self 596 freeO(self); 597 setValO(string, "asd"); 598 r = appendO(self, string); 599 ck_assert_ptr_ne(r, null); 600 s = toStringO(r); 601 ck_assert_str_eq(s, "asd"); 602 free(s); 603 terminateO(string); 604 // not smallString object 605 string = (smallStringt*) allocSmallInt(1); 606 r = appendO(self, string); 607 ck_assert_ptr_eq(r, null); 608 terminateO(string); 609 // null parameter 610 r = appendO(self, null); 611 ck_assert_ptr_eq(r, null); 612 terminateO(self); 613 614 END_TEST 615 616 617 START_TEST(appendSmallJsonSmallStringT) 618 619 smallStringt* r; 620 smallStringt *self = allocG("qwe"); 621 smallJsont *string = allocSmallJson(); 622 623 setTopSO(string, "!@#"); 624 r = self->f->appendSmallJson(self, string); 625 ck_assert_ptr_ne(r, null); 626 char *s = toStringO(r); 627 ck_assert_str_eq(s, "qwe!@#"); 628 free(s); 629 // empty string 630 freeO(string); 631 setTopSO(string, ""); 632 r = self->f->appendSmallJson(self, string); 633 ck_assert_ptr_ne(r, null); 634 s = toStringO(r); 635 ck_assert_str_eq(s, "qwe!@#"); 636 free(s); 637 // not json string 638 freeO(string); 639 setTopBoolO(string, true); 640 r = self->f->appendSmallJson(self, string); 641 ck_assert_ptr_eq(r, null); 642 terminateO(string); 643 // not smallString object 644 string = (smallJsont*) allocSmallInt(1); 645 r = self->f->appendSmallJson(self, string); 646 ck_assert_ptr_eq(r, null); 647 terminateO(string); 648 // null parameter 649 r = self->f->appendSmallJson(self, null); 650 ck_assert_ptr_eq(r, null); 651 terminateO(self); 652 653 END_TEST 654 655 656 START_TEST(appendNSmashSmallStringT) 657 658 smallStringt* r; 659 smallStringt *self = allocG("qwe"); 660 smallStringt *string = allocSmallString("!@#"); 661 662 r = appendNSmashO(self, string); 663 ck_assert_ptr_ne(r, null); 664 char *s = toStringO(r); 665 ck_assert_str_eq(s, "qwe!@#"); 666 free(s); 667 // empty string 668 string = allocSmallString(""); 669 r = appendNSmashO(self, string); 670 ck_assert_ptr_ne(r, null); 671 s = toStringO(r); 672 ck_assert_str_eq(s, "qwe!@#"); 673 free(s); 674 string = allocSmallString(""); 675 freeO(string); 676 r = appendNSmashO(self, string); 677 ck_assert_ptr_ne(r, null); 678 s = toStringO(r); 679 ck_assert_str_eq(s, "qwe!@#"); 680 free(s); 681 // empty self 682 freeO(self); 683 string = allocSmallString("asd"); 684 r = appendNSmashO(self, string); 685 ck_assert_ptr_ne(r, null); 686 s = toStringO(r); 687 ck_assert_str_eq(s, "asd"); 688 free(s); 689 // not smallString object 690 string = (smallStringt*) allocSmallInt(1); 691 r = appendNSmashO(self, string); 692 ck_assert_ptr_eq(r, null); 693 terminateO(string); 694 // null parameter 695 r = appendNSmashO(self, null); 696 ck_assert_ptr_eq(r, null); 697 terminateO(self); 698 699 END_TEST 700 701 702 START_TEST(appendSSmallStringT) 703 704 smallStringt* r; 705 smallStringt *self = allocG("qwe"); 706 707 r = self->f->appendS(self, "!@#"); 708 ck_assert_ptr_ne(r, null); 709 char *s = toStringO(r); 710 ck_assert_str_eq(s, "qwe!@#"); 711 free(s); 712 // empty string 713 r = self->f->appendS(self, ""); 714 ck_assert_ptr_ne(r, null); 715 s = toStringO(r); 716 ck_assert_str_eq(s, "qwe!@#"); 717 free(s); 718 // empty self 719 freeO(self); 720 r = self->f->appendS(self, "asd"); 721 ck_assert_ptr_ne(r, null); 722 s = toStringO(r); 723 ck_assert_str_eq(s, "asd"); 724 free(s); 725 // null parameter 726 r = self->f->appendS(self, null); 727 ck_assert_ptr_eq(r, null); 728 terminateO(self); 729 730 END_TEST 731 732 733 START_TEST(appendCharSmallStringT) 734 735 smallStringt* r; 736 smallStringt *self = allocG("qwe"); 737 738 r = appendCharO(self, '!'); 739 ck_assert_ptr_ne(r, null); 740 char *s = toStringO(r); 741 ck_assert_str_eq(s, "qwe!"); 742 free(s); 743 terminateO(self); 744 745 END_TEST 746 747 748 START_TEST(appendNSmashSmallJsonSmallStringT) 749 750 smallStringt* r; 751 smallStringt *self = allocG("qwe"); 752 smallJsont *string = allocSmallJson(); 753 754 setTopSO(string, "!@#"); 755 r = self->f->appendNSmashSmallJson(self, string); 756 ck_assert_ptr_ne(r, null); 757 char *s = toStringO(r); 758 ck_assert_str_eq(s, "qwe!@#"); 759 free(s); 760 // empty string 761 string = allocSmallJson(); 762 setTopSO(string, ""); 763 r = self->f->appendNSmashSmallJson(self, string); 764 ck_assert_ptr_ne(r, null); 765 s = toStringO(r); 766 ck_assert_str_eq(s, "qwe!@#"); 767 free(s); 768 string = allocSmallJson(); 769 setTypeStringO(string); 770 r = self->f->appendNSmashSmallJson(self, string); 771 ck_assert_ptr_ne(r, null); 772 s = toStringO(r); 773 ck_assert_str_eq(s, "qwe!@#"); 774 free(s); 775 // not json string 776 string = allocSmallJson(); 777 setTopBoolO(string, true); 778 r = self->f->appendNSmashSmallJson(self, string); 779 ck_assert_ptr_eq(r, null); 780 terminateO(string); 781 // not smallString object 782 string = (smallJsont*) allocSmallInt(1); 783 r = self->f->appendNSmashSmallJson(self, string); 784 ck_assert_ptr_eq(r, null); 785 terminateO(string); 786 // null parameter 787 r = self->f->appendNSmashSmallJson(self, null); 788 ck_assert_ptr_eq(r, null); 789 terminateO(self); 790 791 END_TEST 792 793 794 START_TEST(appendNSmashSSmallStringT) 795 796 smallStringt* r; 797 smallStringt *self = allocG("qwe"); 798 799 r = appendNSmashSO(self, strdup("!@#")); 800 ck_assert_ptr_ne(r, null); 801 char *s = toStringO(r); 802 ck_assert_str_eq(s, "qwe!@#"); 803 free(s); 804 // empty string 805 r = appendNSmashSO(self, strdup("")); 806 ck_assert_ptr_ne(r, null); 807 s = toStringO(r); 808 ck_assert_str_eq(s, "qwe!@#"); 809 free(s); 810 // empty self 811 freeO(self); 812 r = appendNSmashSO(self, strdup("asd")); 813 ck_assert_ptr_ne(r, null); 814 s = toStringO(r); 815 ck_assert_str_eq(s, "asd"); 816 free(s); 817 // null parameter 818 r = appendNSmashSO(self, null); 819 ck_assert_ptr_eq(r, null); 820 terminateO(self); 821 822 END_TEST 823 824 825 START_TEST(prependSmallStringT) 826 827 smallStringt* r; 828 smallStringt *self = allocG("qwe"); 829 smallStringt *string = allocSmallString("!@#"); 830 831 r = prependO(self, string); 832 ck_assert_ptr_ne(r, null); 833 char *s = toStringO(r); 834 ck_assert_str_eq(s, "!@#qwe"); 835 free(s); 836 // empty string 837 setValO(string, ""); 838 r = prependO(self, string); 839 ck_assert_ptr_ne(r, null); 840 s = toStringO(r); 841 ck_assert_str_eq(s, "!@#qwe"); 842 free(s); 843 freeO(string); 844 r = prependO(self, string); 845 ck_assert_ptr_ne(r, null); 846 s = toStringO(r); 847 ck_assert_str_eq(s, "!@#qwe"); 848 free(s); 849 // empty self 850 freeO(self); 851 setValO(string, "asd"); 852 r = prependO(self, string); 853 ck_assert_ptr_ne(r, null); 854 s = toStringO(r); 855 ck_assert_str_eq(s, "asd"); 856 free(s); 857 terminateO(string); 858 // not smallString object 859 string = (smallStringt*) allocSmallInt(1); 860 r = prependO(self, string); 861 ck_assert_ptr_eq(r, null); 862 terminateO(string); 863 // null parameter 864 r = prependO(self, null); 865 ck_assert_ptr_eq(r, null); 866 terminateO(self); 867 868 END_TEST 869 870 871 START_TEST(prependSmallJsonSmallStringT) 872 873 smallStringt* r; 874 smallStringt *self = allocG("qwe"); 875 smallJsont *string = allocSmallJson(); 876 877 setTopSO(string, "!@#"); 878 r = self->f->prependSmallJson(self, string); 879 ck_assert_ptr_ne(r, null); 880 char *s = toStringO(r); 881 ck_assert_str_eq(s, "!@#qwe"); 882 free(s); 883 // empty string 884 freeO(string); 885 setTopSO(string, ""); 886 r = self->f->prependSmallJson(self, string); 887 ck_assert_ptr_ne(r, null); 888 s = toStringO(r); 889 ck_assert_str_eq(s, "!@#qwe"); 890 free(s); 891 // not json string 892 freeO(string); 893 setTopBoolO(string, true); 894 r = self->f->prependSmallJson(self, string); 895 ck_assert_ptr_eq(r, null); 896 terminateO(string); 897 // not smallString object 898 string = (smallJsont*) allocSmallInt(1); 899 r = self->f->prependSmallJson(self, string); 900 ck_assert_ptr_eq(r, null); 901 terminateO(string); 902 // null parameter 903 r = self->f->prependSmallJson(self, null); 904 ck_assert_ptr_eq(r, null); 905 terminateO(self); 906 907 END_TEST 908 909 910 START_TEST(prependNSmashSmallStringT) 911 912 smallStringt* r; 913 smallStringt *self = allocG("qwe"); 914 smallStringt *string = allocSmallString("!@#"); 915 916 r = prependNSmashO(self, string); 917 ck_assert_ptr_ne(r, null); 918 char *s = toStringO(r); 919 ck_assert_str_eq(s, "!@#qwe"); 920 free(s); 921 // empty string 922 string = allocSmallString(""); 923 r = prependNSmashO(self, string); 924 ck_assert_ptr_ne(r, null); 925 s = toStringO(r); 926 ck_assert_str_eq(s, "!@#qwe"); 927 free(s); 928 string = allocSmallString(""); 929 freeO(string); 930 r = prependNSmashO(self, string); 931 ck_assert_ptr_ne(r, null); 932 s = toStringO(r); 933 ck_assert_str_eq(s, "!@#qwe"); 934 free(s); 935 // empty self 936 freeO(self); 937 string = allocSmallString("asd"); 938 r = prependNSmashO(self, string); 939 ck_assert_ptr_ne(r, null); 940 s = toStringO(r); 941 ck_assert_str_eq(s, "asd"); 942 free(s); 943 // not smallString object 944 string = (smallStringt*) allocSmallInt(1); 945 r = prependNSmashO(self, string); 946 ck_assert_ptr_eq(r, null); 947 terminateO(string); 948 // null parameter 949 r = prependNSmashO(self, null); 950 ck_assert_ptr_eq(r, null); 951 terminateO(self); 952 953 END_TEST 954 955 956 START_TEST(prependNSmashSmallJsonSmallStringT) 957 958 smallStringt* r; 959 smallStringt *self = allocG("qwe"); 960 smallJsont *string = allocSmallJson(); 961 962 setTopSO(string, "!@#"); 963 r = prependNSmashSmallJsonO(self, string); 964 ck_assert_ptr_ne(r, null); 965 char *s = toStringO(r); 966 ck_assert_str_eq(s, "!@#qwe"); 967 free(s); 968 // empty string 969 string = allocSmallJson(); 970 setTopSO(string, ""); 971 r = prependNSmashSmallJsonO(self, string); 972 ck_assert_ptr_ne(r, null); 973 s = toStringO(r); 974 ck_assert_str_eq(s, "!@#qwe"); 975 free(s); 976 string = allocSmallJson(); 977 setTypeStringO(string); 978 r = prependNSmashSmallJsonO(self, string); 979 ck_assert_ptr_ne(r, null); 980 s = toStringO(r); 981 ck_assert_str_eq(s, "!@#qwe"); 982 free(s); 983 // not json string 984 string = allocSmallJson(); 985 setTopBoolO(string, true); 986 r = prependNSmashSmallJsonO(self, string); 987 ck_assert_ptr_eq(r, null); 988 terminateO(string); 989 // not smallString object 990 string = (smallJsont*) allocSmallInt(1); 991 r = prependNSmashSmallJsonO(self, string); 992 ck_assert_ptr_eq(r, null); 993 terminateO(string); 994 // null parameter 995 r = prependNSmashSmallJsonO(self, null); 996 ck_assert_ptr_eq(r, null); 997 terminateO(self); 998 999 END_TEST 1000 1001 1002 START_TEST(prependSSmallStringT) 1003 1004 smallStringt* r; 1005 smallStringt *self = allocG("qwe"); 1006 1007 r = prependSO(self, "!@#"); 1008 ck_assert_ptr_ne(r, null); 1009 char *s = toStringO(r); 1010 ck_assert_str_eq(s, "!@#qwe"); 1011 free(s); 1012 // empty string 1013 r = prependSO(self, ""); 1014 ck_assert_ptr_ne(r, null); 1015 s = toStringO(r); 1016 ck_assert_str_eq(s, "!@#qwe"); 1017 free(s); 1018 // empty self 1019 freeO(self); 1020 r = prependSO(self, "asd"); 1021 ck_assert_ptr_ne(r, null); 1022 s = toStringO(r); 1023 ck_assert_str_eq(s, "asd"); 1024 free(s); 1025 // null parameter 1026 r = prependSO(self, null); 1027 ck_assert_ptr_eq(r, null); 1028 terminateO(self); 1029 1030 END_TEST 1031 1032 1033 START_TEST(prependCharSmallStringT) 1034 1035 smallStringt* r; 1036 smallStringt *self = allocG("qwe"); 1037 1038 r = prependCharO(self, '!'); 1039 ck_assert_ptr_ne(r, null); 1040 char *s = toStringO(r); 1041 ck_assert_str_eq(s, "!qwe"); 1042 free(s); 1043 terminateO(self); 1044 1045 END_TEST 1046 1047 1048 START_TEST(prependNSmashSSmallStringT) 1049 1050 smallStringt* r; 1051 smallStringt *self = allocG("qwe"); 1052 1053 r = prependNSmashSO(self, strdup("!@#")); 1054 ck_assert_ptr_ne(r, null); 1055 char *s = toStringO(r); 1056 ck_assert_str_eq(s, "!@#qwe"); 1057 free(s); 1058 // empty string 1059 r = prependNSmashSO(self, strdup("")); 1060 ck_assert_ptr_ne(r, null); 1061 s = toStringO(r); 1062 ck_assert_str_eq(s, "!@#qwe"); 1063 free(s); 1064 // empty self 1065 freeO(self); 1066 r = prependNSmashSO(self, strdup("asd")); 1067 ck_assert_ptr_ne(r, null); 1068 s = toStringO(r); 1069 ck_assert_str_eq(s, "asd"); 1070 free(s); 1071 // null parameter 1072 r = prependNSmashSO(self, null); 1073 ck_assert_ptr_eq(r, null); 1074 terminateO(self); 1075 1076 END_TEST 1077 1078 1079 START_TEST(catSmallStringT) 1080 1081 smallStringt* r; 1082 smallStringt *self = allocG("qwe"); 1083 1084 smallStringt *s1 = allocSmallString("123"); 1085 smallStringt *s2 = allocSmallString("456"); 1086 r = catO(self, s1, s2); 1087 ck_assert_ptr_ne(r, null); 1088 char *s = toStringO(r); 1089 ck_assert_str_eq(s, "qwe123456"); 1090 free(s); 1091 // non smallString object 1092 terminateO(s2); 1093 s2 = (smallStringt*) allocSmallInt(1); 1094 r = catO(self, s1, s2); 1095 ck_assert_ptr_eq(r, null); 1096 s = toStringO(self); 1097 ck_assert_str_eq(s, "qwe123456"); 1098 free(s); 1099 terminateO(s1); 1100 terminateO(s2); 1101 terminateO(self); 1102 1103 END_TEST 1104 1105 1106 START_TEST(catSSmallStringT) 1107 1108 smallStringt* r; 1109 smallStringt *self = allocG("qwe"); 1110 1111 r = catSO(self, "123", "456"); 1112 ck_assert_ptr_ne(r, null); 1113 char *s = toStringO(r); 1114 ck_assert_str_eq(s, "qwe123456"); 1115 free(s); 1116 terminateO(self); 1117 1118 END_TEST 1119 1120 1121 START_TEST(pushNFreeManySmallStringT) 1122 1123 smallStringt* r; 1124 smallStringt *self = allocG("qwe"); 1125 1126 smallStringt *s1 = allocSmallString("123"); 1127 smallStringt *s2 = allocSmallString("456"); 1128 r = pushNFreeManyO(self, s1, s2); 1129 ck_assert_ptr_ne(r, null); 1130 char *s = toStringO(r); 1131 ck_assert_str_eq(s, "qwe123456"); 1132 free(s); 1133 // non smallString object 1134 s1 = allocSmallString("123"); 1135 s2 = (smallStringt*) allocSmallInt(1); 1136 r = pushNFreeManyO(self, s1, s2); 1137 ck_assert_ptr_eq(r, null); 1138 s = toStringO(self); 1139 ck_assert_str_eq(s, "qwe123456"); 1140 free(s); 1141 terminateO(s2); 1142 terminateO(self); 1143 1144 END_TEST 1145 1146 1147 START_TEST(pushNFreeManySSmallStringT) 1148 1149 smallStringt* r; 1150 smallStringt *self = allocG("qwe"); 1151 1152 r = pushNFreeManySO(self, strdup("123"), strdup("456")); 1153 ck_assert_ptr_ne(r, null); 1154 char *s = toStringO(r); 1155 ck_assert_str_eq(s, "qwe123456"); 1156 free(s); 1157 terminateO(self); 1158 1159 END_TEST 1160 1161 1162 START_TEST(replaceSmallStringT) 1163 1164 smallStringt* r; 1165 smallStringt *self = allocG("#ee#ee#ad"); 1166 1167 // replace string, multiple character new delimeter 1168 r = replaceO(self, "#","^^", 0); 1169 ck_assert_ptr_ne(r, null); 1170 char *s = toStringO(r); 1171 ck_assert_str_eq(s, "^^ee^^ee^^ad"); 1172 free(s); 1173 // replace string, multiple character old delimeter 1174 setValO(self, "AA##ee##ee#"); 1175 r = replaceO(self, "##","|", 0); 1176 ck_assert_ptr_ne(r, null); 1177 s = toStringO(r); 1178 ck_assert_str_eq(s, "AA|ee|ee#"); 1179 free(s); 1180 // replace one time at the start of string 1181 setValO(self, "#ee#ee#ad"); 1182 r = replaceO(self, "#","^^",1); 1183 ck_assert_ptr_ne(r, null); 1184 s = toStringO(r); 1185 ck_assert_str_eq(s, "^^ee#ee#ad"); 1186 free(s); 1187 // replace one time 1188 setValO(self, "AA##ee##ee#"); 1189 r = replaceO(self, "##","|",1); 1190 ck_assert_ptr_ne(r, null); 1191 s = toStringO(r); 1192 ck_assert_str_eq(s, "AA|ee##ee#"); 1193 free(s); 1194 // NULL new delimiter, one time: same as empty delimiter 1195 setValO(self, "AA##ee##ee#"); 1196 r = replaceO(self, "##",NULL,1); 1197 ck_assert_ptr_ne(r, null); 1198 s = toStringO(r); 1199 ck_assert_str_eq(s, "AAee##ee#"); 1200 free(s); 1201 // empty string 1202 setValO(self, ""); 1203 r = replaceO(self, "##",NULL,1); 1204 ck_assert_ptr_ne(r, null); 1205 s = toStringO(r); 1206 ck_assert_str_eq(s, ""); 1207 free(s); 1208 // empty old delimiter 1209 setValO(self, "qwe"); 1210 ck_assert_ptr_eq(replaceO(self, "","|",1), NULL); 1211 // NULL old delimiter 1212 ck_assert_ptr_eq(replaceO(self, NULL,"|",1), NULL); 1213 // empty old delimiter 1214 ck_assert_ptr_eq(replaceO(self, "","|",1), NULL); 1215 // NULL string 1216 freeO(self); 1217 ck_assert_ptr_eq(replaceO(self, "##","|",1), NULL); 1218 terminateO(self); 1219 1220 END_TEST 1221 1222 1223 START_TEST(replaceCharSSmallStringT) 1224 1225 smallStringt* r; 1226 smallStringt *self = allocG(""); 1227 1228 // replace string, multiple character new delimeter 1229 setValO(self, "#ee#ee#ad"); 1230 r = replaceCharSO(self, '#',"^^", 0); 1231 ck_assert_ptr_ne(r, null); 1232 char *s = toStringO(r); 1233 ck_assert_str_eq(s, "^^ee^^ee^^ad"); 1234 free(s); 1235 // replace one time at the start of string 1236 setValO(self, "#ee#ee#ad"); 1237 r = replaceCharSO(self, '#',"^^",1); 1238 ck_assert_ptr_ne(r, null); 1239 s = toStringO(r); 1240 ck_assert_str_eq(s, "^^ee#ee#ad"); 1241 free(s); 1242 // replace one time 1243 setValO(self, "AA##ee##ee#"); 1244 r = replaceCharSO(self, '#',"|",1); 1245 ck_assert_ptr_ne(r, null); 1246 s = toStringO(r); 1247 ck_assert_str_eq(s, "AA|#ee##ee#"); 1248 free(s); 1249 // NULL new delimiter, one time: same as empty delimiter 1250 setValO(self, "AA#ee##ee#"); 1251 r = replaceCharSO(self, '#',NULL,1); 1252 ck_assert_ptr_ne(r, null); 1253 s = toStringO(r); 1254 ck_assert_str_eq(s, "AAee##ee#"); 1255 free(s); 1256 // empty string 1257 setValO(self, ""); 1258 r = replaceCharSO(self, '#',NULL,1); 1259 ck_assert_ptr_ne(r, null); 1260 s = toStringO(r); 1261 ck_assert_str_eq(s, ""); 1262 free(s); 1263 // empty old delimiter 1264 setValO(self, "qwe"); 1265 ck_assert_ptr_eq(replaceCharSO(self, 0,"|",1), NULL); 1266 // NULL string 1267 freeO(self); 1268 ck_assert_ptr_eq(replaceCharSO(self, '#',"|",1), NULL); 1269 terminateO(self); 1270 1271 END_TEST 1272 1273 1274 START_TEST(replaceSCharSmallStringT) 1275 1276 smallStringt* r; 1277 smallStringt *self = allocG(""); 1278 1279 // replace string, multiple character new delimeter 1280 setValO(self, "#ee#ee#ad"); 1281 r = replaceSCharO(self, "#",'^',0); 1282 ck_assert_ptr_ne(r, null); 1283 char *s = toStringO(r); 1284 ck_assert_str_eq(s, "^ee^ee^ad"); 1285 free(s); 1286 // replace string, multiple character old delimeter 1287 setValO(self, "AA##ee##ee#"); 1288 r = replaceSCharO(self, "##",'|',0); 1289 ck_assert_ptr_ne(r, null); 1290 s = toStringO(r); 1291 ck_assert_str_eq(s, "AA|ee|ee#"); 1292 free(s); 1293 // replace string empty char, multiple character old delimeter 1294 setValO(self, "AA##ee##ee#"); 1295 r = replaceSCharO(self, "##", 0,0); 1296 ck_assert_ptr_ne(r, null); 1297 s = toStringO(r); 1298 ck_assert_str_eq(s, "AAeeee#"); 1299 free(s); 1300 // replace one time at the start of string 1301 setValO(self, "#ee#ee#ad"); 1302 r = replaceSCharO(self, "#",'^',1); 1303 ck_assert_ptr_ne(r, null); 1304 s = toStringO(r); 1305 ck_assert_str_eq(s, "^ee#ee#ad"); 1306 free(s); 1307 // replace one time 1308 setValO(self, "AA##ee##ee#"); 1309 r = replaceSCharO(self, "##",'|',1); 1310 ck_assert_ptr_ne(r, null); 1311 s = toStringO(r); 1312 ck_assert_str_eq(s, "AA|ee##ee#"); 1313 free(s); 1314 // empty string 1315 setValO(self, ""); 1316 r = replaceSCharO(self, "##",0,1); 1317 ck_assert_ptr_ne(r, null); 1318 s = toStringO(r); 1319 ck_assert_str_eq(s, ""); 1320 free(s); 1321 // empty old delimiter 1322 setValO(self, "qwe"); 1323 ck_assert_ptr_eq(replaceSCharO(self, "",'|',1), NULL); 1324 // NULL old delimiter 1325 ck_assert_ptr_eq(replaceSCharO(self, NULL,'|',1), NULL); 1326 // NULL string 1327 freeO(self); 1328 ck_assert_ptr_eq(replaceSCharO(self, "##",'|',1), NULL); 1329 terminateO(self); 1330 1331 END_TEST 1332 1333 1334 START_TEST(replaceCharCharSmallStringT) 1335 1336 smallStringt* r; 1337 smallStringt *self = allocG(""); 1338 1339 // replace string, multiple character new delimeter 1340 setValO(self, "#ee#ee#ad"); 1341 r = replaceCharCharO(self, '#','^', 0); 1342 ck_assert_ptr_ne(r, null); 1343 char *s = toStringO(r); 1344 ck_assert_str_eq(s, "^ee^ee^ad"); 1345 free(s); 1346 // replace one time at the start of string 1347 setValO(self, "#ee#ee#ad"); 1348 r = replaceCharCharO(self, '#','^',1); 1349 ck_assert_ptr_ne(r, null); 1350 s = toStringO(r); 1351 ck_assert_str_eq(s, "^ee#ee#ad"); 1352 free(s); 1353 // replace one time 1354 setValO(self, "AA#ee##ee#"); 1355 r = replaceCharCharO(self, '#','|',1); 1356 ck_assert_ptr_ne(r, null); 1357 s = toStringO(r); 1358 ck_assert_str_eq(s, "AA|ee##ee#"); 1359 free(s); 1360 // empty string 1361 setValO(self, ""); 1362 r = replaceCharCharO(self, '#','^',1); 1363 ck_assert_ptr_ne(r, null); 1364 s = toStringO(r); 1365 ck_assert_str_eq(s, ""); 1366 free(s); 1367 // empty old delimiter 1368 setValO(self, "qwe"); 1369 ck_assert_ptr_eq(replaceCharCharO(self, 0,'|',1), NULL); 1370 // NULL string 1371 freeO(self); 1372 ck_assert_ptr_eq(replaceCharCharO(self, '#','|',1), NULL); 1373 terminateO(self); 1374 1375 END_TEST 1376 1377 1378 START_TEST(replaceSmallJsonSmallJsonSmallStringT) 1379 1380 smallStringt* r; 1381 smallStringt *self = allocG("#ee#ee#ad"); 1382 smallJsont *olds = allocSmallJson(); 1383 smallJsont *news = allocSmallJson(); 1384 1385 // replace string, multiple character new delimeter 1386 freeO(olds); 1387 freeO(news); 1388 setTopSO(olds, "#"); 1389 setTopSO(news, "^^"); 1390 r = replaceSmallJsonSmallJsonO(self, olds, news, 0); 1391 ck_assert_ptr_ne(r, null); 1392 char *s = toStringO(r); 1393 ck_assert_str_eq(s, "^^ee^^ee^^ad"); 1394 free(s); 1395 // replace string, multiple character old delimeter 1396 setValO(self, "AA##ee##ee#"); 1397 freeO(olds); 1398 freeO(news); 1399 setTopSO(olds, "##"); 1400 setTopSO(news, "|"); 1401 r = replaceSmallJsonSmallJsonO(self, olds, news, 0); 1402 ck_assert_ptr_ne(r, null); 1403 s = toStringO(r); 1404 ck_assert_str_eq(s, "AA|ee|ee#"); 1405 free(s); 1406 // replace one time at the start of string 1407 setValO(self, "#ee#ee#ad"); 1408 freeO(olds); 1409 freeO(news); 1410 setTopSO(olds, "#"); 1411 setTopSO(news, "^^"); 1412 r = replaceSmallJsonSmallJsonO(self, olds, news,1); 1413 ck_assert_ptr_ne(r, null); 1414 s = toStringO(r); 1415 ck_assert_str_eq(s, "^^ee#ee#ad"); 1416 free(s); 1417 // replace one time 1418 setValO(self, "AA##ee##ee#"); 1419 freeO(olds); 1420 freeO(news); 1421 setTopSO(olds, "##"); 1422 setTopSO(news, "|"); 1423 r = replaceSmallJsonSmallJsonO(self, olds, news,1); 1424 ck_assert_ptr_ne(r, null); 1425 s = toStringO(r); 1426 ck_assert_str_eq(s, "AA|ee##ee#"); 1427 free(s); 1428 // NULL new delimiter, one time: same as empty delimiter 1429 setValO(self, "AA##ee##ee#"); 1430 freeO(olds); 1431 setTopSO(olds, "##"); 1432 r = replaceSmallJsonSmallJsonO(self, olds, NULL,1); 1433 ck_assert_ptr_ne(r, null); 1434 s = toStringO(r); 1435 ck_assert_str_eq(s, "AAee##ee#"); 1436 free(s); 1437 // non json string 1438 freeO(olds); 1439 setTopIntO(olds, 1); 1440 r = replaceSmallJsonSmallJsonO(self, olds, news,1); 1441 ck_assert_ptr_eq(r, null); 1442 freeO(olds); 1443 freeO(news); 1444 setTopSO(olds, "e"); 1445 setTopIntO(news, 1); 1446 r = replaceSmallJsonSmallJsonO(self, olds, news,1); 1447 ck_assert_ptr_eq(r, null); 1448 // non json object 1449 terminateO(olds); 1450 olds = (smallJsont*) allocSmallInt(1); 1451 r = replaceSmallJsonSmallJsonO(self, olds, news,1); 1452 ck_assert_ptr_eq(r, null); 1453 terminateO(olds); 1454 terminateO(news); 1455 olds = allocSmallJson(); 1456 news = (smallJsont*) allocSmallInt(1); 1457 r = replaceSmallJsonSmallJsonO(self, olds, news,1); 1458 ck_assert_ptr_eq(r, null); 1459 terminateO(news); 1460 news = allocSmallJson(); 1461 // empty string 1462 setValO(self, ""); 1463 freeO(olds); 1464 setTopSO(olds, "##"); 1465 r = replaceSmallJsonSmallJsonO(self, olds, NULL,1); 1466 ck_assert_ptr_ne(r, null); 1467 s = toStringO(r); 1468 ck_assert_str_eq(s, ""); 1469 free(s); 1470 // empty old delimiter 1471 setValO(self, "qwe"); 1472 freeO(olds); 1473 freeO(news); 1474 setTopSO(olds, ""); 1475 setTopSO(news, "|"); 1476 ck_assert_ptr_eq(replaceSmallJsonSmallJsonO(self, olds, news,1), NULL); 1477 // NULL old delimiter 1478 ck_assert_ptr_eq(replaceSmallJsonSmallJsonO(self, NULL, news,1), NULL); 1479 // NULL string 1480 freeO(self); 1481 ck_assert_ptr_eq(replaceSmallJsonSmallJsonO(self, olds, news,1), NULL); 1482 terminateO(olds); 1483 terminateO(news); 1484 terminateO(self); 1485 1486 END_TEST 1487 1488 1489 START_TEST(replaceSmallJsonSmallStringSmallStringT) 1490 1491 smallStringt* r; 1492 smallStringt *self = allocG("#ee#ee#ad"); 1493 smallJsont *olds = allocSmallJson(); 1494 smallStringt *news = allocSmallString(""); 1495 1496 // replace string, multiple character new delimeter 1497 freeO(olds); 1498 setTopSO(olds, "#"); 1499 setValO(news, "^^"); 1500 r = replaceSmallJsonSmallStringO(self, olds, news, 0); 1501 ck_assert_ptr_ne(r, null); 1502 char *s = toStringO(r); 1503 ck_assert_str_eq(s, "^^ee^^ee^^ad"); 1504 free(s); 1505 // replace string, multiple character old delimeter 1506 setValO(self, "AA##ee##ee#"); 1507 freeO(olds); 1508 setTopSO(olds, "##"); 1509 setValO(news, "|"); 1510 r = replaceSmallJsonSmallStringO(self, olds, news, 0); 1511 ck_assert_ptr_ne(r, null); 1512 s = toStringO(r); 1513 ck_assert_str_eq(s, "AA|ee|ee#"); 1514 free(s); 1515 // replace one time at the start of string 1516 setValO(self, "#ee#ee#ad"); 1517 freeO(olds); 1518 setTopSO(olds, "#"); 1519 setValO(news, "^^"); 1520 r = replaceSmallJsonSmallStringO(self, olds, news,1); 1521 ck_assert_ptr_ne(r, null); 1522 s = toStringO(r); 1523 ck_assert_str_eq(s, "^^ee#ee#ad"); 1524 free(s); 1525 // replace one time 1526 setValO(self, "AA##ee##ee#"); 1527 freeO(olds); 1528 setTopSO(olds, "##"); 1529 setValO(news, "|"); 1530 r = replaceSmallJsonSmallStringO(self, olds, news,1); 1531 ck_assert_ptr_ne(r, null); 1532 s = toStringO(r); 1533 ck_assert_str_eq(s, "AA|ee##ee#"); 1534 free(s); 1535 // NULL new delimiter, one time: same as empty delimiter 1536 setValO(self, "AA##ee##ee#"); 1537 freeO(olds); 1538 setTopSO(olds, "##"); 1539 r = replaceSmallJsonSmallStringO(self, olds, NULL,1); 1540 ck_assert_ptr_ne(r, null); 1541 s = toStringO(r); 1542 ck_assert_str_eq(s, "AAee##ee#"); 1543 free(s); 1544 // non json string 1545 freeO(olds); 1546 setTopIntO(olds, 1); 1547 r = replaceSmallJsonSmallStringO(self, olds, news,1); 1548 ck_assert_ptr_eq(r, null); 1549 // non json object 1550 terminateO(olds); 1551 olds = (smallJsont*) allocSmallInt(1); 1552 r = replaceSmallJsonSmallStringO(self, olds, news,1); 1553 ck_assert_ptr_eq(r, null); 1554 terminateO(olds); 1555 terminateO(news); 1556 olds = allocSmallJson(); 1557 news = (smallStringt*) allocSmallInt(1); 1558 r = replaceSmallJsonSmallStringO(self, olds, news,1); 1559 ck_assert_ptr_eq(r, null); 1560 terminateO(news); 1561 news = allocSmallString(""); 1562 // empty string 1563 setValO(self, ""); 1564 freeO(olds); 1565 setTopSO(olds, "##"); 1566 r = replaceSmallJsonSmallStringO(self, olds, NULL,1); 1567 ck_assert_ptr_ne(r, null); 1568 s = toStringO(r); 1569 ck_assert_str_eq(s, ""); 1570 free(s); 1571 // empty old delimiter 1572 setValO(self, "qwe"); 1573 freeO(olds); 1574 setTopSO(olds, ""); 1575 setValO(news, "|"); 1576 ck_assert_ptr_eq(replaceSmallJsonSmallStringO(self, olds, news,1), NULL); 1577 // NULL old delimiter 1578 ck_assert_ptr_eq(replaceSmallJsonSmallStringO(self, NULL, news,1), NULL); 1579 // NULL string 1580 freeO(self); 1581 ck_assert_ptr_eq(replaceSmallJsonSmallStringO(self, olds, news,1), NULL); 1582 terminateO(olds); 1583 terminateO(news); 1584 terminateO(self); 1585 1586 END_TEST 1587 1588 1589 START_TEST(replaceSmallJsonSSmallStringT) 1590 1591 smallStringt* r; 1592 smallStringt *self = allocG("#ee#ee#ad"); 1593 smallJsont *olds = allocSmallJson(); 1594 const char *news; 1595 1596 // replace string, multiple character new delimeter 1597 freeO(olds); 1598 setTopSO(olds, "#"); 1599 news = "^^"; 1600 r = replaceSmallJsonSO(self, olds, news, 0); 1601 ck_assert_ptr_ne(r, null); 1602 char *s = toStringO(r); 1603 ck_assert_str_eq(s, "^^ee^^ee^^ad"); 1604 free(s); 1605 // replace string, multiple character old delimeter 1606 setValO(self, "AA##ee##ee#"); 1607 freeO(olds); 1608 setTopSO(olds, "##"); 1609 news = "|"; 1610 r = replaceSmallJsonSO(self, olds, news, 0); 1611 ck_assert_ptr_ne(r, null); 1612 s = toStringO(r); 1613 ck_assert_str_eq(s, "AA|ee|ee#"); 1614 free(s); 1615 // replace one time at the start of string 1616 setValO(self, "#ee#ee#ad"); 1617 freeO(olds); 1618 setTopSO(olds, "#"); 1619 news = "^^"; 1620 r = replaceSmallJsonSO(self, olds, news,1); 1621 ck_assert_ptr_ne(r, null); 1622 s = toStringO(r); 1623 ck_assert_str_eq(s, "^^ee#ee#ad"); 1624 free(s); 1625 // replace one time 1626 setValO(self, "AA##ee##ee#"); 1627 freeO(olds); 1628 setTopSO(olds, "##"); 1629 news = "|"; 1630 r = replaceSmallJsonSO(self, olds, news,1); 1631 ck_assert_ptr_ne(r, null); 1632 s = toStringO(r); 1633 ck_assert_str_eq(s, "AA|ee##ee#"); 1634 free(s); 1635 // NULL new delimiter, one time: same as empty delimiter 1636 setValO(self, "AA##ee##ee#"); 1637 freeO(olds); 1638 setTopSO(olds, "##"); 1639 r = replaceSmallJsonSO(self, olds, NULL,1); 1640 ck_assert_ptr_ne(r, null); 1641 s = toStringO(r); 1642 ck_assert_str_eq(s, "AAee##ee#"); 1643 free(s); 1644 // non json string 1645 freeO(olds); 1646 setTopIntO(olds, 1); 1647 r = replaceSmallJsonSO(self, olds, news,1); 1648 ck_assert_ptr_eq(r, null); 1649 // non json object 1650 terminateO(olds); 1651 olds = (smallJsont*) allocSmallInt(1); 1652 r = replaceSmallJsonSO(self, olds, news,1); 1653 ck_assert_ptr_eq(r, null); 1654 terminateO(olds); 1655 // empty string 1656 olds = allocSmallJson(); 1657 setValO(self, ""); 1658 setTopSO(olds, "##"); 1659 r = replaceSmallJsonSO(self, olds, NULL,1); 1660 ck_assert_ptr_ne(r, null); 1661 s = toStringO(r); 1662 ck_assert_str_eq(s, ""); 1663 free(s); 1664 // empty old delimiter 1665 setValO(self, "qwe"); 1666 freeO(olds); 1667 setTopSO(olds, ""); 1668 news = "|"; 1669 ck_assert_ptr_eq(replaceSmallJsonSO(self, olds, news,1), NULL); 1670 // NULL old delimiter 1671 ck_assert_ptr_eq(replaceSmallJsonSO(self, NULL, news,1), NULL); 1672 // NULL string 1673 freeO(self); 1674 ck_assert_ptr_eq(replaceSmallJsonSO(self, olds, news,1), NULL); 1675 terminateO(olds); 1676 terminateO(self); 1677 1678 END_TEST 1679 1680 1681 START_TEST(replaceSmallJsonCharSmallStringT) 1682 1683 smallStringt* r; 1684 smallStringt *self = allocG("#ee#ee#ad"); 1685 smallJsont *olds = allocSmallJson(); 1686 char news; 1687 1688 // replace string, multiple character new delimeter 1689 freeO(olds); 1690 setTopSO(olds, "#"); 1691 news = '^'; 1692 r = replaceSmallJsonCharO(self, olds, news, 0); 1693 ck_assert_ptr_ne(r, null); 1694 char *s = toStringO(r); 1695 ck_assert_str_eq(s, "^ee^ee^ad"); 1696 free(s); 1697 // replace string, multiple character old delimeter 1698 setValO(self, "AA##ee##ee#"); 1699 freeO(olds); 1700 setTopSO(olds, "##"); 1701 news = '|'; 1702 r = replaceSmallJsonCharO(self, olds, news, 0); 1703 ck_assert_ptr_ne(r, null); 1704 s = toStringO(r); 1705 ck_assert_str_eq(s, "AA|ee|ee#"); 1706 free(s); 1707 // replace one time at the start of string 1708 setValO(self, "#ee#ee#ad"); 1709 freeO(olds); 1710 setTopSO(olds, "#"); 1711 news = '^'; 1712 r = replaceSmallJsonCharO(self, olds, news,1); 1713 ck_assert_ptr_ne(r, null); 1714 s = toStringO(r); 1715 ck_assert_str_eq(s, "^ee#ee#ad"); 1716 free(s); 1717 // replace one time 1718 setValO(self, "AA##ee##ee#"); 1719 freeO(olds); 1720 setTopSO(olds, "##"); 1721 news = '|'; 1722 r = replaceSmallJsonCharO(self, olds, news,1); 1723 ck_assert_ptr_ne(r, null); 1724 s = toStringO(r); 1725 ck_assert_str_eq(s, "AA|ee##ee#"); 1726 free(s); 1727 // non json string 1728 setValO(self, "AA##ee##ee#"); 1729 freeO(olds); 1730 setTopIntO(olds, 1); 1731 r = replaceSmallJsonCharO(self, olds, news,1); 1732 ck_assert_ptr_eq(r, null); 1733 // non json object 1734 terminateO(olds); 1735 olds = (smallJsont*) allocSmallInt(1); 1736 r = replaceSmallJsonCharO(self, olds, news,1); 1737 ck_assert_ptr_eq(r, null); 1738 terminateO(olds); 1739 // empty string 1740 olds = allocSmallJson(); 1741 setValO(self, ""); 1742 setTopSO(olds, "##"); 1743 r = replaceSmallJsonCharO(self, olds, news,1); 1744 ck_assert_ptr_ne(r, null); 1745 s = toStringO(r); 1746 ck_assert_str_eq(s, ""); 1747 free(s); 1748 // empty old delimiter 1749 setValO(self, "qwe"); 1750 freeO(olds); 1751 setTopSO(olds, ""); 1752 news = '|'; 1753 ck_assert_ptr_eq(replaceSmallJsonCharO(self, olds, news,1), NULL); 1754 // NULL old delimiter 1755 ck_assert_ptr_eq(replaceSmallJsonCharO(self, NULL, news,1), NULL); 1756 // NULL string 1757 freeO(self); 1758 ck_assert_ptr_eq(replaceSmallJsonCharO(self, olds, news,1), NULL); 1759 terminateO(olds); 1760 terminateO(self); 1761 1762 END_TEST 1763 1764 1765 START_TEST(replaceSmallStringSmallJsonSmallStringT) 1766 1767 smallStringt* r; 1768 smallStringt *self = allocG("#ee#ee#ad"); 1769 smallStringt *olds = allocSmallString(""); 1770 smallJsont *news = allocSmallJson(); 1771 1772 // replace string, multiple character new delimeter 1773 freeO(news); 1774 setValO(olds, "#"); 1775 setTopSO(news, "^^"); 1776 r = self->f->replaceSmallStringSmallJson(self, olds, news, 0); 1777 ck_assert_ptr_ne(r, null); 1778 char *s = toStringO(r); 1779 ck_assert_str_eq(s, "^^ee^^ee^^ad"); 1780 free(s); 1781 // replace string, multiple character old delimeter 1782 setValO(self, "AA##ee##ee#"); 1783 freeO(news); 1784 setValO(olds, "##"); 1785 setTopSO(news, "|"); 1786 r = self->f->replaceSmallStringSmallJson(self, olds, news, 0); 1787 ck_assert_ptr_ne(r, null); 1788 s = toStringO(r); 1789 ck_assert_str_eq(s, "AA|ee|ee#"); 1790 free(s); 1791 // replace one time at the start of string 1792 setValO(self, "#ee#ee#ad"); 1793 freeO(news); 1794 setValO(olds, "#"); 1795 setTopSO(news, "^^"); 1796 r = self->f->replaceSmallStringSmallJson(self, olds, news,1); 1797 ck_assert_ptr_ne(r, null); 1798 s = toStringO(r); 1799 ck_assert_str_eq(s, "^^ee#ee#ad"); 1800 free(s); 1801 // replace one time 1802 setValO(self, "AA##ee##ee#"); 1803 freeO(news); 1804 setValO(olds, "##"); 1805 setTopSO(news, "|"); 1806 r = self->f->replaceSmallStringSmallJson(self, olds, news,1); 1807 ck_assert_ptr_ne(r, null); 1808 s = toStringO(r); 1809 ck_assert_str_eq(s, "AA|ee##ee#"); 1810 free(s); 1811 // NULL new delimiter, one time: same as empty delimiter 1812 setValO(self, "AA##ee##ee#"); 1813 setValO(olds, "##"); 1814 r = self->f->replaceSmallStringSmallJson(self, olds, NULL,1); 1815 ck_assert_ptr_ne(r, null); 1816 s = toStringO(r); 1817 ck_assert_str_eq(s, "AAee##ee#"); 1818 free(s); 1819 // non json string 1820 freeO(news); 1821 setTopIntO(news, 1); 1822 r = self->f->replaceSmallStringSmallJson(self, olds, news,1); 1823 ck_assert_ptr_eq(r, null); 1824 // non json object 1825 terminateO(olds); 1826 olds = (smallStringt*) allocSmallInt(1); 1827 r = self->f->replaceSmallStringSmallJson(self, olds, news,1); 1828 ck_assert_ptr_eq(r, null); 1829 terminateO(olds); 1830 terminateO(news); 1831 olds = allocSmallString(""); 1832 news = (smallJsont*) allocSmallInt(1); 1833 r = self->f->replaceSmallStringSmallJson(self, olds, news,1); 1834 ck_assert_ptr_eq(r, null); 1835 terminateO(news); 1836 news = allocSmallJson(); 1837 // empty string 1838 setValO(self, ""); 1839 setValO(olds, "##"); 1840 r = self->f->replaceSmallStringSmallJson(self, olds, NULL,1); 1841 ck_assert_ptr_ne(r, null); 1842 s = toStringO(r); 1843 ck_assert_str_eq(s, ""); 1844 free(s); 1845 // empty old delimiter 1846 setValO(self, "qwe"); 1847 freeO(news); 1848 setValO(olds, ""); 1849 setTopSO(news, "|"); 1850 ck_assert_ptr_eq(self->f->replaceSmallStringSmallJson(self, olds, news,1), NULL); 1851 // NULL old delimiter 1852 ck_assert_ptr_eq(self->f->replaceSmallStringSmallJson(self, NULL, news,1), NULL); 1853 // NULL string 1854 freeO(self); 1855 ck_assert_ptr_eq(self->f->replaceSmallStringSmallJson(self, olds, news,1), NULL); 1856 terminateO(olds); 1857 terminateO(news); 1858 terminateO(self); 1859 1860 END_TEST 1861 1862 1863 START_TEST(replaceSmallStringSmallStringSmallStringT) 1864 1865 smallStringt* r; 1866 smallStringt *self = allocG("#ee#ee#ad"); 1867 smallStringt *olds = allocSmallString(""); 1868 smallStringt *news = allocSmallString(""); 1869 1870 // replace string, multiple character new delimeter 1871 setValO(olds, "#"); 1872 setValO(news, "^^"); 1873 r = replaceSmallStringSmallStringO(self, olds, news, 0); 1874 ck_assert_ptr_ne(r, null); 1875 char *s = toStringO(r); 1876 ck_assert_str_eq(s, "^^ee^^ee^^ad"); 1877 free(s); 1878 // replace string, multiple character old delimeter 1879 setValO(self, "AA##ee##ee#"); 1880 setValO(olds, "##"); 1881 setValO(news, "|"); 1882 r = replaceSmallStringSmallStringO(self, olds, news, 0); 1883 ck_assert_ptr_ne(r, null); 1884 s = toStringO(r); 1885 ck_assert_str_eq(s, "AA|ee|ee#"); 1886 free(s); 1887 // replace one time at the start of string 1888 setValO(self, "#ee#ee#ad"); 1889 setValO(olds, "#"); 1890 setValO(news, "^^"); 1891 r = replaceSmallStringSmallStringO(self, olds, news,1); 1892 ck_assert_ptr_ne(r, null); 1893 s = toStringO(r); 1894 ck_assert_str_eq(s, "^^ee#ee#ad"); 1895 free(s); 1896 // replace one time 1897 setValO(self, "AA##ee##ee#"); 1898 setValO(olds, "##"); 1899 setValO(news, "|"); 1900 r = replaceSmallStringSmallStringO(self, olds, news,1); 1901 ck_assert_ptr_ne(r, null); 1902 s = toStringO(r); 1903 ck_assert_str_eq(s, "AA|ee##ee#"); 1904 free(s); 1905 // NULL new delimiter, one time: same as empty delimiter 1906 setValO(self, "AA##ee##ee#"); 1907 setValO(olds, "##"); 1908 r = replaceSmallStringSmallStringO(self, olds, NULL,1); 1909 ck_assert_ptr_ne(r, null); 1910 s = toStringO(r); 1911 ck_assert_str_eq(s, "AAee##ee#"); 1912 free(s); 1913 // non smallString object 1914 terminateO(olds); 1915 olds = (smallStringt*) allocSmallInt(1); 1916 r = replaceSmallStringSmallStringO(self, olds, news,1); 1917 ck_assert_ptr_eq(r, null); 1918 terminateO(olds); 1919 terminateO(news); 1920 olds = allocSmallString(""); 1921 news = (smallStringt*) allocSmallInt(1); 1922 r = replaceSmallStringSmallStringO(self, olds, news,1); 1923 ck_assert_ptr_eq(r, null); 1924 terminateO(news); 1925 news = allocSmallString(""); 1926 // empty string 1927 setValO(self, ""); 1928 setValO(olds, "##"); 1929 r = replaceSmallStringSmallStringO(self, olds, NULL,1); 1930 ck_assert_ptr_ne(r, null); 1931 s = toStringO(r); 1932 ck_assert_str_eq(s, ""); 1933 free(s); 1934 // empty old delimiter 1935 setValO(self, "qwe"); 1936 setValO(olds, ""); 1937 setValO(news, "|"); 1938 ck_assert_ptr_eq(replaceSmallStringSmallStringO(self, olds, news,1), NULL); 1939 // NULL old delimiter 1940 ck_assert_ptr_eq(replaceSmallStringSmallStringO(self, NULL, news,1), NULL); 1941 // NULL string 1942 freeO(self); 1943 ck_assert_ptr_eq(replaceSmallStringSmallStringO(self, olds, news,1), NULL); 1944 terminateO(olds); 1945 terminateO(news); 1946 terminateO(self); 1947 1948 END_TEST 1949 1950 1951 START_TEST(replaceSmallStringSSmallStringT) 1952 1953 smallStringt* r; 1954 smallStringt *self = allocG("#ee#ee#ad"); 1955 smallStringt *olds = allocSmallString(""); 1956 const char *news; 1957 1958 // replace string, multiple character new delimeter 1959 setValO(olds, "#"); 1960 news = "^^"; 1961 r = replaceSmallStringSO(self, olds, news, 0); 1962 ck_assert_ptr_ne(r, null); 1963 char *s = toStringO(r); 1964 ck_assert_str_eq(s, "^^ee^^ee^^ad"); 1965 free(s); 1966 // replace string, multiple character old delimeter 1967 setValO(self, "AA##ee##ee#"); 1968 setValO(olds, "##"); 1969 news = "|"; 1970 r = replaceSmallStringSO(self, olds, news, 0); 1971 ck_assert_ptr_ne(r, null); 1972 s = toStringO(r); 1973 ck_assert_str_eq(s, "AA|ee|ee#"); 1974 free(s); 1975 // replace one time at the start of string 1976 setValO(self, "#ee#ee#ad"); 1977 setValO(olds, "#"); 1978 news = "^^"; 1979 r = replaceSmallStringSO(self, olds, news,1); 1980 ck_assert_ptr_ne(r, null); 1981 s = toStringO(r); 1982 ck_assert_str_eq(s, "^^ee#ee#ad"); 1983 free(s); 1984 // replace one time 1985 setValO(self, "AA##ee##ee#"); 1986 setValO(olds, "##"); 1987 news = "|"; 1988 r = replaceSmallStringSO(self, olds, news,1); 1989 ck_assert_ptr_ne(r, null); 1990 s = toStringO(r); 1991 ck_assert_str_eq(s, "AA|ee##ee#"); 1992 free(s); 1993 // NULL new delimiter, one time: same as empty delimiter 1994 setValO(self, "AA##ee##ee#"); 1995 setValO(olds, "##"); 1996 r = replaceSmallStringSO(self, olds, NULL,1); 1997 ck_assert_ptr_ne(r, null); 1998 s = toStringO(r); 1999 ck_assert_str_eq(s, "AAee##ee#"); 2000 free(s); 2001 // non smallString object 2002 terminateO(olds); 2003 olds = (smallStringt*) allocSmallInt(1); 2004 r = replaceSmallStringSO(self, olds, news,1); 2005 ck_assert_ptr_eq(r, null); 2006 terminateO(olds); 2007 olds = allocSmallString(""); 2008 // empty string 2009 setValO(self, ""); 2010 setValO(olds, "##"); 2011 r = replaceSmallStringSO(self, olds, NULL,1); 2012 ck_assert_ptr_ne(r, null); 2013 s = toStringO(r); 2014 ck_assert_str_eq(s, ""); 2015 free(s); 2016 // empty old delimiter 2017 setValO(self, "qwe"); 2018 setValO(olds, ""); 2019 news = "|"; 2020 ck_assert_ptr_eq(replaceSmallStringSO(self, olds, news,1), NULL); 2021 // NULL old delimiter 2022 ck_assert_ptr_eq(replaceSmallStringSO(self, NULL, news,1), NULL); 2023 // NULL string 2024 freeO(self); 2025 ck_assert_ptr_eq(replaceSmallStringSO(self, olds, news,1), NULL); 2026 terminateO(olds); 2027 terminateO(self); 2028 2029 END_TEST 2030 2031 2032 START_TEST(replaceSmallStringCharSmallStringT) 2033 2034 smallStringt* r; 2035 smallStringt *self = allocG("#ee#ee#ad"); 2036 smallStringt *olds = allocSmallString(""); 2037 char news; 2038 2039 // replace string, multiple character new delimeter 2040 setValO(olds, "#"); 2041 news = '^'; 2042 r = replaceSmallStringCharO(self, olds, news, 0); 2043 ck_assert_ptr_ne(r, null); 2044 char *s = toStringO(r); 2045 ck_assert_str_eq(s, "^ee^ee^ad"); 2046 free(s); 2047 // replace string, multiple character old delimeter 2048 setValO(self, "AA##ee##ee#"); 2049 setValO(olds, "##"); 2050 news = '|'; 2051 r = replaceSmallStringCharO(self, olds, news, 0); 2052 ck_assert_ptr_ne(r, null); 2053 s = toStringO(r); 2054 ck_assert_str_eq(s, "AA|ee|ee#"); 2055 free(s); 2056 // replace one time at the start of string 2057 setValO(self, "#ee#ee#ad"); 2058 setValO(olds, "#"); 2059 news = '^'; 2060 r = replaceSmallStringCharO(self, olds, news,1); 2061 ck_assert_ptr_ne(r, null); 2062 s = toStringO(r); 2063 ck_assert_str_eq(s, "^ee#ee#ad"); 2064 free(s); 2065 // replace one time 2066 setValO(self, "AA##ee##ee#"); 2067 setValO(olds, "##"); 2068 news = '|'; 2069 r = replaceSmallStringCharO(self, olds, news,1); 2070 ck_assert_ptr_ne(r, null); 2071 s = toStringO(r); 2072 ck_assert_str_eq(s, "AA|ee##ee#"); 2073 free(s); 2074 // non smallString object 2075 terminateO(olds); 2076 olds = (smallStringt*) allocSmallInt(1); 2077 r = replaceSmallStringCharO(self, olds, news,1); 2078 ck_assert_ptr_eq(r, null); 2079 terminateO(olds); 2080 olds = allocSmallString(""); 2081 // empty string 2082 setValO(self, ""); 2083 setValO(olds, "##"); 2084 r = replaceSmallStringCharO(self, olds, news,1); 2085 ck_assert_ptr_ne(r, null); 2086 s = toStringO(r); 2087 ck_assert_str_eq(s, ""); 2088 free(s); 2089 // empty old delimiter 2090 setValO(self, "qwe"); 2091 setValO(olds, ""); 2092 news = '|'; 2093 ck_assert_ptr_eq(replaceSmallStringCharO(self, olds, news,1), NULL); 2094 // NULL old delimiter 2095 ck_assert_ptr_eq(replaceSmallStringCharO(self, NULL, news,1), NULL); 2096 // NULL string 2097 freeO(self); 2098 ck_assert_ptr_eq(replaceSmallStringCharO(self, olds, news,1), NULL); 2099 terminateO(olds); 2100 terminateO(self); 2101 2102 END_TEST 2103 2104 2105 START_TEST(replaceSSmallJsonSmallStringT) 2106 2107 smallStringt* r; 2108 smallStringt *self = allocG("#ee#ee#ad"); 2109 const char *olds; 2110 smallJsont *news = allocSmallJson(); 2111 2112 // replace string, multiple character new delimeter 2113 freeO(news); 2114 olds = "#"; 2115 setTopSO(news, "^^"); 2116 r = replaceSSmallJsonO(self, olds, news, 0); 2117 ck_assert_ptr_ne(r, null); 2118 char *s = toStringO(r); 2119 ck_assert_str_eq(s, "^^ee^^ee^^ad"); 2120 free(s); 2121 // replace string, multiple character old delimeter 2122 setValO(self, "AA##ee##ee#"); 2123 freeO(news); 2124 olds = "##"; 2125 setTopSO(news, "|"); 2126 r = replaceSSmallJsonO(self, olds, news, 0); 2127 ck_assert_ptr_ne(r, null); 2128 s = toStringO(r); 2129 ck_assert_str_eq(s, "AA|ee|ee#"); 2130 free(s); 2131 // replace one time at the start of string 2132 setValO(self, "#ee#ee#ad"); 2133 freeO(news); 2134 olds = "#"; 2135 setTopSO(news, "^^"); 2136 r = replaceSSmallJsonO(self, olds, news,1); 2137 ck_assert_ptr_ne(r, null); 2138 s = toStringO(r); 2139 ck_assert_str_eq(s, "^^ee#ee#ad"); 2140 free(s); 2141 // replace one time 2142 setValO(self, "AA##ee##ee#"); 2143 freeO(news); 2144 olds = "##"; 2145 setTopSO(news, "|"); 2146 r = replaceSSmallJsonO(self, olds, news,1); 2147 ck_assert_ptr_ne(r, null); 2148 s = toStringO(r); 2149 ck_assert_str_eq(s, "AA|ee##ee#"); 2150 free(s); 2151 // NULL new delimiter, one time: same as empty delimiter 2152 setValO(self, "AA##ee##ee#"); 2153 olds = "##"; 2154 r = replaceSSmallJsonO(self, olds, NULL,1); 2155 ck_assert_ptr_ne(r, null); 2156 s = toStringO(r); 2157 ck_assert_str_eq(s, "AAee##ee#"); 2158 free(s); 2159 // non json string 2160 freeO(news); 2161 olds = "e"; 2162 setTopIntO(news, 1); 2163 r = replaceSSmallJsonO(self, olds, news,1); 2164 ck_assert_ptr_eq(r, null); 2165 // non json object 2166 terminateO(news); 2167 news = (smallJsont*) allocSmallInt(1); 2168 r = replaceSSmallJsonO(self, olds, news,1); 2169 ck_assert_ptr_eq(r, null); 2170 terminateO(news); 2171 news = allocSmallJson(); 2172 // empty string 2173 setValO(self, ""); 2174 olds = "##"; 2175 r = replaceSSmallJsonO(self, olds, NULL,1); 2176 ck_assert_ptr_ne(r, null); 2177 s = toStringO(r); 2178 ck_assert_str_eq(s, ""); 2179 free(s); 2180 // empty old delimiter 2181 setValO(self, "qwe"); 2182 freeO(news); 2183 olds = ""; 2184 setTopSO(news, "|"); 2185 ck_assert_ptr_eq(replaceSSmallJsonO(self, olds, news,1), NULL); 2186 // NULL old delimiter 2187 ck_assert_ptr_eq(replaceSSmallJsonO(self, NULL, news,1), NULL); 2188 // NULL string 2189 freeO(self); 2190 ck_assert_ptr_eq(replaceSSmallJsonO(self, olds, news,1), NULL); 2191 terminateO(news); 2192 terminateO(self); 2193 2194 END_TEST 2195 2196 2197 START_TEST(replaceSSmallStringSmallStringT) 2198 2199 smallStringt* r; 2200 smallStringt *self = allocG("#ee#ee#ad"); 2201 const char *olds; 2202 smallStringt *news = allocSmallString(""); 2203 2204 // replace string, multiple character new delimeter 2205 olds = "#"; 2206 setValO(news, "^^"); 2207 r = replaceSSmallStringO(self, olds, news, 0); 2208 ck_assert_ptr_ne(r, null); 2209 char *s = toStringO(r); 2210 ck_assert_str_eq(s, "^^ee^^ee^^ad"); 2211 free(s); 2212 // replace string, multiple character old delimeter 2213 setValO(self, "AA##ee##ee#"); 2214 olds = "##"; 2215 setValO(news, "|"); 2216 r = replaceSSmallStringO(self, olds, news, 0); 2217 ck_assert_ptr_ne(r, null); 2218 s = toStringO(r); 2219 ck_assert_str_eq(s, "AA|ee|ee#"); 2220 free(s); 2221 // replace one time at the start of string 2222 setValO(self, "#ee#ee#ad"); 2223 olds = "#"; 2224 setValO(news, "^^"); 2225 r = replaceSSmallStringO(self, olds, news,1); 2226 ck_assert_ptr_ne(r, null); 2227 s = toStringO(r); 2228 ck_assert_str_eq(s, "^^ee#ee#ad"); 2229 free(s); 2230 // replace one time 2231 setValO(self, "AA##ee##ee#"); 2232 olds = "##"; 2233 setValO(news, "|"); 2234 r = replaceSSmallStringO(self, olds, news,1); 2235 ck_assert_ptr_ne(r, null); 2236 s = toStringO(r); 2237 ck_assert_str_eq(s, "AA|ee##ee#"); 2238 free(s); 2239 // NULL new delimiter, one time: same as empty delimiter 2240 setValO(self, "AA##ee##ee#"); 2241 olds = "##"; 2242 r = replaceSSmallStringO(self, olds, NULL,1); 2243 ck_assert_ptr_ne(r, null); 2244 s = toStringO(r); 2245 ck_assert_str_eq(s, "AAee##ee#"); 2246 free(s); 2247 // non smallString object 2248 terminateO(news); 2249 news = (smallStringt*) allocSmallInt(1); 2250 r = replaceSSmallStringO(self, olds, news,1); 2251 ck_assert_ptr_eq(r, null); 2252 terminateO(news); 2253 news = allocSmallString(""); 2254 // empty string 2255 setValO(self, ""); 2256 olds = "##"; 2257 r = replaceSSmallStringO(self, olds, NULL,1); 2258 ck_assert_ptr_ne(r, null); 2259 s = toStringO(r); 2260 ck_assert_str_eq(s, ""); 2261 free(s); 2262 // empty old delimiter 2263 setValO(self, "qwe"); 2264 olds = ""; 2265 setValO(news, "|"); 2266 ck_assert_ptr_eq(replaceSSmallStringO(self, olds, news,1), NULL); 2267 // NULL old delimiter 2268 ck_assert_ptr_eq(replaceSSmallStringO(self, NULL, news,1), NULL); 2269 // NULL string 2270 freeO(self); 2271 ck_assert_ptr_eq(replaceSSmallStringO(self, olds, news,1), NULL); 2272 terminateO(news); 2273 terminateO(self); 2274 2275 END_TEST 2276 2277 2278 START_TEST(replaceCharSmallJsonSmallStringT) 2279 2280 smallStringt* r; 2281 smallStringt *self = allocG("#ee#ee#ad"); 2282 char olds; 2283 smallJsont *news = allocSmallJson(); 2284 2285 // replace string, multiple character new delimeter 2286 freeO(news); 2287 olds = '#'; 2288 setTopSO(news, "^^"); 2289 r = replaceCharSmallJsonO(self, olds, news, 0); 2290 ck_assert_ptr_ne(r, null); 2291 char *s = toStringO(r); 2292 ck_assert_str_eq(s, "^^ee^^ee^^ad"); 2293 free(s); 2294 // replace string, multiple character old delimeter 2295 setValO(self, "AA#ee#ee"); 2296 freeO(news); 2297 olds = '#'; 2298 setTopSO(news, "|"); 2299 r = replaceCharSmallJsonO(self, olds, news, 0); 2300 ck_assert_ptr_ne(r, null); 2301 s = toStringO(r); 2302 ck_assert_str_eq(s, "AA|ee|ee"); 2303 free(s); 2304 // replace one time at the start of string 2305 setValO(self, "#ee#ee#ad"); 2306 freeO(news); 2307 olds = '#'; 2308 setTopSO(news, "^^"); 2309 r = replaceCharSmallJsonO(self, olds, news,1); 2310 ck_assert_ptr_ne(r, null); 2311 s = toStringO(r); 2312 ck_assert_str_eq(s, "^^ee#ee#ad"); 2313 free(s); 2314 // replace one time 2315 setValO(self, "AA#ee##ee#"); 2316 freeO(news); 2317 olds = '#'; 2318 setTopSO(news, "|"); 2319 r = replaceCharSmallJsonO(self, olds, news,1); 2320 ck_assert_ptr_ne(r, null); 2321 s = toStringO(r); 2322 ck_assert_str_eq(s, "AA|ee##ee#"); 2323 free(s); 2324 // NULL new delimiter, one time: same as empty delimiter 2325 setValO(self, "AA#ee##ee#"); 2326 olds = '#'; 2327 r = replaceCharSmallJsonO(self, olds, NULL,1); 2328 ck_assert_ptr_ne(r, null); 2329 s = toStringO(r); 2330 ck_assert_str_eq(s, "AAee##ee#"); 2331 free(s); 2332 // non json string 2333 freeO(news); 2334 olds = 'e'; 2335 setTopIntO(news, 1); 2336 r = replaceCharSmallJsonO(self, olds, news,1); 2337 ck_assert_ptr_eq(r, null); 2338 // non json object 2339 terminateO(news); 2340 news = (smallJsont*) allocSmallInt(1); 2341 r = replaceCharSmallJsonO(self, olds, news,1); 2342 ck_assert_ptr_eq(r, null); 2343 terminateO(news); 2344 news = allocSmallJson(); 2345 // empty string 2346 setValO(self, ""); 2347 olds = '#'; 2348 r = replaceCharSmallJsonO(self, olds, NULL,1); 2349 ck_assert_ptr_ne(r, null); 2350 s = toStringO(r); 2351 ck_assert_str_eq(s, ""); 2352 free(s); 2353 // NULL string 2354 freeO(self); 2355 freeO(news); 2356 setTopSO(news, "|"); 2357 ck_assert_ptr_eq(replaceCharSmallJsonO(self, olds, news,1), NULL); 2358 terminateO(news); 2359 terminateO(self); 2360 2361 END_TEST 2362 2363 2364 START_TEST(replaceCharSmallStringSmallStringT) 2365 2366 smallStringt* r; 2367 smallStringt *self = allocG("#ee#ee#ad"); 2368 char olds; 2369 smallStringt *news = allocSmallString(""); 2370 2371 // replace string, multiple character new delimeter 2372 olds = '#'; 2373 setValO(news, "^^"); 2374 r = replaceCharSmallStringO(self, olds, news, 0); 2375 ck_assert_ptr_ne(r, null); 2376 char *s = toStringO(r); 2377 ck_assert_str_eq(s, "^^ee^^ee^^ad"); 2378 free(s); 2379 // replace string, multiple character old delimeter 2380 setValO(self, "AA#ee#ee"); 2381 olds = '#'; 2382 setValO(news, "|"); 2383 r = replaceCharSmallStringO(self, olds, news, 0); 2384 ck_assert_ptr_ne(r, null); 2385 s = toStringO(r); 2386 ck_assert_str_eq(s, "AA|ee|ee"); 2387 free(s); 2388 // replace one time at the start of string 2389 setValO(self, "#ee#ee#ad"); 2390 olds = '#'; 2391 setValO(news, "^^"); 2392 r = replaceCharSmallStringO(self, olds, news,1); 2393 ck_assert_ptr_ne(r, null); 2394 s = toStringO(r); 2395 ck_assert_str_eq(s, "^^ee#ee#ad"); 2396 free(s); 2397 // replace one time 2398 setValO(self, "AA#ee##ee#"); 2399 olds = '#'; 2400 setValO(news, "|"); 2401 r = replaceCharSmallStringO(self, olds, news,1); 2402 ck_assert_ptr_ne(r, null); 2403 s = toStringO(r); 2404 ck_assert_str_eq(s, "AA|ee##ee#"); 2405 free(s); 2406 // NULL new delimiter, one time: same as empty delimiter 2407 setValO(self, "AA#ee##ee#"); 2408 olds = '#'; 2409 r = replaceCharSmallStringO(self, olds, NULL,1); 2410 ck_assert_ptr_ne(r, null); 2411 s = toStringO(r); 2412 ck_assert_str_eq(s, "AAee##ee#"); 2413 free(s); 2414 // non smallString object 2415 terminateO(news); 2416 news = (smallStringt*) allocSmallInt(1); 2417 r = replaceCharSmallStringO(self, olds, news,1); 2418 ck_assert_ptr_eq(r, null); 2419 terminateO(news); 2420 news = allocSmallString(""); 2421 // empty string 2422 setValO(self, ""); 2423 olds = '#'; 2424 r = replaceCharSmallStringO(self, olds, NULL,1); 2425 ck_assert_ptr_ne(r, null); 2426 s = toStringO(r); 2427 ck_assert_str_eq(s, ""); 2428 free(s); 2429 // NULL string 2430 freeO(self); 2431 setValO(news, "|"); 2432 ck_assert_ptr_eq(replaceCharSmallStringO(self, olds, news,1), NULL); 2433 terminateO(news); 2434 terminateO(self); 2435 2436 END_TEST 2437 2438 2439 START_TEST(replaceManySmallStringT) 2440 2441 smallStringt* r; 2442 smallStringt *self = allocG(""); 2443 2444 // replace string, multiple character new delimeter 2445 setValO(self, "#ee#ee#ad"); 2446 r = replaceManyO(self, "#","^^","ad","AD"); 2447 ck_assert_ptr_ne(r, null); 2448 char *s = toStringO(r); 2449 ck_assert_str_eq(s, "^^ee^^ee^^AD"); 2450 free(s); 2451 // replace string, empty new delimeter 2452 setValO(self, "#ee#ee#ad"); 2453 r = replaceManyO(self, "#","","ad","AD"); 2454 ck_assert_ptr_ne(r, null); 2455 s = toStringO(r); 2456 ck_assert_str_eq(s, "eeeeAD"); 2457 free(s); 2458 // not enough olds:news pairs 2459 setValO(self, "#ee#ee#ad"); 2460 r = replaceManyO(self, "#","","ad"); 2461 ck_assert_ptr_ne(r, null); 2462 s = toStringO(r); 2463 ck_assert_str_eq(s, "eeeead"); 2464 free(s); 2465 // NULL new delimiter: same as only 2 parameters or not enough olds:news pairs 2466 setValO(self, "AA##ee##ee#"); 2467 r = replaceManyO(self, "##",NULL); 2468 ck_assert_ptr_eq(r, null); 2469 // empty string 2470 setValO(self, ""); 2471 r = replaceManyO(self, "##", ""); 2472 ck_assert_ptr_ne(r, null); 2473 s = toStringO(r); 2474 ck_assert_str_eq(s, ""); 2475 free(s); 2476 // empty string many pairs 2477 setValO(self, ""); 2478 r = replaceManyO(self, "##", "", "$$", ""); 2479 ck_assert_ptr_ne(r, null); 2480 s = toStringO(r); 2481 ck_assert_str_eq(s, ""); 2482 free(s); 2483 // empty string many pairs empty olds 2484 setValO(self, ""); 2485 r = replaceManyO(self, "##", "", "", ""); 2486 ck_assert_ptr_ne(r, null); 2487 s = toStringO(r); 2488 ck_assert_str_eq(s, ""); 2489 free(s); 2490 // empty string and NULL old delimiter 2491 setValO(self, ""); 2492 r = replaceManyO(self, NULL,"|"); 2493 ck_assert_ptr_ne(r, null); 2494 s = toStringO(r); 2495 ck_assert_str_eq(s, ""); 2496 free(s); 2497 // empty string and NULL old delimiter not first - same as replace empty string 2498 setValO(self, ""); 2499 r = replaceManyO(self,"##","|", NULL,"|"); 2500 ck_assert_ptr_ne(r, null); 2501 s = toStringO(r); 2502 ck_assert_str_eq(s, ""); 2503 free(s); 2504 // empty old delimiter 2505 setValO(self, "AA##ee##ee#"); 2506 ck_assert_ptr_eq(replaceManyO(self, "","|", "AA", "BB"), NULL); 2507 // empty old delimiter not first 2508 ck_assert_ptr_eq(replaceManyO(self, "##","|", "", "BB"), NULL); 2509 // NULL string 2510 freeO(self); 2511 ck_assert_ptr_eq(replaceManyO(self, "##","|"), NULL); 2512 terminateO(self); 2513 2514 END_TEST 2515 2516 2517 START_TEST(icReplaceSmallStringT) 2518 2519 smallStringt* r; 2520 smallStringt *self = allocG("BeebeeBad"); 2521 2522 // replace string, multiple character new delimeter 2523 r = icReplaceO(self, "b","^^", 0); 2524 ck_assert_ptr_ne(r, null); 2525 char *s = toStringO(r); 2526 ck_assert_str_eq(s, "^^ee^^ee^^ad"); 2527 free(s); 2528 // replace string, multiple character old delimeter 2529 setValO(self, "AA##ee##ee#"); 2530 r = icReplaceO(self, "##","|", 0); 2531 ck_assert_ptr_ne(r, null); 2532 s = toStringO(r); 2533 ck_assert_str_eq(s, "AA|ee|ee#"); 2534 free(s); 2535 // replace one time at the start of string 2536 setValO(self, "#ee#ee#ad"); 2537 r = icReplaceO(self, "#","^^",1); 2538 ck_assert_ptr_ne(r, null); 2539 s = toStringO(r); 2540 ck_assert_str_eq(s, "^^ee#ee#ad"); 2541 free(s); 2542 // replace one time 2543 setValO(self, "AA##ee##ee#"); 2544 r = icReplaceO(self, "##","|",1); 2545 ck_assert_ptr_ne(r, null); 2546 s = toStringO(r); 2547 ck_assert_str_eq(s, "AA|ee##ee#"); 2548 free(s); 2549 // NULL new delimiter, one time: same as empty delimiter 2550 setValO(self, "AA##ee##ee#"); 2551 r = icReplaceO(self, "##",NULL,1); 2552 ck_assert_ptr_ne(r, null); 2553 s = toStringO(r); 2554 ck_assert_str_eq(s, "AAee##ee#"); 2555 free(s); 2556 // empty string 2557 setValO(self, ""); 2558 r = icReplaceO(self, "##",NULL,1); 2559 ck_assert_ptr_ne(r, null); 2560 s = toStringO(r); 2561 ck_assert_str_eq(s, ""); 2562 free(s); 2563 // empty old delimiter 2564 setValO(self, "qwe"); 2565 ck_assert_ptr_eq(icReplaceO(self, "","|",1), NULL); 2566 // NULL old delimiter 2567 ck_assert_ptr_eq(icReplaceO(self, NULL,"|",1), NULL); 2568 // empty old delimiter 2569 ck_assert_ptr_eq(icReplaceO(self, "","|",1), NULL); 2570 // NULL string 2571 freeO(self); 2572 ck_assert_ptr_eq(icReplaceO(self, "##","|",1), NULL); 2573 terminateO(self); 2574 2575 END_TEST 2576 2577 2578 START_TEST(icReplaceCharSSmallStringT) 2579 2580 smallStringt* r; 2581 smallStringt *self = allocG(""); 2582 2583 // replace string, multiple character new delimeter 2584 setValO(self, "BeebeeBad"); 2585 r = icReplaceCharSO(self, 'B',"^^", 0); 2586 ck_assert_ptr_ne(r, null); 2587 char *s = toStringO(r); 2588 ck_assert_str_eq(s, "^^ee^^ee^^ad"); 2589 free(s); 2590 // replace one time at the start of string 2591 setValO(self, "#ee#ee#ad"); 2592 r = icReplaceCharSO(self, '#',"^^",1); 2593 ck_assert_ptr_ne(r, null); 2594 s = toStringO(r); 2595 ck_assert_str_eq(s, "^^ee#ee#ad"); 2596 free(s); 2597 // replace one time 2598 setValO(self, "AA##ee##ee#"); 2599 r = icReplaceCharSO(self, '#',"|",1); 2600 ck_assert_ptr_ne(r, null); 2601 s = toStringO(r); 2602 ck_assert_str_eq(s, "AA|#ee##ee#"); 2603 free(s); 2604 // NULL new delimiter, one time: same as empty delimiter 2605 setValO(self, "AA#ee##ee#"); 2606 r = icReplaceCharSO(self, '#',NULL,1); 2607 ck_assert_ptr_ne(r, null); 2608 s = toStringO(r); 2609 ck_assert_str_eq(s, "AAee##ee#"); 2610 free(s); 2611 // empty string 2612 setValO(self, ""); 2613 r = icReplaceCharSO(self, '#',NULL,1); 2614 ck_assert_ptr_ne(r, null); 2615 s = toStringO(r); 2616 ck_assert_str_eq(s, ""); 2617 free(s); 2618 // empty old delimiter 2619 setValO(self, "qwe"); 2620 ck_assert_ptr_eq(icReplaceCharSO(self, 0,"|",1), NULL); 2621 // NULL string 2622 freeO(self); 2623 ck_assert_ptr_eq(icReplaceCharSO(self, '#',"|",1), NULL); 2624 terminateO(self); 2625 2626 END_TEST 2627 2628 2629 START_TEST(icReplaceSCharSmallStringT) 2630 2631 smallStringt* r; 2632 smallStringt *self = allocG(""); 2633 2634 // replace string, multiple character new delimeter 2635 setValO(self, "BeebeeBad"); 2636 r = icReplaceSCharO(self, "b",'^',0); 2637 ck_assert_ptr_ne(r, null); 2638 char *s = toStringO(r); 2639 ck_assert_str_eq(s, "^ee^ee^ad"); 2640 free(s); 2641 // replace string, multiple character old delimeter 2642 setValO(self, "AA##ee##ee#"); 2643 r = icReplaceSCharO(self, "##",'|',0); 2644 ck_assert_ptr_ne(r, null); 2645 s = toStringO(r); 2646 ck_assert_str_eq(s, "AA|ee|ee#"); 2647 free(s); 2648 // replace string empty char, multiple character old delimeter 2649 setValO(self, "AA##ee##ee#"); 2650 r = icReplaceSCharO(self, "##", 0,0); 2651 ck_assert_ptr_ne(r, null); 2652 s = toStringO(r); 2653 ck_assert_str_eq(s, "AAeeee#"); 2654 free(s); 2655 // replace one time at the start of string 2656 setValO(self, "#ee#ee#ad"); 2657 r = icReplaceSCharO(self, "#",'^',1); 2658 ck_assert_ptr_ne(r, null); 2659 s = toStringO(r); 2660 ck_assert_str_eq(s, "^ee#ee#ad"); 2661 free(s); 2662 // replace one time 2663 setValO(self, "AA##ee##ee#"); 2664 r = icReplaceSCharO(self, "##",'|',1); 2665 ck_assert_ptr_ne(r, null); 2666 s = toStringO(r); 2667 ck_assert_str_eq(s, "AA|ee##ee#"); 2668 free(s); 2669 // empty string 2670 setValO(self, ""); 2671 r = icReplaceSCharO(self, "##",0,1); 2672 ck_assert_ptr_ne(r, null); 2673 s = toStringO(r); 2674 ck_assert_str_eq(s, ""); 2675 free(s); 2676 // empty old delimiter 2677 setValO(self, "qwe"); 2678 ck_assert_ptr_eq(icReplaceSCharO(self, "",'|',1), NULL); 2679 // NULL old delimiter 2680 ck_assert_ptr_eq(icReplaceSCharO(self, NULL,'|',1), NULL); 2681 // NULL string 2682 freeO(self); 2683 ck_assert_ptr_eq(icReplaceSCharO(self, "##",'|',1), NULL); 2684 terminateO(self); 2685 2686 END_TEST 2687 2688 2689 START_TEST(icReplaceCharCharSmallStringT) 2690 2691 smallStringt* r; 2692 smallStringt *self = allocG(""); 2693 2694 // replace string, multiple character new delimeter 2695 setValO(self, "beeBeebad"); 2696 r = icReplaceCharCharO(self, 'b','^', 0); 2697 ck_assert_ptr_ne(r, null); 2698 char *s = toStringO(r); 2699 ck_assert_str_eq(s, "^ee^ee^ad"); 2700 free(s); 2701 // replace one time at the start of string 2702 setValO(self, "#ee#ee#ad"); 2703 r = icReplaceCharCharO(self, '#','^',1); 2704 ck_assert_ptr_ne(r, null); 2705 s = toStringO(r); 2706 ck_assert_str_eq(s, "^ee#ee#ad"); 2707 free(s); 2708 // replace one time 2709 setValO(self, "AA#ee##ee#"); 2710 r = icReplaceCharCharO(self, '#','|',1); 2711 ck_assert_ptr_ne(r, null); 2712 s = toStringO(r); 2713 ck_assert_str_eq(s, "AA|ee##ee#"); 2714 free(s); 2715 // empty string 2716 setValO(self, ""); 2717 r = icReplaceCharCharO(self, '#','^',1); 2718 ck_assert_ptr_ne(r, null); 2719 s = toStringO(r); 2720 ck_assert_str_eq(s, ""); 2721 free(s); 2722 // empty old delimiter 2723 setValO(self, "qwe"); 2724 ck_assert_ptr_eq(icReplaceCharCharO(self, 0,'|',1), NULL); 2725 // NULL string 2726 freeO(self); 2727 ck_assert_ptr_eq(icReplaceCharCharO(self, '#','|',1), NULL); 2728 terminateO(self); 2729 2730 END_TEST 2731 2732 2733 START_TEST(icReplaceSmallJsonSmallJsonSmallStringT) 2734 2735 smallStringt* r; 2736 smallStringt *self = allocG("BeebeeBad"); 2737 smallJsont *olds = allocSmallJson(); 2738 smallJsont *news = allocSmallJson(); 2739 2740 // replace string, multiple character new delimeter 2741 freeO(olds); 2742 freeO(news); 2743 setTopSO(olds, "B"); 2744 setTopSO(news, "^^"); 2745 r = icReplaceSmallJsonSmallJsonO(self, olds, news, 0); 2746 ck_assert_ptr_ne(r, null); 2747 char *s = toStringO(r); 2748 ck_assert_str_eq(s, "^^ee^^ee^^ad"); 2749 free(s); 2750 // replace string, multiple character old delimeter 2751 setValO(self, "AA##ee##ee#"); 2752 freeO(olds); 2753 freeO(news); 2754 setTopSO(olds, "##"); 2755 setTopSO(news, "|"); 2756 r = icReplaceSmallJsonSmallJsonO(self, olds, news, 0); 2757 ck_assert_ptr_ne(r, null); 2758 s = toStringO(r); 2759 ck_assert_str_eq(s, "AA|ee|ee#"); 2760 free(s); 2761 // replace one time at the start of string 2762 setValO(self, "#ee#ee#ad"); 2763 freeO(olds); 2764 freeO(news); 2765 setTopSO(olds, "#"); 2766 setTopSO(news, "^^"); 2767 r = icReplaceSmallJsonSmallJsonO(self, olds, news,1); 2768 ck_assert_ptr_ne(r, null); 2769 s = toStringO(r); 2770 ck_assert_str_eq(s, "^^ee#ee#ad"); 2771 free(s); 2772 // replace one time 2773 setValO(self, "AA##ee##ee#"); 2774 freeO(olds); 2775 freeO(news); 2776 setTopSO(olds, "##"); 2777 setTopSO(news, "|"); 2778 r = icReplaceSmallJsonSmallJsonO(self, olds, news,1); 2779 ck_assert_ptr_ne(r, null); 2780 s = toStringO(r); 2781 ck_assert_str_eq(s, "AA|ee##ee#"); 2782 free(s); 2783 // NULL new delimiter, one time: same as empty delimiter 2784 setValO(self, "AA##ee##ee#"); 2785 freeO(olds); 2786 setTopSO(olds, "##"); 2787 r = icReplaceSmallJsonSmallJsonO(self, olds, NULL,1); 2788 ck_assert_ptr_ne(r, null); 2789 s = toStringO(r); 2790 ck_assert_str_eq(s, "AAee##ee#"); 2791 free(s); 2792 // non json string 2793 freeO(olds); 2794 setTopIntO(olds, 1); 2795 r = icReplaceSmallJsonSmallJsonO(self, olds, news,1); 2796 ck_assert_ptr_eq(r, null); 2797 freeO(olds); 2798 freeO(news); 2799 setTopSO(olds, "e"); 2800 setTopIntO(news, 1); 2801 r = icReplaceSmallJsonSmallJsonO(self, olds, news,1); 2802 ck_assert_ptr_eq(r, null); 2803 // non json object 2804 terminateO(olds); 2805 olds = (smallJsont*) allocSmallInt(1); 2806 r = icReplaceSmallJsonSmallJsonO(self, olds, news,1); 2807 ck_assert_ptr_eq(r, null); 2808 terminateO(olds); 2809 terminateO(news); 2810 olds = allocSmallJson(); 2811 news = (smallJsont*) allocSmallInt(1); 2812 r = icReplaceSmallJsonSmallJsonO(self, olds, news,1); 2813 ck_assert_ptr_eq(r, null); 2814 terminateO(news); 2815 news = allocSmallJson(); 2816 // empty string 2817 setValO(self, ""); 2818 freeO(olds); 2819 setTopSO(olds, "##"); 2820 r = icReplaceSmallJsonSmallJsonO(self, olds, NULL,1); 2821 ck_assert_ptr_ne(r, null); 2822 s = toStringO(r); 2823 ck_assert_str_eq(s, ""); 2824 free(s); 2825 // empty old delimiter 2826 setValO(self, "qwe"); 2827 freeO(olds); 2828 freeO(news); 2829 setTopSO(olds, ""); 2830 setTopSO(news, "|"); 2831 ck_assert_ptr_eq(icReplaceSmallJsonSmallJsonO(self, olds, news,1), NULL); 2832 // NULL old delimiter 2833 ck_assert_ptr_eq(icReplaceSmallJsonSmallJsonO(self, NULL, news,1), NULL); 2834 // NULL string 2835 freeO(self); 2836 ck_assert_ptr_eq(icReplaceSmallJsonSmallJsonO(self, olds, news,1), NULL); 2837 terminateO(olds); 2838 terminateO(news); 2839 terminateO(self); 2840 2841 END_TEST 2842 2843 2844 START_TEST(icReplaceSmallJsonSmallStringSmallStringT) 2845 2846 smallStringt* r; 2847 smallStringt *self = allocG("BeebeeBad"); 2848 smallJsont *olds = allocSmallJson(); 2849 smallStringt *news = allocSmallString(""); 2850 2851 // replace string, multiple character new delimeter 2852 freeO(olds); 2853 setTopSO(olds, "B"); 2854 setValO(news, "^^"); 2855 r = icReplaceSmallJsonSmallStringO(self, olds, news, 0); 2856 ck_assert_ptr_ne(r, null); 2857 char *s = toStringO(r); 2858 ck_assert_str_eq(s, "^^ee^^ee^^ad"); 2859 free(s); 2860 // replace string, multiple character old delimeter 2861 setValO(self, "AA##ee##ee#"); 2862 freeO(olds); 2863 setTopSO(olds, "##"); 2864 setValO(news, "|"); 2865 r = icReplaceSmallJsonSmallStringO(self, olds, news, 0); 2866 ck_assert_ptr_ne(r, null); 2867 s = toStringO(r); 2868 ck_assert_str_eq(s, "AA|ee|ee#"); 2869 free(s); 2870 // replace one time at the start of string 2871 setValO(self, "#ee#ee#ad"); 2872 freeO(olds); 2873 setTopSO(olds, "#"); 2874 setValO(news, "^^"); 2875 r = icReplaceSmallJsonSmallStringO(self, olds, news,1); 2876 ck_assert_ptr_ne(r, null); 2877 s = toStringO(r); 2878 ck_assert_str_eq(s, "^^ee#ee#ad"); 2879 free(s); 2880 // replace one time 2881 setValO(self, "AA##ee##ee#"); 2882 freeO(olds); 2883 setTopSO(olds, "##"); 2884 setValO(news, "|"); 2885 r = icReplaceSmallJsonSmallStringO(self, olds, news,1); 2886 ck_assert_ptr_ne(r, null); 2887 s = toStringO(r); 2888 ck_assert_str_eq(s, "AA|ee##ee#"); 2889 free(s); 2890 // NULL new delimiter, one time: same as empty delimiter 2891 setValO(self, "AA##ee##ee#"); 2892 freeO(olds); 2893 setTopSO(olds, "##"); 2894 r = icReplaceSmallJsonSmallStringO(self, olds, NULL,1); 2895 ck_assert_ptr_ne(r, null); 2896 s = toStringO(r); 2897 ck_assert_str_eq(s, "AAee##ee#"); 2898 free(s); 2899 // non json string 2900 freeO(olds); 2901 setTopIntO(olds, 1); 2902 r = icReplaceSmallJsonSmallStringO(self, olds, news,1); 2903 ck_assert_ptr_eq(r, null); 2904 // non json object 2905 terminateO(olds); 2906 olds = (smallJsont*) allocSmallInt(1); 2907 r = icReplaceSmallJsonSmallStringO(self, olds, news,1); 2908 ck_assert_ptr_eq(r, null); 2909 terminateO(olds); 2910 terminateO(news); 2911 olds = allocSmallJson(); 2912 news = (smallStringt*) allocSmallInt(1); 2913 r = icReplaceSmallJsonSmallStringO(self, olds, news,1); 2914 ck_assert_ptr_eq(r, null); 2915 terminateO(news); 2916 news = allocSmallString(""); 2917 // empty string 2918 setValO(self, ""); 2919 freeO(olds); 2920 setTopSO(olds, "##"); 2921 r = icReplaceSmallJsonSmallStringO(self, olds, NULL,1); 2922 ck_assert_ptr_ne(r, null); 2923 s = toStringO(r); 2924 ck_assert_str_eq(s, ""); 2925 free(s); 2926 // empty old delimiter 2927 setValO(self, "qwe"); 2928 freeO(olds); 2929 setTopSO(olds, ""); 2930 setValO(news, "|"); 2931 ck_assert_ptr_eq(icReplaceSmallJsonSmallStringO(self, olds, news,1), NULL); 2932 // NULL old delimiter 2933 ck_assert_ptr_eq(icReplaceSmallJsonSmallStringO(self, NULL, news,1), NULL); 2934 // NULL string 2935 freeO(self); 2936 ck_assert_ptr_eq(icReplaceSmallJsonSmallStringO(self, olds, news,1), NULL); 2937 terminateO(olds); 2938 terminateO(news); 2939 terminateO(self); 2940 2941 END_TEST 2942 2943 2944 START_TEST(icReplaceSmallJsonSSmallStringT) 2945 2946 smallStringt* r; 2947 smallStringt *self = allocG("BeebeeBad"); 2948 smallJsont *olds = allocSmallJson(); 2949 const char *news; 2950 2951 // replace string, multiple character new delimeter 2952 freeO(olds); 2953 setTopSO(olds, "b"); 2954 news = "^^"; 2955 r = icReplaceSmallJsonSO(self, olds, news, 0); 2956 ck_assert_ptr_ne(r, null); 2957 char *s = toStringO(r); 2958 ck_assert_str_eq(s, "^^ee^^ee^^ad"); 2959 free(s); 2960 // replace string, multiple character old delimeter 2961 setValO(self, "AA##ee##ee#"); 2962 freeO(olds); 2963 setTopSO(olds, "##"); 2964 news = "|"; 2965 r = icReplaceSmallJsonSO(self, olds, news, 0); 2966 ck_assert_ptr_ne(r, null); 2967 s = toStringO(r); 2968 ck_assert_str_eq(s, "AA|ee|ee#"); 2969 free(s); 2970 // replace one time at the start of string 2971 setValO(self, "#ee#ee#ad"); 2972 freeO(olds); 2973 setTopSO(olds, "#"); 2974 news = "^^"; 2975 r = icReplaceSmallJsonSO(self, olds, news,1); 2976 ck_assert_ptr_ne(r, null); 2977 s = toStringO(r); 2978 ck_assert_str_eq(s, "^^ee#ee#ad"); 2979 free(s); 2980 // replace one time 2981 setValO(self, "AA##ee##ee#"); 2982 freeO(olds); 2983 setTopSO(olds, "##"); 2984 news = "|"; 2985 r = icReplaceSmallJsonSO(self, olds, news,1); 2986 ck_assert_ptr_ne(r, null); 2987 s = toStringO(r); 2988 ck_assert_str_eq(s, "AA|ee##ee#"); 2989 free(s); 2990 // NULL new delimiter, one time: same as empty delimiter 2991 setValO(self, "AA##ee##ee#"); 2992 freeO(olds); 2993 setTopSO(olds, "##"); 2994 r = icReplaceSmallJsonSO(self, olds, NULL,1); 2995 ck_assert_ptr_ne(r, null); 2996 s = toStringO(r); 2997 ck_assert_str_eq(s, "AAee##ee#"); 2998 free(s); 2999 // non json string 3000 freeO(olds); 3001 setTopIntO(olds, 1); 3002 r = icReplaceSmallJsonSO(self, olds, news,1); 3003 ck_assert_ptr_eq(r, null); 3004 // non json object 3005 terminateO(olds); 3006 olds = (smallJsont*) allocSmallInt(1); 3007 r = icReplaceSmallJsonSO(self, olds, news,1); 3008 ck_assert_ptr_eq(r, null); 3009 terminateO(olds); 3010 // empty string 3011 olds = allocSmallJson(); 3012 setValO(self, ""); 3013 setTopSO(olds, "##"); 3014 r = icReplaceSmallJsonSO(self, olds, NULL,1); 3015 ck_assert_ptr_ne(r, null); 3016 s = toStringO(r); 3017 ck_assert_str_eq(s, ""); 3018 free(s); 3019 // empty old delimiter 3020 setValO(self, "qwe"); 3021 freeO(olds); 3022 setTopSO(olds, ""); 3023 news = "|"; 3024 ck_assert_ptr_eq(icReplaceSmallJsonSO(self, olds, news,1), NULL); 3025 // NULL old delimiter 3026 ck_assert_ptr_eq(icReplaceSmallJsonSO(self, NULL, news,1), NULL); 3027 // NULL string 3028 freeO(self); 3029 ck_assert_ptr_eq(icReplaceSmallJsonSO(self, olds, news,1), NULL); 3030 terminateO(olds); 3031 terminateO(self); 3032 3033 END_TEST 3034 3035 3036 START_TEST(icReplaceSmallJsonCharSmallStringT) 3037 3038 smallStringt* r; 3039 smallStringt *self = allocG("beeBeebad"); 3040 smallJsont *olds = allocSmallJson(); 3041 char news; 3042 3043 // replace string, multiple character new delimeter 3044 freeO(olds); 3045 setTopSO(olds, "B"); 3046 news = '^'; 3047 r = icReplaceSmallJsonCharO(self, olds, news, 0); 3048 ck_assert_ptr_ne(r, null); 3049 char *s = toStringO(r); 3050 ck_assert_str_eq(s, "^ee^ee^ad"); 3051 free(s); 3052 // replace string, multiple character old delimeter 3053 setValO(self, "AA##ee##ee#"); 3054 freeO(olds); 3055 setTopSO(olds, "##"); 3056 news = '|'; 3057 r = icReplaceSmallJsonCharO(self, olds, news, 0); 3058 ck_assert_ptr_ne(r, null); 3059 s = toStringO(r); 3060 ck_assert_str_eq(s, "AA|ee|ee#"); 3061 free(s); 3062 // replace one time at the start of string 3063 setValO(self, "#ee#ee#ad"); 3064 freeO(olds); 3065 setTopSO(olds, "#"); 3066 news = '^'; 3067 r = icReplaceSmallJsonCharO(self, olds, news,1); 3068 ck_assert_ptr_ne(r, null); 3069 s = toStringO(r); 3070 ck_assert_str_eq(s, "^ee#ee#ad"); 3071 free(s); 3072 // replace one time 3073 setValO(self, "AA##ee##ee#"); 3074 freeO(olds); 3075 setTopSO(olds, "##"); 3076 news = '|'; 3077 r = icReplaceSmallJsonCharO(self, olds, news,1); 3078 ck_assert_ptr_ne(r, null); 3079 s = toStringO(r); 3080 ck_assert_str_eq(s, "AA|ee##ee#"); 3081 free(s); 3082 // non json string 3083 setValO(self, "AA##ee##ee#"); 3084 freeO(olds); 3085 setTopIntO(olds, 1); 3086 r = icReplaceSmallJsonCharO(self, olds, news,1); 3087 ck_assert_ptr_eq(r, null); 3088 // non json object 3089 terminateO(olds); 3090 olds = (smallJsont*) allocSmallInt(1); 3091 r = icReplaceSmallJsonCharO(self, olds, news,1); 3092 ck_assert_ptr_eq(r, null); 3093 terminateO(olds); 3094 // empty string 3095 olds = allocSmallJson(); 3096 setValO(self, ""); 3097 setTopSO(olds, "##"); 3098 r = icReplaceSmallJsonCharO(self, olds, news,1); 3099 ck_assert_ptr_ne(r, null); 3100 s = toStringO(r); 3101 ck_assert_str_eq(s, ""); 3102 free(s); 3103 // empty old delimiter 3104 setValO(self, "qwe"); 3105 freeO(olds); 3106 setTopSO(olds, ""); 3107 news = '|'; 3108 ck_assert_ptr_eq(icReplaceSmallJsonCharO(self, olds, news,1), NULL); 3109 // NULL old delimiter 3110 ck_assert_ptr_eq(icReplaceSmallJsonCharO(self, NULL, news,1), NULL); 3111 // NULL string 3112 freeO(self); 3113 ck_assert_ptr_eq(icReplaceSmallJsonCharO(self, olds, news,1), NULL); 3114 terminateO(olds); 3115 terminateO(self); 3116 3117 END_TEST 3118 3119 3120 START_TEST(icReplaceSmallStringSmallJsonSmallStringT) 3121 3122 smallStringt* r; 3123 smallStringt *self = allocG("BeeBeeBad"); 3124 smallStringt *olds = allocSmallString(""); 3125 smallJsont *news = allocSmallJson(); 3126 3127 // replace string, multiple character new delimeter 3128 freeO(news); 3129 setValO(olds, "b"); 3130 setTopSO(news, "^^"); 3131 r = self->f->icReplaceSmallStringSmallJson(self, olds, news, 0); 3132 ck_assert_ptr_ne(r, null); 3133 char *s = toStringO(r); 3134 ck_assert_str_eq(s, "^^ee^^ee^^ad"); 3135 free(s); 3136 // replace string, multiple character old delimeter 3137 setValO(self, "AA##ee##ee#"); 3138 freeO(news); 3139 setValO(olds, "##"); 3140 setTopSO(news, "|"); 3141 r = self->f->icReplaceSmallStringSmallJson(self, olds, news, 0); 3142 ck_assert_ptr_ne(r, null); 3143 s = toStringO(r); 3144 ck_assert_str_eq(s, "AA|ee|ee#"); 3145 free(s); 3146 // replace one time at the start of string 3147 setValO(self, "#ee#ee#ad"); 3148 freeO(news); 3149 setValO(olds, "#"); 3150 setTopSO(news, "^^"); 3151 r = self->f->icReplaceSmallStringSmallJson(self, olds, news,1); 3152 ck_assert_ptr_ne(r, null); 3153 s = toStringO(r); 3154 ck_assert_str_eq(s, "^^ee#ee#ad"); 3155 free(s); 3156 // replace one time 3157 setValO(self, "AA##ee##ee#"); 3158 freeO(news); 3159 setValO(olds, "##"); 3160 setTopSO(news, "|"); 3161 r = self->f->icReplaceSmallStringSmallJson(self, olds, news,1); 3162 ck_assert_ptr_ne(r, null); 3163 s = toStringO(r); 3164 ck_assert_str_eq(s, "AA|ee##ee#"); 3165 free(s); 3166 // NULL new delimiter, one time: same as empty delimiter 3167 setValO(self, "AA##ee##ee#"); 3168 setValO(olds, "##"); 3169 r = self->f->icReplaceSmallStringSmallJson(self, olds, NULL,1); 3170 ck_assert_ptr_ne(r, null); 3171 s = toStringO(r); 3172 ck_assert_str_eq(s, "AAee##ee#"); 3173 free(s); 3174 // non json string 3175 freeO(news); 3176 setTopIntO(news, 1); 3177 r = self->f->icReplaceSmallStringSmallJson(self, olds, news,1); 3178 ck_assert_ptr_eq(r, null); 3179 // non json object 3180 terminateO(olds); 3181 olds = (smallStringt*) allocSmallInt(1); 3182 r = self->f->icReplaceSmallStringSmallJson(self, olds, news,1); 3183 ck_assert_ptr_eq(r, null); 3184 terminateO(olds); 3185 terminateO(news); 3186 olds = allocSmallString(""); 3187 news = (smallJsont*) allocSmallInt(1); 3188 r = self->f->icReplaceSmallStringSmallJson(self, olds, news,1); 3189 ck_assert_ptr_eq(r, null); 3190 terminateO(news); 3191 news = allocSmallJson(); 3192 // empty string 3193 setValO(self, ""); 3194 setValO(olds, "##"); 3195 r = self->f->icReplaceSmallStringSmallJson(self, olds, NULL,1); 3196 ck_assert_ptr_ne(r, null); 3197 s = toStringO(r); 3198 ck_assert_str_eq(s, ""); 3199 free(s); 3200 // empty old delimiter 3201 setValO(self, "qwe"); 3202 freeO(news); 3203 setValO(olds, ""); 3204 setTopSO(news, "|"); 3205 ck_assert_ptr_eq(self->f->icReplaceSmallStringSmallJson(self, olds, news,1), NULL); 3206 // NULL old delimiter 3207 ck_assert_ptr_eq(self->f->icReplaceSmallStringSmallJson(self, NULL, news,1), NULL); 3208 // NULL string 3209 freeO(self); 3210 ck_assert_ptr_eq(self->f->icReplaceSmallStringSmallJson(self, olds, news,1), NULL); 3211 terminateO(olds); 3212 terminateO(news); 3213 terminateO(self); 3214 3215 END_TEST 3216 3217 3218 START_TEST(icReplaceSmallStringSmallStringSmallStringT) 3219 3220 smallStringt* r; 3221 smallStringt *self = allocG("beebeebad"); 3222 smallStringt *olds = allocSmallString(""); 3223 smallStringt *news = allocSmallString(""); 3224 3225 // replace string, multiple character new delimeter 3226 setValO(olds, "B"); 3227 setValO(news, "^^"); 3228 r = icReplaceSmallStringSmallStringO(self, olds, news, 0); 3229 ck_assert_ptr_ne(r, null); 3230 char *s = toStringO(r); 3231 ck_assert_str_eq(s, "^^ee^^ee^^ad"); 3232 free(s); 3233 // replace string, multiple character old delimeter 3234 setValO(self, "AA##ee##ee#"); 3235 setValO(olds, "##"); 3236 setValO(news, "|"); 3237 r = icReplaceSmallStringSmallStringO(self, olds, news, 0); 3238 ck_assert_ptr_ne(r, null); 3239 s = toStringO(r); 3240 ck_assert_str_eq(s, "AA|ee|ee#"); 3241 free(s); 3242 // replace one time at the start of string 3243 setValO(self, "#ee#ee#ad"); 3244 setValO(olds, "#"); 3245 setValO(news, "^^"); 3246 r = icReplaceSmallStringSmallStringO(self, olds, news,1); 3247 ck_assert_ptr_ne(r, null); 3248 s = toStringO(r); 3249 ck_assert_str_eq(s, "^^ee#ee#ad"); 3250 free(s); 3251 // replace one time 3252 setValO(self, "AA##ee##ee#"); 3253 setValO(olds, "##"); 3254 setValO(news, "|"); 3255 r = icReplaceSmallStringSmallStringO(self, olds, news,1); 3256 ck_assert_ptr_ne(r, null); 3257 s = toStringO(r); 3258 ck_assert_str_eq(s, "AA|ee##ee#"); 3259 free(s); 3260 // NULL new delimiter, one time: same as empty delimiter 3261 setValO(self, "AA##ee##ee#"); 3262 setValO(olds, "##"); 3263 r = icReplaceSmallStringSmallStringO(self, olds, NULL,1); 3264 ck_assert_ptr_ne(r, null); 3265 s = toStringO(r); 3266 ck_assert_str_eq(s, "AAee##ee#"); 3267 free(s); 3268 // non smallString object 3269 terminateO(olds); 3270 olds = (smallStringt*) allocSmallInt(1); 3271 r = icReplaceSmallStringSmallStringO(self, olds, news,1); 3272 ck_assert_ptr_eq(r, null); 3273 terminateO(olds); 3274 terminateO(news); 3275 olds = allocSmallString(""); 3276 news = (smallStringt*) allocSmallInt(1); 3277 r = icReplaceSmallStringSmallStringO(self, olds, news,1); 3278 ck_assert_ptr_eq(r, null); 3279 terminateO(news); 3280 news = allocSmallString(""); 3281 // empty string 3282 setValO(self, ""); 3283 setValO(olds, "##"); 3284 r = icReplaceSmallStringSmallStringO(self, olds, NULL,1); 3285 ck_assert_ptr_ne(r, null); 3286 s = toStringO(r); 3287 ck_assert_str_eq(s, ""); 3288 free(s); 3289 // empty old delimiter 3290 setValO(self, "qwe"); 3291 setValO(olds, ""); 3292 setValO(news, "|"); 3293 ck_assert_ptr_eq(icReplaceSmallStringSmallStringO(self, olds, news,1), NULL); 3294 // NULL old delimiter 3295 ck_assert_ptr_eq(icReplaceSmallStringSmallStringO(self, NULL, news,1), NULL); 3296 // NULL string 3297 freeO(self); 3298 ck_assert_ptr_eq(icReplaceSmallStringSmallStringO(self, olds, news,1), NULL); 3299 terminateO(olds); 3300 terminateO(news); 3301 terminateO(self); 3302 3303 END_TEST 3304 3305 3306 START_TEST(icReplaceSmallStringSSmallStringT) 3307 3308 smallStringt* r; 3309 smallStringt *self = allocG("beebeebad"); 3310 smallStringt *olds = allocSmallString(""); 3311 const char *news; 3312 3313 // replace string, multiple character new delimeter 3314 setValO(olds, "B"); 3315 news = "^^"; 3316 r = icReplaceSmallStringSO(self, olds, news, 0); 3317 ck_assert_ptr_ne(r, null); 3318 char *s = toStringO(r); 3319 ck_assert_str_eq(s, "^^ee^^ee^^ad"); 3320 free(s); 3321 // replace string, multiple character old delimeter 3322 setValO(self, "AA##ee##ee#"); 3323 setValO(olds, "##"); 3324 news = "|"; 3325 r = icReplaceSmallStringSO(self, olds, news, 0); 3326 ck_assert_ptr_ne(r, null); 3327 s = toStringO(r); 3328 ck_assert_str_eq(s, "AA|ee|ee#"); 3329 free(s); 3330 // replace one time at the start of string 3331 setValO(self, "#ee#ee#ad"); 3332 setValO(olds, "#"); 3333 news = "^^"; 3334 r = icReplaceSmallStringSO(self, olds, news,1); 3335 ck_assert_ptr_ne(r, null); 3336 s = toStringO(r); 3337 ck_assert_str_eq(s, "^^ee#ee#ad"); 3338 free(s); 3339 // replace one time 3340 setValO(self, "AA##ee##ee#"); 3341 setValO(olds, "##"); 3342 news = "|"; 3343 r = icReplaceSmallStringSO(self, olds, news,1); 3344 ck_assert_ptr_ne(r, null); 3345 s = toStringO(r); 3346 ck_assert_str_eq(s, "AA|ee##ee#"); 3347 free(s); 3348 // NULL new delimiter, one time: same as empty delimiter 3349 setValO(self, "AA##ee##ee#"); 3350 setValO(olds, "##"); 3351 r = icReplaceSmallStringSO(self, olds, NULL,1); 3352 ck_assert_ptr_ne(r, null); 3353 s = toStringO(r); 3354 ck_assert_str_eq(s, "AAee##ee#"); 3355 free(s); 3356 // non smallString object 3357 terminateO(olds); 3358 olds = (smallStringt*) allocSmallInt(1); 3359 r = icReplaceSmallStringSO(self, olds, news,1); 3360 ck_assert_ptr_eq(r, null); 3361 terminateO(olds); 3362 olds = allocSmallString(""); 3363 // empty string 3364 setValO(self, ""); 3365 setValO(olds, "##"); 3366 r = icReplaceSmallStringSO(self, olds, NULL,1); 3367 ck_assert_ptr_ne(r, null); 3368 s = toStringO(r); 3369 ck_assert_str_eq(s, ""); 3370 free(s); 3371 // empty old delimiter 3372 setValO(self, "qwe"); 3373 setValO(olds, ""); 3374 news = "|"; 3375 ck_assert_ptr_eq(icReplaceSmallStringSO(self, olds, news,1), NULL); 3376 // NULL old delimiter 3377 ck_assert_ptr_eq(icReplaceSmallStringSO(self, NULL, news,1), NULL); 3378 // NULL string 3379 freeO(self); 3380 ck_assert_ptr_eq(icReplaceSmallStringSO(self, olds, news,1), NULL); 3381 terminateO(olds); 3382 terminateO(self); 3383 3384 END_TEST 3385 3386 3387 START_TEST(icReplaceSmallStringCharSmallStringT) 3388 3389 smallStringt* r; 3390 smallStringt *self = allocG("beebeebad"); 3391 smallStringt *olds = allocSmallString(""); 3392 char news; 3393 3394 // replace string, multiple character new delimeter 3395 setValO(olds, "B"); 3396 news = '^'; 3397 r = icReplaceSmallStringCharO(self, olds, news, 0); 3398 ck_assert_ptr_ne(r, null); 3399 char *s = toStringO(r); 3400 ck_assert_str_eq(s, "^ee^ee^ad"); 3401 free(s); 3402 // replace string, multiple character old delimeter 3403 setValO(self, "AA##ee##ee#"); 3404 setValO(olds, "##"); 3405 news = '|'; 3406 r = icReplaceSmallStringCharO(self, olds, news, 0); 3407 ck_assert_ptr_ne(r, null); 3408 s = toStringO(r); 3409 ck_assert_str_eq(s, "AA|ee|ee#"); 3410 free(s); 3411 // replace one time at the start of string 3412 setValO(self, "#ee#ee#ad"); 3413 setValO(olds, "#"); 3414 news = '^'; 3415 r = icReplaceSmallStringCharO(self, olds, news,1); 3416 ck_assert_ptr_ne(r, null); 3417 s = toStringO(r); 3418 ck_assert_str_eq(s, "^ee#ee#ad"); 3419 free(s); 3420 // replace one time 3421 setValO(self, "AA##ee##ee#"); 3422 setValO(olds, "##"); 3423 news = '|'; 3424 r = icReplaceSmallStringCharO(self, olds, news,1); 3425 ck_assert_ptr_ne(r, null); 3426 s = toStringO(r); 3427 ck_assert_str_eq(s, "AA|ee##ee#"); 3428 free(s); 3429 // non smallString object 3430 terminateO(olds); 3431 olds = (smallStringt*) allocSmallInt(1); 3432 r = icReplaceSmallStringCharO(self, olds, news,1); 3433 ck_assert_ptr_eq(r, null); 3434 terminateO(olds); 3435 olds = allocSmallString(""); 3436 // empty string 3437 setValO(self, ""); 3438 setValO(olds, "##"); 3439 r = icReplaceSmallStringCharO(self, olds, news,1); 3440 ck_assert_ptr_ne(r, null); 3441 s = toStringO(r); 3442 ck_assert_str_eq(s, ""); 3443 free(s); 3444 // empty old delimiter 3445 setValO(self, "qwe"); 3446 setValO(olds, ""); 3447 news = '|'; 3448 ck_assert_ptr_eq(icReplaceSmallStringCharO(self, olds, news,1), NULL); 3449 // NULL old delimiter 3450 ck_assert_ptr_eq(icReplaceSmallStringCharO(self, NULL, news,1), NULL); 3451 // NULL string 3452 freeO(self); 3453 ck_assert_ptr_eq(icReplaceSmallStringCharO(self, olds, news,1), NULL); 3454 terminateO(olds); 3455 terminateO(self); 3456 3457 END_TEST 3458 3459 3460 START_TEST(icReplaceSSmallJsonSmallStringT) 3461 3462 smallStringt* r; 3463 smallStringt *self = allocG("beebeebad"); 3464 const char *olds; 3465 smallJsont *news = allocSmallJson(); 3466 3467 // replace string, multiple character new delimeter 3468 freeO(news); 3469 olds = "B"; 3470 setTopSO(news, "^^"); 3471 r = icReplaceSSmallJsonO(self, olds, news, 0); 3472 ck_assert_ptr_ne(r, null); 3473 char *s = toStringO(r); 3474 ck_assert_str_eq(s, "^^ee^^ee^^ad"); 3475 free(s); 3476 // replace string, multiple character old delimeter 3477 setValO(self, "AA##ee##ee#"); 3478 freeO(news); 3479 olds = "##"; 3480 setTopSO(news, "|"); 3481 r = icReplaceSSmallJsonO(self, olds, news, 0); 3482 ck_assert_ptr_ne(r, null); 3483 s = toStringO(r); 3484 ck_assert_str_eq(s, "AA|ee|ee#"); 3485 free(s); 3486 // replace one time at the start of string 3487 setValO(self, "#ee#ee#ad"); 3488 freeO(news); 3489 olds = "#"; 3490 setTopSO(news, "^^"); 3491 r = icReplaceSSmallJsonO(self, olds, news,1); 3492 ck_assert_ptr_ne(r, null); 3493 s = toStringO(r); 3494 ck_assert_str_eq(s, "^^ee#ee#ad"); 3495 free(s); 3496 // replace one time 3497 setValO(self, "AA##ee##ee#"); 3498 freeO(news); 3499 olds = "##"; 3500 setTopSO(news, "|"); 3501 r = icReplaceSSmallJsonO(self, olds, news,1); 3502 ck_assert_ptr_ne(r, null); 3503 s = toStringO(r); 3504 ck_assert_str_eq(s, "AA|ee##ee#"); 3505 free(s); 3506 // NULL new delimiter, one time: same as empty delimiter 3507 setValO(self, "AA##ee##ee#"); 3508 olds = "##"; 3509 r = icReplaceSSmallJsonO(self, olds, NULL,1); 3510 ck_assert_ptr_ne(r, null); 3511 s = toStringO(r); 3512 ck_assert_str_eq(s, "AAee##ee#"); 3513 free(s); 3514 // non json string 3515 freeO(news); 3516 olds = "e"; 3517 setTopIntO(news, 1); 3518 r = icReplaceSSmallJsonO(self, olds, news,1); 3519 ck_assert_ptr_eq(r, null); 3520 // non json object 3521 terminateO(news); 3522 news = (smallJsont*) allocSmallInt(1); 3523 r = icReplaceSSmallJsonO(self, olds, news,1); 3524 ck_assert_ptr_eq(r, null); 3525 terminateO(news); 3526 news = allocSmallJson(); 3527 // empty string 3528 setValO(self, ""); 3529 olds = "##"; 3530 r = icReplaceSSmallJsonO(self, olds, NULL,1); 3531 ck_assert_ptr_ne(r, null); 3532 s = toStringO(r); 3533 ck_assert_str_eq(s, ""); 3534 free(s); 3535 // empty old delimiter 3536 setValO(self, "qwe"); 3537 freeO(news); 3538 olds = ""; 3539 setTopSO(news, "|"); 3540 ck_assert_ptr_eq(icReplaceSSmallJsonO(self, olds, news,1), NULL); 3541 // NULL old delimiter 3542 ck_assert_ptr_eq(icReplaceSSmallJsonO(self, NULL, news,1), NULL); 3543 // NULL string 3544 freeO(self); 3545 ck_assert_ptr_eq(icReplaceSSmallJsonO(self, olds, news,1), NULL); 3546 terminateO(news); 3547 terminateO(self); 3548 3549 END_TEST 3550 3551 3552 START_TEST(icReplaceSSmallStringSmallStringT) 3553 3554 smallStringt* r; 3555 smallStringt *self = allocG("beebeebad"); 3556 const char *olds; 3557 smallStringt *news = allocSmallString(""); 3558 3559 // replace string, multiple character new delimeter 3560 olds = "B"; 3561 setValO(news, "^^"); 3562 r = icReplaceSSmallStringO(self, olds, news, 0); 3563 ck_assert_ptr_ne(r, null); 3564 char *s = toStringO(r); 3565 ck_assert_str_eq(s, "^^ee^^ee^^ad"); 3566 free(s); 3567 // replace string, multiple character old delimeter 3568 setValO(self, "AA##ee##ee#"); 3569 olds = "##"; 3570 setValO(news, "|"); 3571 r = icReplaceSSmallStringO(self, olds, news, 0); 3572 ck_assert_ptr_ne(r, null); 3573 s = toStringO(r); 3574 ck_assert_str_eq(s, "AA|ee|ee#"); 3575 free(s); 3576 // replace one time at the start of string 3577 setValO(self, "#ee#ee#ad"); 3578 olds = "#"; 3579 setValO(news, "^^"); 3580 r = icReplaceSSmallStringO(self, olds, news,1); 3581 ck_assert_ptr_ne(r, null); 3582 s = toStringO(r); 3583 ck_assert_str_eq(s, "^^ee#ee#ad"); 3584 free(s); 3585 // replace one time 3586 setValO(self, "AA##ee##ee#"); 3587 olds = "##"; 3588 setValO(news, "|"); 3589 r = icReplaceSSmallStringO(self, olds, news,1); 3590 ck_assert_ptr_ne(r, null); 3591 s = toStringO(r); 3592 ck_assert_str_eq(s, "AA|ee##ee#"); 3593 free(s); 3594 // NULL new delimiter, one time: same as empty delimiter 3595 setValO(self, "AA##ee##ee#"); 3596 olds = "##"; 3597 r = icReplaceSSmallStringO(self, olds, NULL,1); 3598 ck_assert_ptr_ne(r, null); 3599 s = toStringO(r); 3600 ck_assert_str_eq(s, "AAee##ee#"); 3601 free(s); 3602 // non smallString object 3603 terminateO(news); 3604 news = (smallStringt*) allocSmallInt(1); 3605 r = icReplaceSSmallStringO(self, olds, news,1); 3606 ck_assert_ptr_eq(r, null); 3607 terminateO(news); 3608 news = allocSmallString(""); 3609 // empty string 3610 setValO(self, ""); 3611 olds = "##"; 3612 r = icReplaceSSmallStringO(self, olds, NULL,1); 3613 ck_assert_ptr_ne(r, null); 3614 s = toStringO(r); 3615 ck_assert_str_eq(s, ""); 3616 free(s); 3617 // empty old delimiter 3618 setValO(self, "qwe"); 3619 olds = ""; 3620 setValO(news, "|"); 3621 ck_assert_ptr_eq(icReplaceSSmallStringO(self, olds, news,1), NULL); 3622 // NULL old delimiter 3623 ck_assert_ptr_eq(icReplaceSSmallStringO(self, NULL, news,1), NULL); 3624 // NULL string 3625 freeO(self); 3626 ck_assert_ptr_eq(icReplaceSSmallStringO(self, olds, news,1), NULL); 3627 terminateO(news); 3628 terminateO(self); 3629 3630 END_TEST 3631 3632 3633 START_TEST(icReplaceCharSmallJsonSmallStringT) 3634 3635 smallStringt* r; 3636 smallStringt *self = allocG("beebeebad"); 3637 char olds; 3638 smallJsont *news = allocSmallJson(); 3639 3640 // replace string, multiple character new delimeter 3641 freeO(news); 3642 olds = 'B'; 3643 setTopSO(news, "^^"); 3644 r = icReplaceCharSmallJsonO(self, olds, news, 0); 3645 ck_assert_ptr_ne(r, null); 3646 char *s = toStringO(r); 3647 ck_assert_str_eq(s, "^^ee^^ee^^ad"); 3648 free(s); 3649 // replace string, multiple character old delimeter 3650 setValO(self, "AA#ee#ee"); 3651 freeO(news); 3652 olds = '#'; 3653 setTopSO(news, "|"); 3654 r = icReplaceCharSmallJsonO(self, olds, news, 0); 3655 ck_assert_ptr_ne(r, null); 3656 s = toStringO(r); 3657 ck_assert_str_eq(s, "AA|ee|ee"); 3658 free(s); 3659 // replace one time at the start of string 3660 setValO(self, "#ee#ee#ad"); 3661 freeO(news); 3662 olds = '#'; 3663 setTopSO(news, "^^"); 3664 r = icReplaceCharSmallJsonO(self, olds, news,1); 3665 ck_assert_ptr_ne(r, null); 3666 s = toStringO(r); 3667 ck_assert_str_eq(s, "^^ee#ee#ad"); 3668 free(s); 3669 // replace one time 3670 setValO(self, "AA#ee##ee#"); 3671 freeO(news); 3672 olds = '#'; 3673 setTopSO(news, "|"); 3674 r = icReplaceCharSmallJsonO(self, olds, news,1); 3675 ck_assert_ptr_ne(r, null); 3676 s = toStringO(r); 3677 ck_assert_str_eq(s, "AA|ee##ee#"); 3678 free(s); 3679 // NULL new delimiter, one time: same as empty delimiter 3680 setValO(self, "AA#ee##ee#"); 3681 olds = '#'; 3682 r = icReplaceCharSmallJsonO(self, olds, NULL,1); 3683 ck_assert_ptr_ne(r, null); 3684 s = toStringO(r); 3685 ck_assert_str_eq(s, "AAee##ee#"); 3686 free(s); 3687 // non json string 3688 freeO(news); 3689 olds = 'e'; 3690 setTopIntO(news, 1); 3691 r = icReplaceCharSmallJsonO(self, olds, news,1); 3692 ck_assert_ptr_eq(r, null); 3693 // non json object 3694 terminateO(news); 3695 news = (smallJsont*) allocSmallInt(1); 3696 r = icReplaceCharSmallJsonO(self, olds, news,1); 3697 ck_assert_ptr_eq(r, null); 3698 terminateO(news); 3699 news = allocSmallJson(); 3700 // empty string 3701 setValO(self, ""); 3702 olds = '#'; 3703 r = icReplaceCharSmallJsonO(self, olds, NULL,1); 3704 ck_assert_ptr_ne(r, null); 3705 s = toStringO(r); 3706 ck_assert_str_eq(s, ""); 3707 free(s); 3708 // NULL string 3709 freeO(self); 3710 freeO(news); 3711 setTopSO(news, "|"); 3712 ck_assert_ptr_eq(icReplaceCharSmallJsonO(self, olds, news,1), NULL); 3713 terminateO(news); 3714 terminateO(self); 3715 3716 END_TEST 3717 3718 3719 START_TEST(icReplaceCharSmallStringSmallStringT) 3720 3721 smallStringt* r; 3722 smallStringt *self = allocG("beebeebad"); 3723 char olds; 3724 smallStringt *news = allocSmallString(""); 3725 3726 // replace string, multiple character new delimeter 3727 olds = 'B'; 3728 setValO(news, "^^"); 3729 r = icReplaceCharSmallStringO(self, olds, news, 0); 3730 ck_assert_ptr_ne(r, null); 3731 char *s = toStringO(r); 3732 ck_assert_str_eq(s, "^^ee^^ee^^ad"); 3733 free(s); 3734 // replace string, multiple character old delimeter 3735 setValO(self, "AA#ee#ee"); 3736 olds = '#'; 3737 setValO(news, "|"); 3738 r = icReplaceCharSmallStringO(self, olds, news, 0); 3739 ck_assert_ptr_ne(r, null); 3740 s = toStringO(r); 3741 ck_assert_str_eq(s, "AA|ee|ee"); 3742 free(s); 3743 // replace one time at the start of string 3744 setValO(self, "#ee#ee#ad"); 3745 olds = '#'; 3746 setValO(news, "^^"); 3747 r = icReplaceCharSmallStringO(self, olds, news,1); 3748 ck_assert_ptr_ne(r, null); 3749 s = toStringO(r); 3750 ck_assert_str_eq(s, "^^ee#ee#ad"); 3751 free(s); 3752 // replace one time 3753 setValO(self, "AA#ee##ee#"); 3754 olds = '#'; 3755 setValO(news, "|"); 3756 r = icReplaceCharSmallStringO(self, olds, news,1); 3757 ck_assert_ptr_ne(r, null); 3758 s = toStringO(r); 3759 ck_assert_str_eq(s, "AA|ee##ee#"); 3760 free(s); 3761 // NULL new delimiter, one time: same as empty delimiter 3762 setValO(self, "AA#ee##ee#"); 3763 olds = '#'; 3764 r = icReplaceCharSmallStringO(self, olds, NULL,1); 3765 ck_assert_ptr_ne(r, null); 3766 s = toStringO(r); 3767 ck_assert_str_eq(s, "AAee##ee#"); 3768 free(s); 3769 // non smallString object 3770 terminateO(news); 3771 news = (smallStringt*) allocSmallInt(1); 3772 r = icReplaceCharSmallStringO(self, olds, news,1); 3773 ck_assert_ptr_eq(r, null); 3774 terminateO(news); 3775 news = allocSmallString(""); 3776 // empty string 3777 setValO(self, ""); 3778 olds = '#'; 3779 r = icReplaceCharSmallStringO(self, olds, NULL,1); 3780 ck_assert_ptr_ne(r, null); 3781 s = toStringO(r); 3782 ck_assert_str_eq(s, ""); 3783 free(s); 3784 // NULL string 3785 freeO(self); 3786 setValO(news, "|"); 3787 ck_assert_ptr_eq(icReplaceCharSmallStringO(self, olds, news,1), NULL); 3788 terminateO(news); 3789 terminateO(self); 3790 3791 END_TEST 3792 3793 3794 START_TEST(icReplaceManySmallStringT) 3795 3796 smallStringt* r; 3797 smallStringt *self = allocG(""); 3798 3799 // replace string, multiple character new delimeter 3800 setValO(self, "beebeebad"); 3801 r = icReplaceManyO(self, "B","^^","aD","AD"); 3802 ck_assert_ptr_ne(r, null); 3803 char *s = toStringO(r); 3804 ck_assert_str_eq(s, "^^ee^^ee^^AD"); 3805 free(s); 3806 // replace string, empty new delimeter 3807 setValO(self, "#ee#ee#ad"); 3808 r = icReplaceManyO(self, "#","","ad","AD"); 3809 ck_assert_ptr_ne(r, null); 3810 s = toStringO(r); 3811 ck_assert_str_eq(s, "eeeeAD"); 3812 free(s); 3813 // not enough olds:news pairs 3814 setValO(self, "#ee#ee#ad"); 3815 r = icReplaceManyO(self, "#","","ad"); 3816 ck_assert_ptr_ne(r, null); 3817 s = toStringO(r); 3818 ck_assert_str_eq(s, "eeeead"); 3819 free(s); 3820 // NULL new delimiter: same as only 2 parameters or not enough olds:news pairs 3821 setValO(self, "AA##ee##ee#"); 3822 r = icReplaceManyO(self, "##",NULL); 3823 ck_assert_ptr_eq(r, null); 3824 // empty string 3825 setValO(self, ""); 3826 r = icReplaceManyO(self, "##", ""); 3827 ck_assert_ptr_ne(r, null); 3828 s = toStringO(r); 3829 ck_assert_str_eq(s, ""); 3830 free(s); 3831 // empty string many pairs 3832 setValO(self, ""); 3833 r = icReplaceManyO(self, "##", "", "$$", ""); 3834 ck_assert_ptr_ne(r, null); 3835 s = toStringO(r); 3836 ck_assert_str_eq(s, ""); 3837 free(s); 3838 // empty string many pairs empty olds 3839 setValO(self, ""); 3840 r = icReplaceManyO(self, "##", "", "", ""); 3841 ck_assert_ptr_ne(r, null); 3842 s = toStringO(r); 3843 ck_assert_str_eq(s, ""); 3844 free(s); 3845 // empty string and NULL old delimiter 3846 setValO(self, ""); 3847 r = icReplaceManyO(self, NULL,"|"); 3848 ck_assert_ptr_ne(r, null); 3849 s = toStringO(r); 3850 ck_assert_str_eq(s, ""); 3851 free(s); 3852 // empty string and NULL old delimiter not first - same as replace empty string 3853 setValO(self, ""); 3854 r = icReplaceManyO(self,"##","|", NULL,"|"); 3855 ck_assert_ptr_ne(r, null); 3856 s = toStringO(r); 3857 ck_assert_str_eq(s, ""); 3858 free(s); 3859 // empty old delimiter 3860 setValO(self, "AA##ee##ee#"); 3861 ck_assert_ptr_eq(icReplaceManyO(self, "","|", "AA", "BB"), NULL); 3862 // empty old delimiter not first 3863 ck_assert_ptr_eq(icReplaceManyO(self, "##","|", "", "BB"), NULL); 3864 // NULL string 3865 freeO(self); 3866 ck_assert_ptr_eq(icReplaceManyO(self, "##","|"), NULL); 3867 terminateO(self); 3868 3869 END_TEST 3870 3871 3872 START_TEST(equalSmallStringT) 3873 3874 bool r; 3875 smallStringt *self = allocG(""); 3876 smallStringt *string = allocSmallString("qwe"); 3877 3878 r = equalO(self,string); 3879 ck_assert(!r); 3880 setValO(self, "qwe"); 3881 r = equalO(self,string); 3882 ck_assert(r); 3883 // empty strings 3884 freeO(string); 3885 r = equalO(self,string); 3886 ck_assert(!r); 3887 freeO(self); 3888 r = equalO(self,string); 3889 ck_assert(!r); 3890 // non smallString object 3891 setValO(self, "qwe"); 3892 terminateO(string); 3893 string = (smallStringt*) allocSmallInt(1); 3894 r = equalO(self,string); 3895 ck_assert(!r); 3896 terminateO(string); 3897 // null object 3898 r = equalO(self, null); 3899 ck_assert(!r); 3900 terminateO(self); 3901 3902 END_TEST 3903 3904 3905 START_TEST(equalSSmallStringT) 3906 3907 bool r; 3908 smallStringt *self = allocG(""); 3909 3910 r = equalSO(self,"qwe"); 3911 ck_assert(!r); 3912 setValO(self, "qwe"); 3913 r = equalSO(self,"qwe"); 3914 ck_assert(r); 3915 // empty strings 3916 freeO(self); 3917 r = equalSO(self, ""); 3918 ck_assert(!r); 3919 // null object 3920 setValO(self, "qwe"); 3921 r = equalSO(self, null); 3922 ck_assert(!r); 3923 terminateO(self); 3924 3925 END_TEST 3926 3927 3928 START_TEST(equalCharSmallStringT) 3929 3930 bool r; 3931 smallStringt *self = allocG(""); 3932 3933 r = equalCharO(self,'q'); 3934 ck_assert(!r); 3935 setValO(self, "q"); 3936 r = equalCharO(self,'q'); 3937 ck_assert(r); 3938 // empty strings 3939 freeO(self); 3940 r = equalCharO(self, ' '); 3941 ck_assert(!r); 3942 terminateO(self); 3943 3944 END_TEST 3945 3946 3947 START_TEST(equalSmallStringBaseT) 3948 3949 bool r; 3950 smallStringt *self = allocG("12"); 3951 baset* p2 = (baset*) allocSmallInt(12); 3952 3953 r = self->f->equalBase(self, p2); 3954 ck_assert(r); 3955 // empty self 3956 freeO(self); 3957 r = self->f->equalBase(self, p2); 3958 ck_assert(!r); 3959 // null object 3960 setValO(self, "qwe"); 3961 r = self->f->equalBase(self, null); 3962 ck_assert(!r); 3963 terminateO(p2); 3964 terminateO(self); 3965 3966 END_TEST 3967 3968 3969 START_TEST(equalSmallStringBoolT) 3970 3971 bool r; 3972 smallStringt* self = allocG("TRUE"); 3973 3974 r = self->f->equalBool(self, true); 3975 ck_assert(r); 3976 setValO(self, "true"); 3977 r = self->f->equalBool(self, true); 3978 ck_assert(r); 3979 setValO(self, "FALSE"); 3980 r = self->f->equalBool(self, false); 3981 ck_assert(r); 3982 setValO(self, "false"); 3983 r = self->f->equalBool(self, false); 3984 ck_assert(r); 3985 r = self->f->equalBool(self, true); 3986 ck_assert(!r); 3987 setValO(self, ""); 3988 r = self->f->equalBool(self, true); 3989 ck_assert(!r); 3990 // empty self 3991 freeO(self); 3992 r = self->f->equalBool(self, true); 3993 ck_assert(!r); 3994 terminateO(self); 3995 3996 END_TEST 3997 3998 3999 START_TEST(equalSmallStringDoubleT) 4000 4001 bool r; 4002 smallStringt* self = allocG("2.2"); 4003 4004 r = self->f->equalDouble(self, 2.2); 4005 ck_assert(r); 4006 r = self->f->equalDouble(self, 2.22); 4007 ck_assert(!r); 4008 // not a double 4009 setValO(self, "2"); 4010 r = self->f->equalDouble(self, 2); 4011 ck_assert(!r); 4012 setValO(self, "qwe"); 4013 r = self->f->equalDouble(self, 2); 4014 ck_assert(!r); 4015 // empty self 4016 freeO(self); 4017 r = self->f->equalDouble(self, 2); 4018 ck_assert(!r); 4019 terminateO(self); 4020 4021 END_TEST 4022 4023 4024 START_TEST(equalSmallStringInt64T) 4025 4026 bool r; 4027 smallStringt* self = allocG("2"); 4028 4029 r = self->f->equalInt64(self, 2); 4030 ck_assert(r); 4031 r = self->f->equalInt64(self, 3); 4032 ck_assert(!r); 4033 // not a double 4034 setValO(self, "2.2"); 4035 r = self->f->equalInt64(self, 2); 4036 ck_assert(!r); 4037 setValO(self, "qwe"); 4038 r = self->f->equalInt64(self, 2); 4039 ck_assert(!r); 4040 // empty self 4041 freeO(self); 4042 r = self->f->equalInt64(self, 2); 4043 ck_assert(!r); 4044 terminateO(self); 4045 4046 END_TEST 4047 4048 4049 START_TEST(equalSmallStringInt32T) 4050 4051 bool r; 4052 smallStringt* self = allocG("2"); 4053 4054 r = self->f->equalInt32(self, 2); 4055 ck_assert(r); 4056 r = self->f->equalInt32(self, 3); 4057 ck_assert(!r); 4058 // not a double 4059 setValO(self, "2.2"); 4060 r = self->f->equalInt32(self, 2); 4061 ck_assert(!r); 4062 setValO(self, "qwe"); 4063 r = self->f->equalInt32(self, 2); 4064 ck_assert(!r); 4065 // empty self 4066 freeO(self); 4067 r = self->f->equalInt32(self, 2); 4068 ck_assert(!r); 4069 terminateO(self); 4070 4071 END_TEST 4072 4073 4074 START_TEST(equalSmallStringUint32T) 4075 4076 bool r; 4077 smallStringt* self = allocG("2"); 4078 4079 r = self->f->equalUint32(self, 2); 4080 ck_assert(r); 4081 r = self->f->equalUint32(self, 3); 4082 ck_assert(!r); 4083 // not a double 4084 setValO(self, "2.2"); 4085 r = self->f->equalUint32(self, 2); 4086 ck_assert(!r); 4087 setValO(self, "qwe"); 4088 r = self->f->equalUint32(self, 2); 4089 ck_assert(!r); 4090 // empty self 4091 freeO(self); 4092 r = self->f->equalUint32(self, 2); 4093 ck_assert(!r); 4094 terminateO(self); 4095 4096 END_TEST 4097 4098 4099 START_TEST(equalSmallStringUint64T) 4100 4101 bool r; 4102 smallStringt* self = allocG("2"); 4103 4104 r = self->f->equalUint64(self, 2); 4105 ck_assert(r); 4106 r = self->f->equalUint64(self, 3); 4107 ck_assert(!r); 4108 // not a double 4109 setValO(self, "2.2"); 4110 r = self->f->equalUint64(self, 2); 4111 ck_assert(!r); 4112 setValO(self, "qwe"); 4113 r = self->f->equalUint64(self, 2); 4114 ck_assert(!r); 4115 // empty self 4116 freeO(self); 4117 r = self->f->equalUint64(self, 2); 4118 ck_assert(!r); 4119 terminateO(self); 4120 4121 END_TEST 4122 4123 4124 START_TEST(equalSmallStringSmallBoolT) 4125 4126 bool r; 4127 smallStringt* self = allocG("TRUE"); 4128 smallBoolt* p2 = allocSmallBool(true); 4129 4130 r = self->f->equalSmallBool(self, p2); 4131 ck_assert(r); 4132 setValO(self, "true"); 4133 r = self->f->equalSmallBool(self, p2); 4134 ck_assert(r); 4135 setValO(self, "FALSE"); 4136 setValO(p2, false); 4137 r = self->f->equalSmallBool(self, p2); 4138 ck_assert(r); 4139 setValO(self, "false"); 4140 r = self->f->equalSmallBool(self, p2); 4141 ck_assert(r); 4142 setValO(p2, true); 4143 r = self->f->equalSmallBool(self, p2); 4144 ck_assert(!r); 4145 // empty p2 4146 freeO(p2); 4147 r = self->f->equalSmallBool(self, p2); 4148 ck_assert(!r); 4149 setValO(p2, true); 4150 // empty string 4151 setValO(self, ""); 4152 r = self->f->equalSmallBool(self, p2); 4153 ck_assert(!r); 4154 // non smallBool object 4155 terminateO(p2); 4156 p2 = (smallBoolt*) allocSmallInt(2); 4157 r = self->f->equalSmallBool(self, p2); 4158 ck_assert(!r); 4159 terminateO(p2); 4160 p2 = allocSmallBool(true); 4161 // null p2 4162 r = self->f->equalSmallBool(self, null); 4163 ck_assert(!r); 4164 // empty self 4165 freeO(self); 4166 r = self->f->equalSmallBool(self, p2); 4167 ck_assert(!r); 4168 terminateO(p2); 4169 terminateO(self); 4170 4171 END_TEST 4172 4173 4174 START_TEST(equalSmallStringSmallBytesT) 4175 4176 bool r; 4177 smallStringt* self = allocG("qwe"); 4178 smallBytest* p2 = allocSmallBytes("qwe", sizeof("qwe")); 4179 4180 r = self->f->equalSmallBytes(self, p2); 4181 ck_assert(r); 4182 // different length 4183 setValO(self, "qw"); 4184 r = self->f->equalSmallBytes(self, p2); 4185 ck_assert(!r); 4186 // empty p2 4187 freeO(p2); 4188 r = self->f->equalSmallBytes(self, p2); 4189 ck_assert(!r); 4190 // non smallBytes object 4191 terminateO(p2); 4192 p2 = (smallBytest*) allocSmallInt(2); 4193 r = self->f->equalSmallBytes(self, p2); 4194 ck_assert(!r); 4195 // null p2 4196 r = self->f->equalSmallBytes(self, null); 4197 ck_assert(!r); 4198 // empty self 4199 freeO(self); 4200 r = self->f->equalSmallBytes(self, p2); 4201 ck_assert(!r); 4202 terminateO(p2); 4203 terminateO(self); 4204 4205 END_TEST 4206 4207 4208 START_TEST(equalSmallStringSmallDoubleT) 4209 4210 bool r; 4211 smallStringt* self = allocG("2.2"); 4212 smallDoublet* p2 = allocSmallDouble(2.2); 4213 4214 r = self->f->equalSmallDouble(self, p2); 4215 ck_assert(r); 4216 setValO(p2, 2.22); 4217 r = self->f->equalSmallDouble(self, p2); 4218 ck_assert(!r); 4219 // not a double 4220 setValO(self, "2"); 4221 r = self->f->equalSmallDouble(self, setValO(p2, 2)); 4222 ck_assert(!r); 4223 setValO(self, "qwe"); 4224 r = self->f->equalSmallDouble(self, p2); 4225 ck_assert(!r); 4226 // empty p2 4227 freeO(p2); 4228 r = self->f->equalSmallDouble(self, p2); 4229 ck_assert(!r); 4230 // non smallDouble object 4231 terminateO(p2); 4232 p2 = (smallDoublet*) allocSmallInt(2); 4233 r = self->f->equalSmallDouble(self, p2); 4234 ck_assert(!r); 4235 // null p2 4236 r = self->f->equalSmallDouble(self, null); 4237 ck_assert(!r); 4238 // empty self 4239 freeO(self); 4240 r = self->f->equalSmallDouble(self, p2); 4241 ck_assert(!r); 4242 terminateO(p2); 4243 terminateO(self); 4244 4245 END_TEST 4246 4247 4248 START_TEST(equalSmallStringSmallIntT) 4249 4250 bool r; 4251 smallStringt* self = allocG("2"); 4252 smallIntt* p2 = allocSmallInt(2); 4253 4254 r = self->f->equalSmallInt(self, p2); 4255 ck_assert(r); 4256 setValO(p2, 3); 4257 r = self->f->equalSmallInt(self, p2); 4258 ck_assert(!r); 4259 // not an int 4260 setValO(self, "2.2"); 4261 r = self->f->equalSmallInt(self, setValO(p2, 2)); 4262 ck_assert(!r); 4263 setValO(self, "qwe"); 4264 r = self->f->equalSmallInt(self, p2); 4265 ck_assert(!r); 4266 // empty p2 4267 freeO(p2); 4268 r = self->f->equalSmallInt(self, p2); 4269 ck_assert(!r); 4270 // non smallDouble object 4271 terminateO(p2); 4272 p2 = (smallIntt*) allocSmallDouble(2); 4273 r = self->f->equalSmallInt(self, p2); 4274 ck_assert(!r); 4275 // null p2 4276 r = self->f->equalSmallInt(self, null); 4277 ck_assert(!r); 4278 // empty self 4279 freeO(self); 4280 r = self->f->equalSmallInt(self, p2); 4281 ck_assert(!r); 4282 terminateO(p2); 4283 terminateO(self); 4284 4285 END_TEST 4286 4287 4288 START_TEST(equalSmallStringSmallJsonT) 4289 4290 bool r; 4291 smallStringt* self = allocG("qwe"); 4292 smallJsont* p2 = allocSmallJson(); 4293 4294 setTopSO(p2, "qwe"); 4295 r = self->f->equalSmallJson(self, p2); 4296 ck_assert(r); 4297 // non json object 4298 terminateO(p2); 4299 p2 = (smallJsont*) allocSmallInt(2); 4300 r = self->f->equalSmallJson(self, p2); 4301 ck_assert(!r); 4302 // null p2 4303 r = self->f->equalSmallJson(self, null); 4304 ck_assert(!r); 4305 terminateO(p2); 4306 terminateO(self); 4307 4308 END_TEST 4309 4310 4311 START_TEST(icEqualSmallStringT) 4312 4313 bool r; 4314 smallStringt *self = allocG(""); 4315 smallStringt *string = allocSmallString("Qwe"); 4316 4317 r = icEqualO(self,string); 4318 ck_assert(!r); 4319 setValO(self, "qwe"); 4320 r = icEqualO(self,string); 4321 ck_assert(r); 4322 // empty strings 4323 freeO(string); 4324 r = icEqualO(self,string); 4325 ck_assert(!r); 4326 freeO(self); 4327 r = icEqualO(self,string); 4328 ck_assert(!r); 4329 // non smallString object 4330 setValO(self, "qwe"); 4331 terminateO(string); 4332 string = (smallStringt*) allocSmallInt(1); 4333 r = icEqualO(self,string); 4334 ck_assert(!r); 4335 terminateO(string); 4336 // null object 4337 r = icEqualO(self, null); 4338 ck_assert(!r); 4339 terminateO(self); 4340 4341 END_TEST 4342 4343 4344 START_TEST(icEqualSSmallStringT) 4345 4346 bool r; 4347 smallStringt *self = allocG(""); 4348 4349 r = icEqualSO(self,"qwe"); 4350 ck_assert(!r); 4351 setValO(self, "qwe"); 4352 r = icEqualSO(self, "Qwe"); 4353 ck_assert(r); 4354 // empty strings 4355 freeO(self); 4356 r = icEqualSO(self, ""); 4357 ck_assert(!r); 4358 // null object 4359 setValO(self, "qwe"); 4360 r = icEqualSO(self, null); 4361 ck_assert(!r); 4362 terminateO(self); 4363 4364 END_TEST 4365 4366 4367 START_TEST(icEqualCharSmallStringT) 4368 4369 bool r; 4370 smallStringt *self = allocG(""); 4371 4372 r = icEqualCharO(self,'q'); 4373 ck_assert(!r); 4374 setValO(self, "q"); 4375 r = icEqualCharO(self,'Q'); 4376 ck_assert(r); 4377 // empty strings 4378 freeO(self); 4379 r = icEqualCharO(self, ' '); 4380 ck_assert(!r); 4381 terminateO(self); 4382 4383 END_TEST 4384 4385 4386 START_TEST(icEqualSmallStringBaseT) 4387 4388 bool r; 4389 smallStringt* self = allocG("qwe"); 4390 baset* p2 = (baset*) allocSmallString("QWE"); 4391 4392 r = self->f->icEqualBase(self, p2); 4393 ck_assert(r); 4394 // empty self 4395 freeO(self); 4396 r = self->f->icEqualBase(self, p2); 4397 ck_assert(!r); 4398 // null object 4399 setValO(self, "qwe"); 4400 r = self->f->icEqualBase(self, null); 4401 ck_assert(!r); 4402 terminateO(p2); 4403 terminateO(self); 4404 4405 END_TEST 4406 4407 4408 START_TEST(icEqualSmallStringSmallJsonT) 4409 4410 bool r; 4411 smallStringt* self = allocG("qwe"); 4412 smallJsont* p2 = allocSmallJson(); 4413 4414 setTopSO(p2, "Qwe"); 4415 r = self->f->icEqualSmallJson(self, p2); 4416 ck_assert(r); 4417 // non json object 4418 terminateO(p2); 4419 p2 = (smallJsont*) allocSmallInt(2); 4420 r = self->f->icEqualSmallJson(self, p2); 4421 ck_assert(!r); 4422 // null p2 4423 r = self->f->icEqualSmallJson(self, null); 4424 ck_assert(!r); 4425 terminateO(p2); 4426 terminateO(self); 4427 4428 END_TEST 4429 4430 4431 START_TEST(equalISSmallStringT) 4432 4433 smallStringt *self = allocG("Ashee|"); 4434 4435 // identical strings 4436 ck_assert(equalISO(self, "shee", 1)); 4437 setValO(self, "Ashee"); 4438 ck_assert(equalISO(self, "shee", -4)); 4439 // string at index shorter than string2 4440 ck_assert(!equalISO(self, "shee", 2)); 4441 // empty string 4442 setValO(self, ""); 4443 ck_assert(!equalISO(self, "shee", 0)); 4444 ck_assert(equalISO(self, "", 0)); 4445 setValO(self, "Ashee"); 4446 ck_assert(!equalISO(self, "", 0)); 4447 // index mismatch 4448 ck_assert(!equalISO(self, "shee", 0)); 4449 // index outside 4450 ck_assert(!equalISO(self, "shee", 10)); 4451 ck_assert(!equalISO(self, "shee", -10)); 4452 // different strings 4453 ck_assert(!equalISO(self, "SH",0)); 4454 // empty self 4455 freeO(self); 4456 ck_assert(!equalISO(self, "SH",0)); 4457 // NULL string 4458 setValO(self, "Ashee"); 4459 ck_assert(!equalISO(self, NULL, 0)); 4460 terminateO(self); 4461 4462 END_TEST 4463 4464 4465 START_TEST(equalICharSmallStringT) 4466 4467 smallStringt *self = allocG("Ashee"); 4468 4469 // identical strings 4470 ck_assert(equalICharO(self, 's', 1)); 4471 ck_assert(equalICharO(self, 's', -4)); 4472 ck_assert(!equalICharO(self, 's', 2)); 4473 // empty string 4474 setValO(self, ""); 4475 ck_assert(!equalICharO(self, 's', 0)); 4476 ck_assert(equalICharO(self, 0, 0)); 4477 setValO(self, "Ashee"); 4478 ck_assert(!equalICharO(self, 0, 0)); 4479 // index mismatch 4480 ck_assert(!equalICharO(self, 's', 0)); 4481 // index outside 4482 ck_assert(!equalICharO(self, 's', 10)); 4483 ck_assert(!equalICharO(self, 's', -10)); 4484 // different strings 4485 setValO(self, "shee"); 4486 ck_assert(!equalICharO(self, 'S',0)); 4487 // NULL string 4488 ck_assert(!equalICharO(self, 0, 0)); 4489 // empty self 4490 freeO(self); 4491 ck_assert(!equalICharO(self, 'S',0)); 4492 terminateO(self); 4493 4494 END_TEST 4495 4496 4497 START_TEST(equalISmallJsonSmallStringT) 4498 4499 smallStringt *self = allocG("Ashee|"); 4500 smallJsont *string = allocSmallJson(); 4501 4502 // identical strings 4503 setTopSO(string, "shee"); 4504 ck_assert(equalISmallJsonO(self, string, 1)); 4505 setValO(self, "Ashee"); 4506 ck_assert(equalISmallJsonO(self, string, -4)); 4507 // string at index shorter than string2 4508 ck_assert(!equalISmallJsonO(self, string, 2)); 4509 // empty string 4510 setValO(self, ""); 4511 ck_assert(!equalISmallJsonO(self, string, 0)); 4512 freeO(string); 4513 setTopSO(string, ""); 4514 ck_assert(equalISmallJsonO(self, string, 0)); 4515 setValO(self, "Ashee"); 4516 ck_assert(!equalISmallJsonO(self, string, 0)); 4517 // index mismatch 4518 freeO(string); 4519 setTopSO(string, "shee"); 4520 ck_assert(!equalISmallJsonO(self, string, 0)); 4521 // index outside 4522 ck_assert(!equalISmallJsonO(self, string, 10)); 4523 ck_assert(!equalISmallJsonO(self, string, -10)); 4524 // different strings 4525 freeO(string); 4526 setTopSO(string, "SH"); 4527 ck_assert(!equalISmallJsonO(self, string,0)); 4528 // non json string 4529 freeO(string); 4530 setTopIntO(string, 1); 4531 ck_assert(!equalISmallJsonO(self, string,0)); 4532 // non json object 4533 terminateO(string); 4534 string = (smallJsont*) allocSmallInt(2); 4535 ck_assert(!equalISmallJsonO(self, string,0)); 4536 // empty self 4537 terminateO(string); 4538 string = allocSmallJson(); 4539 setTopSO(string, "SH"); 4540 freeO(self); 4541 ck_assert(!equalISmallJsonO(self, string,0)); 4542 // NULL string 4543 setValO(self, "Ashee"); 4544 ck_assert(!equalISmallJsonO(self, NULL, 0)); 4545 terminateO(string); 4546 terminateO(self); 4547 4548 END_TEST 4549 4550 4551 START_TEST(equalISmallStringSmallStringT) 4552 4553 smallStringt *self = allocG("Ashee|"); 4554 smallStringt *string = allocSmallString("shee"); 4555 4556 // identical strings 4557 ck_assert(equalISmallStringO(self, string, 1)); 4558 setValO(self, "Ashee"); 4559 ck_assert(equalISmallStringO(self, string, -4)); 4560 // string at index shorter than string2 4561 ck_assert(!equalISmallStringO(self, string, 2)); 4562 // empty string 4563 setValO(self, ""); 4564 ck_assert(!equalISmallStringO(self, string, 0)); 4565 setValO(string, ""); 4566 ck_assert(equalISmallStringO(self, string, 0)); 4567 setValO(self, "Ashee"); 4568 ck_assert(!equalISmallStringO(self, string, 0)); 4569 // index mismatch 4570 freeO(string); 4571 setValO(string, "shee"); 4572 ck_assert(!equalISmallStringO(self, string, 0)); 4573 // index outside 4574 ck_assert(!equalISmallStringO(self, string, 10)); 4575 ck_assert(!equalISmallStringO(self, string, -10)); 4576 // different strings 4577 setValO(string, "SH"); 4578 ck_assert(!equalISmallStringO(self, string,0)); 4579 // non smallString object 4580 terminateO(string); 4581 string = (smallStringt*) allocSmallInt(2); 4582 ck_assert(!equalISmallStringO(self, string,0)); 4583 // empty self 4584 terminateO(string); 4585 string = allocSmallString("SH"); 4586 freeO(self); 4587 ck_assert(!equalISmallStringO(self, string,0)); 4588 // NULL string 4589 setValO(self, "Ashee"); 4590 ck_assert(!equalISmallStringO(self, NULL, 0)); 4591 terminateO(string); 4592 terminateO(self); 4593 4594 END_TEST 4595 4596 4597 START_TEST(startsWithSSmallStringT) 4598 4599 smallStringt *self = allocG("shee"); 4600 4601 // identical strings 4602 ck_assert(startsWithSO(self, "shee")); 4603 setValO(self, "sheepy"); 4604 ck_assert(startsWithSO(self, "shee")); 4605 // different strings 4606 setValO(self, "shee"); 4607 ck_assert(!startsWithSO(self, "SH")); 4608 ck_assert(!startsWithSO(self, "sheep")); 4609 setValO(self, "-shee"); 4610 ck_assert(!startsWithSO(self, "shee")); 4611 // NULL string 4612 ck_assert(!startsWithSO(self, NULL)); 4613 // empty self 4614 freeO(self); 4615 ck_assert(!startsWithSO(self, "shee")); 4616 terminateO(self); 4617 4618 END_TEST 4619 4620 4621 START_TEST(startsWithCharSmallStringT) 4622 4623 smallStringt *self = allocG("shee"); 4624 4625 // identical strings 4626 ck_assert(startsWithCharO(self, 's')); 4627 setValO(self, "sheepy"); 4628 ck_assert(startsWithCharO(self, 's')); 4629 setValO(self, ""); 4630 ck_assert(startsWithCharO(self, 0)); 4631 // different strings 4632 setValO(self, "shee"); 4633 ck_assert(!startsWithCharO(self, 'S')); 4634 setValO(self, "-shee"); 4635 ck_assert(!startsWithCharO(self, 's')); 4636 setValO(self, ""); 4637 ck_assert(!startsWithCharO(self, '0')); 4638 // NULL string 4639 setValO(self, "shee"); 4640 ck_assert(!startsWithCharO(self, 0)); 4641 // empty self 4642 freeO(self); 4643 ck_assert(!startsWithCharO(self, '0')); 4644 terminateO(self); 4645 4646 END_TEST 4647 4648 4649 START_TEST(startsWithSmallJsonSmallStringT) 4650 4651 smallStringt *self = allocG("shee"); 4652 smallJsont *string = allocSmallJson(); 4653 4654 // identical strings 4655 setTopSO(string, "shee"); 4656 ck_assert(startsWithSmallJsonO(self, string)); 4657 setValO(self, "sheepy"); 4658 ck_assert(startsWithSmallJsonO(self, string)); 4659 // different strings 4660 setValO(self, "shee"); 4661 freeO(string); 4662 setTopSO(string, "SH"); 4663 ck_assert(!startsWithSmallJsonO(self, string)); 4664 freeO(string); 4665 setTopSO(string, "sheep"); 4666 ck_assert(!startsWithSmallJsonO(self, string)); 4667 setValO(self, "-shee"); 4668 freeO(string); 4669 setTopSO(string, "shee"); 4670 ck_assert(!startsWithSmallJsonO(self, string)); 4671 // non json string 4672 freeO(string); 4673 setTopIntO(string, 1); 4674 ck_assert(!startsWithSmallJsonO(self, string)); 4675 // non json object 4676 terminateO(string); 4677 string = (smallJsont*) allocSmallInt(1); 4678 ck_assert(!startsWithSmallJsonO(self, string)); 4679 terminateO(string); 4680 string = allocSmallJson(); 4681 // NULL string 4682 ck_assert(!startsWithSmallJsonO(self, NULL)); 4683 // empty self 4684 freeO(self); 4685 setTopSO(string, "shee"); 4686 ck_assert(!startsWithSmallJsonO(self, string)); 4687 terminateO(string); 4688 terminateO(self); 4689 4690 END_TEST 4691 4692 4693 START_TEST(startsWithSmallStringSmallStringT) 4694 4695 smallStringt *self = allocG("shee"); 4696 smallStringt *string = allocSmallString("shee"); 4697 4698 // identical strings 4699 ck_assert(startsWithSmallStringO(self, string)); 4700 setValO(self, "sheepy"); 4701 ck_assert(startsWithSmallStringO(self, string)); 4702 // different strings 4703 setValO(self, "shee"); 4704 setValO(string, "SH"); 4705 ck_assert(!startsWithSmallStringO(self, string)); 4706 setValO(string, "sheep"); 4707 ck_assert(!startsWithSmallStringO(self, string)); 4708 setValO(self, "-shee"); 4709 setValO(string, "shee"); 4710 ck_assert(!startsWithSmallStringO(self, string)); 4711 // non smallString object 4712 terminateO(string); 4713 string = (smallStringt*) allocSmallInt(1); 4714 ck_assert(!startsWithSmallStringO(self, string)); 4715 terminateO(string); 4716 string = allocSmallString("shee"); 4717 // NULL string 4718 ck_assert(!startsWithSmallStringO(self, NULL)); 4719 // empty self 4720 freeO(self); 4721 ck_assert(!startsWithSmallStringO(self, string)); 4722 terminateO(string); 4723 terminateO(self); 4724 4725 END_TEST 4726 4727 4728 START_TEST(endsWithSSmallStringT) 4729 4730 smallStringt *self = allocG("shee"); 4731 4732 // identical strings 4733 ck_assert(endsWithSO(self, "shee")); 4734 setValO(self, "sheepy"); 4735 ck_assert(endsWithSO(self, "eepy")); 4736 // different strings 4737 setValO(self, "shee"); 4738 ck_assert(!endsWithSO(self, "SH")); 4739 ck_assert(!endsWithSO(self, "sheep")); 4740 setValO(self, "shee-"); 4741 ck_assert(!endsWithSO(self, "shee")); 4742 // NULL string 4743 ck_assert(!endsWithSO(self, NULL)); 4744 // empty self 4745 freeO(self); 4746 ck_assert(!endsWithSO(self, "shee")); 4747 terminateO(self); 4748 4749 END_TEST 4750 4751 4752 START_TEST(endsWithCharSmallStringT) 4753 4754 smallStringt *self = allocG("shee"); 4755 4756 // identical strings 4757 ck_assert(endsWithCharO(self, 'e')); 4758 setValO(self, "sheepy"); 4759 ck_assert(endsWithCharO(self, 'y')); 4760 setValO(self, ""); 4761 ck_assert(endsWithCharO(self, 0)); 4762 // different strings 4763 setValO(self, "shee"); 4764 ck_assert(!endsWithCharO(self, 'E')); 4765 ck_assert(!endsWithCharO(self, 'p')); 4766 setValO(self, "shee-"); 4767 ck_assert(!endsWithCharO(self, 'e')); 4768 setValO(self, ""); 4769 ck_assert(!endsWithCharO(self, '0')); 4770 // NULL string 4771 setValO(self, "a"); 4772 ck_assert(!endsWithCharO(self, 0)); 4773 // empty self 4774 freeO(self); 4775 ck_assert(!endsWithCharO(self, '0')); 4776 terminateO(self); 4777 4778 END_TEST 4779 4780 4781 START_TEST(endsWithSmallJsonSmallStringT) 4782 4783 smallStringt *self = allocG("shee"); 4784 smallJsont *string = allocSmallJson(); 4785 4786 // identical strings 4787 setTopSO(string, "shee"); 4788 ck_assert(endsWithSmallJsonO(self, string)); 4789 setValO(self, "sheepy"); 4790 freeO(string); 4791 setTopSO(string, "eepy"); 4792 ck_assert(endsWithSmallJsonO(self, string)); 4793 // different strings 4794 setValO(self, "shee"); 4795 freeO(string); 4796 setTopSO(string, "SH"); 4797 ck_assert(!endsWithSmallJsonO(self, string)); 4798 freeO(string); 4799 setTopSO(string, "sheep"); 4800 ck_assert(!endsWithSmallJsonO(self, string)); 4801 setValO(self, "shee-"); 4802 freeO(string); 4803 setTopSO(string, "shee"); 4804 ck_assert(!endsWithSmallJsonO(self, string)); 4805 // non json string 4806 freeO(string); 4807 setTopIntO(string, 1); 4808 ck_assert(!endsWithSmallJsonO(self, string)); 4809 // non json object 4810 terminateO(string); 4811 string = (smallJsont*) allocSmallInt(1); 4812 ck_assert(!endsWithSmallJsonO(self, string)); 4813 terminateO(string); 4814 string = allocSmallJson(); 4815 setTopSO(string, "shee"); 4816 // NULL string 4817 ck_assert(!endsWithSmallJsonO(self, NULL)); 4818 // empty self 4819 freeO(self); 4820 ck_assert(!endsWithSmallJsonO(self, string)); 4821 terminateO(string); 4822 terminateO(self); 4823 4824 END_TEST 4825 4826 4827 START_TEST(endsWithSmallStringSmallStringT) 4828 4829 smallStringt *self = allocG("shee"); 4830 smallStringt *string = allocSmallString("shee"); 4831 4832 // identical strings 4833 ck_assert(endsWithSmallStringO(self, string)); 4834 setValO(self, "sheepy"); 4835 setValO(string, "eepy"); 4836 ck_assert(endsWithSmallStringO(self, string)); 4837 // different strings 4838 setValO(self, "shee"); 4839 ck_assert(!endsWithSmallStringO(self, string)); 4840 setValO(string, "sheep"); 4841 ck_assert(!endsWithSmallStringO(self, string)); 4842 setValO(self, "shee-"); 4843 setValO(string, "shee"); 4844 ck_assert(!endsWithSmallStringO(self, string)); 4845 // non smallString object 4846 terminateO(string); 4847 string = (smallStringt*) allocSmallInt(1); 4848 ck_assert(!endsWithSmallStringO(self, string)); 4849 terminateO(string); 4850 string = allocSmallString("shee"); 4851 // NULL string 4852 ck_assert(!endsWithSmallStringO(self, NULL)); 4853 // empty self 4854 freeO(self); 4855 ck_assert(!endsWithSmallStringO(self, string)); 4856 terminateO(string); 4857 terminateO(self); 4858 4859 END_TEST 4860 4861 4862 START_TEST(countSSmallStringT) 4863 4864 smallStringt *self = allocG("sheepy"); 4865 4866 // positive count 4867 ck_assert_int_eq(countSO(self, "shee"), 1); 4868 setValO(self, "aaa aaa"); 4869 ck_assert_int_eq(countSO(self, "a"), 6); 4870 ck_assert_int_eq(countSO(self, "aa"), 2); 4871 // 0 count 4872 setValO(self, "shee"); 4873 ck_assert_int_eq(countSO(self, "SH"), 0); 4874 ck_assert_int_eq(countSO(self, "sheepy"), 0); 4875 setValO(self, "aaa aaa"); 4876 ck_assert_int_eq(countSO(self, "ab"), 0); 4877 // empty string 4878 ck_assert_int_eq(countSO(self, ""), -1); 4879 // NULL string 4880 ck_assert_int_eq(countSO(self, NULL), -1); 4881 // empty self 4882 freeO(self); 4883 ck_assert_int_eq(countSO(self, "ab"), -1); 4884 terminateO(self); 4885 4886 END_TEST 4887 4888 4889 START_TEST(countCharSmallStringT) 4890 4891 smallStringt *self = allocG("shee"); 4892 4893 // positive count 4894 ck_assert_int_eq(countCharO(self, 's'), 1); 4895 setValO(self, "aaa aaa"); 4896 ck_assert_int_eq(countCharO(self, 'a'), 6); 4897 // 0 count 4898 setValO(self, "shee"); 4899 ck_assert_int_eq(countCharO(self, 'S'), 0); 4900 ck_assert_int_eq(countCharO(self, 'y'), 0); 4901 setValO(self, "aaa aaa"); 4902 ck_assert_int_eq(countCharO(self, 'b'), 0); 4903 // empty string 4904 setValO(self, ""); 4905 ck_assert_int_eq(countCharO(self, 'a'), 0); 4906 ck_assert_int_eq(countCharO(self, 0), -1); 4907 // NULL string 4908 setValO(self, "a"); 4909 ck_assert_int_eq(countCharO(self, 0), -1); 4910 // empty self 4911 freeO(self); 4912 ck_assert_int_eq(countCharO(self, 'a'), -1); 4913 terminateO(self); 4914 4915 END_TEST 4916 4917 4918 START_TEST(countSmallJsonSmallStringT) 4919 4920 smallStringt *self = allocG("sheepy"); 4921 smallJsont *string = allocSmallJson(); 4922 4923 // positive count 4924 setTopSO(string, "shee"); 4925 ck_assert_int_eq(countSmallJsonO(self, string), 1); 4926 setValO(self, "aaa aaa"); 4927 freeO(string); 4928 setTopSO(string, "a"); 4929 ck_assert_int_eq(countSmallJsonO(self, string), 6); 4930 freeO(string); 4931 setTopSO(string, "aa"); 4932 ck_assert_int_eq(countSmallJsonO(self, string), 2); 4933 // 0 count 4934 setValO(self, "shee"); 4935 freeO(string); 4936 setTopSO(string, "SH"); 4937 ck_assert_int_eq(countSmallJsonO(self, string), 0); 4938 freeO(string); 4939 setTopSO(string, "sheepy"); 4940 ck_assert_int_eq(countSmallJsonO(self, string), 0); 4941 setValO(self, "aaa aaa"); 4942 freeO(string); 4943 setTopSO(string, "ab"); 4944 ck_assert_int_eq(countSmallJsonO(self, string), 0); 4945 // non json string 4946 freeO(string); 4947 setTopIntO(string, -1); 4948 ck_assert_int_eq(countSmallJsonO(self, string), -1); 4949 // non json object 4950 terminateO(string); 4951 string = (smallJsont*) allocSmallInt(1); 4952 ck_assert_int_eq(countSmallJsonO(self, string), -1); 4953 terminateO(string); 4954 string = allocSmallJson(); 4955 // empty string 4956 setTopSO(string, ""); 4957 ck_assert_int_eq(countSmallJsonO(self, string), -1); 4958 // NULL string 4959 ck_assert_int_eq(countSmallJsonO(self, NULL), -1); 4960 // empty self 4961 freeO(self); 4962 freeO(string); 4963 setTopSO(string, "ab"); 4964 ck_assert_int_eq(countSmallJsonO(self, string), -1); 4965 terminateO(string); 4966 terminateO(self); 4967 4968 END_TEST 4969 4970 4971 START_TEST(countSmallStringSmallStringT) 4972 4973 smallStringt *self = allocG("sheepy"); 4974 smallStringt *string = allocSmallString("shee"); 4975 4976 // positive count 4977 ck_assert_int_eq(countSmallStringO(self, string), 1); 4978 setValO(self, "aaa aaa"); 4979 setValO(string, "a"); 4980 ck_assert_int_eq(countSmallStringO(self, string), 6); 4981 setValO(string, "aa"); 4982 ck_assert_int_eq(countSmallStringO(self, string), 2); 4983 // 0 count 4984 setValO(self, "shee"); 4985 setValO(string, "SH"); 4986 ck_assert_int_eq(countSmallStringO(self, string), 0); 4987 setValO(string, "sheepy"); 4988 ck_assert_int_eq(countSmallStringO(self, string), 0); 4989 setValO(self, "aaa aaa"); 4990 setValO(string, "ab"); 4991 ck_assert_int_eq(countSmallStringO(self, string), 0); 4992 // non json object 4993 terminateO(string); 4994 string = (smallStringt*) allocSmallInt(1); 4995 ck_assert_int_eq(countSmallStringO(self, string), -1); 4996 terminateO(string); 4997 string = allocSmallString(""); 4998 // empty string 4999 ck_assert_int_eq(countSmallStringO(self, string), -1); 5000 freeO(string); 5001 ck_assert_int_eq(countSmallStringO(self, string), -1); 5002 // NULL string 5003 ck_assert_int_eq(countSmallStringO(self, NULL), -1); 5004 // empty self 5005 freeO(self); 5006 setValO(string, "ab"); 5007 ck_assert_int_eq(countSmallStringO(self, string), -1); 5008 terminateO(string); 5009 terminateO(self); 5010 5011 END_TEST 5012 5013 5014 START_TEST(icStartsWithSSmallStringT) 5015 5016 smallStringt *self = allocG("shee"); 5017 5018 // identical strings 5019 ck_assert(icStartsWithSO(self, "shee")); 5020 setValO(self, "sheepy"); 5021 ck_assert(icStartsWithSO(self, "shee")); 5022 // different strings 5023 setValO(self, "shee"); 5024 ck_assert(icStartsWithSO(self, "SH")); 5025 ck_assert(!icStartsWithSO(self, "sheep")); 5026 setValO(self, "-shee"); 5027 ck_assert(!icStartsWithSO(self, "shee")); 5028 // NULL string 5029 ck_assert(!icStartsWithSO(self, NULL)); 5030 // empty self 5031 freeO(self); 5032 ck_assert(!icStartsWithSO(self, "shee")); 5033 terminateO(self); 5034 5035 END_TEST 5036 5037 5038 START_TEST(icStartsWithCharSmallStringT) 5039 5040 smallStringt *self = allocG("shee"); 5041 5042 // identical strings 5043 ck_assert(icStartsWithCharO(self, 's')); 5044 setValO(self, "sheepy"); 5045 ck_assert(icStartsWithCharO(self, 's')); 5046 setValO(self, ""); 5047 ck_assert(icStartsWithCharO(self, 0)); 5048 // different strings 5049 setValO(self, "shee"); 5050 ck_assert(icStartsWithCharO(self, 'S')); 5051 setValO(self, "-shee"); 5052 ck_assert(!icStartsWithCharO(self, 's')); 5053 setValO(self, ""); 5054 ck_assert(!icStartsWithCharO(self, '0')); 5055 // NULL string 5056 setValO(self, "shee"); 5057 ck_assert(!icStartsWithCharO(self, 0)); 5058 // empty self 5059 freeO(self); 5060 ck_assert(!icStartsWithCharO(self, '0')); 5061 terminateO(self); 5062 5063 END_TEST 5064 5065 5066 START_TEST(icStartsWithSmallJsonSmallStringT) 5067 5068 smallStringt *self = allocG("shee"); 5069 smallJsont *string = allocSmallJson(); 5070 5071 // identical strings 5072 setTopSO(string, "shee"); 5073 ck_assert(icStartsWithSmallJsonO(self, string)); 5074 setValO(self, "sheepy"); 5075 ck_assert(icStartsWithSmallJsonO(self, string)); 5076 // different strings 5077 setValO(self, "shee"); 5078 freeO(string); 5079 setTopSO(string, "SH"); 5080 ck_assert(icStartsWithSmallJsonO(self, string)); 5081 freeO(string); 5082 setTopSO(string, "sheep"); 5083 ck_assert(!icStartsWithSmallJsonO(self, string)); 5084 setValO(self, "-shee"); 5085 freeO(string); 5086 setTopSO(string, "shee"); 5087 ck_assert(!icStartsWithSmallJsonO(self, string)); 5088 // non json string 5089 freeO(string); 5090 setTopIntO(string, 1); 5091 ck_assert(!icStartsWithSmallJsonO(self, string)); 5092 // non json object 5093 terminateO(string); 5094 string = (smallJsont*) allocSmallInt(1); 5095 ck_assert(!icStartsWithSmallJsonO(self, string)); 5096 terminateO(string); 5097 string = allocSmallJson(); 5098 // NULL string 5099 ck_assert(!icStartsWithSmallJsonO(self, NULL)); 5100 // empty self 5101 freeO(self); 5102 setTopSO(string, "shee"); 5103 ck_assert(!icStartsWithSmallJsonO(self, string)); 5104 terminateO(string); 5105 terminateO(self); 5106 5107 END_TEST 5108 5109 5110 START_TEST(icStartsWithSmallStringSmallStringT) 5111 5112 smallStringt *self = allocG("shee"); 5113 smallStringt *string = allocSmallString("shee"); 5114 5115 // identical strings 5116 ck_assert(icStartsWithSmallStringO(self, string)); 5117 setValO(self, "sheepy"); 5118 ck_assert(icStartsWithSmallStringO(self, string)); 5119 // different strings 5120 setValO(self, "shee"); 5121 setValO(string, "SH"); 5122 ck_assert(icStartsWithSmallStringO(self, string)); 5123 setValO(string, "sheep"); 5124 ck_assert(!icStartsWithSmallStringO(self, string)); 5125 setValO(self, "-shee"); 5126 setValO(string, "shee"); 5127 ck_assert(!icStartsWithSmallStringO(self, string)); 5128 // non smallString object 5129 terminateO(string); 5130 string = (smallStringt*) allocSmallInt(1); 5131 ck_assert(!icStartsWithSmallStringO(self, string)); 5132 terminateO(string); 5133 string = allocSmallString("shee"); 5134 // NULL string 5135 ck_assert(!icStartsWithSmallStringO(self, NULL)); 5136 // empty self 5137 freeO(self); 5138 ck_assert(!icStartsWithSmallStringO(self, string)); 5139 terminateO(string); 5140 terminateO(self); 5141 5142 END_TEST 5143 5144 5145 START_TEST(icEndsWithSSmallStringT) 5146 5147 smallStringt *self = allocG("shee"); 5148 5149 // identical strings 5150 ck_assert(icEndsWithSO(self, "shee")); 5151 setValO(self, "sheepy"); 5152 ck_assert(icEndsWithSO(self, "EEPY")); 5153 // different strings 5154 setValO(self, "shee"); 5155 ck_assert(!icEndsWithSO(self, "SH")); 5156 ck_assert(!icEndsWithSO(self, "sheep")); 5157 setValO(self, "shee-"); 5158 ck_assert(!icEndsWithSO(self, "shee")); 5159 // NULL string 5160 ck_assert(!icEndsWithSO(self, NULL)); 5161 // empty self 5162 freeO(self); 5163 ck_assert(!icEndsWithSO(self, "shee")); 5164 terminateO(self); 5165 5166 END_TEST 5167 5168 5169 START_TEST(icEndsWithCharSmallStringT) 5170 5171 smallStringt *self = allocG("shee"); 5172 5173 // identical strings 5174 ck_assert(icEndsWithCharO(self, 'e')); 5175 setValO(self, "sheepy"); 5176 ck_assert(icEndsWithCharO(self, 'y')); 5177 setValO(self, ""); 5178 ck_assert(icEndsWithCharO(self, 0)); 5179 // different strings 5180 setValO(self, "shee"); 5181 ck_assert(icEndsWithCharO(self, 'E')); 5182 ck_assert(!icEndsWithCharO(self, 'p')); 5183 setValO(self, "shee-"); 5184 ck_assert(!icEndsWithCharO(self, 'e')); 5185 setValO(self, ""); 5186 ck_assert(!icEndsWithCharO(self, '0')); 5187 // NULL string 5188 setValO(self, "a"); 5189 ck_assert(!icEndsWithCharO(self, 0)); 5190 // empty self 5191 freeO(self); 5192 ck_assert(!icEndsWithCharO(self, '0')); 5193 terminateO(self); 5194 5195 END_TEST 5196 5197 5198 START_TEST(icEndsWithSmallJsonSmallStringT) 5199 5200 smallStringt *self = allocG("shee"); 5201 smallJsont *string = allocSmallJson(); 5202 5203 // identical strings 5204 setTopSO(string, "shee"); 5205 ck_assert(icEndsWithSmallJsonO(self, string)); 5206 setValO(self, "sheepy"); 5207 freeO(string); 5208 setTopSO(string, "EEPY"); 5209 ck_assert(icEndsWithSmallJsonO(self, string)); 5210 // different strings 5211 setValO(self, "shee"); 5212 freeO(string); 5213 setTopSO(string, "SH"); 5214 ck_assert(!icEndsWithSmallJsonO(self, string)); 5215 freeO(string); 5216 setTopSO(string, "sheep"); 5217 ck_assert(!icEndsWithSmallJsonO(self, string)); 5218 setValO(self, "shee-"); 5219 freeO(string); 5220 setTopSO(string, "shee"); 5221 ck_assert(!icEndsWithSmallJsonO(self, string)); 5222 // non json string 5223 freeO(string); 5224 setTopIntO(string, 1); 5225 ck_assert(!icEndsWithSmallJsonO(self, string)); 5226 // non json object 5227 terminateO(string); 5228 string = (smallJsont*) allocSmallInt(1); 5229 ck_assert(!icEndsWithSmallJsonO(self, string)); 5230 terminateO(string); 5231 string = allocSmallJson(); 5232 setTopSO(string, "shee"); 5233 // NULL string 5234 ck_assert(!icEndsWithSmallJsonO(self, NULL)); 5235 // empty self 5236 freeO(self); 5237 ck_assert(!icEndsWithSmallJsonO(self, string)); 5238 terminateO(string); 5239 terminateO(self); 5240 5241 END_TEST 5242 5243 5244 START_TEST(icEndsWithSmallStringSmallStringT) 5245 5246 smallStringt *self = allocG("shee"); 5247 smallStringt *string = allocSmallString("shee"); 5248 5249 // identical strings 5250 ck_assert(icEndsWithSmallStringO(self, string)); 5251 setValO(self, "sheepy"); 5252 setValO(string, "EEPY"); 5253 ck_assert(icEndsWithSmallStringO(self, string)); 5254 // different strings 5255 setValO(self, "shee"); 5256 ck_assert(!icEndsWithSmallStringO(self, string)); 5257 setValO(string, "sheep"); 5258 ck_assert(!icEndsWithSmallStringO(self, string)); 5259 setValO(self, "shee-"); 5260 setValO(string, "shee"); 5261 ck_assert(!icEndsWithSmallStringO(self, string)); 5262 // non smallString object 5263 terminateO(string); 5264 string = (smallStringt*) allocSmallInt(1); 5265 ck_assert(!icEndsWithSmallStringO(self, string)); 5266 terminateO(string); 5267 string = allocSmallString("shee"); 5268 // NULL string 5269 ck_assert(!icEndsWithSmallStringO(self, NULL)); 5270 // empty self 5271 freeO(self); 5272 ck_assert(!icEndsWithSmallStringO(self, string)); 5273 terminateO(string); 5274 terminateO(self); 5275 5276 END_TEST 5277 5278 5279 START_TEST(icCountSSmallStringT) 5280 5281 smallStringt *self = allocG("sheepy"); 5282 5283 // positive count 5284 ck_assert_int_eq(icCountSO(self, "shee"), 1); 5285 setValO(self, "aaa aaa"); 5286 ck_assert_int_eq(icCountSO(self, "a"), 6); 5287 ck_assert_int_eq(icCountSO(self, "Aa"), 2); 5288 // 0 icCount 5289 setValO(self, "shee"); 5290 ck_assert_int_eq(icCountSO(self, "SH"), 1); 5291 ck_assert_int_eq(icCountSO(self, "sheepy"), 0); 5292 setValO(self, "aaa aaa"); 5293 ck_assert_int_eq(icCountSO(self, "ab"), 0); 5294 // empty string 5295 ck_assert_int_eq(icCountSO(self, ""), -1); 5296 // NULL string 5297 ck_assert_int_eq(icCountSO(self, NULL), -1); 5298 // empty self 5299 freeO(self); 5300 ck_assert_int_eq(icCountSO(self, "ab"), -1); 5301 terminateO(self); 5302 5303 END_TEST 5304 5305 5306 START_TEST(icCountCharSmallStringT) 5307 5308 smallStringt *self = allocG("shee"); 5309 5310 // positive count 5311 ck_assert_int_eq(icCountCharO(self, 's'), 1); 5312 setValO(self, "aaa aaa"); 5313 ck_assert_int_eq(icCountCharO(self, 'a'), 6); 5314 // 0 icCount 5315 setValO(self, "shee"); 5316 ck_assert_int_eq(icCountCharO(self, 'S'), 1); 5317 ck_assert_int_eq(icCountCharO(self, 'y'), 0); 5318 setValO(self, "aaa aaa"); 5319 ck_assert_int_eq(icCountCharO(self, 'b'), 0); 5320 // empty string 5321 setValO(self, ""); 5322 ck_assert_int_eq(icCountCharO(self, 'a'), 0); 5323 ck_assert_int_eq(icCountCharO(self, 0), -1); 5324 // NULL string 5325 setValO(self, "a"); 5326 ck_assert_int_eq(icCountCharO(self, 0), -1); 5327 // empty self 5328 freeO(self); 5329 ck_assert_int_eq(icCountCharO(self, 'a'), -1); 5330 terminateO(self); 5331 5332 END_TEST 5333 5334 5335 START_TEST(icCountSmallJsonSmallStringT) 5336 5337 smallStringt *self = allocG("sheepy"); 5338 smallJsont *string = allocSmallJson(); 5339 5340 // positive count 5341 setTopSO(string, "shee"); 5342 ck_assert_int_eq(icCountSmallJsonO(self, string), 1); 5343 setValO(self, "aaa aaa"); 5344 freeO(string); 5345 setTopSO(string, "a"); 5346 ck_assert_int_eq(icCountSmallJsonO(self, string), 6); 5347 freeO(string); 5348 setTopSO(string, "aa"); 5349 ck_assert_int_eq(icCountSmallJsonO(self, string), 2); 5350 // 0 icCount 5351 setValO(self, "shee"); 5352 freeO(string); 5353 setTopSO(string, "SH"); 5354 ck_assert_int_eq(icCountSmallJsonO(self, string), 1); 5355 freeO(string); 5356 setTopSO(string, "sheepy"); 5357 ck_assert_int_eq(icCountSmallJsonO(self, string), 0); 5358 setValO(self, "aaa aaa"); 5359 freeO(string); 5360 setTopSO(string, "ab"); 5361 ck_assert_int_eq(icCountSmallJsonO(self, string), 0); 5362 // non json string 5363 freeO(string); 5364 setTopIntO(string, -1); 5365 ck_assert_int_eq(icCountSmallJsonO(self, string), -1); 5366 // non json object 5367 terminateO(string); 5368 string = (smallJsont*) allocSmallInt(1); 5369 ck_assert_int_eq(icCountSmallJsonO(self, string), -1); 5370 terminateO(string); 5371 string = allocSmallJson(); 5372 // empty string 5373 setTopSO(string, ""); 5374 ck_assert_int_eq(icCountSmallJsonO(self, string), -1); 5375 // NULL string 5376 ck_assert_int_eq(icCountSmallJsonO(self, NULL), -1); 5377 // empty self 5378 freeO(self); 5379 freeO(string); 5380 setTopSO(string, "ab"); 5381 ck_assert_int_eq(icCountSmallJsonO(self, string), -1); 5382 terminateO(string); 5383 terminateO(self); 5384 5385 END_TEST 5386 5387 5388 START_TEST(icCountSmallStringSmallStringT) 5389 5390 smallStringt *self = allocG("sheepy"); 5391 smallStringt *string = allocSmallString("shee"); 5392 5393 // positive count 5394 ck_assert_int_eq(icCountSmallStringO(self, string), 1); 5395 setValO(self, "aaa aaa"); 5396 setValO(string, "a"); 5397 ck_assert_int_eq(icCountSmallStringO(self, string), 6); 5398 setValO(string, "aa"); 5399 ck_assert_int_eq(icCountSmallStringO(self, string), 2); 5400 // 0 icCount 5401 setValO(self, "shee"); 5402 setValO(string, "SH"); 5403 ck_assert_int_eq(icCountSmallStringO(self, string), 1); 5404 setValO(string, "sheepy"); 5405 ck_assert_int_eq(icCountSmallStringO(self, string), 0); 5406 setValO(self, "aaa aaa"); 5407 setValO(string, "ab"); 5408 ck_assert_int_eq(icCountSmallStringO(self, string), 0); 5409 // non json object 5410 terminateO(string); 5411 string = (smallStringt*) allocSmallInt(1); 5412 ck_assert_int_eq(icCountSmallStringO(self, string), -1); 5413 terminateO(string); 5414 string = allocSmallString(""); 5415 // empty string 5416 ck_assert_int_eq(icCountSmallStringO(self, string), -1); 5417 freeO(string); 5418 ck_assert_int_eq(icCountSmallStringO(self, string), -1); 5419 // NULL string 5420 ck_assert_int_eq(icCountSmallStringO(self, NULL), -1); 5421 // empty self 5422 freeO(self); 5423 setValO(string, "ab"); 5424 ck_assert_int_eq(icCountSmallStringO(self, string), -1); 5425 terminateO(string); 5426 terminateO(self); 5427 5428 END_TEST 5429 5430 5431 START_TEST(isNumberSmallStringT) 5432 5433 smallStringt *self = allocG(""); 5434 5435 // number 5436 setValO(self, "-12.3"); 5437 ck_assert(isNumberO(self)); 5438 setValO(self, "-123"); 5439 ck_assert(isNumberO(self)); 5440 setValO(self, "123"); 5441 ck_assert(isNumberO(self)); 5442 setValO(self, "1e23"); 5443 ck_assert(isNumberO(self)); 5444 setValO(self, "12E-3"); 5445 ck_assert(isNumberO(self)); 5446 setValO(self, ".123"); 5447 ck_assert(isNumberO(self)); 5448 setValO(self, "-.123"); 5449 ck_assert(isNumberO(self)); 5450 setValO(self, "1E+32"); 5451 ck_assert(isNumberO(self)); 5452 // not a number 5453 setValO(self, ".12e3"); 5454 ck_assert(!isNumberO(self)); 5455 setValO(self, "-.12e3"); 5456 ck_assert(!isNumberO(self)); 5457 setValO(self, "-1-23"); 5458 ck_assert(!isNumberO(self)); 5459 setValO(self, "123-"); 5460 ck_assert(!isNumberO(self)); 5461 setValO(self, "-"); 5462 ck_assert(!isNumberO(self)); 5463 setValO(self, "-123."); 5464 ck_assert(!isNumberO(self)); 5465 setValO(self, "-1.2.3"); 5466 ck_assert(!isNumberO(self)); 5467 setValO(self, "1-2.3"); 5468 ck_assert(!isNumberO(self)); 5469 setValO(self, "12..3"); 5470 ck_assert(!isNumberO(self)); 5471 setValO(self, ".12.3"); 5472 ck_assert(!isNumberO(self)); 5473 setValO(self, "."); 5474 ck_assert(!isNumberO(self)); 5475 setValO(self, "E12"); 5476 ck_assert(!isNumberO(self)); 5477 setValO(self, "E1E2"); 5478 ck_assert(!isNumberO(self)); 5479 setValO(self, "E1.2"); 5480 ck_assert(!isNumberO(self)); 5481 setValO(self, "1E"); 5482 ck_assert(!isNumberO(self)); 5483 setValO(self, "1E2.3"); 5484 ck_assert(!isNumberO(self)); 5485 setValO(self, "1-"); 5486 ck_assert(!isNumberO(self)); 5487 setValO(self, "1E-"); 5488 ck_assert(!isNumberO(self)); 5489 setValO(self, "lib123sheepy"); 5490 ck_assert(!isNumberO(self)); 5491 // string without number 5492 setValO(self, "s"); 5493 ck_assert(!isNumberO(self)); 5494 // empty string 5495 setValO(self, ""); 5496 ck_assert(!isNumberO(self)); 5497 // NULL string 5498 freeO(self); 5499 ck_assert(!isNumberO(self)); 5500 terminateO(self); 5501 5502 END_TEST 5503 5504 5505 START_TEST(isIntSmallStringT) 5506 5507 smallStringt *self = allocG(""); 5508 5509 // integer 5510 setValO(self, "-123"); 5511 ck_assert(isIntO(self)); 5512 setValO(self, "123"); 5513 ck_assert(isIntO(self)); 5514 // not a integer 5515 setValO(self, "1e23"); 5516 ck_assert(!isIntO(self)); 5517 setValO(self, "12E-3"); 5518 ck_assert(!isIntO(self)); 5519 setValO(self, "-12.3"); 5520 ck_assert(!isIntO(self)); 5521 setValO(self, "-1-23"); 5522 ck_assert(!isIntO(self)); 5523 setValO(self, "123-"); 5524 ck_assert(!isIntO(self)); 5525 setValO(self, "-"); 5526 ck_assert(!isIntO(self)); 5527 setValO(self, "-123."); 5528 ck_assert(!isIntO(self)); 5529 setValO(self, ".123"); 5530 ck_assert(!isIntO(self)); 5531 setValO(self, "-1.2.3"); 5532 ck_assert(!isIntO(self)); 5533 setValO(self, "1-2.3"); 5534 ck_assert(!isIntO(self)); 5535 setValO(self, "12..3"); 5536 ck_assert(!isIntO(self)); 5537 setValO(self, "."); 5538 ck_assert(!isIntO(self)); 5539 setValO(self, "1E"); 5540 ck_assert(!isIntO(self)); 5541 setValO(self, "1-"); 5542 ck_assert(!isIntO(self)); 5543 setValO(self, "1E-"); 5544 ck_assert(!isIntO(self)); 5545 setValO(self, "lib123sheepy"); 5546 ck_assert(!isIntO(self)); 5547 // string without number 5548 setValO(self, "s"); 5549 ck_assert(!isIntO(self)); 5550 // empty string 5551 setValO(self, ""); 5552 ck_assert(!isIntO(self)); 5553 // NULL string 5554 freeO(self); 5555 ck_assert(!isIntO(self)); 5556 terminateO(self); 5557 5558 END_TEST 5559 5560 5561 START_TEST(parseIntSmallStringT) 5562 5563 smallStringt *self = allocG(""); 5564 5565 // number 5566 setValO(self, "123sheepy"); 5567 ck_assert_int_eq(parseIntO(self), 123); 5568 setValO(self, "lib123sheepy"); 5569 ck_assert_int_eq(parseIntO(self), 123); 5570 setValO(self, "-123"); 5571 ck_assert_int_eq(parseIntO(self), -123); 5572 // out of range - TODO check stderr 5573 setValO(self, "999999999999999999999999999999999999999"); 5574 parseIntO(self); 5575 // string without number 5576 setValO(self, "sheepy"); 5577 ck_assert_int_eq(parseIntO(self), 0); 5578 // NULL string 5579 freeO(self); 5580 ck_assert_int_eq(parseIntO(self), 0); 5581 terminateO(self); 5582 5583 END_TEST 5584 5585 5586 START_TEST(parseDoubleSmallStringT) 5587 5588 smallStringt *self = allocG(""); 5589 5590 // number 5591 setValO(self, "123.2sheepy"); 5592 ck_assert_int_eq(parseDoubleO(self), 123); 5593 setValO(self, "lib123sheepy"); 5594 ck_assert_int_eq(parseDoubleO(self), 123); 5595 setValO(self, "-123"); 5596 ck_assert_int_eq(parseDoubleO(self), -123); 5597 // out of range - TODO check stderr 5598 setValO(self, "999999999999999999999999999999999999999"); 5599 parseDoubleO(self); 5600 // string without number 5601 setValO(self, "sheepy"); 5602 ck_assert_int_eq(parseDoubleO(self), 0); 5603 // NULL string 5604 freeO(self); 5605 ck_assert_int_eq(parseDoubleO(self), 0); 5606 terminateO(self); 5607 5608 END_TEST 5609 5610 5611 START_TEST(intToSmallStringT) 5612 5613 smallStringt* r; 5614 smallStringt *self = allocG(""); 5615 5616 // number 5617 r = intToO(self, 123); 5618 ck_assert_ptr_ne(r, null); 5619 char *s = toStringO(r); 5620 ck_assert_str_eq(s, "123"); 5621 free(s); 5622 r = intToO(self, -465464123); 5623 ck_assert_ptr_ne(r, null); 5624 s = toStringO(r); 5625 ck_assert_str_eq(s, "-465464123"); 5626 free(s); 5627 terminateO(self); 5628 5629 END_TEST 5630 5631 5632 START_TEST(doubleToSmallStringT) 5633 5634 smallStringt* r; 5635 smallStringt *self = allocG(""); 5636 5637 // number 5638 r = doubleToO(self, 123.4); 5639 ck_assert_ptr_ne(r, null); 5640 char *s = toStringO(r); 5641 ck_assert_str_eq(s, "1.234000e+02"); 5642 free(s); 5643 r = doubleToO(self, -4652445e5); 5644 ck_assert_ptr_ne(r, null); 5645 s = toStringO(r); 5646 ck_assert_str_eq(s, "-4.652445e+11"); 5647 free(s); 5648 terminateO(self); 5649 5650 END_TEST 5651 5652 5653 START_TEST(lenSmallStringT) 5654 5655 size_t r; 5656 smallStringt *self = allocG(""); 5657 5658 r = lenO(self); 5659 ck_assert_int_eq(r, 0); 5660 setValO(self, "123"); 5661 r = lenO(self); 5662 ck_assert_int_eq(r, 3); 5663 freeO(self); 5664 r = lenO(self); 5665 ck_assert_int_eq(r, 0); 5666 terminateO(self); 5667 5668 END_TEST 5669 5670 5671 START_TEST(upperSmallStringT) 5672 5673 smallStringt* r; 5674 smallStringt *self = allocG("sheepy"); 5675 5676 // string 5677 r = upperO(self); 5678 ck_assert_ptr_ne(r, null); 5679 char *s = toStringO(r); 5680 ck_assert_str_eq(s, "SHEEPY"); 5681 free(s); 5682 // NULL string 5683 freeO(self); 5684 ck_assert_ptr_eq(upperO(self), NULL); 5685 terminateO(self); 5686 5687 END_TEST 5688 5689 5690 START_TEST(lowerSmallStringT) 5691 5692 smallStringt* r; 5693 smallStringt *self = allocG("SHeePY"); 5694 5695 // string 5696 r = lowerO(self); 5697 ck_assert_ptr_ne(r, null); 5698 char *s = toStringO(r); 5699 ck_assert_str_eq(s, "sheepy"); 5700 free(s); 5701 // NULL string 5702 freeO(self); 5703 ck_assert_ptr_eq(lowerO(self), NULL); 5704 terminateO(self); 5705 5706 END_TEST 5707 5708 5709 START_TEST(trimSmallStringT) 5710 5711 smallStringt* r; 5712 smallStringt *self = allocG(""); 5713 5714 // no spaces 5715 setValO(self, "SHeePY"); 5716 r = trimO(self); 5717 ck_assert_ptr_ne(r, null); 5718 char *s = toStringO(r); 5719 ck_assert_str_eq(s, "SHeePY"); 5720 free(s); 5721 // heading spaces 5722 setValO(self, " SHeePY"); 5723 r = trimO(self); 5724 ck_assert_ptr_ne(r, null); 5725 s = toStringO(r); 5726 ck_assert_str_eq(s, "SHeePY"); 5727 free(s); 5728 // trailing spaces 5729 setValO(self, "SHeePY "); 5730 r = trimO(self); 5731 ck_assert_ptr_ne(r, null); 5732 s = toStringO(r); 5733 ck_assert_str_eq(s, "SHeePY"); 5734 free(s); 5735 // string with spaces in the middle 5736 setValO(self, " SHe ePY "); 5737 r = trimO(self); 5738 ck_assert_ptr_ne(r, null); 5739 s = toStringO(r); 5740 ck_assert_str_eq(s, "SHe ePY"); 5741 free(s); 5742 // all spaces 5743 setValO(self, " "); 5744 r = trimO(self); 5745 ck_assert_ptr_ne(r, null); 5746 s = toStringO(r); 5747 ck_assert_str_eq(s, ""); 5748 free(s); 5749 // empty string 5750 setValO(self, ""); 5751 r = trimO(self); 5752 ck_assert_ptr_ne(r, null); 5753 s = toStringO(r); 5754 ck_assert_str_eq(s, ""); 5755 free(s); 5756 // NULL string 5757 freeO(self); 5758 ck_assert_ptr_eq(trimO(self), NULL); 5759 terminateO(self); 5760 5761 END_TEST 5762 5763 5764 START_TEST(lTrimSmallStringT) 5765 5766 smallStringt* r; 5767 smallStringt *self = allocG(""); 5768 5769 // no spaces 5770 setValO(self, "SHeePY"); 5771 r = lTrimO(self); 5772 ck_assert_ptr_ne(r, null); 5773 char *s = toStringO(r); 5774 ck_assert_str_eq(s, "SHeePY"); 5775 free(s); 5776 // heading spaces 5777 setValO(self, " SHeePY"); 5778 r = lTrimO(self); 5779 ck_assert_ptr_ne(r, null); 5780 s = toStringO(r); 5781 ck_assert_str_eq(s, "SHeePY"); 5782 free(s); 5783 // trailing spaces 5784 setValO(self, "SHeePY "); 5785 r = lTrimO(self); 5786 ck_assert_ptr_ne(r, null); 5787 s = toStringO(r); 5788 ck_assert_str_eq(s, "SHeePY "); 5789 free(s); 5790 // string with spaces in the middle 5791 setValO(self, " SHe ePY "); 5792 r = lTrimO(self); 5793 ck_assert_ptr_ne(r, null); 5794 s = toStringO(r); 5795 ck_assert_str_eq(s, "SHe ePY "); 5796 free(s); 5797 // all spaces 5798 setValO(self, " "); 5799 r = lTrimO(self); 5800 ck_assert_ptr_ne(r, null); 5801 s = toStringO(r); 5802 ck_assert_str_eq(s, ""); 5803 free(s); 5804 setValO(self, ""); 5805 r = lTrimO(self); 5806 ck_assert_ptr_ne(r, null); 5807 s = toStringO(r); 5808 ck_assert_str_eq(s, ""); 5809 free(s); 5810 // NULL string 5811 freeO(self); 5812 ck_assert_ptr_eq(lTrimO(self), NULL); 5813 terminateO(self); 5814 5815 END_TEST 5816 5817 5818 START_TEST(rTrimSmallStringT) 5819 5820 smallStringt* r; 5821 smallStringt *self = allocG(""); 5822 5823 // no spaces 5824 setValO(self, "SHeePY"); 5825 r = rTrimO(self); 5826 ck_assert_ptr_ne(r, null); 5827 char *s = toStringO(r); 5828 ck_assert_str_eq(s, "SHeePY"); 5829 free(s); 5830 // heading spaces 5831 setValO(self, " SHeePY"); 5832 r = rTrimO(self); 5833 ck_assert_ptr_ne(r, null); 5834 s = toStringO(r); 5835 ck_assert_str_eq(s, " SHeePY"); 5836 free(s); 5837 // trailing spaces 5838 setValO(self, "SHeePY "); 5839 r = rTrimO(self); 5840 ck_assert_ptr_ne(r, null); 5841 s = toStringO(r); 5842 ck_assert_str_eq(s, "SHeePY"); 5843 free(s); 5844 // string with spaces in the middle 5845 setValO(self, " SHe ePY "); 5846 r = rTrimO(self); 5847 ck_assert_ptr_ne(r, null); 5848 s = toStringO(r); 5849 ck_assert_str_eq(s, " SHe ePY"); 5850 free(s); 5851 // all spaces 5852 setValO(self, " "); 5853 r = rTrimO(self); 5854 ck_assert_ptr_ne(r, null); 5855 s = toStringO(r); 5856 ck_assert_str_eq(s, ""); 5857 free(s); 5858 // empty string 5859 setValO(self, ""); 5860 r = rTrimO(self); 5861 ck_assert_ptr_ne(r, null); 5862 s = toStringO(r); 5863 ck_assert_str_eq(s, ""); 5864 free(s); 5865 // NULL string 5866 freeO(self); 5867 ck_assert_ptr_eq(rTrimO(self), NULL); 5868 terminateO(self); 5869 5870 END_TEST 5871 5872 5873 START_TEST(uniqSmallStringT) 5874 5875 smallStringt* r; 5876 smallStringt *self = allocG(""); 5877 5878 // uniquify 5879 setValO(self, "/qwd///"); 5880 r = uniqO(self, '/'); 5881 ck_assert_ptr_ne(r, null); 5882 char *s = toStringO(r); 5883 ck_assert_str_eq(s, "/qwd/"); 5884 free(s); 5885 // short string 5886 setValO(self, "?"); 5887 r = uniqO(self, '/'); 5888 ck_assert_ptr_ne(r, null); 5889 s = toStringO(r); 5890 ck_assert_str_eq(s, "?"); 5891 free(s); 5892 // NULL 5893 freeO(self); 5894 ck_assert_ptr_eq(uniqO(self, '/'), NULL); 5895 terminateO(self); 5896 5897 END_TEST 5898 5899 5900 START_TEST(icUniqSmallStringT) 5901 5902 smallStringt* r; 5903 smallStringt *self = allocG(""); 5904 5905 // uniquify 5906 setValO(self, "/qQwd///"); 5907 r = icUniqO(self, 'q'); 5908 ck_assert_ptr_ne(r, null); 5909 char *s = toStringO(r); 5910 ck_assert_str_eq(s, "/qwd///"); 5911 free(s); 5912 // short string 5913 setValO(self, "?"); 5914 r = icUniqO(self, '/'); 5915 ck_assert_ptr_ne(r, null); 5916 s = toStringO(r); 5917 ck_assert_str_eq(s, "?"); 5918 free(s); 5919 // NULL 5920 freeO(self); 5921 ck_assert_ptr_eq(icUniqO(self, '/'), NULL); 5922 terminateO(self); 5923 5924 END_TEST 5925 5926 5927 START_TEST(getAtSmallStringT) 5928 5929 smallStringt *self = allocG(""); 5930 5931 // get char 5932 setValO(self, "sheepy"); 5933 ck_assert_uint_eq(getAtO(self, 0), 's'); 5934 // negative index 5935 ck_assert_uint_eq(getAtO(self, -1), 'y'); 5936 // outside string 5937 ck_assert_uint_eq(getAtO(self, 10), 0); 5938 ck_assert_uint_eq(getAtO(self, -10), 0); 5939 // negative index in a one char string 5940 setValO(self, "z"); 5941 ck_assert_uint_eq(getAtO(self, -1), 'z'); 5942 // empty string 5943 setValO(self, ""); 5944 ck_assert_uint_eq(getAtO(self, 0), 0); 5945 // NULL string 5946 freeO(self); 5947 ck_assert_uint_eq(getAtO(self, 0), 0); 5948 terminateO(self); 5949 5950 END_TEST 5951 5952 5953 START_TEST(setAtSmallStringT) 5954 5955 smallStringt* r; 5956 smallStringt *self = allocG("sheepy"); 5957 5958 // set char 5959 r = setAtO(self, 0, 'S'); 5960 ck_assert_ptr_ne(r, null); 5961 ck_assert_uint_eq(ssGet(self)[0], 'S'); 5962 // negative index 5963 r = setAtO(self, -2, 'P'); 5964 ck_assert_ptr_ne(r, null); 5965 ck_assert_uint_eq(ssGet(self)[4], 'P'); 5966 // outside string 5967 r = setAtO(self, 20, 'Y'); 5968 ck_assert_ptr_eq(r, null); 5969 r = setAtO(self, -20, 'Y'); 5970 ck_assert_ptr_eq(r, null); 5971 ck_assert_str_eq(ssGet(self), "SheePy"); 5972 // negative index in a one char string 5973 setValO(self, "s"); 5974 r = setAtO(self, -1, 'S'); 5975 ck_assert_ptr_ne(r, null); 5976 ck_assert_uint_eq(ssGet(self)[0], 'S'); 5977 // empty string 5978 setValO(self, ""); 5979 r = setAtO(self, -1, 'S'); 5980 ck_assert_ptr_eq(r, null); 5981 ck_assert_str_eq(ssGet(self), ""); 5982 // NULL string 5983 freeO(self); 5984 r = setAtO(self, 0, 's'); 5985 ck_assert_ptr_eq(r, null); 5986 terminateO(self); 5987 5988 END_TEST 5989 5990 5991 START_TEST(sliceSmallStringT) 5992 5993 smallStringt* r; 5994 smallStringt *self = allocG(""); 5995 5996 // slice 5997 setValO(self, "sheepy"); 5998 r = sliceO(self, 0,2); 5999 ck_assert_ptr_ne(r, null); 6000 ck_assert_str_eq(ssGet(self), "sh"); 6001 // negative index 6002 setValO(self, "sheepy"); 6003 r = sliceO(self, -2,0); 6004 ck_assert_ptr_ne(r, null); 6005 ck_assert_str_eq(ssGet(self), "py"); 6006 // positive and negative indexes 6007 setValO(self, "sheepy"); 6008 r = sliceO(self, 2,-2); 6009 ck_assert_ptr_ne(r, null); 6010 ck_assert_str_eq(ssGet(self), "ee"); 6011 // start = end 6012 setValO(self, "sheepy"); 6013 r = sliceO(self, 2,-4); 6014 ck_assert_ptr_ne(r, null); 6015 ck_assert_str_eq(ssGet(self), ""); 6016 // end of string 6017 setValO(self, "sheepy"); 6018 r = sliceO(self, 2,6); 6019 ck_assert_ptr_ne(r, null); 6020 ck_assert_str_eq(ssGet(self), "eepy"); 6021 // NULL string 6022 freeO(self); 6023 ck_assert_ptr_eq(sliceO(self, 2,-4), NULL); 6024 // start outside string 6025 setValO(self, "sheepy"); 6026 ck_assert_ptr_eq(sliceO(self, 20,-4), NULL); 6027 // end outside string 6028 setValO(self, "sheepy"); 6029 r = sliceO(self, 2,40); 6030 ck_assert_ptr_ne(r, null); 6031 ck_assert_str_eq(ssGet(self), "eepy"); 6032 setValO(self, "sheepy"); 6033 r = sliceO(self, -22,3); 6034 ck_assert_ptr_ne(r, null); 6035 ck_assert_str_eq(ssGet(self), "she"); 6036 setValO(self, "sheepy"); 6037 ck_assert_ptr_eq(sliceO(self, 2,-40), NULL); 6038 // end before start 6039 setValO(self, "sheepy"); 6040 ck_assert_ptr_eq(sliceO(self, 4,2), NULL); 6041 terminateO(self); 6042 6043 END_TEST 6044 6045 6046 START_TEST(cropSmallStringT) 6047 6048 smallStringt* r; 6049 smallStringt *self = allocG(""); 6050 6051 // crop 6052 setValO(self, "sheepy"); 6053 r = cropO(self, 0,2); 6054 ck_assert_ptr_ne(r, null); 6055 ck_assert_str_eq(ssGet(r), "sh"); 6056 ck_assert_str_eq(ssGet(self), "eepy"); 6057 terminateO(r); 6058 // negative index 6059 setValO(self, "sheepy"); 6060 r = cropO(self, -2,0); 6061 ck_assert_ptr_ne(r, null); 6062 ck_assert_str_eq(ssGet(r), "py"); 6063 ck_assert_str_eq(ssGet(self), "shee"); 6064 terminateO(r); 6065 // positive and negative indexes 6066 setValO(self, "sheepy"); 6067 r = cropO(self, 2,-2); 6068 ck_assert_ptr_ne(r, null); 6069 ck_assert_str_eq(ssGet(r), "ee"); 6070 ck_assert_str_eq(ssGet(self), "shpy"); 6071 terminateO(r); 6072 // start = end 6073 setValO(self, "sheepy"); 6074 r = cropO(self, 2,-4); 6075 ck_assert_ptr_ne(r, null); 6076 ck_assert_str_eq(ssGet(r), ""); 6077 ck_assert_str_eq(ssGet(self), "sheepy"); 6078 terminateO(r); 6079 // end of string 6080 setValO(self, "sheepy"); 6081 r = cropO(self, 2,6); 6082 ck_assert_ptr_ne(r, null); 6083 ck_assert_str_eq(ssGet(r), "eepy"); 6084 ck_assert_str_eq(ssGet(self), "sh"); 6085 terminateO(r); 6086 // NULL string 6087 freeO(self); 6088 ck_assert_ptr_eq(cropO(self, 2,-4), NULL); 6089 // start outside string 6090 setValO(self, "sheepy"); 6091 ck_assert_ptr_eq(cropO(self, 20,-4), NULL); 6092 // end outside string 6093 setValO(self, "sheepy"); 6094 r = cropO(self, 2,40); 6095 ck_assert_ptr_ne(r, null); 6096 ck_assert_str_eq(ssGet(r), "eepy"); 6097 ck_assert_str_eq(ssGet(self), "sh"); 6098 terminateO(r); 6099 setValO(self, "sheepy"); 6100 r = cropO(self, -22,3); 6101 ck_assert_ptr_ne(r, null); 6102 ck_assert_str_eq(ssGet(r), "she"); 6103 ck_assert_str_eq(ssGet(self), "epy"); 6104 terminateO(r); 6105 setValO(self, "sheepy"); 6106 ck_assert_ptr_eq(cropO(self, 2,-40), NULL); 6107 // end before start 6108 ck_assert_ptr_eq(cropO(self, 4,2), NULL); 6109 terminateO(self); 6110 6111 END_TEST 6112 6113 6114 START_TEST(cropSSmallStringT) 6115 6116 char* s; 6117 smallStringt *self = allocG(""); 6118 6119 // crop 6120 setValO(self, "sheepy"); 6121 s = cropSO(self, 0,2); 6122 ck_assert_str_eq(s, "sh"); 6123 ck_assert_str_eq(ssGet(self), "eepy"); 6124 free(s); 6125 // negative index 6126 setValO(self, "sheepy"); 6127 s = cropSO(self, -2,0); 6128 ck_assert_str_eq(s, "py"); 6129 ck_assert_str_eq(ssGet(self), "shee"); 6130 free(s); 6131 // positive and negative indexes 6132 setValO(self, "sheepy"); 6133 s = cropSO(self, 2,-2); 6134 ck_assert_str_eq(s, "ee"); 6135 ck_assert_str_eq(ssGet(self), "shpy"); 6136 free(s); 6137 // start = end 6138 setValO(self, "sheepy"); 6139 s = cropSO(self, 2,-4); 6140 ck_assert_str_eq(s, ""); 6141 ck_assert_str_eq(ssGet(self), "sheepy"); 6142 free(s); 6143 // end of string 6144 setValO(self, "sheepy"); 6145 s = cropSO(self, 2,6); 6146 ck_assert_str_eq(s, "eepy"); 6147 ck_assert_str_eq(ssGet(self), "sh"); 6148 free(s); 6149 // NULL string 6150 freeO(self); 6151 ck_assert_ptr_eq(cropSO(self, 2,-4), NULL); 6152 // start outside string 6153 setValO(self, "sheepy"); 6154 ck_assert_ptr_eq(cropSO(self, 20,-4), NULL); 6155 // end outside string 6156 setValO(self, "sheepy"); 6157 s = cropSO(self, 2,40); 6158 ck_assert_str_eq(s, "eepy"); 6159 ck_assert_str_eq(ssGet(self), "sh"); 6160 free(s); 6161 setValO(self, "sheepy"); 6162 s = cropSO(self, -22,3); 6163 ck_assert_str_eq(s, "she"); 6164 ck_assert_str_eq(ssGet(self), "epy"); 6165 free(s); 6166 setValO(self, "sheepy"); 6167 ck_assert_ptr_eq(cropSO(self, 2,-40), NULL); 6168 // end before start 6169 ck_assert_ptr_eq(cropSO(self, 4,2), NULL); 6170 terminateO(self); 6171 6172 END_TEST 6173 6174 6175 START_TEST(cropSmallJsonSmallStringT) 6176 6177 smallJsont* r; 6178 smallStringt *self = allocG(""); 6179 6180 // crop 6181 setValO(self, "sheepy"); 6182 r = cropSmallJsonO(self, 0,2); 6183 ck_assert_ptr_ne(r, null); 6184 ck_assert_str_eq(sjGet(r), "sh"); 6185 ck_assert_str_eq(ssGet(self), "eepy"); 6186 terminateO(r); 6187 // negative index 6188 setValO(self, "sheepy"); 6189 r = cropSmallJsonO(self, -2,0); 6190 ck_assert_ptr_ne(r, null); 6191 ck_assert_str_eq(sjGet(r), "py"); 6192 ck_assert_str_eq(ssGet(self), "shee"); 6193 terminateO(r); 6194 // positive and negative indexes 6195 setValO(self, "sheepy"); 6196 r = cropSmallJsonO(self, 2,-2); 6197 ck_assert_ptr_ne(r, null); 6198 ck_assert_str_eq(sjGet(r), "ee"); 6199 ck_assert_str_eq(ssGet(self), "shpy"); 6200 terminateO(r); 6201 // start = end 6202 setValO(self, "sheepy"); 6203 r = cropSmallJsonO(self, 2,-4); 6204 ck_assert_ptr_ne(r, null); 6205 ck_assert_str_eq(sjGet(r), ""); 6206 ck_assert_str_eq(ssGet(self), "sheepy"); 6207 terminateO(r); 6208 // end of string 6209 setValO(self, "sheepy"); 6210 r = cropSmallJsonO(self, 2,6); 6211 ck_assert_ptr_ne(r, null); 6212 ck_assert_str_eq(sjGet(r), "eepy"); 6213 ck_assert_str_eq(ssGet(self), "sh"); 6214 terminateO(r); 6215 // NULL string 6216 freeO(self); 6217 ck_assert_ptr_eq(cropSmallJsonO(self, 2,-4), NULL); 6218 // start outside string 6219 setValO(self, "sheepy"); 6220 ck_assert_ptr_eq(cropSmallJsonO(self, 20,-4), NULL); 6221 // end outside string 6222 setValO(self, "sheepy"); 6223 r = cropSmallJsonO(self, 2,40); 6224 ck_assert_ptr_ne(r, null); 6225 ck_assert_str_eq(sjGet(r), "eepy"); 6226 ck_assert_str_eq(ssGet(self), "sh"); 6227 terminateO(r); 6228 setValO(self, "sheepy"); 6229 r = cropSmallJsonO(self, -22,3); 6230 ck_assert_ptr_ne(r, null); 6231 ck_assert_str_eq(sjGet(r), "she"); 6232 ck_assert_str_eq(ssGet(self), "epy"); 6233 terminateO(r); 6234 setValO(self, "sheepy"); 6235 ck_assert_ptr_eq(cropSmallJsonO(self, 2,-40), NULL); 6236 // end before start 6237 ck_assert_ptr_eq(cropSmallJsonO(self, 4,2), NULL); 6238 terminateO(self); 6239 terminateO(self); 6240 6241 END_TEST 6242 6243 6244 START_TEST(cropElemSmallStringT) 6245 6246 char r; 6247 smallStringt *self = allocG(""); 6248 6249 // crop 6250 setValO(self, "sheepy"); 6251 r = cropElemO(self, 0); 6252 ck_assert_int_eq(r, 's'); 6253 ck_assert_str_eq(ssGet(self), "heepy"); 6254 setValO(self, "sheepy"); 6255 r = cropElemO(self, 5); 6256 ck_assert_int_eq(r, 'y'); 6257 ck_assert_str_eq(ssGet(self), "sheep"); 6258 // negative index 6259 setValO(self, "sheepy"); 6260 r = cropElemO(self, -1); 6261 ck_assert_int_eq(r, 'y'); 6262 ck_assert_str_eq(ssGet(self), "sheep"); 6263 setValO(self, "sheepy"); 6264 r = cropElemO(self, -6); 6265 ck_assert_int_eq(r, 's'); 6266 ck_assert_str_eq(ssGet(self), "heepy"); 6267 // index outside string 6268 setValO(self, "sheepy"); 6269 r = cropElemO(self, 6); 6270 ck_assert_int_eq(r, 0); 6271 ck_assert_str_eq(ssGet(self), "sheepy"); 6272 setValO(self, "sheepy"); 6273 r = cropElemO(self, -7); 6274 ck_assert_int_eq(r, 0); 6275 ck_assert_str_eq(ssGet(self), "sheepy"); 6276 // null string 6277 freeO(self); 6278 ck_assert_int_eq(cropElemO(self, 0), 0); 6279 terminateO(self); 6280 6281 END_TEST 6282 6283 6284 START_TEST(copySmallStringT) 6285 6286 smallStringt* r; 6287 smallStringt *self = allocG(""); 6288 6289 // copy range 6290 setValO(self, "sheepy"); 6291 r = copyRngO(self, 0,2); 6292 ck_assert_ptr_ne(r, null); 6293 ck_assert_str_eq(ssGet(r), "sh"); 6294 ck_assert_str_eq(ssGet(self), "sheepy"); 6295 terminateO(r); 6296 // negative index 6297 r = copyRngO(self, -2,0); 6298 ck_assert_ptr_ne(r, null); 6299 ck_assert_str_eq(ssGet(r), "py"); 6300 ck_assert_str_eq(ssGet(self), "sheepy"); 6301 terminateO(r); 6302 // positive and negative indexes 6303 r = copyRngO(self, 2,-2); 6304 ck_assert_ptr_ne(r, null); 6305 ck_assert_str_eq(ssGet(r), "ee"); 6306 ck_assert_str_eq(ssGet(self), "sheepy"); 6307 terminateO(r); 6308 // start = end 6309 r = copyRngO(self, 2,-4); 6310 ck_assert_ptr_ne(r, null); 6311 ck_assert_str_eq(ssGet(r), ""); 6312 ck_assert_str_eq(ssGet(self), "sheepy"); 6313 terminateO(r); 6314 // end of string 6315 r = copyRngO(self, 2,6); 6316 ck_assert_ptr_ne(r, null); 6317 ck_assert_str_eq(ssGet(r), "eepy"); 6318 ck_assert_str_eq(ssGet(self), "sheepy"); 6319 terminateO(r); 6320 // NULL string 6321 freeO(self); 6322 ck_assert_ptr_eq(copyRngO(self, 2,-4), NULL); 6323 // start outside string 6324 setValO(self, "sheepy"); 6325 ck_assert_ptr_eq(copyRngO(self, 20,-4), NULL); 6326 // end outside string 6327 r = copyRngO(self, 2,40); 6328 ck_assert_ptr_ne(r, null); 6329 ck_assert_str_eq(ssGet(r), "eepy"); 6330 ck_assert_str_eq(ssGet(self), "sheepy"); 6331 terminateO(r); 6332 r = copyRngO(self, -22,3); 6333 ck_assert_ptr_ne(r, null); 6334 ck_assert_str_eq(ssGet(r), "she"); 6335 ck_assert_str_eq(ssGet(self), "sheepy"); 6336 terminateO(r); 6337 ck_assert_ptr_eq(copyRngO(self, 2,-40), NULL); 6338 // end before start 6339 ck_assert_ptr_eq(copyRngO(self, 4,2), NULL); 6340 terminateO(self); 6341 6342 END_TEST 6343 6344 6345 START_TEST(insertSmallStringT) 6346 6347 smallStringt* r; 6348 smallStringt *self = allocG(""); 6349 smallStringt *toInsert = allocSmallString(""); 6350 6351 // insert 6352 setValO(self, "sheepy"); 6353 setValO(toInsert, "lib"); 6354 r = insertO(self, 0, toInsert); 6355 ck_assert_ptr_ne(r, null); 6356 char *s = toStringO(r); 6357 ck_assert_str_eq(s, "libsheepy"); 6358 free(s); 6359 // negative index 6360 setValO(toInsert, "P"); 6361 r = insertO(self, -2, toInsert); 6362 ck_assert_ptr_ne(r, null); 6363 s = toStringO(r); 6364 ck_assert_str_eq(s, "libsheepPy"); 6365 free(s); 6366 // edge 6367 setValO(self, "qwe"); 6368 setValO(toInsert, "C"); 6369 r = insertO(self, 3, toInsert); 6370 ck_assert_ptr_ne(r, null); 6371 s = toStringO(r); 6372 ck_assert_str_eq(s, "qweC"); 6373 free(s); 6374 // outside string 6375 setValO(self, "qwe"); 6376 r = insertO(self, 4, toInsert); 6377 ck_assert_ptr_eq(r, NULL); 6378 r = insertO(self, -5, toInsert); 6379 ck_assert_ptr_eq(r, NULL); 6380 // negative index in a one char string 6381 setValO(self, "s"); 6382 setValO(toInsert, "S"); 6383 r = insertO(self, -1, toInsert); 6384 ck_assert_ptr_ne(r, null); 6385 s = toStringO(r); 6386 ck_assert_str_eq(s, "sS"); 6387 free(s); 6388 // empty string 6389 setValO(self, ""); 6390 setValO(toInsert, "s"); 6391 r = insertO(self, 0, toInsert); 6392 ck_assert_ptr_ne(r, null); 6393 s = toStringO(r); 6394 ck_assert_str_eq(s, "s"); 6395 free(s); 6396 setValO(self, ""); 6397 r = insertO(self, -1, toInsert); 6398 ck_assert_ptr_ne(r, null); 6399 s = toStringO(r); 6400 ck_assert_str_eq(s, "s"); 6401 free(s); 6402 // empty insert string 6403 setValO(self, "a"); 6404 setValO(toInsert, ""); 6405 r = insertO(self, 0, toInsert); 6406 ck_assert_ptr_ne(r, null); 6407 s = toStringO(r); 6408 ck_assert_str_eq(s, "a"); 6409 free(s); 6410 freeO(toInsert); 6411 r = insertO(self, 0, toInsert); 6412 ck_assert_ptr_ne(r, null); 6413 s = toStringO(r); 6414 ck_assert_str_eq(s, "a"); 6415 free(s); 6416 // non smallString toInsert 6417 terminateO(toInsert); 6418 toInsert = (smallStringt*) allocSmallInt(1); 6419 r = insertO(self, 0, toInsert); 6420 ck_assert_ptr_eq(r, null); 6421 terminateO(toInsert); 6422 toInsert = allocSmallString(""); 6423 // NULL insert string 6424 r = insertO(self, 0, NULL); 6425 ck_assert_ptr_eq(r, null); 6426 // NULL string 6427 freeO(self); 6428 setValO(toInsert, "s"); 6429 r = insertO(self, 1, toInsert); 6430 ck_assert_ptr_eq(r, null); 6431 r = insertO(self, 0, toInsert); 6432 ck_assert_ptr_ne(r, null); 6433 s = toStringO(r); 6434 ck_assert_str_eq(s, "s"); 6435 free(s); 6436 terminateO(toInsert); 6437 terminateO(self); 6438 6439 END_TEST 6440 6441 6442 START_TEST(insertSmallJsonSmallStringT) 6443 6444 smallStringt* r; 6445 smallStringt *self = allocG(""); 6446 smallJsont *toInsert = allocSmallJson(); 6447 6448 // insert 6449 setValO(self, "sheepy"); 6450 freeO(toInsert); 6451 setTopSO(toInsert, "lib"); 6452 r = self->f->insertSmallJson(self, 0, toInsert); 6453 ck_assert_ptr_ne(r, null); 6454 char *s = toStringO(r); 6455 ck_assert_str_eq(s, "libsheepy"); 6456 free(s); 6457 // negative index 6458 freeO(toInsert); 6459 setTopSO(toInsert, "P"); 6460 r = self->f->insertSmallJson(self, -2, toInsert); 6461 ck_assert_ptr_ne(r, null); 6462 s = toStringO(r); 6463 ck_assert_str_eq(s, "libsheepPy"); 6464 free(s); 6465 // edge 6466 setValO(self, "qwe"); 6467 freeO(toInsert); 6468 setTopSO(toInsert, "C"); 6469 r = self->f->insertSmallJson(self, 3, toInsert); 6470 ck_assert_ptr_ne(r, null); 6471 s = toStringO(r); 6472 ck_assert_str_eq(s, "qweC"); 6473 free(s); 6474 // outside string 6475 setValO(self, "qwe"); 6476 r = self->f->insertSmallJson(self, 4, toInsert); 6477 ck_assert_ptr_eq(r, NULL); 6478 r = self->f->insertSmallJson(self, -5, toInsert); 6479 ck_assert_ptr_eq(r, NULL); 6480 // negative index in a one char string 6481 setValO(self, "s"); 6482 freeO(toInsert); 6483 setTopSO(toInsert, "S"); 6484 r = self->f->insertSmallJson(self, -1, toInsert); 6485 ck_assert_ptr_ne(r, null); 6486 s = toStringO(r); 6487 ck_assert_str_eq(s, "sS"); 6488 free(s); 6489 // empty string 6490 setValO(self, ""); 6491 freeO(toInsert); 6492 setTopSO(toInsert, "s"); 6493 r = self->f->insertSmallJson(self, 0, toInsert); 6494 ck_assert_ptr_ne(r, null); 6495 s = toStringO(r); 6496 ck_assert_str_eq(s, "s"); 6497 free(s); 6498 setValO(self, ""); 6499 r = self->f->insertSmallJson(self, -1, toInsert); 6500 ck_assert_ptr_ne(r, null); 6501 s = toStringO(r); 6502 ck_assert_str_eq(s, "s"); 6503 free(s); 6504 // empty insert string 6505 setValO(self, "a"); 6506 freeO(toInsert); 6507 setTopSO(toInsert, ""); 6508 r = self->f->insertSmallJson(self, 0, toInsert); 6509 ck_assert_ptr_ne(r, null); 6510 s = toStringO(r); 6511 ck_assert_str_eq(s, "a"); 6512 free(s); 6513 freeO(toInsert); 6514 r = self->f->insertSmallJson(self, 0, toInsert); 6515 ck_assert_ptr_ne(r, null); 6516 s = toStringO(r); 6517 ck_assert_str_eq(s, "a"); 6518 free(s); 6519 // non json string toInsert 6520 freeO(toInsert); 6521 setTopIntO(toInsert, 2); 6522 r = self->f->insertSmallJson(self, 0, toInsert); 6523 ck_assert_ptr_eq(r, null); 6524 // non smallJson toInsert 6525 terminateO(toInsert); 6526 toInsert = (smallJsont*) allocSmallInt(1); 6527 r = self->f->insertSmallJson(self, 0, toInsert); 6528 ck_assert_ptr_eq(r, null); 6529 terminateO(toInsert); 6530 toInsert = allocSmallJson(); 6531 // NULL insert string 6532 r = self->f->insertSmallJson(self, 0, NULL); 6533 ck_assert_ptr_eq(r, null); 6534 // NULL string 6535 freeO(self); 6536 freeO(toInsert); 6537 setTopSO(toInsert, "s"); 6538 r = self->f->insertSmallJson(self, 1, toInsert); 6539 ck_assert_ptr_eq(r, null); 6540 r = self->f->insertSmallJson(self, 0, toInsert); 6541 ck_assert_ptr_ne(r, null); 6542 s = toStringO(r); 6543 ck_assert_str_eq(s, "s"); 6544 free(s); 6545 terminateO(toInsert); 6546 terminateO(self); 6547 6548 END_TEST 6549 6550 6551 START_TEST(insertSSmallStringT) 6552 6553 smallStringt* r; 6554 smallStringt *self = allocG(""); 6555 6556 // insert 6557 setValO(self, "sheepy"); 6558 r = insertSO(self, 0, "lib"); 6559 ck_assert_ptr_ne(r, null); 6560 char *s = toStringO(r); 6561 ck_assert_str_eq(s, "libsheepy"); 6562 free(s); 6563 // negative index 6564 r = insertSO(self, -2, "P"); 6565 ck_assert_ptr_ne(r, null); 6566 s = toStringO(r); 6567 ck_assert_str_eq(s, "libsheepPy"); 6568 free(s); 6569 // edge 6570 setValO(self, "qwe"); 6571 r = insertSO(self, 3, "C"); 6572 ck_assert_ptr_ne(r, null); 6573 s = toStringO(r); 6574 ck_assert_str_eq(s, "qweC"); 6575 free(s); 6576 // outside string 6577 setValO(self, "qwe"); 6578 r = insertSO(self, 4, "C"); 6579 ck_assert_ptr_eq(r, NULL); 6580 r = insertSO(self, -5, "C"); 6581 ck_assert_ptr_eq(r, NULL); 6582 // negative index in a one char string 6583 setValO(self, "s"); 6584 r = insertSO(self, -1, "S"); 6585 ck_assert_ptr_ne(r, null); 6586 s = toStringO(r); 6587 ck_assert_str_eq(s, "sS"); 6588 free(s); 6589 // empty string 6590 setValO(self, ""); 6591 r = insertSO(self, 0, "s"); 6592 ck_assert_ptr_ne(r, null); 6593 s = toStringO(r); 6594 ck_assert_str_eq(s, "s"); 6595 free(s); 6596 setValO(self, ""); 6597 r = insertSO(self, -1, "s"); 6598 ck_assert_ptr_ne(r, null); 6599 s = toStringO(r); 6600 ck_assert_str_eq(s, "s"); 6601 free(s); 6602 // empty insert string 6603 setValO(self, "a"); 6604 r = insertSO(self, 0, ""); 6605 ck_assert_ptr_ne(r, null); 6606 s = toStringO(r); 6607 ck_assert_str_eq(s, "a"); 6608 free(s); 6609 // NULL insert string 6610 r = insertSO(self, 0, NULL); 6611 ck_assert_ptr_ne(r, null); 6612 s = toStringO(r); 6613 ck_assert_str_eq(s, "a"); 6614 free(s); 6615 // NULL string 6616 freeO(self); 6617 r = insertSO(self, 0, "s"); 6618 ck_assert_ptr_ne(r, null); 6619 s = toStringO(r); 6620 ck_assert_str_eq(s, "s"); 6621 free(s); 6622 terminateO(self); 6623 6624 END_TEST 6625 6626 6627 START_TEST(insertNFreeSmallStringT) 6628 6629 smallStringt* r; 6630 smallStringt *self = allocG(""); 6631 smallStringt *toInsert = allocSmallString(""); 6632 6633 // insert 6634 setValO(self, "sheepy"); 6635 setValO(toInsert, "lib"); 6636 r = self->f->insertNFree(self, 0, toInsert); 6637 ck_assert_ptr_ne(r, null); 6638 char *s = toStringO(r); 6639 ck_assert_str_eq(s, "libsheepy"); 6640 free(s); 6641 // negative index 6642 toInsert = allocSmallString("P"); 6643 r = self->f->insertNFree(self, -2, toInsert); 6644 ck_assert_ptr_ne(r, null); 6645 s = toStringO(r); 6646 ck_assert_str_eq(s, "libsheepPy"); 6647 free(s); 6648 // edge 6649 setValO(self, "qwe"); 6650 toInsert = allocSmallString("C"); 6651 r = self->f->insertNFree(self, 3, toInsert); 6652 ck_assert_ptr_ne(r, null); 6653 s = toStringO(r); 6654 ck_assert_str_eq(s, "qweC"); 6655 free(s); 6656 // outside string 6657 setValO(self, "qwe"); 6658 toInsert = allocSmallString("S"); 6659 r = self->f->insertNFree(self, 4, toInsert); 6660 ck_assert_ptr_eq(r, NULL); 6661 r = self->f->insertNFree(self, -5, toInsert); 6662 ck_assert_ptr_eq(r, NULL); 6663 // negative index in a one char string 6664 setValO(self, "s"); 6665 r = self->f->insertNFree(self, -1, toInsert); 6666 ck_assert_ptr_ne(r, null); 6667 s = toStringO(r); 6668 ck_assert_str_eq(s, "sS"); 6669 free(s); 6670 // empty string 6671 setValO(self, ""); 6672 toInsert = allocSmallString("s"); 6673 r = self->f->insertNFree(self, 0, toInsert); 6674 ck_assert_ptr_ne(r, null); 6675 s = toStringO(r); 6676 ck_assert_str_eq(s, "s"); 6677 free(s); 6678 setValO(self, ""); 6679 toInsert = allocSmallString("s"); 6680 r = self->f->insertNFree(self, -1, toInsert); 6681 ck_assert_ptr_ne(r, null); 6682 s = toStringO(r); 6683 ck_assert_str_eq(s, "s"); 6684 free(s); 6685 // empty insert string 6686 setValO(self, "a"); 6687 toInsert = allocSmallString(""); 6688 r = self->f->insertNFree(self, 0, toInsert); 6689 ck_assert_ptr_ne(r, null); 6690 s = toStringO(r); 6691 ck_assert_str_eq(s, "a"); 6692 free(s); 6693 toInsert = allocSmallString(""); 6694 freeO(toInsert); 6695 r = self->f->insertNFree(self, 0, toInsert); 6696 ck_assert_ptr_ne(r, null); 6697 s = toStringO(r); 6698 ck_assert_str_eq(s, "a"); 6699 free(s); 6700 // non smallString toInsert 6701 toInsert = (smallStringt*) allocSmallInt(1); 6702 r = self->f->insertNFree(self, 0, toInsert); 6703 ck_assert_ptr_eq(r, null); 6704 terminateO(toInsert); 6705 toInsert = allocSmallString("s"); 6706 // NULL insert string 6707 r = self->f->insertNFree(self, 0, NULL); 6708 ck_assert_ptr_eq(r, null); 6709 // NULL string 6710 freeO(self); 6711 r = self->f->insertNFree(self, 1, toInsert); 6712 ck_assert_ptr_eq(r, null); 6713 r = self->f->insertNFree(self, 0, toInsert); 6714 ck_assert_ptr_ne(r, null); 6715 s = toStringO(r); 6716 ck_assert_str_eq(s, "s"); 6717 free(s); 6718 terminateO(self); 6719 6720 END_TEST 6721 6722 6723 START_TEST(insertNFreeSmallJsonSmallStringT) 6724 6725 smallStringt* r; 6726 smallStringt *self = allocG(""); 6727 smallJsont *toInsert = allocSmallJson(); 6728 6729 // insert 6730 setValO(self, "sheepy"); 6731 setTopSO(toInsert, "lib"); 6732 r = self->f->insertNFreeSmallJson(self, 0, toInsert); 6733 ck_assert_ptr_ne(r, null); 6734 char *s = toStringO(r); 6735 ck_assert_str_eq(s, "libsheepy"); 6736 free(s); 6737 // negative index 6738 toInsert = allocSmallJson(); 6739 setTopSO(toInsert, "P"); 6740 r = self->f->insertNFreeSmallJson(self, -2, toInsert); 6741 ck_assert_ptr_ne(r, null); 6742 s = toStringO(r); 6743 ck_assert_str_eq(s, "libsheepPy"); 6744 free(s); 6745 // edge 6746 setValO(self, "qwe"); 6747 toInsert = allocSmallJson(); 6748 setTopSO(toInsert, "C"); 6749 r = self->f->insertNFreeSmallJson(self, 3, toInsert); 6750 ck_assert_ptr_ne(r, null); 6751 s = toStringO(r); 6752 ck_assert_str_eq(s, "qweC"); 6753 free(s); 6754 // outside string 6755 setValO(self, "qwe"); 6756 toInsert = allocSmallJson(); 6757 setTopSO(toInsert, "S"); 6758 r = self->f->insertNFreeSmallJson(self, 4, toInsert); 6759 ck_assert_ptr_eq(r, NULL); 6760 r = self->f->insertNFreeSmallJson(self, -5, toInsert); 6761 ck_assert_ptr_eq(r, NULL); 6762 // negative index in a one char string 6763 setValO(self, "s"); 6764 r = self->f->insertNFreeSmallJson(self, -1, toInsert); 6765 ck_assert_ptr_ne(r, null); 6766 s = toStringO(r); 6767 ck_assert_str_eq(s, "sS"); 6768 free(s); 6769 // empty string 6770 setValO(self, ""); 6771 toInsert = allocSmallJson(); 6772 setTopSO(toInsert, "s"); 6773 r = self->f->insertNFreeSmallJson(self, 0, toInsert); 6774 ck_assert_ptr_ne(r, null); 6775 s = toStringO(r); 6776 ck_assert_str_eq(s, "s"); 6777 free(s); 6778 setValO(self, ""); 6779 toInsert = allocSmallJson(); 6780 setTopSO(toInsert, "s"); 6781 r = self->f->insertNFreeSmallJson(self, -1, toInsert); 6782 ck_assert_ptr_ne(r, null); 6783 s = toStringO(r); 6784 ck_assert_str_eq(s, "s"); 6785 free(s); 6786 // empty insert string 6787 setValO(self, "a"); 6788 toInsert = allocSmallJson(); 6789 setTopSO(toInsert, ""); 6790 r = self->f->insertNFreeSmallJson(self, 0, toInsert); 6791 ck_assert_ptr_ne(r, null); 6792 s = toStringO(r); 6793 ck_assert_str_eq(s, "a"); 6794 free(s); 6795 toInsert = allocSmallJson(); 6796 r = self->f->insertNFreeSmallJson(self, 0, toInsert); 6797 ck_assert_ptr_ne(r, null); 6798 s = toStringO(r); 6799 ck_assert_str_eq(s, "a"); 6800 free(s); 6801 // non json string toInsert 6802 toInsert = allocSmallJson(); 6803 setTopIntO(toInsert, 2); 6804 r = self->f->insertNFreeSmallJson(self, 0, toInsert); 6805 ck_assert_ptr_eq(r, null); 6806 // non smallJson toInsert 6807 terminateO(toInsert); 6808 toInsert = (smallJsont*) allocSmallInt(1); 6809 r = self->f->insertNFreeSmallJson(self, 0, toInsert); 6810 ck_assert_ptr_eq(r, null); 6811 terminateO(toInsert); 6812 toInsert = allocSmallJson(); 6813 // NULL insert string 6814 r = self->f->insertNFreeSmallJson(self, 0, NULL); 6815 ck_assert_ptr_eq(r, null); 6816 // NULL string 6817 freeO(self); 6818 setTopSO(toInsert, "s"); 6819 r = self->f->insertNFreeSmallJson(self, 1, toInsert); 6820 ck_assert_ptr_eq(r, null); 6821 r = self->f->insertNFreeSmallJson(self, 0, toInsert); 6822 ck_assert_ptr_ne(r, null); 6823 s = toStringO(r); 6824 ck_assert_str_eq(s, "s"); 6825 free(s); 6826 terminateO(self); 6827 6828 END_TEST 6829 6830 6831 START_TEST(insertSNFreeSmallStringT) 6832 6833 smallStringt* r; 6834 smallStringt *self = allocG(""); 6835 6836 // insert 6837 setValO(self, "sheepy"); 6838 r = insertSNFreeO(self, 0, strdup("lib")); 6839 ck_assert_ptr_ne(r, null); 6840 char *s = toStringO(r); 6841 ck_assert_str_eq(s, "libsheepy"); 6842 free(s); 6843 // negative index 6844 r = insertSNFreeO(self, -2, strdup("P")); 6845 ck_assert_ptr_ne(r, null); 6846 s = toStringO(r); 6847 ck_assert_str_eq(s, "libsheepPy"); 6848 free(s); 6849 // edge 6850 setValO(self, "qwe"); 6851 r = insertSNFreeO(self, 3, strdup("C")); 6852 ck_assert_ptr_ne(r, null); 6853 s = toStringO(r); 6854 ck_assert_str_eq(s, "qweC"); 6855 free(s); 6856 // outside string 6857 setValO(self, "qwe"); 6858 r = insertSNFreeO(self, 4, "C"); 6859 ck_assert_ptr_eq(r, NULL); 6860 r = insertSNFreeO(self, -5, "C"); 6861 ck_assert_ptr_eq(r, NULL); 6862 // negative index in a one char string 6863 setValO(self, "s"); 6864 r = insertSNFreeO(self, -1, strdup("S")); 6865 ck_assert_ptr_ne(r, null); 6866 s = toStringO(r); 6867 ck_assert_str_eq(s, "sS"); 6868 free(s); 6869 // empty string 6870 setValO(self, ""); 6871 r = insertSNFreeO(self, 0, strdup("s")); 6872 ck_assert_ptr_ne(r, null); 6873 s = toStringO(r); 6874 ck_assert_str_eq(s, "s"); 6875 free(s); 6876 setValO(self, ""); 6877 r = insertSNFreeO(self, -1, strdup("s")); 6878 ck_assert_ptr_ne(r, null); 6879 s = toStringO(r); 6880 ck_assert_str_eq(s, "s"); 6881 free(s); 6882 // empty insert string 6883 setValO(self, "a"); 6884 r = insertSNFreeO(self, 0, strdup("")); 6885 ck_assert_ptr_ne(r, null); 6886 s = toStringO(r); 6887 ck_assert_str_eq(s, "a"); 6888 free(s); 6889 // NULL insert string 6890 r = insertSNFreeO(self, 0, NULL); 6891 ck_assert_ptr_ne(r, null); 6892 s = toStringO(r); 6893 ck_assert_str_eq(s, "a"); 6894 free(s); 6895 // NULL string 6896 freeO(self); 6897 r = insertSNFreeO(self, 0, strdup("s")); 6898 ck_assert_ptr_ne(r, null); 6899 s = toStringO(r); 6900 ck_assert_str_eq(s, "s"); 6901 free(s); 6902 terminateO(self); 6903 6904 END_TEST 6905 6906 6907 START_TEST(injectSmallStringT) 6908 6909 smallStringt* r; 6910 smallStringt *self = allocG(""); 6911 6912 // insert 6913 setValO(self, "sheepy"); 6914 r = self->f->inject(self, 0, 'L'); 6915 ck_assert_ptr_ne(r, null); 6916 char *s = toStringO(r); 6917 ck_assert_str_eq(s, "Lsheepy"); 6918 free(s); 6919 // negative index 6920 setValO(self, "libsheepy"); 6921 r = self->f->inject(self, -2, 'P'); 6922 ck_assert_ptr_ne(r, null); 6923 s = toStringO(r); 6924 ck_assert_str_eq(s, "libsheepPy"); 6925 free(s); 6926 // edge 6927 setValO(self, "qwe"); 6928 r = self->f->inject(self, 3, 'C'); 6929 ck_assert_ptr_ne(r, null); 6930 s = toStringO(r); 6931 ck_assert_str_eq(s, "qweC"); 6932 free(s); 6933 // outside string 6934 setValO(self, "qwe"); 6935 r = self->f->inject(self, 4, 'C'); 6936 ck_assert_ptr_eq(r, NULL); 6937 r = self->f->inject(self, -5, 'C'); 6938 ck_assert_ptr_eq(r, NULL); 6939 // negative index in a one char string 6940 setValO(self, "s"); 6941 r = self->f->inject(self, -2, 'S'); 6942 ck_assert_ptr_ne(r, null); 6943 s = toStringO(r); 6944 ck_assert_str_eq(s, "Ss"); 6945 free(s); 6946 // empty string 6947 setValO(self, ""); 6948 r = self->f->inject(self, 0, 's'); 6949 ck_assert_ptr_ne(r, null); 6950 s = toStringO(r); 6951 ck_assert_str_eq(s, "s"); 6952 free(s); 6953 setValO(self, ""); 6954 r = self->f->inject(self, -1, 's'); 6955 ck_assert_ptr_ne(r, null); 6956 s = toStringO(r); 6957 ck_assert_str_eq(s, "s"); 6958 free(s); 6959 // NULL string 6960 freeO(self); 6961 r = self->f->inject(self, 1, 's'); 6962 ck_assert_ptr_eq(r, NULL); 6963 r = self->f->inject(self, 0, 's'); 6964 ck_assert_ptr_ne(r, null); 6965 s = toStringO(r); 6966 ck_assert_str_eq(s, "s"); 6967 free(s); 6968 terminateO(self); 6969 6970 END_TEST 6971 6972 6973 START_TEST(delSmallStringT) 6974 6975 smallStringt* r; 6976 smallStringt *self = allocG(""); 6977 6978 // del 6979 setValO(self, "sheepy"); 6980 r = delO(self, 0,2); 6981 ck_assert_ptr_ne(r, null); 6982 char *s = toStringO(r); 6983 ck_assert_str_eq(s, "eepy"); 6984 free(s); 6985 // negative index 6986 setValO(self, "sheepy"); 6987 r = delO(self, -2,0); 6988 ck_assert_ptr_ne(r, null); 6989 s = toStringO(r); 6990 ck_assert_str_eq(s, "shee"); 6991 free(s); 6992 // positive and negative indexes 6993 setValO(self, "sheepy"); 6994 r = delO(self, 2,-2); 6995 ck_assert_ptr_ne(r, null); 6996 s = toStringO(r); 6997 ck_assert_str_eq(s, "shpy"); 6998 free(s); 6999 // start = end 7000 setValO(self, "sheepy"); 7001 r = delO(self, 2,-4); 7002 ck_assert_ptr_ne(r, null); 7003 s = toStringO(r); 7004 ck_assert_str_eq(s, "sheepy"); 7005 free(s); 7006 // delete entire string 7007 setValO(self, "sheepy"); 7008 r = delO(self, 0,0); 7009 ck_assert_ptr_ne(r, null); 7010 s = toStringO(r); 7011 ck_assert_str_eq(s, ""); 7012 free(s); 7013 // end of string 7014 setValO(self, "sheepy"); 7015 r = delO(self, 2,6); 7016 ck_assert_ptr_ne(r, null); 7017 s = toStringO(r); 7018 ck_assert_str_eq(s, "sh"); 7019 free(s); 7020 // NULL string 7021 freeO(self); 7022 r = delO(self, 2,-4); 7023 ck_assert_ptr_eq(r, NULL); 7024 // start outside string 7025 setValO(self, "sheepy"); 7026 r = delO(self, 20,-4); 7027 ck_assert_ptr_eq(r, null); 7028 s = toStringO(self); 7029 ck_assert_str_eq(s, "sheepy"); 7030 free(s); 7031 r = delO(self, -20,-4); 7032 ck_assert_ptr_ne(r, null); 7033 s = toStringO(r); 7034 ck_assert_str_eq(s, "eepy"); 7035 free(s); 7036 // end outside string 7037 setValO(self, "sheepy"); 7038 r = delO(self, 2,40); 7039 ck_assert_ptr_ne(r, null); 7040 s = toStringO(r); 7041 ck_assert_str_eq(s, "sh"); 7042 free(s); 7043 setValO(self, "sheepy"); 7044 r = delO(self, 2,-40); 7045 ck_assert_ptr_eq(r, null); 7046 s = toStringO(self); 7047 ck_assert_str_eq(s, "sheepy"); 7048 free(s); 7049 // end before start 7050 setValO(self, "sheepy"); 7051 r = delO(self, 4,2); 7052 ck_assert_ptr_eq(r, null); 7053 s = toStringO(self); 7054 ck_assert_str_eq(s, "sheepy"); 7055 free(s); 7056 terminateO(self); 7057 7058 END_TEST 7059 7060 7061 START_TEST(delElemSmallStringT) 7062 7063 smallStringt* r; 7064 smallStringt *self = allocG(""); 7065 7066 // del 7067 setValO(self, "sheepy"); 7068 r = delElemO(self, 0); 7069 ck_assert_ptr_ne(r, null); 7070 char *s = toStringO(r); 7071 ck_assert_str_eq(s, "heepy"); 7072 free(s); 7073 setValO(self, "sheepy"); 7074 r = delElemO(self, 5); 7075 ck_assert_ptr_ne(r, null); 7076 s = toStringO(r); 7077 ck_assert_str_eq(s, "sheep"); 7078 free(s); 7079 // negative index 7080 setValO(self, "sheepy"); 7081 r = delElemO(self, -1); 7082 ck_assert_ptr_ne(r, null); 7083 s = toStringO(r); 7084 ck_assert_str_eq(s, "sheep"); 7085 free(s); 7086 setValO(self, "sheepy"); 7087 r = delElemO(self, -6); 7088 ck_assert_ptr_ne(r, null); 7089 s = toStringO(r); 7090 ck_assert_str_eq(s, "heepy"); 7091 free(s); 7092 // index outside string 7093 setValO(self, "sheepy"); 7094 r = delElemO(self, 6); 7095 ck_assert_ptr_eq(r, null); 7096 r = delElemO(self, -7); 7097 ck_assert_ptr_eq(r, null); 7098 // empty string 7099 setValO(self, ""); 7100 ck_assert_ptr_eq(delElemO(self, 0), null); 7101 // null string 7102 freeO(self); 7103 ck_assert_ptr_eq(delElemO(self, 0), null); 7104 terminateO(self); 7105 7106 END_TEST 7107 7108 7109 START_TEST(hasSmallStringT) 7110 7111 smallStringt *self = allocG(""); 7112 7113 // find string in the middle 7114 setValO(self, "sheepy"); 7115 ck_assert_str_eq(hasO(self, "ee"), "eepy"); 7116 // find non existing string 7117 ck_assert_ptr_eq(hasO(self, "$"), NULL); 7118 // find NULL 7119 ck_assert_ptr_eq(hasO(self, NULL), NULL); 7120 // empty string 7121 setValO(self, ""); 7122 ck_assert_ptr_eq(hasO(self, "$"), NULL); 7123 // NULL string 7124 freeO(self); 7125 ck_assert_ptr_eq(hasO(self, "$"), NULL); 7126 terminateO(self); 7127 7128 END_TEST 7129 7130 7131 START_TEST(hasCharSmallStringT) 7132 7133 smallStringt *self = allocG(""); 7134 7135 // find string in the middle 7136 setValO(self, "sheepy"); 7137 ck_assert_str_eq(hasCharO(self, 'e'), "eepy"); 7138 // find non existing string 7139 ck_assert_ptr_eq(hasCharO(self, '$'), NULL); 7140 // find 0 7141 ck_assert_str_eq(hasCharO(self, 0), ""); 7142 // empty string 7143 setValO(self, ""); 7144 ck_assert_ptr_eq(hasCharO(self, '$'), NULL); 7145 // NULL string 7146 freeO(self); 7147 ck_assert_ptr_eq(hasCharO(self, '$'), NULL); 7148 terminateO(self); 7149 7150 END_TEST 7151 7152 7153 START_TEST(hasSmallJsonSmallStringT) 7154 7155 smallStringt *self = allocG(""); 7156 smallJsont *needle = allocSmallJson(); 7157 7158 // find string in the middle 7159 setValO(self, "sheepy"); 7160 setTopSO(needle, "ee"); 7161 ck_assert_str_eq(self->f->hasSmallJson(self, needle), "eepy"); 7162 // find non existing string 7163 freeO(needle); 7164 setTopSO(needle, "$"); 7165 ck_assert_ptr_eq(self->f->hasSmallJson(self, needle), NULL); 7166 // non json string 7167 freeO(needle); 7168 ck_assert_ptr_eq(self->f->hasSmallJson(self, needle), NULL); 7169 // non json object 7170 terminateO(needle); 7171 needle = (smallJsont*) allocSmallInt(1); 7172 ck_assert_ptr_eq(self->f->hasSmallJson(self, needle), NULL); 7173 terminateO(needle); 7174 // find NULL 7175 ck_assert_ptr_eq(self->f->hasSmallJson(self, NULL), NULL); 7176 // empty string 7177 setValO(self, ""); 7178 needle = allocSmallJson(); 7179 setTopSO(needle, "$"); 7180 ck_assert_ptr_eq(self->f->hasSmallJson(self, needle), NULL); 7181 // NULL string 7182 freeO(self); 7183 ck_assert_ptr_eq(self->f->hasSmallJson(self, needle), NULL); 7184 terminateO(needle); 7185 terminateO(self); 7186 7187 END_TEST 7188 7189 7190 START_TEST(hasSmallStringSmallStringT) 7191 7192 smallStringt *self = allocG(""); 7193 smallStringt *needle = allocSmallString("ee"); 7194 7195 // find string in the middle 7196 setValO(self, "sheepy"); 7197 ck_assert_str_eq(self->f->hasSmallString(self, needle), "eepy"); 7198 // find non existing string 7199 setValO(needle, "$"); 7200 ck_assert_ptr_eq(self->f->hasSmallString(self, needle), NULL); 7201 // non smallString object 7202 terminateO(needle); 7203 needle = (smallStringt*) allocSmallInt(1); 7204 ck_assert_ptr_eq(self->f->hasSmallString(self, needle), NULL); 7205 terminateO(needle); 7206 // find NULL 7207 ck_assert_ptr_eq(self->f->hasSmallString(self, NULL), NULL); 7208 // empty string 7209 setValO(self, ""); 7210 needle = allocSmallString("$"); 7211 ck_assert_ptr_eq(self->f->hasSmallString(self, needle), NULL); 7212 // NULL string 7213 freeO(self); 7214 ck_assert_ptr_eq(self->f->hasSmallString(self, needle), NULL); 7215 terminateO(needle); 7216 terminateO(self); 7217 7218 END_TEST 7219 7220 7221 START_TEST(findSmallStringT) 7222 7223 smallStringt* r; 7224 smallStringt *self = allocG(""); 7225 7226 // find string in the middle 7227 setValO(self, "sheepy"); 7228 r = findO(self, "ee"); 7229 ck_assert_ptr_ne(r, null); 7230 ck_assert_str_eq(ssGet(r), "eepy"); 7231 terminateO(r); 7232 // find non existing string 7233 ck_assert_ptr_eq(findO(self, "$"), NULL); 7234 // find NULL 7235 ck_assert_ptr_eq(findO(self, NULL), NULL); 7236 // empty string 7237 setValO(self, ""); 7238 ck_assert_ptr_eq(findO(self, "$"), NULL); 7239 // NULL string 7240 freeO(self); 7241 ck_assert_ptr_eq(findO(self, "$"), NULL); 7242 terminateO(self); 7243 7244 END_TEST 7245 7246 7247 START_TEST(findCharSmallStringT) 7248 7249 smallStringt* r; 7250 smallStringt *self = allocG(""); 7251 7252 // find string in the middle 7253 setValO(self, "sheepy"); 7254 r = findCharO(self, 'e'); 7255 ck_assert_ptr_ne(r, null); 7256 ck_assert_str_eq(ssGet(r), "eepy"); 7257 terminateO(r); 7258 // find non existing string 7259 ck_assert_ptr_eq(findCharO(self, '$'), NULL); 7260 // find 0 7261 r = findCharO(self, 0); 7262 ck_assert_ptr_ne(r, null); 7263 ck_assert_str_eq(ssGet(r), ""); 7264 terminateO(r); 7265 // empty string 7266 setValO(self, ""); 7267 ck_assert_ptr_eq(findCharO(self, '$'), NULL); 7268 // NULL string 7269 freeO(self); 7270 ck_assert_ptr_eq(findCharO(self, '$'), NULL); 7271 terminateO(self); 7272 7273 END_TEST 7274 7275 7276 START_TEST(findSmallJsonSmallStringT) 7277 7278 smallStringt* r; 7279 smallStringt *self = allocG(""); 7280 smallJsont *needle = allocSmallJson(); 7281 7282 // find string in the middle 7283 setValO(self, "sheepy"); 7284 setTopSO(needle, "ee"); 7285 r = self->f->findSmallJson(self, needle); 7286 ck_assert_ptr_ne(r, null); 7287 ck_assert_str_eq(ssGet(r), "eepy"); 7288 terminateO(r); 7289 // find non existing string 7290 freeO(needle); 7291 setTopSO(needle, "$"); 7292 ck_assert_ptr_eq(self->f->findSmallJson(self, needle), NULL); 7293 // non json string 7294 freeO(needle); 7295 ck_assert_ptr_eq(self->f->findSmallJson(self, needle), NULL); 7296 // non json object 7297 terminateO(needle); 7298 needle = (smallJsont*) allocSmallInt(1); 7299 ck_assert_ptr_eq(self->f->findSmallJson(self, needle), NULL); 7300 terminateO(needle); 7301 // find NULL 7302 ck_assert_ptr_eq(self->f->findSmallJson(self, NULL), NULL); 7303 // empty string 7304 setValO(self, ""); 7305 needle = allocSmallJson(); 7306 setTopSO(needle, "$"); 7307 ck_assert_ptr_eq(self->f->findSmallJson(self, needle), NULL); 7308 // NULL string 7309 freeO(self); 7310 ck_assert_ptr_eq(self->f->findSmallJson(self, needle), NULL); 7311 terminateO(needle); 7312 terminateO(self); 7313 7314 END_TEST 7315 7316 7317 START_TEST(findSmallStringSmallStringT) 7318 7319 smallStringt* r; 7320 smallStringt *self = allocG(""); 7321 smallStringt *needle = allocSmallString("ee"); 7322 7323 // find string in the middle 7324 setValO(self, "sheepy"); 7325 r = self->f->findSmallString(self, needle); 7326 ck_assert_ptr_ne(r, null); 7327 ck_assert_str_eq(ssGet(r), "eepy"); 7328 terminateO(r); 7329 // find non existing string 7330 setValO(needle, "$"); 7331 ck_assert_ptr_eq(self->f->findSmallString(self, needle), NULL); 7332 // non smallString object 7333 terminateO(needle); 7334 needle = (smallStringt*) allocSmallInt(1); 7335 ck_assert_ptr_eq(self->f->findSmallString(self, needle), NULL); 7336 terminateO(needle); 7337 // find NULL 7338 ck_assert_ptr_eq(self->f->findSmallString(self, NULL), NULL); 7339 // empty string 7340 setValO(self, ""); 7341 needle = allocSmallString("$"); 7342 ck_assert_ptr_eq(self->f->findSmallString(self, needle), NULL); 7343 // NULL string 7344 freeO(self); 7345 ck_assert_ptr_eq(self->f->findSmallString(self, needle), NULL); 7346 terminateO(needle); 7347 terminateO(self); 7348 7349 END_TEST 7350 7351 7352 START_TEST(indexOfSmallStringT) 7353 7354 smallStringt *self = allocG(""); 7355 7356 // indexOf string in the middle 7357 setValO(self, "sheepy"); 7358 ck_assert_int_eq(indexOfO(self, "ee"), 2); 7359 // indexOf non existing string 7360 ck_assert_int_eq(indexOfO(self, "$"), -1); 7361 // indexOf NULL 7362 ck_assert_int_eq(indexOfO(self, NULL), -1); 7363 // NULL string 7364 freeO(self); 7365 ck_assert_int_eq(indexOfO(self, "$"), -1); 7366 terminateO(self); 7367 7368 END_TEST 7369 7370 7371 START_TEST(indexOfCharSmallStringT) 7372 7373 smallStringt *self = allocG(""); 7374 7375 // indexOf string in the middle 7376 setValO(self, "sheepy"); 7377 ck_assert_int_eq(indexOfCharO(self, 'e'), 2); 7378 // indexOf non existing string 7379 ck_assert_int_eq(indexOfCharO(self, '$'), -1); 7380 // indexOf 0 7381 ck_assert_int_eq(indexOfCharO(self, 0), 6); 7382 // NULL string 7383 freeO(self); 7384 ck_assert_int_eq(indexOfCharO(self, '$'), -1); 7385 terminateO(self); 7386 7387 END_TEST 7388 7389 7390 START_TEST(indexOfSmallJsonSmallStringT) 7391 7392 smallStringt *self = allocG(""); 7393 smallJsont *needle = allocSmallJson(); 7394 7395 // indexOf string in the middle 7396 setValO(self, "sheepy"); 7397 setTopSO(needle, "ee"); 7398 ck_assert_int_eq(self->f->indexOfSmallJson(self, needle), 2); 7399 // indexOf non existing string 7400 freeO(needle); 7401 setTopSO(needle, "$"); 7402 ck_assert_int_eq(self->f->indexOfSmallJson(self, needle), -1); 7403 // non json string 7404 freeO(needle); 7405 ck_assert_int_eq(self->f->indexOfSmallJson(self, needle), -1); 7406 // non json object 7407 terminateO(needle); 7408 needle = (smallJsont*) allocSmallInt(1); 7409 ck_assert_int_eq(self->f->indexOfSmallJson(self, needle), -1); 7410 terminateO(needle); 7411 // indexOf NULL 7412 ck_assert_int_eq(self->f->indexOfSmallJson(self, NULL), -1); 7413 // empty string 7414 setValO(self, ""); 7415 needle = allocSmallJson(); 7416 setTopSO(needle, "$"); 7417 ck_assert_int_eq(self->f->indexOfSmallJson(self, needle), -1); 7418 // NULL string 7419 freeO(self); 7420 ck_assert_int_eq(self->f->indexOfSmallJson(self, needle), -1); 7421 terminateO(needle); 7422 terminateO(self); 7423 7424 END_TEST 7425 7426 7427 START_TEST(indexOfSmallStringSmallStringT) 7428 7429 smallStringt *self = allocG(""); 7430 smallStringt *needle = allocSmallString("ee"); 7431 7432 // indexOf string in the middle 7433 setValO(self, "sheepy"); 7434 ck_assert_int_eq(self->f->indexOfSmallString(self, needle), 2); 7435 // indexOf non existing string 7436 setValO(needle, "$"); 7437 ck_assert_int_eq(self->f->indexOfSmallString(self, needle), -1); 7438 // non smallString object 7439 terminateO(needle); 7440 needle = (smallStringt*) allocSmallInt(1); 7441 ck_assert_int_eq(self->f->indexOfSmallString(self, needle), -1); 7442 terminateO(needle); 7443 // indexOf NULL 7444 ck_assert_int_eq(self->f->indexOfSmallString(self, NULL), -1); 7445 // empty string 7446 setValO(self, ""); 7447 needle = allocSmallString("$"); 7448 ck_assert_int_eq(self->f->indexOfSmallString(self, needle), -1); 7449 // NULL string 7450 freeO(self); 7451 ck_assert_int_eq(self->f->indexOfSmallString(self, needle), -1); 7452 terminateO(needle); 7453 terminateO(self); 7454 7455 END_TEST 7456 7457 7458 START_TEST(icHasSmallStringT) 7459 7460 smallStringt *self = allocG(""); 7461 7462 // find string in the middle 7463 setValO(self, "sheepy"); 7464 ck_assert_str_eq(icHasO(self, "EE"), "eepy"); 7465 // find non existing string 7466 ck_assert_ptr_eq(icHasO(self, "$"), NULL); 7467 // find NULL 7468 ck_assert_ptr_eq(icHasO(self, NULL), NULL); 7469 // empty string 7470 setValO(self, ""); 7471 ck_assert_ptr_eq(icHasO(self, "$"), NULL); 7472 // NULL string 7473 freeO(self); 7474 ck_assert_ptr_eq(icHasO(self, "$"), NULL); 7475 terminateO(self); 7476 7477 END_TEST 7478 7479 7480 START_TEST(icHasCharSmallStringT) 7481 7482 smallStringt *self = allocG(""); 7483 7484 // find string in the middle 7485 setValO(self, "sheepy"); 7486 ck_assert_str_eq(icHasCharO(self, 'E'), "eepy"); 7487 // find non existing string 7488 ck_assert_ptr_eq(icHasCharO(self, '$'), NULL); 7489 // find 0 7490 ck_assert_str_eq(icHasCharO(self, 0), ""); 7491 // empty string 7492 setValO(self, ""); 7493 ck_assert_ptr_eq(icHasCharO(self, '$'), NULL); 7494 ck_assert_ptr_eq(icHasCharO(self, 0), NULL); 7495 // NULL string 7496 freeO(self); 7497 ck_assert_ptr_eq(icHasCharO(self, '$'), NULL); 7498 ck_assert_ptr_eq(icHasCharO(self, 0), NULL); 7499 terminateO(self); 7500 7501 END_TEST 7502 7503 7504 START_TEST(icHasSmallJsonSmallStringT) 7505 7506 smallStringt *self = allocG(""); 7507 smallJsont *needle = allocSmallJson(); 7508 7509 // find string in the middle 7510 setValO(self, "sheepy"); 7511 setTopSO(needle, "EE"); 7512 ck_assert_str_eq(self->f->icHasSmallJson(self, needle), "eepy"); 7513 // find non existing string 7514 freeO(needle); 7515 setTopSO(needle, "$"); 7516 ck_assert_ptr_eq(self->f->icHasSmallJson(self, needle), NULL); 7517 // non json string 7518 freeO(needle); 7519 ck_assert_ptr_eq(self->f->icHasSmallJson(self, needle), NULL); 7520 // non json object 7521 terminateO(needle); 7522 needle = (smallJsont*) allocSmallInt(1); 7523 ck_assert_ptr_eq(self->f->icHasSmallJson(self, needle), NULL); 7524 terminateO(needle); 7525 // find NULL 7526 ck_assert_ptr_eq(self->f->icHasSmallJson(self, NULL), NULL); 7527 // empty string 7528 setValO(self, ""); 7529 needle = allocSmallJson(); 7530 setTopSO(needle, "$"); 7531 ck_assert_ptr_eq(self->f->icHasSmallJson(self, needle), NULL); 7532 // NULL string 7533 freeO(self); 7534 ck_assert_ptr_eq(self->f->icHasSmallJson(self, needle), NULL); 7535 terminateO(needle); 7536 terminateO(self); 7537 7538 END_TEST 7539 7540 7541 START_TEST(icHasSmallStringSmallStringT) 7542 7543 smallStringt *self = allocG(""); 7544 smallStringt *needle = allocSmallString("EE"); 7545 7546 // find string in the middle 7547 setValO(self, "sheepy"); 7548 ck_assert_str_eq(self->f->icHasSmallString(self, needle), "eepy"); 7549 // find non existing string 7550 setValO(needle, "$"); 7551 ck_assert_ptr_eq(self->f->icHasSmallString(self, needle), NULL); 7552 // non smallString object 7553 terminateO(needle); 7554 needle = (smallStringt*) allocSmallInt(1); 7555 ck_assert_ptr_eq(self->f->icHasSmallString(self, needle), NULL); 7556 terminateO(needle); 7557 // find NULL 7558 ck_assert_ptr_eq(self->f->icHasSmallString(self, NULL), NULL); 7559 // empty string 7560 setValO(self, ""); 7561 needle = allocSmallString("$"); 7562 ck_assert_ptr_eq(self->f->icHasSmallString(self, needle), NULL); 7563 // NULL string 7564 freeO(self); 7565 ck_assert_ptr_eq(self->f->icHasSmallString(self, needle), NULL); 7566 terminateO(needle); 7567 terminateO(self); 7568 7569 END_TEST 7570 7571 7572 START_TEST(icFindSmallStringT) 7573 7574 smallStringt* r; 7575 smallStringt *self = allocG(""); 7576 7577 // icFind string in the middle 7578 setValO(self, "sheepy"); 7579 r = icFindO(self, "EE"); 7580 ck_assert_ptr_ne(r, null); 7581 ck_assert_str_eq(ssGet(r), "eepy"); 7582 terminateO(r); 7583 // find non existing string 7584 ck_assert_ptr_eq(icFindO(self, "$"), NULL); 7585 // find NULL 7586 ck_assert_ptr_eq(icFindO(self, NULL), NULL); 7587 // empty string 7588 setValO(self, ""); 7589 ck_assert_ptr_eq(icFindO(self, "$"), NULL); 7590 // NULL string 7591 freeO(self); 7592 ck_assert_ptr_eq(icFindO(self, "$"), NULL); 7593 terminateO(self); 7594 7595 END_TEST 7596 7597 7598 START_TEST(icFindCharSmallStringT) 7599 7600 smallStringt* r; 7601 smallStringt *self = allocG(""); 7602 7603 // find string in the middle 7604 setValO(self, "sheepy"); 7605 r = icFindCharO(self, 'E'); 7606 ck_assert_ptr_ne(r, null); 7607 ck_assert_str_eq(ssGet(r), "eepy"); 7608 terminateO(r); 7609 // find non existing string 7610 ck_assert_ptr_eq(icFindCharO(self, '$'), NULL); 7611 // find 0 7612 r = icFindCharO(self, 0); 7613 ck_assert_ptr_ne(r, null); 7614 ck_assert_str_eq(ssGet(r), ""); 7615 terminateO(r); 7616 // empty string 7617 setValO(self, ""); 7618 ck_assert_ptr_eq(icFindCharO(self, '$'), NULL); 7619 ck_assert_ptr_eq(icFindCharO(self, 0), NULL); 7620 // NULL string 7621 freeO(self); 7622 ck_assert_ptr_eq(icFindCharO(self, '$'), NULL); 7623 ck_assert_ptr_eq(icFindCharO(self, 0), NULL); 7624 terminateO(self); 7625 7626 END_TEST 7627 7628 7629 START_TEST(icFindSmallJsonSmallStringT) 7630 7631 smallStringt* r; 7632 smallStringt *self = allocG(""); 7633 smallJsont *needle = allocSmallJson(); 7634 7635 // find string in the middle 7636 setValO(self, "sheepy"); 7637 setTopSO(needle, "EE"); 7638 r = self->f->icFindSmallJson(self, needle); 7639 ck_assert_ptr_ne(r, null); 7640 ck_assert_str_eq(ssGet(r), "eepy"); 7641 terminateO(r); 7642 // find non existing string 7643 freeO(needle); 7644 setTopSO(needle, "$"); 7645 ck_assert_ptr_eq(self->f->icFindSmallJson(self, needle), NULL); 7646 // non json string 7647 freeO(needle); 7648 ck_assert_ptr_eq(self->f->icFindSmallJson(self, needle), NULL); 7649 // non json object 7650 terminateO(needle); 7651 needle = (smallJsont*) allocSmallInt(1); 7652 ck_assert_ptr_eq(self->f->icFindSmallJson(self, needle), NULL); 7653 terminateO(needle); 7654 // find NULL 7655 ck_assert_ptr_eq(self->f->icFindSmallJson(self, NULL), NULL); 7656 // empty string 7657 setValO(self, ""); 7658 needle = allocSmallJson(); 7659 setTopSO(needle, "$"); 7660 ck_assert_ptr_eq(self->f->icFindSmallJson(self, needle), NULL); 7661 // NULL string 7662 freeO(self); 7663 ck_assert_ptr_eq(self->f->icFindSmallJson(self, needle), NULL); 7664 terminateO(needle); 7665 terminateO(self); 7666 7667 END_TEST 7668 7669 7670 START_TEST(icFindSmallStringSmallStringT) 7671 7672 smallStringt* r; 7673 smallStringt *self = allocG(""); 7674 smallStringt *needle = allocSmallString("EE"); 7675 7676 // find string in the middle 7677 setValO(self, "sheepy"); 7678 r = self->f->icFindSmallString(self, needle); 7679 ck_assert_ptr_ne(r, null); 7680 ck_assert_str_eq(ssGet(r), "eepy"); 7681 terminateO(r); 7682 // find non existing string 7683 setValO(needle, "$"); 7684 ck_assert_ptr_eq(self->f->icFindSmallString(self, needle), NULL); 7685 // non smallString object 7686 terminateO(needle); 7687 needle = (smallStringt*) allocSmallInt(1); 7688 ck_assert_ptr_eq(self->f->icFindSmallString(self, needle), NULL); 7689 terminateO(needle); 7690 // find NULL 7691 ck_assert_ptr_eq(self->f->icFindSmallString(self, NULL), NULL); 7692 // empty string 7693 setValO(self, ""); 7694 needle = allocSmallString("$"); 7695 ck_assert_ptr_eq(self->f->icFindSmallString(self, needle), NULL); 7696 // NULL string 7697 freeO(self); 7698 ck_assert_ptr_eq(self->f->icFindSmallString(self, needle), NULL); 7699 terminateO(needle); 7700 terminateO(self); 7701 7702 END_TEST 7703 7704 7705 START_TEST(icIndexOfSmallStringT) 7706 7707 smallStringt *self = allocG(""); 7708 7709 // indexOf string in the middle 7710 setValO(self, "sheepy"); 7711 ck_assert_int_eq(icIndexOfO(self, "EE"), 2); 7712 // indexOf non existing string 7713 ck_assert_int_eq(icIndexOfO(self, "$"), -1); 7714 // indexOf NULL 7715 ck_assert_int_eq(icIndexOfO(self, NULL), -1); 7716 // NULL string 7717 freeO(self); 7718 ck_assert_int_eq(icIndexOfO(self, "$"), -1); 7719 terminateO(self); 7720 7721 END_TEST 7722 7723 7724 START_TEST(icIndexOfCharSmallStringT) 7725 7726 smallStringt *self = allocG(""); 7727 7728 // indexOf string in the middle 7729 setValO(self, "sheepy"); 7730 ck_assert_int_eq(icIndexOfCharO(self, 'E'), 2); 7731 // indexOf non existing string 7732 ck_assert_int_eq(icIndexOfCharO(self, '$'), -1); 7733 // indexOf 0 7734 ck_assert_int_eq(icIndexOfCharO(self, 0), 6); 7735 // NULL string 7736 freeO(self); 7737 ck_assert_int_eq(icIndexOfCharO(self, '$'), -1); 7738 terminateO(self); 7739 7740 END_TEST 7741 7742 7743 START_TEST(icIndexOfSmallJsonSmallStringT) 7744 7745 smallStringt *self = allocG(""); 7746 smallJsont *needle = allocSmallJson(); 7747 7748 // indexOf string in the middle 7749 setValO(self, "sheepy"); 7750 setTopSO(needle, "EE"); 7751 ck_assert_int_eq(self->f->icIndexOfSmallJson(self, needle), 2); 7752 // indexOf non existing string 7753 freeO(needle); 7754 setTopSO(needle, "$"); 7755 ck_assert_int_eq(self->f->icIndexOfSmallJson(self, needle), -1); 7756 // non json string 7757 freeO(needle); 7758 ck_assert_int_eq(self->f->icIndexOfSmallJson(self, needle), -1); 7759 // non json object 7760 terminateO(needle); 7761 needle = (smallJsont*) allocSmallInt(1); 7762 ck_assert_int_eq(self->f->icIndexOfSmallJson(self, needle), -1); 7763 terminateO(needle); 7764 // indexOf NULL 7765 ck_assert_int_eq(self->f->icIndexOfSmallJson(self, NULL), -1); 7766 // empty string 7767 setValO(self, ""); 7768 needle = allocSmallJson(); 7769 setTopSO(needle, "$"); 7770 ck_assert_int_eq(self->f->icIndexOfSmallJson(self, needle), -1); 7771 // NULL string 7772 freeO(self); 7773 ck_assert_int_eq(self->f->icIndexOfSmallJson(self, needle), -1); 7774 terminateO(needle); 7775 terminateO(self); 7776 7777 END_TEST 7778 7779 7780 START_TEST(icIndexOfSmallStringSmallStringT) 7781 7782 smallStringt *self = allocG(""); 7783 smallStringt *needle = allocSmallString("EE"); 7784 7785 // indexOf string in the middle 7786 setValO(self, "sheepy"); 7787 ck_assert_int_eq(self->f->icIndexOfSmallString(self, needle), 2); 7788 // indexOf non existing string 7789 setValO(needle, "$"); 7790 ck_assert_int_eq(self->f->icIndexOfSmallString(self, needle), -1); 7791 // non smallString object 7792 terminateO(needle); 7793 needle = (smallStringt*) allocSmallInt(1); 7794 ck_assert_int_eq(self->f->icIndexOfSmallString(self, needle), -1); 7795 terminateO(needle); 7796 // indexOf NULL 7797 ck_assert_int_eq(self->f->icIndexOfSmallString(self, NULL), -1); 7798 // empty string 7799 setValO(self, ""); 7800 needle = allocSmallString("$"); 7801 ck_assert_int_eq(self->f->icIndexOfSmallString(self, needle), -1); 7802 // NULL string 7803 freeO(self); 7804 ck_assert_int_eq(self->f->icIndexOfSmallString(self, needle), -1); 7805 terminateO(needle); 7806 terminateO(self); 7807 7808 END_TEST 7809 7810 7811 START_TEST(emptySmallStringT) 7812 7813 smallStringt* r; 7814 smallStringt *self = allocG("qwe"); 7815 7816 r = emptyO(self); 7817 ck_assert_ptr_ne(r, null); 7818 char *s = toStringO(r); 7819 ck_assert_str_eq(s, ""); 7820 free(s); 7821 terminateO(self); 7822 7823 END_TEST 7824 7825 7826 START_TEST(isEmptySmallStringT) 7827 7828 smallStringt *self = allocG("qwe"); 7829 7830 ck_assert(!isEmptyO(self)); 7831 emptyO(self); 7832 ck_assert(isEmptyO(self)); 7833 freeO(self); 7834 ck_assert(isEmptyO(self)); 7835 terminateO(self); 7836 7837 END_TEST 7838 7839 7840 START_TEST(isBlankSmallStringT) 7841 7842 smallStringt *self = allocG("q w"); 7843 7844 ck_assert(!isBlankO(self)); 7845 setValO(self, " "); 7846 ck_assert(isBlankO(self)); 7847 emptyO(self); 7848 ck_assert(isBlankO(self)); 7849 freeO(self); 7850 ck_assert(isBlankO(self)); 7851 terminateO(self); 7852 7853 END_TEST 7854 7855 7856 START_TEST(splitSmallStringT) 7857 7858 smallArrayt* r; 7859 smallStringt *self = allocG(""); 7860 7861 // string 7862 setValO(self, "one/two"); 7863 r = splitO(self, "/"); 7864 ck_assert_ptr_ne(r, null); 7865 char *s = toStringO(r); 7866 ck_assert_str_eq(s, "[\"one\",\"two\"]"); 7867 free(s); 7868 terminateO(r); 7869 // delimiter on the edge 7870 setValO(self, "/one"); 7871 r = splitO(self, "/"); 7872 ck_assert_ptr_ne(r, null); 7873 s = toStringO(r); 7874 ck_assert_str_eq(s, "[\"\",\"one\"]"); 7875 free(s); 7876 terminateO(r); 7877 setValO(self, "one/"); 7878 r = splitO(self, "/"); 7879 ck_assert_ptr_ne(r, null); 7880 s = toStringO(r); 7881 ck_assert_str_eq(s, "[\"one\",\"\"]"); 7882 free(s); 7883 terminateO(r); 7884 // delimiter not found 7885 setValO(self, "one/two"); 7886 r = splitO(self, "||"); 7887 ck_assert_ptr_ne(r, null); 7888 s = toStringO(r); 7889 ck_assert_str_eq(s, "[\"one/two\"]"); 7890 free(s); 7891 terminateO(r); 7892 // split with several delimiters after each other 7893 setValO(self, "one/two three "); 7894 r = splitO(self, " "); 7895 ck_assert_ptr_ne(r, null); 7896 s = toStringO(r); 7897 ck_assert_str_eq(s, "[\"one/two\",\"\",\"three\",\"\"]"); 7898 free(s); 7899 terminateO(r); 7900 // multiple character delimiter 7901 setValO(self, "AAe three extract"); 7902 r = splitO(self, "e "); 7903 ck_assert_ptr_ne(r, null); 7904 s = toStringO(r); 7905 ck_assert_str_eq(s, "[\"AA\",\"thre\",\"extract\"]"); 7906 free(s); 7907 terminateO(r); 7908 // empty delimiter 7909 setValO(self, "AAd"); 7910 r = splitO(self, ""); 7911 ck_assert_ptr_ne(r, null); 7912 s = toStringO(r); 7913 ck_assert_str_eq(s, "[\"AAd\"]"); 7914 free(s); 7915 terminateO(r); 7916 // empty string 7917 emptyO(self); 7918 r = splitO(self, "$"); 7919 ck_assert_ptr_ne(r, null); 7920 s = toStringO(r); 7921 ck_assert_str_eq(s, "[\"\"]"); 7922 free(s); 7923 terminateO(r); 7924 // NULL list 7925 freeO(self); 7926 ck_assert_ptr_eq(splitO(self, ";"), NULL); 7927 // NULL delimiter 7928 setValO(self, "test"); 7929 ck_assert_ptr_eq(splitO(self, NULL), NULL); 7930 terminateO(self); 7931 7932 END_TEST 7933 7934 7935 START_TEST(splitCharSmallStringT) 7936 7937 smallArrayt* r; 7938 smallStringt *self = allocG(""); 7939 7940 // string 7941 setValO(self, "one/two"); 7942 r = splitCharO(self, '/'); 7943 ck_assert_ptr_ne(r, null); 7944 char *s = toStringO(r); 7945 ck_assert_str_eq(s, "[\"one\",\"two\"]"); 7946 free(s); 7947 terminateO(r); 7948 // delimiter on the edge 7949 setValO(self, "/one"); 7950 r = splitCharO(self, '/'); 7951 ck_assert_ptr_ne(r, null); 7952 s = toStringO(r); 7953 ck_assert_str_eq(s, "[\"\",\"one\"]"); 7954 free(s); 7955 terminateO(r); 7956 setValO(self, "one/"); 7957 r = splitCharO(self, '/'); 7958 ck_assert_ptr_ne(r, null); 7959 s = toStringO(r); 7960 ck_assert_str_eq(s, "[\"one\",\"\"]"); 7961 free(s); 7962 terminateO(r); 7963 // delimiter not found 7964 setValO(self, "one/two"); 7965 r = splitCharO(self, '|'); 7966 ck_assert_ptr_ne(r, null); 7967 s = toStringO(r); 7968 ck_assert_str_eq(s, "[\"one/two\"]"); 7969 free(s); 7970 terminateO(r); 7971 // split with several delimiters after each other 7972 setValO(self, "one/two three "); 7973 r = splitCharO(self, ' '); 7974 ck_assert_ptr_ne(r, null); 7975 s = toStringO(r); 7976 ck_assert_str_eq(s, "[\"one/two\",\"\",\"three\",\"\"]"); 7977 free(s); 7978 terminateO(r); 7979 // empty string 7980 emptyO(self); 7981 r = splitCharO(self, '$'); 7982 ck_assert_ptr_ne(r, null); 7983 s = toStringO(r); 7984 ck_assert_str_eq(s, "[\"\"]"); 7985 free(s); 7986 terminateO(r); 7987 // NULL list 7988 freeO(self); 7989 ck_assert_ptr_eq(splitCharO(self, ';'), NULL); 7990 terminateO(self); 7991 7992 END_TEST 7993 7994 7995 START_TEST(splitSmallJsonSmallStringT) 7996 7997 smallArrayt* r; 7998 smallStringt *self = allocG(""); 7999 smallJsont *delim = allocSmallJson(); 8000 8001 // string 8002 setValO(self, "one/two"); 8003 setTopSO(delim, "/"); 8004 r = self->f->splitSmallJson(self, delim); 8005 ck_assert_ptr_ne(r, null); 8006 char *s = toStringO(r); 8007 ck_assert_str_eq(s, "[\"one\",\"two\"]"); 8008 free(s); 8009 terminateO(r); 8010 // delimiter on the edge 8011 setValO(self, "/one"); 8012 r = self->f->splitSmallJson(self, delim); 8013 ck_assert_ptr_ne(r, null); 8014 s = toStringO(r); 8015 ck_assert_str_eq(s, "[\"\",\"one\"]"); 8016 free(s); 8017 terminateO(r); 8018 setValO(self, "one/"); 8019 r = self->f->splitSmallJson(self, delim); 8020 ck_assert_ptr_ne(r, null); 8021 s = toStringO(r); 8022 ck_assert_str_eq(s, "[\"one\",\"\"]"); 8023 free(s); 8024 terminateO(r); 8025 // delimiter not found 8026 setValO(self, "one/two"); 8027 freeO(delim); 8028 setTopSO(delim, "||"); 8029 r = self->f->splitSmallJson(self, delim); 8030 ck_assert_ptr_ne(r, null); 8031 s = toStringO(r); 8032 ck_assert_str_eq(s, "[\"one/two\"]"); 8033 free(s); 8034 terminateO(r); 8035 // split with several delimiters after each other 8036 setValO(self, "one/two three "); 8037 freeO(delim); 8038 setTopSO(delim, " "); 8039 r = self->f->splitSmallJson(self, delim); 8040 ck_assert_ptr_ne(r, null); 8041 s = toStringO(r); 8042 ck_assert_str_eq(s, "[\"one/two\",\"\",\"three\",\"\"]"); 8043 free(s); 8044 terminateO(r); 8045 // multiple character delimiter 8046 setValO(self, "AAe three extract"); 8047 freeO(delim); 8048 setTopSO(delim, "e "); 8049 r = self->f->splitSmallJson(self, delim); 8050 ck_assert_ptr_ne(r, null); 8051 s = toStringO(r); 8052 ck_assert_str_eq(s, "[\"AA\",\"thre\",\"extract\"]"); 8053 free(s); 8054 terminateO(r); 8055 // empty delimiter 8056 setValO(self, "AAd"); 8057 freeO(delim); 8058 setTopSO(delim, ""); 8059 r = self->f->splitSmallJson(self, delim); 8060 ck_assert_ptr_ne(r, null); 8061 s = toStringO(r); 8062 ck_assert_str_eq(s, "[\"AAd\"]"); 8063 free(s); 8064 terminateO(r); 8065 // empty string 8066 emptyO(self); 8067 freeO(delim); 8068 setTopSO(delim, "$"); 8069 r = self->f->splitSmallJson(self, delim); 8070 ck_assert_ptr_ne(r, null); 8071 s = toStringO(r); 8072 ck_assert_str_eq(s, "[\"\"]"); 8073 free(s); 8074 terminateO(r); 8075 // non json string delimiter 8076 freeO(delim); 8077 ck_assert_ptr_eq(self->f->splitSmallJson(self, delim), NULL); 8078 // non json object delimiter 8079 terminateO(delim); 8080 delim = (smallJsont*) allocSmallInt(1); 8081 ck_assert_ptr_eq(self->f->splitSmallJson(self, delim), NULL); 8082 terminateO(delim); 8083 delim = allocSmallJson(); 8084 // NULL list 8085 freeO(self); 8086 freeO(delim); 8087 setTopSO(delim, ";"); 8088 ck_assert_ptr_eq(self->f->splitSmallJson(self, delim), NULL); 8089 // NULL delimiter 8090 setValO(self, "test"); 8091 ck_assert_ptr_eq(self->f->splitSmallJson(self, NULL), NULL); 8092 terminateO(delim); 8093 terminateO(self); 8094 8095 END_TEST 8096 8097 8098 START_TEST(splitSmallStringSmallStringT) 8099 8100 smallArrayt* r; 8101 smallStringt *self = allocG(""); 8102 smallStringt *delim = allocSmallString("/"); 8103 8104 // string 8105 setValO(self, "one/two"); 8106 r = self->f->splitSmallString(self, delim); 8107 ck_assert_ptr_ne(r, null); 8108 char *s = toStringO(r); 8109 ck_assert_str_eq(s, "[\"one\",\"two\"]"); 8110 free(s); 8111 terminateO(r); 8112 // delimiter on the edge 8113 setValO(self, "/one"); 8114 r = self->f->splitSmallString(self, delim); 8115 ck_assert_ptr_ne(r, null); 8116 s = toStringO(r); 8117 ck_assert_str_eq(s, "[\"\",\"one\"]"); 8118 free(s); 8119 terminateO(r); 8120 setValO(self, "one/"); 8121 r = self->f->splitSmallString(self, delim); 8122 ck_assert_ptr_ne(r, null); 8123 s = toStringO(r); 8124 ck_assert_str_eq(s, "[\"one\",\"\"]"); 8125 free(s); 8126 terminateO(r); 8127 // delimiter not found 8128 setValO(self, "one/two"); 8129 setValO(delim, "||"); 8130 r = self->f->splitSmallString(self, delim); 8131 ck_assert_ptr_ne(r, null); 8132 s = toStringO(r); 8133 ck_assert_str_eq(s, "[\"one/two\"]"); 8134 free(s); 8135 terminateO(r); 8136 // split with several delimiters after each other 8137 setValO(self, "one/two three "); 8138 setValO(delim, " "); 8139 r = self->f->splitSmallString(self, delim); 8140 ck_assert_ptr_ne(r, null); 8141 s = toStringO(r); 8142 ck_assert_str_eq(s, "[\"one/two\",\"\",\"three\",\"\"]"); 8143 free(s); 8144 terminateO(r); 8145 // multiple character delimiter 8146 setValO(self, "AAe three extract"); 8147 setValO(delim, "e "); 8148 r = self->f->splitSmallString(self, delim); 8149 ck_assert_ptr_ne(r, null); 8150 s = toStringO(r); 8151 ck_assert_str_eq(s, "[\"AA\",\"thre\",\"extract\"]"); 8152 free(s); 8153 terminateO(r); 8154 // empty delimiter 8155 setValO(self, "AAd"); 8156 setValO(delim, ""); 8157 r = self->f->splitSmallString(self, delim); 8158 ck_assert_ptr_ne(r, null); 8159 s = toStringO(r); 8160 ck_assert_str_eq(s, "[\"AAd\"]"); 8161 free(s); 8162 terminateO(r); 8163 // empty string 8164 emptyO(self); 8165 setValO(delim, "$"); 8166 r = self->f->splitSmallString(self, delim); 8167 ck_assert_ptr_ne(r, null); 8168 s = toStringO(r); 8169 ck_assert_str_eq(s, "[\"\"]"); 8170 free(s); 8171 terminateO(r); 8172 // null string delimiter 8173 freeO(delim); 8174 ck_assert_ptr_eq(self->f->splitSmallString(self, delim), NULL); 8175 // non json object delimiter 8176 terminateO(delim); 8177 delim = (smallStringt*) allocSmallInt(1); 8178 ck_assert_ptr_eq(self->f->splitSmallString(self, delim), NULL); 8179 terminateO(delim); 8180 // NULL list 8181 freeO(self); 8182 delim = allocSmallString(";"); 8183 ck_assert_ptr_eq(self->f->splitSmallString(self, delim), NULL); 8184 // NULL delimiter 8185 setValO(self, "test"); 8186 ck_assert_ptr_eq(self->f->splitSmallString(self, NULL), NULL); 8187 terminateO(delim); 8188 terminateO(self); 8189 8190 END_TEST 8191 8192 8193 START_TEST(splitSSmallStringT) 8194 8195 char** r; 8196 smallStringt *self = allocG(""); 8197 8198 // string 8199 setValO(self, "one/two"); 8200 r = splitSO(self, "/"); 8201 ck_assert_uint_eq(listLengthS(r),2); 8202 ck_assert_str_eq(r[0], "one"); 8203 ck_assert_str_eq(r[1], "two"); 8204 listFreeS(r); 8205 // delimiter on the edge 8206 setValO(self, "/one"); 8207 r = splitSO(self, "/"); 8208 ck_assert_uint_eq(listLengthS(r),2); 8209 ck_assert_str_eq(r[0], ""); 8210 ck_assert_str_eq(r[1], "one"); 8211 listFreeS(r); 8212 setValO(self, "one/"); 8213 r = splitSO(self, "/"); 8214 ck_assert_uint_eq(listLengthS(r),2); 8215 ck_assert_str_eq(r[0], "one"); 8216 ck_assert_str_eq(r[1], ""); 8217 listFreeS(r); 8218 // delimiter not found 8219 setValO(self, "one/two"); 8220 r = splitSO(self, "||"); 8221 ck_assert_uint_eq(listLengthS(r),1); 8222 ck_assert_str_eq(r[0], "one/two"); 8223 listFreeS(r); 8224 // split with several delimiters after each other 8225 setValO(self, "one/two three "); 8226 r = splitSO(self, " "); 8227 ck_assert_uint_eq(listLengthS(r),4); 8228 ck_assert_str_eq(r[0], "one/two"); 8229 ck_assert_str_eq(r[1], ""); 8230 ck_assert_str_eq(r[2], "three"); 8231 ck_assert_str_eq(r[3], ""); 8232 listFreeS(r); 8233 // multiple character delimiter 8234 setValO(self, "AAe three extract"); 8235 r = splitSO(self, "e "); 8236 ck_assert_uint_eq(listLengthS(r),3); 8237 ck_assert_str_eq(r[0], "AA"); 8238 ck_assert_str_eq(r[1], "thre"); 8239 ck_assert_str_eq(r[2], "extract"); 8240 listFreeS(r); 8241 // empty delimiter 8242 setValO(self, "AAd"); 8243 r = splitSO(self, ""); 8244 ck_assert_uint_eq(listLengthS(r),1); 8245 ck_assert_str_eq(r[0], "AAd"); 8246 listFreeS(r); 8247 // empty string 8248 emptyO(self); 8249 r = splitSO(self, "$"); 8250 ck_assert_uint_eq(listLengthS(r),1); 8251 ck_assert_str_eq(r[0], ""); 8252 listFreeS(r); 8253 // NULL list 8254 freeO(self); 8255 ck_assert_ptr_eq(splitSO(self, ";"), NULL); 8256 // NULL delimiter 8257 setValO(self, "test"); 8258 ck_assert_ptr_eq(splitSO(self, NULL), NULL); 8259 terminateO(self); 8260 8261 END_TEST 8262 8263 8264 START_TEST(splitCharSSmallStringT) 8265 8266 char** r; 8267 smallStringt *self = allocG(""); 8268 8269 // string 8270 setValO(self, "one/two"); 8271 r = splitCharSO(self, '/'); 8272 ck_assert_uint_eq(listLengthS(r),2); 8273 ck_assert_str_eq(r[0], "one"); 8274 ck_assert_str_eq(r[1], "two"); 8275 listFreeS(r); 8276 // delimiter on the edge 8277 setValO(self, "/one"); 8278 r = splitCharSO(self, '/'); 8279 ck_assert_uint_eq(listLengthS(r),2); 8280 ck_assert_str_eq(r[0], ""); 8281 ck_assert_str_eq(r[1], "one"); 8282 listFreeS(r); 8283 setValO(self, "one/"); 8284 r = splitCharSO(self, '/'); 8285 ck_assert_uint_eq(listLengthS(r),2); 8286 ck_assert_str_eq(r[0], "one"); 8287 ck_assert_str_eq(r[1], ""); 8288 listFreeS(r); 8289 // delimiter not found 8290 setValO(self, "one/two"); 8291 r = splitCharSO(self, '|'); 8292 ck_assert_uint_eq(listLengthS(r),1); 8293 ck_assert_str_eq(r[0], "one/two"); 8294 listFreeS(r); 8295 // split with several delimiters after each other 8296 setValO(self, "one/two three "); 8297 r = splitCharSO(self, ' '); 8298 ck_assert_uint_eq(listLengthS(r),4); 8299 ck_assert_str_eq(r[0], "one/two"); 8300 ck_assert_str_eq(r[1], ""); 8301 ck_assert_str_eq(r[2], "three"); 8302 ck_assert_str_eq(r[3], ""); 8303 listFreeS(r); 8304 // empty string 8305 emptyO(self); 8306 r = splitCharSO(self, '$'); 8307 ck_assert_uint_eq(listLengthS(r),1); 8308 ck_assert_str_eq(r[0], ""); 8309 listFreeS(r); 8310 // NULL list 8311 freeO(self); 8312 ck_assert_ptr_eq(splitCharSO(self, ';'), NULL); 8313 terminateO(self); 8314 8315 END_TEST 8316 8317 8318 START_TEST(splitSmallJsonSSmallStringT) 8319 8320 char** r; 8321 smallStringt *self = allocG(""); 8322 smallJsont *delim = allocSmallJson(); 8323 8324 // string 8325 setValO(self, "one/two"); 8326 setTopSO(delim, "/"); 8327 r = splitSmallJsonSO(self, delim); 8328 ck_assert_uint_eq(listLengthS(r),2); 8329 ck_assert_str_eq(r[0], "one"); 8330 ck_assert_str_eq(r[1], "two"); 8331 listFreeS(r); 8332 // delimiter on the edge 8333 setValO(self, "/one"); 8334 r = splitSmallJsonSO(self, delim); 8335 ck_assert_uint_eq(listLengthS(r),2); 8336 ck_assert_str_eq(r[0], ""); 8337 ck_assert_str_eq(r[1], "one"); 8338 listFreeS(r); 8339 setValO(self, "one/"); 8340 r = splitSmallJsonSO(self, delim); 8341 ck_assert_uint_eq(listLengthS(r),2); 8342 ck_assert_str_eq(r[0], "one"); 8343 ck_assert_str_eq(r[1], ""); 8344 listFreeS(r); 8345 // delimiter not found 8346 setValO(self, "one/two"); 8347 freeO(delim); 8348 setTopSO(delim, "||"); 8349 r = splitSmallJsonSO(self, delim); 8350 ck_assert_uint_eq(listLengthS(r),1); 8351 ck_assert_str_eq(r[0], "one/two"); 8352 listFreeS(r); 8353 // split with several delimiters after each other 8354 setValO(self, "one/two three "); 8355 freeO(delim); 8356 setTopSO(delim, " "); 8357 r = splitSmallJsonSO(self, delim); 8358 ck_assert_uint_eq(listLengthS(r),4); 8359 ck_assert_str_eq(r[0], "one/two"); 8360 ck_assert_str_eq(r[1], ""); 8361 ck_assert_str_eq(r[2], "three"); 8362 ck_assert_str_eq(r[3], ""); 8363 listFreeS(r); 8364 // multiple character delimiter 8365 setValO(self, "AAe three extract"); 8366 freeO(delim); 8367 setTopSO(delim, "e "); 8368 r = splitSmallJsonSO(self, delim); 8369 ck_assert_uint_eq(listLengthS(r),3); 8370 ck_assert_str_eq(r[0], "AA"); 8371 ck_assert_str_eq(r[1], "thre"); 8372 ck_assert_str_eq(r[2], "extract"); 8373 listFreeS(r); 8374 // empty delimiter 8375 setValO(self, "AAd"); 8376 freeO(delim); 8377 setTopSO(delim, ""); 8378 r = splitSmallJsonSO(self, delim); 8379 ck_assert_uint_eq(listLengthS(r),1); 8380 ck_assert_str_eq(r[0], "AAd"); 8381 listFreeS(r); 8382 // empty string 8383 emptyO(self); 8384 freeO(delim); 8385 setTopSO(delim, "$"); 8386 r = splitSmallJsonSO(self, delim); 8387 ck_assert_uint_eq(listLengthS(r),1); 8388 ck_assert_str_eq(r[0], ""); 8389 listFreeS(r); 8390 // non json string delimiter 8391 freeO(delim); 8392 ck_assert_ptr_eq(splitSmallJsonSO(self, delim), NULL); 8393 // non json object delimiter 8394 terminateO(delim); 8395 delim = (smallJsont*) allocSmallInt(1); 8396 ck_assert_ptr_eq(splitSmallJsonSO(self, delim), NULL); 8397 terminateO(delim); 8398 delim = allocSmallJson(); 8399 // NULL list 8400 freeO(self); 8401 freeO(delim); 8402 setTopSO(delim, ";"); 8403 ck_assert_ptr_eq(splitSmallJsonSO(self, delim), NULL); 8404 // NULL delimiter 8405 setValO(self, "test"); 8406 ck_assert_ptr_eq(splitSmallJsonSO(self, NULL), NULL); 8407 terminateO(delim); 8408 terminateO(self); 8409 8410 END_TEST 8411 8412 8413 START_TEST(splitSmallStringSSmallStringT) 8414 8415 char** r; 8416 smallStringt *self = allocG(""); 8417 smallStringt *delim = allocSmallString("/"); 8418 8419 // string 8420 setValO(self, "one/two"); 8421 r = splitSmallStringSO(self, delim); 8422 ck_assert_uint_eq(listLengthS(r),2); 8423 ck_assert_str_eq(r[0], "one"); 8424 ck_assert_str_eq(r[1], "two"); 8425 listFreeS(r); 8426 // delimiter on the edge 8427 setValO(self, "/one"); 8428 r = splitSmallStringSO(self, delim); 8429 ck_assert_uint_eq(listLengthS(r),2); 8430 ck_assert_str_eq(r[0], ""); 8431 ck_assert_str_eq(r[1], "one"); 8432 listFreeS(r); 8433 setValO(self, "one/"); 8434 r = splitSmallStringSO(self, delim); 8435 ck_assert_uint_eq(listLengthS(r),2); 8436 ck_assert_str_eq(r[0], "one"); 8437 ck_assert_str_eq(r[1], ""); 8438 listFreeS(r); 8439 // delimiter not found 8440 setValO(self, "one/two"); 8441 setValO(delim, "||"); 8442 r = splitSmallStringSO(self, delim); 8443 ck_assert_uint_eq(listLengthS(r),1); 8444 ck_assert_str_eq(r[0], "one/two"); 8445 listFreeS(r); 8446 // split with several delimiters after each other 8447 setValO(self, "one/two three "); 8448 setValO(delim, " "); 8449 r = splitSmallStringSO(self, delim); 8450 ck_assert_uint_eq(listLengthS(r),4); 8451 ck_assert_str_eq(r[0], "one/two"); 8452 ck_assert_str_eq(r[1], ""); 8453 ck_assert_str_eq(r[2], "three"); 8454 ck_assert_str_eq(r[3], ""); 8455 listFreeS(r); 8456 // multiple character delimiter 8457 setValO(self, "AAe three extract"); 8458 setValO(delim, "e "); 8459 r = splitSmallStringSO(self, delim); 8460 ck_assert_uint_eq(listLengthS(r),3); 8461 ck_assert_str_eq(r[0], "AA"); 8462 ck_assert_str_eq(r[1], "thre"); 8463 ck_assert_str_eq(r[2], "extract"); 8464 listFreeS(r); 8465 // empty delimiter 8466 setValO(self, "AAd"); 8467 setValO(delim, ""); 8468 r = splitSmallStringSO(self, delim); 8469 ck_assert_uint_eq(listLengthS(r),1); 8470 ck_assert_str_eq(r[0], "AAd"); 8471 listFreeS(r); 8472 // empty string 8473 emptyO(self); 8474 setValO(delim, "$"); 8475 r = splitSmallStringSO(self, delim); 8476 ck_assert_uint_eq(listLengthS(r),1); 8477 ck_assert_str_eq(r[0], ""); 8478 listFreeS(r); 8479 // non smallString object delimiter 8480 terminateO(delim); 8481 delim = (smallStringt*) allocSmallInt(1); 8482 ck_assert_ptr_eq(splitSmallStringSO(self, delim), NULL); 8483 terminateO(delim); 8484 // NULL list 8485 freeO(self); 8486 delim = allocSmallString(";"); 8487 ck_assert_ptr_eq(splitSmallStringSO(self, delim), NULL); 8488 // NULL delimiter 8489 setValO(self, "test"); 8490 ck_assert_ptr_eq(splitSmallStringSO(self, NULL), NULL); 8491 terminateO(delim); 8492 terminateO(self); 8493 8494 END_TEST 8495 8496 8497 START_TEST(extractSmallStringT) 8498 8499 smallArrayt* r; 8500 smallStringt *self = allocG(""); 8501 8502 // string 8503 setValO(self, "one/two|"); 8504 r = extractO(self, "/", "|"); 8505 ck_assert_ptr_ne(r, null); 8506 char *s = toStringO(r); 8507 ck_assert_str_eq(s, "[\"two\"]"); 8508 free(s); 8509 terminateO(r); 8510 // delimiter not found 8511 setValO(self, "one/two"); 8512 r = extractO(self, "||", "/"); 8513 ck_assert_ptr_eq(r, NULL); 8514 // extractO with several delimiters after each other 8515 setValO(self, "one/ two /three "); 8516 r = extractO(self, "/", " "); 8517 ck_assert_ptr_ne(r, null); 8518 s = toStringO(r); 8519 ck_assert_str_eq(s, "[\"\",\"three\"]"); 8520 free(s); 8521 terminateO(r); 8522 // multiple character delimiter 8523 setValO(self, "AAe thre|e extract"); 8524 r = extractO(self, "e ", "|"); 8525 ck_assert_ptr_ne(r, null); 8526 s = toStringO(r); 8527 ck_assert_str_eq(s, "[\"thre\"]"); 8528 free(s); 8529 terminateO(r); 8530 // empty delimiter 8531 setValO(self, "AAd"); 8532 r = extractO(self, "", "Ad"); 8533 ck_assert_ptr_eq(r, NULL); 8534 setValO(self, "AAd"); 8535 r = extractO(self, "A", ""); 8536 ck_assert_ptr_eq(r, NULL); 8537 // empty string 8538 setValO(self, ""); 8539 r = extractO(self, "$", "#"); 8540 ck_assert_ptr_eq(r, NULL); 8541 // delim1 = delim2 8542 setValO(self, ""); 8543 r = extractO(self, "$", "$"); 8544 ck_assert_ptr_eq(r, NULL); 8545 // NULL string 8546 freeO(self); 8547 ck_assert_ptr_eq(extractO(self, ";", ","), NULL); 8548 // NULL delimiter 8549 setValO(self, "test"); 8550 ck_assert_ptr_eq(extractO(self, NULL, ","), NULL); 8551 ck_assert_ptr_eq(extractO(self, ",", NULL), NULL); 8552 terminateO(self); 8553 8554 END_TEST 8555 8556 8557 START_TEST(extractCharSSmallStringT) 8558 8559 smallArrayt* r; 8560 smallStringt *self = allocG(""); 8561 8562 // string 8563 setValO(self, "one/two|"); 8564 r = extractCharSO(self, '/', "|"); 8565 ck_assert_ptr_ne(r, null); 8566 char *s = toStringO(r); 8567 ck_assert_str_eq(s, "[\"two\"]"); 8568 free(s); 8569 terminateO(r); 8570 // delimiter not found 8571 setValO(self, "one/two"); 8572 r = extractCharSO(self, '|', "/"); 8573 ck_assert_ptr_eq(r, NULL); 8574 // extractCharSO with several delimiters after each other 8575 setValO(self, "one/ two /three "); 8576 r = extractCharSO(self, '/', " "); 8577 ck_assert_ptr_ne(r, null); 8578 s = toStringO(r); 8579 ck_assert_str_eq(s, "[\"\",\"three\"]"); 8580 free(s); 8581 terminateO(r); 8582 // multiple character delimiter 8583 setValO(self, "AAe thre|e extract"); 8584 r = extractCharSO(self, ' ', "|e"); 8585 ck_assert_ptr_ne(r, null); 8586 s = toStringO(r); 8587 ck_assert_str_eq(s, "[\"thre\"]"); 8588 free(s); 8589 terminateO(r); 8590 // empty delimiter 8591 setValO(self, "AAd"); 8592 r = extractCharSO(self, 'A', ""); 8593 ck_assert_ptr_eq(r, NULL); 8594 // empty string 8595 setValO(self, ""); 8596 r = extractCharSO(self, '$', "#"); 8597 ck_assert_ptr_eq(r, NULL); 8598 // delim1 = delim2 8599 setValO(self, ""); 8600 r = extractCharSO(self, '$', "$"); 8601 ck_assert_ptr_eq(r, NULL); 8602 // NULL string 8603 freeO(self); 8604 ck_assert_ptr_eq(extractCharSO(self, ';', ","), NULL); 8605 // NULL delimiter 8606 setValO(self, "test"); 8607 ck_assert_ptr_eq(extractCharSO(self, ',', NULL), NULL); 8608 terminateO(self); 8609 8610 END_TEST 8611 8612 8613 START_TEST(extractSCharSmallStringT) 8614 8615 smallArrayt* r; 8616 smallStringt *self = allocG(""); 8617 8618 // string 8619 setValO(self, "one/two|"); 8620 r = extractSCharO(self, "/", '|'); 8621 ck_assert_ptr_ne(r, null); 8622 char *s = toStringO(r); 8623 ck_assert_str_eq(s, "[\"two\"]"); 8624 free(s); 8625 terminateO(r); 8626 // delimiter not found 8627 setValO(self, "one/two"); 8628 r = extractSCharO(self, "||", '/'); 8629 ck_assert_ptr_eq(r, NULL); 8630 // extractSCharO with several delimiters after each other 8631 setValO(self, "one/ two /three "); 8632 r = extractSCharO(self, "/", ' '); 8633 ck_assert_ptr_ne(r, null); 8634 s = toStringO(r); 8635 ck_assert_str_eq(s, "[\"\",\"three\"]"); 8636 free(s); 8637 terminateO(r); 8638 // multiple character delimiter 8639 setValO(self, "AAe thre|e extract"); 8640 r = extractSCharO(self, "e ", '|'); 8641 ck_assert_ptr_ne(r, null); 8642 s = toStringO(r); 8643 ck_assert_str_eq(s, "[\"thre\"]"); 8644 free(s); 8645 terminateO(r); 8646 // empty delimiter 8647 setValO(self, "AAd"); 8648 r = extractSCharO(self, "", 'A'); 8649 ck_assert_ptr_eq(r, NULL); 8650 // empty string 8651 setValO(self, ""); 8652 r = extractSCharO(self, "$", '#'); 8653 ck_assert_ptr_eq(r, NULL); 8654 // delim1 = delim2 8655 setValO(self, ""); 8656 r = extractSCharO(self, "$", '$'); 8657 ck_assert_ptr_eq(r, NULL); 8658 // NULL string 8659 freeO(self); 8660 ck_assert_ptr_eq(extractSCharO(self, ";", ','), NULL); 8661 // NULL delimiter 8662 setValO(self, "test"); 8663 ck_assert_ptr_eq(extractSCharO(self, NULL, ','), NULL); 8664 terminateO(self); 8665 8666 END_TEST 8667 8668 8669 START_TEST(extractCharCharSmallStringT) 8670 8671 smallArrayt* r; 8672 smallStringt *self = allocG(""); 8673 8674 // string 8675 setValO(self, "one/two|"); 8676 r = extractCharCharO(self, '/', '|'); 8677 ck_assert_ptr_ne(r, null); 8678 char *s = toStringO(r); 8679 ck_assert_str_eq(s, "[\"two\"]"); 8680 free(s); 8681 terminateO(r); 8682 // delimiter not found 8683 setValO(self, "one/two"); 8684 r = extractCharCharO(self, '|', '/'); 8685 ck_assert_ptr_eq(r, NULL); 8686 // extractCharCharO with several delimiters after each other 8687 setValO(self, "one/ two /three "); 8688 r = extractCharCharO(self, '/', ' '); 8689 ck_assert_ptr_ne(r, null); 8690 s = toStringO(r); 8691 ck_assert_str_eq(s, "[\"\",\"three\"]"); 8692 free(s); 8693 terminateO(r); 8694 // multiple character delimiter 8695 setValO(self, "AAe thre|e extract"); 8696 r = extractCharCharO(self, ' ', '|'); 8697 ck_assert_ptr_ne(r, null); 8698 s = toStringO(r); 8699 ck_assert_str_eq(s, "[\"thre\"]"); 8700 free(s); 8701 terminateO(r); 8702 // empty string 8703 setValO(self, ""); 8704 r = extractCharCharO(self, '$', '#'); 8705 ck_assert_ptr_eq(r, NULL); 8706 // delim1 = delim2 8707 setValO(self, ""); 8708 r = extractCharCharO(self, '$', '$'); 8709 ck_assert_ptr_eq(r, NULL); 8710 // NULL string 8711 freeO(self); 8712 ck_assert_ptr_eq(extractCharCharO(self, ';', ','), NULL); 8713 terminateO(self); 8714 8715 END_TEST 8716 8717 8718 START_TEST(extractSmallJsonSmallJsonSmallStringT) 8719 8720 smallArrayt* r; 8721 smallStringt *self = allocG(""); 8722 smallJsont* delim1 = allocSmallJson(); 8723 smallJsont* delim2 = allocSmallJson(); 8724 8725 // string 8726 setValO(self, "one/two|"); 8727 setTopSO(delim1, "/"); 8728 setTopSO(delim2, "|"); 8729 r = extractSmallJsonSmallJsonO(self, delim1, delim2); 8730 ck_assert_ptr_ne(r, null); 8731 char *s = toStringO(r); 8732 ck_assert_str_eq(s, "[\"two\"]"); 8733 free(s); 8734 terminateO(r); 8735 // delimiter not found 8736 setValO(self, "one/two"); 8737 freeO(delim1); 8738 freeO(delim2); 8739 setTopSO(delim1, "||"); 8740 setTopSO(delim2, "/"); 8741 r = extractSmallJsonSmallJsonO(self, delim1, delim2); 8742 ck_assert_ptr_eq(r, NULL); 8743 // extractSmallJsonSmallJsonO with several delimiters after each other 8744 setValO(self, "one/ two /three "); 8745 freeO(delim1); 8746 freeO(delim2); 8747 setTopSO(delim1, "/"); 8748 setTopSO(delim2, " "); 8749 r = extractSmallJsonSmallJsonO(self, delim1, delim2); 8750 ck_assert_ptr_ne(r, null); 8751 s = toStringO(r); 8752 ck_assert_str_eq(s, "[\"\",\"three\"]"); 8753 free(s); 8754 terminateO(r); 8755 // multiple character delimiter 8756 setValO(self, "AAe thre|e extract"); 8757 freeO(delim1); 8758 freeO(delim2); 8759 setTopSO(delim1, "e "); 8760 setTopSO(delim2, "|"); 8761 r = extractSmallJsonSmallJsonO(self, delim1, delim2); 8762 ck_assert_ptr_ne(r, null); 8763 s = toStringO(r); 8764 ck_assert_str_eq(s, "[\"thre\"]"); 8765 free(s); 8766 terminateO(r); 8767 // empty delimiter 8768 setValO(self, "AAd"); 8769 freeO(delim1); 8770 freeO(delim2); 8771 setTopSO(delim1, ""); 8772 setTopSO(delim2, "Ad"); 8773 r = extractSmallJsonSmallJsonO(self, delim1, delim2); 8774 ck_assert_ptr_eq(r, NULL); 8775 setValO(self, "AAd"); 8776 freeO(delim1); 8777 freeO(delim2); 8778 setTopSO(delim1, "A"); 8779 setTopSO(delim2, ""); 8780 r = extractSmallJsonSmallJsonO(self, delim1, delim2); 8781 ck_assert_ptr_eq(r, NULL); 8782 // empty string 8783 setValO(self, ""); 8784 freeO(delim1); 8785 freeO(delim2); 8786 setTopSO(delim1, "$"); 8787 setTopSO(delim2, "#"); 8788 r = extractSmallJsonSmallJsonO(self, delim1, delim2); 8789 ck_assert_ptr_eq(r, NULL); 8790 // delim1 = delim2 8791 setValO(self, "$qwe$"); 8792 freeO(delim1); 8793 freeO(delim2); 8794 setTopSO(delim1, "$"); 8795 setTopSO(delim2, "$"); 8796 r = extractSmallJsonSmallJsonO(self, delim1, delim2); 8797 ck_assert_ptr_eq(r, NULL); 8798 // non json string 8799 freeO(delim1); 8800 r = extractSmallJsonSmallJsonO(self, delim1, delim2); 8801 ck_assert_ptr_eq(r, NULL); 8802 setTopSO(delim1, "$"); 8803 freeO(delim2); 8804 r = extractSmallJsonSmallJsonO(self, delim1, delim2); 8805 ck_assert_ptr_eq(r, NULL); 8806 // non json object 8807 terminateO(delim1); 8808 delim1 = (smallJsont*) allocSmallInt(1); 8809 setTopSO(delim2, "$"); 8810 r = extractSmallJsonSmallJsonO(self, delim1, delim2); 8811 ck_assert_ptr_eq(r, NULL); 8812 terminateO(delim1); 8813 delim1 = allocSmallJson(); 8814 setTopSO(delim1, ";"); 8815 terminateO(delim2); 8816 delim2 = (smallJsont*) allocSmallInt(1); 8817 r = extractSmallJsonSmallJsonO(self, delim1, delim2); 8818 ck_assert_ptr_eq(r, NULL); 8819 terminateO(delim2); 8820 delim2 = allocSmallJson(); 8821 // NULL string 8822 freeO(self); 8823 freeO(delim1); 8824 freeO(delim2); 8825 setTopSO(delim1, ";"); 8826 setTopSO(delim2, ","); 8827 ck_assert_ptr_eq(extractSmallJsonSmallJsonO(self, delim1, delim2), NULL); 8828 // NULL delimiter 8829 setValO(self, "test"); 8830 ck_assert_ptr_eq(extractSmallJsonSmallJsonO(self, NULL, delim2), NULL); 8831 ck_assert_ptr_eq(extractSmallJsonSmallJsonO(self, delim1, NULL), NULL); 8832 terminateO(delim1); 8833 terminateO(delim2); 8834 terminateO(self); 8835 8836 END_TEST 8837 8838 8839 START_TEST(extractSmallJsonSmallStringSmallStringT) 8840 8841 smallArrayt* r; 8842 smallStringt *self = allocG(""); 8843 smallJsont* delim1 = allocSmallJson(); 8844 smallStringt* delim2 = allocSmallString("|"); 8845 8846 // string 8847 setValO(self, "one/two|"); 8848 setTopSO(delim1, "/"); 8849 r = extractSmallJsonSmallStringO(self, delim1, delim2); 8850 ck_assert_ptr_ne(r, null); 8851 char *s = toStringO(r); 8852 ck_assert_str_eq(s, "[\"two\"]"); 8853 free(s); 8854 terminateO(r); 8855 // delimiter not found 8856 setValO(self, "one/two"); 8857 freeO(delim1); 8858 setTopSO(delim1, "||"); 8859 setValO(delim2, "/"); 8860 r = extractSmallJsonSmallStringO(self, delim1, delim2); 8861 ck_assert_ptr_eq(r, NULL); 8862 // extractSmallJsonSmallStringO with several delimiters after each other 8863 setValO(self, "one/ two /three "); 8864 freeO(delim1); 8865 setTopSO(delim1, "/"); 8866 setValO(delim2, " "); 8867 r = extractSmallJsonSmallStringO(self, delim1, delim2); 8868 ck_assert_ptr_ne(r, null); 8869 s = toStringO(r); 8870 ck_assert_str_eq(s, "[\"\",\"three\"]"); 8871 free(s); 8872 terminateO(r); 8873 // multiple character delimiter 8874 setValO(self, "AAe thre|e extract"); 8875 freeO(delim1); 8876 setTopSO(delim1, "e "); 8877 setValO(delim2, "|"); 8878 r = extractSmallJsonSmallStringO(self, delim1, delim2); 8879 ck_assert_ptr_ne(r, null); 8880 s = toStringO(r); 8881 ck_assert_str_eq(s, "[\"thre\"]"); 8882 free(s); 8883 terminateO(r); 8884 // empty delimiter 8885 setValO(self, "AAd"); 8886 freeO(delim1); 8887 setTopSO(delim1, ""); 8888 setValO(delim2, "Ad"); 8889 r = extractSmallJsonSmallStringO(self, delim1, delim2); 8890 ck_assert_ptr_eq(r, NULL); 8891 setValO(self, "AAd"); 8892 freeO(delim1); 8893 setTopSO(delim1, "A"); 8894 setValO(delim2, ""); 8895 r = extractSmallJsonSmallStringO(self, delim1, delim2); 8896 ck_assert_ptr_eq(r, NULL); 8897 // empty string 8898 setValO(self, ""); 8899 freeO(delim1); 8900 setTopSO(delim1, "$"); 8901 setValO(delim2, "#"); 8902 r = extractSmallJsonSmallStringO(self, delim1, delim2); 8903 ck_assert_ptr_eq(r, NULL); 8904 // delim1 = delim2 8905 setValO(self, "$qwe$"); 8906 freeO(delim1); 8907 setTopSO(delim1, "$"); 8908 setValO(delim2, "$"); 8909 r = extractSmallJsonSmallStringO(self, delim1, delim2); 8910 ck_assert_ptr_eq(r, NULL); 8911 // non json string 8912 freeO(delim1); 8913 r = extractSmallJsonSmallStringO(self, delim1, delim2); 8914 ck_assert_ptr_eq(r, NULL); 8915 // non json object 8916 terminateO(delim1); 8917 delim1 = (smallJsont*) allocSmallInt(1); 8918 r = extractSmallJsonSmallStringO(self, delim1, delim2); 8919 ck_assert_ptr_eq(r, NULL); 8920 terminateO(delim1); 8921 delim1 = allocSmallJson(); 8922 setTopSO(delim1, ";"); 8923 terminateO(delim2); 8924 delim2 = (smallStringt*) allocSmallInt(1); 8925 r = extractSmallJsonSmallStringO(self, delim1, delim2); 8926 ck_assert_ptr_eq(r, NULL); 8927 terminateO(delim2); 8928 delim2 = allocSmallString(","); 8929 // NULL string 8930 freeO(self); 8931 freeO(delim1); 8932 setTopSO(delim1, ";"); 8933 ck_assert_ptr_eq(extractSmallJsonSmallStringO(self, delim1, delim2), NULL); 8934 // NULL delimiter 8935 setValO(self, "test"); 8936 ck_assert_ptr_eq(extractSmallJsonSmallStringO(self, NULL, delim2), NULL); 8937 ck_assert_ptr_eq(extractSmallJsonSmallStringO(self, delim1, NULL), NULL); 8938 terminateO(delim1); 8939 terminateO(delim2); 8940 terminateO(self); 8941 8942 END_TEST 8943 8944 8945 START_TEST(extractSmallJsonSSmallStringT) 8946 8947 smallArrayt* r; 8948 smallStringt *self = allocG(""); 8949 smallJsont* delim1 = allocSmallJson(); 8950 8951 // string 8952 setValO(self, "one/two|"); 8953 setTopSO(delim1, "/"); 8954 r = extractSmallJsonSO(self, delim1, "|"); 8955 ck_assert_ptr_ne(r, null); 8956 char *s = toStringO(r); 8957 ck_assert_str_eq(s, "[\"two\"]"); 8958 free(s); 8959 terminateO(r); 8960 // delimiter not found 8961 setValO(self, "one/two"); 8962 freeO(delim1); 8963 setTopSO(delim1, "||"); 8964 r = extractSmallJsonSO(self, delim1, "/"); 8965 ck_assert_ptr_eq(r, NULL); 8966 // extractSmallJsonSO with several delimiters after each other 8967 setValO(self, "one/ two /three "); 8968 freeO(delim1); 8969 setTopSO(delim1, "/"); 8970 r = extractSmallJsonSO(self, delim1, " "); 8971 ck_assert_ptr_ne(r, null); 8972 s = toStringO(r); 8973 ck_assert_str_eq(s, "[\"\",\"three\"]"); 8974 free(s); 8975 terminateO(r); 8976 // multiple character delimiter 8977 setValO(self, "AAe thre|e extract"); 8978 freeO(delim1); 8979 setTopSO(delim1, "e "); 8980 r = extractSmallJsonSO(self, delim1, "|"); 8981 ck_assert_ptr_ne(r, null); 8982 s = toStringO(r); 8983 ck_assert_str_eq(s, "[\"thre\"]"); 8984 free(s); 8985 terminateO(r); 8986 // empty delimiter 8987 setValO(self, "AAd"); 8988 freeO(delim1); 8989 setTopSO(delim1, ""); 8990 r = extractSmallJsonSO(self, delim1, "Ad"); 8991 ck_assert_ptr_eq(r, NULL); 8992 setValO(self, "AAd"); 8993 freeO(delim1); 8994 setTopSO(delim1, "A"); 8995 r = extractSmallJsonSO(self, delim1, ""); 8996 ck_assert_ptr_eq(r, NULL); 8997 // empty string 8998 setValO(self, ""); 8999 freeO(delim1); 9000 setTopSO(delim1, "$"); 9001 r = extractSmallJsonSO(self, delim1, "#"); 9002 ck_assert_ptr_eq(r, NULL); 9003 // delim1 = delim2 9004 setValO(self, "$qwe$"); 9005 freeO(delim1); 9006 setTopSO(delim1, "$"); 9007 r = extractSmallJsonSO(self, delim1, "$"); 9008 ck_assert_ptr_eq(r, NULL); 9009 // non json string 9010 freeO(delim1); 9011 r = extractSmallJsonSO(self, delim1, "$"); 9012 ck_assert_ptr_eq(r, NULL); 9013 // non json object 9014 terminateO(delim1); 9015 delim1 = (smallJsont*) allocSmallInt(1); 9016 r = extractSmallJsonSO(self, delim1, "$"); 9017 ck_assert_ptr_eq(r, NULL); 9018 terminateO(delim1); 9019 delim1 = allocSmallJson(); 9020 // NULL string 9021 freeO(self); 9022 freeO(delim1); 9023 setTopSO(delim1, ";"); 9024 ck_assert_ptr_eq(extractSmallJsonSO(self, delim1, ","), NULL); 9025 // NULL delimiter 9026 setValO(self, "test"); 9027 ck_assert_ptr_eq(extractSmallJsonSO(self, NULL, ","), NULL); 9028 ck_assert_ptr_eq(extractSmallJsonSO(self, delim1, NULL), NULL); 9029 terminateO(delim1); 9030 terminateO(self); 9031 9032 END_TEST 9033 9034 9035 START_TEST(extractSmallJsonCharSmallStringT) 9036 9037 smallArrayt* r; 9038 smallStringt *self = allocG(""); 9039 smallJsont* delim1 = allocSmallJson(); 9040 9041 // string 9042 setValO(self, "one/two|"); 9043 setTopSO(delim1, "/"); 9044 r = extractSmallJsonCharO(self, delim1, '|'); 9045 ck_assert_ptr_ne(r, null); 9046 char *s = toStringO(r); 9047 ck_assert_str_eq(s, "[\"two\"]"); 9048 free(s); 9049 terminateO(r); 9050 // delimiter not found 9051 setValO(self, "one/two"); 9052 freeO(delim1); 9053 setTopSO(delim1, "||"); 9054 r = extractSmallJsonCharO(self, delim1, '/'); 9055 ck_assert_ptr_eq(r, NULL); 9056 // extractSmallJsonCharO with several delimiters after each other 9057 setValO(self, "one/ two /three "); 9058 freeO(delim1); 9059 setTopSO(delim1, "/"); 9060 r = extractSmallJsonCharO(self, delim1, ' '); 9061 ck_assert_ptr_ne(r, null); 9062 s = toStringO(r); 9063 ck_assert_str_eq(s, "[\"\",\"three\"]"); 9064 free(s); 9065 terminateO(r); 9066 // multiple character delimiter 9067 setValO(self, "AAe thre|e extract"); 9068 freeO(delim1); 9069 setTopSO(delim1, "e "); 9070 r = extractSmallJsonCharO(self, delim1, '|'); 9071 ck_assert_ptr_ne(r, null); 9072 s = toStringO(r); 9073 ck_assert_str_eq(s, "[\"thre\"]"); 9074 free(s); 9075 terminateO(r); 9076 // empty delimiter 9077 setValO(self, "AAd"); 9078 freeO(delim1); 9079 setTopSO(delim1, ""); 9080 r = extractSmallJsonCharO(self, delim1, 'd'); 9081 ck_assert_ptr_eq(r, NULL); 9082 setValO(self, "AAd"); 9083 // empty string 9084 setValO(self, ""); 9085 freeO(delim1); 9086 setTopSO(delim1, "$"); 9087 r = extractSmallJsonCharO(self, delim1, '#'); 9088 ck_assert_ptr_eq(r, NULL); 9089 // delim1 = delim2 9090 setValO(self, "$qwe$"); 9091 freeO(delim1); 9092 setTopSO(delim1, "$"); 9093 r = extractSmallJsonCharO(self, delim1, '$'); 9094 ck_assert_ptr_eq(r, NULL); 9095 // non json string 9096 freeO(delim1); 9097 r = extractSmallJsonCharO(self, delim1, '$'); 9098 ck_assert_ptr_eq(r, NULL); 9099 // non json object 9100 terminateO(delim1); 9101 delim1 = (smallJsont*) allocSmallInt(1); 9102 r = extractSmallJsonCharO(self, delim1, '$'); 9103 ck_assert_ptr_eq(r, NULL); 9104 terminateO(delim1); 9105 delim1 = allocSmallJson(); 9106 // NULL string 9107 freeO(self); 9108 freeO(delim1); 9109 setTopSO(delim1, ";"); 9110 ck_assert_ptr_eq(extractSmallJsonCharO(self, delim1, ','), NULL); 9111 // NULL delimiter 9112 setValO(self, "test"); 9113 ck_assert_ptr_eq(extractSmallJsonCharO(self, NULL, ','), NULL); 9114 terminateO(delim1); 9115 terminateO(self); 9116 9117 END_TEST 9118 9119 9120 START_TEST(extractSmallStringSmallJsonSmallStringT) 9121 9122 smallArrayt* r; 9123 smallStringt *self = allocG(""); 9124 smallStringt* delim1 = allocSmallString("/"); 9125 smallJsont* delim2 = allocSmallJson(); 9126 9127 // string 9128 setValO(self, "one/two|"); 9129 setTopSO(delim2, "|"); 9130 r = extractSmallStringSmallJsonO(self, delim1, delim2); 9131 ck_assert_ptr_ne(r, null); 9132 char *s = toStringO(r); 9133 ck_assert_str_eq(s, "[\"two\"]"); 9134 free(s); 9135 terminateO(r); 9136 // delimiter not found 9137 setValO(self, "one/two"); 9138 freeO(delim2); 9139 setValO(delim1, "||"); 9140 setTopSO(delim2, "/"); 9141 r = extractSmallStringSmallJsonO(self, delim1, delim2); 9142 ck_assert_ptr_eq(r, NULL); 9143 // extractSmallStringSmallJsonO with several delimiters after each other 9144 setValO(self, "one/ two /three "); 9145 freeO(delim2); 9146 setValO(delim1, "/"); 9147 setTopSO(delim2, " "); 9148 r = extractSmallStringSmallJsonO(self, delim1, delim2); 9149 ck_assert_ptr_ne(r, null); 9150 s = toStringO(r); 9151 ck_assert_str_eq(s, "[\"\",\"three\"]"); 9152 free(s); 9153 terminateO(r); 9154 // multiple character delimiter 9155 setValO(self, "AAe thre|e extract"); 9156 freeO(delim2); 9157 setValO(delim1, "e "); 9158 setTopSO(delim2, "|"); 9159 r = extractSmallStringSmallJsonO(self, delim1, delim2); 9160 ck_assert_ptr_ne(r, null); 9161 s = toStringO(r); 9162 ck_assert_str_eq(s, "[\"thre\"]"); 9163 free(s); 9164 terminateO(r); 9165 // empty delimiter 9166 setValO(self, "AAd"); 9167 freeO(delim2); 9168 setValO(delim1, ""); 9169 setTopSO(delim2, "Ad"); 9170 r = extractSmallStringSmallJsonO(self, delim1, delim2); 9171 ck_assert_ptr_eq(r, NULL); 9172 setValO(self, "AAd"); 9173 freeO(delim2); 9174 setValO(delim1, "A"); 9175 setTopSO(delim2, ""); 9176 r = extractSmallStringSmallJsonO(self, delim1, delim2); 9177 ck_assert_ptr_eq(r, NULL); 9178 // empty string 9179 setValO(self, ""); 9180 freeO(delim2); 9181 setValO(delim1, "$"); 9182 setTopSO(delim2, "#"); 9183 r = extractSmallStringSmallJsonO(self, delim1, delim2); 9184 ck_assert_ptr_eq(r, NULL); 9185 // delim1 = delim2 9186 setValO(self, "$qwe$"); 9187 freeO(delim2); 9188 setValO(delim1, "$"); 9189 setTopSO(delim2, "$"); 9190 r = extractSmallStringSmallJsonO(self, delim1, delim2); 9191 ck_assert_ptr_eq(r, NULL); 9192 // non json string 9193 freeO(delim2); 9194 r = extractSmallStringSmallJsonO(self, delim1, delim2); 9195 ck_assert_ptr_eq(r, NULL); 9196 // non json object 9197 terminateO(delim1); 9198 delim1 = (smallStringt*) allocSmallInt(1); 9199 setTopSO(delim2, "$"); 9200 r = extractSmallStringSmallJsonO(self, delim1, delim2); 9201 ck_assert_ptr_eq(r, NULL); 9202 terminateO(delim1); 9203 delim1 = allocSmallString(";"); 9204 terminateO(delim2); 9205 delim2 = (smallJsont*) allocSmallInt(1); 9206 r = extractSmallStringSmallJsonO(self, delim1, delim2); 9207 ck_assert_ptr_eq(r, NULL); 9208 terminateO(delim2); 9209 delim2 = allocSmallJson(); 9210 // NULL string 9211 freeO(self); 9212 freeO(delim2); 9213 setValO(delim1, ";"); 9214 setTopSO(delim2, ","); 9215 ck_assert_ptr_eq(extractSmallStringSmallJsonO(self, delim1, delim2), NULL); 9216 // NULL delimiter 9217 setValO(self, "test"); 9218 ck_assert_ptr_eq(extractSmallStringSmallJsonO(self, NULL, delim2), NULL); 9219 ck_assert_ptr_eq(extractSmallStringSmallJsonO(self, delim1, NULL), NULL); 9220 terminateO(delim1); 9221 terminateO(delim2); 9222 terminateO(self); 9223 9224 END_TEST 9225 9226 9227 START_TEST(extractSmallStringSmallStringSmallStringT) 9228 9229 smallArrayt* r; 9230 smallStringt *self = allocG(""); 9231 smallStringt* delim1 = allocSmallString("/"); 9232 smallStringt* delim2 = allocSmallString("|"); 9233 9234 // string 9235 setValO(self, "one/two|"); 9236 setValO(delim2, "|"); 9237 r = extractSmallStringSmallStringO(self, delim1, delim2); 9238 ck_assert_ptr_ne(r, null); 9239 char *s = toStringO(r); 9240 ck_assert_str_eq(s, "[\"two\"]"); 9241 free(s); 9242 terminateO(r); 9243 // delimiter not found 9244 setValO(self, "one/two"); 9245 setValO(delim1, "||"); 9246 setValO(delim2, "/"); 9247 r = extractSmallStringSmallStringO(self, delim1, delim2); 9248 ck_assert_ptr_eq(r, NULL); 9249 // extractSmallStringSmallStringO with several delimiters after each other 9250 setValO(self, "one/ two /three "); 9251 setValO(delim1, "/"); 9252 setValO(delim2, " "); 9253 r = extractSmallStringSmallStringO(self, delim1, delim2); 9254 ck_assert_ptr_ne(r, null); 9255 s = toStringO(r); 9256 ck_assert_str_eq(s, "[\"\",\"three\"]"); 9257 free(s); 9258 terminateO(r); 9259 // multiple character delimiter 9260 setValO(self, "AAe thre|e extract"); 9261 setValO(delim1, "e "); 9262 setValO(delim2, "|"); 9263 r = extractSmallStringSmallStringO(self, delim1, delim2); 9264 ck_assert_ptr_ne(r, null); 9265 s = toStringO(r); 9266 ck_assert_str_eq(s, "[\"thre\"]"); 9267 free(s); 9268 terminateO(r); 9269 // empty delimiter 9270 setValO(self, "AAd"); 9271 setValO(delim1, ""); 9272 setValO(delim2, "Ad"); 9273 r = extractSmallStringSmallStringO(self, delim1, delim2); 9274 ck_assert_ptr_eq(r, NULL); 9275 setValO(self, "AAd"); 9276 setValO(delim1, "A"); 9277 setValO(delim2, ""); 9278 r = extractSmallStringSmallStringO(self, delim1, delim2); 9279 ck_assert_ptr_eq(r, NULL); 9280 // empty string 9281 setValO(self, ""); 9282 setValO(delim1, "$"); 9283 setValO(delim2, "#"); 9284 r = extractSmallStringSmallStringO(self, delim1, delim2); 9285 ck_assert_ptr_eq(r, NULL); 9286 // delim1 = delim2 9287 setValO(self, "$qwe$"); 9288 setValO(delim1, "$"); 9289 setValO(delim2, "$"); 9290 r = extractSmallStringSmallStringO(self, delim1, delim2); 9291 ck_assert_ptr_eq(r, NULL); 9292 // non json object 9293 terminateO(delim1); 9294 delim1 = (smallStringt*) allocSmallInt(1); 9295 r = extractSmallStringSmallStringO(self, delim1, delim2); 9296 ck_assert_ptr_eq(r, NULL); 9297 terminateO(delim1); 9298 delim1 = allocSmallString(";"); 9299 terminateO(delim2); 9300 delim2 = (smallStringt*) allocSmallInt(1); 9301 r = extractSmallStringSmallStringO(self, delim1, delim2); 9302 ck_assert_ptr_eq(r, NULL); 9303 terminateO(delim2); 9304 delim2 = allocSmallString(","); 9305 // NULL string 9306 freeO(self); 9307 setValO(delim1, ";"); 9308 ck_assert_ptr_eq(extractSmallStringSmallStringO(self, delim1, delim2), NULL); 9309 // NULL delimiter 9310 setValO(self, "test"); 9311 ck_assert_ptr_eq(extractSmallStringSmallStringO(self, NULL, delim2), NULL); 9312 ck_assert_ptr_eq(extractSmallStringSmallStringO(self, delim1, NULL), NULL); 9313 terminateO(delim1); 9314 terminateO(delim2); 9315 terminateO(self); 9316 9317 END_TEST 9318 9319 9320 START_TEST(extractSmallStringSSmallStringT) 9321 9322 smallArrayt* r; 9323 smallStringt *self = allocG(""); 9324 smallStringt* delim1 = allocSmallString("/"); 9325 9326 // string 9327 setValO(self, "one/two|"); 9328 r = extractSmallStringSO(self, delim1, "|"); 9329 ck_assert_ptr_ne(r, null); 9330 char *s = toStringO(r); 9331 ck_assert_str_eq(s, "[\"two\"]"); 9332 free(s); 9333 terminateO(r); 9334 // delimiter not found 9335 setValO(self, "one/two"); 9336 setValO(delim1, "||"); 9337 r = extractSmallStringSO(self, delim1, "/"); 9338 ck_assert_ptr_eq(r, NULL); 9339 // extractSmallStringSO with several delimiters after each other 9340 setValO(self, "one/ two /three "); 9341 setValO(delim1, "/"); 9342 r = extractSmallStringSO(self, delim1, " "); 9343 ck_assert_ptr_ne(r, null); 9344 s = toStringO(r); 9345 ck_assert_str_eq(s, "[\"\",\"three\"]"); 9346 free(s); 9347 terminateO(r); 9348 // multiple character delimiter 9349 setValO(self, "AAe thre|e extract"); 9350 setValO(delim1, "e "); 9351 r = extractSmallStringSO(self, delim1, "|"); 9352 ck_assert_ptr_ne(r, null); 9353 s = toStringO(r); 9354 ck_assert_str_eq(s, "[\"thre\"]"); 9355 free(s); 9356 terminateO(r); 9357 // empty delimiter 9358 setValO(self, "AAd"); 9359 setValO(delim1, ""); 9360 r = extractSmallStringSO(self, delim1, "Ad"); 9361 ck_assert_ptr_eq(r, NULL); 9362 setValO(self, "AAd"); 9363 setValO(delim1, "A"); 9364 r = extractSmallStringSO(self, delim1, ""); 9365 ck_assert_ptr_eq(r, NULL); 9366 // empty string 9367 setValO(self, ""); 9368 setValO(delim1, "$"); 9369 r = extractSmallStringSO(self, delim1, "#"); 9370 ck_assert_ptr_eq(r, NULL); 9371 // delim1 = delim2 9372 setValO(self, "$qwe$"); 9373 setValO(delim1, "$"); 9374 r = extractSmallStringSO(self, delim1, "$"); 9375 ck_assert_ptr_eq(r, NULL); 9376 // non json object 9377 terminateO(delim1); 9378 delim1 = (smallStringt*) allocSmallInt(1); 9379 r = extractSmallStringSO(self, delim1, "$"); 9380 ck_assert_ptr_eq(r, NULL); 9381 terminateO(delim1); 9382 delim1 = allocSmallString(";"); 9383 // NULL string 9384 freeO(self); 9385 setValO(delim1, ";"); 9386 ck_assert_ptr_eq(extractSmallStringSO(self, delim1, ","), NULL); 9387 // NULL delimiter 9388 setValO(self, "test"); 9389 ck_assert_ptr_eq(extractSmallStringSO(self, NULL, ","), NULL); 9390 ck_assert_ptr_eq(extractSmallStringSO(self, delim1, NULL), NULL); 9391 terminateO(delim1); 9392 terminateO(self); 9393 9394 END_TEST 9395 9396 9397 START_TEST(extractSmallStringCharSmallStringT) 9398 9399 smallArrayt* r; 9400 smallStringt *self = allocG(""); 9401 smallStringt* delim1 = allocSmallString("/"); 9402 9403 // string 9404 setValO(self, "one/two|"); 9405 r = extractSmallStringCharO(self, delim1, '|'); 9406 ck_assert_ptr_ne(r, null); 9407 char *s = toStringO(r); 9408 ck_assert_str_eq(s, "[\"two\"]"); 9409 free(s); 9410 terminateO(r); 9411 // delimiter not found 9412 setValO(self, "one/two"); 9413 setValO(delim1, "||"); 9414 r = extractSmallStringCharO(self, delim1, '/'); 9415 ck_assert_ptr_eq(r, NULL); 9416 // extractSmallStringCharO with several delimiters after each other 9417 setValO(self, "one/ two /three "); 9418 setValO(delim1, "/"); 9419 r = extractSmallStringCharO(self, delim1, ' '); 9420 ck_assert_ptr_ne(r, null); 9421 s = toStringO(r); 9422 ck_assert_str_eq(s, "[\"\",\"three\"]"); 9423 free(s); 9424 terminateO(r); 9425 // multiple character delimiter 9426 setValO(self, "AAe thre|e extract"); 9427 setValO(delim1, "e "); 9428 r = extractSmallStringCharO(self, delim1, '|'); 9429 ck_assert_ptr_ne(r, null); 9430 s = toStringO(r); 9431 ck_assert_str_eq(s, "[\"thre\"]"); 9432 free(s); 9433 terminateO(r); 9434 // empty delimiter 9435 setValO(self, "AAd"); 9436 setValO(delim1, ""); 9437 r = extractSmallStringCharO(self, delim1, 'A'); 9438 ck_assert_ptr_eq(r, NULL); 9439 setValO(self, "AAd"); 9440 setValO(delim1, "A"); 9441 // empty string 9442 setValO(self, ""); 9443 setValO(delim1, "$"); 9444 r = extractSmallStringCharO(self, delim1, '#'); 9445 ck_assert_ptr_eq(r, NULL); 9446 // delim1 = delim2 9447 setValO(self, "$qwe$"); 9448 setValO(delim1, "$"); 9449 r = extractSmallStringCharO(self, delim1, '$'); 9450 ck_assert_ptr_eq(r, NULL); 9451 // non json object 9452 terminateO(delim1); 9453 delim1 = (smallStringt*) allocSmallInt(1); 9454 r = extractSmallStringCharO(self, delim1, '$'); 9455 ck_assert_ptr_eq(r, NULL); 9456 terminateO(delim1); 9457 delim1 = allocSmallString(";"); 9458 // NULL string 9459 freeO(self); 9460 setValO(delim1, ";"); 9461 ck_assert_ptr_eq(extractSmallStringCharO(self, delim1, ','), NULL); 9462 // NULL delimiter 9463 setValO(self, "test"); 9464 ck_assert_ptr_eq(extractSmallStringCharO(self, NULL, ','), NULL); 9465 terminateO(delim1); 9466 terminateO(self); 9467 9468 END_TEST 9469 9470 9471 START_TEST(extractSSmallJsonSmallStringT) 9472 9473 smallArrayt* r; 9474 smallStringt *self = allocG(""); 9475 smallJsont* delim2 = allocSmallJson(); 9476 9477 // string 9478 setValO(self, "one/two|"); 9479 setTopSO(delim2, "|"); 9480 r = extractSSmallJsonO(self, "/", delim2); 9481 ck_assert_ptr_ne(r, null); 9482 char *s = toStringO(r); 9483 ck_assert_str_eq(s, "[\"two\"]"); 9484 free(s); 9485 terminateO(r); 9486 // delimiter not found 9487 setValO(self, "one/two"); 9488 freeO(delim2); 9489 setTopSO(delim2, "/"); 9490 r = extractSSmallJsonO(self, "||", delim2); 9491 ck_assert_ptr_eq(r, NULL); 9492 // extractSSmallJsonO with several delimiters after each other 9493 setValO(self, "one/ two /three "); 9494 freeO(delim2); 9495 setTopSO(delim2, " "); 9496 r = extractSSmallJsonO(self, "/", delim2); 9497 ck_assert_ptr_ne(r, null); 9498 s = toStringO(r); 9499 ck_assert_str_eq(s, "[\"\",\"three\"]"); 9500 free(s); 9501 terminateO(r); 9502 // multiple character delimiter 9503 setValO(self, "AAe thre|e extract"); 9504 freeO(delim2); 9505 setTopSO(delim2, "|"); 9506 r = extractSSmallJsonO(self, "e ", delim2); 9507 ck_assert_ptr_ne(r, null); 9508 s = toStringO(r); 9509 ck_assert_str_eq(s, "[\"thre\"]"); 9510 free(s); 9511 terminateO(r); 9512 // empty delimiter 9513 setValO(self, "AAd"); 9514 freeO(delim2); 9515 setTopSO(delim2, "Ad"); 9516 r = extractSSmallJsonO(self, "", delim2); 9517 ck_assert_ptr_eq(r, NULL); 9518 setValO(self, "AAd"); 9519 freeO(delim2); 9520 setTopSO(delim2, ""); 9521 r = extractSSmallJsonO(self, "A", delim2); 9522 ck_assert_ptr_eq(r, NULL); 9523 // empty string 9524 setValO(self, ""); 9525 freeO(delim2); 9526 setTopSO(delim2, "#"); 9527 r = extractSSmallJsonO(self, "$", delim2); 9528 ck_assert_ptr_eq(r, NULL); 9529 // delim1 = delim2 9530 setValO(self, "$qwe$"); 9531 freeO(delim2); 9532 setTopSO(delim2, "$"); 9533 r = extractSSmallJsonO(self, "$", delim2); 9534 ck_assert_ptr_eq(r, NULL); 9535 // non json string 9536 freeO(delim2); 9537 r = extractSSmallJsonO(self, "$", delim2); 9538 ck_assert_ptr_eq(r, NULL); 9539 // non json object 9540 terminateO(delim2); 9541 delim2 = (smallJsont*) allocSmallInt(1); 9542 r = extractSSmallJsonO(self, ";", delim2); 9543 ck_assert_ptr_eq(r, NULL); 9544 terminateO(delim2); 9545 delim2 = allocSmallJson(); 9546 // NULL string 9547 freeO(self); 9548 freeO(delim2); 9549 setTopSO(delim2, ","); 9550 ck_assert_ptr_eq(extractSSmallJsonO(self, ";", delim2), NULL); 9551 // NULL delimiter 9552 setValO(self, "test"); 9553 ck_assert_ptr_eq(extractSSmallJsonO(self, NULL, delim2), NULL); 9554 ck_assert_ptr_eq(extractSSmallJsonO(self, ";", NULL), NULL); 9555 terminateO(delim2); 9556 terminateO(self); 9557 9558 END_TEST 9559 9560 9561 START_TEST(extractSSmallStringSmallStringT) 9562 9563 smallArrayt* r; 9564 smallStringt *self = allocG(""); 9565 smallStringt* delim2 = allocSmallString("|"); 9566 9567 // string 9568 setValO(self, "one/two|"); 9569 setValO(delim2, "|"); 9570 r = extractSSmallStringO(self, "/", delim2); 9571 ck_assert_ptr_ne(r, null); 9572 char *s = toStringO(r); 9573 ck_assert_str_eq(s, "[\"two\"]"); 9574 free(s); 9575 terminateO(r); 9576 // delimiter not found 9577 setValO(self, "one/two"); 9578 setValO(delim2, "/"); 9579 r = extractSSmallStringO(self, "||", delim2); 9580 ck_assert_ptr_eq(r, NULL); 9581 // extractSSmallStringO with several delimiters after each other 9582 setValO(self, "one/ two /three "); 9583 setValO(delim2, " "); 9584 r = extractSSmallStringO(self, "/", delim2); 9585 ck_assert_ptr_ne(r, null); 9586 s = toStringO(r); 9587 ck_assert_str_eq(s, "[\"\",\"three\"]"); 9588 free(s); 9589 terminateO(r); 9590 // multiple character delimiter 9591 setValO(self, "AAe thre|e extract"); 9592 setValO(delim2, "|"); 9593 r = extractSSmallStringO(self, "e ", delim2); 9594 ck_assert_ptr_ne(r, null); 9595 s = toStringO(r); 9596 ck_assert_str_eq(s, "[\"thre\"]"); 9597 free(s); 9598 terminateO(r); 9599 // empty delimiter 9600 setValO(self, "AAd"); 9601 setValO(delim2, "Ad"); 9602 r = extractSSmallStringO(self, "", delim2); 9603 ck_assert_ptr_eq(r, NULL); 9604 setValO(self, "AAd"); 9605 setValO(delim2, ""); 9606 r = extractSSmallStringO(self, "A", delim2); 9607 ck_assert_ptr_eq(r, NULL); 9608 // empty string 9609 setValO(self, ""); 9610 setValO(delim2, "#"); 9611 r = extractSSmallStringO(self, "$", delim2); 9612 ck_assert_ptr_eq(r, NULL); 9613 // delim1 = delim2 9614 setValO(self, "$qwe$"); 9615 setValO(delim2, "$"); 9616 r = extractSSmallStringO(self, "$", delim2); 9617 ck_assert_ptr_eq(r, NULL); 9618 // non json object 9619 terminateO(delim2); 9620 delim2 = (smallStringt*) allocSmallInt(1); 9621 r = extractSSmallStringO(self, ";", delim2); 9622 ck_assert_ptr_eq(r, NULL); 9623 terminateO(delim2); 9624 delim2 = allocSmallString(","); 9625 // NULL string 9626 freeO(self); 9627 ck_assert_ptr_eq(extractSSmallStringO(self, ";", delim2), NULL); 9628 // NULL delimiter 9629 setValO(self, "test"); 9630 ck_assert_ptr_eq(extractSSmallStringO(self, NULL, delim2), NULL); 9631 ck_assert_ptr_eq(extractSSmallStringO(self, ";", NULL), NULL); 9632 terminateO(delim2); 9633 terminateO(self); 9634 9635 END_TEST 9636 9637 9638 START_TEST(extractCharSmallJsonSmallStringT) 9639 9640 smallArrayt* r; 9641 smallStringt *self = allocG(""); 9642 smallJsont* delim2 = allocSmallJson(); 9643 9644 // string 9645 setValO(self, "one/two|"); 9646 setTopSO(delim2, "|"); 9647 r = extractCharSmallJsonO(self, '/', delim2); 9648 ck_assert_ptr_ne(r, null); 9649 char *s = toStringO(r); 9650 ck_assert_str_eq(s, "[\"two\"]"); 9651 free(s); 9652 terminateO(r); 9653 // delimiter not found 9654 setValO(self, "one/two"); 9655 freeO(delim2); 9656 setTopSO(delim2, "/"); 9657 r = extractCharSmallJsonO(self, '|', delim2); 9658 ck_assert_ptr_eq(r, NULL); 9659 // extractCharSmallJsonO with several delimiters after each other 9660 setValO(self, "one/ two /three "); 9661 freeO(delim2); 9662 setTopSO(delim2, " "); 9663 r = extractCharSmallJsonO(self, '/', delim2); 9664 ck_assert_ptr_ne(r, null); 9665 s = toStringO(r); 9666 ck_assert_str_eq(s, "[\"\",\"three\"]"); 9667 free(s); 9668 terminateO(r); 9669 // multiple character delimiter 9670 setValO(self, "AAe thre|e extract"); 9671 freeO(delim2); 9672 setTopSO(delim2, "|"); 9673 r = extractCharSmallJsonO(self, ' ', delim2); 9674 ck_assert_ptr_ne(r, null); 9675 s = toStringO(r); 9676 ck_assert_str_eq(s, "[\"thre\"]"); 9677 free(s); 9678 terminateO(r); 9679 // empty delimiter 9680 setValO(self, "AAd"); 9681 freeO(delim2); 9682 setTopSO(delim2, ""); 9683 r = extractCharSmallJsonO(self, 'A', delim2); 9684 ck_assert_ptr_eq(r, NULL); 9685 // empty string 9686 setValO(self, ""); 9687 freeO(delim2); 9688 setTopSO(delim2, "#"); 9689 r = extractCharSmallJsonO(self, '$', delim2); 9690 ck_assert_ptr_eq(r, NULL); 9691 // delim1 = delim2 9692 setValO(self, "$qwe$"); 9693 freeO(delim2); 9694 setTopSO(delim2, "$"); 9695 r = extractCharSmallJsonO(self, '$', delim2); 9696 ck_assert_ptr_eq(r, NULL); 9697 // non json string 9698 freeO(delim2); 9699 r = extractCharSmallJsonO(self, '$', delim2); 9700 ck_assert_ptr_eq(r, NULL); 9701 // non json object 9702 terminateO(delim2); 9703 delim2 = (smallJsont*) allocSmallInt(1); 9704 r = extractCharSmallJsonO(self, ';', delim2); 9705 ck_assert_ptr_eq(r, NULL); 9706 terminateO(delim2); 9707 delim2 = allocSmallJson(); 9708 // NULL string 9709 freeO(self); 9710 freeO(delim2); 9711 setTopSO(delim2, ","); 9712 ck_assert_ptr_eq(extractCharSmallJsonO(self, ';', delim2), NULL); 9713 // NULL delimiter 9714 setValO(self, "test"); 9715 ck_assert_ptr_eq(extractCharSmallJsonO(self, ';', NULL), NULL); 9716 terminateO(delim2); 9717 terminateO(self); 9718 9719 END_TEST 9720 9721 9722 START_TEST(extractCharSmallStringSmallStringT) 9723 9724 smallArrayt* r; 9725 smallStringt *self = allocG(""); 9726 smallStringt* delim2 = allocSmallString("|"); 9727 9728 // string 9729 setValO(self, "one/two|"); 9730 setValO(delim2, "|"); 9731 r = extractCharSmallStringO(self, '/', delim2); 9732 ck_assert_ptr_ne(r, null); 9733 char *s = toStringO(r); 9734 ck_assert_str_eq(s, "[\"two\"]"); 9735 free(s); 9736 terminateO(r); 9737 // delimiter not found 9738 setValO(self, "one/two"); 9739 setValO(delim2, "/"); 9740 r = extractCharSmallStringO(self, '|', delim2); 9741 ck_assert_ptr_eq(r, NULL); 9742 // extractCharSmallStringO with several delimiters after each other 9743 setValO(self, "one/ two /three "); 9744 setValO(delim2, " "); 9745 r = extractCharSmallStringO(self, '/', delim2); 9746 ck_assert_ptr_ne(r, null); 9747 s = toStringO(r); 9748 ck_assert_str_eq(s, "[\"\",\"three\"]"); 9749 free(s); 9750 terminateO(r); 9751 // multiple character delimiter 9752 setValO(self, "AAe thre|e extract"); 9753 setValO(delim2, "|e"); 9754 r = extractCharSmallStringO(self, ' ', delim2); 9755 ck_assert_ptr_ne(r, null); 9756 s = toStringO(r); 9757 ck_assert_str_eq(s, "[\"thre\"]"); 9758 free(s); 9759 terminateO(r); 9760 // empty delimiter 9761 setValO(self, "AAd"); 9762 setValO(delim2, ""); 9763 r = extractCharSmallStringO(self, 'A', delim2); 9764 ck_assert_ptr_eq(r, NULL); 9765 // empty string 9766 setValO(self, ""); 9767 setValO(delim2, "#"); 9768 r = extractCharSmallStringO(self, '$', delim2); 9769 ck_assert_ptr_eq(r, NULL); 9770 // delim1 = delim2 9771 setValO(self, "$qwe$"); 9772 setValO(delim2, "$"); 9773 r = extractCharSmallStringO(self, '$', delim2); 9774 ck_assert_ptr_eq(r, NULL); 9775 // non json object 9776 terminateO(delim2); 9777 delim2 = (smallStringt*) allocSmallInt(1); 9778 r = extractCharSmallStringO(self, ';', delim2); 9779 ck_assert_ptr_eq(r, NULL); 9780 terminateO(delim2); 9781 delim2 = allocSmallString(","); 9782 // NULL string 9783 freeO(self); 9784 ck_assert_ptr_eq(extractCharSmallStringO(self, ';', delim2), NULL); 9785 // NULL delimiter 9786 setValO(self, "test"); 9787 ck_assert_ptr_eq(extractCharSmallStringO(self, ';', NULL), NULL); 9788 terminateO(delim2); 9789 terminateO(self); 9790 9791 END_TEST 9792 9793 9794 START_TEST(icSplitSmallStringT) 9795 9796 smallArrayt* r; 9797 smallStringt *self = allocG(""); 9798 9799 // string 9800 setValO(self, "one/two"); 9801 r = icSplitO(self, "/"); 9802 ck_assert_ptr_ne(r, null); 9803 char *s = toStringO(r); 9804 ck_assert_str_eq(s, "[\"one\",\"two\"]"); 9805 free(s); 9806 terminateO(r); 9807 // delimiter on the edge 9808 setValO(self, "/one"); 9809 r = icSplitO(self, "/"); 9810 ck_assert_ptr_ne(r, null); 9811 s = toStringO(r); 9812 ck_assert_str_eq(s, "[\"\",\"one\"]"); 9813 free(s); 9814 terminateO(r); 9815 setValO(self, "one/"); 9816 r = icSplitO(self, "/"); 9817 ck_assert_ptr_ne(r, null); 9818 s = toStringO(r); 9819 ck_assert_str_eq(s, "[\"one\",\"\"]"); 9820 free(s); 9821 terminateO(r); 9822 // delimiter not found 9823 setValO(self, "one/two"); 9824 r = icSplitO(self, "||"); 9825 ck_assert_ptr_ne(r, null); 9826 s = toStringO(r); 9827 ck_assert_str_eq(s, "[\"one/two\"]"); 9828 free(s); 9829 terminateO(r); 9830 // icSplit with several delimiters after each other 9831 setValO(self, "one/two three "); 9832 r = icSplitO(self, " "); 9833 ck_assert_ptr_ne(r, null); 9834 s = toStringO(r); 9835 ck_assert_str_eq(s, "[\"one/two\",\"\",\"three\",\"\"]"); 9836 free(s); 9837 terminateO(r); 9838 // multiple character delimiter 9839 setValO(self, "AAe three extract"); 9840 r = icSplitO(self, "E "); 9841 ck_assert_ptr_ne(r, null); 9842 s = toStringO(r); 9843 ck_assert_str_eq(s, "[\"AA\",\"thre\",\"extract\"]"); 9844 free(s); 9845 terminateO(r); 9846 // empty delimiter 9847 setValO(self, "AAd"); 9848 r = icSplitO(self, ""); 9849 ck_assert_ptr_ne(r, null); 9850 s = toStringO(r); 9851 ck_assert_str_eq(s, "[\"AAd\"]"); 9852 free(s); 9853 terminateO(r); 9854 // empty string 9855 emptyO(self); 9856 r = icSplitO(self, "$"); 9857 ck_assert_ptr_ne(r, null); 9858 s = toStringO(r); 9859 ck_assert_str_eq(s, "[\"\"]"); 9860 free(s); 9861 terminateO(r); 9862 // NULL list 9863 freeO(self); 9864 ck_assert_ptr_eq(icSplitO(self, ";"), NULL); 9865 // NULL delimiter 9866 setValO(self, "test"); 9867 ck_assert_ptr_eq(icSplitO(self, NULL), NULL); 9868 terminateO(self); 9869 9870 END_TEST 9871 9872 9873 START_TEST(icSplitCharSmallStringT) 9874 9875 smallArrayt* r; 9876 smallStringt *self = allocG(""); 9877 9878 // string 9879 setValO(self, "one/two"); 9880 r = icSplitCharO(self, 'T'); 9881 ck_assert_ptr_ne(r, null); 9882 char *s = toStringO(r); 9883 ck_assert_str_eq(s, "[\"one/\",\"wo\"]"); 9884 free(s); 9885 terminateO(r); 9886 // delimiter on the edge 9887 setValO(self, "/one"); 9888 r = icSplitCharO(self, '/'); 9889 ck_assert_ptr_ne(r, null); 9890 s = toStringO(r); 9891 ck_assert_str_eq(s, "[\"\",\"one\"]"); 9892 free(s); 9893 terminateO(r); 9894 setValO(self, "one/"); 9895 r = icSplitCharO(self, '/'); 9896 ck_assert_ptr_ne(r, null); 9897 s = toStringO(r); 9898 ck_assert_str_eq(s, "[\"one\",\"\"]"); 9899 free(s); 9900 terminateO(r); 9901 // delimiter not found 9902 setValO(self, "one/two"); 9903 r = icSplitCharO(self, '|'); 9904 ck_assert_ptr_ne(r, null); 9905 s = toStringO(r); 9906 ck_assert_str_eq(s, "[\"one/two\"]"); 9907 free(s); 9908 terminateO(r); 9909 // icSplit with several delimiters after each other 9910 setValO(self, "one/two three "); 9911 r = icSplitCharO(self, ' '); 9912 ck_assert_ptr_ne(r, null); 9913 s = toStringO(r); 9914 ck_assert_str_eq(s, "[\"one/two\",\"\",\"three\",\"\"]"); 9915 free(s); 9916 terminateO(r); 9917 // empty string 9918 emptyO(self); 9919 r = icSplitCharO(self, '$'); 9920 ck_assert_ptr_ne(r, null); 9921 s = toStringO(r); 9922 ck_assert_str_eq(s, "[\"\"]"); 9923 free(s); 9924 terminateO(r); 9925 // NULL list 9926 freeO(self); 9927 ck_assert_ptr_eq(icSplitCharO(self, ';'), NULL); 9928 terminateO(self); 9929 9930 END_TEST 9931 9932 9933 START_TEST(icSplitSmallJsonSmallStringT) 9934 9935 smallArrayt* r; 9936 smallStringt *self = allocG(""); 9937 smallJsont *delim = allocSmallJson(); 9938 9939 // string 9940 setValO(self, "one/two"); 9941 setTopSO(delim, "/"); 9942 r = self->f->icSplitSmallJson(self, delim); 9943 ck_assert_ptr_ne(r, null); 9944 char *s = toStringO(r); 9945 ck_assert_str_eq(s, "[\"one\",\"two\"]"); 9946 free(s); 9947 terminateO(r); 9948 // delimiter on the edge 9949 setValO(self, "/one"); 9950 r = self->f->icSplitSmallJson(self, delim); 9951 ck_assert_ptr_ne(r, null); 9952 s = toStringO(r); 9953 ck_assert_str_eq(s, "[\"\",\"one\"]"); 9954 free(s); 9955 terminateO(r); 9956 setValO(self, "one/"); 9957 r = self->f->icSplitSmallJson(self, delim); 9958 ck_assert_ptr_ne(r, null); 9959 s = toStringO(r); 9960 ck_assert_str_eq(s, "[\"one\",\"\"]"); 9961 free(s); 9962 terminateO(r); 9963 // delimiter not found 9964 setValO(self, "one/two"); 9965 freeO(delim); 9966 setTopSO(delim, "||"); 9967 r = self->f->icSplitSmallJson(self, delim); 9968 ck_assert_ptr_ne(r, null); 9969 s = toStringO(r); 9970 ck_assert_str_eq(s, "[\"one/two\"]"); 9971 free(s); 9972 terminateO(r); 9973 // icSplit with several delimiters after each other 9974 setValO(self, "one/two three "); 9975 freeO(delim); 9976 setTopSO(delim, " "); 9977 r = self->f->icSplitSmallJson(self, delim); 9978 ck_assert_ptr_ne(r, null); 9979 s = toStringO(r); 9980 ck_assert_str_eq(s, "[\"one/two\",\"\",\"three\",\"\"]"); 9981 free(s); 9982 terminateO(r); 9983 // multiple character delimiter 9984 setValO(self, "AAe three extract"); 9985 freeO(delim); 9986 setTopSO(delim, "E "); 9987 r = self->f->icSplitSmallJson(self, delim); 9988 ck_assert_ptr_ne(r, null); 9989 s = toStringO(r); 9990 ck_assert_str_eq(s, "[\"AA\",\"thre\",\"extract\"]"); 9991 free(s); 9992 terminateO(r); 9993 // empty delimiter 9994 setValO(self, "AAd"); 9995 freeO(delim); 9996 setTopSO(delim, ""); 9997 r = self->f->icSplitSmallJson(self, delim); 9998 ck_assert_ptr_ne(r, null); 9999 s = toStringO(r); 10000 ck_assert_str_eq(s, "[\"AAd\"]"); 10001 free(s); 10002 terminateO(r); 10003 // empty string 10004 emptyO(self); 10005 freeO(delim); 10006 setTopSO(delim, "$"); 10007 r = self->f->icSplitSmallJson(self, delim); 10008 ck_assert_ptr_ne(r, null); 10009 s = toStringO(r); 10010 ck_assert_str_eq(s, "[\"\"]"); 10011 free(s); 10012 terminateO(r); 10013 // non json string delimiter 10014 freeO(delim); 10015 ck_assert_ptr_eq(self->f->icSplitSmallJson(self, delim), NULL); 10016 // non json object delimiter 10017 terminateO(delim); 10018 delim = (smallJsont*) allocSmallInt(1); 10019 ck_assert_ptr_eq(self->f->icSplitSmallJson(self, delim), NULL); 10020 terminateO(delim); 10021 delim = allocSmallJson(); 10022 // NULL list 10023 freeO(self); 10024 freeO(delim); 10025 setTopSO(delim, ";"); 10026 ck_assert_ptr_eq(self->f->icSplitSmallJson(self, delim), NULL); 10027 // NULL delimiter 10028 setValO(self, "test"); 10029 ck_assert_ptr_eq(self->f->icSplitSmallJson(self, NULL), NULL); 10030 terminateO(delim); 10031 terminateO(self); 10032 10033 END_TEST 10034 10035 10036 START_TEST(icSplitSmallStringSmallStringT) 10037 10038 smallArrayt* r; 10039 smallStringt *self = allocG(""); 10040 smallStringt *delim = allocSmallString("/"); 10041 10042 // string 10043 setValO(self, "one/two"); 10044 r = self->f->icSplitSmallString(self, delim); 10045 ck_assert_ptr_ne(r, null); 10046 char *s = toStringO(r); 10047 ck_assert_str_eq(s, "[\"one\",\"two\"]"); 10048 free(s); 10049 terminateO(r); 10050 // delimiter on the edge 10051 setValO(self, "/one"); 10052 r = self->f->icSplitSmallString(self, delim); 10053 ck_assert_ptr_ne(r, null); 10054 s = toStringO(r); 10055 ck_assert_str_eq(s, "[\"\",\"one\"]"); 10056 free(s); 10057 terminateO(r); 10058 setValO(self, "one/"); 10059 r = self->f->icSplitSmallString(self, delim); 10060 ck_assert_ptr_ne(r, null); 10061 s = toStringO(r); 10062 ck_assert_str_eq(s, "[\"one\",\"\"]"); 10063 free(s); 10064 terminateO(r); 10065 // delimiter not found 10066 setValO(self, "one/two"); 10067 setValO(delim, "||"); 10068 r = self->f->icSplitSmallString(self, delim); 10069 ck_assert_ptr_ne(r, null); 10070 s = toStringO(r); 10071 ck_assert_str_eq(s, "[\"one/two\"]"); 10072 free(s); 10073 terminateO(r); 10074 // icSplit with several delimiters after each other 10075 setValO(self, "one/two three "); 10076 setValO(delim, " "); 10077 r = self->f->icSplitSmallString(self, delim); 10078 ck_assert_ptr_ne(r, null); 10079 s = toStringO(r); 10080 ck_assert_str_eq(s, "[\"one/two\",\"\",\"three\",\"\"]"); 10081 free(s); 10082 terminateO(r); 10083 // multiple character delimiter 10084 setValO(self, "AAe three extract"); 10085 setValO(delim, "E "); 10086 r = self->f->icSplitSmallString(self, delim); 10087 ck_assert_ptr_ne(r, null); 10088 s = toStringO(r); 10089 ck_assert_str_eq(s, "[\"AA\",\"thre\",\"extract\"]"); 10090 free(s); 10091 terminateO(r); 10092 // empty delimiter 10093 setValO(self, "AAd"); 10094 setValO(delim, ""); 10095 r = self->f->icSplitSmallString(self, delim); 10096 ck_assert_ptr_ne(r, null); 10097 s = toStringO(r); 10098 ck_assert_str_eq(s, "[\"AAd\"]"); 10099 free(s); 10100 terminateO(r); 10101 // empty string 10102 emptyO(self); 10103 setValO(delim, "$"); 10104 r = self->f->icSplitSmallString(self, delim); 10105 ck_assert_ptr_ne(r, null); 10106 s = toStringO(r); 10107 ck_assert_str_eq(s, "[\"\"]"); 10108 free(s); 10109 terminateO(r); 10110 // null string delimiter 10111 freeO(delim); 10112 ck_assert_ptr_eq(self->f->icSplitSmallString(self, delim), NULL); 10113 // non json object delimiter 10114 terminateO(delim); 10115 delim = (smallStringt*) allocSmallInt(1); 10116 ck_assert_ptr_eq(self->f->icSplitSmallString(self, delim), NULL); 10117 terminateO(delim); 10118 // NULL list 10119 freeO(self); 10120 delim = allocSmallString(";"); 10121 ck_assert_ptr_eq(self->f->icSplitSmallString(self, delim), NULL); 10122 // NULL delimiter 10123 setValO(self, "test"); 10124 ck_assert_ptr_eq(self->f->icSplitSmallString(self, NULL), NULL); 10125 terminateO(delim); 10126 terminateO(self); 10127 10128 END_TEST 10129 10130 10131 START_TEST(icSplitSSmallStringT) 10132 10133 char** r; 10134 smallStringt *self = allocG(""); 10135 10136 // string 10137 setValO(self, "one/two"); 10138 r = icSplitSO(self, "/"); 10139 ck_assert_uint_eq(listLengthS(r),2); 10140 ck_assert_str_eq(r[0], "one"); 10141 ck_assert_str_eq(r[1], "two"); 10142 listFreeS(r); 10143 // delimiter on the edge 10144 setValO(self, "/one"); 10145 r = icSplitSO(self, "/"); 10146 ck_assert_uint_eq(listLengthS(r),2); 10147 ck_assert_str_eq(r[0], ""); 10148 ck_assert_str_eq(r[1], "one"); 10149 listFreeS(r); 10150 setValO(self, "one/"); 10151 r = icSplitSO(self, "/"); 10152 ck_assert_uint_eq(listLengthS(r),2); 10153 ck_assert_str_eq(r[0], "one"); 10154 ck_assert_str_eq(r[1], ""); 10155 listFreeS(r); 10156 // delimiter not found 10157 setValO(self, "one/two"); 10158 r = icSplitSO(self, "||"); 10159 ck_assert_uint_eq(listLengthS(r),1); 10160 ck_assert_str_eq(r[0], "one/two"); 10161 listFreeS(r); 10162 // icSplit with several delimiters after each other 10163 setValO(self, "one/two three "); 10164 r = icSplitSO(self, " "); 10165 ck_assert_uint_eq(listLengthS(r),4); 10166 ck_assert_str_eq(r[0], "one/two"); 10167 ck_assert_str_eq(r[1], ""); 10168 ck_assert_str_eq(r[2], "three"); 10169 ck_assert_str_eq(r[3], ""); 10170 listFreeS(r); 10171 // multiple character delimiter 10172 setValO(self, "AAe three extract"); 10173 r = icSplitSO(self, "E "); 10174 ck_assert_uint_eq(listLengthS(r),3); 10175 ck_assert_str_eq(r[0], "AA"); 10176 ck_assert_str_eq(r[1], "thre"); 10177 ck_assert_str_eq(r[2], "extract"); 10178 listFreeS(r); 10179 // empty delimiter 10180 setValO(self, "AAd"); 10181 r = icSplitSO(self, ""); 10182 ck_assert_uint_eq(listLengthS(r),1); 10183 ck_assert_str_eq(r[0], "AAd"); 10184 listFreeS(r); 10185 // empty string 10186 emptyO(self); 10187 r = icSplitSO(self, "$"); 10188 ck_assert_uint_eq(listLengthS(r),1); 10189 ck_assert_str_eq(r[0], ""); 10190 listFreeS(r); 10191 // NULL list 10192 freeO(self); 10193 ck_assert_ptr_eq(icSplitSO(self, ";"), NULL); 10194 // NULL delimiter 10195 setValO(self, "test"); 10196 ck_assert_ptr_eq(icSplitSO(self, NULL), NULL); 10197 terminateO(self); 10198 10199 END_TEST 10200 10201 10202 START_TEST(icSplitCharSSmallStringT) 10203 10204 char** r; 10205 smallStringt *self = allocG(""); 10206 10207 // string 10208 setValO(self, "one/two"); 10209 r = icSplitCharSO(self, 'T'); 10210 ck_assert_uint_eq(listLengthS(r),2); 10211 ck_assert_str_eq(r[0], "one/"); 10212 ck_assert_str_eq(r[1], "wo"); 10213 listFreeS(r); 10214 // delimiter on the edge 10215 setValO(self, "/one"); 10216 r = icSplitCharSO(self, '/'); 10217 ck_assert_uint_eq(listLengthS(r),2); 10218 ck_assert_str_eq(r[0], ""); 10219 ck_assert_str_eq(r[1], "one"); 10220 listFreeS(r); 10221 setValO(self, "one/"); 10222 r = icSplitCharSO(self, '/'); 10223 ck_assert_uint_eq(listLengthS(r),2); 10224 ck_assert_str_eq(r[0], "one"); 10225 ck_assert_str_eq(r[1], ""); 10226 listFreeS(r); 10227 // delimiter not found 10228 setValO(self, "one/two"); 10229 r = icSplitCharSO(self, '|'); 10230 ck_assert_uint_eq(listLengthS(r),1); 10231 ck_assert_str_eq(r[0], "one/two"); 10232 listFreeS(r); 10233 // icSplit with several delimiters after each other 10234 setValO(self, "one/two three "); 10235 r = icSplitCharSO(self, ' '); 10236 ck_assert_uint_eq(listLengthS(r),4); 10237 ck_assert_str_eq(r[0], "one/two"); 10238 ck_assert_str_eq(r[1], ""); 10239 ck_assert_str_eq(r[2], "three"); 10240 ck_assert_str_eq(r[3], ""); 10241 listFreeS(r); 10242 // empty string 10243 emptyO(self); 10244 r = icSplitCharSO(self, '$'); 10245 ck_assert_uint_eq(listLengthS(r),1); 10246 ck_assert_str_eq(r[0], ""); 10247 listFreeS(r); 10248 // NULL list 10249 freeO(self); 10250 ck_assert_ptr_eq(icSplitCharSO(self, ';'), NULL); 10251 terminateO(self); 10252 10253 END_TEST 10254 10255 10256 START_TEST(icSplitSmallJsonSSmallStringT) 10257 10258 char** r; 10259 smallStringt *self = allocG(""); 10260 smallJsont *delim = allocSmallJson(); 10261 10262 // string 10263 setValO(self, "one/two"); 10264 setTopSO(delim, "/"); 10265 r = icSplitSmallJsonSO(self, delim); 10266 ck_assert_uint_eq(listLengthS(r),2); 10267 ck_assert_str_eq(r[0], "one"); 10268 ck_assert_str_eq(r[1], "two"); 10269 listFreeS(r); 10270 // delimiter on the edge 10271 setValO(self, "/one"); 10272 r = icSplitSmallJsonSO(self, delim); 10273 ck_assert_uint_eq(listLengthS(r),2); 10274 ck_assert_str_eq(r[0], ""); 10275 ck_assert_str_eq(r[1], "one"); 10276 listFreeS(r); 10277 setValO(self, "one/"); 10278 r = icSplitSmallJsonSO(self, delim); 10279 ck_assert_uint_eq(listLengthS(r),2); 10280 ck_assert_str_eq(r[0], "one"); 10281 ck_assert_str_eq(r[1], ""); 10282 listFreeS(r); 10283 // delimiter not found 10284 setValO(self, "one/two"); 10285 freeO(delim); 10286 setTopSO(delim, "||"); 10287 r = icSplitSmallJsonSO(self, delim); 10288 ck_assert_uint_eq(listLengthS(r),1); 10289 ck_assert_str_eq(r[0], "one/two"); 10290 listFreeS(r); 10291 // icSplit with several delimiters after each other 10292 setValO(self, "one/two three "); 10293 freeO(delim); 10294 setTopSO(delim, " "); 10295 r = icSplitSmallJsonSO(self, delim); 10296 ck_assert_uint_eq(listLengthS(r),4); 10297 ck_assert_str_eq(r[0], "one/two"); 10298 ck_assert_str_eq(r[1], ""); 10299 ck_assert_str_eq(r[2], "three"); 10300 ck_assert_str_eq(r[3], ""); 10301 listFreeS(r); 10302 // multiple character delimiter 10303 setValO(self, "AAe three extract"); 10304 freeO(delim); 10305 setTopSO(delim, "E "); 10306 r = icSplitSmallJsonSO(self, delim); 10307 ck_assert_uint_eq(listLengthS(r),3); 10308 ck_assert_str_eq(r[0], "AA"); 10309 ck_assert_str_eq(r[1], "thre"); 10310 ck_assert_str_eq(r[2], "extract"); 10311 listFreeS(r); 10312 // empty delimiter 10313 setValO(self, "AAd"); 10314 freeO(delim); 10315 setTopSO(delim, ""); 10316 r = icSplitSmallJsonSO(self, delim); 10317 ck_assert_uint_eq(listLengthS(r),1); 10318 ck_assert_str_eq(r[0], "AAd"); 10319 listFreeS(r); 10320 // empty string 10321 emptyO(self); 10322 freeO(delim); 10323 setTopSO(delim, "$"); 10324 r = icSplitSmallJsonSO(self, delim); 10325 ck_assert_uint_eq(listLengthS(r),1); 10326 ck_assert_str_eq(r[0], ""); 10327 listFreeS(r); 10328 // non json string delimiter 10329 freeO(delim); 10330 ck_assert_ptr_eq(icSplitSmallJsonSO(self, delim), NULL); 10331 // non json object delimiter 10332 terminateO(delim); 10333 delim = (smallJsont*) allocSmallInt(1); 10334 ck_assert_ptr_eq(icSplitSmallJsonSO(self, delim), NULL); 10335 terminateO(delim); 10336 delim = allocSmallJson(); 10337 // NULL list 10338 freeO(self); 10339 freeO(delim); 10340 setTopSO(delim, ";"); 10341 ck_assert_ptr_eq(icSplitSmallJsonSO(self, delim), NULL); 10342 // NULL delimiter 10343 setValO(self, "test"); 10344 ck_assert_ptr_eq(icSplitSmallJsonSO(self, NULL), NULL); 10345 terminateO(delim); 10346 terminateO(self); 10347 10348 END_TEST 10349 10350 10351 START_TEST(icSplitSmallStringSSmallStringT) 10352 10353 char** r; 10354 smallStringt *self = allocG(""); 10355 smallStringt *delim = allocSmallString("/"); 10356 10357 // string 10358 setValO(self, "one/two"); 10359 r = icSplitSmallStringSO(self, delim); 10360 ck_assert_uint_eq(listLengthS(r),2); 10361 ck_assert_str_eq(r[0], "one"); 10362 ck_assert_str_eq(r[1], "two"); 10363 listFreeS(r); 10364 // delimiter on the edge 10365 setValO(self, "/one"); 10366 r = icSplitSmallStringSO(self, delim); 10367 ck_assert_uint_eq(listLengthS(r),2); 10368 ck_assert_str_eq(r[0], ""); 10369 ck_assert_str_eq(r[1], "one"); 10370 listFreeS(r); 10371 setValO(self, "one/"); 10372 r = icSplitSmallStringSO(self, delim); 10373 ck_assert_uint_eq(listLengthS(r),2); 10374 ck_assert_str_eq(r[0], "one"); 10375 ck_assert_str_eq(r[1], ""); 10376 listFreeS(r); 10377 // delimiter not found 10378 setValO(self, "one/two"); 10379 setValO(delim, "||"); 10380 r = icSplitSmallStringSO(self, delim); 10381 ck_assert_uint_eq(listLengthS(r),1); 10382 ck_assert_str_eq(r[0], "one/two"); 10383 listFreeS(r); 10384 // icSplit with several delimiters after each other 10385 setValO(self, "one/two three "); 10386 setValO(delim, " "); 10387 r = icSplitSmallStringSO(self, delim); 10388 ck_assert_uint_eq(listLengthS(r),4); 10389 ck_assert_str_eq(r[0], "one/two"); 10390 ck_assert_str_eq(r[1], ""); 10391 ck_assert_str_eq(r[2], "three"); 10392 ck_assert_str_eq(r[3], ""); 10393 listFreeS(r); 10394 // multiple character delimiter 10395 setValO(self, "AAe three extract"); 10396 setValO(delim, "E "); 10397 r = icSplitSmallStringSO(self, delim); 10398 ck_assert_uint_eq(listLengthS(r),3); 10399 ck_assert_str_eq(r[0], "AA"); 10400 ck_assert_str_eq(r[1], "thre"); 10401 ck_assert_str_eq(r[2], "extract"); 10402 listFreeS(r); 10403 // empty delimiter 10404 setValO(self, "AAd"); 10405 setValO(delim, ""); 10406 r = icSplitSmallStringSO(self, delim); 10407 ck_assert_uint_eq(listLengthS(r),1); 10408 ck_assert_str_eq(r[0], "AAd"); 10409 listFreeS(r); 10410 // empty string 10411 emptyO(self); 10412 setValO(delim, "$"); 10413 r = icSplitSmallStringSO(self, delim); 10414 ck_assert_uint_eq(listLengthS(r),1); 10415 ck_assert_str_eq(r[0], ""); 10416 listFreeS(r); 10417 // non smallString object delimiter 10418 terminateO(delim); 10419 delim = (smallStringt*) allocSmallInt(1); 10420 ck_assert_ptr_eq(icSplitSmallStringSO(self, delim), NULL); 10421 terminateO(delim); 10422 // NULL list 10423 freeO(self); 10424 delim = allocSmallString(";"); 10425 ck_assert_ptr_eq(icSplitSmallStringSO(self, delim), NULL); 10426 // NULL delimiter 10427 setValO(self, "test"); 10428 ck_assert_ptr_eq(icSplitSmallStringSO(self, NULL), NULL); 10429 terminateO(delim); 10430 terminateO(self); 10431 10432 END_TEST 10433 10434 10435 START_TEST(icExtractSmallStringT) 10436 10437 smallArrayt* r; 10438 smallStringt *self = allocG(""); 10439 10440 // string 10441 setValO(self, "one/twos"); 10442 r = icExtractO(self, "E", "S"); 10443 ck_assert_ptr_ne(r, null); 10444 char *s = toStringO(r); 10445 ck_assert_str_eq(s, "[\"/two\"]"); 10446 free(s); 10447 terminateO(r); 10448 // delimiter not found 10449 setValO(self, "one/two"); 10450 r = icExtractO(self, "||", "/"); 10451 ck_assert_ptr_eq(r, NULL); 10452 // icExtractO with several delimiters after each other 10453 setValO(self, "one/ two /three "); 10454 r = icExtractO(self, "/", " "); 10455 ck_assert_ptr_ne(r, null); 10456 s = toStringO(r); 10457 ck_assert_str_eq(s, "[\"\",\"three\"]"); 10458 free(s); 10459 terminateO(r); 10460 // multiple character delimiter 10461 setValO(self, "AAe thre|e icExtract"); 10462 r = icExtractO(self, "e ", "|"); 10463 ck_assert_ptr_ne(r, null); 10464 s = toStringO(r); 10465 ck_assert_str_eq(s, "[\"thre\"]"); 10466 free(s); 10467 terminateO(r); 10468 // empty delimiter 10469 setValO(self, "AAd"); 10470 r = icExtractO(self, "", "Ad"); 10471 ck_assert_ptr_eq(r, NULL); 10472 setValO(self, "AAd"); 10473 r = icExtractO(self, "A", ""); 10474 ck_assert_ptr_eq(r, NULL); 10475 // empty string 10476 setValO(self, ""); 10477 r = icExtractO(self, "$", "#"); 10478 ck_assert_ptr_eq(r, NULL); 10479 // delim1 = delim2 10480 setValO(self, ""); 10481 r = icExtractO(self, "$", "$"); 10482 ck_assert_ptr_eq(r, NULL); 10483 // NULL string 10484 freeO(self); 10485 ck_assert_ptr_eq(icExtractO(self, ";", ","), NULL); 10486 // NULL delimiter 10487 setValO(self, "test"); 10488 ck_assert_ptr_eq(icExtractO(self, NULL, ","), NULL); 10489 ck_assert_ptr_eq(icExtractO(self, ",", NULL), NULL); 10490 terminateO(self); 10491 10492 END_TEST 10493 10494 10495 START_TEST(icExtractCharSSmallStringT) 10496 10497 smallArrayt* r; 10498 smallStringt *self = allocG(""); 10499 10500 // string 10501 setValO(self, "one/twos"); 10502 r = icExtractCharSO(self, 'E', "S"); 10503 ck_assert_ptr_ne(r, null); 10504 char *s = toStringO(r); 10505 ck_assert_str_eq(s, "[\"/two\"]"); 10506 free(s); 10507 terminateO(r); 10508 // delimiter not found 10509 setValO(self, "one/two"); 10510 r = icExtractCharSO(self, '|', "/"); 10511 ck_assert_ptr_eq(r, NULL); 10512 // icExtractCharSO with several delimiters after each other 10513 setValO(self, "one/ two /three "); 10514 r = icExtractCharSO(self, '/', " "); 10515 ck_assert_ptr_ne(r, null); 10516 s = toStringO(r); 10517 ck_assert_str_eq(s, "[\"\",\"three\"]"); 10518 free(s); 10519 terminateO(r); 10520 // multiple character delimiter 10521 setValO(self, "AAe thre|e icExtract"); 10522 r = icExtractCharSO(self, ' ', "|e"); 10523 ck_assert_ptr_ne(r, null); 10524 s = toStringO(r); 10525 ck_assert_str_eq(s, "[\"thre\"]"); 10526 free(s); 10527 terminateO(r); 10528 // empty delimiter 10529 setValO(self, "AAd"); 10530 r = icExtractCharSO(self, 'A', ""); 10531 ck_assert_ptr_eq(r, NULL); 10532 // empty string 10533 setValO(self, ""); 10534 r = icExtractCharSO(self, '$', "#"); 10535 ck_assert_ptr_eq(r, NULL); 10536 // delim1 = delim2 10537 setValO(self, ""); 10538 r = icExtractCharSO(self, '$', "$"); 10539 ck_assert_ptr_eq(r, NULL); 10540 // NULL string 10541 freeO(self); 10542 ck_assert_ptr_eq(icExtractCharSO(self, ';', ","), NULL); 10543 // NULL delimiter 10544 setValO(self, "test"); 10545 ck_assert_ptr_eq(icExtractCharSO(self, ',', NULL), NULL); 10546 terminateO(self); 10547 10548 END_TEST 10549 10550 10551 START_TEST(icExtractSCharSmallStringT) 10552 10553 smallArrayt* r; 10554 smallStringt *self = allocG(""); 10555 10556 // string 10557 setValO(self, "one/twos"); 10558 r = icExtractSCharO(self, "E", 'S'); 10559 ck_assert_ptr_ne(r, null); 10560 char *s = toStringO(r); 10561 ck_assert_str_eq(s, "[\"/two\"]"); 10562 free(s); 10563 terminateO(r); 10564 // delimiter not found 10565 setValO(self, "one/two"); 10566 r = icExtractSCharO(self, "||", '/'); 10567 ck_assert_ptr_eq(r, NULL); 10568 // icExtractSCharO with several delimiters after each other 10569 setValO(self, "one/ two /three "); 10570 r = icExtractSCharO(self, "/", ' '); 10571 ck_assert_ptr_ne(r, null); 10572 s = toStringO(r); 10573 ck_assert_str_eq(s, "[\"\",\"three\"]"); 10574 free(s); 10575 terminateO(r); 10576 // multiple character delimiter 10577 setValO(self, "AAe thre|e icExtract"); 10578 r = icExtractSCharO(self, "e ", '|'); 10579 ck_assert_ptr_ne(r, null); 10580 s = toStringO(r); 10581 ck_assert_str_eq(s, "[\"thre\"]"); 10582 free(s); 10583 terminateO(r); 10584 // empty delimiter 10585 setValO(self, "AAd"); 10586 r = icExtractSCharO(self, "", 'A'); 10587 ck_assert_ptr_eq(r, NULL); 10588 // empty string 10589 setValO(self, ""); 10590 r = icExtractSCharO(self, "$", '#'); 10591 ck_assert_ptr_eq(r, NULL); 10592 // delim1 = delim2 10593 setValO(self, ""); 10594 r = icExtractSCharO(self, "$", '$'); 10595 ck_assert_ptr_eq(r, NULL); 10596 // NULL string 10597 freeO(self); 10598 ck_assert_ptr_eq(icExtractSCharO(self, ";", ','), NULL); 10599 // NULL delimiter 10600 setValO(self, "test"); 10601 ck_assert_ptr_eq(icExtractSCharO(self, NULL, ','), NULL); 10602 terminateO(self); 10603 10604 END_TEST 10605 10606 10607 START_TEST(icExtractCharCharSmallStringT) 10608 10609 smallArrayt* r; 10610 smallStringt *self = allocG(""); 10611 10612 // string 10613 setValO(self, "one/twos"); 10614 r = icExtractCharCharO(self, 'E', 'S'); 10615 ck_assert_ptr_ne(r, null); 10616 char *s = toStringO(r); 10617 ck_assert_str_eq(s, "[\"/two\"]"); 10618 free(s); 10619 terminateO(r); 10620 // delimiter not found 10621 setValO(self, "one/two"); 10622 r = icExtractCharCharO(self, '|', '/'); 10623 ck_assert_ptr_eq(r, NULL); 10624 // icExtractCharCharO with several delimiters after each other 10625 setValO(self, "one/ two /three "); 10626 r = icExtractCharCharO(self, '/', ' '); 10627 ck_assert_ptr_ne(r, null); 10628 s = toStringO(r); 10629 ck_assert_str_eq(s, "[\"\",\"three\"]"); 10630 free(s); 10631 terminateO(r); 10632 // multiple character delimiter 10633 setValO(self, "AAe thre|e icExtract"); 10634 r = icExtractCharCharO(self, ' ', '|'); 10635 ck_assert_ptr_ne(r, null); 10636 s = toStringO(r); 10637 ck_assert_str_eq(s, "[\"thre\"]"); 10638 free(s); 10639 terminateO(r); 10640 // empty string 10641 setValO(self, ""); 10642 r = icExtractCharCharO(self, '$', '#'); 10643 ck_assert_ptr_eq(r, NULL); 10644 // delim1 = delim2 10645 setValO(self, ""); 10646 r = icExtractCharCharO(self, '$', '$'); 10647 ck_assert_ptr_eq(r, NULL); 10648 // NULL string 10649 freeO(self); 10650 ck_assert_ptr_eq(icExtractCharCharO(self, ';', ','), NULL); 10651 terminateO(self); 10652 10653 END_TEST 10654 10655 10656 START_TEST(icExtractSmallJsonSmallJsonSmallStringT) 10657 10658 smallArrayt* r; 10659 smallStringt *self = allocG(""); 10660 smallJsont* delim1 = allocSmallJson(); 10661 smallJsont* delim2 = allocSmallJson(); 10662 10663 // string 10664 setValO(self, "one/twos"); 10665 setTopSO(delim1, "E"); 10666 setTopSO(delim2, "S"); 10667 r = icExtractSmallJsonSmallJsonO(self, delim1, delim2); 10668 ck_assert_ptr_ne(r, null); 10669 char *s = toStringO(r); 10670 ck_assert_str_eq(s, "[\"/two\"]"); 10671 free(s); 10672 terminateO(r); 10673 // delimiter not found 10674 setValO(self, "one/two"); 10675 freeO(delim1); 10676 freeO(delim2); 10677 setTopSO(delim1, "||"); 10678 setTopSO(delim2, "/"); 10679 r = icExtractSmallJsonSmallJsonO(self, delim1, delim2); 10680 ck_assert_ptr_eq(r, NULL); 10681 // icExtractSmallJsonSmallJsonO with several delimiters after each other 10682 setValO(self, "one/ two /three "); 10683 freeO(delim1); 10684 freeO(delim2); 10685 setTopSO(delim1, "/"); 10686 setTopSO(delim2, " "); 10687 r = icExtractSmallJsonSmallJsonO(self, delim1, delim2); 10688 ck_assert_ptr_ne(r, null); 10689 s = toStringO(r); 10690 ck_assert_str_eq(s, "[\"\",\"three\"]"); 10691 free(s); 10692 terminateO(r); 10693 // multiple character delimiter 10694 setValO(self, "AAe thre|e icExtract"); 10695 freeO(delim1); 10696 freeO(delim2); 10697 setTopSO(delim1, "e "); 10698 setTopSO(delim2, "|"); 10699 r = icExtractSmallJsonSmallJsonO(self, delim1, delim2); 10700 ck_assert_ptr_ne(r, null); 10701 s = toStringO(r); 10702 ck_assert_str_eq(s, "[\"thre\"]"); 10703 free(s); 10704 terminateO(r); 10705 // empty delimiter 10706 setValO(self, "AAd"); 10707 freeO(delim1); 10708 freeO(delim2); 10709 setTopSO(delim1, ""); 10710 setTopSO(delim2, "Ad"); 10711 r = icExtractSmallJsonSmallJsonO(self, delim1, delim2); 10712 ck_assert_ptr_eq(r, NULL); 10713 setValO(self, "AAd"); 10714 freeO(delim1); 10715 freeO(delim2); 10716 setTopSO(delim1, "A"); 10717 setTopSO(delim2, ""); 10718 r = icExtractSmallJsonSmallJsonO(self, delim1, delim2); 10719 ck_assert_ptr_eq(r, NULL); 10720 // empty string 10721 setValO(self, ""); 10722 freeO(delim1); 10723 freeO(delim2); 10724 setTopSO(delim1, "$"); 10725 setTopSO(delim2, "#"); 10726 r = icExtractSmallJsonSmallJsonO(self, delim1, delim2); 10727 ck_assert_ptr_eq(r, NULL); 10728 // delim1 = delim2 10729 setValO(self, "$qwe$"); 10730 freeO(delim1); 10731 freeO(delim2); 10732 setTopSO(delim1, "$"); 10733 setTopSO(delim2, "$"); 10734 r = icExtractSmallJsonSmallJsonO(self, delim1, delim2); 10735 ck_assert_ptr_eq(r, NULL); 10736 // non json string 10737 freeO(delim1); 10738 r = icExtractSmallJsonSmallJsonO(self, delim1, delim2); 10739 ck_assert_ptr_eq(r, NULL); 10740 setTopSO(delim1, "$"); 10741 freeO(delim2); 10742 r = icExtractSmallJsonSmallJsonO(self, delim1, delim2); 10743 ck_assert_ptr_eq(r, NULL); 10744 // non json object 10745 terminateO(delim1); 10746 delim1 = (smallJsont*) allocSmallInt(1); 10747 setTopSO(delim2, "$"); 10748 r = icExtractSmallJsonSmallJsonO(self, delim1, delim2); 10749 ck_assert_ptr_eq(r, NULL); 10750 terminateO(delim1); 10751 delim1 = allocSmallJson(); 10752 setTopSO(delim1, ";"); 10753 terminateO(delim2); 10754 delim2 = (smallJsont*) allocSmallInt(1); 10755 r = icExtractSmallJsonSmallJsonO(self, delim1, delim2); 10756 ck_assert_ptr_eq(r, NULL); 10757 terminateO(delim2); 10758 delim2 = allocSmallJson(); 10759 // NULL string 10760 freeO(self); 10761 freeO(delim1); 10762 freeO(delim2); 10763 setTopSO(delim1, ";"); 10764 setTopSO(delim2, ","); 10765 ck_assert_ptr_eq(icExtractSmallJsonSmallJsonO(self, delim1, delim2), NULL); 10766 // NULL delimiter 10767 setValO(self, "test"); 10768 ck_assert_ptr_eq(icExtractSmallJsonSmallJsonO(self, NULL, delim2), NULL); 10769 ck_assert_ptr_eq(icExtractSmallJsonSmallJsonO(self, delim1, NULL), NULL); 10770 terminateO(delim1); 10771 terminateO(delim2); 10772 terminateO(self); 10773 10774 END_TEST 10775 10776 10777 START_TEST(icExtractSmallJsonSmallStringSmallStringT) 10778 10779 smallArrayt* r; 10780 smallStringt *self = allocG(""); 10781 smallJsont* delim1 = allocSmallJson(); 10782 smallStringt* delim2 = allocSmallString("S"); 10783 10784 // string 10785 setValO(self, "one/twos"); 10786 setTopSO(delim1, "E"); 10787 r = icExtractSmallJsonSmallStringO(self, delim1, delim2); 10788 ck_assert_ptr_ne(r, null); 10789 char *s = toStringO(r); 10790 ck_assert_str_eq(s, "[\"/two\"]"); 10791 free(s); 10792 terminateO(r); 10793 // delimiter not found 10794 setValO(self, "one/two"); 10795 freeO(delim1); 10796 setTopSO(delim1, "||"); 10797 setValO(delim2, "/"); 10798 r = icExtractSmallJsonSmallStringO(self, delim1, delim2); 10799 ck_assert_ptr_eq(r, NULL); 10800 // icExtractSmallJsonSmallStringO with several delimiters after each other 10801 setValO(self, "one/ two /three "); 10802 freeO(delim1); 10803 setTopSO(delim1, "/"); 10804 setValO(delim2, " "); 10805 r = icExtractSmallJsonSmallStringO(self, delim1, delim2); 10806 ck_assert_ptr_ne(r, null); 10807 s = toStringO(r); 10808 ck_assert_str_eq(s, "[\"\",\"three\"]"); 10809 free(s); 10810 terminateO(r); 10811 // multiple character delimiter 10812 setValO(self, "AAe thre|e icExtract"); 10813 freeO(delim1); 10814 setTopSO(delim1, "e "); 10815 setValO(delim2, "|"); 10816 r = icExtractSmallJsonSmallStringO(self, delim1, delim2); 10817 ck_assert_ptr_ne(r, null); 10818 s = toStringO(r); 10819 ck_assert_str_eq(s, "[\"thre\"]"); 10820 free(s); 10821 terminateO(r); 10822 // empty delimiter 10823 setValO(self, "AAd"); 10824 freeO(delim1); 10825 setTopSO(delim1, ""); 10826 setValO(delim2, "Ad"); 10827 r = icExtractSmallJsonSmallStringO(self, delim1, delim2); 10828 ck_assert_ptr_eq(r, NULL); 10829 setValO(self, "AAd"); 10830 freeO(delim1); 10831 setTopSO(delim1, "A"); 10832 setValO(delim2, ""); 10833 r = icExtractSmallJsonSmallStringO(self, delim1, delim2); 10834 ck_assert_ptr_eq(r, NULL); 10835 // empty string 10836 setValO(self, ""); 10837 freeO(delim1); 10838 setTopSO(delim1, "$"); 10839 setValO(delim2, "#"); 10840 r = icExtractSmallJsonSmallStringO(self, delim1, delim2); 10841 ck_assert_ptr_eq(r, NULL); 10842 // delim1 = delim2 10843 setValO(self, "$qwe$"); 10844 freeO(delim1); 10845 setTopSO(delim1, "$"); 10846 setValO(delim2, "$"); 10847 r = icExtractSmallJsonSmallStringO(self, delim1, delim2); 10848 ck_assert_ptr_eq(r, NULL); 10849 // non json string 10850 freeO(delim1); 10851 r = icExtractSmallJsonSmallStringO(self, delim1, delim2); 10852 ck_assert_ptr_eq(r, NULL); 10853 // non json object 10854 terminateO(delim1); 10855 delim1 = (smallJsont*) allocSmallInt(1); 10856 r = icExtractSmallJsonSmallStringO(self, delim1, delim2); 10857 ck_assert_ptr_eq(r, NULL); 10858 terminateO(delim1); 10859 delim1 = allocSmallJson(); 10860 setTopSO(delim1, ";"); 10861 terminateO(delim2); 10862 delim2 = (smallStringt*) allocSmallInt(1); 10863 r = icExtractSmallJsonSmallStringO(self, delim1, delim2); 10864 ck_assert_ptr_eq(r, NULL); 10865 terminateO(delim2); 10866 delim2 = allocSmallString(","); 10867 // NULL string 10868 freeO(self); 10869 freeO(delim1); 10870 setTopSO(delim1, ";"); 10871 ck_assert_ptr_eq(icExtractSmallJsonSmallStringO(self, delim1, delim2), NULL); 10872 // NULL delimiter 10873 setValO(self, "test"); 10874 ck_assert_ptr_eq(icExtractSmallJsonSmallStringO(self, NULL, delim2), NULL); 10875 ck_assert_ptr_eq(icExtractSmallJsonSmallStringO(self, delim1, NULL), NULL); 10876 terminateO(delim1); 10877 terminateO(delim2); 10878 terminateO(self); 10879 10880 END_TEST 10881 10882 10883 START_TEST(icExtractSmallJsonSSmallStringT) 10884 10885 smallArrayt* r; 10886 smallStringt *self = allocG(""); 10887 smallJsont* delim1 = allocSmallJson(); 10888 10889 // string 10890 setValO(self, "one/twos"); 10891 setTopSO(delim1, "E"); 10892 r = icExtractSmallJsonSO(self, delim1, "S"); 10893 ck_assert_ptr_ne(r, null); 10894 char *s = toStringO(r); 10895 ck_assert_str_eq(s, "[\"/two\"]"); 10896 free(s); 10897 terminateO(r); 10898 // delimiter not found 10899 setValO(self, "one/two"); 10900 freeO(delim1); 10901 setTopSO(delim1, "||"); 10902 r = icExtractSmallJsonSO(self, delim1, "/"); 10903 ck_assert_ptr_eq(r, NULL); 10904 // icExtractSmallJsonSO with several delimiters after each other 10905 setValO(self, "one/ two /three "); 10906 freeO(delim1); 10907 setTopSO(delim1, "/"); 10908 r = icExtractSmallJsonSO(self, delim1, " "); 10909 ck_assert_ptr_ne(r, null); 10910 s = toStringO(r); 10911 ck_assert_str_eq(s, "[\"\",\"three\"]"); 10912 free(s); 10913 terminateO(r); 10914 // multiple character delimiter 10915 setValO(self, "AAe thre|e icExtract"); 10916 freeO(delim1); 10917 setTopSO(delim1, "e "); 10918 r = icExtractSmallJsonSO(self, delim1, "|"); 10919 ck_assert_ptr_ne(r, null); 10920 s = toStringO(r); 10921 ck_assert_str_eq(s, "[\"thre\"]"); 10922 free(s); 10923 terminateO(r); 10924 // empty delimiter 10925 setValO(self, "AAd"); 10926 freeO(delim1); 10927 setTopSO(delim1, ""); 10928 r = icExtractSmallJsonSO(self, delim1, "Ad"); 10929 ck_assert_ptr_eq(r, NULL); 10930 setValO(self, "AAd"); 10931 freeO(delim1); 10932 setTopSO(delim1, "A"); 10933 r = icExtractSmallJsonSO(self, delim1, ""); 10934 ck_assert_ptr_eq(r, NULL); 10935 // empty string 10936 setValO(self, ""); 10937 freeO(delim1); 10938 setTopSO(delim1, "$"); 10939 r = icExtractSmallJsonSO(self, delim1, "#"); 10940 ck_assert_ptr_eq(r, NULL); 10941 // delim1 = delim2 10942 setValO(self, "$qwe$"); 10943 freeO(delim1); 10944 setTopSO(delim1, "$"); 10945 r = icExtractSmallJsonSO(self, delim1, "$"); 10946 ck_assert_ptr_eq(r, NULL); 10947 // non json string 10948 freeO(delim1); 10949 r = icExtractSmallJsonSO(self, delim1, "$"); 10950 ck_assert_ptr_eq(r, NULL); 10951 // non json object 10952 terminateO(delim1); 10953 delim1 = (smallJsont*) allocSmallInt(1); 10954 r = icExtractSmallJsonSO(self, delim1, "$"); 10955 ck_assert_ptr_eq(r, NULL); 10956 terminateO(delim1); 10957 delim1 = allocSmallJson(); 10958 // NULL string 10959 freeO(self); 10960 freeO(delim1); 10961 setTopSO(delim1, ";"); 10962 ck_assert_ptr_eq(icExtractSmallJsonSO(self, delim1, ","), NULL); 10963 // NULL delimiter 10964 setValO(self, "test"); 10965 ck_assert_ptr_eq(icExtractSmallJsonSO(self, NULL, ","), NULL); 10966 ck_assert_ptr_eq(icExtractSmallJsonSO(self, delim1, NULL), NULL); 10967 terminateO(delim1); 10968 terminateO(self); 10969 10970 END_TEST 10971 10972 10973 START_TEST(icExtractSmallJsonCharSmallStringT) 10974 10975 smallArrayt* r; 10976 smallStringt *self = allocG(""); 10977 smallJsont* delim1 = allocSmallJson(); 10978 10979 // string 10980 setValO(self, "one/twos"); 10981 setTopSO(delim1, "E"); 10982 r = icExtractSmallJsonCharO(self, delim1, 'S'); 10983 ck_assert_ptr_ne(r, null); 10984 char *s = toStringO(r); 10985 ck_assert_str_eq(s, "[\"/two\"]"); 10986 free(s); 10987 terminateO(r); 10988 // delimiter not found 10989 setValO(self, "one/two"); 10990 freeO(delim1); 10991 setTopSO(delim1, "||"); 10992 r = icExtractSmallJsonCharO(self, delim1, '/'); 10993 ck_assert_ptr_eq(r, NULL); 10994 // icExtractSmallJsonCharO with several delimiters after each other 10995 setValO(self, "one/ two /three "); 10996 freeO(delim1); 10997 setTopSO(delim1, "/"); 10998 r = icExtractSmallJsonCharO(self, delim1, ' '); 10999 ck_assert_ptr_ne(r, null); 11000 s = toStringO(r); 11001 ck_assert_str_eq(s, "[\"\",\"three\"]"); 11002 free(s); 11003 terminateO(r); 11004 // multiple character delimiter 11005 setValO(self, "AAe thre|e icExtract"); 11006 freeO(delim1); 11007 setTopSO(delim1, "e "); 11008 r = icExtractSmallJsonCharO(self, delim1, '|'); 11009 ck_assert_ptr_ne(r, null); 11010 s = toStringO(r); 11011 ck_assert_str_eq(s, "[\"thre\"]"); 11012 free(s); 11013 terminateO(r); 11014 // empty delimiter 11015 setValO(self, "AAd"); 11016 freeO(delim1); 11017 setTopSO(delim1, ""); 11018 r = icExtractSmallJsonCharO(self, delim1, 'd'); 11019 ck_assert_ptr_eq(r, NULL); 11020 setValO(self, "AAd"); 11021 // empty string 11022 setValO(self, ""); 11023 freeO(delim1); 11024 setTopSO(delim1, "$"); 11025 r = icExtractSmallJsonCharO(self, delim1, '#'); 11026 ck_assert_ptr_eq(r, NULL); 11027 // delim1 = delim2 11028 setValO(self, "$qwe$"); 11029 freeO(delim1); 11030 setTopSO(delim1, "$"); 11031 r = icExtractSmallJsonCharO(self, delim1, '$'); 11032 ck_assert_ptr_eq(r, NULL); 11033 // non json string 11034 freeO(delim1); 11035 r = icExtractSmallJsonCharO(self, delim1, '$'); 11036 ck_assert_ptr_eq(r, NULL); 11037 // non json object 11038 terminateO(delim1); 11039 delim1 = (smallJsont*) allocSmallInt(1); 11040 r = icExtractSmallJsonCharO(self, delim1, '$'); 11041 ck_assert_ptr_eq(r, NULL); 11042 terminateO(delim1); 11043 delim1 = allocSmallJson(); 11044 // NULL string 11045 freeO(self); 11046 freeO(delim1); 11047 setTopSO(delim1, ";"); 11048 ck_assert_ptr_eq(icExtractSmallJsonCharO(self, delim1, ','), NULL); 11049 // NULL delimiter 11050 setValO(self, "test"); 11051 ck_assert_ptr_eq(icExtractSmallJsonCharO(self, NULL, ','), NULL); 11052 terminateO(delim1); 11053 terminateO(self); 11054 11055 END_TEST 11056 11057 11058 START_TEST(icExtractSmallStringSmallJsonSmallStringT) 11059 11060 smallArrayt* r; 11061 smallStringt *self = allocG(""); 11062 smallStringt* delim1 = allocSmallString("E"); 11063 smallJsont* delim2 = allocSmallJson(); 11064 11065 // string 11066 setValO(self, "one/twos"); 11067 setTopSO(delim2, "S"); 11068 r = icExtractSmallStringSmallJsonO(self, delim1, delim2); 11069 ck_assert_ptr_ne(r, null); 11070 char *s = toStringO(r); 11071 ck_assert_str_eq(s, "[\"/two\"]"); 11072 free(s); 11073 terminateO(r); 11074 // delimiter not found 11075 setValO(self, "one/two"); 11076 freeO(delim2); 11077 setValO(delim1, "||"); 11078 setTopSO(delim2, "/"); 11079 r = icExtractSmallStringSmallJsonO(self, delim1, delim2); 11080 ck_assert_ptr_eq(r, NULL); 11081 // icExtractSmallStringSmallJsonO with several delimiters after each other 11082 setValO(self, "one/ two /three "); 11083 freeO(delim2); 11084 setValO(delim1, "/"); 11085 setTopSO(delim2, " "); 11086 r = icExtractSmallStringSmallJsonO(self, delim1, delim2); 11087 ck_assert_ptr_ne(r, null); 11088 s = toStringO(r); 11089 ck_assert_str_eq(s, "[\"\",\"three\"]"); 11090 free(s); 11091 terminateO(r); 11092 // multiple character delimiter 11093 setValO(self, "AAe thre|e icExtract"); 11094 freeO(delim2); 11095 setValO(delim1, "e "); 11096 setTopSO(delim2, "|"); 11097 r = icExtractSmallStringSmallJsonO(self, delim1, delim2); 11098 ck_assert_ptr_ne(r, null); 11099 s = toStringO(r); 11100 ck_assert_str_eq(s, "[\"thre\"]"); 11101 free(s); 11102 terminateO(r); 11103 // empty delimiter 11104 setValO(self, "AAd"); 11105 freeO(delim2); 11106 setValO(delim1, ""); 11107 setTopSO(delim2, "Ad"); 11108 r = icExtractSmallStringSmallJsonO(self, delim1, delim2); 11109 ck_assert_ptr_eq(r, NULL); 11110 setValO(self, "AAd"); 11111 freeO(delim2); 11112 setValO(delim1, "A"); 11113 setTopSO(delim2, ""); 11114 r = icExtractSmallStringSmallJsonO(self, delim1, delim2); 11115 ck_assert_ptr_eq(r, NULL); 11116 // empty string 11117 setValO(self, ""); 11118 freeO(delim2); 11119 setValO(delim1, "$"); 11120 setTopSO(delim2, "#"); 11121 r = icExtractSmallStringSmallJsonO(self, delim1, delim2); 11122 ck_assert_ptr_eq(r, NULL); 11123 // delim1 = delim2 11124 setValO(self, "$qwe$"); 11125 freeO(delim2); 11126 setValO(delim1, "$"); 11127 setTopSO(delim2, "$"); 11128 r = icExtractSmallStringSmallJsonO(self, delim1, delim2); 11129 ck_assert_ptr_eq(r, NULL); 11130 // non json string 11131 freeO(delim2); 11132 r = icExtractSmallStringSmallJsonO(self, delim1, delim2); 11133 ck_assert_ptr_eq(r, NULL); 11134 // non json object 11135 terminateO(delim1); 11136 delim1 = (smallStringt*) allocSmallInt(1); 11137 setTopSO(delim2, "$"); 11138 r = icExtractSmallStringSmallJsonO(self, delim1, delim2); 11139 ck_assert_ptr_eq(r, NULL); 11140 terminateO(delim1); 11141 delim1 = allocSmallString(";"); 11142 terminateO(delim2); 11143 delim2 = (smallJsont*) allocSmallInt(1); 11144 r = icExtractSmallStringSmallJsonO(self, delim1, delim2); 11145 ck_assert_ptr_eq(r, NULL); 11146 terminateO(delim2); 11147 delim2 = allocSmallJson(); 11148 // NULL string 11149 freeO(self); 11150 freeO(delim2); 11151 setValO(delim1, ";"); 11152 setTopSO(delim2, ","); 11153 ck_assert_ptr_eq(icExtractSmallStringSmallJsonO(self, delim1, delim2), NULL); 11154 // NULL delimiter 11155 setValO(self, "test"); 11156 ck_assert_ptr_eq(icExtractSmallStringSmallJsonO(self, NULL, delim2), NULL); 11157 ck_assert_ptr_eq(icExtractSmallStringSmallJsonO(self, delim1, NULL), NULL); 11158 terminateO(delim1); 11159 terminateO(delim2); 11160 terminateO(self); 11161 11162 END_TEST 11163 11164 11165 START_TEST(icExtractSmallStringSmallStringSmallStringT) 11166 11167 smallArrayt* r; 11168 smallStringt *self = allocG(""); 11169 smallStringt* delim1 = allocSmallString("E"); 11170 smallStringt* delim2 = allocSmallString("|"); 11171 11172 // string 11173 setValO(self, "one/twos"); 11174 setValO(delim2, "S"); 11175 r = icExtractSmallStringSmallStringO(self, delim1, delim2); 11176 ck_assert_ptr_ne(r, null); 11177 char *s = toStringO(r); 11178 ck_assert_str_eq(s, "[\"/two\"]"); 11179 free(s); 11180 terminateO(r); 11181 // delimiter not found 11182 setValO(self, "one/two"); 11183 setValO(delim1, "||"); 11184 setValO(delim2, "/"); 11185 r = icExtractSmallStringSmallStringO(self, delim1, delim2); 11186 ck_assert_ptr_eq(r, NULL); 11187 // icExtractSmallStringSmallStringO with several delimiters after each other 11188 setValO(self, "one/ two /three "); 11189 setValO(delim1, "/"); 11190 setValO(delim2, " "); 11191 r = icExtractSmallStringSmallStringO(self, delim1, delim2); 11192 ck_assert_ptr_ne(r, null); 11193 s = toStringO(r); 11194 ck_assert_str_eq(s, "[\"\",\"three\"]"); 11195 free(s); 11196 terminateO(r); 11197 // multiple character delimiter 11198 setValO(self, "AAe thre|e icExtract"); 11199 setValO(delim1, "e "); 11200 setValO(delim2, "|"); 11201 r = icExtractSmallStringSmallStringO(self, delim1, delim2); 11202 ck_assert_ptr_ne(r, null); 11203 s = toStringO(r); 11204 ck_assert_str_eq(s, "[\"thre\"]"); 11205 free(s); 11206 terminateO(r); 11207 // empty delimiter 11208 setValO(self, "AAd"); 11209 setValO(delim1, ""); 11210 setValO(delim2, "Ad"); 11211 r = icExtractSmallStringSmallStringO(self, delim1, delim2); 11212 ck_assert_ptr_eq(r, NULL); 11213 setValO(self, "AAd"); 11214 setValO(delim1, "A"); 11215 setValO(delim2, ""); 11216 r = icExtractSmallStringSmallStringO(self, delim1, delim2); 11217 ck_assert_ptr_eq(r, NULL); 11218 // empty string 11219 setValO(self, ""); 11220 setValO(delim1, "$"); 11221 setValO(delim2, "#"); 11222 r = icExtractSmallStringSmallStringO(self, delim1, delim2); 11223 ck_assert_ptr_eq(r, NULL); 11224 // delim1 = delim2 11225 setValO(self, "$qwe$"); 11226 setValO(delim1, "$"); 11227 setValO(delim2, "$"); 11228 r = icExtractSmallStringSmallStringO(self, delim1, delim2); 11229 ck_assert_ptr_eq(r, NULL); 11230 // non json object 11231 terminateO(delim1); 11232 delim1 = (smallStringt*) allocSmallInt(1); 11233 r = icExtractSmallStringSmallStringO(self, delim1, delim2); 11234 ck_assert_ptr_eq(r, NULL); 11235 terminateO(delim1); 11236 delim1 = allocSmallString(";"); 11237 terminateO(delim2); 11238 delim2 = (smallStringt*) allocSmallInt(1); 11239 r = icExtractSmallStringSmallStringO(self, delim1, delim2); 11240 ck_assert_ptr_eq(r, NULL); 11241 terminateO(delim2); 11242 delim2 = allocSmallString(","); 11243 // NULL string 11244 freeO(self); 11245 setValO(delim1, ";"); 11246 ck_assert_ptr_eq(icExtractSmallStringSmallStringO(self, delim1, delim2), NULL); 11247 // NULL delimiter 11248 setValO(self, "test"); 11249 ck_assert_ptr_eq(icExtractSmallStringSmallStringO(self, NULL, delim2), NULL); 11250 ck_assert_ptr_eq(icExtractSmallStringSmallStringO(self, delim1, NULL), NULL); 11251 terminateO(delim1); 11252 terminateO(delim2); 11253 terminateO(self); 11254 11255 END_TEST 11256 11257 11258 START_TEST(icExtractSmallStringSSmallStringT) 11259 11260 smallArrayt* r; 11261 smallStringt *self = allocG(""); 11262 smallStringt* delim1 = allocSmallString("E"); 11263 11264 // string 11265 setValO(self, "one/twos"); 11266 r = icExtractSmallStringSO(self, delim1, "S"); 11267 ck_assert_ptr_ne(r, null); 11268 char *s = toStringO(r); 11269 ck_assert_str_eq(s, "[\"/two\"]"); 11270 free(s); 11271 terminateO(r); 11272 // delimiter not found 11273 setValO(self, "one/two"); 11274 setValO(delim1, "||"); 11275 r = icExtractSmallStringSO(self, delim1, "/"); 11276 ck_assert_ptr_eq(r, NULL); 11277 // icExtractSmallStringSO with several delimiters after each other 11278 setValO(self, "one/ two /three "); 11279 setValO(delim1, "/"); 11280 r = icExtractSmallStringSO(self, delim1, " "); 11281 ck_assert_ptr_ne(r, null); 11282 s = toStringO(r); 11283 ck_assert_str_eq(s, "[\"\",\"three\"]"); 11284 free(s); 11285 terminateO(r); 11286 // multiple character delimiter 11287 setValO(self, "AAe thre|e icExtract"); 11288 setValO(delim1, "e "); 11289 r = icExtractSmallStringSO(self, delim1, "|"); 11290 ck_assert_ptr_ne(r, null); 11291 s = toStringO(r); 11292 ck_assert_str_eq(s, "[\"thre\"]"); 11293 free(s); 11294 terminateO(r); 11295 // empty delimiter 11296 setValO(self, "AAd"); 11297 setValO(delim1, ""); 11298 r = icExtractSmallStringSO(self, delim1, "Ad"); 11299 ck_assert_ptr_eq(r, NULL); 11300 setValO(self, "AAd"); 11301 setValO(delim1, "A"); 11302 r = icExtractSmallStringSO(self, delim1, ""); 11303 ck_assert_ptr_eq(r, NULL); 11304 // empty string 11305 setValO(self, ""); 11306 setValO(delim1, "$"); 11307 r = icExtractSmallStringSO(self, delim1, "#"); 11308 ck_assert_ptr_eq(r, NULL); 11309 // delim1 = delim2 11310 setValO(self, "$qwe$"); 11311 setValO(delim1, "$"); 11312 r = icExtractSmallStringSO(self, delim1, "$"); 11313 ck_assert_ptr_eq(r, NULL); 11314 // non json object 11315 terminateO(delim1); 11316 delim1 = (smallStringt*) allocSmallInt(1); 11317 r = icExtractSmallStringSO(self, delim1, "$"); 11318 ck_assert_ptr_eq(r, NULL); 11319 terminateO(delim1); 11320 delim1 = allocSmallString(";"); 11321 // NULL string 11322 freeO(self); 11323 setValO(delim1, ";"); 11324 ck_assert_ptr_eq(icExtractSmallStringSO(self, delim1, ","), NULL); 11325 // NULL delimiter 11326 setValO(self, "test"); 11327 ck_assert_ptr_eq(icExtractSmallStringSO(self, NULL, ","), NULL); 11328 ck_assert_ptr_eq(icExtractSmallStringSO(self, delim1, NULL), NULL); 11329 terminateO(delim1); 11330 terminateO(self); 11331 11332 END_TEST 11333 11334 11335 START_TEST(icExtractSmallStringCharSmallStringT) 11336 11337 smallArrayt* r; 11338 smallStringt *self = allocG(""); 11339 smallStringt* delim1 = allocSmallString("E"); 11340 11341 // string 11342 setValO(self, "one/twos"); 11343 r = icExtractSmallStringCharO(self, delim1, 'S'); 11344 ck_assert_ptr_ne(r, null); 11345 char *s = toStringO(r); 11346 ck_assert_str_eq(s, "[\"/two\"]"); 11347 free(s); 11348 terminateO(r); 11349 // delimiter not found 11350 setValO(self, "one/two"); 11351 setValO(delim1, "||"); 11352 r = icExtractSmallStringCharO(self, delim1, '/'); 11353 ck_assert_ptr_eq(r, NULL); 11354 // icExtractSmallStringCharO with several delimiters after each other 11355 setValO(self, "one/ two /three "); 11356 setValO(delim1, "/"); 11357 r = icExtractSmallStringCharO(self, delim1, ' '); 11358 ck_assert_ptr_ne(r, null); 11359 s = toStringO(r); 11360 ck_assert_str_eq(s, "[\"\",\"three\"]"); 11361 free(s); 11362 terminateO(r); 11363 // multiple character delimiter 11364 setValO(self, "AAe thre|e icExtract"); 11365 setValO(delim1, "e "); 11366 r = icExtractSmallStringCharO(self, delim1, '|'); 11367 ck_assert_ptr_ne(r, null); 11368 s = toStringO(r); 11369 ck_assert_str_eq(s, "[\"thre\"]"); 11370 free(s); 11371 terminateO(r); 11372 // empty delimiter 11373 setValO(self, "AAd"); 11374 setValO(delim1, ""); 11375 r = icExtractSmallStringCharO(self, delim1, 'A'); 11376 ck_assert_ptr_eq(r, NULL); 11377 setValO(self, "AAd"); 11378 setValO(delim1, "A"); 11379 // empty string 11380 setValO(self, ""); 11381 setValO(delim1, "$"); 11382 r = icExtractSmallStringCharO(self, delim1, '#'); 11383 ck_assert_ptr_eq(r, NULL); 11384 // delim1 = delim2 11385 setValO(self, "$qwe$"); 11386 setValO(delim1, "$"); 11387 r = icExtractSmallStringCharO(self, delim1, '$'); 11388 ck_assert_ptr_eq(r, NULL); 11389 // non json object 11390 terminateO(delim1); 11391 delim1 = (smallStringt*) allocSmallInt(1); 11392 r = icExtractSmallStringCharO(self, delim1, '$'); 11393 ck_assert_ptr_eq(r, NULL); 11394 terminateO(delim1); 11395 delim1 = allocSmallString(";"); 11396 // NULL string 11397 freeO(self); 11398 setValO(delim1, ";"); 11399 ck_assert_ptr_eq(icExtractSmallStringCharO(self, delim1, ','), NULL); 11400 // NULL delimiter 11401 setValO(self, "test"); 11402 ck_assert_ptr_eq(icExtractSmallStringCharO(self, NULL, ','), NULL); 11403 terminateO(delim1); 11404 terminateO(self); 11405 11406 END_TEST 11407 11408 11409 START_TEST(icExtractSSmallJsonSmallStringT) 11410 11411 smallArrayt* r; 11412 smallStringt *self = allocG(""); 11413 smallJsont* delim2 = allocSmallJson(); 11414 11415 // string 11416 setValO(self, "one/twos"); 11417 setTopSO(delim2, "S"); 11418 r = icExtractSSmallJsonO(self, "E", delim2); 11419 ck_assert_ptr_ne(r, null); 11420 char *s = toStringO(r); 11421 ck_assert_str_eq(s, "[\"/two\"]"); 11422 free(s); 11423 terminateO(r); 11424 // delimiter not found 11425 setValO(self, "one/two"); 11426 freeO(delim2); 11427 setTopSO(delim2, "/"); 11428 r = icExtractSSmallJsonO(self, "||", delim2); 11429 ck_assert_ptr_eq(r, NULL); 11430 // icExtractSSmallJsonO with several delimiters after each other 11431 setValO(self, "one/ two /three "); 11432 freeO(delim2); 11433 setTopSO(delim2, " "); 11434 r = icExtractSSmallJsonO(self, "/", delim2); 11435 ck_assert_ptr_ne(r, null); 11436 s = toStringO(r); 11437 ck_assert_str_eq(s, "[\"\",\"three\"]"); 11438 free(s); 11439 terminateO(r); 11440 // multiple character delimiter 11441 setValO(self, "AAe thre|e icExtract"); 11442 freeO(delim2); 11443 setTopSO(delim2, "|"); 11444 r = icExtractSSmallJsonO(self, "e ", delim2); 11445 ck_assert_ptr_ne(r, null); 11446 s = toStringO(r); 11447 ck_assert_str_eq(s, "[\"thre\"]"); 11448 free(s); 11449 terminateO(r); 11450 // empty delimiter 11451 setValO(self, "AAd"); 11452 freeO(delim2); 11453 setTopSO(delim2, "Ad"); 11454 r = icExtractSSmallJsonO(self, "", delim2); 11455 ck_assert_ptr_eq(r, NULL); 11456 setValO(self, "AAd"); 11457 freeO(delim2); 11458 setTopSO(delim2, ""); 11459 r = icExtractSSmallJsonO(self, "A", delim2); 11460 ck_assert_ptr_eq(r, NULL); 11461 // empty string 11462 setValO(self, ""); 11463 freeO(delim2); 11464 setTopSO(delim2, "#"); 11465 r = icExtractSSmallJsonO(self, "$", delim2); 11466 ck_assert_ptr_eq(r, NULL); 11467 // delim1 = delim2 11468 setValO(self, "$qwe$"); 11469 freeO(delim2); 11470 setTopSO(delim2, "$"); 11471 r = icExtractSSmallJsonO(self, "$", delim2); 11472 ck_assert_ptr_eq(r, NULL); 11473 // non json string 11474 freeO(delim2); 11475 r = icExtractSSmallJsonO(self, "$", delim2); 11476 ck_assert_ptr_eq(r, NULL); 11477 // non json object 11478 terminateO(delim2); 11479 delim2 = (smallJsont*) allocSmallInt(1); 11480 r = icExtractSSmallJsonO(self, ";", delim2); 11481 ck_assert_ptr_eq(r, NULL); 11482 terminateO(delim2); 11483 delim2 = allocSmallJson(); 11484 // NULL string 11485 freeO(self); 11486 freeO(delim2); 11487 setTopSO(delim2, ","); 11488 ck_assert_ptr_eq(icExtractSSmallJsonO(self, ";", delim2), NULL); 11489 // NULL delimiter 11490 setValO(self, "test"); 11491 ck_assert_ptr_eq(icExtractSSmallJsonO(self, NULL, delim2), NULL); 11492 ck_assert_ptr_eq(icExtractSSmallJsonO(self, ";", NULL), NULL); 11493 terminateO(delim2); 11494 terminateO(self); 11495 11496 END_TEST 11497 11498 11499 START_TEST(icExtractSSmallStringSmallStringT) 11500 11501 smallArrayt* r; 11502 smallStringt *self = allocG(""); 11503 smallStringt* delim2 = allocSmallString("|"); 11504 11505 // string 11506 setValO(self, "one/twos"); 11507 setValO(delim2, "S"); 11508 r = icExtractSSmallStringO(self, "E", delim2); 11509 ck_assert_ptr_ne(r, null); 11510 char *s = toStringO(r); 11511 ck_assert_str_eq(s, "[\"/two\"]"); 11512 free(s); 11513 terminateO(r); 11514 // delimiter not found 11515 setValO(self, "one/two"); 11516 setValO(delim2, "/"); 11517 r = icExtractSSmallStringO(self, "||", delim2); 11518 ck_assert_ptr_eq(r, NULL); 11519 // icExtractSSmallStringO with several delimiters after each other 11520 setValO(self, "one/ two /three "); 11521 setValO(delim2, " "); 11522 r = icExtractSSmallStringO(self, "/", delim2); 11523 ck_assert_ptr_ne(r, null); 11524 s = toStringO(r); 11525 ck_assert_str_eq(s, "[\"\",\"three\"]"); 11526 free(s); 11527 terminateO(r); 11528 // multiple character delimiter 11529 setValO(self, "AAe thre|e icExtract"); 11530 setValO(delim2, "|"); 11531 r = icExtractSSmallStringO(self, "e ", delim2); 11532 ck_assert_ptr_ne(r, null); 11533 s = toStringO(r); 11534 ck_assert_str_eq(s, "[\"thre\"]"); 11535 free(s); 11536 terminateO(r); 11537 // empty delimiter 11538 setValO(self, "AAd"); 11539 setValO(delim2, "Ad"); 11540 r = icExtractSSmallStringO(self, "", delim2); 11541 ck_assert_ptr_eq(r, NULL); 11542 setValO(self, "AAd"); 11543 setValO(delim2, ""); 11544 r = icExtractSSmallStringO(self, "A", delim2); 11545 ck_assert_ptr_eq(r, NULL); 11546 // empty string 11547 setValO(self, ""); 11548 setValO(delim2, "#"); 11549 r = icExtractSSmallStringO(self, "$", delim2); 11550 ck_assert_ptr_eq(r, NULL); 11551 // delim1 = delim2 11552 setValO(self, "$qwe$"); 11553 setValO(delim2, "$"); 11554 r = icExtractSSmallStringO(self, "$", delim2); 11555 ck_assert_ptr_eq(r, NULL); 11556 // non json object 11557 terminateO(delim2); 11558 delim2 = (smallStringt*) allocSmallInt(1); 11559 r = icExtractSSmallStringO(self, ";", delim2); 11560 ck_assert_ptr_eq(r, NULL); 11561 terminateO(delim2); 11562 delim2 = allocSmallString(","); 11563 // NULL string 11564 freeO(self); 11565 ck_assert_ptr_eq(icExtractSSmallStringO(self, ";", delim2), NULL); 11566 // NULL delimiter 11567 setValO(self, "test"); 11568 ck_assert_ptr_eq(icExtractSSmallStringO(self, NULL, delim2), NULL); 11569 ck_assert_ptr_eq(icExtractSSmallStringO(self, ";", NULL), NULL); 11570 terminateO(delim2); 11571 terminateO(self); 11572 11573 END_TEST 11574 11575 11576 START_TEST(icExtractCharSmallJsonSmallStringT) 11577 11578 smallArrayt* r; 11579 smallStringt *self = allocG(""); 11580 smallJsont* delim2 = allocSmallJson(); 11581 11582 // string 11583 setValO(self, "one/twos"); 11584 setTopSO(delim2, "S"); 11585 r = icExtractCharSmallJsonO(self, 'E', delim2); 11586 ck_assert_ptr_ne(r, null); 11587 char *s = toStringO(r); 11588 ck_assert_str_eq(s, "[\"/two\"]"); 11589 free(s); 11590 terminateO(r); 11591 // delimiter not found 11592 setValO(self, "one/two"); 11593 freeO(delim2); 11594 setTopSO(delim2, "/"); 11595 r = icExtractCharSmallJsonO(self, '|', delim2); 11596 ck_assert_ptr_eq(r, NULL); 11597 // icExtractCharSmallJsonO with several delimiters after each other 11598 setValO(self, "one/ two /three "); 11599 freeO(delim2); 11600 setTopSO(delim2, " "); 11601 r = icExtractCharSmallJsonO(self, '/', delim2); 11602 ck_assert_ptr_ne(r, null); 11603 s = toStringO(r); 11604 ck_assert_str_eq(s, "[\"\",\"three\"]"); 11605 free(s); 11606 terminateO(r); 11607 // multiple character delimiter 11608 setValO(self, "AAe thre|e icExtract"); 11609 freeO(delim2); 11610 setTopSO(delim2, "|"); 11611 r = icExtractCharSmallJsonO(self, ' ', delim2); 11612 ck_assert_ptr_ne(r, null); 11613 s = toStringO(r); 11614 ck_assert_str_eq(s, "[\"thre\"]"); 11615 free(s); 11616 terminateO(r); 11617 // empty delimiter 11618 setValO(self, "AAd"); 11619 freeO(delim2); 11620 setTopSO(delim2, ""); 11621 r = icExtractCharSmallJsonO(self, 'A', delim2); 11622 ck_assert_ptr_eq(r, NULL); 11623 // empty string 11624 setValO(self, ""); 11625 freeO(delim2); 11626 setTopSO(delim2, "#"); 11627 r = icExtractCharSmallJsonO(self, '$', delim2); 11628 ck_assert_ptr_eq(r, NULL); 11629 // delim1 = delim2 11630 setValO(self, "$qwe$"); 11631 freeO(delim2); 11632 setTopSO(delim2, "$"); 11633 r = icExtractCharSmallJsonO(self, '$', delim2); 11634 ck_assert_ptr_eq(r, NULL); 11635 // non json string 11636 freeO(delim2); 11637 r = icExtractCharSmallJsonO(self, '$', delim2); 11638 ck_assert_ptr_eq(r, NULL); 11639 // non json object 11640 terminateO(delim2); 11641 delim2 = (smallJsont*) allocSmallInt(1); 11642 r = icExtractCharSmallJsonO(self, ';', delim2); 11643 ck_assert_ptr_eq(r, NULL); 11644 terminateO(delim2); 11645 delim2 = allocSmallJson(); 11646 // NULL string 11647 freeO(self); 11648 freeO(delim2); 11649 setTopSO(delim2, ","); 11650 ck_assert_ptr_eq(icExtractCharSmallJsonO(self, ';', delim2), NULL); 11651 // NULL delimiter 11652 setValO(self, "test"); 11653 ck_assert_ptr_eq(icExtractCharSmallJsonO(self, ';', NULL), NULL); 11654 terminateO(delim2); 11655 terminateO(self); 11656 11657 END_TEST 11658 11659 11660 START_TEST(icExtractCharSmallStringSmallStringT) 11661 11662 smallArrayt* r; 11663 smallStringt *self = allocG(""); 11664 smallStringt* delim2 = allocSmallString("|"); 11665 11666 // string 11667 setValO(self, "one/twos"); 11668 setValO(delim2, "S"); 11669 r = icExtractCharSmallStringO(self, 'E', delim2); 11670 ck_assert_ptr_ne(r, null); 11671 char *s = toStringO(r); 11672 ck_assert_str_eq(s, "[\"/two\"]"); 11673 free(s); 11674 terminateO(r); 11675 // delimiter not found 11676 setValO(self, "one/two"); 11677 setValO(delim2, "/"); 11678 r = icExtractCharSmallStringO(self, '|', delim2); 11679 ck_assert_ptr_eq(r, NULL); 11680 // icExtractCharSmallStringO with several delimiters after each other 11681 setValO(self, "one/ two /three "); 11682 setValO(delim2, " "); 11683 r = icExtractCharSmallStringO(self, '/', delim2); 11684 ck_assert_ptr_ne(r, null); 11685 s = toStringO(r); 11686 ck_assert_str_eq(s, "[\"\",\"three\"]"); 11687 free(s); 11688 terminateO(r); 11689 // multiple character delimiter 11690 setValO(self, "AAe thre|e icExtract"); 11691 setValO(delim2, "|e"); 11692 r = icExtractCharSmallStringO(self, ' ', delim2); 11693 ck_assert_ptr_ne(r, null); 11694 s = toStringO(r); 11695 ck_assert_str_eq(s, "[\"thre\"]"); 11696 free(s); 11697 terminateO(r); 11698 // empty delimiter 11699 setValO(self, "AAd"); 11700 setValO(delim2, ""); 11701 r = icExtractCharSmallStringO(self, 'A', delim2); 11702 ck_assert_ptr_eq(r, NULL); 11703 // empty string 11704 setValO(self, ""); 11705 setValO(delim2, "#"); 11706 r = icExtractCharSmallStringO(self, '$', delim2); 11707 ck_assert_ptr_eq(r, NULL); 11708 // delim1 = delim2 11709 setValO(self, "$qwe$"); 11710 setValO(delim2, "$"); 11711 r = icExtractCharSmallStringO(self, '$', delim2); 11712 ck_assert_ptr_eq(r, NULL); 11713 // non json object 11714 terminateO(delim2); 11715 delim2 = (smallStringt*) allocSmallInt(1); 11716 r = icExtractCharSmallStringO(self, ';', delim2); 11717 ck_assert_ptr_eq(r, NULL); 11718 terminateO(delim2); 11719 delim2 = allocSmallString(","); 11720 // NULL string 11721 freeO(self); 11722 ck_assert_ptr_eq(icExtractCharSmallStringO(self, ';', delim2), NULL); 11723 // NULL delimiter 11724 setValO(self, "test"); 11725 ck_assert_ptr_eq(icExtractCharSmallStringO(self, ';', NULL), NULL); 11726 terminateO(delim2); 11727 terminateO(self); 11728 11729 END_TEST 11730 11731 11732 START_TEST(colorSmallStringT) 11733 11734 smallStringt* r; 11735 smallStringt *self = allocG("qwe"); 11736 11737 r = colorO(self, RED); 11738 ck_assert_ptr_ne(r, null); 11739 char *s = toStringO(r); 11740 ck_assert_str_eq(s, RED"qwe"RST); 11741 free(s); 11742 // null color 11743 r = colorO(self, null); 11744 ck_assert_ptr_eq(r, NULL); 11745 // empty self 11746 freeO(self); 11747 r = colorO(self, RED); 11748 ck_assert_ptr_eq(r, NULL); 11749 terminateO(self); 11750 11751 END_TEST 11752 11753 11754 START_TEST(colordSmallStringT) 11755 11756 char* r; 11757 smallStringt *self = allocG("qwe"); 11758 11759 r = colordO(self, RED); 11760 ck_assert_ptr_ne(r, null); 11761 ck_assert_str_eq(r, RED"qwe"RST); 11762 free(r); 11763 // empty string 11764 emptyO(self); 11765 r = colordO(self, RED); 11766 ck_assert_ptr_ne(r, null); 11767 ck_assert_str_eq(r, ""); 11768 free(r); 11769 // null color 11770 r = colordO(self, null); 11771 ck_assert_ptr_eq(r, NULL); 11772 // empty self 11773 freeO(self); 11774 r = colordO(self, RED); 11775 ck_assert_ptr_eq(r, NULL); 11776 terminateO(self); 11777 11778 END_TEST 11779 11780 11781 START_TEST(readFileSmallStringT) 11782 11783 smallStringt* r; 11784 smallStringt *self = allocG(""); 11785 11786 // text 11787 r = readFileO(self, "../textTest.null"); 11788 ck_assert_ptr_ne(r, null); 11789 char *s = toStringO(r); 11790 ck_assert_str_eq(s, "LINE 1\nANOTHER line\n"); 11791 free(s); 11792 // empty text 11793 r = readFileO(self, "../chmodTest.null"); 11794 ck_assert_ptr_ne(r, null); 11795 s = toStringO(r); 11796 ck_assert_str_eq(s, ""); 11797 free(s); 11798 fileChmod("../writeOnlyText.null", S_IWUSR | S_IWGRP | S_IWOTH); 11799 ck_assert_ptr_eq(readFileO(self, "../writeOnlyText.null"), NULL); 11800 fileChmod("../writeOnlyText.null", S_IRUSR |S_IWUSR | S_IRGRP | S_IROTH); 11801 // blank path 11802 ck_assert_ptr_eq(readFileO(self, ""), NULL); 11803 // NULL path 11804 ck_assert_ptr_eq(readFileO(self, NULL), NULL); 11805 // non existing path 11806 if (fileExists("nonExistingFile")) 11807 rmAll("nonExistingFile"); 11808 ck_assert_ptr_eq(readFileO(self, "nonExistingFile"), NULL); 11809 terminateO(self); 11810 11811 END_TEST 11812 11813 11814 START_TEST(readFileSmallJsonSmallStringT) 11815 11816 smallStringt* r; 11817 smallStringt *self = allocG(""); 11818 smallJsont *filePath = allocSmallJson(); 11819 11820 // text 11821 setTopSO(filePath, "../textTest.null"); 11822 r = self->f->readFileSmallJson(self, filePath); 11823 ck_assert_ptr_ne(r, null); 11824 char *s = toStringO(r); 11825 ck_assert_str_eq(s, "LINE 1\nANOTHER line\n"); 11826 free(s); 11827 // empty text 11828 freeO(filePath); 11829 setTopSO(filePath, "../chmodTest.null"); 11830 r = self->f->readFileSmallJson(self, filePath); 11831 ck_assert_ptr_ne(r, null); 11832 s = toStringO(r); 11833 ck_assert_str_eq(s, ""); 11834 free(s); 11835 freeO(filePath); 11836 fileChmod("../writeOnlyText.null", S_IWUSR | S_IWGRP | S_IWOTH); 11837 setTopSO(filePath, "../writeOnlyText.null"); 11838 ck_assert_ptr_eq(self->f->readFileSmallJson(self, filePath), NULL); 11839 fileChmod("../writeOnlyText.null", S_IRUSR |S_IWUSR | S_IRGRP | S_IROTH); 11840 // blank path 11841 freeO(filePath); 11842 setTopSO(filePath, ""); 11843 ck_assert_ptr_eq(self->f->readFileSmallJson(self, filePath), NULL); 11844 // non json string 11845 freeO(filePath); 11846 ck_assert_ptr_eq(self->f->readFileSmallJson(self, filePath), NULL); 11847 // non json object 11848 terminateO(filePath); 11849 filePath = (smallJsont*) allocSmallInt(1); 11850 ck_assert_ptr_eq(self->f->readFileSmallJson(self, filePath), NULL); 11851 terminateO(filePath); 11852 // NULL path 11853 ck_assert_ptr_eq(self->f->readFileSmallJson(self, NULL), NULL); 11854 // non existing path 11855 if (fileExists("nonExistingFile")) 11856 rmAll("nonExistingFile"); 11857 filePath = allocSmallJson(); 11858 setTopSO(filePath, "nonExistingFile"); 11859 ck_assert_ptr_eq(self->f->readFileSmallJson(self, filePath), NULL); 11860 terminateO(filePath); 11861 terminateO(self); 11862 11863 END_TEST 11864 11865 11866 START_TEST(readFileSmallStringSmallStringT) 11867 11868 smallStringt* r; 11869 smallStringt *self = allocG(""); 11870 smallStringt *filePath = allocSmallString(""); 11871 11872 // text 11873 setValO(filePath, "../textTest.null"); 11874 r = self->f->readFileSmallString(self, filePath); 11875 ck_assert_ptr_ne(r, null); 11876 char *s = toStringO(r); 11877 ck_assert_str_eq(s, "LINE 1\nANOTHER line\n"); 11878 free(s); 11879 // empty text 11880 setValO(filePath, "../chmodTest.null"); 11881 r = self->f->readFileSmallString(self, filePath); 11882 ck_assert_ptr_ne(r, null); 11883 s = toStringO(r); 11884 ck_assert_str_eq(s, ""); 11885 free(s); 11886 fileChmod("../writeOnlyText.null", S_IWUSR | S_IWGRP | S_IWOTH); 11887 setValO(filePath, "../writeOnlyText.null"); 11888 ck_assert_ptr_eq(self->f->readFileSmallString(self, filePath), NULL); 11889 fileChmod("../writeOnlyText.null", S_IRUSR |S_IWUSR | S_IRGRP | S_IROTH); 11890 // blank path 11891 setValO(filePath, ""); 11892 ck_assert_ptr_eq(self->f->readFileSmallString(self, filePath), NULL); 11893 // non empty filePath 11894 freeO(filePath); 11895 ck_assert_ptr_eq(self->f->readFileSmallString(self, filePath), NULL); 11896 // non smallString object 11897 terminateO(filePath); 11898 filePath = (smallStringt*) allocSmallInt(1); 11899 ck_assert_ptr_eq(self->f->readFileSmallString(self, filePath), NULL); 11900 terminateO(filePath); 11901 // NULL path 11902 ck_assert_ptr_eq(self->f->readFileSmallString(self, NULL), NULL); 11903 // non existing path 11904 if (fileExists("nonExistingFile")) 11905 rmAll("nonExistingFile"); 11906 filePath = allocSmallString("nonExistingFile"); 11907 ck_assert_ptr_eq(self->f->readFileSmallString(self, filePath), NULL); 11908 terminateO(filePath); 11909 terminateO(self); 11910 11911 END_TEST 11912 11913 11914 START_TEST(readStreamSmallStringT) 11915 11916 smallStringt* r; 11917 smallStringt *self = allocG(""); 11918 FILE *f; 11919 11920 // text 11921 f = fopen("../textTest.null", "r"); 11922 r = readStreamO(self, f); 11923 ck_assert_ptr_ne(r, null); 11924 char *s = toStringO(r); 11925 ck_assert_str_eq(s, "LINE 1\nANOTHER line\n"); 11926 free(s); 11927 fclose(f); 11928 // empty text 11929 f = fopen("../chmodTest.null", "r"); 11930 r = readStreamO(self, f); 11931 ck_assert_ptr_ne(r, null); 11932 s = toStringO(r); 11933 ck_assert_str_eq(s, ""); 11934 free(s); 11935 fclose(f); 11936 // null file 11937 ck_assert_ptr_eq(readStreamO(self, null), null); 11938 terminateO(self); 11939 11940 END_TEST 11941 11942 11943 START_TEST(writeFileSmallStringT) 11944 11945 int r; 11946 smallStringt *self = allocG(""); 11947 11948 // write textOutTest.null 11949 readFileO(self, "../textTest.null"); 11950 r = writeFileO(self, "textOutTest.null"); 11951 ck_assert(r); 11952 // check textOutTest.null 11953 freeO(self); 11954 readFileO(self, "textOutTest.null"); 11955 ck_assert_uint_eq(lenO(self),20); 11956 char *s = toStringO(self); 11957 ck_assert_str_eq(s, "LINE 1\nANOTHER line\n"); 11958 free(s); 11959 // non existing file 11960 // make sure the file doesnt exist 11961 if (fileExists("nonExistingFile")) 11962 rmAll("nonExistingFile"); 11963 ck_assert(writeFileO(self, "nonExistingFile")); 11964 if (fileExists("nonExistingFile")) 11965 rmAll("nonExistingFile"); 11966 // blank file name 11967 ck_assert(!writeFileO(self, " ")); 11968 // read only path 11969 ck_assert(!writeFileO(self, "/nonExistingFile")); 11970 // NULL path 11971 ck_assert(!writeFileO(self, NULL)); 11972 // NULL string 11973 freeO(self); 11974 ck_assert(!writeFileO(self, "a")); 11975 terminateO(self); 11976 11977 END_TEST 11978 11979 11980 START_TEST(writeFileSmallJsonSmallStringT) 11981 11982 int r; 11983 smallStringt *self = allocG(""); 11984 smallJsont *filePath = allocSmallJson(); 11985 11986 // write textOutTest.null 11987 setTopSO(filePath, "textOutTest.null"); 11988 readFileO(self, "../textTest.null"); 11989 r = self->f->writeFileSmallJson(self, filePath); 11990 ck_assert(r); 11991 // check textOutTest.null 11992 freeO(self); 11993 readFileO(self, "textOutTest.null"); 11994 ck_assert_uint_eq(lenO(self),20); 11995 char *s = toStringO(self); 11996 ck_assert_str_eq(s, "LINE 1\nANOTHER line\n"); 11997 free(s); 11998 // non existing file 11999 // make sure the file doesnt exist 12000 if (fileExists("nonExistingFile")) 12001 rmAll("nonExistingFile"); 12002 freeO(filePath); 12003 setTopSO(filePath, "textOutTest.null"); 12004 ck_assert(self->f->writeFileSmallJson(self, filePath)); 12005 if (fileExists("nonExistingFile")) 12006 rmAll("nonExistingFile"); 12007 // blank file name 12008 freeO(filePath); 12009 setTopSO(filePath, " "); 12010 ck_assert(!self->f->writeFileSmallJson(self, filePath)); 12011 // read only path 12012 freeO(filePath); 12013 setTopSO(filePath, "/nonExistingFile"); 12014 ck_assert(!self->f->writeFileSmallJson(self, filePath)); 12015 // non json string 12016 freeO(filePath); 12017 ck_assert(!self->f->writeFileSmallJson(self, filePath)); 12018 // non json object 12019 terminateO(filePath); 12020 filePath = (smallJsont*) allocSmallInt(1); 12021 ck_assert(!self->f->writeFileSmallJson(self, filePath)); 12022 terminateO(filePath); 12023 // NULL path 12024 ck_assert(!self->f->writeFileSmallJson(self, NULL)); 12025 // NULL string 12026 freeO(self); 12027 filePath = allocSmallJson(); 12028 setTopSO(filePath, "a"); 12029 ck_assert(!self->f->writeFileSmallJson(self, filePath)); 12030 terminateO(filePath); 12031 terminateO(self); 12032 12033 END_TEST 12034 12035 12036 START_TEST(writeFileSmallStringSmallStringT) 12037 12038 int r; 12039 smallStringt *self = allocG(""); 12040 smallStringt *filePath = allocSmallString(""); 12041 12042 // write textOutTest.null 12043 setValO(filePath, "textOutTest.null"); 12044 readFileO(self, "../textTest.null"); 12045 r = self->f->writeFileSmallString(self, filePath); 12046 ck_assert(r); 12047 // check textOutTest.null 12048 freeO(self); 12049 readFileO(self, "textOutTest.null"); 12050 ck_assert_uint_eq(lenO(self),20); 12051 char *s = toStringO(self); 12052 ck_assert_str_eq(s, "LINE 1\nANOTHER line\n"); 12053 free(s); 12054 // non existing file 12055 // make sure the file doesnt exist 12056 if (fileExists("nonExistingFile")) 12057 rmAll("nonExistingFile"); 12058 setValO(filePath, "textOutTest.null"); 12059 ck_assert(self->f->writeFileSmallString(self, filePath)); 12060 if (fileExists("nonExistingFile")) 12061 rmAll("nonExistingFile"); 12062 // blank file name 12063 setValO(filePath, " "); 12064 ck_assert(!self->f->writeFileSmallString(self, filePath)); 12065 // read only path 12066 setValO(filePath, "/nonExistingFile"); 12067 ck_assert(!self->f->writeFileSmallString(self, filePath)); 12068 // non smallString object 12069 terminateO(filePath); 12070 filePath = (smallStringt*) allocSmallInt(1); 12071 ck_assert(!self->f->writeFileSmallString(self, filePath)); 12072 terminateO(filePath); 12073 // NULL path 12074 ck_assert(!self->f->writeFileSmallString(self, NULL)); 12075 // NULL string 12076 freeO(self); 12077 filePath = allocSmallString("a"); 12078 ck_assert(!self->f->writeFileSmallString(self, filePath)); 12079 terminateO(filePath); 12080 terminateO(self); 12081 12082 END_TEST 12083 12084 12085 START_TEST(writeStreamSmallStringT) 12086 12087 int r; 12088 smallStringt *self = allocG(""); 12089 FILE *f; 12090 12091 // write textOutTest.null 12092 readFileO(self, "../textTest.null"); 12093 f = fopen("textOutTest.null", "w"); 12094 r = writeStreamO(self, f); 12095 ck_assert(r); 12096 fclose(f); 12097 // check textOutTest.null 12098 freeO(self); 12099 readFileO(self, "textOutTest.null"); 12100 ck_assert_uint_eq(lenO(self),20); 12101 ck_assert_str_eq(ssGet(self), "LINE 1\nANOTHER line\n"); 12102 // NULL file 12103 setValO(self, "qwe"); 12104 ck_assert(!writeStreamO(self, NULL)); 12105 // NULL string 12106 freeO(self); 12107 ck_assert(!writeStreamO(self, f)); 12108 terminateO(self); 12109 12110 END_TEST 12111 12112 12113 START_TEST(appendFileSmallStringT) 12114 12115 int r; 12116 smallStringt *self = allocG(""); 12117 12118 // write textOutTest.null 12119 setValO(self, "appended line\n"); 12120 r = appendFileO(self, "appendTextOutTest.null"); 12121 ck_assert(r); 12122 setValO(self, "appended line 2\n"); 12123 r = appendFileO(self, "appendTextOutTest.null"); 12124 ck_assert(r); 12125 // check textOutTest.null 12126 freeO(self); 12127 readFileO(self, "appendTextOutTest.null"); 12128 ck_assert_uint_eq(lenO(self),30); 12129 ck_assert_str_eq(ssGet(self), "appended line\nappended line 2\n"); 12130 if (fileExists("appendTextOutTest.null")) 12131 rmAll("appendTextOutTest.null"); 12132 // blank file name 12133 ck_assert(!appendFileO(self, " ")); 12134 // read only path 12135 ck_assert(!appendFileO(self, "/nonExistingFile")); 12136 // NULL path 12137 ck_assert(!appendFileO(self, NULL)); 12138 // NULL string 12139 freeO(self); 12140 ck_assert(!appendFileO(self, "a")); 12141 terminateO(self); 12142 12143 END_TEST 12144 12145 12146 START_TEST(appendFileSmallStringSmallStringT) 12147 12148 int r; 12149 smallStringt *self = allocG(""); 12150 smallStringt *filePath = allocSmallString(""); 12151 12152 // write textOutTest.null 12153 setValO(self, "appended line\n"); 12154 setValO(filePath, "appendTextOutTest.null"); 12155 r = appendFileSmallStringO(self, filePath); 12156 ck_assert(r); 12157 setValO(self, "appended line 2\n"); 12158 r = appendFileSmallStringO(self, filePath); 12159 ck_assert(r); 12160 // check textOutTest.null 12161 freeO(self); 12162 readFileO(self, "appendTextOutTest.null"); 12163 ck_assert_uint_eq(lenO(self),30); 12164 ck_assert_str_eq(ssGet(self), "appended line\nappended line 2\n"); 12165 if (fileExists("appendTextOutTest.null")) 12166 rmAll("appendTextOutTest.null"); 12167 // blank file name 12168 setValO(filePath, " "); 12169 ck_assert(!appendFileSmallStringO(self, filePath)); 12170 // read only path 12171 setValO(filePath, "/nonExistingFile"); 12172 ck_assert(!appendFileSmallStringO(self, filePath)); 12173 // non smallString path 12174 terminateO(filePath); 12175 filePath = (smallStringt*) allocSmallInt(1); 12176 ck_assert(!appendFileSmallStringO(self, filePath)); 12177 terminateO(filePath); 12178 // NULL path 12179 ck_assert(!appendFileSmallStringO(self, NULL)); 12180 // NULL string 12181 freeO(self); 12182 filePath = allocSmallString("a"); 12183 ck_assert(!appendFileSmallStringO(self, filePath)); 12184 terminateO(filePath); 12185 terminateO(self); 12186 12187 END_TEST 12188 12189 12190 START_TEST(duplicateSmallStringGT) 12191 12192 smallStringt* r; 12193 smallStringt *self = allocG("qwe"); 12194 12195 r = duplicateSmallStringG(self); 12196 ck_assert_ptr_ne(r, null); 12197 ck_assert_str_eq(ssGet(r), ssGet(self)); 12198 terminateO(r); 12199 terminateO(self); 12200 12201 END_TEST 12202 12203 12204 START_TEST(freeSmallStringGT) 12205 12206 smallStringt *self = allocG(""); 12207 12208 freeSmallStringG(self); 12209 ck_assert_ptr_eq(self->data, null); 12210 terminateO(self); 12211 12212 END_TEST 12213 12214 12215 START_TEST(setBoolSmallStringGT) 12216 12217 smallStringt* r; 12218 smallStringt* self = allocG(""); 12219 12220 r = setBoolSmallStringG(self, false); 12221 ck_assert_ptr_ne(r, null); 12222 char *s = toStringO(r); 12223 ck_assert_str_eq(s, "false"); 12224 free(s); 12225 terminateO(self); 12226 12227 END_TEST 12228 12229 12230 START_TEST(setDoubleSmallStringGT) 12231 12232 smallStringt* r; 12233 smallStringt* self = allocG(""); 12234 12235 r = setDoubleSmallStringG(self, 2.2); 12236 ck_assert_ptr_ne(r, null); 12237 char *s = toStringO(r); 12238 ck_assert_str_eq(s, "2.200000e+00"); 12239 free(s); 12240 terminateO(self); 12241 12242 END_TEST 12243 12244 12245 START_TEST(setInt64SmallStringGT) 12246 12247 smallStringt* r; 12248 smallStringt* self = allocG(""); 12249 12250 r = setInt64SmallStringG(self, 2); 12251 ck_assert_ptr_ne(r, null); 12252 char *s = toStringO(r); 12253 ck_assert_str_eq(s, "2"); 12254 free(s); 12255 terminateO(self); 12256 12257 END_TEST 12258 12259 12260 START_TEST(setInt32SmallStringGT) 12261 12262 smallStringt* r; 12263 smallStringt* self = allocG(""); 12264 12265 r = setInt32SmallStringG(self, 2); 12266 ck_assert_ptr_ne(r, null); 12267 char *s = toStringO(r); 12268 ck_assert_str_eq(s, "2"); 12269 free(s); 12270 terminateO(self); 12271 12272 END_TEST 12273 12274 12275 START_TEST(setUint32SmallStringGT) 12276 12277 smallStringt* r; 12278 smallStringt* self = allocG(""); 12279 12280 r = setUint32SmallStringG(self, 2); 12281 ck_assert_ptr_ne(r, null); 12282 char *s = toStringO(r); 12283 ck_assert_str_eq(s, "2"); 12284 free(s); 12285 terminateO(self); 12286 12287 END_TEST 12288 12289 12290 START_TEST(setUint64SmallStringGT) 12291 12292 smallStringt* r; 12293 smallStringt* self = allocG(""); 12294 12295 r = setUint64SmallStringG(self, 2); 12296 ck_assert_ptr_ne(r, null); 12297 char *s = toStringO(r); 12298 ck_assert_str_eq(s, "2"); 12299 free(s); 12300 terminateO(self); 12301 12302 END_TEST 12303 12304 12305 START_TEST(setSmallStringGT) 12306 12307 smallStringt* r; 12308 smallStringt* self = allocG(""); 12309 12310 r = setSmallStringG(self, "qwe"); 12311 ck_assert_ptr_ne(r, null); 12312 char *s = toStringO(r); 12313 ck_assert_str_eq(s, "qwe"); 12314 free(s); 12315 terminateO(self); 12316 12317 END_TEST 12318 12319 12320 START_TEST(setCharSmallStringGT) 12321 12322 smallStringt* r; 12323 smallStringt *self = allocG(""); 12324 12325 r = setCharSmallStringG(self, 'q'); 12326 ck_assert_ptr_ne(r, null); 12327 char *s = toStringO(r); 12328 ck_assert_str_eq(s, "q"); 12329 free(s); 12330 terminateO(self); 12331 12332 END_TEST 12333 12334 12335 START_TEST(setSmallArraySmallStringGT) 12336 12337 smallStringt* r; 12338 smallStringt* self = allocG(""); 12339 smallArrayt* p2 = allocSmallArray(); 12340 12341 p2->f->pushS(p2, "asd"); 12342 r = setSmallArraySmallStringG(self, p2); 12343 ck_assert_ptr_ne(r, null); 12344 char *s = toStringO(r); 12345 ck_assert_str_eq(s, "[\"asd\"]"); 12346 free(s); 12347 terminateO(p2); 12348 terminateO(self); 12349 12350 END_TEST 12351 12352 12353 START_TEST(setFromSmallDictSmallStringGT) 12354 12355 smallStringt* r; 12356 smallStringt* self = allocG(""); 12357 smallDictt* p2 = allocSmallDict(); 12358 12359 p2->f->setS(p2, "1", "asd"); 12360 r = setFromSmallDictSmallStringG(self, p2); 12361 ck_assert_ptr_ne(r, null); 12362 char *s = toStringO(r); 12363 ck_assert_str_eq(s, "{\"1\":\"asd\"}"); 12364 free(s); 12365 terminateO(p2); 12366 terminateO(self); 12367 12368 END_TEST 12369 12370 12371 START_TEST(setFromSmallJsonSmallStringGT) 12372 12373 smallStringt* r; 12374 smallStringt* self = allocG(""); 12375 smallJsont* p2 = allocSmallJson(); 12376 12377 p2->f->setS(p2, "1", "asd"); 12378 r = setFromSmallJsonSmallStringG(self, p2); 12379 ck_assert_ptr_ne(r, null); 12380 char *s = toStringO(r); 12381 ck_assert_str_eq(s, "{\"1\":\"asd\"}"); 12382 free(s); 12383 terminateO(p2); 12384 terminateO(self); 12385 12386 END_TEST 12387 12388 12389 START_TEST(setSmallBoolSmallStringGT) 12390 12391 smallStringt* r; 12392 smallStringt* self = allocG(""); 12393 smallBoolt* p2 = allocSmallBool(true); 12394 12395 r = setSmallBoolSmallStringG(self, p2); 12396 ck_assert_ptr_ne(r, null); 12397 char *s = toStringO(r); 12398 ck_assert_str_eq(s, "true"); 12399 free(s); 12400 terminateO(p2); 12401 terminateO(self); 12402 12403 END_TEST 12404 12405 12406 START_TEST(setSmallDoubleSmallStringGT) 12407 12408 smallStringt* r; 12409 smallStringt* self = allocG(""); 12410 smallDoublet* p2 = allocSmallDouble(2.2); 12411 12412 r = setSmallDoubleSmallStringG(self, p2); 12413 ck_assert_ptr_ne(r, null); 12414 char *s = toStringO(r); 12415 ck_assert_str_eq(s, "2.200000e+00"); 12416 free(s); 12417 terminateO(p2); 12418 terminateO(self); 12419 12420 END_TEST 12421 12422 12423 START_TEST(setSmallIntSmallStringGT) 12424 12425 smallStringt* r; 12426 smallStringt* self = allocG(""); 12427 smallIntt* p2 = allocSmallInt(2); 12428 12429 r = setSmallIntSmallStringG(self, p2); 12430 ck_assert_ptr_ne(r, null); 12431 char *s = toStringO(r); 12432 ck_assert_str_eq(s, "2"); 12433 free(s); 12434 terminateO(p2); 12435 terminateO(self); 12436 12437 END_TEST 12438 12439 12440 START_TEST(setSmallJsonSmallStringGT) 12441 12442 smallStringt* r; 12443 smallStringt* self = allocG(""); 12444 smallJsont* p2 = allocSmallJson(); 12445 12446 setTopBoolO(p2, true); 12447 r = setSmallJsonSmallStringG(self, p2); 12448 ck_assert_ptr_ne(r, null); 12449 char *s = toStringO(r); 12450 ck_assert_str_eq(s, "true"); 12451 free(s); 12452 terminateO(p2); 12453 terminateO(self); 12454 12455 END_TEST 12456 12457 12458 START_TEST(setSmallStringSmallStringGT) 12459 12460 smallStringt* r; 12461 smallStringt* self = allocG(""); 12462 smallStringt* p2 = allocSmallString("qwe"); 12463 12464 r = setSmallStringSmallStringG(self, p2); 12465 ck_assert_ptr_ne(r, null); 12466 char *s = toStringO(r); 12467 ck_assert_str_eq(s, "qwe"); 12468 free(s); 12469 terminateO(p2); 12470 terminateO(self); 12471 12472 END_TEST 12473 12474 12475 START_TEST(getAtSmallStringGT) 12476 12477 smallStringt *self = allocG(""); 12478 12479 setValO(self, "sheepy"); 12480 ck_assert_uint_eq(getAtSmallStringG(self, 0, 0), 's'); 12481 terminateO(self); 12482 12483 END_TEST 12484 12485 12486 START_TEST(setAtSmallStringGT) 12487 12488 smallStringt* r; 12489 smallStringt *self = allocG("a"); 12490 12491 r = setAtSmallStringG(self, 0, 'S'); 12492 ck_assert_ptr_ne(r, null); 12493 ck_assert_uint_eq(ssGet(self)[0], 'S'); 12494 terminateO(self); 12495 12496 END_TEST 12497 12498 12499 START_TEST(appendSmallStringGT) 12500 12501 smallStringt* r; 12502 smallStringt *self = allocG("qwe"); 12503 smallStringt *string = allocSmallString("!@#"); 12504 12505 r = appendSmallStringG(self, string); 12506 ck_assert_ptr_ne(r, null); 12507 char *s = toStringO(r); 12508 ck_assert_str_eq(s, "qwe!@#"); 12509 free(s); 12510 terminateO(string); 12511 terminateO(self); 12512 12513 END_TEST 12514 12515 12516 START_TEST(appendSmallJsonSmallStringGT) 12517 12518 smallStringt* r; 12519 smallStringt *self = allocG("qwe"); 12520 smallJsont *string = allocSmallJson(); 12521 12522 setTopSO(string, "!@#"); 12523 r = appendSmallJsonSmallStringG(self, string); 12524 ck_assert_ptr_ne(r, null); 12525 char *s = toStringO(r); 12526 ck_assert_str_eq(s, "qwe!@#"); 12527 free(s); 12528 terminateO(string); 12529 terminateO(self); 12530 12531 END_TEST 12532 12533 12534 START_TEST(appendSSmallStringGT) 12535 12536 smallStringt* r; 12537 smallStringt *self = allocG("qwe"); 12538 12539 r = appendSSmallStringG(self, "!@#"); 12540 ck_assert_ptr_ne(r, null); 12541 char *s = toStringO(r); 12542 ck_assert_str_eq(s, "qwe!@#"); 12543 free(s); 12544 terminateO(self); 12545 12546 END_TEST 12547 12548 12549 START_TEST(appendCharSmallStringGT) 12550 12551 smallStringt* r; 12552 smallStringt *self = allocG("qwe"); 12553 12554 r = appendCharSmallStringG(self, '!'); 12555 ck_assert_ptr_ne(r, null); 12556 char *s = toStringO(r); 12557 ck_assert_str_eq(s, "qwe!"); 12558 free(s); 12559 terminateO(self); 12560 12561 END_TEST 12562 12563 12564 START_TEST(appendNSmashSmallStringGT) 12565 12566 smallStringt* r; 12567 smallStringt *self = allocG("qwe"); 12568 smallStringt *string = allocSmallString("!@#"); 12569 12570 r = appendNSmashSmallStringG(self, string); 12571 ck_assert_ptr_ne(r, null); 12572 char *s = toStringO(r); 12573 ck_assert_str_eq(s, "qwe!@#"); 12574 free(s); 12575 terminateO(self); 12576 12577 END_TEST 12578 12579 12580 START_TEST(appendNSmashSmallJsonSmallStringGT) 12581 12582 smallStringt* r; 12583 smallStringt *self = allocG("qwe"); 12584 smallJsont *string = allocSmallJson(); 12585 12586 setTopSO(string, "!@#"); 12587 r = appendNSmashSmallJsonSmallStringG(self, string); 12588 ck_assert_ptr_ne(r, null); 12589 char *s = toStringO(r); 12590 ck_assert_str_eq(s, "qwe!@#"); 12591 free(s); 12592 terminateO(self); 12593 12594 END_TEST 12595 12596 12597 START_TEST(appendNSmashSSmallStringGT) 12598 12599 smallStringt* r; 12600 smallStringt *self = allocG("qwe"); 12601 12602 r = appendNSmashSSmallStringG(self, strdup("!@#")); 12603 ck_assert_ptr_ne(r, null); 12604 char *s = toStringO(r); 12605 ck_assert_str_eq(s, "qwe!@#"); 12606 free(s); 12607 terminateO(self); 12608 12609 END_TEST 12610 12611 12612 START_TEST(prependSmallStringGT) 12613 12614 smallStringt* r; 12615 smallStringt *self = allocG("qwe"); 12616 smallStringt *string = allocSmallString("!@#"); 12617 12618 r = prependSmallStringG(self, string); 12619 ck_assert_ptr_ne(r, null); 12620 char *s = toStringO(r); 12621 ck_assert_str_eq(s, "!@#qwe"); 12622 free(s); 12623 terminateO(string); 12624 terminateO(self); 12625 12626 END_TEST 12627 12628 12629 START_TEST(prependSmallJsonSmallStringGT) 12630 12631 smallStringt* r; 12632 smallStringt *self = allocG("qwe"); 12633 smallJsont *string = allocSmallJson(); 12634 12635 setTopSO(string, "!@#"); 12636 r = prependSmallJsonSmallStringG(self, string); 12637 ck_assert_ptr_ne(r, null); 12638 char *s = toStringO(r); 12639 ck_assert_str_eq(s, "!@#qwe"); 12640 free(s); 12641 terminateO(string); 12642 terminateO(self); 12643 12644 END_TEST 12645 12646 12647 START_TEST(prependSSmallStringGT) 12648 12649 smallStringt* r; 12650 smallStringt *self = allocG("qwe"); 12651 12652 r = prependSSmallStringG(self, "!@#"); 12653 ck_assert_ptr_ne(r, null); 12654 char *s = toStringO(r); 12655 ck_assert_str_eq(s, "!@#qwe"); 12656 free(s); 12657 terminateO(self); 12658 12659 END_TEST 12660 12661 12662 START_TEST(prependCharSmallStringGT) 12663 12664 smallStringt* r; 12665 smallStringt *self = allocG("qwe"); 12666 12667 r = prependCharSmallStringG(self, '!'); 12668 ck_assert_ptr_ne(r, null); 12669 char *s = toStringO(r); 12670 ck_assert_str_eq(s, "!qwe"); 12671 free(s); 12672 terminateO(self); 12673 12674 END_TEST 12675 12676 12677 START_TEST(prependNSmashSmallStringGT) 12678 12679 smallStringt* r; 12680 smallStringt *self = allocG("qwe"); 12681 smallStringt *string = allocSmallString("!@#"); 12682 12683 r = prependNSmashSmallStringG(self, string); 12684 ck_assert_ptr_ne(r, null); 12685 char *s = toStringO(r); 12686 ck_assert_str_eq(s, "!@#qwe"); 12687 free(s); 12688 terminateO(self); 12689 12690 END_TEST 12691 12692 12693 START_TEST(prependNSmashSmallJsonSmallStringGT) 12694 12695 smallStringt* r; 12696 smallStringt *self = allocG("qwe"); 12697 smallJsont *string = allocSmallJson(); 12698 12699 setTopSO(string, "!@#"); 12700 r = prependNSmashSmallJsonSmallStringG(self, string); 12701 ck_assert_ptr_ne(r, null); 12702 char *s = toStringO(r); 12703 ck_assert_str_eq(s, "!@#qwe"); 12704 free(s); 12705 terminateO(self); 12706 12707 END_TEST 12708 12709 12710 START_TEST(prependNSmashSSmallStringGT) 12711 12712 smallStringt* r; 12713 smallStringt *self = allocG("qwe"); 12714 12715 r = prependNSmashSSmallStringG(self, strdup("!@#")); 12716 ck_assert_ptr_ne(r, null); 12717 char *s = toStringO(r); 12718 ck_assert_str_eq(s, "!@#qwe"); 12719 free(s); 12720 terminateO(self); 12721 12722 END_TEST 12723 12724 12725 START_TEST(replaceSmallStringGT) 12726 12727 smallStringt* r; 12728 smallStringt *self = allocG("#ee#ee#ad"); 12729 12730 // replace string, multiple character new delimeter 12731 r = replaceSmallStringG(self, "#","^^", 0); 12732 ck_assert_ptr_ne(r, null); 12733 char *s = toStringO(r); 12734 ck_assert_str_eq(s, "^^ee^^ee^^ad"); 12735 free(s); 12736 terminateO(self); 12737 12738 END_TEST 12739 12740 12741 START_TEST(replaceCharSSmallStringGT) 12742 12743 smallStringt* r; 12744 smallStringt *self = allocG(""); 12745 12746 // replace string, multiple character new delimeter 12747 setValO(self, "#ee#ee#ad"); 12748 r = replaceCharSSmallStringG(self, '#',"^^", 0); 12749 ck_assert_ptr_ne(r, null); 12750 char *s = toStringO(r); 12751 ck_assert_str_eq(s, "^^ee^^ee^^ad"); 12752 free(s); 12753 terminateO(self); 12754 12755 END_TEST 12756 12757 12758 START_TEST(replaceSCharSmallStringGT) 12759 12760 smallStringt* r; 12761 smallStringt *self = allocG(""); 12762 12763 // replace string, multiple character new delimeter 12764 setValO(self, "#ee#ee#ad"); 12765 r = replaceSCharSmallStringG(self, "#",'^',0); 12766 ck_assert_ptr_ne(r, null); 12767 char *s = toStringO(r); 12768 ck_assert_str_eq(s, "^ee^ee^ad"); 12769 free(s); 12770 terminateO(self); 12771 12772 END_TEST 12773 12774 12775 START_TEST(replaceCharCharSmallStringGT) 12776 12777 smallStringt* r; 12778 smallStringt *self = allocG(""); 12779 12780 // replace string, multiple character new delimeter 12781 setValO(self, "#ee#ee#ad"); 12782 r = replaceCharCharSmallStringG(self, '#','^', 0); 12783 ck_assert_ptr_ne(r, null); 12784 char *s = toStringO(r); 12785 ck_assert_str_eq(s, "^ee^ee^ad"); 12786 free(s); 12787 terminateO(self); 12788 12789 END_TEST 12790 12791 12792 START_TEST(replaceSmallJsonSmallJsonSmallStringGT) 12793 12794 smallStringt* r; 12795 smallStringt *self = allocG("#ee#ee#ad"); 12796 smallJsont *olds = allocSmallJson(); 12797 smallJsont *news = allocSmallJson(); 12798 12799 // replace string, multiple character new delimeter 12800 freeO(olds); 12801 freeO(news); 12802 setTopSO(olds, "#"); 12803 setTopSO(news, "^^"); 12804 r = replaceSmallJsonSmallJsonSmallStringG(self, olds, news, 0); 12805 ck_assert_ptr_ne(r, null); 12806 char *s = toStringO(r); 12807 ck_assert_str_eq(s, "^^ee^^ee^^ad"); 12808 free(s); 12809 terminateO(olds); 12810 terminateO(news); 12811 terminateO(self); 12812 12813 END_TEST 12814 12815 12816 START_TEST(replaceSmallJsonSmallStringSmallStringGT) 12817 12818 smallStringt* r; 12819 smallStringt *self = allocG("#ee#ee#ad"); 12820 smallJsont *olds = allocSmallJson(); 12821 smallStringt *news = allocSmallString(""); 12822 12823 // replace string, multiple character new delimeter 12824 freeO(olds); 12825 setTopSO(olds, "#"); 12826 setValO(news, "^^"); 12827 r = replaceSmallJsonSmallStringSmallStringG(self, olds, news, 0); 12828 ck_assert_ptr_ne(r, null); 12829 char *s = toStringO(r); 12830 ck_assert_str_eq(s, "^^ee^^ee^^ad"); 12831 free(s); 12832 terminateO(olds); 12833 terminateO(news); 12834 terminateO(self); 12835 12836 END_TEST 12837 12838 12839 START_TEST(replaceSmallJsonSSmallStringGT) 12840 12841 smallStringt* r; 12842 smallStringt *self = allocG("#ee#ee#ad"); 12843 smallJsont *olds = allocSmallJson(); 12844 const char *news; 12845 12846 // replace string, multiple character new delimeter 12847 freeO(olds); 12848 setTopSO(olds, "#"); 12849 news = "^^"; 12850 r = replaceSmallJsonSSmallStringG(self, olds, news, 0); 12851 ck_assert_ptr_ne(r, null); 12852 char *s = toStringO(r); 12853 ck_assert_str_eq(s, "^^ee^^ee^^ad"); 12854 free(s); 12855 terminateO(olds); 12856 terminateO(self); 12857 12858 END_TEST 12859 12860 12861 START_TEST(replaceSmallJsonCharSmallStringGT) 12862 12863 smallStringt* r; 12864 smallStringt *self = allocG("#ee#ee#ad"); 12865 smallJsont *olds = allocSmallJson(); 12866 char news; 12867 12868 // replace string, multiple character new delimeter 12869 freeO(olds); 12870 setTopSO(olds, "#"); 12871 news = '^'; 12872 r = replaceSmallJsonCharSmallStringG(self, olds, news, 0); 12873 ck_assert_ptr_ne(r, null); 12874 char *s = toStringO(r); 12875 ck_assert_str_eq(s, "^ee^ee^ad"); 12876 free(s); 12877 terminateO(olds); 12878 terminateO(self); 12879 12880 END_TEST 12881 12882 12883 START_TEST(replaceSmallStringSmallJsonSmallStringGT) 12884 12885 smallStringt* r; 12886 smallStringt *self = allocG("#ee#ee#ad"); 12887 smallStringt *olds = allocSmallString(""); 12888 smallJsont *news = allocSmallJson(); 12889 12890 // replace string, multiple character new delimeter 12891 freeO(news); 12892 setValO(olds, "#"); 12893 setTopSO(news, "^^"); 12894 r = replaceSmallStringSmallJsonSmallStringG(self, olds, news, 0); 12895 ck_assert_ptr_ne(r, null); 12896 char *s = toStringO(r); 12897 ck_assert_str_eq(s, "^^ee^^ee^^ad"); 12898 free(s); 12899 terminateO(olds); 12900 terminateO(news); 12901 terminateO(self); 12902 12903 END_TEST 12904 12905 12906 START_TEST(replaceSmallStringSmallStringSmallStringGT) 12907 12908 smallStringt* r; 12909 smallStringt *self = allocG("#ee#ee#ad"); 12910 smallStringt *olds = allocSmallString(""); 12911 smallStringt *news = allocSmallString(""); 12912 12913 // replace string, multiple character new delimeter 12914 setValO(olds, "#"); 12915 setValO(news, "^^"); 12916 r = replaceSmallStringSmallStringSmallStringG(self, olds, news, 0); 12917 ck_assert_ptr_ne(r, null); 12918 char *s = toStringO(r); 12919 ck_assert_str_eq(s, "^^ee^^ee^^ad"); 12920 free(s); 12921 terminateO(olds); 12922 terminateO(news); 12923 terminateO(self); 12924 12925 END_TEST 12926 12927 12928 START_TEST(replaceSmallStringSSmallStringGT) 12929 12930 smallStringt* r; 12931 smallStringt *self = allocG("#ee#ee#ad"); 12932 smallStringt *olds = allocSmallString(""); 12933 const char *news; 12934 12935 // replace string, multiple character new delimeter 12936 setValO(olds, "#"); 12937 news = "^^"; 12938 r = replaceSmallStringSSmallStringG(self, olds, news, 0); 12939 ck_assert_ptr_ne(r, null); 12940 char *s = toStringO(r); 12941 ck_assert_str_eq(s, "^^ee^^ee^^ad"); 12942 free(s); 12943 terminateO(olds); 12944 terminateO(self); 12945 12946 END_TEST 12947 12948 12949 START_TEST(replaceSmallStringCharSmallStringGT) 12950 12951 smallStringt* r; 12952 smallStringt *self = allocG("#ee#ee#ad"); 12953 smallStringt *olds = allocSmallString(""); 12954 char news; 12955 12956 // replace string, multiple character new delimeter 12957 setValO(olds, "#"); 12958 news = '^'; 12959 r = replaceSmallStringCharSmallStringG(self, olds, news, 0); 12960 ck_assert_ptr_ne(r, null); 12961 char *s = toStringO(r); 12962 ck_assert_str_eq(s, "^ee^ee^ad"); 12963 free(s); 12964 terminateO(olds); 12965 terminateO(self); 12966 12967 END_TEST 12968 12969 12970 START_TEST(replaceSSmallJsonSmallStringGT) 12971 12972 smallStringt* r; 12973 smallStringt *self = allocG("#ee#ee#ad"); 12974 const char *olds; 12975 smallJsont *news = allocSmallJson(); 12976 12977 // replace string, multiple character new delimeter 12978 freeO(news); 12979 olds = "#"; 12980 setTopSO(news, "^^"); 12981 r = replaceSSmallJsonSmallStringG(self, olds, news, 0); 12982 ck_assert_ptr_ne(r, null); 12983 char *s = toStringO(r); 12984 ck_assert_str_eq(s, "^^ee^^ee^^ad"); 12985 free(s); 12986 terminateO(news); 12987 terminateO(self); 12988 12989 END_TEST 12990 12991 12992 START_TEST(replaceSSmallStringSmallStringGT) 12993 12994 smallStringt* r; 12995 smallStringt *self = allocG("#ee#ee#ad"); 12996 const char *olds; 12997 smallStringt *news = allocSmallString(""); 12998 12999 // replace string, multiple character new delimeter 13000 olds = "#"; 13001 setValO(news, "^^"); 13002 r = replaceSSmallStringSmallStringG(self, olds, news, 0); 13003 ck_assert_ptr_ne(r, null); 13004 char *s = toStringO(r); 13005 ck_assert_str_eq(s, "^^ee^^ee^^ad"); 13006 free(s); 13007 terminateO(news); 13008 terminateO(self); 13009 13010 END_TEST 13011 13012 13013 START_TEST(replaceCharSmallJsonSmallStringGT) 13014 13015 smallStringt* r; 13016 smallStringt *self = allocG("#ee#ee#ad"); 13017 char olds; 13018 smallJsont *news = allocSmallJson(); 13019 13020 // replace string, multiple character new delimeter 13021 freeO(news); 13022 olds = '#'; 13023 setTopSO(news, "^^"); 13024 r = replaceCharSmallJsonSmallStringG(self, olds, news, 0); 13025 ck_assert_ptr_ne(r, null); 13026 char *s = toStringO(r); 13027 ck_assert_str_eq(s, "^^ee^^ee^^ad"); 13028 free(s); 13029 terminateO(news); 13030 terminateO(self); 13031 13032 END_TEST 13033 13034 13035 START_TEST(replaceCharSmallStringSmallStringGT) 13036 13037 smallStringt* r; 13038 smallStringt *self = allocG("#ee#ee#ad"); 13039 char olds; 13040 smallStringt *news = allocSmallString(""); 13041 13042 // replace string, multiple character new delimeter 13043 olds = '#'; 13044 setValO(news, "^^"); 13045 r = replaceCharSmallStringSmallStringG(self, olds, news, 0); 13046 ck_assert_ptr_ne(r, null); 13047 char *s = toStringO(r); 13048 ck_assert_str_eq(s, "^^ee^^ee^^ad"); 13049 free(s); 13050 terminateO(news); 13051 terminateO(self); 13052 13053 END_TEST 13054 13055 13056 START_TEST(icReplaceSmallStringGT) 13057 13058 smallStringt* r; 13059 smallStringt *self = allocG("BeebeeBad"); 13060 13061 // replace string, multiple character new delimeter 13062 r = icReplaceSmallStringG(self, "b","^^", 0); 13063 ck_assert_ptr_ne(r, null); 13064 char *s = toStringO(r); 13065 ck_assert_str_eq(s, "^^ee^^ee^^ad"); 13066 free(s); 13067 terminateO(self); 13068 13069 END_TEST 13070 13071 13072 START_TEST(icReplaceCharSSmallStringGT) 13073 13074 smallStringt* r; 13075 smallStringt *self = allocG(""); 13076 13077 // replace string, multiple character new delimeter 13078 setValO(self, "BeebeeBad"); 13079 r = icReplaceCharSSmallStringG(self, 'B',"^^", 0); 13080 ck_assert_ptr_ne(r, null); 13081 char *s = toStringO(r); 13082 ck_assert_str_eq(s, "^^ee^^ee^^ad"); 13083 free(s); 13084 terminateO(self); 13085 13086 END_TEST 13087 13088 13089 START_TEST(icReplaceSCharSmallStringGT) 13090 13091 smallStringt* r; 13092 smallStringt *self = allocG(""); 13093 13094 // replace string, multiple character new delimeter 13095 setValO(self, "BeebeeBad"); 13096 r = icReplaceSCharSmallStringG(self, "b",'^',0); 13097 ck_assert_ptr_ne(r, null); 13098 char *s = toStringO(r); 13099 ck_assert_str_eq(s, "^ee^ee^ad"); 13100 free(s); 13101 terminateO(self); 13102 13103 END_TEST 13104 13105 13106 START_TEST(icReplaceCharCharSmallStringGT) 13107 13108 smallStringt* r; 13109 smallStringt *self = allocG(""); 13110 13111 // replace string, multiple character new delimeter 13112 setValO(self, "beeBeebad"); 13113 r = icReplaceCharCharSmallStringG(self, 'b','^', 0); 13114 ck_assert_ptr_ne(r, null); 13115 char *s = toStringO(r); 13116 ck_assert_str_eq(s, "^ee^ee^ad"); 13117 free(s); 13118 terminateO(self); 13119 13120 END_TEST 13121 13122 13123 START_TEST(icReplaceSmallJsonSmallJsonSmallStringGT) 13124 13125 smallStringt* r; 13126 smallStringt *self = allocG("BeebeeBad"); 13127 smallJsont *olds = allocSmallJson(); 13128 smallJsont *news = allocSmallJson(); 13129 13130 // replace string, multiple character new delimeter 13131 freeO(olds); 13132 freeO(news); 13133 setTopSO(olds, "B"); 13134 setTopSO(news, "^^"); 13135 r = icReplaceSmallJsonSmallJsonSmallStringG(self, olds, news, 0); 13136 ck_assert_ptr_ne(r, null); 13137 char *s = toStringO(r); 13138 ck_assert_str_eq(s, "^^ee^^ee^^ad"); 13139 free(s); 13140 terminateO(olds); 13141 terminateO(news); 13142 terminateO(self); 13143 13144 END_TEST 13145 13146 13147 START_TEST(icReplaceSmallJsonSmallStringSmallStringGT) 13148 13149 smallStringt* r; 13150 smallStringt *self = allocG("BeebeeBad"); 13151 smallJsont *olds = allocSmallJson(); 13152 smallStringt *news = allocSmallString(""); 13153 13154 // replace string, multiple character new delimeter 13155 freeO(olds); 13156 setTopSO(olds, "B"); 13157 setValO(news, "^^"); 13158 r = icReplaceSmallJsonSmallStringSmallStringG(self, olds, news, 0); 13159 ck_assert_ptr_ne(r, null); 13160 char *s = toStringO(r); 13161 ck_assert_str_eq(s, "^^ee^^ee^^ad"); 13162 free(s); 13163 terminateO(olds); 13164 terminateO(news); 13165 terminateO(self); 13166 13167 END_TEST 13168 13169 13170 START_TEST(icReplaceSmallJsonSSmallStringGT) 13171 13172 smallStringt* r; 13173 smallStringt *self = allocG("BeebeeBad"); 13174 smallJsont *olds = allocSmallJson(); 13175 const char *news; 13176 13177 // replace string, multiple character new delimeter 13178 freeO(olds); 13179 setTopSO(olds, "b"); 13180 news = "^^"; 13181 r = icReplaceSmallJsonSSmallStringG(self, olds, news, 0); 13182 ck_assert_ptr_ne(r, null); 13183 char *s = toStringO(r); 13184 ck_assert_str_eq(s, "^^ee^^ee^^ad"); 13185 free(s); 13186 terminateO(olds); 13187 terminateO(self); 13188 13189 END_TEST 13190 13191 13192 START_TEST(icReplaceSmallJsonCharSmallStringGT) 13193 13194 smallStringt* r; 13195 smallStringt *self = allocG("beeBeebad"); 13196 smallJsont *olds = allocSmallJson(); 13197 char news; 13198 13199 // replace string, multiple character new delimeter 13200 freeO(olds); 13201 setTopSO(olds, "B"); 13202 news = '^'; 13203 r = icReplaceSmallJsonCharSmallStringG(self, olds, news, 0); 13204 ck_assert_ptr_ne(r, null); 13205 char *s = toStringO(r); 13206 ck_assert_str_eq(s, "^ee^ee^ad"); 13207 free(s); 13208 terminateO(olds); 13209 terminateO(self); 13210 13211 END_TEST 13212 13213 13214 START_TEST(icReplaceSmallStringSmallJsonSmallStringGT) 13215 13216 smallStringt* r; 13217 smallStringt *self = allocG("BeeBeeBad"); 13218 smallStringt *olds = allocSmallString(""); 13219 smallJsont *news = allocSmallJson(); 13220 13221 // replace string, multiple character new delimeter 13222 freeO(news); 13223 setValO(olds, "b"); 13224 setTopSO(news, "^^"); 13225 r = icReplaceSmallStringSmallJsonSmallStringG(self, olds, news, 0); 13226 ck_assert_ptr_ne(r, null); 13227 char *s = toStringO(r); 13228 ck_assert_str_eq(s, "^^ee^^ee^^ad"); 13229 free(s); 13230 terminateO(olds); 13231 terminateO(news); 13232 terminateO(self); 13233 13234 END_TEST 13235 13236 13237 START_TEST(icReplaceSmallStringSmallStringSmallStringGT) 13238 13239 smallStringt* r; 13240 smallStringt *self = allocG("beebeebad"); 13241 smallStringt *olds = allocSmallString(""); 13242 smallStringt *news = allocSmallString(""); 13243 13244 // replace string, multiple character new delimeter 13245 setValO(olds, "B"); 13246 setValO(news, "^^"); 13247 r = icReplaceSmallStringSmallStringSmallStringG(self, olds, news, 0); 13248 ck_assert_ptr_ne(r, null); 13249 char *s = toStringO(r); 13250 ck_assert_str_eq(s, "^^ee^^ee^^ad"); 13251 free(s); 13252 terminateO(olds); 13253 terminateO(news); 13254 terminateO(self); 13255 13256 END_TEST 13257 13258 13259 START_TEST(icReplaceSmallStringSSmallStringGT) 13260 13261 smallStringt* r; 13262 smallStringt *self = allocG("beebeebad"); 13263 smallStringt *olds = allocSmallString(""); 13264 const char *news; 13265 13266 // replace string, multiple character new delimeter 13267 setValO(olds, "B"); 13268 news = "^^"; 13269 r = icReplaceSmallStringSSmallStringG(self, olds, news, 0); 13270 ck_assert_ptr_ne(r, null); 13271 char *s = toStringO(r); 13272 ck_assert_str_eq(s, "^^ee^^ee^^ad"); 13273 free(s); 13274 terminateO(olds); 13275 terminateO(self); 13276 13277 END_TEST 13278 13279 13280 START_TEST(icReplaceSmallStringCharSmallStringGT) 13281 13282 smallStringt* r; 13283 smallStringt *self = allocG("beebeebad"); 13284 smallStringt *olds = allocSmallString(""); 13285 char news; 13286 13287 // replace string, multiple character new delimeter 13288 setValO(olds, "B"); 13289 news = '^'; 13290 r = icReplaceSmallStringCharSmallStringG(self, olds, news, 0); 13291 ck_assert_ptr_ne(r, null); 13292 char *s = toStringO(r); 13293 ck_assert_str_eq(s, "^ee^ee^ad"); 13294 free(s); 13295 terminateO(olds); 13296 terminateO(self); 13297 13298 END_TEST 13299 13300 13301 START_TEST(icReplaceSSmallJsonSmallStringGT) 13302 13303 smallStringt* r; 13304 smallStringt *self = allocG("beebeebad"); 13305 const char *olds; 13306 smallJsont *news = allocSmallJson(); 13307 13308 // replace string, multiple character new delimeter 13309 freeO(news); 13310 olds = "B"; 13311 setTopSO(news, "^^"); 13312 r = icReplaceSSmallJsonSmallStringG(self, olds, news, 0); 13313 ck_assert_ptr_ne(r, null); 13314 char *s = toStringO(r); 13315 ck_assert_str_eq(s, "^^ee^^ee^^ad"); 13316 free(s); 13317 terminateO(news); 13318 terminateO(self); 13319 13320 END_TEST 13321 13322 13323 START_TEST(icReplaceSSmallStringSmallStringGT) 13324 13325 smallStringt* r; 13326 smallStringt *self = allocG("beebeebad"); 13327 const char *olds; 13328 smallStringt *news = allocSmallString(""); 13329 13330 // replace string, multiple character new delimeter 13331 olds = "B"; 13332 setValO(news, "^^"); 13333 r = icReplaceSSmallStringSmallStringG(self, olds, news, 0); 13334 ck_assert_ptr_ne(r, null); 13335 char *s = toStringO(r); 13336 ck_assert_str_eq(s, "^^ee^^ee^^ad"); 13337 free(s); 13338 terminateO(news); 13339 terminateO(self); 13340 13341 END_TEST 13342 13343 13344 START_TEST(icReplaceCharSmallJsonSmallStringGT) 13345 13346 smallStringt* r; 13347 smallStringt *self = allocG("beebeebad"); 13348 char olds; 13349 smallJsont *news = allocSmallJson(); 13350 13351 // replace string, multiple character new delimeter 13352 freeO(news); 13353 olds = 'B'; 13354 setTopSO(news, "^^"); 13355 r = icReplaceCharSmallJsonSmallStringG(self, olds, news, 0); 13356 ck_assert_ptr_ne(r, null); 13357 char *s = toStringO(r); 13358 ck_assert_str_eq(s, "^^ee^^ee^^ad"); 13359 free(s); 13360 terminateO(news); 13361 terminateO(self); 13362 13363 END_TEST 13364 13365 13366 START_TEST(icReplaceCharSmallStringSmallStringGT) 13367 13368 smallStringt* r; 13369 smallStringt *self = allocG("beebeebad"); 13370 char olds; 13371 smallStringt *news = allocSmallString(""); 13372 13373 // replace string, multiple character new delimeter 13374 olds = 'B'; 13375 setValO(news, "^^"); 13376 r = icReplaceCharSmallStringSmallStringG(self, olds, news, 0); 13377 ck_assert_ptr_ne(r, null); 13378 char *s = toStringO(r); 13379 ck_assert_str_eq(s, "^^ee^^ee^^ad"); 13380 free(s); 13381 terminateO(news); 13382 terminateO(self); 13383 13384 END_TEST 13385 13386 13387 START_TEST(equalSmallStringFGT) 13388 13389 bool r; 13390 smallStringt* self = allocG("qwe"); 13391 smallStringt *string = allocSmallString("qwe"); 13392 13393 r = equalSmallStringFG(self,string); 13394 ck_assert(r); 13395 terminateO(string); 13396 terminateO(self); 13397 13398 END_TEST 13399 13400 13401 START_TEST(equalCharSmallStringGT) 13402 13403 bool r; 13404 smallStringt *self = allocG("q"); 13405 13406 r = equalCharSmallStringG(self,'q'); 13407 ck_assert(r); 13408 terminateO(self); 13409 13410 END_TEST 13411 13412 13413 START_TEST(equalSSmallStringGT) 13414 13415 bool r; 13416 smallStringt *self = allocG("qwe"); 13417 13418 r = equalSSmallStringG(self,"qwe"); 13419 ck_assert(r); 13420 terminateO(self); 13421 13422 END_TEST 13423 13424 13425 START_TEST(equalSmallStringBaseGT) 13426 13427 bool r; 13428 smallStringt *self = allocG("12"); 13429 baset* p2 = (baset*) allocSmallInt(12); 13430 13431 r = equalSmallStringBaseG(self, p2); 13432 ck_assert(r); 13433 terminateO(p2); 13434 terminateO(self); 13435 13436 END_TEST 13437 13438 13439 START_TEST(equalSmallStringBoolGT) 13440 13441 bool r; 13442 smallStringt* self = allocG("true"); 13443 13444 r = equalSmallStringBoolG(self, true); 13445 ck_assert(r); 13446 terminateO(self); 13447 13448 END_TEST 13449 13450 13451 START_TEST(equalSmallStringDoubleGT) 13452 13453 bool r; 13454 smallStringt* self = allocG("2.2"); 13455 13456 r = equalSmallStringDoubleG(self, 2.2); 13457 ck_assert(r); 13458 terminateO(self); 13459 13460 END_TEST 13461 13462 13463 START_TEST(equalSmallStringInt64GT) 13464 13465 bool r; 13466 smallStringt* self = allocG("2"); 13467 13468 r = equalSmallStringInt64G(self, 2); 13469 ck_assert(r); 13470 terminateO(self); 13471 13472 END_TEST 13473 13474 13475 START_TEST(equalSmallStringInt32GT) 13476 13477 bool r; 13478 smallStringt* self = allocG("2"); 13479 13480 r = equalSmallStringInt32G(self, 2); 13481 ck_assert(r); 13482 terminateO(self); 13483 13484 END_TEST 13485 13486 13487 START_TEST(equalSmallStringUint32GT) 13488 13489 bool r; 13490 smallStringt* self = allocG("2"); 13491 13492 r = equalSmallStringUint32G(self, 2); 13493 ck_assert(r); 13494 terminateO(self); 13495 13496 END_TEST 13497 13498 13499 START_TEST(equalSmallStringUint64GT) 13500 13501 bool r; 13502 smallStringt* self = allocG("2"); 13503 13504 r = equalSmallStringUint64G(self, 2); 13505 ck_assert(r); 13506 terminateO(self); 13507 13508 END_TEST 13509 13510 13511 START_TEST(equalSmallStringSmallBoolGT) 13512 13513 bool r; 13514 smallStringt* self = allocG("TRUE"); 13515 smallBoolt* p2 = allocSmallBool(true); 13516 13517 r = equalSmallStringSmallBoolG(self, p2); 13518 ck_assert(r); 13519 terminateO(p2); 13520 terminateO(self); 13521 13522 END_TEST 13523 13524 13525 START_TEST(equalSmallStringSmallBytesGT) 13526 13527 bool r; 13528 smallStringt* self = allocG("qwe"); 13529 smallBytest* p2 = allocSmallBytes("qwe", sizeof("qwe")); 13530 13531 r = equalSmallStringSmallBytesG(self, p2); 13532 ck_assert(r); 13533 terminateO(p2); 13534 terminateO(self); 13535 13536 END_TEST 13537 13538 13539 START_TEST(equalSmallStringSmallDoubleGT) 13540 13541 bool r; 13542 smallStringt* self = allocG("2.2"); 13543 smallDoublet* p2 = allocSmallDouble(2.2); 13544 13545 r = equalSmallStringSmallDoubleG(self, p2); 13546 ck_assert(r); 13547 terminateO(p2); 13548 terminateO(self); 13549 13550 END_TEST 13551 13552 13553 START_TEST(equalSmallStringSmallIntGT) 13554 13555 bool r; 13556 smallStringt* self = allocG("2"); 13557 smallIntt* p2 = allocSmallInt(2); 13558 13559 r = equalSmallStringSmallIntG(self, p2); 13560 ck_assert(r); 13561 terminateO(p2); 13562 terminateO(self); 13563 13564 END_TEST 13565 13566 13567 START_TEST(equalSmallStringSmallJsonGT) 13568 13569 bool r; 13570 smallStringt* self = allocG("qwe"); 13571 smallJsont* p2 = allocSmallJson(); 13572 13573 setTopSO(p2, "qwe"); 13574 r = equalSmallStringSmallJsonG(self, p2); 13575 ck_assert(r); 13576 terminateO(p2); 13577 terminateO(self); 13578 13579 END_TEST 13580 13581 13582 START_TEST(icEqualSmallStringFGT) 13583 13584 bool r; 13585 smallStringt *self = allocG("qwe"); 13586 smallStringt *string = allocSmallString("Qwe"); 13587 13588 r = icEqualSmallStringFG(self,string); 13589 ck_assert(r); 13590 terminateO(string); 13591 terminateO(self); 13592 13593 END_TEST 13594 13595 13596 START_TEST(icEqualCharSmallStringGT) 13597 13598 bool r; 13599 smallStringt *self = allocG("q"); 13600 13601 r = icEqualCharSmallStringG(self,'Q'); 13602 ck_assert(r); 13603 terminateO(self); 13604 13605 END_TEST 13606 13607 13608 START_TEST(icEqualSSmallStringGT) 13609 13610 bool r; 13611 smallStringt *self = allocG("qwe"); 13612 13613 r = icEqualSSmallStringG(self, "Qwe"); 13614 ck_assert(r); 13615 terminateO(self); 13616 13617 END_TEST 13618 13619 13620 START_TEST(icEqualSmallStringBaseGT) 13621 13622 bool r; 13623 smallStringt* self = allocG("qwe"); 13624 baset* p2 = (baset*) allocSmallString("QWE"); 13625 13626 r = icEqualSmallStringBaseG(self, p2); 13627 ck_assert(r); 13628 terminateO(p2); 13629 terminateO(self); 13630 13631 END_TEST 13632 13633 13634 START_TEST(icEqualSmallStringSmallJsonGT) 13635 13636 bool r; 13637 smallStringt* self = allocG("qwe"); 13638 smallJsont* p2 = allocSmallJson(); 13639 13640 setTopSO(p2, "Qwe"); 13641 r = icEqualSmallStringSmallJsonG(self, p2); 13642 ck_assert(r); 13643 terminateO(p2); 13644 terminateO(self); 13645 13646 END_TEST 13647 13648 13649 START_TEST(equalISSmallStringGT) 13650 13651 smallStringt *self = allocG("Ashee|"); 13652 13653 ck_assert(equalISSmallStringG(self, "shee", 1)); 13654 terminateO(self); 13655 13656 END_TEST 13657 13658 13659 START_TEST(equalICharSmallStringGT) 13660 13661 smallStringt *self = allocG("Ashee"); 13662 13663 ck_assert(equalICharSmallStringG(self, 's', 1)); 13664 terminateO(self); 13665 13666 END_TEST 13667 13668 13669 START_TEST(equalISmallJsonSmallStringGT) 13670 13671 smallStringt *self = allocG("Ashee|"); 13672 smallJsont *string = allocSmallJson(); 13673 13674 setTopSO(string, "shee"); 13675 ck_assert(equalISmallJsonSmallStringG(self, string, 1)); 13676 terminateO(string); 13677 terminateO(self); 13678 13679 END_TEST 13680 13681 13682 START_TEST(equalISmallStringSmallStringGT) 13683 13684 smallStringt *self = allocG("Ashee|"); 13685 smallStringt *string = allocSmallString("shee"); 13686 13687 ck_assert(equalISmallStringSmallStringG(self, string, 1)); 13688 terminateO(string); 13689 terminateO(self); 13690 13691 END_TEST 13692 13693 13694 START_TEST(startsWithSSmallStringGT) 13695 13696 smallStringt *self = allocG("sheepy"); 13697 13698 ck_assert(startsWithSSmallStringG(self, "shee")); 13699 terminateO(self); 13700 13701 END_TEST 13702 13703 13704 START_TEST(startsWithCharSmallStringGT) 13705 13706 smallStringt *self = allocG("shee"); 13707 13708 ck_assert(startsWithCharSmallStringG(self, 's')); 13709 terminateO(self); 13710 13711 END_TEST 13712 13713 13714 START_TEST(startsWithSmallJsonSmallStringGT) 13715 13716 smallStringt *self = allocG("sheepy"); 13717 smallJsont *string = allocSmallJson(); 13718 13719 setTopSO(string, "shee"); 13720 ck_assert(startsWithSmallJsonSmallStringG(self, string)); 13721 terminateO(string); 13722 terminateO(self); 13723 13724 END_TEST 13725 13726 13727 START_TEST(startsWithSmallStringSmallStringGT) 13728 13729 smallStringt *self = allocG("sheepy"); 13730 smallStringt *string = allocSmallString("shee"); 13731 13732 ck_assert(startsWithSmallStringSmallStringG(self, string)); 13733 terminateO(string); 13734 terminateO(self); 13735 13736 END_TEST 13737 13738 13739 START_TEST(endsWithSSmallStringGT) 13740 13741 smallStringt *self = allocG("sheepy"); 13742 13743 ck_assert(endsWithSSmallStringG(self, "eepy")); 13744 terminateO(self); 13745 13746 END_TEST 13747 13748 13749 START_TEST(endsWithCharSmallStringGT) 13750 13751 smallStringt *self = allocG("sheepy"); 13752 13753 ck_assert(endsWithCharSmallStringG(self, 'y')); 13754 terminateO(self); 13755 13756 END_TEST 13757 13758 13759 START_TEST(endsWithSmallJsonSmallStringGT) 13760 13761 smallStringt *self = allocG("shee"); 13762 smallJsont *string = allocSmallJson(); 13763 13764 setValO(self, "sheepy"); 13765 setTopSO(string, "eepy"); 13766 ck_assert(endsWithSmallJsonSmallStringG(self, string)); 13767 terminateO(string); 13768 terminateO(self); 13769 13770 END_TEST 13771 13772 13773 START_TEST(endsWithSmallStringSmallStringGT) 13774 13775 smallStringt *self = allocG("sheepy"); 13776 smallStringt *string = allocSmallString("eepy"); 13777 13778 ck_assert(endsWithSmallStringSmallStringG(self, string)); 13779 terminateO(string); 13780 terminateO(self); 13781 13782 END_TEST 13783 13784 13785 START_TEST(countSSmallStringGT) 13786 13787 smallStringt *self = allocG("sheepy"); 13788 13789 // positive count 13790 ck_assert_int_eq(countSSmallStringG(self, "shee"), 1); 13791 terminateO(self); 13792 13793 END_TEST 13794 13795 13796 START_TEST(countCharSmallStringGT) 13797 13798 smallStringt *self = allocG("shee"); 13799 13800 // positive count 13801 ck_assert_int_eq(countCharSmallStringG(self, 's'), 1); 13802 terminateO(self); 13803 13804 END_TEST 13805 13806 13807 START_TEST(countSmallJsonSmallStringGT) 13808 13809 smallStringt *self = allocG("sheepy"); 13810 smallJsont *string = allocSmallJson(); 13811 13812 // positive count 13813 setTopSO(string, "shee"); 13814 ck_assert_int_eq(countSmallJsonSmallStringG(self, string), 1); 13815 terminateO(string); 13816 terminateO(self); 13817 13818 END_TEST 13819 13820 13821 START_TEST(countSmallStringSmallStringGT) 13822 13823 smallStringt *self = allocG("sheepy"); 13824 smallStringt *string = allocSmallString("shee"); 13825 13826 ck_assert_int_eq(countSmallStringSmallStringG(self, string), 1); 13827 terminateO(string); 13828 terminateO(self); 13829 13830 END_TEST 13831 13832 13833 START_TEST(icStartsWithSSmallStringGT) 13834 13835 smallStringt *self = allocG("sheepy"); 13836 13837 ck_assert(icStartsWithSSmallStringG(self, "shee")); 13838 terminateO(self); 13839 13840 END_TEST 13841 13842 13843 START_TEST(icStartsWithCharSmallStringGT) 13844 13845 smallStringt *self = allocG("shee"); 13846 13847 ck_assert(icStartsWithCharSmallStringG(self, 'S')); 13848 terminateO(self); 13849 13850 END_TEST 13851 13852 13853 START_TEST(icStartsWithSmallJsonSmallStringGT) 13854 13855 smallStringt *self = allocG("sheepy"); 13856 smallJsont *string = allocSmallJson(); 13857 13858 setTopSO(string, "shee"); 13859 ck_assert(icStartsWithSmallJsonSmallStringG(self, string)); 13860 terminateO(string); 13861 terminateO(self); 13862 13863 END_TEST 13864 13865 13866 START_TEST(icStartsWithSmallStringSmallStringGT) 13867 13868 smallStringt *self = allocG("sheepy"); 13869 smallStringt *string = allocSmallString("shee"); 13870 13871 ck_assert(icStartsWithSmallStringSmallStringG(self, string)); 13872 terminateO(string); 13873 terminateO(self); 13874 13875 END_TEST 13876 13877 13878 START_TEST(icEndsWithSSmallStringGT) 13879 13880 smallStringt *self = allocG("sheepy"); 13881 13882 ck_assert(icEndsWithSSmallStringG(self, "EEPY")); 13883 terminateO(self); 13884 13885 END_TEST 13886 13887 13888 START_TEST(icEndsWithCharSmallStringGT) 13889 13890 smallStringt *self = allocG("shee"); 13891 13892 ck_assert(icEndsWithCharSmallStringG(self, 'e')); 13893 terminateO(self); 13894 13895 END_TEST 13896 13897 13898 START_TEST(icEndsWithSmallJsonSmallStringGT) 13899 13900 smallStringt *self = allocG("sheepy"); 13901 smallJsont *string = allocSmallJson(); 13902 13903 setTopSO(string, "EEPY"); 13904 ck_assert(icEndsWithSmallJsonSmallStringG(self, string)); 13905 terminateO(string); 13906 terminateO(self); 13907 13908 END_TEST 13909 13910 13911 START_TEST(icEndsWithSmallStringSmallStringGT) 13912 13913 smallStringt *self = allocG("sheepy"); 13914 smallStringt *string = allocSmallString("EEPY"); 13915 13916 ck_assert(icEndsWithSmallStringSmallStringG(self, string)); 13917 terminateO(string); 13918 terminateO(self); 13919 13920 END_TEST 13921 13922 13923 START_TEST(icCountSSmallStringGT) 13924 13925 smallStringt *self = allocG("sheepy"); 13926 13927 // positive count 13928 ck_assert_int_eq(icCountSSmallStringG(self, "Shee"), 1); 13929 terminateO(self); 13930 13931 END_TEST 13932 13933 13934 START_TEST(icCountCharSmallStringGT) 13935 13936 smallStringt *self = allocG("shee"); 13937 13938 // positive count 13939 ck_assert_int_eq(icCountCharSmallStringG(self, 'S'), 1); 13940 terminateO(self); 13941 13942 END_TEST 13943 13944 13945 START_TEST(icCountSmallJsonSmallStringGT) 13946 13947 smallStringt *self = allocG("sheepy"); 13948 smallJsont *string = allocSmallJson(); 13949 13950 // positive count 13951 setTopSO(string, "Shee"); 13952 ck_assert_int_eq(icCountSmallJsonSmallStringG(self, string), 1); 13953 terminateO(string); 13954 terminateO(self); 13955 13956 END_TEST 13957 13958 13959 START_TEST(icCountSmallStringSmallStringGT) 13960 13961 smallStringt *self = allocG("sheepy"); 13962 smallStringt *string = allocSmallString("shee"); 13963 13964 // positive count 13965 ck_assert_int_eq(icCountSmallStringSmallStringG(self, string), 1); 13966 terminateO(string); 13967 terminateO(self); 13968 13969 END_TEST 13970 13971 13972 START_TEST(isNumberSmallStringGT) 13973 13974 smallStringt *self = allocG(""); 13975 13976 setValO(self, "-12.3"); 13977 ck_assert(isNumberSmallStringG(self)); 13978 terminateO(self); 13979 13980 END_TEST 13981 13982 13983 START_TEST(isIntSmallStringGT) 13984 13985 smallStringt *self = allocG(""); 13986 13987 setValO(self, "-123"); 13988 ck_assert(isIntSmallStringG(self)); 13989 terminateO(self); 13990 13991 END_TEST 13992 13993 13994 START_TEST(parseIntSmallStringGT) 13995 13996 smallStringt *self = allocG("123asd"); 13997 13998 ck_assert_int_eq(parseIntSmallStringG(self), 123); 13999 terminateO(self); 14000 14001 END_TEST 14002 14003 14004 START_TEST(intToSmallStringGT) 14005 14006 smallStringt* r; 14007 smallStringt *self = allocG(""); 14008 14009 r = intToSmallStringG(self, 123); 14010 ck_assert_ptr_ne(r, null); 14011 char *s = toStringO(r); 14012 ck_assert_str_eq(s, "123"); 14013 free(s); 14014 terminateO(self); 14015 14016 END_TEST 14017 14018 14019 START_TEST(parseDoubleSmallStringGT) 14020 14021 smallStringt *self = allocG("123.2sheepy"); 14022 14023 ck_assert(parseDoubleSmallStringG(self) == 123.2); 14024 terminateO(self); 14025 14026 END_TEST 14027 14028 14029 START_TEST(doubleToSmallStringGT) 14030 14031 smallStringt* r; 14032 smallStringt *self = allocG(""); 14033 14034 r = doubleToSmallStringG(self, 123.4); 14035 ck_assert_ptr_ne(r, null); 14036 char *s = toStringO(r); 14037 ck_assert_str_eq(s, "1.234000e+02"); 14038 free(s); 14039 terminateO(self); 14040 14041 END_TEST 14042 14043 14044 START_TEST(lenSmallStringGT) 14045 14046 size_t r; 14047 smallStringt *self = allocG("123"); 14048 14049 r = lenSmallStringG(self); 14050 ck_assert_int_eq(r, 3); 14051 terminateO(self); 14052 14053 END_TEST 14054 14055 14056 START_TEST(upperSmallStringGT) 14057 14058 smallStringt* r; 14059 smallStringt *self = allocG("sheepy"); 14060 14061 r = upperSmallStringG(self); 14062 ck_assert_ptr_ne(r, null); 14063 char *s = toStringO(r); 14064 ck_assert_str_eq(s, "SHEEPY"); 14065 free(s); 14066 terminateO(self); 14067 14068 END_TEST 14069 14070 14071 START_TEST(lowerSmallStringGT) 14072 14073 smallStringt* r; 14074 smallStringt *self = allocG("SHeePY"); 14075 14076 r = lowerSmallStringG(self); 14077 ck_assert_ptr_ne(r, null); 14078 char *s = toStringO(r); 14079 ck_assert_str_eq(s, "sheepy"); 14080 free(s); 14081 terminateO(self); 14082 14083 END_TEST 14084 14085 14086 START_TEST(trimSmallStringGT) 14087 14088 smallStringt* r; 14089 smallStringt *self = allocG(" SHeePY"); 14090 14091 r = trimSmallStringG(self); 14092 ck_assert_ptr_ne(r, null); 14093 char *s = toStringO(r); 14094 ck_assert_str_eq(s, "SHeePY"); 14095 free(s); 14096 terminateO(self); 14097 14098 END_TEST 14099 14100 14101 START_TEST(lTrimSmallStringGT) 14102 14103 smallStringt* r; 14104 smallStringt *self = allocG(" SHeePY "); 14105 14106 r = lTrimSmallStringG(self); 14107 ck_assert_ptr_ne(r, null); 14108 char *s = toStringO(r); 14109 ck_assert_str_eq(s, "SHeePY "); 14110 free(s); 14111 terminateO(self); 14112 14113 END_TEST 14114 14115 14116 START_TEST(rTrimSmallStringGT) 14117 14118 smallStringt* r; 14119 smallStringt *self = allocG(" SHeePY "); 14120 14121 r = rTrimSmallStringG(self); 14122 ck_assert_ptr_ne(r, null); 14123 char *s = toStringO(r); 14124 ck_assert_str_eq(s, " SHeePY"); 14125 free(s); 14126 terminateO(self); 14127 14128 END_TEST 14129 14130 14131 START_TEST(uniqSmallStringGT) 14132 14133 smallStringt* r; 14134 smallStringt *self = allocG("/qwd///"); 14135 14136 r = uniqSmallStringG(self, '/'); 14137 ck_assert_ptr_ne(r, null); 14138 char *s = toStringO(r); 14139 ck_assert_str_eq(s, "/qwd/"); 14140 free(s); 14141 terminateO(self); 14142 14143 END_TEST 14144 14145 14146 START_TEST(icUniqSmallStringGT) 14147 14148 smallStringt* r; 14149 smallStringt *self = allocG("/qQwd///"); 14150 14151 r = icUniqSmallStringG(self, 'q'); 14152 ck_assert_ptr_ne(r, null); 14153 char *s = toStringO(r); 14154 ck_assert_str_eq(s, "/qwd///"); 14155 free(s); 14156 terminateO(self); 14157 14158 END_TEST 14159 14160 14161 START_TEST(sliceSmallStringGT) 14162 14163 smallStringt* r; 14164 smallStringt *self = allocG("sheepy"); 14165 14166 r = sliceSmallStringG(self, 0,2); 14167 ck_assert_ptr_ne(r, null); 14168 ck_assert_str_eq(ssGet(self), "sh"); 14169 terminateO(self); 14170 14171 END_TEST 14172 14173 14174 START_TEST(cropSmallStringGT) 14175 14176 smallStringt* r; 14177 smallStringt *self = allocG("sheepy"); 14178 14179 r = cropSmallStringG(self, 0,2); 14180 ck_assert_ptr_ne(r, null); 14181 ck_assert_str_eq(ssGet(r), "sh"); 14182 ck_assert_str_eq(ssGet(self), "eepy"); 14183 terminateO(r); 14184 terminateO(self); 14185 14186 END_TEST 14187 14188 14189 START_TEST(cropSSmallStringGT) 14190 14191 char* s; 14192 smallStringt *self = allocG("sheepy"); 14193 14194 s = cropSSmallStringG(self, 0,2); 14195 ck_assert_str_eq(s, "sh"); 14196 ck_assert_str_eq(ssGet(self), "eepy"); 14197 free(s); 14198 terminateO(self); 14199 14200 END_TEST 14201 14202 14203 START_TEST(cropSmallJsonSmallStringGT) 14204 14205 smallJsont* r; 14206 smallStringt *self = allocG("sheepy"); 14207 14208 r = cropSmallJsonSmallStringG(self, 0,2); 14209 ck_assert_ptr_ne(r, null); 14210 ck_assert_str_eq(sjGet(r), "sh"); 14211 ck_assert_str_eq(ssGet(self), "eepy"); 14212 terminateO(r); 14213 terminateO(self); 14214 14215 END_TEST 14216 14217 14218 START_TEST(cropElemSmallStringGT) 14219 14220 char r; 14221 smallStringt *self = allocG("sheepy"); 14222 14223 r = cropElemSmallStringG(self, 0); 14224 ck_assert_int_eq(r, 's'); 14225 ck_assert_str_eq(ssGet(self), "heepy"); 14226 terminateO(self); 14227 14228 END_TEST 14229 14230 14231 START_TEST(copySmallStringGT) 14232 14233 smallStringt* r; 14234 smallStringt *self = allocG("sheepy"); 14235 14236 r = copySmallStringG(self, 0,2); 14237 ck_assert_ptr_ne(r, null); 14238 ck_assert_str_eq(ssGet(r), "sh"); 14239 ck_assert_str_eq(ssGet(self), "sheepy"); 14240 terminateO(r); 14241 terminateO(self); 14242 14243 END_TEST 14244 14245 14246 START_TEST(insertSmallStringGT) 14247 14248 smallStringt* r; 14249 smallStringt *self = allocG("sheepy"); 14250 smallStringt *toInsert = allocSmallString("lib"); 14251 14252 r = insertSmallStringG(self, 0, toInsert); 14253 ck_assert_ptr_ne(r, null); 14254 char *s = toStringO(r); 14255 ck_assert_str_eq(s, "libsheepy"); 14256 free(s); 14257 terminateO(toInsert); 14258 terminateO(self); 14259 14260 END_TEST 14261 14262 14263 START_TEST(insertSmallJsonSmallStringGT) 14264 14265 smallStringt* r; 14266 smallStringt *self = allocG("sheepy"); 14267 smallJsont *toInsert = allocSmallJson(); 14268 14269 setTopSO(toInsert, "lib"); 14270 r = insertSmallJsonSmallStringG(self, 0, toInsert); 14271 ck_assert_ptr_ne(r, null); 14272 char *s = toStringO(r); 14273 ck_assert_str_eq(s, "libsheepy"); 14274 free(s); 14275 terminateO(toInsert); 14276 terminateO(self); 14277 14278 END_TEST 14279 14280 14281 START_TEST(insertSSmallStringGT) 14282 14283 smallStringt* r; 14284 smallStringt *self = allocG("sheepy"); 14285 14286 r = insertSSmallStringG(self, 0, "lib"); 14287 ck_assert_ptr_ne(r, null); 14288 char *s = toStringO(r); 14289 ck_assert_str_eq(s, "libsheepy"); 14290 free(s); 14291 terminateO(self); 14292 14293 END_TEST 14294 14295 14296 START_TEST(insertNFreeSmallStringGT) 14297 14298 smallStringt* r; 14299 smallStringt *self = allocG(""); 14300 smallStringt *toInsert = allocSmallString(""); 14301 14302 setValO(self, "sheepy"); 14303 setValO(toInsert, "lib"); 14304 r = insertNFreeSmallStringG(self, 0, toInsert); 14305 ck_assert_ptr_ne(r, null); 14306 char *s = toStringO(r); 14307 ck_assert_str_eq(s, "libsheepy"); 14308 free(s); 14309 terminateO(self); 14310 14311 END_TEST 14312 14313 14314 START_TEST(insertNFreeSmallJsonSmallStringGT) 14315 14316 smallStringt* r; 14317 smallStringt *self = allocG(""); 14318 smallJsont *toInsert = allocSmallJson(); 14319 14320 setValO(self, "sheepy"); 14321 setTopSO(toInsert, "lib"); 14322 r = insertNFreeSmallJsonSmallStringG(self, 0, toInsert); 14323 ck_assert_ptr_ne(r, null); 14324 char *s = toStringO(r); 14325 ck_assert_str_eq(s, "libsheepy"); 14326 free(s); 14327 terminateO(self); 14328 14329 END_TEST 14330 14331 14332 START_TEST(insertSNFreeSmallStringGT) 14333 14334 smallStringt* r; 14335 smallStringt *self = allocG(""); 14336 14337 setValO(self, "sheepy"); 14338 r = insertSNFreeSmallStringG(self, 0, strdup("lib")); 14339 ck_assert_ptr_ne(r, null); 14340 char *s = toStringO(r); 14341 ck_assert_str_eq(s, "libsheepy"); 14342 free(s); 14343 terminateO(self); 14344 14345 END_TEST 14346 14347 14348 START_TEST(injectSmallStringGT) 14349 14350 smallStringt* r; 14351 smallStringt *self = allocG(""); 14352 14353 setValO(self, "sheepy"); 14354 r = injectSmallStringG(self, 0, 'L'); 14355 ck_assert_ptr_ne(r, null); 14356 char *s = toStringO(r); 14357 ck_assert_str_eq(s, "Lsheepy"); 14358 free(s); 14359 terminateO(self); 14360 14361 END_TEST 14362 14363 14364 START_TEST(delSmallStringGT) 14365 14366 smallStringt* r; 14367 smallStringt *self = allocG(""); 14368 14369 setValO(self, "sheepy"); 14370 r = delSmallStringG(self, 0,2); 14371 ck_assert_ptr_ne(r, null); 14372 char *s = toStringO(r); 14373 ck_assert_str_eq(s, "eepy"); 14374 free(s); 14375 terminateO(self); 14376 14377 END_TEST 14378 14379 14380 START_TEST(delElemSmallStringGT) 14381 14382 smallStringt* r; 14383 smallStringt *self = allocG(""); 14384 14385 setValO(self, "sheepy"); 14386 r = delElemSmallStringG(self, 0); 14387 ck_assert_ptr_ne(r, null); 14388 char *s = toStringO(r); 14389 ck_assert_str_eq(s, "heepy"); 14390 free(s); 14391 terminateO(self); 14392 14393 END_TEST 14394 14395 14396 START_TEST(hasSmallStringGT) 14397 14398 smallStringt *self = allocG(""); 14399 14400 setValO(self, "sheepy"); 14401 ck_assert_str_eq(hasSmallStringG(self, "ee"), "eepy"); 14402 terminateO(self); 14403 14404 END_TEST 14405 14406 14407 START_TEST(hasCharSmallStringGT) 14408 14409 smallStringt *self = allocG(""); 14410 14411 setValO(self, "sheepy"); 14412 ck_assert_str_eq(hasCharSmallStringG(self, 'e'), "eepy"); 14413 terminateO(self); 14414 14415 END_TEST 14416 14417 14418 START_TEST(hasSmallJsonSmallStringGT) 14419 14420 smallStringt *self = allocG(""); 14421 smallJsont *needle = allocSmallJson(); 14422 14423 // find string in the middle 14424 setValO(self, "sheepy"); 14425 setTopSO(needle, "ee"); 14426 ck_assert_str_eq(hasSmallJsonSmallStringG(self, needle), "eepy"); 14427 terminateO(needle); 14428 terminateO(self); 14429 14430 END_TEST 14431 14432 14433 START_TEST(hasSmallStringSmallStringGT) 14434 14435 smallStringt *self = allocG(""); 14436 smallStringt *needle = allocSmallString("ee"); 14437 14438 // find string in the middle 14439 setValO(self, "sheepy"); 14440 ck_assert_str_eq(hasSmallStringSmallStringG(self, needle), "eepy"); 14441 terminateO(needle); 14442 terminateO(self); 14443 14444 END_TEST 14445 14446 14447 START_TEST(findSmallStringGT) 14448 14449 smallStringt* r; 14450 smallStringt *self = allocG(""); 14451 14452 setValO(self, "sheepy"); 14453 r = findSmallStringG(self, "ee"); 14454 ck_assert_ptr_ne(r, null); 14455 ck_assert_str_eq(ssGet(r), "eepy"); 14456 terminateO(r); 14457 terminateO(self); 14458 14459 END_TEST 14460 14461 14462 START_TEST(findCharSmallStringGT) 14463 14464 smallStringt* r; 14465 smallStringt *self = allocG(""); 14466 14467 setValO(self, "sheepy"); 14468 r = findCharSmallStringG(self, 'e'); 14469 ck_assert_ptr_ne(r, null); 14470 ck_assert_str_eq(ssGet(r), "eepy"); 14471 terminateO(r); 14472 terminateO(self); 14473 14474 END_TEST 14475 14476 14477 START_TEST(findSmallJsonSmallStringGT) 14478 14479 smallStringt* r; 14480 smallStringt *self = allocG(""); 14481 smallJsont *needle = allocSmallJson(); 14482 14483 // find string in the middle 14484 setValO(self, "sheepy"); 14485 setTopSO(needle, "ee"); 14486 r = findSmallJsonSmallStringG(self, needle); 14487 ck_assert_ptr_ne(r, null); 14488 ck_assert_str_eq(ssGet(r), "eepy"); 14489 terminateO(r); 14490 terminateO(needle); 14491 terminateO(self); 14492 14493 END_TEST 14494 14495 14496 START_TEST(findSmallStringSmallStringGT) 14497 14498 smallStringt* r; 14499 smallStringt *self = allocG(""); 14500 smallStringt *needle = allocSmallString("ee"); 14501 14502 // find string in the middle 14503 setValO(self, "sheepy"); 14504 r = findSmallStringSmallStringG(self, needle); 14505 ck_assert_ptr_ne(r, null); 14506 ck_assert_str_eq(ssGet(r), "eepy"); 14507 terminateO(r); 14508 terminateO(needle); 14509 terminateO(self); 14510 14511 END_TEST 14512 14513 14514 START_TEST(indexOfSmallStringGT) 14515 14516 smallStringt *self = allocG(""); 14517 14518 setValO(self, "sheepy"); 14519 ck_assert_int_eq(indexOfSmallStringG(self, "ee"), 2); 14520 terminateO(self); 14521 14522 END_TEST 14523 14524 14525 START_TEST(indexOfCharSmallStringGT) 14526 14527 smallStringt *self = allocG(""); 14528 14529 setValO(self, "sheepy"); 14530 ck_assert_int_eq(indexOfCharSmallStringG(self, 'e'), 2); 14531 terminateO(self); 14532 14533 END_TEST 14534 14535 14536 START_TEST(indexOfSmallJsonSmallStringGT) 14537 14538 smallStringt *self = allocG(""); 14539 smallJsont *needle = allocSmallJson(); 14540 14541 // indexOf string in the middle 14542 setValO(self, "sheepy"); 14543 setTopSO(needle, "ee"); 14544 ck_assert_int_eq(indexOfSmallJsonSmallStringG(self, needle), 2); 14545 terminateO(needle); 14546 terminateO(self); 14547 14548 END_TEST 14549 14550 14551 START_TEST(indexOfSmallStringSmallStringGT) 14552 14553 smallStringt *self = allocG(""); 14554 smallStringt *needle = allocSmallString("ee"); 14555 14556 // indexOf string in the middle 14557 setValO(self, "sheepy"); 14558 ck_assert_int_eq(indexOfSmallStringSmallStringG(self, needle), 2); 14559 terminateO(needle); 14560 terminateO(self); 14561 14562 END_TEST 14563 14564 14565 START_TEST(icHasSmallStringGT) 14566 14567 smallStringt *self = allocG(""); 14568 14569 setValO(self, "sheepy"); 14570 ck_assert_str_eq(icHasSmallStringG(self, "EE"), "eepy"); 14571 terminateO(self); 14572 14573 END_TEST 14574 14575 14576 START_TEST(icHasCharSmallStringGT) 14577 14578 smallStringt *self = allocG(""); 14579 14580 setValO(self, "sheepy"); 14581 ck_assert_str_eq(icHasCharSmallStringG(self, 'E'), "eepy"); 14582 terminateO(self); 14583 14584 END_TEST 14585 14586 14587 START_TEST(icHasSmallJsonSmallStringGT) 14588 14589 smallStringt *self = allocG(""); 14590 smallJsont *needle = allocSmallJson(); 14591 14592 // find string in the middle 14593 setValO(self, "sheepy"); 14594 setTopSO(needle, "EE"); 14595 ck_assert_str_eq(icHasSmallJsonSmallStringG(self, needle), "eepy"); 14596 terminateO(needle); 14597 terminateO(self); 14598 14599 END_TEST 14600 14601 14602 START_TEST(icHasSmallStringSmallStringGT) 14603 14604 smallStringt *self = allocG(""); 14605 smallStringt *needle = allocSmallString("EE"); 14606 14607 // find string in the middle 14608 setValO(self, "sheepy"); 14609 ck_assert_str_eq(icHasSmallStringSmallStringG(self, needle), "eepy"); 14610 terminateO(needle); 14611 terminateO(self); 14612 14613 END_TEST 14614 14615 14616 START_TEST(icFindSmallStringGT) 14617 14618 smallStringt* r; 14619 smallStringt *self = allocG(""); 14620 14621 setValO(self, "sheepy"); 14622 r = icFindSmallStringG(self, "EE"); 14623 ck_assert_ptr_ne(r, null); 14624 ck_assert_str_eq(ssGet(r), "eepy"); 14625 terminateO(r); 14626 terminateO(self); 14627 14628 END_TEST 14629 14630 14631 START_TEST(icFindCharSmallStringGT) 14632 14633 smallStringt* r; 14634 smallStringt *self = allocG(""); 14635 14636 setValO(self, "sheepy"); 14637 r = icFindCharSmallStringG(self, 'E'); 14638 ck_assert_ptr_ne(r, null); 14639 ck_assert_str_eq(ssGet(r), "eepy"); 14640 terminateO(r); 14641 terminateO(self); 14642 14643 END_TEST 14644 14645 14646 START_TEST(icFindSmallJsonSmallStringGT) 14647 14648 smallStringt* r; 14649 smallStringt *self = allocG(""); 14650 smallJsont *needle = allocSmallJson(); 14651 14652 // find string in the middle 14653 setValO(self, "sheepy"); 14654 setTopSO(needle, "EE"); 14655 r = icFindSmallJsonSmallStringG(self, needle); 14656 ck_assert_ptr_ne(r, null); 14657 ck_assert_str_eq(ssGet(r), "eepy"); 14658 terminateO(r); 14659 terminateO(needle); 14660 terminateO(self); 14661 14662 END_TEST 14663 14664 14665 START_TEST(icFindSmallStringSmallStringGT) 14666 14667 smallStringt* r; 14668 smallStringt *self = allocG(""); 14669 smallStringt *needle = allocSmallString("EE"); 14670 14671 // find string in the middle 14672 setValO(self, "sheepy"); 14673 r = icFindSmallStringSmallStringG(self, needle); 14674 ck_assert_ptr_ne(r, null); 14675 ck_assert_str_eq(ssGet(r), "eepy"); 14676 terminateO(r); 14677 terminateO(needle); 14678 terminateO(self); 14679 14680 END_TEST 14681 14682 14683 START_TEST(icIndexOfSmallStringGT) 14684 14685 smallStringt *self = allocG(""); 14686 14687 setValO(self, "sheepy"); 14688 ck_assert_int_eq(icIndexOfSmallStringG(self, "EE"), 2); 14689 terminateO(self); 14690 14691 END_TEST 14692 14693 14694 START_TEST(icIndexOfCharSmallStringGT) 14695 14696 smallStringt *self = allocG(""); 14697 14698 setValO(self, "sheepy"); 14699 ck_assert_int_eq(icIndexOfCharSmallStringG(self, 'E'), 2); 14700 terminateO(self); 14701 14702 END_TEST 14703 14704 14705 START_TEST(icIndexOfSmallJsonSmallStringGT) 14706 14707 smallStringt *self = allocG(""); 14708 smallJsont *needle = allocSmallJson(); 14709 14710 // indexOf string in the middle 14711 setValO(self, "sheepy"); 14712 setTopSO(needle, "EE"); 14713 ck_assert_int_eq(icIndexOfSmallJsonSmallStringG(self, needle), 2); 14714 terminateO(needle); 14715 terminateO(self); 14716 14717 END_TEST 14718 14719 14720 START_TEST(icIndexOfSmallStringSmallStringGT) 14721 14722 smallStringt *self = allocG(""); 14723 smallStringt *needle = allocSmallString("EE"); 14724 14725 // indexOf string in the middle 14726 setValO(self, "sheepy"); 14727 ck_assert_int_eq(icIndexOfSmallStringSmallStringG(self, needle), 2); 14728 terminateO(needle); 14729 terminateO(self); 14730 14731 END_TEST 14732 14733 14734 START_TEST(emptySmallStringGT) 14735 14736 smallStringt* r; 14737 smallStringt *self = allocG("qwe"); 14738 14739 r = emptySmallStringG(self); 14740 ck_assert_ptr_ne(r, null); 14741 char *s = toStringO(r); 14742 ck_assert_str_eq(s, ""); 14743 free(s); 14744 terminateO(self); 14745 14746 END_TEST 14747 14748 14749 START_TEST(isEmptySmallStringGT) 14750 14751 smallStringt *self = allocG("qwe"); 14752 14753 ck_assert(!isEmptySmallStringG(self)); 14754 terminateO(self); 14755 14756 END_TEST 14757 14758 14759 START_TEST(isBlankSmallStringGT) 14760 14761 smallStringt *self = allocG(""); 14762 14763 setValO(self, " "); 14764 ck_assert(isBlankSmallStringG(self)); 14765 terminateO(self); 14766 14767 END_TEST 14768 14769 14770 START_TEST(splitSmallStringGT) 14771 14772 smallArrayt* r; 14773 smallStringt *self = allocG(""); 14774 14775 setValO(self, "one/two"); 14776 r = splitSmallStringG(self, "/"); 14777 ck_assert_ptr_ne(r, null); 14778 char *s = toStringO(r); 14779 ck_assert_str_eq(s, "[\"one\",\"two\"]"); 14780 free(s); 14781 terminateO(r); 14782 terminateO(self); 14783 14784 END_TEST 14785 14786 14787 START_TEST(splitCharSmallStringGT) 14788 14789 smallArrayt* r; 14790 smallStringt *self = allocG(""); 14791 14792 setValO(self, "one/two"); 14793 r = splitCharSmallStringG(self, '/'); 14794 ck_assert_ptr_ne(r, null); 14795 char *s = toStringO(r); 14796 ck_assert_str_eq(s, "[\"one\",\"two\"]"); 14797 free(s); 14798 terminateO(r); 14799 terminateO(self); 14800 14801 END_TEST 14802 14803 14804 START_TEST(splitSmallJsonSmallStringGT) 14805 14806 smallArrayt* r; 14807 smallStringt *self = allocG(""); 14808 smallJsont *delim = allocSmallJson(); 14809 14810 // string 14811 setValO(self, "one/two"); 14812 setTopSO(delim, "/"); 14813 r = splitSmallJsonSmallStringG(self, delim); 14814 ck_assert_ptr_ne(r, null); 14815 char *s = toStringO(r); 14816 ck_assert_str_eq(s, "[\"one\",\"two\"]"); 14817 free(s); 14818 terminateO(r); 14819 terminateO(delim); 14820 terminateO(self); 14821 14822 END_TEST 14823 14824 14825 START_TEST(splitSmallStringSmallStringGT) 14826 14827 smallArrayt* r; 14828 smallStringt *self = allocG(""); 14829 smallStringt *delim = allocSmallString("/"); 14830 14831 // string 14832 setValO(self, "one/two"); 14833 r = splitSmallStringSmallStringG(self, delim); 14834 ck_assert_ptr_ne(r, null); 14835 char *s = toStringO(r); 14836 ck_assert_str_eq(s, "[\"one\",\"two\"]"); 14837 free(s); 14838 terminateO(r); 14839 terminateO(delim); 14840 terminateO(self); 14841 14842 END_TEST 14843 14844 14845 START_TEST(splitCharPSSmallStringGT) 14846 14847 char** r; 14848 smallStringt *self = allocG(""); 14849 14850 setValO(self, "one/two"); 14851 r = splitCharPSSmallStringG(self, "/"); 14852 ck_assert_uint_eq(listLengthS(r),2); 14853 ck_assert_str_eq(r[0], "one"); 14854 ck_assert_str_eq(r[1], "two"); 14855 listFreeS(r); 14856 terminateO(self); 14857 14858 END_TEST 14859 14860 14861 START_TEST(splitCharSSmallStringGT) 14862 14863 char** r; 14864 smallStringt *self = allocG(""); 14865 14866 setValO(self, "one/two"); 14867 r = splitCharSSmallStringG(self, '/'); 14868 ck_assert_uint_eq(listLengthS(r),2); 14869 ck_assert_str_eq(r[0], "one"); 14870 ck_assert_str_eq(r[1], "two"); 14871 listFreeS(r); 14872 terminateO(self); 14873 14874 END_TEST 14875 14876 14877 START_TEST(splitSmallJsonSSmallStringGT) 14878 14879 char** r; 14880 smallStringt *self = allocG(""); 14881 smallJsont *delim = allocSmallJson(); 14882 14883 // string 14884 setValO(self, "one/two"); 14885 setTopSO(delim, "/"); 14886 r = splitSmallJsonSSmallStringG(self, delim); 14887 ck_assert_uint_eq(listLengthS(r),2); 14888 ck_assert_str_eq(r[0], "one"); 14889 ck_assert_str_eq(r[1], "two"); 14890 listFreeS(r); 14891 terminateO(delim); 14892 terminateO(self); 14893 14894 END_TEST 14895 14896 14897 START_TEST(splitSmallStringSSmallStringGT) 14898 14899 char** r; 14900 smallStringt *self = allocG(""); 14901 smallStringt *delim = allocSmallString("/"); 14902 14903 // string 14904 setValO(self, "one/two"); 14905 r = splitSmallStringSSmallStringG(self, delim); 14906 ck_assert_uint_eq(listLengthS(r),2); 14907 ck_assert_str_eq(r[0], "one"); 14908 ck_assert_str_eq(r[1], "two"); 14909 listFreeS(r); 14910 terminateO(delim); 14911 terminateO(self); 14912 14913 END_TEST 14914 14915 14916 START_TEST(extractSmallStringGT) 14917 14918 smallArrayt* r; 14919 smallStringt *self = allocG(""); 14920 14921 setValO(self, "one/two|"); 14922 r = extractSmallStringG(self, "/", "|"); 14923 ck_assert_ptr_ne(r, null); 14924 char *s = toStringO(r); 14925 ck_assert_str_eq(s, "[\"two\"]"); 14926 free(s); 14927 terminateO(r); 14928 terminateO(self); 14929 14930 END_TEST 14931 14932 14933 START_TEST(extractCharSSmallStringGT) 14934 14935 smallArrayt* r; 14936 smallStringt *self = allocG(""); 14937 14938 setValO(self, "one/two|"); 14939 r = extractCharSSmallStringG(self, '/', "|"); 14940 ck_assert_ptr_ne(r, null); 14941 char *s = toStringO(r); 14942 ck_assert_str_eq(s, "[\"two\"]"); 14943 free(s); 14944 terminateO(r); 14945 terminateO(self); 14946 14947 END_TEST 14948 14949 14950 START_TEST(extractSCharSmallStringGT) 14951 14952 smallArrayt* r; 14953 smallStringt *self = allocG(""); 14954 14955 setValO(self, "one/two|"); 14956 r = extractSCharSmallStringG(self, "/", '|'); 14957 ck_assert_ptr_ne(r, null); 14958 char *s = toStringO(r); 14959 ck_assert_str_eq(s, "[\"two\"]"); 14960 free(s); 14961 terminateO(r); 14962 terminateO(self); 14963 14964 END_TEST 14965 14966 14967 START_TEST(extractCharCharSmallStringGT) 14968 14969 smallArrayt* r; 14970 smallStringt *self = allocG(""); 14971 14972 setValO(self, "one/two|"); 14973 r = extractCharCharSmallStringG(self, '/', '|'); 14974 ck_assert_ptr_ne(r, null); 14975 char *s = toStringO(r); 14976 ck_assert_str_eq(s, "[\"two\"]"); 14977 free(s); 14978 terminateO(r); 14979 terminateO(self); 14980 14981 END_TEST 14982 14983 14984 START_TEST(extractSmallJsonSmallJsonSmallStringGT) 14985 14986 smallArrayt* r; 14987 smallStringt *self = allocG(""); 14988 smallJsont* delim1 = allocSmallJson(); 14989 smallJsont* delim2 = allocSmallJson(); 14990 14991 // string 14992 setValO(self, "one/two|"); 14993 setTopSO(delim1, "/"); 14994 setTopSO(delim2, "|"); 14995 r = extractSmallJsonSmallJsonSmallStringG(self, delim1, delim2); 14996 ck_assert_ptr_ne(r, null); 14997 char *s = toStringO(r); 14998 ck_assert_str_eq(s, "[\"two\"]"); 14999 free(s); 15000 terminateO(r); 15001 terminateO(delim1); 15002 terminateO(delim2); 15003 terminateO(self); 15004 15005 END_TEST 15006 15007 15008 START_TEST(extractSmallJsonSmallStringSmallStringGT) 15009 15010 smallArrayt* r; 15011 smallStringt *self = allocG(""); 15012 smallJsont* delim1 = allocSmallJson(); 15013 smallStringt* delim2 = allocSmallString("|"); 15014 15015 // string 15016 setValO(self, "one/two|"); 15017 setTopSO(delim1, "/"); 15018 r = extractSmallJsonSmallStringSmallStringG(self, delim1, delim2); 15019 ck_assert_ptr_ne(r, null); 15020 char *s = toStringO(r); 15021 ck_assert_str_eq(s, "[\"two\"]"); 15022 free(s); 15023 terminateO(r); 15024 terminateO(delim1); 15025 terminateO(delim2); 15026 terminateO(self); 15027 15028 END_TEST 15029 15030 15031 START_TEST(extractSmallJsonSSmallStringGT) 15032 15033 smallArrayt* r; 15034 smallStringt *self = allocG(""); 15035 smallJsont* delim1 = allocSmallJson(); 15036 15037 // string 15038 setValO(self, "one/two|"); 15039 setTopSO(delim1, "/"); 15040 r = extractSmallJsonSSmallStringG(self, delim1, "|"); 15041 ck_assert_ptr_ne(r, null); 15042 char *s = toStringO(r); 15043 ck_assert_str_eq(s, "[\"two\"]"); 15044 free(s); 15045 terminateO(r); 15046 terminateO(delim1); 15047 terminateO(self); 15048 15049 END_TEST 15050 15051 15052 START_TEST(extractSmallJsonCharSmallStringGT) 15053 15054 smallArrayt* r; 15055 smallStringt *self = allocG(""); 15056 smallJsont* delim1 = allocSmallJson(); 15057 15058 // string 15059 setValO(self, "one/two|"); 15060 setTopSO(delim1, "/"); 15061 r = extractSmallJsonCharSmallStringG(self, delim1, '|'); 15062 ck_assert_ptr_ne(r, null); 15063 char *s = toStringO(r); 15064 ck_assert_str_eq(s, "[\"two\"]"); 15065 free(s); 15066 terminateO(r); 15067 terminateO(delim1); 15068 terminateO(self); 15069 15070 END_TEST 15071 15072 15073 START_TEST(extractSmallStringSmallJsonSmallStringGT) 15074 15075 smallArrayt* r; 15076 smallStringt *self = allocG(""); 15077 smallStringt* delim1 = allocSmallString("/"); 15078 smallJsont* delim2 = allocSmallJson(); 15079 15080 // string 15081 setValO(self, "one/two|"); 15082 setTopSO(delim2, "|"); 15083 r = extractSmallStringSmallJsonSmallStringG(self, delim1, delim2); 15084 ck_assert_ptr_ne(r, null); 15085 char *s = toStringO(r); 15086 ck_assert_str_eq(s, "[\"two\"]"); 15087 free(s); 15088 terminateO(r); 15089 terminateO(delim1); 15090 terminateO(delim2); 15091 terminateO(self); 15092 15093 END_TEST 15094 15095 15096 START_TEST(extractSmallStringSmallStringSmallStringGT) 15097 15098 smallArrayt* r; 15099 smallStringt *self = allocG(""); 15100 smallStringt* delim1 = allocSmallString("/"); 15101 smallStringt* delim2 = allocSmallString("|"); 15102 15103 // string 15104 setValO(self, "one/two|"); 15105 setValO(delim2, "|"); 15106 r = extractSmallStringSmallStringSmallStringG(self, delim1, delim2); 15107 ck_assert_ptr_ne(r, null); 15108 char *s = toStringO(r); 15109 ck_assert_str_eq(s, "[\"two\"]"); 15110 free(s); 15111 terminateO(r); 15112 terminateO(delim1); 15113 terminateO(delim2); 15114 terminateO(self); 15115 15116 END_TEST 15117 15118 15119 START_TEST(extractSmallStringSSmallStringGT) 15120 15121 smallArrayt* r; 15122 smallStringt *self = allocG(""); 15123 smallStringt* delim1 = allocSmallString("/"); 15124 15125 // string 15126 setValO(self, "one/two|"); 15127 r = extractSmallStringSSmallStringG(self, delim1, "|"); 15128 ck_assert_ptr_ne(r, null); 15129 char *s = toStringO(r); 15130 ck_assert_str_eq(s, "[\"two\"]"); 15131 free(s); 15132 terminateO(r); 15133 terminateO(delim1); 15134 terminateO(self); 15135 15136 END_TEST 15137 15138 15139 START_TEST(extractSmallStringCharSmallStringGT) 15140 15141 smallArrayt* r; 15142 smallStringt *self = allocG(""); 15143 smallStringt* delim1 = allocSmallString("/"); 15144 15145 // string 15146 setValO(self, "one/two|"); 15147 r = extractSmallStringCharSmallStringG(self, delim1, '|'); 15148 ck_assert_ptr_ne(r, null); 15149 char *s = toStringO(r); 15150 ck_assert_str_eq(s, "[\"two\"]"); 15151 free(s); 15152 terminateO(r); 15153 terminateO(delim1); 15154 terminateO(self); 15155 15156 END_TEST 15157 15158 15159 START_TEST(extractSSmallJsonSmallStringGT) 15160 15161 smallArrayt* r; 15162 smallStringt *self = allocG(""); 15163 smallJsont* delim2 = allocSmallJson(); 15164 15165 // string 15166 setValO(self, "one/two|"); 15167 setTopSO(delim2, "|"); 15168 r = extractSSmallJsonSmallStringG(self, "/", delim2); 15169 ck_assert_ptr_ne(r, null); 15170 char *s = toStringO(r); 15171 ck_assert_str_eq(s, "[\"two\"]"); 15172 free(s); 15173 terminateO(r); 15174 terminateO(delim2); 15175 terminateO(self); 15176 15177 END_TEST 15178 15179 15180 START_TEST(extractSSmallStringSmallStringGT) 15181 15182 smallArrayt* r; 15183 smallStringt *self = allocG(""); 15184 smallStringt* delim2 = allocSmallString("|"); 15185 15186 // string 15187 setValO(self, "one/two|"); 15188 setValO(delim2, "|"); 15189 r = extractSSmallStringSmallStringG(self, "/", delim2); 15190 ck_assert_ptr_ne(r, null); 15191 char *s = toStringO(r); 15192 ck_assert_str_eq(s, "[\"two\"]"); 15193 free(s); 15194 terminateO(r); 15195 terminateO(delim2); 15196 terminateO(self); 15197 15198 END_TEST 15199 15200 15201 START_TEST(extractCharSmallJsonSmallStringGT) 15202 15203 smallArrayt* r; 15204 smallStringt *self = allocG(""); 15205 smallJsont* delim2 = allocSmallJson(); 15206 15207 // string 15208 setValO(self, "one/two|"); 15209 setTopSO(delim2, "|"); 15210 r = extractCharSmallJsonSmallStringG(self, '/', delim2); 15211 ck_assert_ptr_ne(r, null); 15212 char *s = toStringO(r); 15213 ck_assert_str_eq(s, "[\"two\"]"); 15214 free(s); 15215 terminateO(r); 15216 terminateO(delim2); 15217 terminateO(self); 15218 15219 END_TEST 15220 15221 15222 START_TEST(extractCharSmallStringSmallStringGT) 15223 15224 smallArrayt* r; 15225 smallStringt *self = allocG(""); 15226 smallStringt* delim2 = allocSmallString("|"); 15227 15228 // string 15229 setValO(self, "one/two|"); 15230 setValO(delim2, "|"); 15231 r = extractCharSmallStringSmallStringG(self, '/', delim2); 15232 ck_assert_ptr_ne(r, null); 15233 char *s = toStringO(r); 15234 ck_assert_str_eq(s, "[\"two\"]"); 15235 free(s); 15236 terminateO(r); 15237 terminateO(delim2); 15238 terminateO(self); 15239 15240 END_TEST 15241 15242 15243 START_TEST(icSplitSmallStringGT) 15244 15245 smallArrayt* r; 15246 smallStringt *self = allocG(""); 15247 15248 setValO(self, "one/two"); 15249 r = icSplitSmallStringG(self, "/"); 15250 ck_assert_ptr_ne(r, null); 15251 char *s = toStringO(r); 15252 ck_assert_str_eq(s, "[\"one\",\"two\"]"); 15253 free(s); 15254 terminateO(r); 15255 terminateO(self); 15256 15257 END_TEST 15258 15259 15260 START_TEST(icSplitCharSmallStringGT) 15261 15262 smallArrayt* r; 15263 smallStringt *self = allocG(""); 15264 15265 setValO(self, "one/two"); 15266 r = icSplitCharSmallStringG(self, 'T'); 15267 ck_assert_ptr_ne(r, null); 15268 char *s = toStringO(r); 15269 ck_assert_str_eq(s, "[\"one/\",\"wo\"]"); 15270 free(s); 15271 terminateO(r); 15272 terminateO(self); 15273 15274 END_TEST 15275 15276 15277 START_TEST(icSplitSmallJsonSmallStringGT) 15278 15279 smallArrayt* r; 15280 smallStringt *self = allocG(""); 15281 smallJsont *delim = allocSmallJson(); 15282 15283 // string 15284 setValO(self, "one/two"); 15285 setTopSO(delim, "T"); 15286 r = icSplitSmallJsonSmallStringG(self, delim); 15287 ck_assert_ptr_ne(r, null); 15288 char *s = toStringO(r); 15289 ck_assert_str_eq(s, "[\"one/\",\"wo\"]"); 15290 free(s); 15291 terminateO(r); 15292 terminateO(delim); 15293 terminateO(self); 15294 15295 END_TEST 15296 15297 15298 START_TEST(icSplitSmallStringSmallStringGT) 15299 15300 smallArrayt* r; 15301 smallStringt *self = allocG(""); 15302 smallStringt *delim = allocSmallString("T"); 15303 15304 // string 15305 setValO(self, "one/two"); 15306 r = icSplitSmallStringSmallStringG(self, delim); 15307 ck_assert_ptr_ne(r, null); 15308 char *s = toStringO(r); 15309 ck_assert_str_eq(s, "[\"one/\",\"wo\"]"); 15310 free(s); 15311 terminateO(r); 15312 terminateO(delim); 15313 terminateO(self); 15314 15315 END_TEST 15316 15317 15318 START_TEST(icSplitCharPSSmallStringGT) 15319 15320 char** r; 15321 smallStringt *self = allocG(""); 15322 15323 setValO(self, "one/two"); 15324 r = icSplitCharPSSmallStringG(self, "T"); 15325 ck_assert_uint_eq(listLengthS(r),2); 15326 ck_assert_str_eq(r[0], "one/"); 15327 ck_assert_str_eq(r[1], "wo"); 15328 listFreeS(r); 15329 terminateO(self); 15330 15331 END_TEST 15332 15333 15334 START_TEST(icSplitCharSSmallStringGT) 15335 15336 char** r; 15337 smallStringt *self = allocG(""); 15338 15339 setValO(self, "one/two"); 15340 r = icSplitCharSSmallStringG(self, 'T'); 15341 ck_assert_uint_eq(listLengthS(r),2); 15342 ck_assert_str_eq(r[0], "one/"); 15343 ck_assert_str_eq(r[1], "wo"); 15344 listFreeS(r); 15345 terminateO(self); 15346 15347 END_TEST 15348 15349 15350 START_TEST(icSplitSmallJsonSSmallStringGT) 15351 15352 char** r; 15353 smallStringt *self = allocG(""); 15354 smallJsont *delim = allocSmallJson(); 15355 15356 // string 15357 setValO(self, "one/two"); 15358 setTopSO(delim, "T"); 15359 r = icSplitSmallJsonSSmallStringG(self, delim); 15360 ck_assert_uint_eq(listLengthS(r),2); 15361 ck_assert_str_eq(r[0], "one/"); 15362 ck_assert_str_eq(r[1], "wo"); 15363 listFreeS(r); 15364 terminateO(delim); 15365 terminateO(self); 15366 15367 END_TEST 15368 15369 15370 START_TEST(icSplitSmallStringSSmallStringGT) 15371 15372 char** r; 15373 smallStringt *self = allocG(""); 15374 smallStringt *delim = allocSmallString("T"); 15375 15376 // string 15377 setValO(self, "one/two"); 15378 r = icSplitSmallStringSSmallStringG(self, delim); 15379 ck_assert_uint_eq(listLengthS(r),2); 15380 ck_assert_str_eq(r[0], "one/"); 15381 ck_assert_str_eq(r[1], "wo"); 15382 listFreeS(r); 15383 terminateO(delim); 15384 terminateO(self); 15385 15386 END_TEST 15387 15388 15389 START_TEST(icExtractSmallStringGT) 15390 15391 smallArrayt* r; 15392 smallStringt *self = allocG(""); 15393 15394 setValO(self, "one/twos"); 15395 r = icExtractSmallStringG(self, "E", "S"); 15396 ck_assert_ptr_ne(r, null); 15397 char *s = toStringO(r); 15398 ck_assert_str_eq(s, "[\"/two\"]"); 15399 free(s); 15400 terminateO(r); 15401 terminateO(self); 15402 15403 END_TEST 15404 15405 15406 START_TEST(icExtractCharSSmallStringGT) 15407 15408 smallArrayt* r; 15409 smallStringt *self = allocG(""); 15410 15411 setValO(self, "one/twos"); 15412 r = icExtractCharSSmallStringG(self, 'E', "S"); 15413 ck_assert_ptr_ne(r, null); 15414 char *s = toStringO(r); 15415 ck_assert_str_eq(s, "[\"/two\"]"); 15416 free(s); 15417 terminateO(r); 15418 terminateO(self); 15419 15420 END_TEST 15421 15422 15423 START_TEST(icExtractSCharSmallStringGT) 15424 15425 smallArrayt* r; 15426 smallStringt *self = allocG(""); 15427 15428 setValO(self, "one/twos"); 15429 r = icExtractSCharSmallStringG(self, "E", 'S'); 15430 ck_assert_ptr_ne(r, null); 15431 char *s = toStringO(r); 15432 ck_assert_str_eq(s, "[\"/two\"]"); 15433 free(s); 15434 terminateO(r); 15435 terminateO(self); 15436 15437 END_TEST 15438 15439 15440 START_TEST(icExtractCharCharSmallStringGT) 15441 15442 smallArrayt* r; 15443 smallStringt *self = allocG(""); 15444 15445 setValO(self, "one/twos"); 15446 r = icExtractCharCharSmallStringG(self, 'E', 'S'); 15447 ck_assert_ptr_ne(r, null); 15448 char *s = toStringO(r); 15449 ck_assert_str_eq(s, "[\"/two\"]"); 15450 free(s); 15451 terminateO(r); 15452 terminateO(self); 15453 15454 END_TEST 15455 15456 15457 START_TEST(icExtractSmallJsonSmallJsonSmallStringGT) 15458 15459 smallArrayt* r; 15460 smallStringt *self = allocG(""); 15461 smallJsont* delim1 = allocSmallJson(); 15462 smallJsont* delim2 = allocSmallJson(); 15463 15464 // string 15465 setValO(self, "one/twos"); 15466 setTopSO(delim1, "E"); 15467 setTopSO(delim2, "S"); 15468 r = icExtractSmallJsonSmallJsonSmallStringG(self, delim1, delim2); 15469 ck_assert_ptr_ne(r, null); 15470 char *s = toStringO(r); 15471 ck_assert_str_eq(s, "[\"/two\"]"); 15472 free(s); 15473 terminateO(r); 15474 terminateO(delim1); 15475 terminateO(delim2); 15476 terminateO(self); 15477 15478 END_TEST 15479 15480 15481 START_TEST(icExtractSmallJsonSmallStringSmallStringGT) 15482 15483 smallArrayt* r; 15484 smallStringt *self = allocG(""); 15485 smallJsont* delim1 = allocSmallJson(); 15486 smallStringt* delim2 = allocSmallString("S"); 15487 15488 // string 15489 setValO(self, "one/twos"); 15490 setTopSO(delim1, "E"); 15491 r = icExtractSmallJsonSmallStringSmallStringG(self, delim1, delim2); 15492 ck_assert_ptr_ne(r, null); 15493 char *s = toStringO(r); 15494 ck_assert_str_eq(s, "[\"/two\"]"); 15495 free(s); 15496 terminateO(r); 15497 terminateO(delim1); 15498 terminateO(delim2); 15499 terminateO(self); 15500 15501 END_TEST 15502 15503 15504 START_TEST(icExtractSmallJsonSSmallStringGT) 15505 15506 smallArrayt* r; 15507 smallStringt *self = allocG(""); 15508 smallJsont* delim1 = allocSmallJson(); 15509 15510 // string 15511 setValO(self, "one/twos"); 15512 setTopSO(delim1, "E"); 15513 r = icExtractSmallJsonSSmallStringG(self, delim1, "S"); 15514 ck_assert_ptr_ne(r, null); 15515 char *s = toStringO(r); 15516 ck_assert_str_eq(s, "[\"/two\"]"); 15517 free(s); 15518 terminateO(r); 15519 terminateO(delim1); 15520 terminateO(self); 15521 15522 END_TEST 15523 15524 15525 START_TEST(icExtractSmallJsonCharSmallStringGT) 15526 15527 smallArrayt* r; 15528 smallStringt *self = allocG(""); 15529 smallJsont* delim1 = allocSmallJson(); 15530 15531 // string 15532 setValO(self, "one/twos"); 15533 setTopSO(delim1, "E"); 15534 r = icExtractSmallJsonCharSmallStringG(self, delim1, 'S'); 15535 ck_assert_ptr_ne(r, null); 15536 char *s = toStringO(r); 15537 ck_assert_str_eq(s, "[\"/two\"]"); 15538 free(s); 15539 terminateO(r); 15540 terminateO(delim1); 15541 terminateO(self); 15542 15543 END_TEST 15544 15545 15546 START_TEST(icExtractSmallStringSmallJsonSmallStringGT) 15547 15548 smallArrayt* r; 15549 smallStringt *self = allocG(""); 15550 smallStringt* delim1 = allocSmallString("E"); 15551 smallJsont* delim2 = allocSmallJson(); 15552 15553 // string 15554 setValO(self, "one/twos"); 15555 setTopSO(delim2, "S"); 15556 r = icExtractSmallStringSmallJsonSmallStringG(self, delim1, delim2); 15557 ck_assert_ptr_ne(r, null); 15558 char *s = toStringO(r); 15559 ck_assert_str_eq(s, "[\"/two\"]"); 15560 free(s); 15561 terminateO(r); 15562 terminateO(delim1); 15563 terminateO(delim2); 15564 terminateO(self); 15565 15566 END_TEST 15567 15568 15569 START_TEST(icExtractSmallStringSmallStringSmallStringGT) 15570 15571 smallArrayt* r; 15572 smallStringt *self = allocG(""); 15573 smallStringt* delim1 = allocSmallString("E"); 15574 smallStringt* delim2 = allocSmallString("|"); 15575 15576 // string 15577 setValO(self, "one/twos"); 15578 setValO(delim2, "S"); 15579 r = icExtractSmallStringSmallStringSmallStringG(self, delim1, delim2); 15580 ck_assert_ptr_ne(r, null); 15581 char *s = toStringO(r); 15582 ck_assert_str_eq(s, "[\"/two\"]"); 15583 free(s); 15584 terminateO(r); 15585 terminateO(delim1); 15586 terminateO(delim2); 15587 terminateO(self); 15588 15589 END_TEST 15590 15591 15592 START_TEST(icExtractSmallStringSSmallStringGT) 15593 15594 smallArrayt* r; 15595 smallStringt *self = allocG(""); 15596 smallStringt* delim1 = allocSmallString("E"); 15597 15598 // string 15599 setValO(self, "one/twos"); 15600 r = icExtractSmallStringSSmallStringG(self, delim1, "S"); 15601 ck_assert_ptr_ne(r, null); 15602 char *s = toStringO(r); 15603 ck_assert_str_eq(s, "[\"/two\"]"); 15604 free(s); 15605 terminateO(r); 15606 terminateO(delim1); 15607 terminateO(self); 15608 15609 END_TEST 15610 15611 15612 START_TEST(icExtractSmallStringCharSmallStringGT) 15613 15614 smallArrayt* r; 15615 smallStringt *self = allocG(""); 15616 smallStringt* delim1 = allocSmallString("E"); 15617 15618 // string 15619 setValO(self, "one/twos"); 15620 r = icExtractSmallStringCharSmallStringG(self, delim1, 'S'); 15621 ck_assert_ptr_ne(r, null); 15622 char *s = toStringO(r); 15623 ck_assert_str_eq(s, "[\"/two\"]"); 15624 free(s); 15625 terminateO(r); 15626 terminateO(delim1); 15627 terminateO(self); 15628 15629 END_TEST 15630 15631 15632 START_TEST(icExtractSSmallJsonSmallStringGT) 15633 15634 smallArrayt* r; 15635 smallStringt *self = allocG(""); 15636 smallJsont* delim2 = allocSmallJson(); 15637 15638 // string 15639 setValO(self, "one/twos"); 15640 setTopSO(delim2, "S"); 15641 r = icExtractSSmallJsonSmallStringG(self, "E", delim2); 15642 ck_assert_ptr_ne(r, null); 15643 char *s = toStringO(r); 15644 ck_assert_str_eq(s, "[\"/two\"]"); 15645 free(s); 15646 terminateO(r); 15647 terminateO(delim2); 15648 terminateO(self); 15649 15650 END_TEST 15651 15652 15653 START_TEST(icExtractSSmallStringSmallStringGT) 15654 15655 smallArrayt* r; 15656 smallStringt *self = allocG(""); 15657 smallStringt* delim2 = allocSmallString("|"); 15658 15659 // string 15660 setValO(self, "one/twos"); 15661 setValO(delim2, "S"); 15662 r = icExtractSSmallStringSmallStringG(self, "E", delim2); 15663 ck_assert_ptr_ne(r, null); 15664 char *s = toStringO(r); 15665 ck_assert_str_eq(s, "[\"/two\"]"); 15666 free(s); 15667 terminateO(r); 15668 terminateO(delim2); 15669 terminateO(self); 15670 15671 END_TEST 15672 15673 15674 START_TEST(icExtractCharSmallJsonSmallStringGT) 15675 15676 smallArrayt* r; 15677 smallStringt *self = allocG(""); 15678 smallJsont* delim2 = allocSmallJson(); 15679 15680 // string 15681 setValO(self, "one/twos"); 15682 setTopSO(delim2, "S"); 15683 r = icExtractCharSmallJsonSmallStringG(self, 'E', delim2); 15684 ck_assert_ptr_ne(r, null); 15685 char *s = toStringO(r); 15686 ck_assert_str_eq(s, "[\"/two\"]"); 15687 free(s); 15688 terminateO(r); 15689 terminateO(delim2); 15690 terminateO(self); 15691 15692 END_TEST 15693 15694 15695 START_TEST(icExtractCharSmallStringSmallStringGT) 15696 15697 smallArrayt* r; 15698 smallStringt *self = allocG(""); 15699 smallStringt* delim2 = allocSmallString("|"); 15700 15701 // string 15702 setValO(self, "one/twos"); 15703 setValO(delim2, "S"); 15704 r = icExtractCharSmallStringSmallStringG(self, 'E', delim2); 15705 ck_assert_ptr_ne(r, null); 15706 char *s = toStringO(r); 15707 ck_assert_str_eq(s, "[\"/two\"]"); 15708 free(s); 15709 terminateO(r); 15710 terminateO(delim2); 15711 terminateO(self); 15712 15713 END_TEST 15714 15715 15716 START_TEST(readFileSmallStringGT) 15717 15718 smallStringt* r; 15719 smallStringt *self = allocG(""); 15720 15721 r = readFileSmallStringG(self, "../textTest.null"); 15722 ck_assert_ptr_ne(r, null); 15723 char *s = toStringO(r); 15724 ck_assert_str_eq(s, "LINE 1\nANOTHER line\n"); 15725 free(s); 15726 terminateO(self); 15727 15728 END_TEST 15729 15730 15731 START_TEST(readFileSmallJsonSmallStringGT) 15732 15733 smallStringt* r; 15734 smallStringt *self = allocG(""); 15735 smallJsont *filePath = allocSmallJson(); 15736 15737 // text 15738 setTopSO(filePath, "../textTest.null"); 15739 r = readFileSmallJsonSmallStringG(self, filePath); 15740 ck_assert_ptr_ne(r, null); 15741 char *s = toStringO(r); 15742 ck_assert_str_eq(s, "LINE 1\nANOTHER line\n"); 15743 free(s); 15744 terminateO(filePath); 15745 terminateO(self); 15746 15747 END_TEST 15748 15749 15750 START_TEST(readFileSmallStringSmallStringGT) 15751 15752 smallStringt* r; 15753 smallStringt *self = allocG(""); 15754 smallStringt *filePath = allocSmallString(""); 15755 15756 // text 15757 setValO(filePath, "../textTest.null"); 15758 r = readFileSmallStringSmallStringG(self, filePath); 15759 ck_assert_ptr_ne(r, null); 15760 char *s = toStringO(r); 15761 ck_assert_str_eq(s, "LINE 1\nANOTHER line\n"); 15762 free(s); 15763 terminateO(filePath); 15764 terminateO(self); 15765 15766 END_TEST 15767 15768 15769 START_TEST(readStreamSmallStringGT) 15770 15771 smallStringt* r; 15772 smallStringt *self = allocG(""); 15773 FILE *f; 15774 15775 // text 15776 f = fopen("../textTest.null", "r"); 15777 r = readStreamSmallStringG(self, f); 15778 ck_assert_ptr_ne(r, null); 15779 char *s = toStringO(r); 15780 ck_assert_str_eq(s, "LINE 1\nANOTHER line\n"); 15781 free(s); 15782 fclose(f); 15783 terminateO(self); 15784 15785 END_TEST 15786 15787 15788 START_TEST(writeFileSmallStringGT) 15789 15790 int r; 15791 smallStringt *self = allocG(""); 15792 15793 readFileO(self, "../textTest.null"); 15794 r = writeFileSmallStringG(self, "textOutTest.null"); 15795 ck_assert(r); 15796 // check textOutTest.null 15797 freeO(self); 15798 readFileO(self, "textOutTest.null"); 15799 ck_assert_uint_eq(lenO(self),20); 15800 char *s = toStringO(self); 15801 ck_assert_str_eq(s, "LINE 1\nANOTHER line\n"); 15802 free(s); 15803 terminateO(self); 15804 15805 END_TEST 15806 15807 15808 START_TEST(writeFileSmallJsonSmallStringGT) 15809 15810 int r; 15811 smallStringt *self = allocG(""); 15812 smallJsont *filePath = allocSmallJson(); 15813 15814 // write textOutTest.null 15815 setTopSO(filePath, "textOutTest.null"); 15816 readFileO(self, "../textTest.null"); 15817 r = writeFileSmallJsonSmallStringG(self, filePath); 15818 ck_assert(r); 15819 // check textOutTest.null 15820 freeO(self); 15821 readFileO(self, "textOutTest.null"); 15822 ck_assert_uint_eq(lenO(self),20); 15823 char *s = toStringO(self); 15824 ck_assert_str_eq(s, "LINE 1\nANOTHER line\n"); 15825 free(s); 15826 terminateO(filePath); 15827 terminateO(self); 15828 15829 END_TEST 15830 15831 15832 START_TEST(writeFileSmallStringSmallStringGT) 15833 15834 int r; 15835 smallStringt *self = allocG(""); 15836 smallStringt *filePath = allocSmallString(""); 15837 15838 // write textOutTest.null 15839 setValO(filePath, "textOutTest.null"); 15840 readFileO(self, "../textTest.null"); 15841 r = writeFileSmallStringSmallStringG(self, filePath); 15842 ck_assert(r); 15843 // check textOutTest.null 15844 freeO(self); 15845 readFileO(self, "textOutTest.null"); 15846 ck_assert_uint_eq(lenO(self),20); 15847 char *s = toStringO(self); 15848 ck_assert_str_eq(s, "LINE 1\nANOTHER line\n"); 15849 free(s); 15850 terminateO(filePath); 15851 terminateO(self); 15852 15853 END_TEST 15854 15855 15856 START_TEST(writeStreamSmallStringGT) 15857 15858 int r; 15859 smallStringt *self = allocG(""); 15860 FILE *f; 15861 15862 // write textOutTest.null 15863 readFileO(self, "../textTest.null"); 15864 f = fopen("textOutTest.null", "w"); 15865 r = writeStreamSmallStringG(self, f); 15866 ck_assert(r); 15867 fclose(f); 15868 // check textOutTest.null 15869 freeO(self); 15870 readFileO(self, "textOutTest.null"); 15871 ck_assert_uint_eq(lenO(self),20); 15872 ck_assert_str_eq(ssGet(self), "LINE 1\nANOTHER line\n"); 15873 terminateO(self); 15874 15875 END_TEST 15876 15877 15878 START_TEST(appendFileSmallStringFGT) 15879 15880 int r; 15881 smallStringt *self = allocG(""); 15882 15883 setValO(self, "appended line\n"); 15884 r = appendFileSmallStringFG(self, "appendTextOutTest.null"); 15885 ck_assert(r); 15886 setValO(self, "appended line 2\n"); 15887 r = appendFileSmallStringFG(self, "appendTextOutTest.null"); 15888 ck_assert(r); 15889 // check textOutTest.null 15890 freeO(self); 15891 readFileO(self, "appendTextOutTest.null"); 15892 ck_assert_uint_eq(lenO(self),30); 15893 ck_assert_str_eq(ssGet(self), "appended line\nappended line 2\n"); 15894 if (fileExists("appendTextOutTest.null")) 15895 rmAll("appendTextOutTest.null"); 15896 terminateO(self); 15897 15898 END_TEST 15899 15900 15901 START_TEST(appendFileSmallStringSmallStringGT) 15902 15903 int r; 15904 smallStringt *self = allocG(""); 15905 smallStringt *filePath = allocSmallString(""); 15906 15907 // write textOutTest.null 15908 setValO(self, "appended line\n"); 15909 setValO(filePath, "appendTextOutTest.null"); 15910 r = appendFileSmallStringSmallStringG(self, filePath); 15911 ck_assert(r); 15912 setValO(self, "appended line 2\n"); 15913 r = appendFileSmallStringSmallStringG(self, filePath); 15914 ck_assert(r); 15915 // check textOutTest.null 15916 freeO(self); 15917 readFileO(self, "appendTextOutTest.null"); 15918 ck_assert_uint_eq(lenO(self),30); 15919 ck_assert_str_eq(ssGet(self), "appended line\nappended line 2\n"); 15920 if (fileExists("appendTextOutTest.null")) 15921 rmAll("appendTextOutTest.null"); 15922 terminateO(filePath); 15923 terminateO(self); 15924 15925 END_TEST 15926 15927 15928 15929 15930 15931 Suite * libsheepySuite(void) { 15932 Suite *s; 15933 TCase *tc_core; 15934 15935 s = suite_create("libsheepy"); 15936 15937 /* Core test case */ 15938 tc_core = tcase_create("Object"); 15939 15940 setLogMode(LOG_VERBOSE); 15941 15942 // disable btrace to make the test run faster 15943 btraceDisable(); 15944 15945 tcase_add_test(tc_core, initiateSmallStringT); 15946 tcase_add_test(tc_core, initiateAllocateSmallStringT); 15947 tcase_add_test(tc_core, allocSmallStringT); 15948 tcase_add_test(tc_core, createSFT); 15949 tcase_add_test(tc_core, freeSmallStringT); 15950 tcase_add_test(tc_core, terminateSmallStringT); 15951 tcase_add_test(tc_core, toStringSmallStringT); 15952 tcase_add_test(tc_core, duplicateSmallStringT); 15953 tcase_add_test(tc_core, smashSmallStringT); 15954 tcase_add_test(tc_core, finishSmallStringT); 15955 tcase_add_test(tc_core, getSmallStringT); 15956 tcase_add_test(tc_core, setSmallStringT); 15957 tcase_add_test(tc_core, setCharSmallStringT); 15958 tcase_add_test(tc_core, setBoolSmallStringT); 15959 tcase_add_test(tc_core, setDoubleSmallStringT); 15960 tcase_add_test(tc_core, setInt64SmallStringT); 15961 tcase_add_test(tc_core, setInt32SmallStringT); 15962 tcase_add_test(tc_core, setUint32SmallStringT); 15963 tcase_add_test(tc_core, setUint64SmallStringT); 15964 tcase_add_test(tc_core, setSmallArraySmallStringT); 15965 tcase_add_test(tc_core, setFromSmallDictSmallStringT); 15966 tcase_add_test(tc_core, setFromSmallJsonSmallStringT); 15967 tcase_add_test(tc_core, setSmallBoolSmallStringT); 15968 tcase_add_test(tc_core, setSmallDoubleSmallStringT); 15969 tcase_add_test(tc_core, setSmallIntSmallStringT); 15970 tcase_add_test(tc_core, setSmallJsonSmallStringT); 15971 tcase_add_test(tc_core, setSmallStringSmallStringT); 15972 tcase_add_test(tc_core, setNFreeSmallStringT); 15973 tcase_add_test(tc_core, appendSmallStringT); 15974 tcase_add_test(tc_core, appendSmallJsonSmallStringT); 15975 tcase_add_test(tc_core, appendNSmashSmallStringT); 15976 tcase_add_test(tc_core, appendSSmallStringT); 15977 tcase_add_test(tc_core, appendCharSmallStringT); 15978 tcase_add_test(tc_core, appendNSmashSmallJsonSmallStringT); 15979 tcase_add_test(tc_core, appendNSmashSSmallStringT); 15980 tcase_add_test(tc_core, prependSmallStringT); 15981 tcase_add_test(tc_core, prependSmallJsonSmallStringT); 15982 tcase_add_test(tc_core, prependNSmashSmallStringT); 15983 tcase_add_test(tc_core, prependNSmashSmallJsonSmallStringT); 15984 tcase_add_test(tc_core, prependSSmallStringT); 15985 tcase_add_test(tc_core, prependCharSmallStringT); 15986 tcase_add_test(tc_core, prependNSmashSSmallStringT); 15987 tcase_add_test(tc_core, catSmallStringT); 15988 tcase_add_test(tc_core, catSSmallStringT); 15989 tcase_add_test(tc_core, pushNFreeManySmallStringT); 15990 tcase_add_test(tc_core, pushNFreeManySSmallStringT); 15991 tcase_add_test(tc_core, replaceSmallStringT); 15992 tcase_add_test(tc_core, replaceCharSSmallStringT); 15993 tcase_add_test(tc_core, replaceSCharSmallStringT); 15994 tcase_add_test(tc_core, replaceCharCharSmallStringT); 15995 tcase_add_test(tc_core, replaceSmallJsonSmallJsonSmallStringT); 15996 tcase_add_test(tc_core, replaceSmallJsonSmallStringSmallStringT); 15997 tcase_add_test(tc_core, replaceSmallJsonSSmallStringT); 15998 tcase_add_test(tc_core, replaceSmallJsonCharSmallStringT); 15999 tcase_add_test(tc_core, replaceSmallStringSmallJsonSmallStringT); 16000 tcase_add_test(tc_core, replaceSmallStringSmallStringSmallStringT); 16001 tcase_add_test(tc_core, replaceSmallStringSSmallStringT); 16002 tcase_add_test(tc_core, replaceSmallStringCharSmallStringT); 16003 tcase_add_test(tc_core, replaceSSmallJsonSmallStringT); 16004 tcase_add_test(tc_core, replaceSSmallStringSmallStringT); 16005 tcase_add_test(tc_core, replaceCharSmallJsonSmallStringT); 16006 tcase_add_test(tc_core, replaceCharSmallStringSmallStringT); 16007 tcase_add_test(tc_core, replaceManySmallStringT); 16008 tcase_add_test(tc_core, icReplaceSmallStringT); 16009 tcase_add_test(tc_core, icReplaceCharSSmallStringT); 16010 tcase_add_test(tc_core, icReplaceSCharSmallStringT); 16011 tcase_add_test(tc_core, icReplaceCharCharSmallStringT); 16012 tcase_add_test(tc_core, icReplaceSmallJsonSmallJsonSmallStringT); 16013 tcase_add_test(tc_core, icReplaceSmallJsonSmallStringSmallStringT); 16014 tcase_add_test(tc_core, icReplaceSmallJsonSSmallStringT); 16015 tcase_add_test(tc_core, icReplaceSmallJsonCharSmallStringT); 16016 tcase_add_test(tc_core, icReplaceSmallStringSmallJsonSmallStringT); 16017 tcase_add_test(tc_core, icReplaceSmallStringSmallStringSmallStringT); 16018 tcase_add_test(tc_core, icReplaceSmallStringSSmallStringT); 16019 tcase_add_test(tc_core, icReplaceSmallStringCharSmallStringT); 16020 tcase_add_test(tc_core, icReplaceSSmallJsonSmallStringT); 16021 tcase_add_test(tc_core, icReplaceSSmallStringSmallStringT); 16022 tcase_add_test(tc_core, icReplaceCharSmallJsonSmallStringT); 16023 tcase_add_test(tc_core, icReplaceCharSmallStringSmallStringT); 16024 tcase_add_test(tc_core, icReplaceManySmallStringT); 16025 tcase_add_test(tc_core, equalSmallStringT); 16026 tcase_add_test(tc_core, equalSSmallStringT); 16027 tcase_add_test(tc_core, equalCharSmallStringT); 16028 tcase_add_test(tc_core, equalSmallStringBaseT); 16029 tcase_add_test(tc_core, equalSmallStringBoolT); 16030 tcase_add_test(tc_core, equalSmallStringDoubleT); 16031 tcase_add_test(tc_core, equalSmallStringInt64T); 16032 tcase_add_test(tc_core, equalSmallStringInt32T); 16033 tcase_add_test(tc_core, equalSmallStringUint32T); 16034 tcase_add_test(tc_core, equalSmallStringUint64T); 16035 tcase_add_test(tc_core, equalSmallStringSmallBoolT); 16036 tcase_add_test(tc_core, equalSmallStringSmallBytesT); 16037 tcase_add_test(tc_core, equalSmallStringSmallDoubleT); 16038 tcase_add_test(tc_core, equalSmallStringSmallIntT); 16039 tcase_add_test(tc_core, equalSmallStringSmallJsonT); 16040 tcase_add_test(tc_core, icEqualSmallStringT); 16041 tcase_add_test(tc_core, icEqualSSmallStringT); 16042 tcase_add_test(tc_core, icEqualCharSmallStringT); 16043 tcase_add_test(tc_core, icEqualSmallStringBaseT); 16044 tcase_add_test(tc_core, icEqualSmallStringSmallJsonT); 16045 tcase_add_test(tc_core, equalISSmallStringT); 16046 tcase_add_test(tc_core, equalICharSmallStringT); 16047 tcase_add_test(tc_core, equalISmallJsonSmallStringT); 16048 tcase_add_test(tc_core, equalISmallStringSmallStringT); 16049 tcase_add_test(tc_core, startsWithSSmallStringT); 16050 tcase_add_test(tc_core, startsWithCharSmallStringT); 16051 tcase_add_test(tc_core, startsWithSmallJsonSmallStringT); 16052 tcase_add_test(tc_core, startsWithSmallStringSmallStringT); 16053 tcase_add_test(tc_core, endsWithSSmallStringT); 16054 tcase_add_test(tc_core, endsWithCharSmallStringT); 16055 tcase_add_test(tc_core, endsWithSmallJsonSmallStringT); 16056 tcase_add_test(tc_core, endsWithSmallStringSmallStringT); 16057 tcase_add_test(tc_core, countSSmallStringT); 16058 tcase_add_test(tc_core, countCharSmallStringT); 16059 tcase_add_test(tc_core, countSmallJsonSmallStringT); 16060 tcase_add_test(tc_core, countSmallStringSmallStringT); 16061 tcase_add_test(tc_core, icStartsWithSSmallStringT); 16062 tcase_add_test(tc_core, icStartsWithCharSmallStringT); 16063 tcase_add_test(tc_core, icStartsWithSmallJsonSmallStringT); 16064 tcase_add_test(tc_core, icStartsWithSmallStringSmallStringT); 16065 tcase_add_test(tc_core, icEndsWithSSmallStringT); 16066 tcase_add_test(tc_core, icEndsWithCharSmallStringT); 16067 tcase_add_test(tc_core, icEndsWithSmallJsonSmallStringT); 16068 tcase_add_test(tc_core, icEndsWithSmallStringSmallStringT); 16069 tcase_add_test(tc_core, icCountSSmallStringT); 16070 tcase_add_test(tc_core, icCountCharSmallStringT); 16071 tcase_add_test(tc_core, icCountSmallJsonSmallStringT); 16072 tcase_add_test(tc_core, icCountSmallStringSmallStringT); 16073 tcase_add_test(tc_core, isNumberSmallStringT); 16074 tcase_add_test(tc_core, isIntSmallStringT); 16075 tcase_add_test(tc_core, parseIntSmallStringT); 16076 tcase_add_test(tc_core, parseDoubleSmallStringT); 16077 tcase_add_test(tc_core, intToSmallStringT); 16078 tcase_add_test(tc_core, doubleToSmallStringT); 16079 tcase_add_test(tc_core, lenSmallStringT); 16080 tcase_add_test(tc_core, upperSmallStringT); 16081 tcase_add_test(tc_core, lowerSmallStringT); 16082 tcase_add_test(tc_core, trimSmallStringT); 16083 tcase_add_test(tc_core, lTrimSmallStringT); 16084 tcase_add_test(tc_core, rTrimSmallStringT); 16085 tcase_add_test(tc_core, uniqSmallStringT); 16086 tcase_add_test(tc_core, icUniqSmallStringT); 16087 tcase_add_test(tc_core, getAtSmallStringT); 16088 tcase_add_test(tc_core, setAtSmallStringT); 16089 tcase_add_test(tc_core, sliceSmallStringT); 16090 tcase_add_test(tc_core, cropSmallStringT); 16091 tcase_add_test(tc_core, cropSSmallStringT); 16092 tcase_add_test(tc_core, cropSmallJsonSmallStringT); 16093 tcase_add_test(tc_core, cropElemSmallStringT); 16094 tcase_add_test(tc_core, copySmallStringT); 16095 tcase_add_test(tc_core, insertSmallStringT); 16096 tcase_add_test(tc_core, insertSmallJsonSmallStringT); 16097 tcase_add_test(tc_core, insertSSmallStringT); 16098 tcase_add_test(tc_core, insertNFreeSmallStringT); 16099 tcase_add_test(tc_core, insertNFreeSmallJsonSmallStringT); 16100 tcase_add_test(tc_core, insertSNFreeSmallStringT); 16101 tcase_add_test(tc_core, injectSmallStringT); 16102 tcase_add_test(tc_core, delSmallStringT); 16103 tcase_add_test(tc_core, delElemSmallStringT); 16104 tcase_add_test(tc_core, hasSmallStringT); 16105 tcase_add_test(tc_core, hasCharSmallStringT); 16106 tcase_add_test(tc_core, hasSmallJsonSmallStringT); 16107 tcase_add_test(tc_core, hasSmallStringSmallStringT); 16108 tcase_add_test(tc_core, findSmallStringT); 16109 tcase_add_test(tc_core, findCharSmallStringT); 16110 tcase_add_test(tc_core, findSmallJsonSmallStringT); 16111 tcase_add_test(tc_core, findSmallStringSmallStringT); 16112 tcase_add_test(tc_core, indexOfSmallStringT); 16113 tcase_add_test(tc_core, indexOfCharSmallStringT); 16114 tcase_add_test(tc_core, indexOfSmallJsonSmallStringT); 16115 tcase_add_test(tc_core, indexOfSmallStringSmallStringT); 16116 tcase_add_test(tc_core, icHasSmallStringT); 16117 tcase_add_test(tc_core, icHasCharSmallStringT); 16118 tcase_add_test(tc_core, icHasSmallJsonSmallStringT); 16119 tcase_add_test(tc_core, icHasSmallStringSmallStringT); 16120 tcase_add_test(tc_core, icFindSmallStringT); 16121 tcase_add_test(tc_core, icFindCharSmallStringT); 16122 tcase_add_test(tc_core, icFindSmallJsonSmallStringT); 16123 tcase_add_test(tc_core, icFindSmallStringSmallStringT); 16124 tcase_add_test(tc_core, icIndexOfSmallStringT); 16125 tcase_add_test(tc_core, icIndexOfCharSmallStringT); 16126 tcase_add_test(tc_core, icIndexOfSmallJsonSmallStringT); 16127 tcase_add_test(tc_core, icIndexOfSmallStringSmallStringT); 16128 tcase_add_test(tc_core, emptySmallStringT); 16129 tcase_add_test(tc_core, isEmptySmallStringT); 16130 tcase_add_test(tc_core, isBlankSmallStringT); 16131 tcase_add_test(tc_core, splitSmallStringT); 16132 tcase_add_test(tc_core, splitCharSmallStringT); 16133 tcase_add_test(tc_core, splitSmallJsonSmallStringT); 16134 tcase_add_test(tc_core, splitSmallStringSmallStringT); 16135 tcase_add_test(tc_core, splitSSmallStringT); 16136 tcase_add_test(tc_core, splitCharSSmallStringT); 16137 tcase_add_test(tc_core, splitSmallJsonSSmallStringT); 16138 tcase_add_test(tc_core, splitSmallStringSSmallStringT); 16139 tcase_add_test(tc_core, extractSmallStringT); 16140 tcase_add_test(tc_core, extractCharSSmallStringT); 16141 tcase_add_test(tc_core, extractSCharSmallStringT); 16142 tcase_add_test(tc_core, extractCharCharSmallStringT); 16143 tcase_add_test(tc_core, extractSmallJsonSmallJsonSmallStringT); 16144 tcase_add_test(tc_core, extractSmallJsonSmallStringSmallStringT); 16145 tcase_add_test(tc_core, extractSmallJsonSSmallStringT); 16146 tcase_add_test(tc_core, extractSmallJsonCharSmallStringT); 16147 tcase_add_test(tc_core, extractSmallStringSmallJsonSmallStringT); 16148 tcase_add_test(tc_core, extractSmallStringSmallStringSmallStringT); 16149 tcase_add_test(tc_core, extractSmallStringSSmallStringT); 16150 tcase_add_test(tc_core, extractSmallStringCharSmallStringT); 16151 tcase_add_test(tc_core, extractSSmallJsonSmallStringT); 16152 tcase_add_test(tc_core, extractSSmallStringSmallStringT); 16153 tcase_add_test(tc_core, extractCharSmallJsonSmallStringT); 16154 tcase_add_test(tc_core, extractCharSmallStringSmallStringT); 16155 tcase_add_test(tc_core, icSplitSmallStringT); 16156 tcase_add_test(tc_core, icSplitCharSmallStringT); 16157 tcase_add_test(tc_core, icSplitSmallJsonSmallStringT); 16158 tcase_add_test(tc_core, icSplitSmallStringSmallStringT); 16159 tcase_add_test(tc_core, icSplitSSmallStringT); 16160 tcase_add_test(tc_core, icSplitCharSSmallStringT); 16161 tcase_add_test(tc_core, icSplitSmallJsonSSmallStringT); 16162 tcase_add_test(tc_core, icSplitSmallStringSSmallStringT); 16163 tcase_add_test(tc_core, icExtractSmallStringT); 16164 tcase_add_test(tc_core, icExtractCharSSmallStringT); 16165 tcase_add_test(tc_core, icExtractSCharSmallStringT); 16166 tcase_add_test(tc_core, icExtractCharCharSmallStringT); 16167 tcase_add_test(tc_core, icExtractSmallJsonSmallJsonSmallStringT); 16168 tcase_add_test(tc_core, icExtractSmallJsonSmallStringSmallStringT); 16169 tcase_add_test(tc_core, icExtractSmallJsonSSmallStringT); 16170 tcase_add_test(tc_core, icExtractSmallJsonCharSmallStringT); 16171 tcase_add_test(tc_core, icExtractSmallStringSmallJsonSmallStringT); 16172 tcase_add_test(tc_core, icExtractSmallStringSmallStringSmallStringT); 16173 tcase_add_test(tc_core, icExtractSmallStringSSmallStringT); 16174 tcase_add_test(tc_core, icExtractSmallStringCharSmallStringT); 16175 tcase_add_test(tc_core, icExtractSSmallJsonSmallStringT); 16176 tcase_add_test(tc_core, icExtractSSmallStringSmallStringT); 16177 tcase_add_test(tc_core, icExtractCharSmallJsonSmallStringT); 16178 tcase_add_test(tc_core, icExtractCharSmallStringSmallStringT); 16179 tcase_add_test(tc_core, colorSmallStringT); 16180 tcase_add_test(tc_core, colordSmallStringT); 16181 tcase_add_test(tc_core, readFileSmallStringT); 16182 tcase_add_test(tc_core, readFileSmallJsonSmallStringT); 16183 tcase_add_test(tc_core, readFileSmallStringSmallStringT); 16184 tcase_add_test(tc_core, readStreamSmallStringT); 16185 tcase_add_test(tc_core, writeFileSmallStringT); 16186 tcase_add_test(tc_core, writeFileSmallJsonSmallStringT); 16187 tcase_add_test(tc_core, writeFileSmallStringSmallStringT); 16188 tcase_add_test(tc_core, writeStreamSmallStringT); 16189 tcase_add_test(tc_core, appendFileSmallStringT); 16190 tcase_add_test(tc_core, appendFileSmallStringSmallStringT); 16191 tcase_add_test(tc_core, duplicateSmallStringGT); 16192 tcase_add_test(tc_core, freeSmallStringGT); 16193 tcase_add_test(tc_core, setBoolSmallStringGT); 16194 tcase_add_test(tc_core, setDoubleSmallStringGT); 16195 tcase_add_test(tc_core, setInt64SmallStringGT); 16196 tcase_add_test(tc_core, setInt32SmallStringGT); 16197 tcase_add_test(tc_core, setUint32SmallStringGT); 16198 tcase_add_test(tc_core, setUint64SmallStringGT); 16199 tcase_add_test(tc_core, setSmallStringGT); 16200 tcase_add_test(tc_core, setCharSmallStringGT); 16201 tcase_add_test(tc_core, setSmallArraySmallStringGT); 16202 tcase_add_test(tc_core, setFromSmallDictSmallStringGT); 16203 tcase_add_test(tc_core, setFromSmallJsonSmallStringGT); 16204 tcase_add_test(tc_core, setSmallBoolSmallStringGT); 16205 tcase_add_test(tc_core, setSmallDoubleSmallStringGT); 16206 tcase_add_test(tc_core, setSmallIntSmallStringGT); 16207 tcase_add_test(tc_core, setSmallJsonSmallStringGT); 16208 tcase_add_test(tc_core, setSmallStringSmallStringGT); 16209 tcase_add_test(tc_core, getAtSmallStringGT); 16210 tcase_add_test(tc_core, setAtSmallStringGT); 16211 tcase_add_test(tc_core, appendSmallStringGT); 16212 tcase_add_test(tc_core, appendSmallJsonSmallStringGT); 16213 tcase_add_test(tc_core, appendSSmallStringGT); 16214 tcase_add_test(tc_core, appendCharSmallStringGT); 16215 tcase_add_test(tc_core, appendNSmashSmallStringGT); 16216 tcase_add_test(tc_core, appendNSmashSmallJsonSmallStringGT); 16217 tcase_add_test(tc_core, appendNSmashSSmallStringGT); 16218 tcase_add_test(tc_core, prependSmallStringGT); 16219 tcase_add_test(tc_core, prependSmallJsonSmallStringGT); 16220 tcase_add_test(tc_core, prependSSmallStringGT); 16221 tcase_add_test(tc_core, prependCharSmallStringGT); 16222 tcase_add_test(tc_core, prependNSmashSmallStringGT); 16223 tcase_add_test(tc_core, prependNSmashSmallJsonSmallStringGT); 16224 tcase_add_test(tc_core, prependNSmashSSmallStringGT); 16225 tcase_add_test(tc_core, replaceSmallStringGT); 16226 tcase_add_test(tc_core, replaceCharSSmallStringGT); 16227 tcase_add_test(tc_core, replaceSCharSmallStringGT); 16228 tcase_add_test(tc_core, replaceCharCharSmallStringGT); 16229 tcase_add_test(tc_core, replaceSmallJsonSmallJsonSmallStringGT); 16230 tcase_add_test(tc_core, replaceSmallJsonSmallStringSmallStringGT); 16231 tcase_add_test(tc_core, replaceSmallJsonSSmallStringGT); 16232 tcase_add_test(tc_core, replaceSmallJsonCharSmallStringGT); 16233 tcase_add_test(tc_core, replaceSmallStringSmallJsonSmallStringGT); 16234 tcase_add_test(tc_core, replaceSmallStringSmallStringSmallStringGT); 16235 tcase_add_test(tc_core, replaceSmallStringSSmallStringGT); 16236 tcase_add_test(tc_core, replaceSmallStringCharSmallStringGT); 16237 tcase_add_test(tc_core, replaceSSmallJsonSmallStringGT); 16238 tcase_add_test(tc_core, replaceSSmallStringSmallStringGT); 16239 tcase_add_test(tc_core, replaceCharSmallJsonSmallStringGT); 16240 tcase_add_test(tc_core, replaceCharSmallStringSmallStringGT); 16241 tcase_add_test(tc_core, icReplaceSmallStringGT); 16242 tcase_add_test(tc_core, icReplaceCharSSmallStringGT); 16243 tcase_add_test(tc_core, icReplaceSCharSmallStringGT); 16244 tcase_add_test(tc_core, icReplaceCharCharSmallStringGT); 16245 tcase_add_test(tc_core, icReplaceSmallJsonSmallJsonSmallStringGT); 16246 tcase_add_test(tc_core, icReplaceSmallJsonSmallStringSmallStringGT); 16247 tcase_add_test(tc_core, icReplaceSmallJsonSSmallStringGT); 16248 tcase_add_test(tc_core, icReplaceSmallJsonCharSmallStringGT); 16249 tcase_add_test(tc_core, icReplaceSmallStringSmallJsonSmallStringGT); 16250 tcase_add_test(tc_core, icReplaceSmallStringSmallStringSmallStringGT); 16251 tcase_add_test(tc_core, icReplaceSmallStringSSmallStringGT); 16252 tcase_add_test(tc_core, icReplaceSmallStringCharSmallStringGT); 16253 tcase_add_test(tc_core, icReplaceSSmallJsonSmallStringGT); 16254 tcase_add_test(tc_core, icReplaceSSmallStringSmallStringGT); 16255 tcase_add_test(tc_core, icReplaceCharSmallJsonSmallStringGT); 16256 tcase_add_test(tc_core, icReplaceCharSmallStringSmallStringGT); 16257 tcase_add_test(tc_core, equalSmallStringFGT); 16258 tcase_add_test(tc_core, equalCharSmallStringGT); 16259 tcase_add_test(tc_core, equalSSmallStringGT); 16260 tcase_add_test(tc_core, equalSmallStringBaseGT); 16261 tcase_add_test(tc_core, equalSmallStringBoolGT); 16262 tcase_add_test(tc_core, equalSmallStringDoubleGT); 16263 tcase_add_test(tc_core, equalSmallStringInt64GT); 16264 tcase_add_test(tc_core, equalSmallStringInt32GT); 16265 tcase_add_test(tc_core, equalSmallStringUint32GT); 16266 tcase_add_test(tc_core, equalSmallStringUint64GT); 16267 tcase_add_test(tc_core, equalSmallStringSmallBoolGT); 16268 tcase_add_test(tc_core, equalSmallStringSmallBytesGT); 16269 tcase_add_test(tc_core, equalSmallStringSmallDoubleGT); 16270 tcase_add_test(tc_core, equalSmallStringSmallIntGT); 16271 tcase_add_test(tc_core, equalSmallStringSmallJsonGT); 16272 tcase_add_test(tc_core, icEqualSmallStringFGT); 16273 tcase_add_test(tc_core, icEqualCharSmallStringGT); 16274 tcase_add_test(tc_core, icEqualSSmallStringGT); 16275 tcase_add_test(tc_core, icEqualSmallStringBaseGT); 16276 tcase_add_test(tc_core, icEqualSmallStringSmallJsonGT); 16277 tcase_add_test(tc_core, equalISSmallStringGT); 16278 tcase_add_test(tc_core, equalICharSmallStringGT); 16279 tcase_add_test(tc_core, equalISmallJsonSmallStringGT); 16280 tcase_add_test(tc_core, equalISmallStringSmallStringGT); 16281 tcase_add_test(tc_core, startsWithSSmallStringGT); 16282 tcase_add_test(tc_core, startsWithCharSmallStringGT); 16283 tcase_add_test(tc_core, startsWithSmallJsonSmallStringGT); 16284 tcase_add_test(tc_core, startsWithSmallStringSmallStringGT); 16285 tcase_add_test(tc_core, endsWithSSmallStringGT); 16286 tcase_add_test(tc_core, endsWithCharSmallStringGT); 16287 tcase_add_test(tc_core, endsWithSmallJsonSmallStringGT); 16288 tcase_add_test(tc_core, endsWithSmallStringSmallStringGT); 16289 tcase_add_test(tc_core, countSSmallStringGT); 16290 tcase_add_test(tc_core, countCharSmallStringGT); 16291 tcase_add_test(tc_core, countSmallJsonSmallStringGT); 16292 tcase_add_test(tc_core, countSmallStringSmallStringGT); 16293 tcase_add_test(tc_core, icStartsWithSSmallStringGT); 16294 tcase_add_test(tc_core, icStartsWithCharSmallStringGT); 16295 tcase_add_test(tc_core, icStartsWithSmallJsonSmallStringGT); 16296 tcase_add_test(tc_core, icStartsWithSmallStringSmallStringGT); 16297 tcase_add_test(tc_core, icEndsWithSSmallStringGT); 16298 tcase_add_test(tc_core, icEndsWithCharSmallStringGT); 16299 tcase_add_test(tc_core, icEndsWithSmallJsonSmallStringGT); 16300 tcase_add_test(tc_core, icEndsWithSmallStringSmallStringGT); 16301 tcase_add_test(tc_core, icCountSSmallStringGT); 16302 tcase_add_test(tc_core, icCountCharSmallStringGT); 16303 tcase_add_test(tc_core, icCountSmallJsonSmallStringGT); 16304 tcase_add_test(tc_core, icCountSmallStringSmallStringGT); 16305 tcase_add_test(tc_core, isNumberSmallStringGT); 16306 tcase_add_test(tc_core, isIntSmallStringGT); 16307 tcase_add_test(tc_core, parseIntSmallStringGT); 16308 tcase_add_test(tc_core, intToSmallStringGT); 16309 tcase_add_test(tc_core, parseDoubleSmallStringGT); 16310 tcase_add_test(tc_core, doubleToSmallStringGT); 16311 tcase_add_test(tc_core, lenSmallStringGT); 16312 tcase_add_test(tc_core, upperSmallStringGT); 16313 tcase_add_test(tc_core, lowerSmallStringGT); 16314 tcase_add_test(tc_core, trimSmallStringGT); 16315 tcase_add_test(tc_core, lTrimSmallStringGT); 16316 tcase_add_test(tc_core, rTrimSmallStringGT); 16317 tcase_add_test(tc_core, uniqSmallStringGT); 16318 tcase_add_test(tc_core, icUniqSmallStringGT); 16319 tcase_add_test(tc_core, sliceSmallStringGT); 16320 tcase_add_test(tc_core, cropSmallStringGT); 16321 tcase_add_test(tc_core, cropSSmallStringGT); 16322 tcase_add_test(tc_core, cropSmallJsonSmallStringGT); 16323 tcase_add_test(tc_core, cropElemSmallStringGT); 16324 tcase_add_test(tc_core, copySmallStringGT); 16325 tcase_add_test(tc_core, insertSmallStringGT); 16326 tcase_add_test(tc_core, insertSmallJsonSmallStringGT); 16327 tcase_add_test(tc_core, insertSSmallStringGT); 16328 tcase_add_test(tc_core, insertNFreeSmallStringGT); 16329 tcase_add_test(tc_core, insertNFreeSmallJsonSmallStringGT); 16330 tcase_add_test(tc_core, insertSNFreeSmallStringGT); 16331 tcase_add_test(tc_core, injectSmallStringGT); 16332 tcase_add_test(tc_core, delSmallStringGT); 16333 tcase_add_test(tc_core, delElemSmallStringGT); 16334 tcase_add_test(tc_core, hasSmallStringGT); 16335 tcase_add_test(tc_core, hasCharSmallStringGT); 16336 tcase_add_test(tc_core, hasSmallJsonSmallStringGT); 16337 tcase_add_test(tc_core, hasSmallStringSmallStringGT); 16338 tcase_add_test(tc_core, findSmallStringGT); 16339 tcase_add_test(tc_core, findCharSmallStringGT); 16340 tcase_add_test(tc_core, findSmallJsonSmallStringGT); 16341 tcase_add_test(tc_core, findSmallStringSmallStringGT); 16342 tcase_add_test(tc_core, indexOfSmallStringGT); 16343 tcase_add_test(tc_core, indexOfCharSmallStringGT); 16344 tcase_add_test(tc_core, indexOfSmallJsonSmallStringGT); 16345 tcase_add_test(tc_core, indexOfSmallStringSmallStringGT); 16346 tcase_add_test(tc_core, icHasSmallStringGT); 16347 tcase_add_test(tc_core, icHasCharSmallStringGT); 16348 tcase_add_test(tc_core, icHasSmallJsonSmallStringGT); 16349 tcase_add_test(tc_core, icHasSmallStringSmallStringGT); 16350 tcase_add_test(tc_core, icFindSmallStringGT); 16351 tcase_add_test(tc_core, icFindCharSmallStringGT); 16352 tcase_add_test(tc_core, icFindSmallJsonSmallStringGT); 16353 tcase_add_test(tc_core, icFindSmallStringSmallStringGT); 16354 tcase_add_test(tc_core, icIndexOfSmallStringGT); 16355 tcase_add_test(tc_core, icIndexOfCharSmallStringGT); 16356 tcase_add_test(tc_core, icIndexOfSmallJsonSmallStringGT); 16357 tcase_add_test(tc_core, icIndexOfSmallStringSmallStringGT); 16358 tcase_add_test(tc_core, emptySmallStringGT); 16359 tcase_add_test(tc_core, isEmptySmallStringGT); 16360 tcase_add_test(tc_core, isBlankSmallStringGT); 16361 tcase_add_test(tc_core, splitSmallStringGT); 16362 tcase_add_test(tc_core, splitCharSmallStringGT); 16363 tcase_add_test(tc_core, splitSmallJsonSmallStringGT); 16364 tcase_add_test(tc_core, splitSmallStringSmallStringGT); 16365 tcase_add_test(tc_core, splitCharPSSmallStringGT); 16366 tcase_add_test(tc_core, splitCharSSmallStringGT); 16367 tcase_add_test(tc_core, splitSmallJsonSSmallStringGT); 16368 tcase_add_test(tc_core, splitSmallStringSSmallStringGT); 16369 tcase_add_test(tc_core, extractSmallStringGT); 16370 tcase_add_test(tc_core, extractCharSSmallStringGT); 16371 tcase_add_test(tc_core, extractSCharSmallStringGT); 16372 tcase_add_test(tc_core, extractCharCharSmallStringGT); 16373 tcase_add_test(tc_core, extractSmallJsonSmallJsonSmallStringGT); 16374 tcase_add_test(tc_core, extractSmallJsonSmallStringSmallStringGT); 16375 tcase_add_test(tc_core, extractSmallJsonSSmallStringGT); 16376 tcase_add_test(tc_core, extractSmallJsonCharSmallStringGT); 16377 tcase_add_test(tc_core, extractSmallStringSmallJsonSmallStringGT); 16378 tcase_add_test(tc_core, extractSmallStringSmallStringSmallStringGT); 16379 tcase_add_test(tc_core, extractSmallStringSSmallStringGT); 16380 tcase_add_test(tc_core, extractSmallStringCharSmallStringGT); 16381 tcase_add_test(tc_core, extractSSmallJsonSmallStringGT); 16382 tcase_add_test(tc_core, extractSSmallStringSmallStringGT); 16383 tcase_add_test(tc_core, extractCharSmallJsonSmallStringGT); 16384 tcase_add_test(tc_core, extractCharSmallStringSmallStringGT); 16385 tcase_add_test(tc_core, icSplitSmallStringGT); 16386 tcase_add_test(tc_core, icSplitCharSmallStringGT); 16387 tcase_add_test(tc_core, icSplitSmallJsonSmallStringGT); 16388 tcase_add_test(tc_core, icSplitSmallStringSmallStringGT); 16389 tcase_add_test(tc_core, icSplitCharPSSmallStringGT); 16390 tcase_add_test(tc_core, icSplitCharSSmallStringGT); 16391 tcase_add_test(tc_core, icSplitSmallJsonSSmallStringGT); 16392 tcase_add_test(tc_core, icSplitSmallStringSSmallStringGT); 16393 tcase_add_test(tc_core, icExtractSmallStringGT); 16394 tcase_add_test(tc_core, icExtractCharSSmallStringGT); 16395 tcase_add_test(tc_core, icExtractSCharSmallStringGT); 16396 tcase_add_test(tc_core, icExtractCharCharSmallStringGT); 16397 tcase_add_test(tc_core, icExtractSmallJsonSmallJsonSmallStringGT); 16398 tcase_add_test(tc_core, icExtractSmallJsonSmallStringSmallStringGT); 16399 tcase_add_test(tc_core, icExtractSmallJsonSSmallStringGT); 16400 tcase_add_test(tc_core, icExtractSmallJsonCharSmallStringGT); 16401 tcase_add_test(tc_core, icExtractSmallStringSmallJsonSmallStringGT); 16402 tcase_add_test(tc_core, icExtractSmallStringSmallStringSmallStringGT); 16403 tcase_add_test(tc_core, icExtractSmallStringSSmallStringGT); 16404 tcase_add_test(tc_core, icExtractSmallStringCharSmallStringGT); 16405 tcase_add_test(tc_core, icExtractSSmallJsonSmallStringGT); 16406 tcase_add_test(tc_core, icExtractSSmallStringSmallStringGT); 16407 tcase_add_test(tc_core, icExtractCharSmallJsonSmallStringGT); 16408 tcase_add_test(tc_core, icExtractCharSmallStringSmallStringGT); 16409 tcase_add_test(tc_core, readFileSmallStringGT); 16410 tcase_add_test(tc_core, readFileSmallJsonSmallStringGT); 16411 tcase_add_test(tc_core, readFileSmallStringSmallStringGT); 16412 tcase_add_test(tc_core, readStreamSmallStringGT); 16413 tcase_add_test(tc_core, writeFileSmallStringGT); 16414 tcase_add_test(tc_core, writeFileSmallJsonSmallStringGT); 16415 tcase_add_test(tc_core, writeFileSmallStringSmallStringGT); 16416 tcase_add_test(tc_core, writeStreamSmallStringGT); 16417 tcase_add_test(tc_core, appendFileSmallStringFGT); 16418 tcase_add_test(tc_core, appendFileSmallStringSmallStringGT); 16419 16420 suite_add_tcase(s, tc_core); 16421 16422 return s; 16423 } 16424 16425 int main(int ARGC UNUSED, char** ARGV UNUSED) { 16426 int number_failed; 16427 Suite *s; 16428 SRunner *sr; 16429 16430 s = libsheepySuite(); 16431 sr = srunner_create(s); 16432 16433 srunner_run_all(sr, CK_NORMAL); 16434 number_failed = srunner_ntests_failed(sr); 16435 srunner_free(sr); 16436 16437 exit((number_failed == 0) ? EXIT_SUCCESS : EXIT_FAILURE); 16438 } 16439 // vim: set expandtab ts=2 sw=2: