libsheepyCSmallStringTestMem.c (403920B)
1 #include <stdlib.h> 2 #include <stdio.h> 3 #include <string.h> 4 5 #define ck_assert_str_eq(a,b) a;b; 6 #define ck_assert_str_ne(a,b) a;b; 7 #define ck_assert_ptr_eq(a,b) a;b; 8 #define ck_assert_ptr_ne(a,b) a;b; 9 #define ck_assert_uint_eq(a,b) a;b; 10 #define ck_assert_uint_ne(a,b) a;b; 11 #define ck_assert_int_eq(a,b) a;b; 12 #define ck_assert_int_ne(a,b) a;b; 13 #define ck_assert(a) a; 14 15 16 #include "../libsheepy.h" 17 #include "../libsheepyObject.h" 18 19 #ifdef __GNUC__ 20 #define UNUSED __attribute__ ((unused)) 21 #else 22 #define UNUSED 23 #endif 24 25 // TODO redirect stderr 26 27 28 void initiateSmallStringT(void) { 29 30 smallStringt self; 31 32 initiateSmallString(&self); 33 34 } 35 36 37 void initiateAllocateSmallStringT(void) { 38 39 smallStringt *self = null; 40 41 initiateAllocateSmallString(&self); 42 terminateO(self); 43 44 } 45 46 47 void allocSmallStringT(void) { 48 49 smallStringt* r; 50 51 r = allocSmallString("qwe"); 52 ck_assert_ptr_ne(r, null); 53 char *s = toStringO(r); 54 ck_assert_str_eq(s, "qwe"); 55 free(s); 56 terminateO(r); 57 58 } 59 60 61 void createSFT(void) { 62 63 smallStringt* r; 64 65 r = createS("qwe", "123", "!@#"); 66 ck_assert_ptr_ne(r, null); 67 char *s = toStringO(r); 68 ck_assert_str_eq(s, "qwe123!@#"); 69 free(s); 70 terminateO(r); 71 72 73 } 74 75 76 void freeSmallStringT(void) { 77 78 smallStringt *self = allocG("qwe"); 79 80 freeO(self); 81 ck_assert_ptr_eq(toStringO(self), null); 82 terminateO(self); 83 84 } 85 86 87 void terminateSmallStringT(void) { 88 89 smallStringt *self = allocG(""); 90 91 terminateO(self); 92 ck_assert_ptr_eq(self, null); 93 94 } 95 96 97 void toStringSmallStringT(void) { 98 99 char* r; 100 smallStringt *self = allocG("qwe"); 101 102 r = toStringO(self); 103 ck_assert_str_eq(r, "qwe"); 104 free(r); 105 freeO(self); 106 ck_assert_ptr_eq(toStringO(self), null); 107 terminateO(self); 108 109 } 110 111 112 void duplicateSmallStringT(void) { 113 114 smallStringt* r; 115 smallStringt *self = allocG("qwe"); 116 117 r = duplicateO(self); 118 ck_assert_ptr_ne(r, null); 119 char *s = toStringO(r); 120 ck_assert_str_eq(s, "qwe"); 121 free(s); 122 terminateO(r); 123 // empty object 124 freeO(self); 125 r = duplicateO(self); 126 ck_assert_ptr_ne(r, null); 127 ck_assert_ptr_eq(toStringO(r), null); 128 terminateO(r); 129 terminateO(self); 130 131 } 132 133 134 void smashSmallStringT(void) { 135 136 smallStringt *self = allocG(""); 137 138 freeO(self); 139 smashO(self); 140 141 } 142 143 144 void finishSmallStringT(void) { 145 146 smallStringt *self = allocG(""); 147 148 freeO(self); 149 finishO(self); 150 151 } 152 153 154 void getSmallStringT(void) { 155 156 char* r; 157 smallStringt *self = allocG(""); 158 159 r = getValO(self); 160 ck_assert_ptr_ne(r, null); 161 ck_assert_str_eq(r, ""); 162 // empty object 163 freeO(self); 164 r = getValO(self); 165 ck_assert_ptr_eq(r, null); 166 terminateO(self); 167 168 } 169 170 171 void setSmallStringT(void) { 172 173 smallStringt* r; 174 smallStringt *self = allocG(""); 175 176 r = setValO(self, "qwe"); 177 ck_assert_ptr_ne(r, null); 178 char *s = toStringO(r); 179 ck_assert_str_eq(s, "qwe"); 180 free(s); 181 // null 182 r = setValO(self, null); 183 ck_assert_ptr_eq(r, null); 184 terminateO(self); 185 186 } 187 188 189 void setCharSmallStringT(void) { 190 191 smallStringt* r; 192 smallStringt *self = allocG(""); 193 194 r = self->f->setChar(self, 'q'); 195 ck_assert_ptr_ne(r, null); 196 char *s = toStringO(r); 197 ck_assert_str_eq(s, "q"); 198 free(s); 199 terminateO(self); 200 201 } 202 203 204 void setBoolSmallStringT(void) { 205 206 smallStringt* r; 207 smallStringt* self = allocG(""); 208 209 r = self->f->setBool(self, false); 210 ck_assert_ptr_ne(r, null); 211 char *s = toStringO(r); 212 ck_assert_str_eq(s, "false"); 213 free(s); 214 r = self->f->setBool(self, true); 215 ck_assert_ptr_ne(r, null); 216 s = toStringO(r); 217 ck_assert_str_eq(s, "true"); 218 free(s); 219 terminateO(self); 220 221 } 222 223 224 void setDoubleSmallStringT(void) { 225 226 smallStringt* r; 227 smallStringt* self = allocG(""); 228 229 r = self->f->setDouble(self, 2.2); 230 ck_assert_ptr_ne(r, null); 231 char *s = toStringO(r); 232 ck_assert_str_eq(s, "2.200000e+00"); 233 free(s); 234 terminateO(self); 235 236 } 237 238 239 void setInt64SmallStringT(void) { 240 241 smallStringt* r; 242 smallStringt* self = allocG(""); 243 244 r = self->f->setInt64(self, 2); 245 ck_assert_ptr_ne(r, null); 246 char *s = toStringO(r); 247 ck_assert_str_eq(s, "2"); 248 free(s); 249 terminateO(self); 250 251 } 252 253 254 void setInt32SmallStringT(void) { 255 256 smallStringt* r; 257 smallStringt* self = allocG(""); 258 259 r = self->f->setInt32(self, 2); 260 ck_assert_ptr_ne(r, null); 261 char *s = toStringO(r); 262 ck_assert_str_eq(s, "2"); 263 free(s); 264 terminateO(self); 265 266 } 267 268 269 void setUint32SmallStringT(void) { 270 271 smallStringt* r; 272 smallStringt* self = allocG(""); 273 274 r = self->f->setUint32(self, 2); 275 ck_assert_ptr_ne(r, null); 276 char *s = toStringO(r); 277 ck_assert_str_eq(s, "2"); 278 free(s); 279 terminateO(self); 280 281 } 282 283 284 void setUint64SmallStringT(void) { 285 286 smallStringt* r; 287 smallStringt* self = allocG(""); 288 289 r = self->f->setUint64(self, 2); 290 ck_assert_ptr_ne(r, null); 291 char *s = toStringO(r); 292 ck_assert_str_eq(s, "2"); 293 free(s); 294 terminateO(self); 295 296 } 297 298 299 void setSmallArraySmallStringT(void) { 300 301 smallStringt* r; 302 smallStringt* self = allocG(""); 303 smallArrayt* p2 = allocSmallArray(); 304 305 p2->f->pushS(p2, "asd"); 306 r = self->f->setSmallArray(self, p2); 307 ck_assert_ptr_ne(r, null); 308 char *s = toStringO(r); 309 ck_assert_str_eq(s, "[\"asd\"]"); 310 free(s); 311 terminateO(p2); 312 // not smallArray object 313 p2 = (smallArrayt*) allocSmallInt(1); 314 r = self->f->setSmallArray(self, p2); 315 ck_assert_ptr_eq(r, null); 316 terminateO(p2); 317 // null parameter 318 r = self->f->setSmallArray(self, null); 319 ck_assert_ptr_eq(r, null); 320 terminateO(self); 321 322 } 323 324 325 void setFromSmallDictSmallStringT(void) { 326 327 smallStringt* r; 328 smallStringt* self = allocG(""); 329 smallDictt* p2 = allocSmallDict(); 330 331 p2->f->setS(p2, "1", "asd"); 332 r = self->f->setFromSmallDict(self, p2); 333 ck_assert_ptr_ne(r, null); 334 char *s = toStringO(r); 335 ck_assert_str_eq(s, "{\"1\":\"asd\"}"); 336 free(s); 337 terminateO(p2); 338 // not smallDict object 339 p2 = (smallDictt*) allocSmallInt(1); 340 r = self->f->setFromSmallDict(self, p2); 341 ck_assert_ptr_eq(r, null); 342 terminateO(p2); 343 // null parameter 344 r = self->f->setFromSmallDict(self, null); 345 ck_assert_ptr_eq(r, null); 346 terminateO(self); 347 348 } 349 350 351 void setFromSmallJsonSmallStringT(void) { 352 353 smallStringt* r; 354 smallStringt* self = allocG(""); 355 smallJsont* p2 = allocSmallJson(); 356 357 p2->f->setS(p2, "1", "asd"); 358 r = self->f->setFromSmallJson(self, p2); 359 ck_assert_ptr_ne(r, null); 360 char *s = toStringO(r); 361 ck_assert_str_eq(s, "{\"1\":\"asd\"}"); 362 free(s); 363 terminateO(p2); 364 // not smallJson object 365 p2 = (smallJsont*) allocSmallInt(1); 366 r = self->f->setFromSmallJson(self, p2); 367 ck_assert_ptr_eq(r, null); 368 terminateO(p2); 369 // null parameter 370 r = self->f->setFromSmallJson(self, null); 371 ck_assert_ptr_eq(r, null); 372 terminateO(self); 373 374 } 375 376 377 void setSmallBoolSmallStringT(void) { 378 379 smallStringt* r; 380 smallStringt* self = allocG(""); 381 smallBoolt* p2 = allocSmallBool(true); 382 383 r = self->f->setSmallBool(self, p2); 384 ck_assert_ptr_ne(r, null); 385 char *s = toStringO(r); 386 ck_assert_str_eq(s, "true"); 387 free(s); 388 terminateO(p2); 389 // not smallBool object 390 p2 = (smallBoolt*) allocSmallInt(1); 391 r = self->f->setSmallBool(self, p2); 392 ck_assert_ptr_eq(r, null); 393 terminateO(p2); 394 // null parameter 395 r = self->f->setSmallBool(self, null); 396 ck_assert_ptr_eq(r, null); 397 terminateO(self); 398 399 } 400 401 402 void setSmallDoubleSmallStringT(void) { 403 404 smallStringt* r; 405 smallStringt* self = allocG(""); 406 smallDoublet* p2 = allocSmallDouble(2.2); 407 408 r = self->f->setSmallDouble(self, p2); 409 ck_assert_ptr_ne(r, null); 410 char *s = toStringO(r); 411 ck_assert_str_eq(s, "2.200000e+00"); 412 free(s); 413 terminateO(p2); 414 // not smallDouble object 415 p2 = (smallDoublet*) allocSmallInt(1); 416 r = self->f->setSmallDouble(self, p2); 417 ck_assert_ptr_eq(r, null); 418 terminateO(p2); 419 // null parameter 420 r = self->f->setSmallDouble(self, null); 421 ck_assert_ptr_eq(r, null); 422 terminateO(self); 423 424 } 425 426 427 void setSmallIntSmallStringT(void) { 428 429 smallStringt* r; 430 smallStringt* self = allocG(""); 431 smallIntt* p2 = allocSmallInt(2); 432 433 r = self->f->setSmallInt(self, p2); 434 ck_assert_ptr_ne(r, null); 435 char *s = toStringO(r); 436 ck_assert_str_eq(s, "2"); 437 free(s); 438 terminateO(p2); 439 // not smallInt object 440 p2 = (smallIntt*) allocSmallJson(); 441 r = self->f->setSmallInt(self, p2); 442 ck_assert_ptr_eq(r, null); 443 terminateO(p2); 444 // null parameter 445 r = self->f->setSmallInt(self, null); 446 ck_assert_ptr_eq(r, null); 447 terminateO(self); 448 449 } 450 451 452 void setSmallJsonSmallStringT(void) { 453 454 smallStringt* r; 455 smallStringt* self = allocG("qwe"); 456 smallJsont* p2 = allocSmallJson(); 457 458 // undefined 459 createUndefined(u); 460 setTopO(p2, (baset*)&u); 461 r = self->f->setSmallJson(self, p2); 462 ck_assert_ptr_ne(r, null); 463 char *s = toStringO(r); 464 ck_assert_str_eq(s, "qwe"); 465 free(s); 466 freeO(p2); 467 // bool 468 setTopBoolO(p2, true); 469 r = self->f->setSmallJson(self, p2); 470 ck_assert_ptr_ne(r, null); 471 s = toStringO(r); 472 ck_assert_str_eq(s, "true"); 473 free(s); 474 freeO(p2); 475 // double 476 setTopDoubleO(p2, 2.2); 477 r = self->f->setSmallJson(self, p2); 478 ck_assert_ptr_ne(r, null); 479 s = toStringO(r); 480 ck_assert_str_eq(s, "2.200000e+00"); 481 free(s); 482 freeO(p2); 483 // int 484 setTopIntO(p2, 2); 485 r = self->f->setSmallJson(self, p2); 486 ck_assert_ptr_ne(r, null); 487 s = toStringO(r); 488 ck_assert_str_eq(s, "2"); 489 free(s); 490 freeO(p2); 491 // string 492 setTopStringO(p2, "qwe"); 493 r = self->f->setSmallJson(self, p2); 494 ck_assert_ptr_ne(r, null); 495 s = toStringO(r); 496 ck_assert_str_eq(s, "qwe"); 497 free(s); 498 freeO(p2); 499 // dict 500 createSmallDict(d); 501 setTopDictO(p2, &d); 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 // array 509 createSmallArray(a); 510 setTopArrayO(p2, &a); 511 r = self->f->setSmallJson(self, p2); 512 ck_assert_ptr_ne(r, null); 513 s = toStringO(r); 514 ck_assert_str_eq(s, "[]"); 515 free(s); 516 freeO(p2); 517 // empty p2 object 518 r = self->f->setSmallJson(self, p2); 519 ck_assert_ptr_ne(r, null); 520 s = toStringO(r); 521 ck_assert_str_eq(s, "[]"); 522 free(s); 523 finishO(p2); 524 // not smallJson object 525 p2 = (smallJsont*) allocSmallInt(1); 526 r = self->f->setSmallJson(self, p2); 527 ck_assert_ptr_eq(r, null); 528 terminateO(p2); 529 // null parameter 530 r = self->f->setSmallJson(self, null); 531 ck_assert_ptr_eq(r, null); 532 terminateO(self); 533 534 } 535 536 537 void setSmallStringSmallStringT(void) { 538 539 smallStringt* r; 540 smallStringt* self = allocG(""); 541 smallStringt* p2 = allocSmallString("qwe"); 542 543 r = self->f->setSmallString(self, p2); 544 ck_assert_ptr_ne(r, null); 545 char *s = toStringO(r); 546 ck_assert_str_eq(s, "qwe"); 547 free(s); 548 terminateO(p2); 549 // not smallString object 550 p2 = (smallStringt*) allocSmallInt(1); 551 r = self->f->setSmallString(self, p2); 552 ck_assert_ptr_eq(r, null); 553 terminateO(p2); 554 // null parameter 555 r = self->f->setSmallString(self, null); 556 ck_assert_ptr_eq(r, null); 557 terminateO(self); 558 559 } 560 561 562 void setNFreeSmallStringT(void) { 563 564 smallStringt* r; 565 smallStringt *self = allocG(""); 566 567 r = self->f->setNFree(self, strdup("qwe")); 568 ck_assert_ptr_ne(r, null); 569 char *s = toStringO(r); 570 ck_assert_str_eq(s, "qwe"); 571 free(s); 572 // null parameter 573 r = self->f->setNFree(self, null); 574 ck_assert_ptr_eq(r, null); 575 terminateO(self); 576 577 } 578 579 580 void appendSmallStringT(void) { 581 582 smallStringt* r; 583 smallStringt *self = allocG("qwe"); 584 smallStringt *string = allocSmallString("!@#"); 585 586 r = appendO(self, string); 587 ck_assert_ptr_ne(r, null); 588 char *s = toStringO(r); 589 ck_assert_str_eq(s, "qwe!@#"); 590 free(s); 591 // empty string 592 setValO(string, ""); 593 r = appendO(self, string); 594 ck_assert_ptr_ne(r, null); 595 s = toStringO(r); 596 ck_assert_str_eq(s, "qwe!@#"); 597 free(s); 598 freeO(string); 599 r = appendO(self, string); 600 ck_assert_ptr_ne(r, null); 601 s = toStringO(r); 602 ck_assert_str_eq(s, "qwe!@#"); 603 free(s); 604 // empty self 605 freeO(self); 606 setValO(string, "asd"); 607 r = appendO(self, string); 608 ck_assert_ptr_ne(r, null); 609 s = toStringO(r); 610 ck_assert_str_eq(s, "asd"); 611 free(s); 612 terminateO(string); 613 // not smallString object 614 string = (smallStringt*) allocSmallInt(1); 615 r = appendO(self, string); 616 ck_assert_ptr_eq(r, null); 617 terminateO(string); 618 // null parameter 619 r = appendO(self, null); 620 ck_assert_ptr_eq(r, null); 621 terminateO(self); 622 623 } 624 625 626 void appendSmallJsonSmallStringT(void) { 627 628 smallStringt* r; 629 smallStringt *self = allocG("qwe"); 630 smallJsont *string = allocSmallJson(); 631 632 setTopSO(string, "!@#"); 633 r = self->f->appendSmallJson(self, string); 634 ck_assert_ptr_ne(r, null); 635 char *s = toStringO(r); 636 ck_assert_str_eq(s, "qwe!@#"); 637 free(s); 638 // empty string 639 freeO(string); 640 setTopSO(string, ""); 641 r = self->f->appendSmallJson(self, string); 642 ck_assert_ptr_ne(r, null); 643 s = toStringO(r); 644 ck_assert_str_eq(s, "qwe!@#"); 645 free(s); 646 // not json string 647 freeO(string); 648 setTopBoolO(string, true); 649 r = self->f->appendSmallJson(self, string); 650 ck_assert_ptr_eq(r, null); 651 terminateO(string); 652 // not smallString object 653 string = (smallJsont*) allocSmallInt(1); 654 r = self->f->appendSmallJson(self, string); 655 ck_assert_ptr_eq(r, null); 656 terminateO(string); 657 // null parameter 658 r = self->f->appendSmallJson(self, null); 659 ck_assert_ptr_eq(r, null); 660 terminateO(self); 661 662 } 663 664 665 void appendNSmashSmallStringT(void) { 666 667 smallStringt* r; 668 smallStringt *self = allocG("qwe"); 669 smallStringt *string = allocSmallString("!@#"); 670 671 r = appendNSmashO(self, string); 672 ck_assert_ptr_ne(r, null); 673 char *s = toStringO(r); 674 ck_assert_str_eq(s, "qwe!@#"); 675 free(s); 676 // empty string 677 string = allocSmallString(""); 678 r = appendNSmashO(self, string); 679 ck_assert_ptr_ne(r, null); 680 s = toStringO(r); 681 ck_assert_str_eq(s, "qwe!@#"); 682 free(s); 683 string = allocSmallString(""); 684 freeO(string); 685 r = appendNSmashO(self, string); 686 ck_assert_ptr_ne(r, null); 687 s = toStringO(r); 688 ck_assert_str_eq(s, "qwe!@#"); 689 free(s); 690 // empty self 691 freeO(self); 692 string = allocSmallString("asd"); 693 r = appendNSmashO(self, string); 694 ck_assert_ptr_ne(r, null); 695 s = toStringO(r); 696 ck_assert_str_eq(s, "asd"); 697 free(s); 698 // not smallString object 699 string = (smallStringt*) allocSmallInt(1); 700 r = appendNSmashO(self, string); 701 ck_assert_ptr_eq(r, null); 702 terminateO(string); 703 // null parameter 704 r = appendNSmashO(self, null); 705 ck_assert_ptr_eq(r, null); 706 terminateO(self); 707 708 } 709 710 711 void appendSSmallStringT(void) { 712 713 smallStringt* r; 714 smallStringt *self = allocG("qwe"); 715 716 r = self->f->appendS(self, "!@#"); 717 ck_assert_ptr_ne(r, null); 718 char *s = toStringO(r); 719 ck_assert_str_eq(s, "qwe!@#"); 720 free(s); 721 // empty string 722 r = self->f->appendS(self, ""); 723 ck_assert_ptr_ne(r, null); 724 s = toStringO(r); 725 ck_assert_str_eq(s, "qwe!@#"); 726 free(s); 727 // empty self 728 freeO(self); 729 r = self->f->appendS(self, "asd"); 730 ck_assert_ptr_ne(r, null); 731 s = toStringO(r); 732 ck_assert_str_eq(s, "asd"); 733 free(s); 734 // null parameter 735 r = self->f->appendS(self, null); 736 ck_assert_ptr_eq(r, null); 737 terminateO(self); 738 739 } 740 741 742 void appendCharSmallStringT(void) { 743 744 smallStringt* r; 745 smallStringt *self = allocG("qwe"); 746 747 r = appendCharO(self, '!'); 748 ck_assert_ptr_ne(r, null); 749 char *s = toStringO(r); 750 ck_assert_str_eq(s, "qwe!"); 751 free(s); 752 terminateO(self); 753 754 } 755 756 757 void appendNSmashSmallJsonSmallStringT(void) { 758 759 smallStringt* r; 760 smallStringt *self = allocG("qwe"); 761 smallJsont *string = allocSmallJson(); 762 763 setTopSO(string, "!@#"); 764 r = self->f->appendNSmashSmallJson(self, string); 765 ck_assert_ptr_ne(r, null); 766 char *s = toStringO(r); 767 ck_assert_str_eq(s, "qwe!@#"); 768 free(s); 769 // empty string 770 string = allocSmallJson(); 771 setTopSO(string, ""); 772 r = self->f->appendNSmashSmallJson(self, string); 773 ck_assert_ptr_ne(r, null); 774 s = toStringO(r); 775 ck_assert_str_eq(s, "qwe!@#"); 776 free(s); 777 string = allocSmallJson(); 778 setTypeStringO(string); 779 r = self->f->appendNSmashSmallJson(self, string); 780 ck_assert_ptr_ne(r, null); 781 s = toStringO(r); 782 ck_assert_str_eq(s, "qwe!@#"); 783 free(s); 784 // not json string 785 string = allocSmallJson(); 786 setTopBoolO(string, true); 787 r = self->f->appendNSmashSmallJson(self, string); 788 ck_assert_ptr_eq(r, null); 789 terminateO(string); 790 // not smallString object 791 string = (smallJsont*) allocSmallInt(1); 792 r = self->f->appendNSmashSmallJson(self, string); 793 ck_assert_ptr_eq(r, null); 794 terminateO(string); 795 // null parameter 796 r = self->f->appendNSmashSmallJson(self, null); 797 ck_assert_ptr_eq(r, null); 798 terminateO(self); 799 800 } 801 802 803 void appendNSmashSSmallStringT(void) { 804 805 smallStringt* r; 806 smallStringt *self = allocG("qwe"); 807 808 r = appendNSmashSO(self, strdup("!@#")); 809 ck_assert_ptr_ne(r, null); 810 char *s = toStringO(r); 811 ck_assert_str_eq(s, "qwe!@#"); 812 free(s); 813 // empty string 814 r = appendNSmashSO(self, strdup("")); 815 ck_assert_ptr_ne(r, null); 816 s = toStringO(r); 817 ck_assert_str_eq(s, "qwe!@#"); 818 free(s); 819 // empty self 820 freeO(self); 821 r = appendNSmashSO(self, strdup("asd")); 822 ck_assert_ptr_ne(r, null); 823 s = toStringO(r); 824 ck_assert_str_eq(s, "asd"); 825 free(s); 826 // null parameter 827 r = appendNSmashSO(self, null); 828 ck_assert_ptr_eq(r, null); 829 terminateO(self); 830 831 } 832 833 834 void prependSmallStringT(void) { 835 836 smallStringt* r; 837 smallStringt *self = allocG("qwe"); 838 smallStringt *string = allocSmallString("!@#"); 839 840 r = prependO(self, string); 841 ck_assert_ptr_ne(r, null); 842 char *s = toStringO(r); 843 ck_assert_str_eq(s, "!@#qwe"); 844 free(s); 845 // empty string 846 setValO(string, ""); 847 r = prependO(self, string); 848 ck_assert_ptr_ne(r, null); 849 s = toStringO(r); 850 ck_assert_str_eq(s, "!@#qwe"); 851 free(s); 852 freeO(string); 853 r = prependO(self, string); 854 ck_assert_ptr_ne(r, null); 855 s = toStringO(r); 856 ck_assert_str_eq(s, "!@#qwe"); 857 free(s); 858 // empty self 859 freeO(self); 860 setValO(string, "asd"); 861 r = prependO(self, string); 862 ck_assert_ptr_ne(r, null); 863 s = toStringO(r); 864 ck_assert_str_eq(s, "asd"); 865 free(s); 866 terminateO(string); 867 // not smallString object 868 string = (smallStringt*) allocSmallInt(1); 869 r = prependO(self, string); 870 ck_assert_ptr_eq(r, null); 871 terminateO(string); 872 // null parameter 873 r = prependO(self, null); 874 ck_assert_ptr_eq(r, null); 875 terminateO(self); 876 877 } 878 879 880 void prependSmallJsonSmallStringT(void) { 881 882 smallStringt* r; 883 smallStringt *self = allocG("qwe"); 884 smallJsont *string = allocSmallJson(); 885 886 setTopSO(string, "!@#"); 887 r = self->f->prependSmallJson(self, string); 888 ck_assert_ptr_ne(r, null); 889 char *s = toStringO(r); 890 ck_assert_str_eq(s, "!@#qwe"); 891 free(s); 892 // empty string 893 freeO(string); 894 setTopSO(string, ""); 895 r = self->f->prependSmallJson(self, string); 896 ck_assert_ptr_ne(r, null); 897 s = toStringO(r); 898 ck_assert_str_eq(s, "!@#qwe"); 899 free(s); 900 // not json string 901 freeO(string); 902 setTopBoolO(string, true); 903 r = self->f->prependSmallJson(self, string); 904 ck_assert_ptr_eq(r, null); 905 terminateO(string); 906 // not smallString object 907 string = (smallJsont*) allocSmallInt(1); 908 r = self->f->prependSmallJson(self, string); 909 ck_assert_ptr_eq(r, null); 910 terminateO(string); 911 // null parameter 912 r = self->f->prependSmallJson(self, null); 913 ck_assert_ptr_eq(r, null); 914 terminateO(self); 915 916 } 917 918 919 void prependNSmashSmallStringT(void) { 920 921 smallStringt* r; 922 smallStringt *self = allocG("qwe"); 923 smallStringt *string = allocSmallString("!@#"); 924 925 r = prependNSmashO(self, string); 926 ck_assert_ptr_ne(r, null); 927 char *s = toStringO(r); 928 ck_assert_str_eq(s, "!@#qwe"); 929 free(s); 930 // empty string 931 string = allocSmallString(""); 932 r = prependNSmashO(self, string); 933 ck_assert_ptr_ne(r, null); 934 s = toStringO(r); 935 ck_assert_str_eq(s, "!@#qwe"); 936 free(s); 937 string = allocSmallString(""); 938 freeO(string); 939 r = prependNSmashO(self, string); 940 ck_assert_ptr_ne(r, null); 941 s = toStringO(r); 942 ck_assert_str_eq(s, "!@#qwe"); 943 free(s); 944 // empty self 945 freeO(self); 946 string = allocSmallString("asd"); 947 r = prependNSmashO(self, string); 948 ck_assert_ptr_ne(r, null); 949 s = toStringO(r); 950 ck_assert_str_eq(s, "asd"); 951 free(s); 952 // not smallString object 953 string = (smallStringt*) allocSmallInt(1); 954 r = prependNSmashO(self, string); 955 ck_assert_ptr_eq(r, null); 956 terminateO(string); 957 // null parameter 958 r = prependNSmashO(self, null); 959 ck_assert_ptr_eq(r, null); 960 terminateO(self); 961 962 } 963 964 965 void prependNSmashSmallJsonSmallStringT(void) { 966 967 smallStringt* r; 968 smallStringt *self = allocG("qwe"); 969 smallJsont *string = allocSmallJson(); 970 971 setTopSO(string, "!@#"); 972 r = prependNSmashSmallJsonO(self, string); 973 ck_assert_ptr_ne(r, null); 974 char *s = toStringO(r); 975 ck_assert_str_eq(s, "!@#qwe"); 976 free(s); 977 // empty string 978 string = allocSmallJson(); 979 setTopSO(string, ""); 980 r = prependNSmashSmallJsonO(self, string); 981 ck_assert_ptr_ne(r, null); 982 s = toStringO(r); 983 ck_assert_str_eq(s, "!@#qwe"); 984 free(s); 985 string = allocSmallJson(); 986 setTypeStringO(string); 987 r = prependNSmashSmallJsonO(self, string); 988 ck_assert_ptr_ne(r, null); 989 s = toStringO(r); 990 ck_assert_str_eq(s, "!@#qwe"); 991 free(s); 992 // not json string 993 string = allocSmallJson(); 994 setTopBoolO(string, true); 995 r = prependNSmashSmallJsonO(self, string); 996 ck_assert_ptr_eq(r, null); 997 terminateO(string); 998 // not smallString object 999 string = (smallJsont*) allocSmallInt(1); 1000 r = prependNSmashSmallJsonO(self, string); 1001 ck_assert_ptr_eq(r, null); 1002 terminateO(string); 1003 // null parameter 1004 r = prependNSmashSmallJsonO(self, null); 1005 ck_assert_ptr_eq(r, null); 1006 terminateO(self); 1007 1008 } 1009 1010 1011 void prependSSmallStringT(void) { 1012 1013 smallStringt* r; 1014 smallStringt *self = allocG("qwe"); 1015 1016 r = prependSO(self, "!@#"); 1017 ck_assert_ptr_ne(r, null); 1018 char *s = toStringO(r); 1019 ck_assert_str_eq(s, "!@#qwe"); 1020 free(s); 1021 // empty string 1022 r = prependSO(self, ""); 1023 ck_assert_ptr_ne(r, null); 1024 s = toStringO(r); 1025 ck_assert_str_eq(s, "!@#qwe"); 1026 free(s); 1027 // empty self 1028 freeO(self); 1029 r = prependSO(self, "asd"); 1030 ck_assert_ptr_ne(r, null); 1031 s = toStringO(r); 1032 ck_assert_str_eq(s, "asd"); 1033 free(s); 1034 // null parameter 1035 r = prependSO(self, null); 1036 ck_assert_ptr_eq(r, null); 1037 terminateO(self); 1038 1039 } 1040 1041 1042 void prependCharSmallStringT(void) { 1043 1044 smallStringt* r; 1045 smallStringt *self = allocG("qwe"); 1046 1047 r = prependCharO(self, '!'); 1048 ck_assert_ptr_ne(r, null); 1049 char *s = toStringO(r); 1050 ck_assert_str_eq(s, "!qwe"); 1051 free(s); 1052 terminateO(self); 1053 1054 } 1055 1056 1057 void prependNSmashSSmallStringT(void) { 1058 1059 smallStringt* r; 1060 smallStringt *self = allocG("qwe"); 1061 1062 r = prependNSmashSO(self, strdup("!@#")); 1063 ck_assert_ptr_ne(r, null); 1064 char *s = toStringO(r); 1065 ck_assert_str_eq(s, "!@#qwe"); 1066 free(s); 1067 // empty string 1068 r = prependNSmashSO(self, strdup("")); 1069 ck_assert_ptr_ne(r, null); 1070 s = toStringO(r); 1071 ck_assert_str_eq(s, "!@#qwe"); 1072 free(s); 1073 // empty self 1074 freeO(self); 1075 r = prependNSmashSO(self, strdup("asd")); 1076 ck_assert_ptr_ne(r, null); 1077 s = toStringO(r); 1078 ck_assert_str_eq(s, "asd"); 1079 free(s); 1080 // null parameter 1081 r = prependNSmashSO(self, null); 1082 ck_assert_ptr_eq(r, null); 1083 terminateO(self); 1084 1085 } 1086 1087 1088 void catSmallStringT(void) { 1089 1090 smallStringt* r; 1091 smallStringt *self = allocG("qwe"); 1092 1093 smallStringt *s1 = allocSmallString("123"); 1094 smallStringt *s2 = allocSmallString("456"); 1095 r = catO(self, s1, s2); 1096 ck_assert_ptr_ne(r, null); 1097 char *s = toStringO(r); 1098 ck_assert_str_eq(s, "qwe123456"); 1099 free(s); 1100 // non smallString object 1101 terminateO(s2); 1102 s2 = (smallStringt*) allocSmallInt(1); 1103 r = catO(self, s1, s2); 1104 ck_assert_ptr_eq(r, null); 1105 s = toStringO(self); 1106 ck_assert_str_eq(s, "qwe123456"); 1107 free(s); 1108 terminateO(s1); 1109 terminateO(s2); 1110 terminateO(self); 1111 1112 } 1113 1114 1115 void catSSmallStringT(void) { 1116 1117 smallStringt* r; 1118 smallStringt *self = allocG("qwe"); 1119 1120 r = catSO(self, "123", "456"); 1121 ck_assert_ptr_ne(r, null); 1122 char *s = toStringO(r); 1123 ck_assert_str_eq(s, "qwe123456"); 1124 free(s); 1125 terminateO(self); 1126 1127 } 1128 1129 1130 void pushNFreeManySmallStringT(void) { 1131 1132 smallStringt* r; 1133 smallStringt *self = allocG("qwe"); 1134 1135 smallStringt *s1 = allocSmallString("123"); 1136 smallStringt *s2 = allocSmallString("456"); 1137 r = pushNFreeManyO(self, s1, s2); 1138 ck_assert_ptr_ne(r, null); 1139 char *s = toStringO(r); 1140 ck_assert_str_eq(s, "qwe123456"); 1141 free(s); 1142 // non smallString object 1143 s1 = allocSmallString("123"); 1144 s2 = (smallStringt*) allocSmallInt(1); 1145 r = pushNFreeManyO(self, s1, s2); 1146 ck_assert_ptr_eq(r, null); 1147 s = toStringO(self); 1148 ck_assert_str_eq(s, "qwe123456"); 1149 free(s); 1150 terminateO(s2); 1151 terminateO(self); 1152 1153 } 1154 1155 1156 void pushNFreeManySSmallStringT(void) { 1157 1158 smallStringt* r; 1159 smallStringt *self = allocG("qwe"); 1160 1161 r = pushNFreeManySO(self, strdup("123"), strdup("456")); 1162 ck_assert_ptr_ne(r, null); 1163 char *s = toStringO(r); 1164 ck_assert_str_eq(s, "qwe123456"); 1165 free(s); 1166 terminateO(self); 1167 1168 } 1169 1170 1171 void replaceSmallStringT(void) { 1172 1173 smallStringt* r; 1174 smallStringt *self = allocG("#ee#ee#ad"); 1175 1176 // replace string, multiple character new delimeter 1177 r = replaceO(self, "#","^^", 0); 1178 ck_assert_ptr_ne(r, null); 1179 char *s = toStringO(r); 1180 ck_assert_str_eq(s, "^^ee^^ee^^ad"); 1181 free(s); 1182 // replace string, multiple character old delimeter 1183 setValO(self, "AA##ee##ee#"); 1184 r = replaceO(self, "##","|", 0); 1185 ck_assert_ptr_ne(r, null); 1186 s = toStringO(r); 1187 ck_assert_str_eq(s, "AA|ee|ee#"); 1188 free(s); 1189 // replace one time at the start of string 1190 setValO(self, "#ee#ee#ad"); 1191 r = replaceO(self, "#","^^",1); 1192 ck_assert_ptr_ne(r, null); 1193 s = toStringO(r); 1194 ck_assert_str_eq(s, "^^ee#ee#ad"); 1195 free(s); 1196 // replace one time 1197 setValO(self, "AA##ee##ee#"); 1198 r = replaceO(self, "##","|",1); 1199 ck_assert_ptr_ne(r, null); 1200 s = toStringO(r); 1201 ck_assert_str_eq(s, "AA|ee##ee#"); 1202 free(s); 1203 // NULL new delimiter, one time: same as empty delimiter 1204 setValO(self, "AA##ee##ee#"); 1205 r = replaceO(self, "##",NULL,1); 1206 ck_assert_ptr_ne(r, null); 1207 s = toStringO(r); 1208 ck_assert_str_eq(s, "AAee##ee#"); 1209 free(s); 1210 // empty string 1211 setValO(self, ""); 1212 r = replaceO(self, "##",NULL,1); 1213 ck_assert_ptr_ne(r, null); 1214 s = toStringO(r); 1215 ck_assert_str_eq(s, ""); 1216 free(s); 1217 // empty old delimiter 1218 setValO(self, "qwe"); 1219 ck_assert_ptr_eq(replaceO(self, "","|",1), NULL); 1220 // NULL old delimiter 1221 ck_assert_ptr_eq(replaceO(self, NULL,"|",1), NULL); 1222 // empty old delimiter 1223 ck_assert_ptr_eq(replaceO(self, "","|",1), NULL); 1224 // NULL string 1225 freeO(self); 1226 ck_assert_ptr_eq(replaceO(self, "##","|",1), NULL); 1227 terminateO(self); 1228 1229 } 1230 1231 1232 void replaceCharSSmallStringT(void) { 1233 1234 smallStringt* r; 1235 smallStringt *self = allocG(""); 1236 1237 // replace string, multiple character new delimeter 1238 setValO(self, "#ee#ee#ad"); 1239 r = replaceCharSO(self, '#',"^^", 0); 1240 ck_assert_ptr_ne(r, null); 1241 char *s = toStringO(r); 1242 ck_assert_str_eq(s, "^^ee^^ee^^ad"); 1243 free(s); 1244 // replace one time at the start of string 1245 setValO(self, "#ee#ee#ad"); 1246 r = replaceCharSO(self, '#',"^^",1); 1247 ck_assert_ptr_ne(r, null); 1248 s = toStringO(r); 1249 ck_assert_str_eq(s, "^^ee#ee#ad"); 1250 free(s); 1251 // replace one time 1252 setValO(self, "AA##ee##ee#"); 1253 r = replaceCharSO(self, '#',"|",1); 1254 ck_assert_ptr_ne(r, null); 1255 s = toStringO(r); 1256 ck_assert_str_eq(s, "AA|#ee##ee#"); 1257 free(s); 1258 // NULL new delimiter, one time: same as empty delimiter 1259 setValO(self, "AA#ee##ee#"); 1260 r = replaceCharSO(self, '#',NULL,1); 1261 ck_assert_ptr_ne(r, null); 1262 s = toStringO(r); 1263 ck_assert_str_eq(s, "AAee##ee#"); 1264 free(s); 1265 // empty string 1266 setValO(self, ""); 1267 r = replaceCharSO(self, '#',NULL,1); 1268 ck_assert_ptr_ne(r, null); 1269 s = toStringO(r); 1270 ck_assert_str_eq(s, ""); 1271 free(s); 1272 // empty old delimiter 1273 setValO(self, "qwe"); 1274 ck_assert_ptr_eq(replaceCharSO(self, 0,"|",1), NULL); 1275 // NULL string 1276 freeO(self); 1277 ck_assert_ptr_eq(replaceCharSO(self, '#',"|",1), NULL); 1278 terminateO(self); 1279 1280 } 1281 1282 1283 void replaceSCharSmallStringT(void) { 1284 1285 smallStringt* r; 1286 smallStringt *self = allocG(""); 1287 1288 // replace string, multiple character new delimeter 1289 setValO(self, "#ee#ee#ad"); 1290 r = replaceSCharO(self, "#",'^',0); 1291 ck_assert_ptr_ne(r, null); 1292 char *s = toStringO(r); 1293 ck_assert_str_eq(s, "^ee^ee^ad"); 1294 free(s); 1295 // replace string, multiple character old delimeter 1296 setValO(self, "AA##ee##ee#"); 1297 r = replaceSCharO(self, "##",'|',0); 1298 ck_assert_ptr_ne(r, null); 1299 s = toStringO(r); 1300 ck_assert_str_eq(s, "AA|ee|ee#"); 1301 free(s); 1302 // replace string empty char, multiple character old delimeter 1303 setValO(self, "AA##ee##ee#"); 1304 r = replaceSCharO(self, "##", 0,0); 1305 ck_assert_ptr_ne(r, null); 1306 s = toStringO(r); 1307 ck_assert_str_eq(s, "AAeeee#"); 1308 free(s); 1309 // replace one time at the start of string 1310 setValO(self, "#ee#ee#ad"); 1311 r = replaceSCharO(self, "#",'^',1); 1312 ck_assert_ptr_ne(r, null); 1313 s = toStringO(r); 1314 ck_assert_str_eq(s, "^ee#ee#ad"); 1315 free(s); 1316 // replace one time 1317 setValO(self, "AA##ee##ee#"); 1318 r = replaceSCharO(self, "##",'|',1); 1319 ck_assert_ptr_ne(r, null); 1320 s = toStringO(r); 1321 ck_assert_str_eq(s, "AA|ee##ee#"); 1322 free(s); 1323 // empty string 1324 setValO(self, ""); 1325 r = replaceSCharO(self, "##",0,1); 1326 ck_assert_ptr_ne(r, null); 1327 s = toStringO(r); 1328 ck_assert_str_eq(s, ""); 1329 free(s); 1330 // empty old delimiter 1331 setValO(self, "qwe"); 1332 ck_assert_ptr_eq(replaceSCharO(self, "",'|',1), NULL); 1333 // NULL old delimiter 1334 ck_assert_ptr_eq(replaceSCharO(self, NULL,'|',1), NULL); 1335 // NULL string 1336 freeO(self); 1337 ck_assert_ptr_eq(replaceSCharO(self, "##",'|',1), NULL); 1338 terminateO(self); 1339 1340 } 1341 1342 1343 void replaceCharCharSmallStringT(void) { 1344 1345 smallStringt* r; 1346 smallStringt *self = allocG(""); 1347 1348 // replace string, multiple character new delimeter 1349 setValO(self, "#ee#ee#ad"); 1350 r = replaceCharCharO(self, '#','^', 0); 1351 ck_assert_ptr_ne(r, null); 1352 char *s = toStringO(r); 1353 ck_assert_str_eq(s, "^ee^ee^ad"); 1354 free(s); 1355 // replace one time at the start of string 1356 setValO(self, "#ee#ee#ad"); 1357 r = replaceCharCharO(self, '#','^',1); 1358 ck_assert_ptr_ne(r, null); 1359 s = toStringO(r); 1360 ck_assert_str_eq(s, "^ee#ee#ad"); 1361 free(s); 1362 // replace one time 1363 setValO(self, "AA#ee##ee#"); 1364 r = replaceCharCharO(self, '#','|',1); 1365 ck_assert_ptr_ne(r, null); 1366 s = toStringO(r); 1367 ck_assert_str_eq(s, "AA|ee##ee#"); 1368 free(s); 1369 // empty string 1370 setValO(self, ""); 1371 r = replaceCharCharO(self, '#','^',1); 1372 ck_assert_ptr_ne(r, null); 1373 s = toStringO(r); 1374 ck_assert_str_eq(s, ""); 1375 free(s); 1376 // empty old delimiter 1377 setValO(self, "qwe"); 1378 ck_assert_ptr_eq(replaceCharCharO(self, 0,'|',1), NULL); 1379 // NULL string 1380 freeO(self); 1381 ck_assert_ptr_eq(replaceCharCharO(self, '#','|',1), NULL); 1382 terminateO(self); 1383 1384 } 1385 1386 1387 void replaceSmallJsonSmallJsonSmallStringT(void) { 1388 1389 smallStringt* r; 1390 smallStringt *self = allocG("#ee#ee#ad"); 1391 smallJsont *olds = allocSmallJson(); 1392 smallJsont *news = allocSmallJson(); 1393 1394 // replace string, multiple character new delimeter 1395 freeO(olds); 1396 freeO(news); 1397 setTopSO(olds, "#"); 1398 setTopSO(news, "^^"); 1399 r = replaceSmallJsonSmallJsonO(self, olds, news, 0); 1400 ck_assert_ptr_ne(r, null); 1401 char *s = toStringO(r); 1402 ck_assert_str_eq(s, "^^ee^^ee^^ad"); 1403 free(s); 1404 // replace string, multiple character old delimeter 1405 setValO(self, "AA##ee##ee#"); 1406 freeO(olds); 1407 freeO(news); 1408 setTopSO(olds, "##"); 1409 setTopSO(news, "|"); 1410 r = replaceSmallJsonSmallJsonO(self, olds, news, 0); 1411 ck_assert_ptr_ne(r, null); 1412 s = toStringO(r); 1413 ck_assert_str_eq(s, "AA|ee|ee#"); 1414 free(s); 1415 // replace one time at the start of string 1416 setValO(self, "#ee#ee#ad"); 1417 freeO(olds); 1418 freeO(news); 1419 setTopSO(olds, "#"); 1420 setTopSO(news, "^^"); 1421 r = replaceSmallJsonSmallJsonO(self, olds, news,1); 1422 ck_assert_ptr_ne(r, null); 1423 s = toStringO(r); 1424 ck_assert_str_eq(s, "^^ee#ee#ad"); 1425 free(s); 1426 // replace one time 1427 setValO(self, "AA##ee##ee#"); 1428 freeO(olds); 1429 freeO(news); 1430 setTopSO(olds, "##"); 1431 setTopSO(news, "|"); 1432 r = replaceSmallJsonSmallJsonO(self, olds, news,1); 1433 ck_assert_ptr_ne(r, null); 1434 s = toStringO(r); 1435 ck_assert_str_eq(s, "AA|ee##ee#"); 1436 free(s); 1437 // NULL new delimiter, one time: same as empty delimiter 1438 setValO(self, "AA##ee##ee#"); 1439 freeO(olds); 1440 setTopSO(olds, "##"); 1441 r = replaceSmallJsonSmallJsonO(self, olds, NULL,1); 1442 ck_assert_ptr_ne(r, null); 1443 s = toStringO(r); 1444 ck_assert_str_eq(s, "AAee##ee#"); 1445 free(s); 1446 // non json string 1447 freeO(olds); 1448 setTopIntO(olds, 1); 1449 r = replaceSmallJsonSmallJsonO(self, olds, news,1); 1450 ck_assert_ptr_eq(r, null); 1451 freeO(olds); 1452 freeO(news); 1453 setTopSO(olds, "e"); 1454 setTopIntO(news, 1); 1455 r = replaceSmallJsonSmallJsonO(self, olds, news,1); 1456 ck_assert_ptr_eq(r, null); 1457 // non json object 1458 terminateO(olds); 1459 olds = (smallJsont*) allocSmallInt(1); 1460 r = replaceSmallJsonSmallJsonO(self, olds, news,1); 1461 ck_assert_ptr_eq(r, null); 1462 terminateO(olds); 1463 terminateO(news); 1464 olds = allocSmallJson(); 1465 news = (smallJsont*) allocSmallInt(1); 1466 r = replaceSmallJsonSmallJsonO(self, olds, news,1); 1467 ck_assert_ptr_eq(r, null); 1468 terminateO(news); 1469 news = allocSmallJson(); 1470 // empty string 1471 setValO(self, ""); 1472 freeO(olds); 1473 setTopSO(olds, "##"); 1474 r = replaceSmallJsonSmallJsonO(self, olds, NULL,1); 1475 ck_assert_ptr_ne(r, null); 1476 s = toStringO(r); 1477 ck_assert_str_eq(s, ""); 1478 free(s); 1479 // empty old delimiter 1480 setValO(self, "qwe"); 1481 freeO(olds); 1482 freeO(news); 1483 setTopSO(olds, ""); 1484 setTopSO(news, "|"); 1485 ck_assert_ptr_eq(replaceSmallJsonSmallJsonO(self, olds, news,1), NULL); 1486 // NULL old delimiter 1487 ck_assert_ptr_eq(replaceSmallJsonSmallJsonO(self, NULL, news,1), NULL); 1488 // NULL string 1489 freeO(self); 1490 ck_assert_ptr_eq(replaceSmallJsonSmallJsonO(self, olds, news,1), NULL); 1491 terminateO(olds); 1492 terminateO(news); 1493 terminateO(self); 1494 1495 } 1496 1497 1498 void replaceSmallJsonSmallStringSmallStringT(void) { 1499 1500 smallStringt* r; 1501 smallStringt *self = allocG("#ee#ee#ad"); 1502 smallJsont *olds = allocSmallJson(); 1503 smallStringt *news = allocSmallString(""); 1504 1505 // replace string, multiple character new delimeter 1506 freeO(olds); 1507 setTopSO(olds, "#"); 1508 setValO(news, "^^"); 1509 r = replaceSmallJsonSmallStringO(self, olds, news, 0); 1510 ck_assert_ptr_ne(r, null); 1511 char *s = toStringO(r); 1512 ck_assert_str_eq(s, "^^ee^^ee^^ad"); 1513 free(s); 1514 // replace string, multiple character old delimeter 1515 setValO(self, "AA##ee##ee#"); 1516 freeO(olds); 1517 setTopSO(olds, "##"); 1518 setValO(news, "|"); 1519 r = replaceSmallJsonSmallStringO(self, olds, news, 0); 1520 ck_assert_ptr_ne(r, null); 1521 s = toStringO(r); 1522 ck_assert_str_eq(s, "AA|ee|ee#"); 1523 free(s); 1524 // replace one time at the start of string 1525 setValO(self, "#ee#ee#ad"); 1526 freeO(olds); 1527 setTopSO(olds, "#"); 1528 setValO(news, "^^"); 1529 r = replaceSmallJsonSmallStringO(self, olds, news,1); 1530 ck_assert_ptr_ne(r, null); 1531 s = toStringO(r); 1532 ck_assert_str_eq(s, "^^ee#ee#ad"); 1533 free(s); 1534 // replace one time 1535 setValO(self, "AA##ee##ee#"); 1536 freeO(olds); 1537 setTopSO(olds, "##"); 1538 setValO(news, "|"); 1539 r = replaceSmallJsonSmallStringO(self, olds, news,1); 1540 ck_assert_ptr_ne(r, null); 1541 s = toStringO(r); 1542 ck_assert_str_eq(s, "AA|ee##ee#"); 1543 free(s); 1544 // NULL new delimiter, one time: same as empty delimiter 1545 setValO(self, "AA##ee##ee#"); 1546 freeO(olds); 1547 setTopSO(olds, "##"); 1548 r = replaceSmallJsonSmallStringO(self, olds, NULL,1); 1549 ck_assert_ptr_ne(r, null); 1550 s = toStringO(r); 1551 ck_assert_str_eq(s, "AAee##ee#"); 1552 free(s); 1553 // non json string 1554 freeO(olds); 1555 setTopIntO(olds, 1); 1556 r = replaceSmallJsonSmallStringO(self, olds, news,1); 1557 ck_assert_ptr_eq(r, null); 1558 // non json object 1559 terminateO(olds); 1560 olds = (smallJsont*) allocSmallInt(1); 1561 r = replaceSmallJsonSmallStringO(self, olds, news,1); 1562 ck_assert_ptr_eq(r, null); 1563 terminateO(olds); 1564 terminateO(news); 1565 olds = allocSmallJson(); 1566 news = (smallStringt*) allocSmallInt(1); 1567 r = replaceSmallJsonSmallStringO(self, olds, news,1); 1568 ck_assert_ptr_eq(r, null); 1569 terminateO(news); 1570 news = allocSmallString(""); 1571 // empty string 1572 setValO(self, ""); 1573 freeO(olds); 1574 setTopSO(olds, "##"); 1575 r = replaceSmallJsonSmallStringO(self, olds, NULL,1); 1576 ck_assert_ptr_ne(r, null); 1577 s = toStringO(r); 1578 ck_assert_str_eq(s, ""); 1579 free(s); 1580 // empty old delimiter 1581 setValO(self, "qwe"); 1582 freeO(olds); 1583 setTopSO(olds, ""); 1584 setValO(news, "|"); 1585 ck_assert_ptr_eq(replaceSmallJsonSmallStringO(self, olds, news,1), NULL); 1586 // NULL old delimiter 1587 ck_assert_ptr_eq(replaceSmallJsonSmallStringO(self, NULL, news,1), NULL); 1588 // NULL string 1589 freeO(self); 1590 ck_assert_ptr_eq(replaceSmallJsonSmallStringO(self, olds, news,1), NULL); 1591 terminateO(olds); 1592 terminateO(news); 1593 terminateO(self); 1594 1595 } 1596 1597 1598 void replaceSmallJsonSSmallStringT(void) { 1599 1600 smallStringt* r; 1601 smallStringt *self = allocG("#ee#ee#ad"); 1602 smallJsont *olds = allocSmallJson(); 1603 const char *news; 1604 1605 // replace string, multiple character new delimeter 1606 freeO(olds); 1607 setTopSO(olds, "#"); 1608 news = "^^"; 1609 r = replaceSmallJsonSO(self, olds, news, 0); 1610 ck_assert_ptr_ne(r, null); 1611 char *s = toStringO(r); 1612 ck_assert_str_eq(s, "^^ee^^ee^^ad"); 1613 free(s); 1614 // replace string, multiple character old delimeter 1615 setValO(self, "AA##ee##ee#"); 1616 freeO(olds); 1617 setTopSO(olds, "##"); 1618 news = "|"; 1619 r = replaceSmallJsonSO(self, olds, news, 0); 1620 ck_assert_ptr_ne(r, null); 1621 s = toStringO(r); 1622 ck_assert_str_eq(s, "AA|ee|ee#"); 1623 free(s); 1624 // replace one time at the start of string 1625 setValO(self, "#ee#ee#ad"); 1626 freeO(olds); 1627 setTopSO(olds, "#"); 1628 news = "^^"; 1629 r = replaceSmallJsonSO(self, olds, news,1); 1630 ck_assert_ptr_ne(r, null); 1631 s = toStringO(r); 1632 ck_assert_str_eq(s, "^^ee#ee#ad"); 1633 free(s); 1634 // replace one time 1635 setValO(self, "AA##ee##ee#"); 1636 freeO(olds); 1637 setTopSO(olds, "##"); 1638 news = "|"; 1639 r = replaceSmallJsonSO(self, olds, news,1); 1640 ck_assert_ptr_ne(r, null); 1641 s = toStringO(r); 1642 ck_assert_str_eq(s, "AA|ee##ee#"); 1643 free(s); 1644 // NULL new delimiter, one time: same as empty delimiter 1645 setValO(self, "AA##ee##ee#"); 1646 freeO(olds); 1647 setTopSO(olds, "##"); 1648 r = replaceSmallJsonSO(self, olds, NULL,1); 1649 ck_assert_ptr_ne(r, null); 1650 s = toStringO(r); 1651 ck_assert_str_eq(s, "AAee##ee#"); 1652 free(s); 1653 // non json string 1654 freeO(olds); 1655 setTopIntO(olds, 1); 1656 r = replaceSmallJsonSO(self, olds, news,1); 1657 ck_assert_ptr_eq(r, null); 1658 // non json object 1659 terminateO(olds); 1660 olds = (smallJsont*) allocSmallInt(1); 1661 r = replaceSmallJsonSO(self, olds, news,1); 1662 ck_assert_ptr_eq(r, null); 1663 terminateO(olds); 1664 // empty string 1665 olds = allocSmallJson(); 1666 setValO(self, ""); 1667 setTopSO(olds, "##"); 1668 r = replaceSmallJsonSO(self, olds, NULL,1); 1669 ck_assert_ptr_ne(r, null); 1670 s = toStringO(r); 1671 ck_assert_str_eq(s, ""); 1672 free(s); 1673 // empty old delimiter 1674 setValO(self, "qwe"); 1675 freeO(olds); 1676 setTopSO(olds, ""); 1677 news = "|"; 1678 ck_assert_ptr_eq(replaceSmallJsonSO(self, olds, news,1), NULL); 1679 // NULL old delimiter 1680 ck_assert_ptr_eq(replaceSmallJsonSO(self, NULL, news,1), NULL); 1681 // NULL string 1682 freeO(self); 1683 ck_assert_ptr_eq(replaceSmallJsonSO(self, olds, news,1), NULL); 1684 terminateO(olds); 1685 terminateO(self); 1686 1687 } 1688 1689 1690 void replaceSmallJsonCharSmallStringT(void) { 1691 1692 smallStringt* r; 1693 smallStringt *self = allocG("#ee#ee#ad"); 1694 smallJsont *olds = allocSmallJson(); 1695 char news; 1696 1697 // replace string, multiple character new delimeter 1698 freeO(olds); 1699 setTopSO(olds, "#"); 1700 news = '^'; 1701 r = replaceSmallJsonCharO(self, olds, news, 0); 1702 ck_assert_ptr_ne(r, null); 1703 char *s = toStringO(r); 1704 ck_assert_str_eq(s, "^ee^ee^ad"); 1705 free(s); 1706 // replace string, multiple character old delimeter 1707 setValO(self, "AA##ee##ee#"); 1708 freeO(olds); 1709 setTopSO(olds, "##"); 1710 news = '|'; 1711 r = replaceSmallJsonCharO(self, olds, news, 0); 1712 ck_assert_ptr_ne(r, null); 1713 s = toStringO(r); 1714 ck_assert_str_eq(s, "AA|ee|ee#"); 1715 free(s); 1716 // replace one time at the start of string 1717 setValO(self, "#ee#ee#ad"); 1718 freeO(olds); 1719 setTopSO(olds, "#"); 1720 news = '^'; 1721 r = replaceSmallJsonCharO(self, olds, news,1); 1722 ck_assert_ptr_ne(r, null); 1723 s = toStringO(r); 1724 ck_assert_str_eq(s, "^ee#ee#ad"); 1725 free(s); 1726 // replace one time 1727 setValO(self, "AA##ee##ee#"); 1728 freeO(olds); 1729 setTopSO(olds, "##"); 1730 news = '|'; 1731 r = replaceSmallJsonCharO(self, olds, news,1); 1732 ck_assert_ptr_ne(r, null); 1733 s = toStringO(r); 1734 ck_assert_str_eq(s, "AA|ee##ee#"); 1735 free(s); 1736 // non json string 1737 setValO(self, "AA##ee##ee#"); 1738 freeO(olds); 1739 setTopIntO(olds, 1); 1740 r = replaceSmallJsonCharO(self, olds, news,1); 1741 ck_assert_ptr_eq(r, null); 1742 // non json object 1743 terminateO(olds); 1744 olds = (smallJsont*) allocSmallInt(1); 1745 r = replaceSmallJsonCharO(self, olds, news,1); 1746 ck_assert_ptr_eq(r, null); 1747 terminateO(olds); 1748 // empty string 1749 olds = allocSmallJson(); 1750 setValO(self, ""); 1751 setTopSO(olds, "##"); 1752 r = replaceSmallJsonCharO(self, olds, news,1); 1753 ck_assert_ptr_ne(r, null); 1754 s = toStringO(r); 1755 ck_assert_str_eq(s, ""); 1756 free(s); 1757 // empty old delimiter 1758 setValO(self, "qwe"); 1759 freeO(olds); 1760 setTopSO(olds, ""); 1761 news = '|'; 1762 ck_assert_ptr_eq(replaceSmallJsonCharO(self, olds, news,1), NULL); 1763 // NULL old delimiter 1764 ck_assert_ptr_eq(replaceSmallJsonCharO(self, NULL, news,1), NULL); 1765 // NULL string 1766 freeO(self); 1767 ck_assert_ptr_eq(replaceSmallJsonCharO(self, olds, news,1), NULL); 1768 terminateO(olds); 1769 terminateO(self); 1770 1771 } 1772 1773 1774 void replaceSmallStringSmallJsonSmallStringT(void) { 1775 1776 smallStringt* r; 1777 smallStringt *self = allocG("#ee#ee#ad"); 1778 smallStringt *olds = allocSmallString(""); 1779 smallJsont *news = allocSmallJson(); 1780 1781 // replace string, multiple character new delimeter 1782 freeO(news); 1783 setValO(olds, "#"); 1784 setTopSO(news, "^^"); 1785 r = self->f->replaceSmallStringSmallJson(self, olds, news, 0); 1786 ck_assert_ptr_ne(r, null); 1787 char *s = toStringO(r); 1788 ck_assert_str_eq(s, "^^ee^^ee^^ad"); 1789 free(s); 1790 // replace string, multiple character old delimeter 1791 setValO(self, "AA##ee##ee#"); 1792 freeO(news); 1793 setValO(olds, "##"); 1794 setTopSO(news, "|"); 1795 r = self->f->replaceSmallStringSmallJson(self, olds, news, 0); 1796 ck_assert_ptr_ne(r, null); 1797 s = toStringO(r); 1798 ck_assert_str_eq(s, "AA|ee|ee#"); 1799 free(s); 1800 // replace one time at the start of string 1801 setValO(self, "#ee#ee#ad"); 1802 freeO(news); 1803 setValO(olds, "#"); 1804 setTopSO(news, "^^"); 1805 r = self->f->replaceSmallStringSmallJson(self, olds, news,1); 1806 ck_assert_ptr_ne(r, null); 1807 s = toStringO(r); 1808 ck_assert_str_eq(s, "^^ee#ee#ad"); 1809 free(s); 1810 // replace one time 1811 setValO(self, "AA##ee##ee#"); 1812 freeO(news); 1813 setValO(olds, "##"); 1814 setTopSO(news, "|"); 1815 r = self->f->replaceSmallStringSmallJson(self, olds, news,1); 1816 ck_assert_ptr_ne(r, null); 1817 s = toStringO(r); 1818 ck_assert_str_eq(s, "AA|ee##ee#"); 1819 free(s); 1820 // NULL new delimiter, one time: same as empty delimiter 1821 setValO(self, "AA##ee##ee#"); 1822 setValO(olds, "##"); 1823 r = self->f->replaceSmallStringSmallJson(self, olds, NULL,1); 1824 ck_assert_ptr_ne(r, null); 1825 s = toStringO(r); 1826 ck_assert_str_eq(s, "AAee##ee#"); 1827 free(s); 1828 // non json string 1829 freeO(news); 1830 setTopIntO(news, 1); 1831 r = self->f->replaceSmallStringSmallJson(self, olds, news,1); 1832 ck_assert_ptr_eq(r, null); 1833 // non json object 1834 terminateO(olds); 1835 olds = (smallStringt*) allocSmallInt(1); 1836 r = self->f->replaceSmallStringSmallJson(self, olds, news,1); 1837 ck_assert_ptr_eq(r, null); 1838 terminateO(olds); 1839 terminateO(news); 1840 olds = allocSmallString(""); 1841 news = (smallJsont*) allocSmallInt(1); 1842 r = self->f->replaceSmallStringSmallJson(self, olds, news,1); 1843 ck_assert_ptr_eq(r, null); 1844 terminateO(news); 1845 news = allocSmallJson(); 1846 // empty string 1847 setValO(self, ""); 1848 setValO(olds, "##"); 1849 r = self->f->replaceSmallStringSmallJson(self, olds, NULL,1); 1850 ck_assert_ptr_ne(r, null); 1851 s = toStringO(r); 1852 ck_assert_str_eq(s, ""); 1853 free(s); 1854 // empty old delimiter 1855 setValO(self, "qwe"); 1856 freeO(news); 1857 setValO(olds, ""); 1858 setTopSO(news, "|"); 1859 ck_assert_ptr_eq(self->f->replaceSmallStringSmallJson(self, olds, news,1), NULL); 1860 // NULL old delimiter 1861 ck_assert_ptr_eq(self->f->replaceSmallStringSmallJson(self, NULL, news,1), NULL); 1862 // NULL string 1863 freeO(self); 1864 ck_assert_ptr_eq(self->f->replaceSmallStringSmallJson(self, olds, news,1), NULL); 1865 terminateO(olds); 1866 terminateO(news); 1867 terminateO(self); 1868 1869 } 1870 1871 1872 void replaceSmallStringSmallStringSmallStringT(void) { 1873 1874 smallStringt* r; 1875 smallStringt *self = allocG("#ee#ee#ad"); 1876 smallStringt *olds = allocSmallString(""); 1877 smallStringt *news = allocSmallString(""); 1878 1879 // replace string, multiple character new delimeter 1880 setValO(olds, "#"); 1881 setValO(news, "^^"); 1882 r = replaceSmallStringSmallStringO(self, olds, news, 0); 1883 ck_assert_ptr_ne(r, null); 1884 char *s = toStringO(r); 1885 ck_assert_str_eq(s, "^^ee^^ee^^ad"); 1886 free(s); 1887 // replace string, multiple character old delimeter 1888 setValO(self, "AA##ee##ee#"); 1889 setValO(olds, "##"); 1890 setValO(news, "|"); 1891 r = replaceSmallStringSmallStringO(self, olds, news, 0); 1892 ck_assert_ptr_ne(r, null); 1893 s = toStringO(r); 1894 ck_assert_str_eq(s, "AA|ee|ee#"); 1895 free(s); 1896 // replace one time at the start of string 1897 setValO(self, "#ee#ee#ad"); 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, "^^ee#ee#ad"); 1904 free(s); 1905 // replace one time 1906 setValO(self, "AA##ee##ee#"); 1907 setValO(olds, "##"); 1908 setValO(news, "|"); 1909 r = replaceSmallStringSmallStringO(self, olds, news,1); 1910 ck_assert_ptr_ne(r, null); 1911 s = toStringO(r); 1912 ck_assert_str_eq(s, "AA|ee##ee#"); 1913 free(s); 1914 // NULL new delimiter, one time: same as empty delimiter 1915 setValO(self, "AA##ee##ee#"); 1916 setValO(olds, "##"); 1917 r = replaceSmallStringSmallStringO(self, olds, NULL,1); 1918 ck_assert_ptr_ne(r, null); 1919 s = toStringO(r); 1920 ck_assert_str_eq(s, "AAee##ee#"); 1921 free(s); 1922 // non smallString object 1923 terminateO(olds); 1924 olds = (smallStringt*) allocSmallInt(1); 1925 r = replaceSmallStringSmallStringO(self, olds, news,1); 1926 ck_assert_ptr_eq(r, null); 1927 terminateO(olds); 1928 terminateO(news); 1929 olds = allocSmallString(""); 1930 news = (smallStringt*) allocSmallInt(1); 1931 r = replaceSmallStringSmallStringO(self, olds, news,1); 1932 ck_assert_ptr_eq(r, null); 1933 terminateO(news); 1934 news = allocSmallString(""); 1935 // empty string 1936 setValO(self, ""); 1937 setValO(olds, "##"); 1938 r = replaceSmallStringSmallStringO(self, olds, NULL,1); 1939 ck_assert_ptr_ne(r, null); 1940 s = toStringO(r); 1941 ck_assert_str_eq(s, ""); 1942 free(s); 1943 // empty old delimiter 1944 setValO(self, "qwe"); 1945 setValO(olds, ""); 1946 setValO(news, "|"); 1947 ck_assert_ptr_eq(replaceSmallStringSmallStringO(self, olds, news,1), NULL); 1948 // NULL old delimiter 1949 ck_assert_ptr_eq(replaceSmallStringSmallStringO(self, NULL, news,1), NULL); 1950 // NULL string 1951 freeO(self); 1952 ck_assert_ptr_eq(replaceSmallStringSmallStringO(self, olds, news,1), NULL); 1953 terminateO(olds); 1954 terminateO(news); 1955 terminateO(self); 1956 1957 } 1958 1959 1960 void replaceSmallStringSSmallStringT(void) { 1961 1962 smallStringt* r; 1963 smallStringt *self = allocG("#ee#ee#ad"); 1964 smallStringt *olds = allocSmallString(""); 1965 const char *news; 1966 1967 // replace string, multiple character new delimeter 1968 setValO(olds, "#"); 1969 news = "^^"; 1970 r = replaceSmallStringSO(self, olds, news, 0); 1971 ck_assert_ptr_ne(r, null); 1972 char *s = toStringO(r); 1973 ck_assert_str_eq(s, "^^ee^^ee^^ad"); 1974 free(s); 1975 // replace string, multiple character old delimeter 1976 setValO(self, "AA##ee##ee#"); 1977 setValO(olds, "##"); 1978 news = "|"; 1979 r = replaceSmallStringSO(self, olds, news, 0); 1980 ck_assert_ptr_ne(r, null); 1981 s = toStringO(r); 1982 ck_assert_str_eq(s, "AA|ee|ee#"); 1983 free(s); 1984 // replace one time at the start of string 1985 setValO(self, "#ee#ee#ad"); 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, "^^ee#ee#ad"); 1992 free(s); 1993 // replace one time 1994 setValO(self, "AA##ee##ee#"); 1995 setValO(olds, "##"); 1996 news = "|"; 1997 r = replaceSmallStringSO(self, olds, news,1); 1998 ck_assert_ptr_ne(r, null); 1999 s = toStringO(r); 2000 ck_assert_str_eq(s, "AA|ee##ee#"); 2001 free(s); 2002 // NULL new delimiter, one time: same as empty delimiter 2003 setValO(self, "AA##ee##ee#"); 2004 setValO(olds, "##"); 2005 r = replaceSmallStringSO(self, olds, NULL,1); 2006 ck_assert_ptr_ne(r, null); 2007 s = toStringO(r); 2008 ck_assert_str_eq(s, "AAee##ee#"); 2009 free(s); 2010 // non smallString object 2011 terminateO(olds); 2012 olds = (smallStringt*) allocSmallInt(1); 2013 r = replaceSmallStringSO(self, olds, news,1); 2014 ck_assert_ptr_eq(r, null); 2015 terminateO(olds); 2016 olds = allocSmallString(""); 2017 // empty string 2018 setValO(self, ""); 2019 setValO(olds, "##"); 2020 r = replaceSmallStringSO(self, olds, NULL,1); 2021 ck_assert_ptr_ne(r, null); 2022 s = toStringO(r); 2023 ck_assert_str_eq(s, ""); 2024 free(s); 2025 // empty old delimiter 2026 setValO(self, "qwe"); 2027 setValO(olds, ""); 2028 news = "|"; 2029 ck_assert_ptr_eq(replaceSmallStringSO(self, olds, news,1), NULL); 2030 // NULL old delimiter 2031 ck_assert_ptr_eq(replaceSmallStringSO(self, NULL, news,1), NULL); 2032 // NULL string 2033 freeO(self); 2034 ck_assert_ptr_eq(replaceSmallStringSO(self, olds, news,1), NULL); 2035 terminateO(olds); 2036 terminateO(self); 2037 2038 } 2039 2040 2041 void replaceSmallStringCharSmallStringT(void) { 2042 2043 smallStringt* r; 2044 smallStringt *self = allocG("#ee#ee#ad"); 2045 smallStringt *olds = allocSmallString(""); 2046 char news; 2047 2048 // replace string, multiple character new delimeter 2049 setValO(olds, "#"); 2050 news = '^'; 2051 r = replaceSmallStringCharO(self, olds, news, 0); 2052 ck_assert_ptr_ne(r, null); 2053 char *s = toStringO(r); 2054 ck_assert_str_eq(s, "^ee^ee^ad"); 2055 free(s); 2056 // replace string, multiple character old delimeter 2057 setValO(self, "AA##ee##ee#"); 2058 setValO(olds, "##"); 2059 news = '|'; 2060 r = replaceSmallStringCharO(self, olds, news, 0); 2061 ck_assert_ptr_ne(r, null); 2062 s = toStringO(r); 2063 ck_assert_str_eq(s, "AA|ee|ee#"); 2064 free(s); 2065 // replace one time at the start of string 2066 setValO(self, "#ee#ee#ad"); 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, "^ee#ee#ad"); 2073 free(s); 2074 // replace one time 2075 setValO(self, "AA##ee##ee#"); 2076 setValO(olds, "##"); 2077 news = '|'; 2078 r = replaceSmallStringCharO(self, olds, news,1); 2079 ck_assert_ptr_ne(r, null); 2080 s = toStringO(r); 2081 ck_assert_str_eq(s, "AA|ee##ee#"); 2082 free(s); 2083 // non smallString object 2084 terminateO(olds); 2085 olds = (smallStringt*) allocSmallInt(1); 2086 r = replaceSmallStringCharO(self, olds, news,1); 2087 ck_assert_ptr_eq(r, null); 2088 terminateO(olds); 2089 olds = allocSmallString(""); 2090 // empty string 2091 setValO(self, ""); 2092 setValO(olds, "##"); 2093 r = replaceSmallStringCharO(self, olds, news,1); 2094 ck_assert_ptr_ne(r, null); 2095 s = toStringO(r); 2096 ck_assert_str_eq(s, ""); 2097 free(s); 2098 // empty old delimiter 2099 setValO(self, "qwe"); 2100 setValO(olds, ""); 2101 news = '|'; 2102 ck_assert_ptr_eq(replaceSmallStringCharO(self, olds, news,1), NULL); 2103 // NULL old delimiter 2104 ck_assert_ptr_eq(replaceSmallStringCharO(self, NULL, news,1), NULL); 2105 // NULL string 2106 freeO(self); 2107 ck_assert_ptr_eq(replaceSmallStringCharO(self, olds, news,1), NULL); 2108 terminateO(olds); 2109 terminateO(self); 2110 2111 } 2112 2113 2114 void replaceSSmallJsonSmallStringT(void) { 2115 2116 smallStringt* r; 2117 smallStringt *self = allocG("#ee#ee#ad"); 2118 const char *olds; 2119 smallJsont *news = allocSmallJson(); 2120 2121 // replace string, multiple character new delimeter 2122 freeO(news); 2123 olds = "#"; 2124 setTopSO(news, "^^"); 2125 r = replaceSSmallJsonO(self, olds, news, 0); 2126 ck_assert_ptr_ne(r, null); 2127 char *s = toStringO(r); 2128 ck_assert_str_eq(s, "^^ee^^ee^^ad"); 2129 free(s); 2130 // replace string, multiple character old delimeter 2131 setValO(self, "AA##ee##ee#"); 2132 freeO(news); 2133 olds = "##"; 2134 setTopSO(news, "|"); 2135 r = replaceSSmallJsonO(self, olds, news, 0); 2136 ck_assert_ptr_ne(r, null); 2137 s = toStringO(r); 2138 ck_assert_str_eq(s, "AA|ee|ee#"); 2139 free(s); 2140 // replace one time at the start of string 2141 setValO(self, "#ee#ee#ad"); 2142 freeO(news); 2143 olds = "#"; 2144 setTopSO(news, "^^"); 2145 r = replaceSSmallJsonO(self, olds, news,1); 2146 ck_assert_ptr_ne(r, null); 2147 s = toStringO(r); 2148 ck_assert_str_eq(s, "^^ee#ee#ad"); 2149 free(s); 2150 // replace one time 2151 setValO(self, "AA##ee##ee#"); 2152 freeO(news); 2153 olds = "##"; 2154 setTopSO(news, "|"); 2155 r = replaceSSmallJsonO(self, olds, news,1); 2156 ck_assert_ptr_ne(r, null); 2157 s = toStringO(r); 2158 ck_assert_str_eq(s, "AA|ee##ee#"); 2159 free(s); 2160 // NULL new delimiter, one time: same as empty delimiter 2161 setValO(self, "AA##ee##ee#"); 2162 olds = "##"; 2163 r = replaceSSmallJsonO(self, olds, NULL,1); 2164 ck_assert_ptr_ne(r, null); 2165 s = toStringO(r); 2166 ck_assert_str_eq(s, "AAee##ee#"); 2167 free(s); 2168 // non json string 2169 freeO(news); 2170 olds = "e"; 2171 setTopIntO(news, 1); 2172 r = replaceSSmallJsonO(self, olds, news,1); 2173 ck_assert_ptr_eq(r, null); 2174 // non json object 2175 terminateO(news); 2176 news = (smallJsont*) allocSmallInt(1); 2177 r = replaceSSmallJsonO(self, olds, news,1); 2178 ck_assert_ptr_eq(r, null); 2179 terminateO(news); 2180 news = allocSmallJson(); 2181 // empty string 2182 setValO(self, ""); 2183 olds = "##"; 2184 r = replaceSSmallJsonO(self, olds, NULL,1); 2185 ck_assert_ptr_ne(r, null); 2186 s = toStringO(r); 2187 ck_assert_str_eq(s, ""); 2188 free(s); 2189 // empty old delimiter 2190 setValO(self, "qwe"); 2191 freeO(news); 2192 olds = ""; 2193 setTopSO(news, "|"); 2194 ck_assert_ptr_eq(replaceSSmallJsonO(self, olds, news,1), NULL); 2195 // NULL old delimiter 2196 ck_assert_ptr_eq(replaceSSmallJsonO(self, NULL, news,1), NULL); 2197 // NULL string 2198 freeO(self); 2199 ck_assert_ptr_eq(replaceSSmallJsonO(self, olds, news,1), NULL); 2200 terminateO(news); 2201 terminateO(self); 2202 2203 } 2204 2205 2206 void replaceSSmallStringSmallStringT(void) { 2207 2208 smallStringt* r; 2209 smallStringt *self = allocG("#ee#ee#ad"); 2210 const char *olds; 2211 smallStringt *news = allocSmallString(""); 2212 2213 // replace string, multiple character new delimeter 2214 olds = "#"; 2215 setValO(news, "^^"); 2216 r = replaceSSmallStringO(self, olds, news, 0); 2217 ck_assert_ptr_ne(r, null); 2218 char *s = toStringO(r); 2219 ck_assert_str_eq(s, "^^ee^^ee^^ad"); 2220 free(s); 2221 // replace string, multiple character old delimeter 2222 setValO(self, "AA##ee##ee#"); 2223 olds = "##"; 2224 setValO(news, "|"); 2225 r = replaceSSmallStringO(self, olds, news, 0); 2226 ck_assert_ptr_ne(r, null); 2227 s = toStringO(r); 2228 ck_assert_str_eq(s, "AA|ee|ee#"); 2229 free(s); 2230 // replace one time at the start of string 2231 setValO(self, "#ee#ee#ad"); 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, "^^ee#ee#ad"); 2238 free(s); 2239 // replace one time 2240 setValO(self, "AA##ee##ee#"); 2241 olds = "##"; 2242 setValO(news, "|"); 2243 r = replaceSSmallStringO(self, olds, news,1); 2244 ck_assert_ptr_ne(r, null); 2245 s = toStringO(r); 2246 ck_assert_str_eq(s, "AA|ee##ee#"); 2247 free(s); 2248 // NULL new delimiter, one time: same as empty delimiter 2249 setValO(self, "AA##ee##ee#"); 2250 olds = "##"; 2251 r = replaceSSmallStringO(self, olds, NULL,1); 2252 ck_assert_ptr_ne(r, null); 2253 s = toStringO(r); 2254 ck_assert_str_eq(s, "AAee##ee#"); 2255 free(s); 2256 // non smallString object 2257 terminateO(news); 2258 news = (smallStringt*) allocSmallInt(1); 2259 r = replaceSSmallStringO(self, olds, news,1); 2260 ck_assert_ptr_eq(r, null); 2261 terminateO(news); 2262 news = allocSmallString(""); 2263 // empty string 2264 setValO(self, ""); 2265 olds = "##"; 2266 r = replaceSSmallStringO(self, olds, NULL,1); 2267 ck_assert_ptr_ne(r, null); 2268 s = toStringO(r); 2269 ck_assert_str_eq(s, ""); 2270 free(s); 2271 // empty old delimiter 2272 setValO(self, "qwe"); 2273 olds = ""; 2274 setValO(news, "|"); 2275 ck_assert_ptr_eq(replaceSSmallStringO(self, olds, news,1), NULL); 2276 // NULL old delimiter 2277 ck_assert_ptr_eq(replaceSSmallStringO(self, NULL, news,1), NULL); 2278 // NULL string 2279 freeO(self); 2280 ck_assert_ptr_eq(replaceSSmallStringO(self, olds, news,1), NULL); 2281 terminateO(news); 2282 terminateO(self); 2283 2284 } 2285 2286 2287 void replaceCharSmallJsonSmallStringT(void) { 2288 2289 smallStringt* r; 2290 smallStringt *self = allocG("#ee#ee#ad"); 2291 char olds; 2292 smallJsont *news = allocSmallJson(); 2293 2294 // replace string, multiple character new delimeter 2295 freeO(news); 2296 olds = '#'; 2297 setTopSO(news, "^^"); 2298 r = replaceCharSmallJsonO(self, olds, news, 0); 2299 ck_assert_ptr_ne(r, null); 2300 char *s = toStringO(r); 2301 ck_assert_str_eq(s, "^^ee^^ee^^ad"); 2302 free(s); 2303 // replace string, multiple character old delimeter 2304 setValO(self, "AA#ee#ee"); 2305 freeO(news); 2306 olds = '#'; 2307 setTopSO(news, "|"); 2308 r = replaceCharSmallJsonO(self, olds, news, 0); 2309 ck_assert_ptr_ne(r, null); 2310 s = toStringO(r); 2311 ck_assert_str_eq(s, "AA|ee|ee"); 2312 free(s); 2313 // replace one time at the start of string 2314 setValO(self, "#ee#ee#ad"); 2315 freeO(news); 2316 olds = '#'; 2317 setTopSO(news, "^^"); 2318 r = replaceCharSmallJsonO(self, olds, news,1); 2319 ck_assert_ptr_ne(r, null); 2320 s = toStringO(r); 2321 ck_assert_str_eq(s, "^^ee#ee#ad"); 2322 free(s); 2323 // replace one time 2324 setValO(self, "AA#ee##ee#"); 2325 freeO(news); 2326 olds = '#'; 2327 setTopSO(news, "|"); 2328 r = replaceCharSmallJsonO(self, olds, news,1); 2329 ck_assert_ptr_ne(r, null); 2330 s = toStringO(r); 2331 ck_assert_str_eq(s, "AA|ee##ee#"); 2332 free(s); 2333 // NULL new delimiter, one time: same as empty delimiter 2334 setValO(self, "AA#ee##ee#"); 2335 olds = '#'; 2336 r = replaceCharSmallJsonO(self, olds, NULL,1); 2337 ck_assert_ptr_ne(r, null); 2338 s = toStringO(r); 2339 ck_assert_str_eq(s, "AAee##ee#"); 2340 free(s); 2341 // non json string 2342 freeO(news); 2343 olds = 'e'; 2344 setTopIntO(news, 1); 2345 r = replaceCharSmallJsonO(self, olds, news,1); 2346 ck_assert_ptr_eq(r, null); 2347 // non json object 2348 terminateO(news); 2349 news = (smallJsont*) allocSmallInt(1); 2350 r = replaceCharSmallJsonO(self, olds, news,1); 2351 ck_assert_ptr_eq(r, null); 2352 terminateO(news); 2353 news = allocSmallJson(); 2354 // empty string 2355 setValO(self, ""); 2356 olds = '#'; 2357 r = replaceCharSmallJsonO(self, olds, NULL,1); 2358 ck_assert_ptr_ne(r, null); 2359 s = toStringO(r); 2360 ck_assert_str_eq(s, ""); 2361 free(s); 2362 // NULL string 2363 freeO(self); 2364 freeO(news); 2365 setTopSO(news, "|"); 2366 ck_assert_ptr_eq(replaceCharSmallJsonO(self, olds, news,1), NULL); 2367 terminateO(news); 2368 terminateO(self); 2369 2370 } 2371 2372 2373 void replaceCharSmallStringSmallStringT(void) { 2374 2375 smallStringt* r; 2376 smallStringt *self = allocG("#ee#ee#ad"); 2377 char olds; 2378 smallStringt *news = allocSmallString(""); 2379 2380 // replace string, multiple character new delimeter 2381 olds = '#'; 2382 setValO(news, "^^"); 2383 r = replaceCharSmallStringO(self, olds, news, 0); 2384 ck_assert_ptr_ne(r, null); 2385 char *s = toStringO(r); 2386 ck_assert_str_eq(s, "^^ee^^ee^^ad"); 2387 free(s); 2388 // replace string, multiple character old delimeter 2389 setValO(self, "AA#ee#ee"); 2390 olds = '#'; 2391 setValO(news, "|"); 2392 r = replaceCharSmallStringO(self, olds, news, 0); 2393 ck_assert_ptr_ne(r, null); 2394 s = toStringO(r); 2395 ck_assert_str_eq(s, "AA|ee|ee"); 2396 free(s); 2397 // replace one time at the start of string 2398 setValO(self, "#ee#ee#ad"); 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, "^^ee#ee#ad"); 2405 free(s); 2406 // replace one time 2407 setValO(self, "AA#ee##ee#"); 2408 olds = '#'; 2409 setValO(news, "|"); 2410 r = replaceCharSmallStringO(self, olds, news,1); 2411 ck_assert_ptr_ne(r, null); 2412 s = toStringO(r); 2413 ck_assert_str_eq(s, "AA|ee##ee#"); 2414 free(s); 2415 // NULL new delimiter, one time: same as empty delimiter 2416 setValO(self, "AA#ee##ee#"); 2417 olds = '#'; 2418 r = replaceCharSmallStringO(self, olds, NULL,1); 2419 ck_assert_ptr_ne(r, null); 2420 s = toStringO(r); 2421 ck_assert_str_eq(s, "AAee##ee#"); 2422 free(s); 2423 // non smallString object 2424 terminateO(news); 2425 news = (smallStringt*) allocSmallInt(1); 2426 r = replaceCharSmallStringO(self, olds, news,1); 2427 ck_assert_ptr_eq(r, null); 2428 terminateO(news); 2429 news = allocSmallString(""); 2430 // empty string 2431 setValO(self, ""); 2432 olds = '#'; 2433 r = replaceCharSmallStringO(self, olds, NULL,1); 2434 ck_assert_ptr_ne(r, null); 2435 s = toStringO(r); 2436 ck_assert_str_eq(s, ""); 2437 free(s); 2438 // NULL string 2439 freeO(self); 2440 setValO(news, "|"); 2441 ck_assert_ptr_eq(replaceCharSmallStringO(self, olds, news,1), NULL); 2442 terminateO(news); 2443 terminateO(self); 2444 2445 } 2446 2447 2448 void replaceManySmallStringT(void) { 2449 2450 smallStringt* r; 2451 smallStringt *self = allocG(""); 2452 2453 // replace string, multiple character new delimeter 2454 setValO(self, "#ee#ee#ad"); 2455 r = replaceManyO(self, "#","^^","ad","AD"); 2456 ck_assert_ptr_ne(r, null); 2457 char *s = toStringO(r); 2458 ck_assert_str_eq(s, "^^ee^^ee^^AD"); 2459 free(s); 2460 // replace string, empty new delimeter 2461 setValO(self, "#ee#ee#ad"); 2462 r = replaceManyO(self, "#","","ad","AD"); 2463 ck_assert_ptr_ne(r, null); 2464 s = toStringO(r); 2465 ck_assert_str_eq(s, "eeeeAD"); 2466 free(s); 2467 // not enough olds:news pairs 2468 setValO(self, "#ee#ee#ad"); 2469 r = replaceManyO(self, "#","","ad"); 2470 ck_assert_ptr_ne(r, null); 2471 s = toStringO(r); 2472 ck_assert_str_eq(s, "eeeead"); 2473 free(s); 2474 // NULL new delimiter: same as only 2 parameters or not enough olds:news pairs 2475 setValO(self, "AA##ee##ee#"); 2476 r = replaceManyO(self, "##",NULL); 2477 ck_assert_ptr_eq(r, null); 2478 // empty string 2479 setValO(self, ""); 2480 r = replaceManyO(self, "##", ""); 2481 ck_assert_ptr_ne(r, null); 2482 s = toStringO(r); 2483 ck_assert_str_eq(s, ""); 2484 free(s); 2485 // empty string many pairs 2486 setValO(self, ""); 2487 r = replaceManyO(self, "##", "", "$$", ""); 2488 ck_assert_ptr_ne(r, null); 2489 s = toStringO(r); 2490 ck_assert_str_eq(s, ""); 2491 free(s); 2492 // empty string many pairs empty olds 2493 setValO(self, ""); 2494 r = replaceManyO(self, "##", "", "", ""); 2495 ck_assert_ptr_ne(r, null); 2496 s = toStringO(r); 2497 ck_assert_str_eq(s, ""); 2498 free(s); 2499 // empty string and NULL old delimiter 2500 setValO(self, ""); 2501 r = replaceManyO(self, NULL,"|"); 2502 ck_assert_ptr_ne(r, null); 2503 s = toStringO(r); 2504 ck_assert_str_eq(s, ""); 2505 free(s); 2506 // empty string and NULL old delimiter not first - same as replace empty string 2507 setValO(self, ""); 2508 r = replaceManyO(self,"##","|", NULL,"|"); 2509 ck_assert_ptr_ne(r, null); 2510 s = toStringO(r); 2511 ck_assert_str_eq(s, ""); 2512 free(s); 2513 // empty old delimiter 2514 setValO(self, "AA##ee##ee#"); 2515 ck_assert_ptr_eq(replaceManyO(self, "","|", "AA", "BB"), NULL); 2516 // empty old delimiter not first 2517 ck_assert_ptr_eq(replaceManyO(self, "##","|", "", "BB"), NULL); 2518 // NULL string 2519 freeO(self); 2520 ck_assert_ptr_eq(replaceManyO(self, "##","|"), NULL); 2521 terminateO(self); 2522 2523 } 2524 2525 2526 void icReplaceSmallStringT(void) { 2527 2528 smallStringt* r; 2529 smallStringt *self = allocG("BeebeeBad"); 2530 2531 // replace string, multiple character new delimeter 2532 r = icReplaceO(self, "b","^^", 0); 2533 ck_assert_ptr_ne(r, null); 2534 char *s = toStringO(r); 2535 ck_assert_str_eq(s, "^^ee^^ee^^ad"); 2536 free(s); 2537 // replace string, multiple character old delimeter 2538 setValO(self, "AA##ee##ee#"); 2539 r = icReplaceO(self, "##","|", 0); 2540 ck_assert_ptr_ne(r, null); 2541 s = toStringO(r); 2542 ck_assert_str_eq(s, "AA|ee|ee#"); 2543 free(s); 2544 // replace one time at the start of string 2545 setValO(self, "#ee#ee#ad"); 2546 r = icReplaceO(self, "#","^^",1); 2547 ck_assert_ptr_ne(r, null); 2548 s = toStringO(r); 2549 ck_assert_str_eq(s, "^^ee#ee#ad"); 2550 free(s); 2551 // replace one time 2552 setValO(self, "AA##ee##ee#"); 2553 r = icReplaceO(self, "##","|",1); 2554 ck_assert_ptr_ne(r, null); 2555 s = toStringO(r); 2556 ck_assert_str_eq(s, "AA|ee##ee#"); 2557 free(s); 2558 // NULL new delimiter, one time: same as empty delimiter 2559 setValO(self, "AA##ee##ee#"); 2560 r = icReplaceO(self, "##",NULL,1); 2561 ck_assert_ptr_ne(r, null); 2562 s = toStringO(r); 2563 ck_assert_str_eq(s, "AAee##ee#"); 2564 free(s); 2565 // empty string 2566 setValO(self, ""); 2567 r = icReplaceO(self, "##",NULL,1); 2568 ck_assert_ptr_ne(r, null); 2569 s = toStringO(r); 2570 ck_assert_str_eq(s, ""); 2571 free(s); 2572 // empty old delimiter 2573 setValO(self, "qwe"); 2574 ck_assert_ptr_eq(icReplaceO(self, "","|",1), NULL); 2575 // NULL old delimiter 2576 ck_assert_ptr_eq(icReplaceO(self, NULL,"|",1), NULL); 2577 // empty old delimiter 2578 ck_assert_ptr_eq(icReplaceO(self, "","|",1), NULL); 2579 // NULL string 2580 freeO(self); 2581 ck_assert_ptr_eq(icReplaceO(self, "##","|",1), NULL); 2582 terminateO(self); 2583 2584 } 2585 2586 2587 void icReplaceCharSSmallStringT(void) { 2588 2589 smallStringt* r; 2590 smallStringt *self = allocG(""); 2591 2592 // replace string, multiple character new delimeter 2593 setValO(self, "BeebeeBad"); 2594 r = icReplaceCharSO(self, 'B',"^^", 0); 2595 ck_assert_ptr_ne(r, null); 2596 char *s = toStringO(r); 2597 ck_assert_str_eq(s, "^^ee^^ee^^ad"); 2598 free(s); 2599 // replace one time at the start of string 2600 setValO(self, "#ee#ee#ad"); 2601 r = icReplaceCharSO(self, '#',"^^",1); 2602 ck_assert_ptr_ne(r, null); 2603 s = toStringO(r); 2604 ck_assert_str_eq(s, "^^ee#ee#ad"); 2605 free(s); 2606 // replace one time 2607 setValO(self, "AA##ee##ee#"); 2608 r = icReplaceCharSO(self, '#',"|",1); 2609 ck_assert_ptr_ne(r, null); 2610 s = toStringO(r); 2611 ck_assert_str_eq(s, "AA|#ee##ee#"); 2612 free(s); 2613 // NULL new delimiter, one time: same as empty delimiter 2614 setValO(self, "AA#ee##ee#"); 2615 r = icReplaceCharSO(self, '#',NULL,1); 2616 ck_assert_ptr_ne(r, null); 2617 s = toStringO(r); 2618 ck_assert_str_eq(s, "AAee##ee#"); 2619 free(s); 2620 // empty string 2621 setValO(self, ""); 2622 r = icReplaceCharSO(self, '#',NULL,1); 2623 ck_assert_ptr_ne(r, null); 2624 s = toStringO(r); 2625 ck_assert_str_eq(s, ""); 2626 free(s); 2627 // empty old delimiter 2628 setValO(self, "qwe"); 2629 ck_assert_ptr_eq(icReplaceCharSO(self, 0,"|",1), NULL); 2630 // NULL string 2631 freeO(self); 2632 ck_assert_ptr_eq(icReplaceCharSO(self, '#',"|",1), NULL); 2633 terminateO(self); 2634 2635 } 2636 2637 2638 void icReplaceSCharSmallStringT(void) { 2639 2640 smallStringt* r; 2641 smallStringt *self = allocG(""); 2642 2643 // replace string, multiple character new delimeter 2644 setValO(self, "BeebeeBad"); 2645 r = icReplaceSCharO(self, "b",'^',0); 2646 ck_assert_ptr_ne(r, null); 2647 char *s = toStringO(r); 2648 ck_assert_str_eq(s, "^ee^ee^ad"); 2649 free(s); 2650 // replace string, multiple character old delimeter 2651 setValO(self, "AA##ee##ee#"); 2652 r = icReplaceSCharO(self, "##",'|',0); 2653 ck_assert_ptr_ne(r, null); 2654 s = toStringO(r); 2655 ck_assert_str_eq(s, "AA|ee|ee#"); 2656 free(s); 2657 // replace string empty char, multiple character old delimeter 2658 setValO(self, "AA##ee##ee#"); 2659 r = icReplaceSCharO(self, "##", 0,0); 2660 ck_assert_ptr_ne(r, null); 2661 s = toStringO(r); 2662 ck_assert_str_eq(s, "AAeeee#"); 2663 free(s); 2664 // replace one time at the start of string 2665 setValO(self, "#ee#ee#ad"); 2666 r = icReplaceSCharO(self, "#",'^',1); 2667 ck_assert_ptr_ne(r, null); 2668 s = toStringO(r); 2669 ck_assert_str_eq(s, "^ee#ee#ad"); 2670 free(s); 2671 // replace one time 2672 setValO(self, "AA##ee##ee#"); 2673 r = icReplaceSCharO(self, "##",'|',1); 2674 ck_assert_ptr_ne(r, null); 2675 s = toStringO(r); 2676 ck_assert_str_eq(s, "AA|ee##ee#"); 2677 free(s); 2678 // empty string 2679 setValO(self, ""); 2680 r = icReplaceSCharO(self, "##",0,1); 2681 ck_assert_ptr_ne(r, null); 2682 s = toStringO(r); 2683 ck_assert_str_eq(s, ""); 2684 free(s); 2685 // empty old delimiter 2686 setValO(self, "qwe"); 2687 ck_assert_ptr_eq(icReplaceSCharO(self, "",'|',1), NULL); 2688 // NULL old delimiter 2689 ck_assert_ptr_eq(icReplaceSCharO(self, NULL,'|',1), NULL); 2690 // NULL string 2691 freeO(self); 2692 ck_assert_ptr_eq(icReplaceSCharO(self, "##",'|',1), NULL); 2693 terminateO(self); 2694 2695 } 2696 2697 2698 void icReplaceCharCharSmallStringT(void) { 2699 2700 smallStringt* r; 2701 smallStringt *self = allocG(""); 2702 2703 // replace string, multiple character new delimeter 2704 setValO(self, "beeBeebad"); 2705 r = icReplaceCharCharO(self, 'b','^', 0); 2706 ck_assert_ptr_ne(r, null); 2707 char *s = toStringO(r); 2708 ck_assert_str_eq(s, "^ee^ee^ad"); 2709 free(s); 2710 // replace one time at the start of string 2711 setValO(self, "#ee#ee#ad"); 2712 r = icReplaceCharCharO(self, '#','^',1); 2713 ck_assert_ptr_ne(r, null); 2714 s = toStringO(r); 2715 ck_assert_str_eq(s, "^ee#ee#ad"); 2716 free(s); 2717 // replace one time 2718 setValO(self, "AA#ee##ee#"); 2719 r = icReplaceCharCharO(self, '#','|',1); 2720 ck_assert_ptr_ne(r, null); 2721 s = toStringO(r); 2722 ck_assert_str_eq(s, "AA|ee##ee#"); 2723 free(s); 2724 // empty string 2725 setValO(self, ""); 2726 r = icReplaceCharCharO(self, '#','^',1); 2727 ck_assert_ptr_ne(r, null); 2728 s = toStringO(r); 2729 ck_assert_str_eq(s, ""); 2730 free(s); 2731 // empty old delimiter 2732 setValO(self, "qwe"); 2733 ck_assert_ptr_eq(icReplaceCharCharO(self, 0,'|',1), NULL); 2734 // NULL string 2735 freeO(self); 2736 ck_assert_ptr_eq(icReplaceCharCharO(self, '#','|',1), NULL); 2737 terminateO(self); 2738 2739 } 2740 2741 2742 void icReplaceSmallJsonSmallJsonSmallStringT(void) { 2743 2744 smallStringt* r; 2745 smallStringt *self = allocG("BeebeeBad"); 2746 smallJsont *olds = allocSmallJson(); 2747 smallJsont *news = allocSmallJson(); 2748 2749 // replace string, multiple character new delimeter 2750 freeO(olds); 2751 freeO(news); 2752 setTopSO(olds, "B"); 2753 setTopSO(news, "^^"); 2754 r = icReplaceSmallJsonSmallJsonO(self, olds, news, 0); 2755 ck_assert_ptr_ne(r, null); 2756 char *s = toStringO(r); 2757 ck_assert_str_eq(s, "^^ee^^ee^^ad"); 2758 free(s); 2759 // replace string, multiple character old delimeter 2760 setValO(self, "AA##ee##ee#"); 2761 freeO(olds); 2762 freeO(news); 2763 setTopSO(olds, "##"); 2764 setTopSO(news, "|"); 2765 r = icReplaceSmallJsonSmallJsonO(self, olds, news, 0); 2766 ck_assert_ptr_ne(r, null); 2767 s = toStringO(r); 2768 ck_assert_str_eq(s, "AA|ee|ee#"); 2769 free(s); 2770 // replace one time at the start of string 2771 setValO(self, "#ee#ee#ad"); 2772 freeO(olds); 2773 freeO(news); 2774 setTopSO(olds, "#"); 2775 setTopSO(news, "^^"); 2776 r = icReplaceSmallJsonSmallJsonO(self, olds, news,1); 2777 ck_assert_ptr_ne(r, null); 2778 s = toStringO(r); 2779 ck_assert_str_eq(s, "^^ee#ee#ad"); 2780 free(s); 2781 // replace one time 2782 setValO(self, "AA##ee##ee#"); 2783 freeO(olds); 2784 freeO(news); 2785 setTopSO(olds, "##"); 2786 setTopSO(news, "|"); 2787 r = icReplaceSmallJsonSmallJsonO(self, olds, news,1); 2788 ck_assert_ptr_ne(r, null); 2789 s = toStringO(r); 2790 ck_assert_str_eq(s, "AA|ee##ee#"); 2791 free(s); 2792 // NULL new delimiter, one time: same as empty delimiter 2793 setValO(self, "AA##ee##ee#"); 2794 freeO(olds); 2795 setTopSO(olds, "##"); 2796 r = icReplaceSmallJsonSmallJsonO(self, olds, NULL,1); 2797 ck_assert_ptr_ne(r, null); 2798 s = toStringO(r); 2799 ck_assert_str_eq(s, "AAee##ee#"); 2800 free(s); 2801 // non json string 2802 freeO(olds); 2803 setTopIntO(olds, 1); 2804 r = icReplaceSmallJsonSmallJsonO(self, olds, news,1); 2805 ck_assert_ptr_eq(r, null); 2806 freeO(olds); 2807 freeO(news); 2808 setTopSO(olds, "e"); 2809 setTopIntO(news, 1); 2810 r = icReplaceSmallJsonSmallJsonO(self, olds, news,1); 2811 ck_assert_ptr_eq(r, null); 2812 // non json object 2813 terminateO(olds); 2814 olds = (smallJsont*) allocSmallInt(1); 2815 r = icReplaceSmallJsonSmallJsonO(self, olds, news,1); 2816 ck_assert_ptr_eq(r, null); 2817 terminateO(olds); 2818 terminateO(news); 2819 olds = allocSmallJson(); 2820 news = (smallJsont*) allocSmallInt(1); 2821 r = icReplaceSmallJsonSmallJsonO(self, olds, news,1); 2822 ck_assert_ptr_eq(r, null); 2823 terminateO(news); 2824 news = allocSmallJson(); 2825 // empty string 2826 setValO(self, ""); 2827 freeO(olds); 2828 setTopSO(olds, "##"); 2829 r = icReplaceSmallJsonSmallJsonO(self, olds, NULL,1); 2830 ck_assert_ptr_ne(r, null); 2831 s = toStringO(r); 2832 ck_assert_str_eq(s, ""); 2833 free(s); 2834 // empty old delimiter 2835 setValO(self, "qwe"); 2836 freeO(olds); 2837 freeO(news); 2838 setTopSO(olds, ""); 2839 setTopSO(news, "|"); 2840 ck_assert_ptr_eq(icReplaceSmallJsonSmallJsonO(self, olds, news,1), NULL); 2841 // NULL old delimiter 2842 ck_assert_ptr_eq(icReplaceSmallJsonSmallJsonO(self, NULL, news,1), NULL); 2843 // NULL string 2844 freeO(self); 2845 ck_assert_ptr_eq(icReplaceSmallJsonSmallJsonO(self, olds, news,1), NULL); 2846 terminateO(olds); 2847 terminateO(news); 2848 terminateO(self); 2849 2850 } 2851 2852 2853 void icReplaceSmallJsonSmallStringSmallStringT(void) { 2854 2855 smallStringt* r; 2856 smallStringt *self = allocG("BeebeeBad"); 2857 smallJsont *olds = allocSmallJson(); 2858 smallStringt *news = allocSmallString(""); 2859 2860 // replace string, multiple character new delimeter 2861 freeO(olds); 2862 setTopSO(olds, "B"); 2863 setValO(news, "^^"); 2864 r = icReplaceSmallJsonSmallStringO(self, olds, news, 0); 2865 ck_assert_ptr_ne(r, null); 2866 char *s = toStringO(r); 2867 ck_assert_str_eq(s, "^^ee^^ee^^ad"); 2868 free(s); 2869 // replace string, multiple character old delimeter 2870 setValO(self, "AA##ee##ee#"); 2871 freeO(olds); 2872 setTopSO(olds, "##"); 2873 setValO(news, "|"); 2874 r = icReplaceSmallJsonSmallStringO(self, olds, news, 0); 2875 ck_assert_ptr_ne(r, null); 2876 s = toStringO(r); 2877 ck_assert_str_eq(s, "AA|ee|ee#"); 2878 free(s); 2879 // replace one time at the start of string 2880 setValO(self, "#ee#ee#ad"); 2881 freeO(olds); 2882 setTopSO(olds, "#"); 2883 setValO(news, "^^"); 2884 r = icReplaceSmallJsonSmallStringO(self, olds, news,1); 2885 ck_assert_ptr_ne(r, null); 2886 s = toStringO(r); 2887 ck_assert_str_eq(s, "^^ee#ee#ad"); 2888 free(s); 2889 // replace one time 2890 setValO(self, "AA##ee##ee#"); 2891 freeO(olds); 2892 setTopSO(olds, "##"); 2893 setValO(news, "|"); 2894 r = icReplaceSmallJsonSmallStringO(self, olds, news,1); 2895 ck_assert_ptr_ne(r, null); 2896 s = toStringO(r); 2897 ck_assert_str_eq(s, "AA|ee##ee#"); 2898 free(s); 2899 // NULL new delimiter, one time: same as empty delimiter 2900 setValO(self, "AA##ee##ee#"); 2901 freeO(olds); 2902 setTopSO(olds, "##"); 2903 r = icReplaceSmallJsonSmallStringO(self, olds, NULL,1); 2904 ck_assert_ptr_ne(r, null); 2905 s = toStringO(r); 2906 ck_assert_str_eq(s, "AAee##ee#"); 2907 free(s); 2908 // non json string 2909 freeO(olds); 2910 setTopIntO(olds, 1); 2911 r = icReplaceSmallJsonSmallStringO(self, olds, news,1); 2912 ck_assert_ptr_eq(r, null); 2913 // non json object 2914 terminateO(olds); 2915 olds = (smallJsont*) allocSmallInt(1); 2916 r = icReplaceSmallJsonSmallStringO(self, olds, news,1); 2917 ck_assert_ptr_eq(r, null); 2918 terminateO(olds); 2919 terminateO(news); 2920 olds = allocSmallJson(); 2921 news = (smallStringt*) allocSmallInt(1); 2922 r = icReplaceSmallJsonSmallStringO(self, olds, news,1); 2923 ck_assert_ptr_eq(r, null); 2924 terminateO(news); 2925 news = allocSmallString(""); 2926 // empty string 2927 setValO(self, ""); 2928 freeO(olds); 2929 setTopSO(olds, "##"); 2930 r = icReplaceSmallJsonSmallStringO(self, olds, NULL,1); 2931 ck_assert_ptr_ne(r, null); 2932 s = toStringO(r); 2933 ck_assert_str_eq(s, ""); 2934 free(s); 2935 // empty old delimiter 2936 setValO(self, "qwe"); 2937 freeO(olds); 2938 setTopSO(olds, ""); 2939 setValO(news, "|"); 2940 ck_assert_ptr_eq(icReplaceSmallJsonSmallStringO(self, olds, news,1), NULL); 2941 // NULL old delimiter 2942 ck_assert_ptr_eq(icReplaceSmallJsonSmallStringO(self, NULL, news,1), NULL); 2943 // NULL string 2944 freeO(self); 2945 ck_assert_ptr_eq(icReplaceSmallJsonSmallStringO(self, olds, news,1), NULL); 2946 terminateO(olds); 2947 terminateO(news); 2948 terminateO(self); 2949 2950 } 2951 2952 2953 void icReplaceSmallJsonSSmallStringT(void) { 2954 2955 smallStringt* r; 2956 smallStringt *self = allocG("BeebeeBad"); 2957 smallJsont *olds = allocSmallJson(); 2958 const char *news; 2959 2960 // replace string, multiple character new delimeter 2961 freeO(olds); 2962 setTopSO(olds, "b"); 2963 news = "^^"; 2964 r = icReplaceSmallJsonSO(self, olds, news, 0); 2965 ck_assert_ptr_ne(r, null); 2966 char *s = toStringO(r); 2967 ck_assert_str_eq(s, "^^ee^^ee^^ad"); 2968 free(s); 2969 // replace string, multiple character old delimeter 2970 setValO(self, "AA##ee##ee#"); 2971 freeO(olds); 2972 setTopSO(olds, "##"); 2973 news = "|"; 2974 r = icReplaceSmallJsonSO(self, olds, news, 0); 2975 ck_assert_ptr_ne(r, null); 2976 s = toStringO(r); 2977 ck_assert_str_eq(s, "AA|ee|ee#"); 2978 free(s); 2979 // replace one time at the start of string 2980 setValO(self, "#ee#ee#ad"); 2981 freeO(olds); 2982 setTopSO(olds, "#"); 2983 news = "^^"; 2984 r = icReplaceSmallJsonSO(self, olds, news,1); 2985 ck_assert_ptr_ne(r, null); 2986 s = toStringO(r); 2987 ck_assert_str_eq(s, "^^ee#ee#ad"); 2988 free(s); 2989 // replace one time 2990 setValO(self, "AA##ee##ee#"); 2991 freeO(olds); 2992 setTopSO(olds, "##"); 2993 news = "|"; 2994 r = icReplaceSmallJsonSO(self, olds, news,1); 2995 ck_assert_ptr_ne(r, null); 2996 s = toStringO(r); 2997 ck_assert_str_eq(s, "AA|ee##ee#"); 2998 free(s); 2999 // NULL new delimiter, one time: same as empty delimiter 3000 setValO(self, "AA##ee##ee#"); 3001 freeO(olds); 3002 setTopSO(olds, "##"); 3003 r = icReplaceSmallJsonSO(self, olds, NULL,1); 3004 ck_assert_ptr_ne(r, null); 3005 s = toStringO(r); 3006 ck_assert_str_eq(s, "AAee##ee#"); 3007 free(s); 3008 // non json string 3009 freeO(olds); 3010 setTopIntO(olds, 1); 3011 r = icReplaceSmallJsonSO(self, olds, news,1); 3012 ck_assert_ptr_eq(r, null); 3013 // non json object 3014 terminateO(olds); 3015 olds = (smallJsont*) allocSmallInt(1); 3016 r = icReplaceSmallJsonSO(self, olds, news,1); 3017 ck_assert_ptr_eq(r, null); 3018 terminateO(olds); 3019 // empty string 3020 olds = allocSmallJson(); 3021 setValO(self, ""); 3022 setTopSO(olds, "##"); 3023 r = icReplaceSmallJsonSO(self, olds, NULL,1); 3024 ck_assert_ptr_ne(r, null); 3025 s = toStringO(r); 3026 ck_assert_str_eq(s, ""); 3027 free(s); 3028 // empty old delimiter 3029 setValO(self, "qwe"); 3030 freeO(olds); 3031 setTopSO(olds, ""); 3032 news = "|"; 3033 ck_assert_ptr_eq(icReplaceSmallJsonSO(self, olds, news,1), NULL); 3034 // NULL old delimiter 3035 ck_assert_ptr_eq(icReplaceSmallJsonSO(self, NULL, news,1), NULL); 3036 // NULL string 3037 freeO(self); 3038 ck_assert_ptr_eq(icReplaceSmallJsonSO(self, olds, news,1), NULL); 3039 terminateO(olds); 3040 terminateO(self); 3041 3042 } 3043 3044 3045 void icReplaceSmallJsonCharSmallStringT(void) { 3046 3047 smallStringt* r; 3048 smallStringt *self = allocG("beeBeebad"); 3049 smallJsont *olds = allocSmallJson(); 3050 char news; 3051 3052 // replace string, multiple character new delimeter 3053 freeO(olds); 3054 setTopSO(olds, "B"); 3055 news = '^'; 3056 r = icReplaceSmallJsonCharO(self, olds, news, 0); 3057 ck_assert_ptr_ne(r, null); 3058 char *s = toStringO(r); 3059 ck_assert_str_eq(s, "^ee^ee^ad"); 3060 free(s); 3061 // replace string, multiple character old delimeter 3062 setValO(self, "AA##ee##ee#"); 3063 freeO(olds); 3064 setTopSO(olds, "##"); 3065 news = '|'; 3066 r = icReplaceSmallJsonCharO(self, olds, news, 0); 3067 ck_assert_ptr_ne(r, null); 3068 s = toStringO(r); 3069 ck_assert_str_eq(s, "AA|ee|ee#"); 3070 free(s); 3071 // replace one time at the start of string 3072 setValO(self, "#ee#ee#ad"); 3073 freeO(olds); 3074 setTopSO(olds, "#"); 3075 news = '^'; 3076 r = icReplaceSmallJsonCharO(self, olds, news,1); 3077 ck_assert_ptr_ne(r, null); 3078 s = toStringO(r); 3079 ck_assert_str_eq(s, "^ee#ee#ad"); 3080 free(s); 3081 // replace one time 3082 setValO(self, "AA##ee##ee#"); 3083 freeO(olds); 3084 setTopSO(olds, "##"); 3085 news = '|'; 3086 r = icReplaceSmallJsonCharO(self, olds, news,1); 3087 ck_assert_ptr_ne(r, null); 3088 s = toStringO(r); 3089 ck_assert_str_eq(s, "AA|ee##ee#"); 3090 free(s); 3091 // non json string 3092 setValO(self, "AA##ee##ee#"); 3093 freeO(olds); 3094 setTopIntO(olds, 1); 3095 r = icReplaceSmallJsonCharO(self, olds, news,1); 3096 ck_assert_ptr_eq(r, null); 3097 // non json object 3098 terminateO(olds); 3099 olds = (smallJsont*) allocSmallInt(1); 3100 r = icReplaceSmallJsonCharO(self, olds, news,1); 3101 ck_assert_ptr_eq(r, null); 3102 terminateO(olds); 3103 // empty string 3104 olds = allocSmallJson(); 3105 setValO(self, ""); 3106 setTopSO(olds, "##"); 3107 r = icReplaceSmallJsonCharO(self, olds, news,1); 3108 ck_assert_ptr_ne(r, null); 3109 s = toStringO(r); 3110 ck_assert_str_eq(s, ""); 3111 free(s); 3112 // empty old delimiter 3113 setValO(self, "qwe"); 3114 freeO(olds); 3115 setTopSO(olds, ""); 3116 news = '|'; 3117 ck_assert_ptr_eq(icReplaceSmallJsonCharO(self, olds, news,1), NULL); 3118 // NULL old delimiter 3119 ck_assert_ptr_eq(icReplaceSmallJsonCharO(self, NULL, news,1), NULL); 3120 // NULL string 3121 freeO(self); 3122 ck_assert_ptr_eq(icReplaceSmallJsonCharO(self, olds, news,1), NULL); 3123 terminateO(olds); 3124 terminateO(self); 3125 3126 } 3127 3128 3129 void icReplaceSmallStringSmallJsonSmallStringT(void) { 3130 3131 smallStringt* r; 3132 smallStringt *self = allocG("BeeBeeBad"); 3133 smallStringt *olds = allocSmallString(""); 3134 smallJsont *news = allocSmallJson(); 3135 3136 // replace string, multiple character new delimeter 3137 freeO(news); 3138 setValO(olds, "b"); 3139 setTopSO(news, "^^"); 3140 r = self->f->icReplaceSmallStringSmallJson(self, olds, news, 0); 3141 ck_assert_ptr_ne(r, null); 3142 char *s = toStringO(r); 3143 ck_assert_str_eq(s, "^^ee^^ee^^ad"); 3144 free(s); 3145 // replace string, multiple character old delimeter 3146 setValO(self, "AA##ee##ee#"); 3147 freeO(news); 3148 setValO(olds, "##"); 3149 setTopSO(news, "|"); 3150 r = self->f->icReplaceSmallStringSmallJson(self, olds, news, 0); 3151 ck_assert_ptr_ne(r, null); 3152 s = toStringO(r); 3153 ck_assert_str_eq(s, "AA|ee|ee#"); 3154 free(s); 3155 // replace one time at the start of string 3156 setValO(self, "#ee#ee#ad"); 3157 freeO(news); 3158 setValO(olds, "#"); 3159 setTopSO(news, "^^"); 3160 r = self->f->icReplaceSmallStringSmallJson(self, olds, news,1); 3161 ck_assert_ptr_ne(r, null); 3162 s = toStringO(r); 3163 ck_assert_str_eq(s, "^^ee#ee#ad"); 3164 free(s); 3165 // replace one time 3166 setValO(self, "AA##ee##ee#"); 3167 freeO(news); 3168 setValO(olds, "##"); 3169 setTopSO(news, "|"); 3170 r = self->f->icReplaceSmallStringSmallJson(self, olds, news,1); 3171 ck_assert_ptr_ne(r, null); 3172 s = toStringO(r); 3173 ck_assert_str_eq(s, "AA|ee##ee#"); 3174 free(s); 3175 // NULL new delimiter, one time: same as empty delimiter 3176 setValO(self, "AA##ee##ee#"); 3177 setValO(olds, "##"); 3178 r = self->f->icReplaceSmallStringSmallJson(self, olds, NULL,1); 3179 ck_assert_ptr_ne(r, null); 3180 s = toStringO(r); 3181 ck_assert_str_eq(s, "AAee##ee#"); 3182 free(s); 3183 // non json string 3184 freeO(news); 3185 setTopIntO(news, 1); 3186 r = self->f->icReplaceSmallStringSmallJson(self, olds, news,1); 3187 ck_assert_ptr_eq(r, null); 3188 // non json object 3189 terminateO(olds); 3190 olds = (smallStringt*) allocSmallInt(1); 3191 r = self->f->icReplaceSmallStringSmallJson(self, olds, news,1); 3192 ck_assert_ptr_eq(r, null); 3193 terminateO(olds); 3194 terminateO(news); 3195 olds = allocSmallString(""); 3196 news = (smallJsont*) allocSmallInt(1); 3197 r = self->f->icReplaceSmallStringSmallJson(self, olds, news,1); 3198 ck_assert_ptr_eq(r, null); 3199 terminateO(news); 3200 news = allocSmallJson(); 3201 // empty string 3202 setValO(self, ""); 3203 setValO(olds, "##"); 3204 r = self->f->icReplaceSmallStringSmallJson(self, olds, NULL,1); 3205 ck_assert_ptr_ne(r, null); 3206 s = toStringO(r); 3207 ck_assert_str_eq(s, ""); 3208 free(s); 3209 // empty old delimiter 3210 setValO(self, "qwe"); 3211 freeO(news); 3212 setValO(olds, ""); 3213 setTopSO(news, "|"); 3214 ck_assert_ptr_eq(self->f->icReplaceSmallStringSmallJson(self, olds, news,1), NULL); 3215 // NULL old delimiter 3216 ck_assert_ptr_eq(self->f->icReplaceSmallStringSmallJson(self, NULL, news,1), NULL); 3217 // NULL string 3218 freeO(self); 3219 ck_assert_ptr_eq(self->f->icReplaceSmallStringSmallJson(self, olds, news,1), NULL); 3220 terminateO(olds); 3221 terminateO(news); 3222 terminateO(self); 3223 3224 } 3225 3226 3227 void icReplaceSmallStringSmallStringSmallStringT(void) { 3228 3229 smallStringt* r; 3230 smallStringt *self = allocG("beebeebad"); 3231 smallStringt *olds = allocSmallString(""); 3232 smallStringt *news = allocSmallString(""); 3233 3234 // replace string, multiple character new delimeter 3235 setValO(olds, "B"); 3236 setValO(news, "^^"); 3237 r = icReplaceSmallStringSmallStringO(self, olds, news, 0); 3238 ck_assert_ptr_ne(r, null); 3239 char *s = toStringO(r); 3240 ck_assert_str_eq(s, "^^ee^^ee^^ad"); 3241 free(s); 3242 // replace string, multiple character old delimeter 3243 setValO(self, "AA##ee##ee#"); 3244 setValO(olds, "##"); 3245 setValO(news, "|"); 3246 r = icReplaceSmallStringSmallStringO(self, olds, news, 0); 3247 ck_assert_ptr_ne(r, null); 3248 s = toStringO(r); 3249 ck_assert_str_eq(s, "AA|ee|ee#"); 3250 free(s); 3251 // replace one time at the start of string 3252 setValO(self, "#ee#ee#ad"); 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, "^^ee#ee#ad"); 3259 free(s); 3260 // replace one time 3261 setValO(self, "AA##ee##ee#"); 3262 setValO(olds, "##"); 3263 setValO(news, "|"); 3264 r = icReplaceSmallStringSmallStringO(self, olds, news,1); 3265 ck_assert_ptr_ne(r, null); 3266 s = toStringO(r); 3267 ck_assert_str_eq(s, "AA|ee##ee#"); 3268 free(s); 3269 // NULL new delimiter, one time: same as empty delimiter 3270 setValO(self, "AA##ee##ee#"); 3271 setValO(olds, "##"); 3272 r = icReplaceSmallStringSmallStringO(self, olds, NULL,1); 3273 ck_assert_ptr_ne(r, null); 3274 s = toStringO(r); 3275 ck_assert_str_eq(s, "AAee##ee#"); 3276 free(s); 3277 // non smallString object 3278 terminateO(olds); 3279 olds = (smallStringt*) allocSmallInt(1); 3280 r = icReplaceSmallStringSmallStringO(self, olds, news,1); 3281 ck_assert_ptr_eq(r, null); 3282 terminateO(olds); 3283 terminateO(news); 3284 olds = allocSmallString(""); 3285 news = (smallStringt*) allocSmallInt(1); 3286 r = icReplaceSmallStringSmallStringO(self, olds, news,1); 3287 ck_assert_ptr_eq(r, null); 3288 terminateO(news); 3289 news = allocSmallString(""); 3290 // empty string 3291 setValO(self, ""); 3292 setValO(olds, "##"); 3293 r = icReplaceSmallStringSmallStringO(self, olds, NULL,1); 3294 ck_assert_ptr_ne(r, null); 3295 s = toStringO(r); 3296 ck_assert_str_eq(s, ""); 3297 free(s); 3298 // empty old delimiter 3299 setValO(self, "qwe"); 3300 setValO(olds, ""); 3301 setValO(news, "|"); 3302 ck_assert_ptr_eq(icReplaceSmallStringSmallStringO(self, olds, news,1), NULL); 3303 // NULL old delimiter 3304 ck_assert_ptr_eq(icReplaceSmallStringSmallStringO(self, NULL, news,1), NULL); 3305 // NULL string 3306 freeO(self); 3307 ck_assert_ptr_eq(icReplaceSmallStringSmallStringO(self, olds, news,1), NULL); 3308 terminateO(olds); 3309 terminateO(news); 3310 terminateO(self); 3311 3312 } 3313 3314 3315 void icReplaceSmallStringSSmallStringT(void) { 3316 3317 smallStringt* r; 3318 smallStringt *self = allocG("beebeebad"); 3319 smallStringt *olds = allocSmallString(""); 3320 const char *news; 3321 3322 // replace string, multiple character new delimeter 3323 setValO(olds, "B"); 3324 news = "^^"; 3325 r = icReplaceSmallStringSO(self, olds, news, 0); 3326 ck_assert_ptr_ne(r, null); 3327 char *s = toStringO(r); 3328 ck_assert_str_eq(s, "^^ee^^ee^^ad"); 3329 free(s); 3330 // replace string, multiple character old delimeter 3331 setValO(self, "AA##ee##ee#"); 3332 setValO(olds, "##"); 3333 news = "|"; 3334 r = icReplaceSmallStringSO(self, olds, news, 0); 3335 ck_assert_ptr_ne(r, null); 3336 s = toStringO(r); 3337 ck_assert_str_eq(s, "AA|ee|ee#"); 3338 free(s); 3339 // replace one time at the start of string 3340 setValO(self, "#ee#ee#ad"); 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, "^^ee#ee#ad"); 3347 free(s); 3348 // replace one time 3349 setValO(self, "AA##ee##ee#"); 3350 setValO(olds, "##"); 3351 news = "|"; 3352 r = icReplaceSmallStringSO(self, olds, news,1); 3353 ck_assert_ptr_ne(r, null); 3354 s = toStringO(r); 3355 ck_assert_str_eq(s, "AA|ee##ee#"); 3356 free(s); 3357 // NULL new delimiter, one time: same as empty delimiter 3358 setValO(self, "AA##ee##ee#"); 3359 setValO(olds, "##"); 3360 r = icReplaceSmallStringSO(self, olds, NULL,1); 3361 ck_assert_ptr_ne(r, null); 3362 s = toStringO(r); 3363 ck_assert_str_eq(s, "AAee##ee#"); 3364 free(s); 3365 // non smallString object 3366 terminateO(olds); 3367 olds = (smallStringt*) allocSmallInt(1); 3368 r = icReplaceSmallStringSO(self, olds, news,1); 3369 ck_assert_ptr_eq(r, null); 3370 terminateO(olds); 3371 olds = allocSmallString(""); 3372 // empty string 3373 setValO(self, ""); 3374 setValO(olds, "##"); 3375 r = icReplaceSmallStringSO(self, olds, NULL,1); 3376 ck_assert_ptr_ne(r, null); 3377 s = toStringO(r); 3378 ck_assert_str_eq(s, ""); 3379 free(s); 3380 // empty old delimiter 3381 setValO(self, "qwe"); 3382 setValO(olds, ""); 3383 news = "|"; 3384 ck_assert_ptr_eq(icReplaceSmallStringSO(self, olds, news,1), NULL); 3385 // NULL old delimiter 3386 ck_assert_ptr_eq(icReplaceSmallStringSO(self, NULL, news,1), NULL); 3387 // NULL string 3388 freeO(self); 3389 ck_assert_ptr_eq(icReplaceSmallStringSO(self, olds, news,1), NULL); 3390 terminateO(olds); 3391 terminateO(self); 3392 3393 } 3394 3395 3396 void icReplaceSmallStringCharSmallStringT(void) { 3397 3398 smallStringt* r; 3399 smallStringt *self = allocG("beebeebad"); 3400 smallStringt *olds = allocSmallString(""); 3401 char news; 3402 3403 // replace string, multiple character new delimeter 3404 setValO(olds, "B"); 3405 news = '^'; 3406 r = icReplaceSmallStringCharO(self, olds, news, 0); 3407 ck_assert_ptr_ne(r, null); 3408 char *s = toStringO(r); 3409 ck_assert_str_eq(s, "^ee^ee^ad"); 3410 free(s); 3411 // replace string, multiple character old delimeter 3412 setValO(self, "AA##ee##ee#"); 3413 setValO(olds, "##"); 3414 news = '|'; 3415 r = icReplaceSmallStringCharO(self, olds, news, 0); 3416 ck_assert_ptr_ne(r, null); 3417 s = toStringO(r); 3418 ck_assert_str_eq(s, "AA|ee|ee#"); 3419 free(s); 3420 // replace one time at the start of string 3421 setValO(self, "#ee#ee#ad"); 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, "^ee#ee#ad"); 3428 free(s); 3429 // replace one time 3430 setValO(self, "AA##ee##ee#"); 3431 setValO(olds, "##"); 3432 news = '|'; 3433 r = icReplaceSmallStringCharO(self, olds, news,1); 3434 ck_assert_ptr_ne(r, null); 3435 s = toStringO(r); 3436 ck_assert_str_eq(s, "AA|ee##ee#"); 3437 free(s); 3438 // non smallString object 3439 terminateO(olds); 3440 olds = (smallStringt*) allocSmallInt(1); 3441 r = icReplaceSmallStringCharO(self, olds, news,1); 3442 ck_assert_ptr_eq(r, null); 3443 terminateO(olds); 3444 olds = allocSmallString(""); 3445 // empty string 3446 setValO(self, ""); 3447 setValO(olds, "##"); 3448 r = icReplaceSmallStringCharO(self, olds, news,1); 3449 ck_assert_ptr_ne(r, null); 3450 s = toStringO(r); 3451 ck_assert_str_eq(s, ""); 3452 free(s); 3453 // empty old delimiter 3454 setValO(self, "qwe"); 3455 setValO(olds, ""); 3456 news = '|'; 3457 ck_assert_ptr_eq(icReplaceSmallStringCharO(self, olds, news,1), NULL); 3458 // NULL old delimiter 3459 ck_assert_ptr_eq(icReplaceSmallStringCharO(self, NULL, news,1), NULL); 3460 // NULL string 3461 freeO(self); 3462 ck_assert_ptr_eq(icReplaceSmallStringCharO(self, olds, news,1), NULL); 3463 terminateO(olds); 3464 terminateO(self); 3465 3466 } 3467 3468 3469 void icReplaceSSmallJsonSmallStringT(void) { 3470 3471 smallStringt* r; 3472 smallStringt *self = allocG("beebeebad"); 3473 const char *olds; 3474 smallJsont *news = allocSmallJson(); 3475 3476 // replace string, multiple character new delimeter 3477 freeO(news); 3478 olds = "B"; 3479 setTopSO(news, "^^"); 3480 r = icReplaceSSmallJsonO(self, olds, news, 0); 3481 ck_assert_ptr_ne(r, null); 3482 char *s = toStringO(r); 3483 ck_assert_str_eq(s, "^^ee^^ee^^ad"); 3484 free(s); 3485 // replace string, multiple character old delimeter 3486 setValO(self, "AA##ee##ee#"); 3487 freeO(news); 3488 olds = "##"; 3489 setTopSO(news, "|"); 3490 r = icReplaceSSmallJsonO(self, olds, news, 0); 3491 ck_assert_ptr_ne(r, null); 3492 s = toStringO(r); 3493 ck_assert_str_eq(s, "AA|ee|ee#"); 3494 free(s); 3495 // replace one time at the start of string 3496 setValO(self, "#ee#ee#ad"); 3497 freeO(news); 3498 olds = "#"; 3499 setTopSO(news, "^^"); 3500 r = icReplaceSSmallJsonO(self, olds, news,1); 3501 ck_assert_ptr_ne(r, null); 3502 s = toStringO(r); 3503 ck_assert_str_eq(s, "^^ee#ee#ad"); 3504 free(s); 3505 // replace one time 3506 setValO(self, "AA##ee##ee#"); 3507 freeO(news); 3508 olds = "##"; 3509 setTopSO(news, "|"); 3510 r = icReplaceSSmallJsonO(self, olds, news,1); 3511 ck_assert_ptr_ne(r, null); 3512 s = toStringO(r); 3513 ck_assert_str_eq(s, "AA|ee##ee#"); 3514 free(s); 3515 // NULL new delimiter, one time: same as empty delimiter 3516 setValO(self, "AA##ee##ee#"); 3517 olds = "##"; 3518 r = icReplaceSSmallJsonO(self, olds, NULL,1); 3519 ck_assert_ptr_ne(r, null); 3520 s = toStringO(r); 3521 ck_assert_str_eq(s, "AAee##ee#"); 3522 free(s); 3523 // non json string 3524 freeO(news); 3525 olds = "e"; 3526 setTopIntO(news, 1); 3527 r = icReplaceSSmallJsonO(self, olds, news,1); 3528 ck_assert_ptr_eq(r, null); 3529 // non json object 3530 terminateO(news); 3531 news = (smallJsont*) allocSmallInt(1); 3532 r = icReplaceSSmallJsonO(self, olds, news,1); 3533 ck_assert_ptr_eq(r, null); 3534 terminateO(news); 3535 news = allocSmallJson(); 3536 // empty string 3537 setValO(self, ""); 3538 olds = "##"; 3539 r = icReplaceSSmallJsonO(self, olds, NULL,1); 3540 ck_assert_ptr_ne(r, null); 3541 s = toStringO(r); 3542 ck_assert_str_eq(s, ""); 3543 free(s); 3544 // empty old delimiter 3545 setValO(self, "qwe"); 3546 freeO(news); 3547 olds = ""; 3548 setTopSO(news, "|"); 3549 ck_assert_ptr_eq(icReplaceSSmallJsonO(self, olds, news,1), NULL); 3550 // NULL old delimiter 3551 ck_assert_ptr_eq(icReplaceSSmallJsonO(self, NULL, news,1), NULL); 3552 // NULL string 3553 freeO(self); 3554 ck_assert_ptr_eq(icReplaceSSmallJsonO(self, olds, news,1), NULL); 3555 terminateO(news); 3556 terminateO(self); 3557 3558 } 3559 3560 3561 void icReplaceSSmallStringSmallStringT(void) { 3562 3563 smallStringt* r; 3564 smallStringt *self = allocG("beebeebad"); 3565 const char *olds; 3566 smallStringt *news = allocSmallString(""); 3567 3568 // replace string, multiple character new delimeter 3569 olds = "B"; 3570 setValO(news, "^^"); 3571 r = icReplaceSSmallStringO(self, olds, news, 0); 3572 ck_assert_ptr_ne(r, null); 3573 char *s = toStringO(r); 3574 ck_assert_str_eq(s, "^^ee^^ee^^ad"); 3575 free(s); 3576 // replace string, multiple character old delimeter 3577 setValO(self, "AA##ee##ee#"); 3578 olds = "##"; 3579 setValO(news, "|"); 3580 r = icReplaceSSmallStringO(self, olds, news, 0); 3581 ck_assert_ptr_ne(r, null); 3582 s = toStringO(r); 3583 ck_assert_str_eq(s, "AA|ee|ee#"); 3584 free(s); 3585 // replace one time at the start of string 3586 setValO(self, "#ee#ee#ad"); 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, "^^ee#ee#ad"); 3593 free(s); 3594 // replace one time 3595 setValO(self, "AA##ee##ee#"); 3596 olds = "##"; 3597 setValO(news, "|"); 3598 r = icReplaceSSmallStringO(self, olds, news,1); 3599 ck_assert_ptr_ne(r, null); 3600 s = toStringO(r); 3601 ck_assert_str_eq(s, "AA|ee##ee#"); 3602 free(s); 3603 // NULL new delimiter, one time: same as empty delimiter 3604 setValO(self, "AA##ee##ee#"); 3605 olds = "##"; 3606 r = icReplaceSSmallStringO(self, olds, NULL,1); 3607 ck_assert_ptr_ne(r, null); 3608 s = toStringO(r); 3609 ck_assert_str_eq(s, "AAee##ee#"); 3610 free(s); 3611 // non smallString object 3612 terminateO(news); 3613 news = (smallStringt*) allocSmallInt(1); 3614 r = icReplaceSSmallStringO(self, olds, news,1); 3615 ck_assert_ptr_eq(r, null); 3616 terminateO(news); 3617 news = allocSmallString(""); 3618 // empty string 3619 setValO(self, ""); 3620 olds = "##"; 3621 r = icReplaceSSmallStringO(self, olds, NULL,1); 3622 ck_assert_ptr_ne(r, null); 3623 s = toStringO(r); 3624 ck_assert_str_eq(s, ""); 3625 free(s); 3626 // empty old delimiter 3627 setValO(self, "qwe"); 3628 olds = ""; 3629 setValO(news, "|"); 3630 ck_assert_ptr_eq(icReplaceSSmallStringO(self, olds, news,1), NULL); 3631 // NULL old delimiter 3632 ck_assert_ptr_eq(icReplaceSSmallStringO(self, NULL, news,1), NULL); 3633 // NULL string 3634 freeO(self); 3635 ck_assert_ptr_eq(icReplaceSSmallStringO(self, olds, news,1), NULL); 3636 terminateO(news); 3637 terminateO(self); 3638 3639 } 3640 3641 3642 void icReplaceCharSmallJsonSmallStringT(void) { 3643 3644 smallStringt* r; 3645 smallStringt *self = allocG("beebeebad"); 3646 char olds; 3647 smallJsont *news = allocSmallJson(); 3648 3649 // replace string, multiple character new delimeter 3650 freeO(news); 3651 olds = 'B'; 3652 setTopSO(news, "^^"); 3653 r = icReplaceCharSmallJsonO(self, olds, news, 0); 3654 ck_assert_ptr_ne(r, null); 3655 char *s = toStringO(r); 3656 ck_assert_str_eq(s, "^^ee^^ee^^ad"); 3657 free(s); 3658 // replace string, multiple character old delimeter 3659 setValO(self, "AA#ee#ee"); 3660 freeO(news); 3661 olds = '#'; 3662 setTopSO(news, "|"); 3663 r = icReplaceCharSmallJsonO(self, olds, news, 0); 3664 ck_assert_ptr_ne(r, null); 3665 s = toStringO(r); 3666 ck_assert_str_eq(s, "AA|ee|ee"); 3667 free(s); 3668 // replace one time at the start of string 3669 setValO(self, "#ee#ee#ad"); 3670 freeO(news); 3671 olds = '#'; 3672 setTopSO(news, "^^"); 3673 r = icReplaceCharSmallJsonO(self, olds, news,1); 3674 ck_assert_ptr_ne(r, null); 3675 s = toStringO(r); 3676 ck_assert_str_eq(s, "^^ee#ee#ad"); 3677 free(s); 3678 // replace one time 3679 setValO(self, "AA#ee##ee#"); 3680 freeO(news); 3681 olds = '#'; 3682 setTopSO(news, "|"); 3683 r = icReplaceCharSmallJsonO(self, olds, news,1); 3684 ck_assert_ptr_ne(r, null); 3685 s = toStringO(r); 3686 ck_assert_str_eq(s, "AA|ee##ee#"); 3687 free(s); 3688 // NULL new delimiter, one time: same as empty delimiter 3689 setValO(self, "AA#ee##ee#"); 3690 olds = '#'; 3691 r = icReplaceCharSmallJsonO(self, olds, NULL,1); 3692 ck_assert_ptr_ne(r, null); 3693 s = toStringO(r); 3694 ck_assert_str_eq(s, "AAee##ee#"); 3695 free(s); 3696 // non json string 3697 freeO(news); 3698 olds = 'e'; 3699 setTopIntO(news, 1); 3700 r = icReplaceCharSmallJsonO(self, olds, news,1); 3701 ck_assert_ptr_eq(r, null); 3702 // non json object 3703 terminateO(news); 3704 news = (smallJsont*) allocSmallInt(1); 3705 r = icReplaceCharSmallJsonO(self, olds, news,1); 3706 ck_assert_ptr_eq(r, null); 3707 terminateO(news); 3708 news = allocSmallJson(); 3709 // empty string 3710 setValO(self, ""); 3711 olds = '#'; 3712 r = icReplaceCharSmallJsonO(self, olds, NULL,1); 3713 ck_assert_ptr_ne(r, null); 3714 s = toStringO(r); 3715 ck_assert_str_eq(s, ""); 3716 free(s); 3717 // NULL string 3718 freeO(self); 3719 freeO(news); 3720 setTopSO(news, "|"); 3721 ck_assert_ptr_eq(icReplaceCharSmallJsonO(self, olds, news,1), NULL); 3722 terminateO(news); 3723 terminateO(self); 3724 3725 } 3726 3727 3728 void icReplaceCharSmallStringSmallStringT(void) { 3729 3730 smallStringt* r; 3731 smallStringt *self = allocG("beebeebad"); 3732 char olds; 3733 smallStringt *news = allocSmallString(""); 3734 3735 // replace string, multiple character new delimeter 3736 olds = 'B'; 3737 setValO(news, "^^"); 3738 r = icReplaceCharSmallStringO(self, olds, news, 0); 3739 ck_assert_ptr_ne(r, null); 3740 char *s = toStringO(r); 3741 ck_assert_str_eq(s, "^^ee^^ee^^ad"); 3742 free(s); 3743 // replace string, multiple character old delimeter 3744 setValO(self, "AA#ee#ee"); 3745 olds = '#'; 3746 setValO(news, "|"); 3747 r = icReplaceCharSmallStringO(self, olds, news, 0); 3748 ck_assert_ptr_ne(r, null); 3749 s = toStringO(r); 3750 ck_assert_str_eq(s, "AA|ee|ee"); 3751 free(s); 3752 // replace one time at the start of string 3753 setValO(self, "#ee#ee#ad"); 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, "^^ee#ee#ad"); 3760 free(s); 3761 // replace one time 3762 setValO(self, "AA#ee##ee#"); 3763 olds = '#'; 3764 setValO(news, "|"); 3765 r = icReplaceCharSmallStringO(self, olds, news,1); 3766 ck_assert_ptr_ne(r, null); 3767 s = toStringO(r); 3768 ck_assert_str_eq(s, "AA|ee##ee#"); 3769 free(s); 3770 // NULL new delimiter, one time: same as empty delimiter 3771 setValO(self, "AA#ee##ee#"); 3772 olds = '#'; 3773 r = icReplaceCharSmallStringO(self, olds, NULL,1); 3774 ck_assert_ptr_ne(r, null); 3775 s = toStringO(r); 3776 ck_assert_str_eq(s, "AAee##ee#"); 3777 free(s); 3778 // non smallString object 3779 terminateO(news); 3780 news = (smallStringt*) allocSmallInt(1); 3781 r = icReplaceCharSmallStringO(self, olds, news,1); 3782 ck_assert_ptr_eq(r, null); 3783 terminateO(news); 3784 news = allocSmallString(""); 3785 // empty string 3786 setValO(self, ""); 3787 olds = '#'; 3788 r = icReplaceCharSmallStringO(self, olds, NULL,1); 3789 ck_assert_ptr_ne(r, null); 3790 s = toStringO(r); 3791 ck_assert_str_eq(s, ""); 3792 free(s); 3793 // NULL string 3794 freeO(self); 3795 setValO(news, "|"); 3796 ck_assert_ptr_eq(icReplaceCharSmallStringO(self, olds, news,1), NULL); 3797 terminateO(news); 3798 terminateO(self); 3799 3800 } 3801 3802 3803 void icReplaceManySmallStringT(void) { 3804 3805 smallStringt* r; 3806 smallStringt *self = allocG(""); 3807 3808 // replace string, multiple character new delimeter 3809 setValO(self, "beebeebad"); 3810 r = icReplaceManyO(self, "B","^^","aD","AD"); 3811 ck_assert_ptr_ne(r, null); 3812 char *s = toStringO(r); 3813 ck_assert_str_eq(s, "^^ee^^ee^^AD"); 3814 free(s); 3815 // replace string, empty new delimeter 3816 setValO(self, "#ee#ee#ad"); 3817 r = icReplaceManyO(self, "#","","ad","AD"); 3818 ck_assert_ptr_ne(r, null); 3819 s = toStringO(r); 3820 ck_assert_str_eq(s, "eeeeAD"); 3821 free(s); 3822 // not enough olds:news pairs 3823 setValO(self, "#ee#ee#ad"); 3824 r = icReplaceManyO(self, "#","","ad"); 3825 ck_assert_ptr_ne(r, null); 3826 s = toStringO(r); 3827 ck_assert_str_eq(s, "eeeead"); 3828 free(s); 3829 // NULL new delimiter: same as only 2 parameters or not enough olds:news pairs 3830 setValO(self, "AA##ee##ee#"); 3831 r = icReplaceManyO(self, "##",NULL); 3832 ck_assert_ptr_eq(r, null); 3833 // empty string 3834 setValO(self, ""); 3835 r = icReplaceManyO(self, "##", ""); 3836 ck_assert_ptr_ne(r, null); 3837 s = toStringO(r); 3838 ck_assert_str_eq(s, ""); 3839 free(s); 3840 // empty string many pairs 3841 setValO(self, ""); 3842 r = icReplaceManyO(self, "##", "", "$$", ""); 3843 ck_assert_ptr_ne(r, null); 3844 s = toStringO(r); 3845 ck_assert_str_eq(s, ""); 3846 free(s); 3847 // empty string many pairs empty olds 3848 setValO(self, ""); 3849 r = icReplaceManyO(self, "##", "", "", ""); 3850 ck_assert_ptr_ne(r, null); 3851 s = toStringO(r); 3852 ck_assert_str_eq(s, ""); 3853 free(s); 3854 // empty string and NULL old delimiter 3855 setValO(self, ""); 3856 r = icReplaceManyO(self, NULL,"|"); 3857 ck_assert_ptr_ne(r, null); 3858 s = toStringO(r); 3859 ck_assert_str_eq(s, ""); 3860 free(s); 3861 // empty string and NULL old delimiter not first - same as replace empty string 3862 setValO(self, ""); 3863 r = icReplaceManyO(self,"##","|", NULL,"|"); 3864 ck_assert_ptr_ne(r, null); 3865 s = toStringO(r); 3866 ck_assert_str_eq(s, ""); 3867 free(s); 3868 // empty old delimiter 3869 setValO(self, "AA##ee##ee#"); 3870 ck_assert_ptr_eq(icReplaceManyO(self, "","|", "AA", "BB"), NULL); 3871 // empty old delimiter not first 3872 ck_assert_ptr_eq(icReplaceManyO(self, "##","|", "", "BB"), NULL); 3873 // NULL string 3874 freeO(self); 3875 ck_assert_ptr_eq(icReplaceManyO(self, "##","|"), NULL); 3876 terminateO(self); 3877 3878 } 3879 3880 3881 void equalSmallStringT(void) { 3882 3883 bool r; 3884 smallStringt *self = allocG(""); 3885 smallStringt *string = allocSmallString("qwe"); 3886 3887 r = equalO(self,string); 3888 ck_assert(!r); 3889 setValO(self, "qwe"); 3890 r = equalO(self,string); 3891 ck_assert(r); 3892 // empty strings 3893 freeO(string); 3894 r = equalO(self,string); 3895 ck_assert(!r); 3896 freeO(self); 3897 r = equalO(self,string); 3898 ck_assert(!r); 3899 // non smallString object 3900 setValO(self, "qwe"); 3901 terminateO(string); 3902 string = (smallStringt*) allocSmallInt(1); 3903 r = equalO(self,string); 3904 ck_assert(!r); 3905 terminateO(string); 3906 // null object 3907 r = equalO(self, null); 3908 ck_assert(!r); 3909 terminateO(self); 3910 3911 } 3912 3913 3914 void equalSSmallStringT(void) { 3915 3916 bool r; 3917 smallStringt *self = allocG(""); 3918 3919 r = equalSO(self,"qwe"); 3920 ck_assert(!r); 3921 setValO(self, "qwe"); 3922 r = equalSO(self,"qwe"); 3923 ck_assert(r); 3924 // empty strings 3925 freeO(self); 3926 r = equalSO(self, ""); 3927 ck_assert(!r); 3928 // null object 3929 setValO(self, "qwe"); 3930 r = equalSO(self, null); 3931 ck_assert(!r); 3932 terminateO(self); 3933 3934 } 3935 3936 3937 void equalCharSmallStringT(void) { 3938 3939 bool r; 3940 smallStringt *self = allocG(""); 3941 3942 r = equalCharO(self,'q'); 3943 ck_assert(!r); 3944 setValO(self, "q"); 3945 r = equalCharO(self,'q'); 3946 ck_assert(r); 3947 // empty strings 3948 freeO(self); 3949 r = equalCharO(self, ' '); 3950 ck_assert(!r); 3951 terminateO(self); 3952 3953 } 3954 3955 3956 void equalSmallStringBaseT(void) { 3957 3958 bool r; 3959 smallStringt *self = allocG("12"); 3960 baset* p2 = (baset*) allocSmallInt(12); 3961 3962 r = self->f->equalBase(self, p2); 3963 ck_assert(r); 3964 // empty self 3965 freeO(self); 3966 r = self->f->equalBase(self, p2); 3967 ck_assert(!r); 3968 // null object 3969 setValO(self, "qwe"); 3970 r = self->f->equalBase(self, null); 3971 ck_assert(!r); 3972 terminateO(p2); 3973 terminateO(self); 3974 3975 } 3976 3977 3978 void equalSmallStringBoolT(void) { 3979 3980 bool r; 3981 smallStringt* self = allocG("TRUE"); 3982 3983 r = self->f->equalBool(self, true); 3984 ck_assert(r); 3985 setValO(self, "true"); 3986 r = self->f->equalBool(self, true); 3987 ck_assert(r); 3988 setValO(self, "FALSE"); 3989 r = self->f->equalBool(self, false); 3990 ck_assert(r); 3991 setValO(self, "false"); 3992 r = self->f->equalBool(self, false); 3993 ck_assert(r); 3994 r = self->f->equalBool(self, true); 3995 ck_assert(!r); 3996 setValO(self, ""); 3997 r = self->f->equalBool(self, true); 3998 ck_assert(!r); 3999 // empty self 4000 freeO(self); 4001 r = self->f->equalBool(self, true); 4002 ck_assert(!r); 4003 terminateO(self); 4004 4005 } 4006 4007 4008 void equalSmallStringDoubleT(void) { 4009 4010 bool r; 4011 smallStringt* self = allocG("2.2"); 4012 4013 r = self->f->equalDouble(self, 2.2); 4014 ck_assert(r); 4015 r = self->f->equalDouble(self, 2.22); 4016 ck_assert(!r); 4017 // not a double 4018 setValO(self, "2"); 4019 r = self->f->equalDouble(self, 2); 4020 ck_assert(!r); 4021 setValO(self, "qwe"); 4022 r = self->f->equalDouble(self, 2); 4023 ck_assert(!r); 4024 // empty self 4025 freeO(self); 4026 r = self->f->equalDouble(self, 2); 4027 ck_assert(!r); 4028 terminateO(self); 4029 4030 } 4031 4032 4033 void equalSmallStringInt64T(void) { 4034 4035 bool r; 4036 smallStringt* self = allocG("2"); 4037 4038 r = self->f->equalInt64(self, 2); 4039 ck_assert(r); 4040 r = self->f->equalInt64(self, 3); 4041 ck_assert(!r); 4042 // not a double 4043 setValO(self, "2.2"); 4044 r = self->f->equalInt64(self, 2); 4045 ck_assert(!r); 4046 setValO(self, "qwe"); 4047 r = self->f->equalInt64(self, 2); 4048 ck_assert(!r); 4049 // empty self 4050 freeO(self); 4051 r = self->f->equalInt64(self, 2); 4052 ck_assert(!r); 4053 terminateO(self); 4054 4055 } 4056 4057 4058 void equalSmallStringInt32T(void) { 4059 4060 bool r; 4061 smallStringt* self = allocG("2"); 4062 4063 r = self->f->equalInt32(self, 2); 4064 ck_assert(r); 4065 r = self->f->equalInt32(self, 3); 4066 ck_assert(!r); 4067 // not a double 4068 setValO(self, "2.2"); 4069 r = self->f->equalInt32(self, 2); 4070 ck_assert(!r); 4071 setValO(self, "qwe"); 4072 r = self->f->equalInt32(self, 2); 4073 ck_assert(!r); 4074 // empty self 4075 freeO(self); 4076 r = self->f->equalInt32(self, 2); 4077 ck_assert(!r); 4078 terminateO(self); 4079 4080 } 4081 4082 4083 void equalSmallStringUint32T(void) { 4084 4085 bool r; 4086 smallStringt* self = allocG("2"); 4087 4088 r = self->f->equalUint32(self, 2); 4089 ck_assert(r); 4090 r = self->f->equalUint32(self, 3); 4091 ck_assert(!r); 4092 // not a double 4093 setValO(self, "2.2"); 4094 r = self->f->equalUint32(self, 2); 4095 ck_assert(!r); 4096 setValO(self, "qwe"); 4097 r = self->f->equalUint32(self, 2); 4098 ck_assert(!r); 4099 // empty self 4100 freeO(self); 4101 r = self->f->equalUint32(self, 2); 4102 ck_assert(!r); 4103 terminateO(self); 4104 4105 } 4106 4107 4108 void equalSmallStringUint64T(void) { 4109 4110 bool r; 4111 smallStringt* self = allocG("2"); 4112 4113 r = self->f->equalUint64(self, 2); 4114 ck_assert(r); 4115 r = self->f->equalUint64(self, 3); 4116 ck_assert(!r); 4117 // not a double 4118 setValO(self, "2.2"); 4119 r = self->f->equalUint64(self, 2); 4120 ck_assert(!r); 4121 setValO(self, "qwe"); 4122 r = self->f->equalUint64(self, 2); 4123 ck_assert(!r); 4124 // empty self 4125 freeO(self); 4126 r = self->f->equalUint64(self, 2); 4127 ck_assert(!r); 4128 terminateO(self); 4129 4130 } 4131 4132 4133 void equalSmallStringSmallBoolT(void) { 4134 4135 bool r; 4136 smallStringt* self = allocG("TRUE"); 4137 smallBoolt* p2 = allocSmallBool(true); 4138 4139 r = self->f->equalSmallBool(self, p2); 4140 ck_assert(r); 4141 setValO(self, "true"); 4142 r = self->f->equalSmallBool(self, p2); 4143 ck_assert(r); 4144 setValO(self, "FALSE"); 4145 setValO(p2, false); 4146 r = self->f->equalSmallBool(self, p2); 4147 ck_assert(r); 4148 setValO(self, "false"); 4149 r = self->f->equalSmallBool(self, p2); 4150 ck_assert(r); 4151 setValO(p2, true); 4152 r = self->f->equalSmallBool(self, p2); 4153 ck_assert(!r); 4154 // empty p2 4155 freeO(p2); 4156 r = self->f->equalSmallBool(self, p2); 4157 ck_assert(!r); 4158 setValO(p2, true); 4159 // empty string 4160 setValO(self, ""); 4161 r = self->f->equalSmallBool(self, p2); 4162 ck_assert(!r); 4163 // non smallBool object 4164 terminateO(p2); 4165 p2 = (smallBoolt*) allocSmallInt(2); 4166 r = self->f->equalSmallBool(self, p2); 4167 ck_assert(!r); 4168 terminateO(p2); 4169 p2 = allocSmallBool(true); 4170 // null p2 4171 r = self->f->equalSmallBool(self, null); 4172 ck_assert(!r); 4173 // empty self 4174 freeO(self); 4175 r = self->f->equalSmallBool(self, p2); 4176 ck_assert(!r); 4177 terminateO(p2); 4178 terminateO(self); 4179 4180 } 4181 4182 4183 void equalSmallStringSmallBytesT(void) { 4184 4185 bool r; 4186 smallStringt* self = allocG("qwe"); 4187 smallBytest* p2 = allocSmallBytes("qwe", sizeof("qwe")); 4188 4189 r = self->f->equalSmallBytes(self, p2); 4190 ck_assert(r); 4191 // different length 4192 setValO(self, "qw"); 4193 r = self->f->equalSmallBytes(self, p2); 4194 ck_assert(!r); 4195 // empty p2 4196 freeO(p2); 4197 r = self->f->equalSmallBytes(self, p2); 4198 ck_assert(!r); 4199 // non smallBytes object 4200 terminateO(p2); 4201 p2 = (smallBytest*) allocSmallInt(2); 4202 r = self->f->equalSmallBytes(self, p2); 4203 ck_assert(!r); 4204 // null p2 4205 r = self->f->equalSmallBytes(self, null); 4206 ck_assert(!r); 4207 // empty self 4208 freeO(self); 4209 r = self->f->equalSmallBytes(self, p2); 4210 ck_assert(!r); 4211 terminateO(p2); 4212 terminateO(self); 4213 4214 } 4215 4216 4217 void equalSmallStringSmallDoubleT(void) { 4218 4219 bool r; 4220 smallStringt* self = allocG("2.2"); 4221 smallDoublet* p2 = allocSmallDouble(2.2); 4222 4223 r = self->f->equalSmallDouble(self, p2); 4224 ck_assert(r); 4225 setValO(p2, 2.22); 4226 r = self->f->equalSmallDouble(self, p2); 4227 ck_assert(!r); 4228 // not a double 4229 setValO(self, "2"); 4230 r = self->f->equalSmallDouble(self, setValO(p2, 2)); 4231 ck_assert(!r); 4232 setValO(self, "qwe"); 4233 r = self->f->equalSmallDouble(self, p2); 4234 ck_assert(!r); 4235 // empty p2 4236 freeO(p2); 4237 r = self->f->equalSmallDouble(self, p2); 4238 ck_assert(!r); 4239 // non smallDouble object 4240 terminateO(p2); 4241 p2 = (smallDoublet*) allocSmallInt(2); 4242 r = self->f->equalSmallDouble(self, p2); 4243 ck_assert(!r); 4244 // null p2 4245 r = self->f->equalSmallDouble(self, null); 4246 ck_assert(!r); 4247 // empty self 4248 freeO(self); 4249 r = self->f->equalSmallDouble(self, p2); 4250 ck_assert(!r); 4251 terminateO(p2); 4252 terminateO(self); 4253 4254 } 4255 4256 4257 void equalSmallStringSmallIntT(void) { 4258 4259 bool r; 4260 smallStringt* self = allocG("2"); 4261 smallIntt* p2 = allocSmallInt(2); 4262 4263 r = self->f->equalSmallInt(self, p2); 4264 ck_assert(r); 4265 setValO(p2, 3); 4266 r = self->f->equalSmallInt(self, p2); 4267 ck_assert(!r); 4268 // not an int 4269 setValO(self, "2.2"); 4270 r = self->f->equalSmallInt(self, setValO(p2, 2)); 4271 ck_assert(!r); 4272 setValO(self, "qwe"); 4273 r = self->f->equalSmallInt(self, p2); 4274 ck_assert(!r); 4275 // empty p2 4276 freeO(p2); 4277 r = self->f->equalSmallInt(self, p2); 4278 ck_assert(!r); 4279 // non smallDouble object 4280 terminateO(p2); 4281 p2 = (smallIntt*) allocSmallDouble(2); 4282 r = self->f->equalSmallInt(self, p2); 4283 ck_assert(!r); 4284 // null p2 4285 r = self->f->equalSmallInt(self, null); 4286 ck_assert(!r); 4287 // empty self 4288 freeO(self); 4289 r = self->f->equalSmallInt(self, p2); 4290 ck_assert(!r); 4291 terminateO(p2); 4292 terminateO(self); 4293 4294 } 4295 4296 4297 void equalSmallStringSmallJsonT(void) { 4298 4299 bool r; 4300 smallStringt* self = allocG("qwe"); 4301 smallJsont* p2 = allocSmallJson(); 4302 4303 setTopSO(p2, "qwe"); 4304 r = self->f->equalSmallJson(self, p2); 4305 ck_assert(r); 4306 // non json object 4307 terminateO(p2); 4308 p2 = (smallJsont*) allocSmallInt(2); 4309 r = self->f->equalSmallJson(self, p2); 4310 ck_assert(!r); 4311 // null p2 4312 r = self->f->equalSmallJson(self, null); 4313 ck_assert(!r); 4314 terminateO(p2); 4315 terminateO(self); 4316 4317 } 4318 4319 4320 void icEqualSmallStringT(void) { 4321 4322 bool r; 4323 smallStringt *self = allocG(""); 4324 smallStringt *string = allocSmallString("Qwe"); 4325 4326 r = icEqualO(self,string); 4327 ck_assert(!r); 4328 setValO(self, "qwe"); 4329 r = icEqualO(self,string); 4330 ck_assert(r); 4331 // empty strings 4332 freeO(string); 4333 r = icEqualO(self,string); 4334 ck_assert(!r); 4335 freeO(self); 4336 r = icEqualO(self,string); 4337 ck_assert(!r); 4338 // non smallString object 4339 setValO(self, "qwe"); 4340 terminateO(string); 4341 string = (smallStringt*) allocSmallInt(1); 4342 r = icEqualO(self,string); 4343 ck_assert(!r); 4344 terminateO(string); 4345 // null object 4346 r = icEqualO(self, null); 4347 ck_assert(!r); 4348 terminateO(self); 4349 4350 } 4351 4352 4353 void icEqualSSmallStringT(void) { 4354 4355 bool r; 4356 smallStringt *self = allocG(""); 4357 4358 r = icEqualSO(self,"qwe"); 4359 ck_assert(!r); 4360 setValO(self, "qwe"); 4361 r = icEqualSO(self, "Qwe"); 4362 ck_assert(r); 4363 // empty strings 4364 freeO(self); 4365 r = icEqualSO(self, ""); 4366 ck_assert(!r); 4367 // null object 4368 setValO(self, "qwe"); 4369 r = icEqualSO(self, null); 4370 ck_assert(!r); 4371 terminateO(self); 4372 4373 } 4374 4375 4376 void icEqualCharSmallStringT(void) { 4377 4378 bool r; 4379 smallStringt *self = allocG(""); 4380 4381 r = icEqualCharO(self,'q'); 4382 ck_assert(!r); 4383 setValO(self, "q"); 4384 r = icEqualCharO(self,'Q'); 4385 ck_assert(r); 4386 // empty strings 4387 freeO(self); 4388 r = icEqualCharO(self, ' '); 4389 ck_assert(!r); 4390 terminateO(self); 4391 4392 } 4393 4394 4395 void icEqualSmallStringBaseT(void) { 4396 4397 bool r; 4398 smallStringt* self = allocG("qwe"); 4399 baset* p2 = (baset*) allocSmallString("QWE"); 4400 4401 r = self->f->icEqualBase(self, p2); 4402 ck_assert(r); 4403 // empty self 4404 freeO(self); 4405 r = self->f->icEqualBase(self, p2); 4406 ck_assert(!r); 4407 // null object 4408 setValO(self, "qwe"); 4409 r = self->f->icEqualBase(self, null); 4410 ck_assert(!r); 4411 terminateO(p2); 4412 terminateO(self); 4413 4414 } 4415 4416 4417 void icEqualSmallStringSmallJsonT(void) { 4418 4419 bool r; 4420 smallStringt* self = allocG("qwe"); 4421 smallJsont* p2 = allocSmallJson(); 4422 4423 setTopSO(p2, "Qwe"); 4424 r = self->f->icEqualSmallJson(self, p2); 4425 ck_assert(r); 4426 // non json object 4427 terminateO(p2); 4428 p2 = (smallJsont*) allocSmallInt(2); 4429 r = self->f->icEqualSmallJson(self, p2); 4430 ck_assert(!r); 4431 // null p2 4432 r = self->f->icEqualSmallJson(self, null); 4433 ck_assert(!r); 4434 terminateO(p2); 4435 terminateO(self); 4436 4437 } 4438 4439 4440 void equalISSmallStringT(void) { 4441 4442 smallStringt *self = allocG("Ashee|"); 4443 4444 // identical strings 4445 ck_assert(equalISO(self, "shee", 1)); 4446 setValO(self, "Ashee"); 4447 ck_assert(equalISO(self, "shee", -4)); 4448 // string at index shorter than string2 4449 ck_assert(!equalISO(self, "shee", 2)); 4450 // empty string 4451 setValO(self, ""); 4452 ck_assert(!equalISO(self, "shee", 0)); 4453 ck_assert(equalISO(self, "", 0)); 4454 setValO(self, "Ashee"); 4455 ck_assert(!equalISO(self, "", 0)); 4456 // index mismatch 4457 ck_assert(!equalISO(self, "shee", 0)); 4458 // index outside 4459 ck_assert(!equalISO(self, "shee", 10)); 4460 ck_assert(!equalISO(self, "shee", -10)); 4461 // different strings 4462 ck_assert(!equalISO(self, "SH",0)); 4463 // empty self 4464 freeO(self); 4465 ck_assert(!equalISO(self, "SH",0)); 4466 // NULL string 4467 setValO(self, "Ashee"); 4468 ck_assert(!equalISO(self, NULL, 0)); 4469 terminateO(self); 4470 4471 } 4472 4473 4474 void equalICharSmallStringT(void) { 4475 4476 smallStringt *self = allocG("Ashee"); 4477 4478 // identical strings 4479 ck_assert(equalICharO(self, 's', 1)); 4480 ck_assert(equalICharO(self, 's', -4)); 4481 ck_assert(!equalICharO(self, 's', 2)); 4482 // empty string 4483 setValO(self, ""); 4484 ck_assert(!equalICharO(self, 's', 0)); 4485 ck_assert(equalICharO(self, 0, 0)); 4486 setValO(self, "Ashee"); 4487 ck_assert(!equalICharO(self, 0, 0)); 4488 // index mismatch 4489 ck_assert(!equalICharO(self, 's', 0)); 4490 // index outside 4491 ck_assert(!equalICharO(self, 's', 10)); 4492 ck_assert(!equalICharO(self, 's', -10)); 4493 // different strings 4494 setValO(self, "shee"); 4495 ck_assert(!equalICharO(self, 'S',0)); 4496 // NULL string 4497 ck_assert(!equalICharO(self, 0, 0)); 4498 // empty self 4499 freeO(self); 4500 ck_assert(!equalICharO(self, 'S',0)); 4501 terminateO(self); 4502 4503 } 4504 4505 4506 void equalISmallJsonSmallStringT(void) { 4507 4508 smallStringt *self = allocG("Ashee|"); 4509 smallJsont *string = allocSmallJson(); 4510 4511 // identical strings 4512 setTopSO(string, "shee"); 4513 ck_assert(equalISmallJsonO(self, string, 1)); 4514 setValO(self, "Ashee"); 4515 ck_assert(equalISmallJsonO(self, string, -4)); 4516 // string at index shorter than string2 4517 ck_assert(!equalISmallJsonO(self, string, 2)); 4518 // empty string 4519 setValO(self, ""); 4520 ck_assert(!equalISmallJsonO(self, string, 0)); 4521 freeO(string); 4522 setTopSO(string, ""); 4523 ck_assert(equalISmallJsonO(self, string, 0)); 4524 setValO(self, "Ashee"); 4525 ck_assert(!equalISmallJsonO(self, string, 0)); 4526 // index mismatch 4527 freeO(string); 4528 setTopSO(string, "shee"); 4529 ck_assert(!equalISmallJsonO(self, string, 0)); 4530 // index outside 4531 ck_assert(!equalISmallJsonO(self, string, 10)); 4532 ck_assert(!equalISmallJsonO(self, string, -10)); 4533 // different strings 4534 freeO(string); 4535 setTopSO(string, "SH"); 4536 ck_assert(!equalISmallJsonO(self, string,0)); 4537 // non json string 4538 freeO(string); 4539 setTopIntO(string, 1); 4540 ck_assert(!equalISmallJsonO(self, string,0)); 4541 // non json object 4542 terminateO(string); 4543 string = (smallJsont*) allocSmallInt(2); 4544 ck_assert(!equalISmallJsonO(self, string,0)); 4545 // empty self 4546 terminateO(string); 4547 string = allocSmallJson(); 4548 setTopSO(string, "SH"); 4549 freeO(self); 4550 ck_assert(!equalISmallJsonO(self, string,0)); 4551 // NULL string 4552 setValO(self, "Ashee"); 4553 ck_assert(!equalISmallJsonO(self, NULL, 0)); 4554 terminateO(string); 4555 terminateO(self); 4556 4557 } 4558 4559 4560 void equalISmallStringSmallStringT(void) { 4561 4562 smallStringt *self = allocG("Ashee|"); 4563 smallStringt *string = allocSmallString("shee"); 4564 4565 // identical strings 4566 ck_assert(equalISmallStringO(self, string, 1)); 4567 setValO(self, "Ashee"); 4568 ck_assert(equalISmallStringO(self, string, -4)); 4569 // string at index shorter than string2 4570 ck_assert(!equalISmallStringO(self, string, 2)); 4571 // empty string 4572 setValO(self, ""); 4573 ck_assert(!equalISmallStringO(self, string, 0)); 4574 setValO(string, ""); 4575 ck_assert(equalISmallStringO(self, string, 0)); 4576 setValO(self, "Ashee"); 4577 ck_assert(!equalISmallStringO(self, string, 0)); 4578 // index mismatch 4579 freeO(string); 4580 setValO(string, "shee"); 4581 ck_assert(!equalISmallStringO(self, string, 0)); 4582 // index outside 4583 ck_assert(!equalISmallStringO(self, string, 10)); 4584 ck_assert(!equalISmallStringO(self, string, -10)); 4585 // different strings 4586 setValO(string, "SH"); 4587 ck_assert(!equalISmallStringO(self, string,0)); 4588 // non smallString object 4589 terminateO(string); 4590 string = (smallStringt*) allocSmallInt(2); 4591 ck_assert(!equalISmallStringO(self, string,0)); 4592 // empty self 4593 terminateO(string); 4594 string = allocSmallString("SH"); 4595 freeO(self); 4596 ck_assert(!equalISmallStringO(self, string,0)); 4597 // NULL string 4598 setValO(self, "Ashee"); 4599 ck_assert(!equalISmallStringO(self, NULL, 0)); 4600 terminateO(string); 4601 terminateO(self); 4602 4603 } 4604 4605 4606 void startsWithSSmallStringT(void) { 4607 4608 smallStringt *self = allocG("shee"); 4609 4610 // identical strings 4611 ck_assert(startsWithSO(self, "shee")); 4612 setValO(self, "sheepy"); 4613 ck_assert(startsWithSO(self, "shee")); 4614 // different strings 4615 setValO(self, "shee"); 4616 ck_assert(!startsWithSO(self, "SH")); 4617 ck_assert(!startsWithSO(self, "sheep")); 4618 setValO(self, "-shee"); 4619 ck_assert(!startsWithSO(self, "shee")); 4620 // NULL string 4621 ck_assert(!startsWithSO(self, NULL)); 4622 // empty self 4623 freeO(self); 4624 ck_assert(!startsWithSO(self, "shee")); 4625 terminateO(self); 4626 4627 } 4628 4629 4630 void startsWithCharSmallStringT(void) { 4631 4632 smallStringt *self = allocG("shee"); 4633 4634 // identical strings 4635 ck_assert(startsWithCharO(self, 's')); 4636 setValO(self, "sheepy"); 4637 ck_assert(startsWithCharO(self, 's')); 4638 setValO(self, ""); 4639 ck_assert(startsWithCharO(self, 0)); 4640 // different strings 4641 setValO(self, "shee"); 4642 ck_assert(!startsWithCharO(self, 'S')); 4643 setValO(self, "-shee"); 4644 ck_assert(!startsWithCharO(self, 's')); 4645 setValO(self, ""); 4646 ck_assert(!startsWithCharO(self, '0')); 4647 // NULL string 4648 setValO(self, "shee"); 4649 ck_assert(!startsWithCharO(self, 0)); 4650 // empty self 4651 freeO(self); 4652 ck_assert(!startsWithCharO(self, '0')); 4653 terminateO(self); 4654 4655 } 4656 4657 4658 void startsWithSmallJsonSmallStringT(void) { 4659 4660 smallStringt *self = allocG("shee"); 4661 smallJsont *string = allocSmallJson(); 4662 4663 // identical strings 4664 setTopSO(string, "shee"); 4665 ck_assert(startsWithSmallJsonO(self, string)); 4666 setValO(self, "sheepy"); 4667 ck_assert(startsWithSmallJsonO(self, string)); 4668 // different strings 4669 setValO(self, "shee"); 4670 freeO(string); 4671 setTopSO(string, "SH"); 4672 ck_assert(!startsWithSmallJsonO(self, string)); 4673 freeO(string); 4674 setTopSO(string, "sheep"); 4675 ck_assert(!startsWithSmallJsonO(self, string)); 4676 setValO(self, "-shee"); 4677 freeO(string); 4678 setTopSO(string, "shee"); 4679 ck_assert(!startsWithSmallJsonO(self, string)); 4680 // non json string 4681 freeO(string); 4682 setTopIntO(string, 1); 4683 ck_assert(!startsWithSmallJsonO(self, string)); 4684 // non json object 4685 terminateO(string); 4686 string = (smallJsont*) allocSmallInt(1); 4687 ck_assert(!startsWithSmallJsonO(self, string)); 4688 terminateO(string); 4689 string = allocSmallJson(); 4690 // NULL string 4691 ck_assert(!startsWithSmallJsonO(self, NULL)); 4692 // empty self 4693 freeO(self); 4694 setTopSO(string, "shee"); 4695 ck_assert(!startsWithSmallJsonO(self, string)); 4696 terminateO(string); 4697 terminateO(self); 4698 4699 } 4700 4701 4702 void startsWithSmallStringSmallStringT(void) { 4703 4704 smallStringt *self = allocG("shee"); 4705 smallStringt *string = allocSmallString("shee"); 4706 4707 // identical strings 4708 ck_assert(startsWithSmallStringO(self, string)); 4709 setValO(self, "sheepy"); 4710 ck_assert(startsWithSmallStringO(self, string)); 4711 // different strings 4712 setValO(self, "shee"); 4713 setValO(string, "SH"); 4714 ck_assert(!startsWithSmallStringO(self, string)); 4715 setValO(string, "sheep"); 4716 ck_assert(!startsWithSmallStringO(self, string)); 4717 setValO(self, "-shee"); 4718 setValO(string, "shee"); 4719 ck_assert(!startsWithSmallStringO(self, string)); 4720 // non smallString object 4721 terminateO(string); 4722 string = (smallStringt*) allocSmallInt(1); 4723 ck_assert(!startsWithSmallStringO(self, string)); 4724 terminateO(string); 4725 string = allocSmallString("shee"); 4726 // NULL string 4727 ck_assert(!startsWithSmallStringO(self, NULL)); 4728 // empty self 4729 freeO(self); 4730 ck_assert(!startsWithSmallStringO(self, string)); 4731 terminateO(string); 4732 terminateO(self); 4733 4734 } 4735 4736 4737 void endsWithSSmallStringT(void) { 4738 4739 smallStringt *self = allocG("shee"); 4740 4741 // identical strings 4742 ck_assert(endsWithSO(self, "shee")); 4743 setValO(self, "sheepy"); 4744 ck_assert(endsWithSO(self, "eepy")); 4745 // different strings 4746 setValO(self, "shee"); 4747 ck_assert(!endsWithSO(self, "SH")); 4748 ck_assert(!endsWithSO(self, "sheep")); 4749 setValO(self, "shee-"); 4750 ck_assert(!endsWithSO(self, "shee")); 4751 // NULL string 4752 ck_assert(!endsWithSO(self, NULL)); 4753 // empty self 4754 freeO(self); 4755 ck_assert(!endsWithSO(self, "shee")); 4756 terminateO(self); 4757 4758 } 4759 4760 4761 void endsWithCharSmallStringT(void) { 4762 4763 smallStringt *self = allocG("shee"); 4764 4765 // identical strings 4766 ck_assert(endsWithCharO(self, 'e')); 4767 setValO(self, "sheepy"); 4768 ck_assert(endsWithCharO(self, 'y')); 4769 setValO(self, ""); 4770 ck_assert(endsWithCharO(self, 0)); 4771 // different strings 4772 setValO(self, "shee"); 4773 ck_assert(!endsWithCharO(self, 'E')); 4774 ck_assert(!endsWithCharO(self, 'p')); 4775 setValO(self, "shee-"); 4776 ck_assert(!endsWithCharO(self, 'e')); 4777 setValO(self, ""); 4778 ck_assert(!endsWithCharO(self, '0')); 4779 // NULL string 4780 setValO(self, "a"); 4781 ck_assert(!endsWithCharO(self, 0)); 4782 // empty self 4783 freeO(self); 4784 ck_assert(!endsWithCharO(self, '0')); 4785 terminateO(self); 4786 4787 } 4788 4789 4790 void endsWithSmallJsonSmallStringT(void) { 4791 4792 smallStringt *self = allocG("shee"); 4793 smallJsont *string = allocSmallJson(); 4794 4795 // identical strings 4796 setTopSO(string, "shee"); 4797 ck_assert(endsWithSmallJsonO(self, string)); 4798 setValO(self, "sheepy"); 4799 freeO(string); 4800 setTopSO(string, "eepy"); 4801 ck_assert(endsWithSmallJsonO(self, string)); 4802 // different strings 4803 setValO(self, "shee"); 4804 freeO(string); 4805 setTopSO(string, "SH"); 4806 ck_assert(!endsWithSmallJsonO(self, string)); 4807 freeO(string); 4808 setTopSO(string, "sheep"); 4809 ck_assert(!endsWithSmallJsonO(self, string)); 4810 setValO(self, "shee-"); 4811 freeO(string); 4812 setTopSO(string, "shee"); 4813 ck_assert(!endsWithSmallJsonO(self, string)); 4814 // non json string 4815 freeO(string); 4816 setTopIntO(string, 1); 4817 ck_assert(!endsWithSmallJsonO(self, string)); 4818 // non json object 4819 terminateO(string); 4820 string = (smallJsont*) allocSmallInt(1); 4821 ck_assert(!endsWithSmallJsonO(self, string)); 4822 terminateO(string); 4823 string = allocSmallJson(); 4824 setTopSO(string, "shee"); 4825 // NULL string 4826 ck_assert(!endsWithSmallJsonO(self, NULL)); 4827 // empty self 4828 freeO(self); 4829 ck_assert(!endsWithSmallJsonO(self, string)); 4830 terminateO(string); 4831 terminateO(self); 4832 4833 } 4834 4835 4836 void endsWithSmallStringSmallStringT(void) { 4837 4838 smallStringt *self = allocG("shee"); 4839 smallStringt *string = allocSmallString("shee"); 4840 4841 // identical strings 4842 ck_assert(endsWithSmallStringO(self, string)); 4843 setValO(self, "sheepy"); 4844 setValO(string, "eepy"); 4845 ck_assert(endsWithSmallStringO(self, string)); 4846 // different strings 4847 setValO(self, "shee"); 4848 ck_assert(!endsWithSmallStringO(self, string)); 4849 setValO(string, "sheep"); 4850 ck_assert(!endsWithSmallStringO(self, string)); 4851 setValO(self, "shee-"); 4852 setValO(string, "shee"); 4853 ck_assert(!endsWithSmallStringO(self, string)); 4854 // non smallString object 4855 terminateO(string); 4856 string = (smallStringt*) allocSmallInt(1); 4857 ck_assert(!endsWithSmallStringO(self, string)); 4858 terminateO(string); 4859 string = allocSmallString("shee"); 4860 // NULL string 4861 ck_assert(!endsWithSmallStringO(self, NULL)); 4862 // empty self 4863 freeO(self); 4864 ck_assert(!endsWithSmallStringO(self, string)); 4865 terminateO(string); 4866 terminateO(self); 4867 4868 } 4869 4870 4871 void countSSmallStringT(void) { 4872 4873 smallStringt *self = allocG("sheepy"); 4874 4875 // positive count 4876 ck_assert_int_eq(countSO(self, "shee"), 1); 4877 setValO(self, "aaa aaa"); 4878 ck_assert_int_eq(countSO(self, "a"), 6); 4879 ck_assert_int_eq(countSO(self, "aa"), 2); 4880 // 0 count 4881 setValO(self, "shee"); 4882 ck_assert_int_eq(countSO(self, "SH"), 0); 4883 ck_assert_int_eq(countSO(self, "sheepy"), 0); 4884 setValO(self, "aaa aaa"); 4885 ck_assert_int_eq(countSO(self, "ab"), 0); 4886 // empty string 4887 ck_assert_int_eq(countSO(self, ""), -1); 4888 // NULL string 4889 ck_assert_int_eq(countSO(self, NULL), -1); 4890 // empty self 4891 freeO(self); 4892 ck_assert_int_eq(countSO(self, "ab"), -1); 4893 terminateO(self); 4894 4895 } 4896 4897 4898 void countCharSmallStringT(void) { 4899 4900 smallStringt *self = allocG("shee"); 4901 4902 // positive count 4903 ck_assert_int_eq(countCharO(self, 's'), 1); 4904 setValO(self, "aaa aaa"); 4905 ck_assert_int_eq(countCharO(self, 'a'), 6); 4906 // 0 count 4907 setValO(self, "shee"); 4908 ck_assert_int_eq(countCharO(self, 'S'), 0); 4909 ck_assert_int_eq(countCharO(self, 'y'), 0); 4910 setValO(self, "aaa aaa"); 4911 ck_assert_int_eq(countCharO(self, 'b'), 0); 4912 // empty string 4913 setValO(self, ""); 4914 ck_assert_int_eq(countCharO(self, 'a'), 0); 4915 ck_assert_int_eq(countCharO(self, 0), -1); 4916 // NULL string 4917 setValO(self, "a"); 4918 ck_assert_int_eq(countCharO(self, 0), -1); 4919 // empty self 4920 freeO(self); 4921 ck_assert_int_eq(countCharO(self, 'a'), -1); 4922 terminateO(self); 4923 4924 } 4925 4926 4927 void countSmallJsonSmallStringT(void) { 4928 4929 smallStringt *self = allocG("sheepy"); 4930 smallJsont *string = allocSmallJson(); 4931 4932 // positive count 4933 setTopSO(string, "shee"); 4934 ck_assert_int_eq(countSmallJsonO(self, string), 1); 4935 setValO(self, "aaa aaa"); 4936 freeO(string); 4937 setTopSO(string, "a"); 4938 ck_assert_int_eq(countSmallJsonO(self, string), 6); 4939 freeO(string); 4940 setTopSO(string, "aa"); 4941 ck_assert_int_eq(countSmallJsonO(self, string), 2); 4942 // 0 count 4943 setValO(self, "shee"); 4944 freeO(string); 4945 setTopSO(string, "SH"); 4946 ck_assert_int_eq(countSmallJsonO(self, string), 0); 4947 freeO(string); 4948 setTopSO(string, "sheepy"); 4949 ck_assert_int_eq(countSmallJsonO(self, string), 0); 4950 setValO(self, "aaa aaa"); 4951 freeO(string); 4952 setTopSO(string, "ab"); 4953 ck_assert_int_eq(countSmallJsonO(self, string), 0); 4954 // non json string 4955 freeO(string); 4956 setTopIntO(string, -1); 4957 ck_assert_int_eq(countSmallJsonO(self, string), -1); 4958 // non json object 4959 terminateO(string); 4960 string = (smallJsont*) allocSmallInt(1); 4961 ck_assert_int_eq(countSmallJsonO(self, string), -1); 4962 terminateO(string); 4963 string = allocSmallJson(); 4964 // empty string 4965 setTopSO(string, ""); 4966 ck_assert_int_eq(countSmallJsonO(self, string), -1); 4967 // NULL string 4968 ck_assert_int_eq(countSmallJsonO(self, NULL), -1); 4969 // empty self 4970 freeO(self); 4971 freeO(string); 4972 setTopSO(string, "ab"); 4973 ck_assert_int_eq(countSmallJsonO(self, string), -1); 4974 terminateO(string); 4975 terminateO(self); 4976 4977 } 4978 4979 4980 void countSmallStringSmallStringT(void) { 4981 4982 smallStringt *self = allocG("sheepy"); 4983 smallStringt *string = allocSmallString("shee"); 4984 4985 // positive count 4986 ck_assert_int_eq(countSmallStringO(self, string), 1); 4987 setValO(self, "aaa aaa"); 4988 setValO(string, "a"); 4989 ck_assert_int_eq(countSmallStringO(self, string), 6); 4990 setValO(string, "aa"); 4991 ck_assert_int_eq(countSmallStringO(self, string), 2); 4992 // 0 count 4993 setValO(self, "shee"); 4994 setValO(string, "SH"); 4995 ck_assert_int_eq(countSmallStringO(self, string), 0); 4996 setValO(string, "sheepy"); 4997 ck_assert_int_eq(countSmallStringO(self, string), 0); 4998 setValO(self, "aaa aaa"); 4999 setValO(string, "ab"); 5000 ck_assert_int_eq(countSmallStringO(self, string), 0); 5001 // non json object 5002 terminateO(string); 5003 string = (smallStringt*) allocSmallInt(1); 5004 ck_assert_int_eq(countSmallStringO(self, string), -1); 5005 terminateO(string); 5006 string = allocSmallString(""); 5007 // empty string 5008 ck_assert_int_eq(countSmallStringO(self, string), -1); 5009 freeO(string); 5010 ck_assert_int_eq(countSmallStringO(self, string), -1); 5011 // NULL string 5012 ck_assert_int_eq(countSmallStringO(self, NULL), -1); 5013 // empty self 5014 freeO(self); 5015 setValO(string, "ab"); 5016 ck_assert_int_eq(countSmallStringO(self, string), -1); 5017 terminateO(string); 5018 terminateO(self); 5019 5020 } 5021 5022 5023 void icStartsWithSSmallStringT(void) { 5024 5025 smallStringt *self = allocG("shee"); 5026 5027 // identical strings 5028 ck_assert(icStartsWithSO(self, "shee")); 5029 setValO(self, "sheepy"); 5030 ck_assert(icStartsWithSO(self, "shee")); 5031 // different strings 5032 setValO(self, "shee"); 5033 ck_assert(icStartsWithSO(self, "SH")); 5034 ck_assert(!icStartsWithSO(self, "sheep")); 5035 setValO(self, "-shee"); 5036 ck_assert(!icStartsWithSO(self, "shee")); 5037 // NULL string 5038 ck_assert(!icStartsWithSO(self, NULL)); 5039 // empty self 5040 freeO(self); 5041 ck_assert(!icStartsWithSO(self, "shee")); 5042 terminateO(self); 5043 5044 } 5045 5046 5047 void icStartsWithCharSmallStringT(void) { 5048 5049 smallStringt *self = allocG("shee"); 5050 5051 // identical strings 5052 ck_assert(icStartsWithCharO(self, 's')); 5053 setValO(self, "sheepy"); 5054 ck_assert(icStartsWithCharO(self, 's')); 5055 setValO(self, ""); 5056 ck_assert(icStartsWithCharO(self, 0)); 5057 // different strings 5058 setValO(self, "shee"); 5059 ck_assert(icStartsWithCharO(self, 'S')); 5060 setValO(self, "-shee"); 5061 ck_assert(!icStartsWithCharO(self, 's')); 5062 setValO(self, ""); 5063 ck_assert(!icStartsWithCharO(self, '0')); 5064 // NULL string 5065 setValO(self, "shee"); 5066 ck_assert(!icStartsWithCharO(self, 0)); 5067 // empty self 5068 freeO(self); 5069 ck_assert(!icStartsWithCharO(self, '0')); 5070 terminateO(self); 5071 5072 } 5073 5074 5075 void icStartsWithSmallJsonSmallStringT(void) { 5076 5077 smallStringt *self = allocG("shee"); 5078 smallJsont *string = allocSmallJson(); 5079 5080 // identical strings 5081 setTopSO(string, "shee"); 5082 ck_assert(icStartsWithSmallJsonO(self, string)); 5083 setValO(self, "sheepy"); 5084 ck_assert(icStartsWithSmallJsonO(self, string)); 5085 // different strings 5086 setValO(self, "shee"); 5087 freeO(string); 5088 setTopSO(string, "SH"); 5089 ck_assert(icStartsWithSmallJsonO(self, string)); 5090 freeO(string); 5091 setTopSO(string, "sheep"); 5092 ck_assert(!icStartsWithSmallJsonO(self, string)); 5093 setValO(self, "-shee"); 5094 freeO(string); 5095 setTopSO(string, "shee"); 5096 ck_assert(!icStartsWithSmallJsonO(self, string)); 5097 // non json string 5098 freeO(string); 5099 setTopIntO(string, 1); 5100 ck_assert(!icStartsWithSmallJsonO(self, string)); 5101 // non json object 5102 terminateO(string); 5103 string = (smallJsont*) allocSmallInt(1); 5104 ck_assert(!icStartsWithSmallJsonO(self, string)); 5105 terminateO(string); 5106 string = allocSmallJson(); 5107 // NULL string 5108 ck_assert(!icStartsWithSmallJsonO(self, NULL)); 5109 // empty self 5110 freeO(self); 5111 setTopSO(string, "shee"); 5112 ck_assert(!icStartsWithSmallJsonO(self, string)); 5113 terminateO(string); 5114 terminateO(self); 5115 5116 } 5117 5118 5119 void icStartsWithSmallStringSmallStringT(void) { 5120 5121 smallStringt *self = allocG("shee"); 5122 smallStringt *string = allocSmallString("shee"); 5123 5124 // identical strings 5125 ck_assert(icStartsWithSmallStringO(self, string)); 5126 setValO(self, "sheepy"); 5127 ck_assert(icStartsWithSmallStringO(self, string)); 5128 // different strings 5129 setValO(self, "shee"); 5130 setValO(string, "SH"); 5131 ck_assert(icStartsWithSmallStringO(self, string)); 5132 setValO(string, "sheep"); 5133 ck_assert(!icStartsWithSmallStringO(self, string)); 5134 setValO(self, "-shee"); 5135 setValO(string, "shee"); 5136 ck_assert(!icStartsWithSmallStringO(self, string)); 5137 // non smallString object 5138 terminateO(string); 5139 string = (smallStringt*) allocSmallInt(1); 5140 ck_assert(!icStartsWithSmallStringO(self, string)); 5141 terminateO(string); 5142 string = allocSmallString("shee"); 5143 // NULL string 5144 ck_assert(!icStartsWithSmallStringO(self, NULL)); 5145 // empty self 5146 freeO(self); 5147 ck_assert(!icStartsWithSmallStringO(self, string)); 5148 terminateO(string); 5149 terminateO(self); 5150 5151 } 5152 5153 5154 void icEndsWithSSmallStringT(void) { 5155 5156 smallStringt *self = allocG("shee"); 5157 5158 // identical strings 5159 ck_assert(icEndsWithSO(self, "shee")); 5160 setValO(self, "sheepy"); 5161 ck_assert(icEndsWithSO(self, "EEPY")); 5162 // different strings 5163 setValO(self, "shee"); 5164 ck_assert(!icEndsWithSO(self, "SH")); 5165 ck_assert(!icEndsWithSO(self, "sheep")); 5166 setValO(self, "shee-"); 5167 ck_assert(!icEndsWithSO(self, "shee")); 5168 // NULL string 5169 ck_assert(!icEndsWithSO(self, NULL)); 5170 // empty self 5171 freeO(self); 5172 ck_assert(!icEndsWithSO(self, "shee")); 5173 terminateO(self); 5174 5175 } 5176 5177 5178 void icEndsWithCharSmallStringT(void) { 5179 5180 smallStringt *self = allocG("shee"); 5181 5182 // identical strings 5183 ck_assert(icEndsWithCharO(self, 'e')); 5184 setValO(self, "sheepy"); 5185 ck_assert(icEndsWithCharO(self, 'y')); 5186 setValO(self, ""); 5187 ck_assert(icEndsWithCharO(self, 0)); 5188 // different strings 5189 setValO(self, "shee"); 5190 ck_assert(icEndsWithCharO(self, 'E')); 5191 ck_assert(!icEndsWithCharO(self, 'p')); 5192 setValO(self, "shee-"); 5193 ck_assert(!icEndsWithCharO(self, 'e')); 5194 setValO(self, ""); 5195 ck_assert(!icEndsWithCharO(self, '0')); 5196 // NULL string 5197 setValO(self, "a"); 5198 ck_assert(!icEndsWithCharO(self, 0)); 5199 // empty self 5200 freeO(self); 5201 ck_assert(!icEndsWithCharO(self, '0')); 5202 terminateO(self); 5203 5204 } 5205 5206 5207 void icEndsWithSmallJsonSmallStringT(void) { 5208 5209 smallStringt *self = allocG("shee"); 5210 smallJsont *string = allocSmallJson(); 5211 5212 // identical strings 5213 setTopSO(string, "shee"); 5214 ck_assert(icEndsWithSmallJsonO(self, string)); 5215 setValO(self, "sheepy"); 5216 freeO(string); 5217 setTopSO(string, "EEPY"); 5218 ck_assert(icEndsWithSmallJsonO(self, string)); 5219 // different strings 5220 setValO(self, "shee"); 5221 freeO(string); 5222 setTopSO(string, "SH"); 5223 ck_assert(!icEndsWithSmallJsonO(self, string)); 5224 freeO(string); 5225 setTopSO(string, "sheep"); 5226 ck_assert(!icEndsWithSmallJsonO(self, string)); 5227 setValO(self, "shee-"); 5228 freeO(string); 5229 setTopSO(string, "shee"); 5230 ck_assert(!icEndsWithSmallJsonO(self, string)); 5231 // non json string 5232 freeO(string); 5233 setTopIntO(string, 1); 5234 ck_assert(!icEndsWithSmallJsonO(self, string)); 5235 // non json object 5236 terminateO(string); 5237 string = (smallJsont*) allocSmallInt(1); 5238 ck_assert(!icEndsWithSmallJsonO(self, string)); 5239 terminateO(string); 5240 string = allocSmallJson(); 5241 setTopSO(string, "shee"); 5242 // NULL string 5243 ck_assert(!icEndsWithSmallJsonO(self, NULL)); 5244 // empty self 5245 freeO(self); 5246 ck_assert(!icEndsWithSmallJsonO(self, string)); 5247 terminateO(string); 5248 terminateO(self); 5249 5250 } 5251 5252 5253 void icEndsWithSmallStringSmallStringT(void) { 5254 5255 smallStringt *self = allocG("shee"); 5256 smallStringt *string = allocSmallString("shee"); 5257 5258 // identical strings 5259 ck_assert(icEndsWithSmallStringO(self, string)); 5260 setValO(self, "sheepy"); 5261 setValO(string, "EEPY"); 5262 ck_assert(icEndsWithSmallStringO(self, string)); 5263 // different strings 5264 setValO(self, "shee"); 5265 ck_assert(!icEndsWithSmallStringO(self, string)); 5266 setValO(string, "sheep"); 5267 ck_assert(!icEndsWithSmallStringO(self, string)); 5268 setValO(self, "shee-"); 5269 setValO(string, "shee"); 5270 ck_assert(!icEndsWithSmallStringO(self, string)); 5271 // non smallString object 5272 terminateO(string); 5273 string = (smallStringt*) allocSmallInt(1); 5274 ck_assert(!icEndsWithSmallStringO(self, string)); 5275 terminateO(string); 5276 string = allocSmallString("shee"); 5277 // NULL string 5278 ck_assert(!icEndsWithSmallStringO(self, NULL)); 5279 // empty self 5280 freeO(self); 5281 ck_assert(!icEndsWithSmallStringO(self, string)); 5282 terminateO(string); 5283 terminateO(self); 5284 5285 } 5286 5287 5288 void icCountSSmallStringT(void) { 5289 5290 smallStringt *self = allocG("sheepy"); 5291 5292 // positive count 5293 ck_assert_int_eq(icCountSO(self, "shee"), 1); 5294 setValO(self, "aaa aaa"); 5295 ck_assert_int_eq(icCountSO(self, "a"), 6); 5296 ck_assert_int_eq(icCountSO(self, "Aa"), 2); 5297 // 0 icCount 5298 setValO(self, "shee"); 5299 ck_assert_int_eq(icCountSO(self, "SH"), 1); 5300 ck_assert_int_eq(icCountSO(self, "sheepy"), 0); 5301 setValO(self, "aaa aaa"); 5302 ck_assert_int_eq(icCountSO(self, "ab"), 0); 5303 // empty string 5304 ck_assert_int_eq(icCountSO(self, ""), -1); 5305 // NULL string 5306 ck_assert_int_eq(icCountSO(self, NULL), -1); 5307 // empty self 5308 freeO(self); 5309 ck_assert_int_eq(icCountSO(self, "ab"), -1); 5310 terminateO(self); 5311 5312 } 5313 5314 5315 void icCountCharSmallStringT(void) { 5316 5317 smallStringt *self = allocG("shee"); 5318 5319 // positive count 5320 ck_assert_int_eq(icCountCharO(self, 's'), 1); 5321 setValO(self, "aaa aaa"); 5322 ck_assert_int_eq(icCountCharO(self, 'a'), 6); 5323 // 0 icCount 5324 setValO(self, "shee"); 5325 ck_assert_int_eq(icCountCharO(self, 'S'), 1); 5326 ck_assert_int_eq(icCountCharO(self, 'y'), 0); 5327 setValO(self, "aaa aaa"); 5328 ck_assert_int_eq(icCountCharO(self, 'b'), 0); 5329 // empty string 5330 setValO(self, ""); 5331 ck_assert_int_eq(icCountCharO(self, 'a'), 0); 5332 ck_assert_int_eq(icCountCharO(self, 0), -1); 5333 // NULL string 5334 setValO(self, "a"); 5335 ck_assert_int_eq(icCountCharO(self, 0), -1); 5336 // empty self 5337 freeO(self); 5338 ck_assert_int_eq(icCountCharO(self, 'a'), -1); 5339 terminateO(self); 5340 5341 } 5342 5343 5344 void icCountSmallJsonSmallStringT(void) { 5345 5346 smallStringt *self = allocG("sheepy"); 5347 smallJsont *string = allocSmallJson(); 5348 5349 // positive count 5350 setTopSO(string, "shee"); 5351 ck_assert_int_eq(icCountSmallJsonO(self, string), 1); 5352 setValO(self, "aaa aaa"); 5353 freeO(string); 5354 setTopSO(string, "a"); 5355 ck_assert_int_eq(icCountSmallJsonO(self, string), 6); 5356 freeO(string); 5357 setTopSO(string, "aa"); 5358 ck_assert_int_eq(icCountSmallJsonO(self, string), 2); 5359 // 0 icCount 5360 setValO(self, "shee"); 5361 freeO(string); 5362 setTopSO(string, "SH"); 5363 ck_assert_int_eq(icCountSmallJsonO(self, string), 1); 5364 freeO(string); 5365 setTopSO(string, "sheepy"); 5366 ck_assert_int_eq(icCountSmallJsonO(self, string), 0); 5367 setValO(self, "aaa aaa"); 5368 freeO(string); 5369 setTopSO(string, "ab"); 5370 ck_assert_int_eq(icCountSmallJsonO(self, string), 0); 5371 // non json string 5372 freeO(string); 5373 setTopIntO(string, -1); 5374 ck_assert_int_eq(icCountSmallJsonO(self, string), -1); 5375 // non json object 5376 terminateO(string); 5377 string = (smallJsont*) allocSmallInt(1); 5378 ck_assert_int_eq(icCountSmallJsonO(self, string), -1); 5379 terminateO(string); 5380 string = allocSmallJson(); 5381 // empty string 5382 setTopSO(string, ""); 5383 ck_assert_int_eq(icCountSmallJsonO(self, string), -1); 5384 // NULL string 5385 ck_assert_int_eq(icCountSmallJsonO(self, NULL), -1); 5386 // empty self 5387 freeO(self); 5388 freeO(string); 5389 setTopSO(string, "ab"); 5390 ck_assert_int_eq(icCountSmallJsonO(self, string), -1); 5391 terminateO(string); 5392 terminateO(self); 5393 5394 } 5395 5396 5397 void icCountSmallStringSmallStringT(void) { 5398 5399 smallStringt *self = allocG("sheepy"); 5400 smallStringt *string = allocSmallString("shee"); 5401 5402 // positive count 5403 ck_assert_int_eq(icCountSmallStringO(self, string), 1); 5404 setValO(self, "aaa aaa"); 5405 setValO(string, "a"); 5406 ck_assert_int_eq(icCountSmallStringO(self, string), 6); 5407 setValO(string, "aa"); 5408 ck_assert_int_eq(icCountSmallStringO(self, string), 2); 5409 // 0 icCount 5410 setValO(self, "shee"); 5411 setValO(string, "SH"); 5412 ck_assert_int_eq(icCountSmallStringO(self, string), 1); 5413 setValO(string, "sheepy"); 5414 ck_assert_int_eq(icCountSmallStringO(self, string), 0); 5415 setValO(self, "aaa aaa"); 5416 setValO(string, "ab"); 5417 ck_assert_int_eq(icCountSmallStringO(self, string), 0); 5418 // non json object 5419 terminateO(string); 5420 string = (smallStringt*) allocSmallInt(1); 5421 ck_assert_int_eq(icCountSmallStringO(self, string), -1); 5422 terminateO(string); 5423 string = allocSmallString(""); 5424 // empty string 5425 ck_assert_int_eq(icCountSmallStringO(self, string), -1); 5426 freeO(string); 5427 ck_assert_int_eq(icCountSmallStringO(self, string), -1); 5428 // NULL string 5429 ck_assert_int_eq(icCountSmallStringO(self, NULL), -1); 5430 // empty self 5431 freeO(self); 5432 setValO(string, "ab"); 5433 ck_assert_int_eq(icCountSmallStringO(self, string), -1); 5434 terminateO(string); 5435 terminateO(self); 5436 5437 } 5438 5439 5440 void isNumberSmallStringT(void) { 5441 5442 smallStringt *self = allocG(""); 5443 5444 // number 5445 setValO(self, "-12.3"); 5446 ck_assert(isNumberO(self)); 5447 setValO(self, "-123"); 5448 ck_assert(isNumberO(self)); 5449 setValO(self, "123"); 5450 ck_assert(isNumberO(self)); 5451 setValO(self, "1e23"); 5452 ck_assert(isNumberO(self)); 5453 setValO(self, "12E-3"); 5454 ck_assert(isNumberO(self)); 5455 setValO(self, ".123"); 5456 ck_assert(isNumberO(self)); 5457 setValO(self, "-.123"); 5458 ck_assert(isNumberO(self)); 5459 setValO(self, "1E+32"); 5460 ck_assert(isNumberO(self)); 5461 // not a number 5462 setValO(self, ".12e3"); 5463 ck_assert(!isNumberO(self)); 5464 setValO(self, "-.12e3"); 5465 ck_assert(!isNumberO(self)); 5466 setValO(self, "-1-23"); 5467 ck_assert(!isNumberO(self)); 5468 setValO(self, "123-"); 5469 ck_assert(!isNumberO(self)); 5470 setValO(self, "-"); 5471 ck_assert(!isNumberO(self)); 5472 setValO(self, "-123."); 5473 ck_assert(!isNumberO(self)); 5474 setValO(self, "-1.2.3"); 5475 ck_assert(!isNumberO(self)); 5476 setValO(self, "1-2.3"); 5477 ck_assert(!isNumberO(self)); 5478 setValO(self, "12..3"); 5479 ck_assert(!isNumberO(self)); 5480 setValO(self, ".12.3"); 5481 ck_assert(!isNumberO(self)); 5482 setValO(self, "."); 5483 ck_assert(!isNumberO(self)); 5484 setValO(self, "E12"); 5485 ck_assert(!isNumberO(self)); 5486 setValO(self, "E1E2"); 5487 ck_assert(!isNumberO(self)); 5488 setValO(self, "E1.2"); 5489 ck_assert(!isNumberO(self)); 5490 setValO(self, "1E"); 5491 ck_assert(!isNumberO(self)); 5492 setValO(self, "1E2.3"); 5493 ck_assert(!isNumberO(self)); 5494 setValO(self, "1-"); 5495 ck_assert(!isNumberO(self)); 5496 setValO(self, "1E-"); 5497 ck_assert(!isNumberO(self)); 5498 setValO(self, "lib123sheepy"); 5499 ck_assert(!isNumberO(self)); 5500 // string without number 5501 setValO(self, "s"); 5502 ck_assert(!isNumberO(self)); 5503 // empty string 5504 setValO(self, ""); 5505 ck_assert(!isNumberO(self)); 5506 // NULL string 5507 freeO(self); 5508 ck_assert(!isNumberO(self)); 5509 terminateO(self); 5510 5511 } 5512 5513 5514 void isIntSmallStringT(void) { 5515 5516 smallStringt *self = allocG(""); 5517 5518 // integer 5519 setValO(self, "-123"); 5520 ck_assert(isIntO(self)); 5521 setValO(self, "123"); 5522 ck_assert(isIntO(self)); 5523 // not a integer 5524 setValO(self, "1e23"); 5525 ck_assert(!isIntO(self)); 5526 setValO(self, "12E-3"); 5527 ck_assert(!isIntO(self)); 5528 setValO(self, "-12.3"); 5529 ck_assert(!isIntO(self)); 5530 setValO(self, "-1-23"); 5531 ck_assert(!isIntO(self)); 5532 setValO(self, "123-"); 5533 ck_assert(!isIntO(self)); 5534 setValO(self, "-"); 5535 ck_assert(!isIntO(self)); 5536 setValO(self, "-123."); 5537 ck_assert(!isIntO(self)); 5538 setValO(self, ".123"); 5539 ck_assert(!isIntO(self)); 5540 setValO(self, "-1.2.3"); 5541 ck_assert(!isIntO(self)); 5542 setValO(self, "1-2.3"); 5543 ck_assert(!isIntO(self)); 5544 setValO(self, "12..3"); 5545 ck_assert(!isIntO(self)); 5546 setValO(self, "."); 5547 ck_assert(!isIntO(self)); 5548 setValO(self, "1E"); 5549 ck_assert(!isIntO(self)); 5550 setValO(self, "1-"); 5551 ck_assert(!isIntO(self)); 5552 setValO(self, "1E-"); 5553 ck_assert(!isIntO(self)); 5554 setValO(self, "lib123sheepy"); 5555 ck_assert(!isIntO(self)); 5556 // string without number 5557 setValO(self, "s"); 5558 ck_assert(!isIntO(self)); 5559 // empty string 5560 setValO(self, ""); 5561 ck_assert(!isIntO(self)); 5562 // NULL string 5563 freeO(self); 5564 ck_assert(!isIntO(self)); 5565 terminateO(self); 5566 5567 } 5568 5569 5570 void parseIntSmallStringT(void) { 5571 5572 smallStringt *self = allocG(""); 5573 5574 // number 5575 setValO(self, "123sheepy"); 5576 ck_assert_int_eq(parseIntO(self), 123); 5577 setValO(self, "lib123sheepy"); 5578 ck_assert_int_eq(parseIntO(self), 123); 5579 setValO(self, "-123"); 5580 ck_assert_int_eq(parseIntO(self), -123); 5581 // out of range - TODO check stderr 5582 setValO(self, "999999999999999999999999999999999999999"); 5583 parseIntO(self); 5584 // string without number 5585 setValO(self, "sheepy"); 5586 ck_assert_int_eq(parseIntO(self), 0); 5587 // NULL string 5588 freeO(self); 5589 ck_assert_int_eq(parseIntO(self), 0); 5590 terminateO(self); 5591 5592 } 5593 5594 5595 void parseDoubleSmallStringT(void) { 5596 5597 smallStringt *self = allocG(""); 5598 5599 // number 5600 setValO(self, "123.2sheepy"); 5601 ck_assert_int_eq(parseDoubleO(self), 123); 5602 setValO(self, "lib123sheepy"); 5603 ck_assert_int_eq(parseDoubleO(self), 123); 5604 setValO(self, "-123"); 5605 ck_assert_int_eq(parseDoubleO(self), -123); 5606 // out of range - TODO check stderr 5607 setValO(self, "999999999999999999999999999999999999999"); 5608 parseDoubleO(self); 5609 // string without number 5610 setValO(self, "sheepy"); 5611 ck_assert_int_eq(parseDoubleO(self), 0); 5612 // NULL string 5613 freeO(self); 5614 ck_assert_int_eq(parseDoubleO(self), 0); 5615 terminateO(self); 5616 5617 } 5618 5619 5620 void intToSmallStringT(void) { 5621 5622 smallStringt* r; 5623 smallStringt *self = allocG(""); 5624 5625 // number 5626 r = intToO(self, 123); 5627 ck_assert_ptr_ne(r, null); 5628 char *s = toStringO(r); 5629 ck_assert_str_eq(s, "123"); 5630 free(s); 5631 r = intToO(self, -465464123); 5632 ck_assert_ptr_ne(r, null); 5633 s = toStringO(r); 5634 ck_assert_str_eq(s, "-465464123"); 5635 free(s); 5636 terminateO(self); 5637 5638 } 5639 5640 5641 void doubleToSmallStringT(void) { 5642 5643 smallStringt* r; 5644 smallStringt *self = allocG(""); 5645 5646 // number 5647 r = doubleToO(self, 123.4); 5648 ck_assert_ptr_ne(r, null); 5649 char *s = toStringO(r); 5650 ck_assert_str_eq(s, "1.234000e+02"); 5651 free(s); 5652 r = doubleToO(self, -4652445e5); 5653 ck_assert_ptr_ne(r, null); 5654 s = toStringO(r); 5655 ck_assert_str_eq(s, "-4.652445e+11"); 5656 free(s); 5657 terminateO(self); 5658 5659 } 5660 5661 5662 void lenSmallStringT(void) { 5663 5664 size_t r; 5665 smallStringt *self = allocG(""); 5666 5667 r = lenO(self); 5668 ck_assert_int_eq(r, 0); 5669 setValO(self, "123"); 5670 r = lenO(self); 5671 ck_assert_int_eq(r, 3); 5672 freeO(self); 5673 r = lenO(self); 5674 ck_assert_int_eq(r, 0); 5675 terminateO(self); 5676 5677 } 5678 5679 5680 void upperSmallStringT(void) { 5681 5682 smallStringt* r; 5683 smallStringt *self = allocG("sheepy"); 5684 5685 // string 5686 r = upperO(self); 5687 ck_assert_ptr_ne(r, null); 5688 char *s = toStringO(r); 5689 ck_assert_str_eq(s, "SHEEPY"); 5690 free(s); 5691 // NULL string 5692 freeO(self); 5693 ck_assert_ptr_eq(upperO(self), NULL); 5694 terminateO(self); 5695 5696 } 5697 5698 5699 void lowerSmallStringT(void) { 5700 5701 smallStringt* r; 5702 smallStringt *self = allocG("SHeePY"); 5703 5704 // string 5705 r = lowerO(self); 5706 ck_assert_ptr_ne(r, null); 5707 char *s = toStringO(r); 5708 ck_assert_str_eq(s, "sheepy"); 5709 free(s); 5710 // NULL string 5711 freeO(self); 5712 ck_assert_ptr_eq(lowerO(self), NULL); 5713 terminateO(self); 5714 5715 } 5716 5717 5718 void trimSmallStringT(void) { 5719 5720 smallStringt* r; 5721 smallStringt *self = allocG(""); 5722 5723 // no spaces 5724 setValO(self, "SHeePY"); 5725 r = trimO(self); 5726 ck_assert_ptr_ne(r, null); 5727 char *s = toStringO(r); 5728 ck_assert_str_eq(s, "SHeePY"); 5729 free(s); 5730 // heading spaces 5731 setValO(self, " SHeePY"); 5732 r = trimO(self); 5733 ck_assert_ptr_ne(r, null); 5734 s = toStringO(r); 5735 ck_assert_str_eq(s, "SHeePY"); 5736 free(s); 5737 // trailing spaces 5738 setValO(self, "SHeePY "); 5739 r = trimO(self); 5740 ck_assert_ptr_ne(r, null); 5741 s = toStringO(r); 5742 ck_assert_str_eq(s, "SHeePY"); 5743 free(s); 5744 // string with spaces in the middle 5745 setValO(self, " SHe ePY "); 5746 r = trimO(self); 5747 ck_assert_ptr_ne(r, null); 5748 s = toStringO(r); 5749 ck_assert_str_eq(s, "SHe ePY"); 5750 free(s); 5751 // all spaces 5752 setValO(self, " "); 5753 r = trimO(self); 5754 ck_assert_ptr_ne(r, null); 5755 s = toStringO(r); 5756 ck_assert_str_eq(s, ""); 5757 free(s); 5758 // empty string 5759 setValO(self, ""); 5760 r = trimO(self); 5761 ck_assert_ptr_ne(r, null); 5762 s = toStringO(r); 5763 ck_assert_str_eq(s, ""); 5764 free(s); 5765 // NULL string 5766 freeO(self); 5767 ck_assert_ptr_eq(trimO(self), NULL); 5768 terminateO(self); 5769 5770 } 5771 5772 5773 void lTrimSmallStringT(void) { 5774 5775 smallStringt* r; 5776 smallStringt *self = allocG(""); 5777 5778 // no spaces 5779 setValO(self, "SHeePY"); 5780 r = lTrimO(self); 5781 ck_assert_ptr_ne(r, null); 5782 char *s = toStringO(r); 5783 ck_assert_str_eq(s, "SHeePY"); 5784 free(s); 5785 // heading spaces 5786 setValO(self, " SHeePY"); 5787 r = lTrimO(self); 5788 ck_assert_ptr_ne(r, null); 5789 s = toStringO(r); 5790 ck_assert_str_eq(s, "SHeePY"); 5791 free(s); 5792 // trailing spaces 5793 setValO(self, "SHeePY "); 5794 r = lTrimO(self); 5795 ck_assert_ptr_ne(r, null); 5796 s = toStringO(r); 5797 ck_assert_str_eq(s, "SHeePY "); 5798 free(s); 5799 // string with spaces in the middle 5800 setValO(self, " SHe ePY "); 5801 r = lTrimO(self); 5802 ck_assert_ptr_ne(r, null); 5803 s = toStringO(r); 5804 ck_assert_str_eq(s, "SHe ePY "); 5805 free(s); 5806 // all spaces 5807 setValO(self, " "); 5808 r = lTrimO(self); 5809 ck_assert_ptr_ne(r, null); 5810 s = toStringO(r); 5811 ck_assert_str_eq(s, ""); 5812 free(s); 5813 setValO(self, ""); 5814 r = lTrimO(self); 5815 ck_assert_ptr_ne(r, null); 5816 s = toStringO(r); 5817 ck_assert_str_eq(s, ""); 5818 free(s); 5819 // NULL string 5820 freeO(self); 5821 ck_assert_ptr_eq(lTrimO(self), NULL); 5822 terminateO(self); 5823 5824 } 5825 5826 5827 void rTrimSmallStringT(void) { 5828 5829 smallStringt* r; 5830 smallStringt *self = allocG(""); 5831 5832 // no spaces 5833 setValO(self, "SHeePY"); 5834 r = rTrimO(self); 5835 ck_assert_ptr_ne(r, null); 5836 char *s = toStringO(r); 5837 ck_assert_str_eq(s, "SHeePY"); 5838 free(s); 5839 // heading spaces 5840 setValO(self, " SHeePY"); 5841 r = rTrimO(self); 5842 ck_assert_ptr_ne(r, null); 5843 s = toStringO(r); 5844 ck_assert_str_eq(s, " SHeePY"); 5845 free(s); 5846 // trailing spaces 5847 setValO(self, "SHeePY "); 5848 r = rTrimO(self); 5849 ck_assert_ptr_ne(r, null); 5850 s = toStringO(r); 5851 ck_assert_str_eq(s, "SHeePY"); 5852 free(s); 5853 // string with spaces in the middle 5854 setValO(self, " SHe ePY "); 5855 r = rTrimO(self); 5856 ck_assert_ptr_ne(r, null); 5857 s = toStringO(r); 5858 ck_assert_str_eq(s, " SHe ePY"); 5859 free(s); 5860 // all spaces 5861 setValO(self, " "); 5862 r = rTrimO(self); 5863 ck_assert_ptr_ne(r, null); 5864 s = toStringO(r); 5865 ck_assert_str_eq(s, ""); 5866 free(s); 5867 // empty string 5868 setValO(self, ""); 5869 r = rTrimO(self); 5870 ck_assert_ptr_ne(r, null); 5871 s = toStringO(r); 5872 ck_assert_str_eq(s, ""); 5873 free(s); 5874 // NULL string 5875 freeO(self); 5876 ck_assert_ptr_eq(rTrimO(self), NULL); 5877 terminateO(self); 5878 5879 } 5880 5881 5882 void uniqSmallStringT(void) { 5883 5884 smallStringt* r; 5885 smallStringt *self = allocG(""); 5886 5887 // uniquify 5888 setValO(self, "/qwd///"); 5889 r = uniqO(self, '/'); 5890 ck_assert_ptr_ne(r, null); 5891 char *s = toStringO(r); 5892 ck_assert_str_eq(s, "/qwd/"); 5893 free(s); 5894 // short string 5895 setValO(self, "?"); 5896 r = uniqO(self, '/'); 5897 ck_assert_ptr_ne(r, null); 5898 s = toStringO(r); 5899 ck_assert_str_eq(s, "?"); 5900 free(s); 5901 // NULL 5902 freeO(self); 5903 ck_assert_ptr_eq(uniqO(self, '/'), NULL); 5904 terminateO(self); 5905 5906 } 5907 5908 5909 void icUniqSmallStringT(void) { 5910 5911 smallStringt* r; 5912 smallStringt *self = allocG(""); 5913 5914 // uniquify 5915 setValO(self, "/qQwd///"); 5916 r = icUniqO(self, 'q'); 5917 ck_assert_ptr_ne(r, null); 5918 char *s = toStringO(r); 5919 ck_assert_str_eq(s, "/qwd///"); 5920 free(s); 5921 // short string 5922 setValO(self, "?"); 5923 r = icUniqO(self, '/'); 5924 ck_assert_ptr_ne(r, null); 5925 s = toStringO(r); 5926 ck_assert_str_eq(s, "?"); 5927 free(s); 5928 // NULL 5929 freeO(self); 5930 ck_assert_ptr_eq(icUniqO(self, '/'), NULL); 5931 terminateO(self); 5932 5933 } 5934 5935 5936 void getAtSmallStringT(void) { 5937 5938 smallStringt *self = allocG(""); 5939 5940 // get char 5941 setValO(self, "sheepy"); 5942 ck_assert_uint_eq(getAtO(self, 0), 's'); 5943 // negative index 5944 ck_assert_uint_eq(getAtO(self, -1), 'y'); 5945 // outside string 5946 ck_assert_uint_eq(getAtO(self, 10), 0); 5947 ck_assert_uint_eq(getAtO(self, -10), 0); 5948 // negative index in a one char string 5949 setValO(self, "z"); 5950 ck_assert_uint_eq(getAtO(self, -1), 'z'); 5951 // empty string 5952 setValO(self, ""); 5953 ck_assert_uint_eq(getAtO(self, 0), 0); 5954 // NULL string 5955 freeO(self); 5956 ck_assert_uint_eq(getAtO(self, 0), 0); 5957 terminateO(self); 5958 5959 } 5960 5961 5962 void setAtSmallStringT(void) { 5963 5964 smallStringt* r; 5965 smallStringt *self = allocG("sheepy"); 5966 5967 // set char 5968 r = setAtO(self, 0, 'S'); 5969 ck_assert_ptr_ne(r, null); 5970 ck_assert_uint_eq(ssGet(self)[0], 'S'); 5971 // negative index 5972 r = setAtO(self, -2, 'P'); 5973 ck_assert_ptr_ne(r, null); 5974 ck_assert_uint_eq(ssGet(self)[4], 'P'); 5975 // outside string 5976 r = setAtO(self, 20, 'Y'); 5977 ck_assert_ptr_eq(r, null); 5978 r = setAtO(self, -20, 'Y'); 5979 ck_assert_ptr_eq(r, null); 5980 ck_assert_str_eq(ssGet(self), "SheePy"); 5981 // negative index in a one char string 5982 setValO(self, "s"); 5983 r = setAtO(self, -1, 'S'); 5984 ck_assert_ptr_ne(r, null); 5985 ck_assert_uint_eq(ssGet(self)[0], 'S'); 5986 // empty string 5987 setValO(self, ""); 5988 r = setAtO(self, -1, 'S'); 5989 ck_assert_ptr_eq(r, null); 5990 ck_assert_str_eq(ssGet(self), ""); 5991 // NULL string 5992 freeO(self); 5993 r = setAtO(self, 0, 's'); 5994 ck_assert_ptr_eq(r, null); 5995 terminateO(self); 5996 5997 } 5998 5999 6000 void sliceSmallStringT(void) { 6001 6002 smallStringt* r; 6003 smallStringt *self = allocG(""); 6004 6005 // slice 6006 setValO(self, "sheepy"); 6007 r = sliceO(self, 0,2); 6008 ck_assert_ptr_ne(r, null); 6009 ck_assert_str_eq(ssGet(self), "sh"); 6010 // negative index 6011 setValO(self, "sheepy"); 6012 r = sliceO(self, -2,0); 6013 ck_assert_ptr_ne(r, null); 6014 ck_assert_str_eq(ssGet(self), "py"); 6015 // positive and negative indexes 6016 setValO(self, "sheepy"); 6017 r = sliceO(self, 2,-2); 6018 ck_assert_ptr_ne(r, null); 6019 ck_assert_str_eq(ssGet(self), "ee"); 6020 // start = end 6021 setValO(self, "sheepy"); 6022 r = sliceO(self, 2,-4); 6023 ck_assert_ptr_ne(r, null); 6024 ck_assert_str_eq(ssGet(self), ""); 6025 // end of string 6026 setValO(self, "sheepy"); 6027 r = sliceO(self, 2,6); 6028 ck_assert_ptr_ne(r, null); 6029 ck_assert_str_eq(ssGet(self), "eepy"); 6030 // NULL string 6031 freeO(self); 6032 ck_assert_ptr_eq(sliceO(self, 2,-4), NULL); 6033 // start outside string 6034 setValO(self, "sheepy"); 6035 ck_assert_ptr_eq(sliceO(self, 20,-4), NULL); 6036 // end outside string 6037 setValO(self, "sheepy"); 6038 r = sliceO(self, 2,40); 6039 ck_assert_ptr_ne(r, null); 6040 ck_assert_str_eq(ssGet(self), "eepy"); 6041 setValO(self, "sheepy"); 6042 r = sliceO(self, -22,3); 6043 ck_assert_ptr_ne(r, null); 6044 ck_assert_str_eq(ssGet(self), "she"); 6045 setValO(self, "sheepy"); 6046 ck_assert_ptr_eq(sliceO(self, 2,-40), NULL); 6047 // end before start 6048 setValO(self, "sheepy"); 6049 ck_assert_ptr_eq(sliceO(self, 4,2), NULL); 6050 terminateO(self); 6051 6052 } 6053 6054 6055 void cropSmallStringT(void) { 6056 6057 smallStringt* r; 6058 smallStringt *self = allocG(""); 6059 6060 // crop 6061 setValO(self, "sheepy"); 6062 r = cropO(self, 0,2); 6063 ck_assert_ptr_ne(r, null); 6064 ck_assert_str_eq(ssGet(r), "sh"); 6065 ck_assert_str_eq(ssGet(self), "eepy"); 6066 terminateO(r); 6067 // negative index 6068 setValO(self, "sheepy"); 6069 r = cropO(self, -2,0); 6070 ck_assert_ptr_ne(r, null); 6071 ck_assert_str_eq(ssGet(r), "py"); 6072 ck_assert_str_eq(ssGet(self), "shee"); 6073 terminateO(r); 6074 // positive and negative indexes 6075 setValO(self, "sheepy"); 6076 r = cropO(self, 2,-2); 6077 ck_assert_ptr_ne(r, null); 6078 ck_assert_str_eq(ssGet(r), "ee"); 6079 ck_assert_str_eq(ssGet(self), "shpy"); 6080 terminateO(r); 6081 // start = end 6082 setValO(self, "sheepy"); 6083 r = cropO(self, 2,-4); 6084 ck_assert_ptr_ne(r, null); 6085 ck_assert_str_eq(ssGet(r), ""); 6086 ck_assert_str_eq(ssGet(self), "sheepy"); 6087 terminateO(r); 6088 // end of string 6089 setValO(self, "sheepy"); 6090 r = cropO(self, 2,6); 6091 ck_assert_ptr_ne(r, null); 6092 ck_assert_str_eq(ssGet(r), "eepy"); 6093 ck_assert_str_eq(ssGet(self), "sh"); 6094 terminateO(r); 6095 // NULL string 6096 freeO(self); 6097 ck_assert_ptr_eq(cropO(self, 2,-4), NULL); 6098 // start outside string 6099 setValO(self, "sheepy"); 6100 ck_assert_ptr_eq(cropO(self, 20,-4), NULL); 6101 // end outside string 6102 setValO(self, "sheepy"); 6103 r = cropO(self, 2,40); 6104 ck_assert_ptr_ne(r, null); 6105 ck_assert_str_eq(ssGet(r), "eepy"); 6106 ck_assert_str_eq(ssGet(self), "sh"); 6107 terminateO(r); 6108 setValO(self, "sheepy"); 6109 r = cropO(self, -22,3); 6110 ck_assert_ptr_ne(r, null); 6111 ck_assert_str_eq(ssGet(r), "she"); 6112 ck_assert_str_eq(ssGet(self), "epy"); 6113 terminateO(r); 6114 setValO(self, "sheepy"); 6115 ck_assert_ptr_eq(cropO(self, 2,-40), NULL); 6116 // end before start 6117 ck_assert_ptr_eq(cropO(self, 4,2), NULL); 6118 terminateO(self); 6119 6120 } 6121 6122 6123 void cropSSmallStringT(void) { 6124 6125 char* s; 6126 smallStringt *self = allocG(""); 6127 6128 // crop 6129 setValO(self, "sheepy"); 6130 s = cropSO(self, 0,2); 6131 ck_assert_str_eq(s, "sh"); 6132 ck_assert_str_eq(ssGet(self), "eepy"); 6133 free(s); 6134 // negative index 6135 setValO(self, "sheepy"); 6136 s = cropSO(self, -2,0); 6137 ck_assert_str_eq(s, "py"); 6138 ck_assert_str_eq(ssGet(self), "shee"); 6139 free(s); 6140 // positive and negative indexes 6141 setValO(self, "sheepy"); 6142 s = cropSO(self, 2,-2); 6143 ck_assert_str_eq(s, "ee"); 6144 ck_assert_str_eq(ssGet(self), "shpy"); 6145 free(s); 6146 // start = end 6147 setValO(self, "sheepy"); 6148 s = cropSO(self, 2,-4); 6149 ck_assert_str_eq(s, ""); 6150 ck_assert_str_eq(ssGet(self), "sheepy"); 6151 free(s); 6152 // end of string 6153 setValO(self, "sheepy"); 6154 s = cropSO(self, 2,6); 6155 ck_assert_str_eq(s, "eepy"); 6156 ck_assert_str_eq(ssGet(self), "sh"); 6157 free(s); 6158 // NULL string 6159 freeO(self); 6160 ck_assert_ptr_eq(cropSO(self, 2,-4), NULL); 6161 // start outside string 6162 setValO(self, "sheepy"); 6163 ck_assert_ptr_eq(cropSO(self, 20,-4), NULL); 6164 // end outside string 6165 setValO(self, "sheepy"); 6166 s = cropSO(self, 2,40); 6167 ck_assert_str_eq(s, "eepy"); 6168 ck_assert_str_eq(ssGet(self), "sh"); 6169 free(s); 6170 setValO(self, "sheepy"); 6171 s = cropSO(self, -22,3); 6172 ck_assert_str_eq(s, "she"); 6173 ck_assert_str_eq(ssGet(self), "epy"); 6174 free(s); 6175 setValO(self, "sheepy"); 6176 ck_assert_ptr_eq(cropSO(self, 2,-40), NULL); 6177 // end before start 6178 ck_assert_ptr_eq(cropSO(self, 4,2), NULL); 6179 terminateO(self); 6180 6181 } 6182 6183 6184 void cropSmallJsonSmallStringT(void) { 6185 6186 smallJsont* r; 6187 smallStringt *self = allocG(""); 6188 6189 // crop 6190 setValO(self, "sheepy"); 6191 r = cropSmallJsonO(self, 0,2); 6192 ck_assert_ptr_ne(r, null); 6193 ck_assert_str_eq(sjGet(r), "sh"); 6194 ck_assert_str_eq(ssGet(self), "eepy"); 6195 terminateO(r); 6196 // negative index 6197 setValO(self, "sheepy"); 6198 r = cropSmallJsonO(self, -2,0); 6199 ck_assert_ptr_ne(r, null); 6200 ck_assert_str_eq(sjGet(r), "py"); 6201 ck_assert_str_eq(ssGet(self), "shee"); 6202 terminateO(r); 6203 // positive and negative indexes 6204 setValO(self, "sheepy"); 6205 r = cropSmallJsonO(self, 2,-2); 6206 ck_assert_ptr_ne(r, null); 6207 ck_assert_str_eq(sjGet(r), "ee"); 6208 ck_assert_str_eq(ssGet(self), "shpy"); 6209 terminateO(r); 6210 // start = end 6211 setValO(self, "sheepy"); 6212 r = cropSmallJsonO(self, 2,-4); 6213 ck_assert_ptr_ne(r, null); 6214 ck_assert_str_eq(sjGet(r), ""); 6215 ck_assert_str_eq(ssGet(self), "sheepy"); 6216 terminateO(r); 6217 // end of string 6218 setValO(self, "sheepy"); 6219 r = cropSmallJsonO(self, 2,6); 6220 ck_assert_ptr_ne(r, null); 6221 ck_assert_str_eq(sjGet(r), "eepy"); 6222 ck_assert_str_eq(ssGet(self), "sh"); 6223 terminateO(r); 6224 // NULL string 6225 freeO(self); 6226 ck_assert_ptr_eq(cropSmallJsonO(self, 2,-4), NULL); 6227 // start outside string 6228 setValO(self, "sheepy"); 6229 ck_assert_ptr_eq(cropSmallJsonO(self, 20,-4), NULL); 6230 // end outside string 6231 setValO(self, "sheepy"); 6232 r = cropSmallJsonO(self, 2,40); 6233 ck_assert_ptr_ne(r, null); 6234 ck_assert_str_eq(sjGet(r), "eepy"); 6235 ck_assert_str_eq(ssGet(self), "sh"); 6236 terminateO(r); 6237 setValO(self, "sheepy"); 6238 r = cropSmallJsonO(self, -22,3); 6239 ck_assert_ptr_ne(r, null); 6240 ck_assert_str_eq(sjGet(r), "she"); 6241 ck_assert_str_eq(ssGet(self), "epy"); 6242 terminateO(r); 6243 setValO(self, "sheepy"); 6244 ck_assert_ptr_eq(cropSmallJsonO(self, 2,-40), NULL); 6245 // end before start 6246 ck_assert_ptr_eq(cropSmallJsonO(self, 4,2), NULL); 6247 terminateO(self); 6248 terminateO(self); 6249 6250 } 6251 6252 6253 void cropElemSmallStringT(void) { 6254 6255 char r; 6256 smallStringt *self = allocG(""); 6257 6258 // crop 6259 setValO(self, "sheepy"); 6260 r = cropElemO(self, 0); 6261 ck_assert_int_eq(r, 's'); 6262 ck_assert_str_eq(ssGet(self), "heepy"); 6263 setValO(self, "sheepy"); 6264 r = cropElemO(self, 5); 6265 ck_assert_int_eq(r, 'y'); 6266 ck_assert_str_eq(ssGet(self), "sheep"); 6267 // negative index 6268 setValO(self, "sheepy"); 6269 r = cropElemO(self, -1); 6270 ck_assert_int_eq(r, 'y'); 6271 ck_assert_str_eq(ssGet(self), "sheep"); 6272 setValO(self, "sheepy"); 6273 r = cropElemO(self, -6); 6274 ck_assert_int_eq(r, 's'); 6275 ck_assert_str_eq(ssGet(self), "heepy"); 6276 // index outside string 6277 setValO(self, "sheepy"); 6278 r = cropElemO(self, 6); 6279 ck_assert_int_eq(r, 0); 6280 ck_assert_str_eq(ssGet(self), "sheepy"); 6281 setValO(self, "sheepy"); 6282 r = cropElemO(self, -7); 6283 ck_assert_int_eq(r, 0); 6284 ck_assert_str_eq(ssGet(self), "sheepy"); 6285 // null string 6286 freeO(self); 6287 ck_assert_int_eq(cropElemO(self, 0), 0); 6288 terminateO(self); 6289 6290 } 6291 6292 6293 void copySmallStringT(void) { 6294 6295 smallStringt* r; 6296 smallStringt *self = allocG(""); 6297 6298 // copy range 6299 setValO(self, "sheepy"); 6300 r = copyRngO(self, 0,2); 6301 ck_assert_ptr_ne(r, null); 6302 ck_assert_str_eq(ssGet(r), "sh"); 6303 ck_assert_str_eq(ssGet(self), "sheepy"); 6304 terminateO(r); 6305 // negative index 6306 r = copyRngO(self, -2,0); 6307 ck_assert_ptr_ne(r, null); 6308 ck_assert_str_eq(ssGet(r), "py"); 6309 ck_assert_str_eq(ssGet(self), "sheepy"); 6310 terminateO(r); 6311 // positive and negative indexes 6312 r = copyRngO(self, 2,-2); 6313 ck_assert_ptr_ne(r, null); 6314 ck_assert_str_eq(ssGet(r), "ee"); 6315 ck_assert_str_eq(ssGet(self), "sheepy"); 6316 terminateO(r); 6317 // start = end 6318 r = copyRngO(self, 2,-4); 6319 ck_assert_ptr_ne(r, null); 6320 ck_assert_str_eq(ssGet(r), ""); 6321 ck_assert_str_eq(ssGet(self), "sheepy"); 6322 terminateO(r); 6323 // end of string 6324 r = copyRngO(self, 2,6); 6325 ck_assert_ptr_ne(r, null); 6326 ck_assert_str_eq(ssGet(r), "eepy"); 6327 ck_assert_str_eq(ssGet(self), "sheepy"); 6328 terminateO(r); 6329 // NULL string 6330 freeO(self); 6331 ck_assert_ptr_eq(copyRngO(self, 2,-4), NULL); 6332 // start outside string 6333 setValO(self, "sheepy"); 6334 ck_assert_ptr_eq(copyRngO(self, 20,-4), NULL); 6335 // end outside string 6336 r = copyRngO(self, 2,40); 6337 ck_assert_ptr_ne(r, null); 6338 ck_assert_str_eq(ssGet(r), "eepy"); 6339 ck_assert_str_eq(ssGet(self), "sheepy"); 6340 terminateO(r); 6341 r = copyRngO(self, -22,3); 6342 ck_assert_ptr_ne(r, null); 6343 ck_assert_str_eq(ssGet(r), "she"); 6344 ck_assert_str_eq(ssGet(self), "sheepy"); 6345 terminateO(r); 6346 ck_assert_ptr_eq(copyRngO(self, 2,-40), NULL); 6347 // end before start 6348 ck_assert_ptr_eq(copyRngO(self, 4,2), NULL); 6349 terminateO(self); 6350 6351 } 6352 6353 6354 void insertSmallStringT(void) { 6355 6356 smallStringt* r; 6357 smallStringt *self = allocG(""); 6358 smallStringt *toInsert = allocSmallString(""); 6359 6360 // insert 6361 setValO(self, "sheepy"); 6362 setValO(toInsert, "lib"); 6363 r = insertO(self, 0, toInsert); 6364 ck_assert_ptr_ne(r, null); 6365 char *s = toStringO(r); 6366 ck_assert_str_eq(s, "libsheepy"); 6367 free(s); 6368 // negative index 6369 setValO(toInsert, "P"); 6370 r = insertO(self, -2, toInsert); 6371 ck_assert_ptr_ne(r, null); 6372 s = toStringO(r); 6373 ck_assert_str_eq(s, "libsheepPy"); 6374 free(s); 6375 // edge 6376 setValO(self, "qwe"); 6377 setValO(toInsert, "C"); 6378 r = insertO(self, 3, toInsert); 6379 ck_assert_ptr_ne(r, null); 6380 s = toStringO(r); 6381 ck_assert_str_eq(s, "qweC"); 6382 free(s); 6383 // outside string 6384 setValO(self, "qwe"); 6385 r = insertO(self, 4, toInsert); 6386 ck_assert_ptr_eq(r, NULL); 6387 r = insertO(self, -5, toInsert); 6388 ck_assert_ptr_eq(r, NULL); 6389 // negative index in a one char string 6390 setValO(self, "s"); 6391 setValO(toInsert, "S"); 6392 r = insertO(self, -1, toInsert); 6393 ck_assert_ptr_ne(r, null); 6394 s = toStringO(r); 6395 ck_assert_str_eq(s, "sS"); 6396 free(s); 6397 // empty string 6398 setValO(self, ""); 6399 setValO(toInsert, "s"); 6400 r = insertO(self, 0, toInsert); 6401 ck_assert_ptr_ne(r, null); 6402 s = toStringO(r); 6403 ck_assert_str_eq(s, "s"); 6404 free(s); 6405 setValO(self, ""); 6406 r = insertO(self, -1, toInsert); 6407 ck_assert_ptr_ne(r, null); 6408 s = toStringO(r); 6409 ck_assert_str_eq(s, "s"); 6410 free(s); 6411 // empty insert string 6412 setValO(self, "a"); 6413 setValO(toInsert, ""); 6414 r = insertO(self, 0, toInsert); 6415 ck_assert_ptr_ne(r, null); 6416 s = toStringO(r); 6417 ck_assert_str_eq(s, "a"); 6418 free(s); 6419 freeO(toInsert); 6420 r = insertO(self, 0, toInsert); 6421 ck_assert_ptr_ne(r, null); 6422 s = toStringO(r); 6423 ck_assert_str_eq(s, "a"); 6424 free(s); 6425 // non smallString toInsert 6426 terminateO(toInsert); 6427 toInsert = (smallStringt*) allocSmallInt(1); 6428 r = insertO(self, 0, toInsert); 6429 ck_assert_ptr_eq(r, null); 6430 terminateO(toInsert); 6431 toInsert = allocSmallString(""); 6432 // NULL insert string 6433 r = insertO(self, 0, NULL); 6434 ck_assert_ptr_eq(r, null); 6435 // NULL string 6436 freeO(self); 6437 setValO(toInsert, "s"); 6438 r = insertO(self, 1, toInsert); 6439 ck_assert_ptr_eq(r, null); 6440 r = insertO(self, 0, toInsert); 6441 ck_assert_ptr_ne(r, null); 6442 s = toStringO(r); 6443 ck_assert_str_eq(s, "s"); 6444 free(s); 6445 terminateO(toInsert); 6446 terminateO(self); 6447 6448 } 6449 6450 6451 void insertSmallJsonSmallStringT(void) { 6452 6453 smallStringt* r; 6454 smallStringt *self = allocG(""); 6455 smallJsont *toInsert = allocSmallJson(); 6456 6457 // insert 6458 setValO(self, "sheepy"); 6459 freeO(toInsert); 6460 setTopSO(toInsert, "lib"); 6461 r = self->f->insertSmallJson(self, 0, toInsert); 6462 ck_assert_ptr_ne(r, null); 6463 char *s = toStringO(r); 6464 ck_assert_str_eq(s, "libsheepy"); 6465 free(s); 6466 // negative index 6467 freeO(toInsert); 6468 setTopSO(toInsert, "P"); 6469 r = self->f->insertSmallJson(self, -2, toInsert); 6470 ck_assert_ptr_ne(r, null); 6471 s = toStringO(r); 6472 ck_assert_str_eq(s, "libsheepPy"); 6473 free(s); 6474 // edge 6475 setValO(self, "qwe"); 6476 freeO(toInsert); 6477 setTopSO(toInsert, "C"); 6478 r = self->f->insertSmallJson(self, 3, toInsert); 6479 ck_assert_ptr_ne(r, null); 6480 s = toStringO(r); 6481 ck_assert_str_eq(s, "qweC"); 6482 free(s); 6483 // outside string 6484 setValO(self, "qwe"); 6485 r = self->f->insertSmallJson(self, 4, toInsert); 6486 ck_assert_ptr_eq(r, NULL); 6487 r = self->f->insertSmallJson(self, -5, toInsert); 6488 ck_assert_ptr_eq(r, NULL); 6489 // negative index in a one char string 6490 setValO(self, "s"); 6491 freeO(toInsert); 6492 setTopSO(toInsert, "S"); 6493 r = self->f->insertSmallJson(self, -1, toInsert); 6494 ck_assert_ptr_ne(r, null); 6495 s = toStringO(r); 6496 ck_assert_str_eq(s, "sS"); 6497 free(s); 6498 // empty string 6499 setValO(self, ""); 6500 freeO(toInsert); 6501 setTopSO(toInsert, "s"); 6502 r = self->f->insertSmallJson(self, 0, toInsert); 6503 ck_assert_ptr_ne(r, null); 6504 s = toStringO(r); 6505 ck_assert_str_eq(s, "s"); 6506 free(s); 6507 setValO(self, ""); 6508 r = self->f->insertSmallJson(self, -1, toInsert); 6509 ck_assert_ptr_ne(r, null); 6510 s = toStringO(r); 6511 ck_assert_str_eq(s, "s"); 6512 free(s); 6513 // empty insert string 6514 setValO(self, "a"); 6515 freeO(toInsert); 6516 setTopSO(toInsert, ""); 6517 r = self->f->insertSmallJson(self, 0, toInsert); 6518 ck_assert_ptr_ne(r, null); 6519 s = toStringO(r); 6520 ck_assert_str_eq(s, "a"); 6521 free(s); 6522 freeO(toInsert); 6523 r = self->f->insertSmallJson(self, 0, toInsert); 6524 ck_assert_ptr_ne(r, null); 6525 s = toStringO(r); 6526 ck_assert_str_eq(s, "a"); 6527 free(s); 6528 // non json string toInsert 6529 freeO(toInsert); 6530 setTopIntO(toInsert, 2); 6531 r = self->f->insertSmallJson(self, 0, toInsert); 6532 ck_assert_ptr_eq(r, null); 6533 // non smallJson toInsert 6534 terminateO(toInsert); 6535 toInsert = (smallJsont*) allocSmallInt(1); 6536 r = self->f->insertSmallJson(self, 0, toInsert); 6537 ck_assert_ptr_eq(r, null); 6538 terminateO(toInsert); 6539 toInsert = allocSmallJson(); 6540 // NULL insert string 6541 r = self->f->insertSmallJson(self, 0, NULL); 6542 ck_assert_ptr_eq(r, null); 6543 // NULL string 6544 freeO(self); 6545 freeO(toInsert); 6546 setTopSO(toInsert, "s"); 6547 r = self->f->insertSmallJson(self, 1, toInsert); 6548 ck_assert_ptr_eq(r, null); 6549 r = self->f->insertSmallJson(self, 0, toInsert); 6550 ck_assert_ptr_ne(r, null); 6551 s = toStringO(r); 6552 ck_assert_str_eq(s, "s"); 6553 free(s); 6554 terminateO(toInsert); 6555 terminateO(self); 6556 6557 } 6558 6559 6560 void insertSSmallStringT(void) { 6561 6562 smallStringt* r; 6563 smallStringt *self = allocG(""); 6564 6565 // insert 6566 setValO(self, "sheepy"); 6567 r = insertSO(self, 0, "lib"); 6568 ck_assert_ptr_ne(r, null); 6569 char *s = toStringO(r); 6570 ck_assert_str_eq(s, "libsheepy"); 6571 free(s); 6572 // negative index 6573 r = insertSO(self, -2, "P"); 6574 ck_assert_ptr_ne(r, null); 6575 s = toStringO(r); 6576 ck_assert_str_eq(s, "libsheepPy"); 6577 free(s); 6578 // edge 6579 setValO(self, "qwe"); 6580 r = insertSO(self, 3, "C"); 6581 ck_assert_ptr_ne(r, null); 6582 s = toStringO(r); 6583 ck_assert_str_eq(s, "qweC"); 6584 free(s); 6585 // outside string 6586 setValO(self, "qwe"); 6587 r = insertSO(self, 4, "C"); 6588 ck_assert_ptr_eq(r, NULL); 6589 r = insertSO(self, -5, "C"); 6590 ck_assert_ptr_eq(r, NULL); 6591 // negative index in a one char string 6592 setValO(self, "s"); 6593 r = insertSO(self, -1, "S"); 6594 ck_assert_ptr_ne(r, null); 6595 s = toStringO(r); 6596 ck_assert_str_eq(s, "sS"); 6597 free(s); 6598 // empty string 6599 setValO(self, ""); 6600 r = insertSO(self, 0, "s"); 6601 ck_assert_ptr_ne(r, null); 6602 s = toStringO(r); 6603 ck_assert_str_eq(s, "s"); 6604 free(s); 6605 setValO(self, ""); 6606 r = insertSO(self, -1, "s"); 6607 ck_assert_ptr_ne(r, null); 6608 s = toStringO(r); 6609 ck_assert_str_eq(s, "s"); 6610 free(s); 6611 // empty insert string 6612 setValO(self, "a"); 6613 r = insertSO(self, 0, ""); 6614 ck_assert_ptr_ne(r, null); 6615 s = toStringO(r); 6616 ck_assert_str_eq(s, "a"); 6617 free(s); 6618 // NULL insert string 6619 r = insertSO(self, 0, NULL); 6620 ck_assert_ptr_ne(r, null); 6621 s = toStringO(r); 6622 ck_assert_str_eq(s, "a"); 6623 free(s); 6624 // NULL string 6625 freeO(self); 6626 r = insertSO(self, 0, "s"); 6627 ck_assert_ptr_ne(r, null); 6628 s = toStringO(r); 6629 ck_assert_str_eq(s, "s"); 6630 free(s); 6631 terminateO(self); 6632 6633 } 6634 6635 6636 void insertNFreeSmallStringT(void) { 6637 6638 smallStringt* r; 6639 smallStringt *self = allocG(""); 6640 smallStringt *toInsert = allocSmallString(""); 6641 6642 // insert 6643 setValO(self, "sheepy"); 6644 setValO(toInsert, "lib"); 6645 r = self->f->insertNFree(self, 0, toInsert); 6646 ck_assert_ptr_ne(r, null); 6647 char *s = toStringO(r); 6648 ck_assert_str_eq(s, "libsheepy"); 6649 free(s); 6650 // negative index 6651 toInsert = allocSmallString("P"); 6652 r = self->f->insertNFree(self, -2, toInsert); 6653 ck_assert_ptr_ne(r, null); 6654 s = toStringO(r); 6655 ck_assert_str_eq(s, "libsheepPy"); 6656 free(s); 6657 // edge 6658 setValO(self, "qwe"); 6659 toInsert = allocSmallString("C"); 6660 r = self->f->insertNFree(self, 3, toInsert); 6661 ck_assert_ptr_ne(r, null); 6662 s = toStringO(r); 6663 ck_assert_str_eq(s, "qweC"); 6664 free(s); 6665 // outside string 6666 setValO(self, "qwe"); 6667 toInsert = allocSmallString("S"); 6668 r = self->f->insertNFree(self, 4, toInsert); 6669 ck_assert_ptr_eq(r, NULL); 6670 r = self->f->insertNFree(self, -5, toInsert); 6671 ck_assert_ptr_eq(r, NULL); 6672 // negative index in a one char string 6673 setValO(self, "s"); 6674 r = self->f->insertNFree(self, -1, toInsert); 6675 ck_assert_ptr_ne(r, null); 6676 s = toStringO(r); 6677 ck_assert_str_eq(s, "sS"); 6678 free(s); 6679 // empty string 6680 setValO(self, ""); 6681 toInsert = allocSmallString("s"); 6682 r = self->f->insertNFree(self, 0, toInsert); 6683 ck_assert_ptr_ne(r, null); 6684 s = toStringO(r); 6685 ck_assert_str_eq(s, "s"); 6686 free(s); 6687 setValO(self, ""); 6688 toInsert = allocSmallString("s"); 6689 r = self->f->insertNFree(self, -1, toInsert); 6690 ck_assert_ptr_ne(r, null); 6691 s = toStringO(r); 6692 ck_assert_str_eq(s, "s"); 6693 free(s); 6694 // empty insert string 6695 setValO(self, "a"); 6696 toInsert = allocSmallString(""); 6697 r = self->f->insertNFree(self, 0, toInsert); 6698 ck_assert_ptr_ne(r, null); 6699 s = toStringO(r); 6700 ck_assert_str_eq(s, "a"); 6701 free(s); 6702 toInsert = allocSmallString(""); 6703 freeO(toInsert); 6704 r = self->f->insertNFree(self, 0, toInsert); 6705 ck_assert_ptr_ne(r, null); 6706 s = toStringO(r); 6707 ck_assert_str_eq(s, "a"); 6708 free(s); 6709 // non smallString toInsert 6710 toInsert = (smallStringt*) allocSmallInt(1); 6711 r = self->f->insertNFree(self, 0, toInsert); 6712 ck_assert_ptr_eq(r, null); 6713 terminateO(toInsert); 6714 toInsert = allocSmallString("s"); 6715 // NULL insert string 6716 r = self->f->insertNFree(self, 0, NULL); 6717 ck_assert_ptr_eq(r, null); 6718 // NULL string 6719 freeO(self); 6720 r = self->f->insertNFree(self, 1, toInsert); 6721 ck_assert_ptr_eq(r, null); 6722 r = self->f->insertNFree(self, 0, toInsert); 6723 ck_assert_ptr_ne(r, null); 6724 s = toStringO(r); 6725 ck_assert_str_eq(s, "s"); 6726 free(s); 6727 terminateO(self); 6728 6729 } 6730 6731 6732 void insertNFreeSmallJsonSmallStringT(void) { 6733 6734 smallStringt* r; 6735 smallStringt *self = allocG(""); 6736 smallJsont *toInsert = allocSmallJson(); 6737 6738 // insert 6739 setValO(self, "sheepy"); 6740 setTopSO(toInsert, "lib"); 6741 r = self->f->insertNFreeSmallJson(self, 0, toInsert); 6742 ck_assert_ptr_ne(r, null); 6743 char *s = toStringO(r); 6744 ck_assert_str_eq(s, "libsheepy"); 6745 free(s); 6746 // negative index 6747 toInsert = allocSmallJson(); 6748 setTopSO(toInsert, "P"); 6749 r = self->f->insertNFreeSmallJson(self, -2, toInsert); 6750 ck_assert_ptr_ne(r, null); 6751 s = toStringO(r); 6752 ck_assert_str_eq(s, "libsheepPy"); 6753 free(s); 6754 // edge 6755 setValO(self, "qwe"); 6756 toInsert = allocSmallJson(); 6757 setTopSO(toInsert, "C"); 6758 r = self->f->insertNFreeSmallJson(self, 3, toInsert); 6759 ck_assert_ptr_ne(r, null); 6760 s = toStringO(r); 6761 ck_assert_str_eq(s, "qweC"); 6762 free(s); 6763 // outside string 6764 setValO(self, "qwe"); 6765 toInsert = allocSmallJson(); 6766 setTopSO(toInsert, "S"); 6767 r = self->f->insertNFreeSmallJson(self, 4, toInsert); 6768 ck_assert_ptr_eq(r, NULL); 6769 r = self->f->insertNFreeSmallJson(self, -5, toInsert); 6770 ck_assert_ptr_eq(r, NULL); 6771 // negative index in a one char string 6772 setValO(self, "s"); 6773 r = self->f->insertNFreeSmallJson(self, -1, toInsert); 6774 ck_assert_ptr_ne(r, null); 6775 s = toStringO(r); 6776 ck_assert_str_eq(s, "sS"); 6777 free(s); 6778 // empty string 6779 setValO(self, ""); 6780 toInsert = allocSmallJson(); 6781 setTopSO(toInsert, "s"); 6782 r = self->f->insertNFreeSmallJson(self, 0, toInsert); 6783 ck_assert_ptr_ne(r, null); 6784 s = toStringO(r); 6785 ck_assert_str_eq(s, "s"); 6786 free(s); 6787 setValO(self, ""); 6788 toInsert = allocSmallJson(); 6789 setTopSO(toInsert, "s"); 6790 r = self->f->insertNFreeSmallJson(self, -1, toInsert); 6791 ck_assert_ptr_ne(r, null); 6792 s = toStringO(r); 6793 ck_assert_str_eq(s, "s"); 6794 free(s); 6795 // empty insert string 6796 setValO(self, "a"); 6797 toInsert = allocSmallJson(); 6798 setTopSO(toInsert, ""); 6799 r = self->f->insertNFreeSmallJson(self, 0, toInsert); 6800 ck_assert_ptr_ne(r, null); 6801 s = toStringO(r); 6802 ck_assert_str_eq(s, "a"); 6803 free(s); 6804 toInsert = allocSmallJson(); 6805 r = self->f->insertNFreeSmallJson(self, 0, toInsert); 6806 ck_assert_ptr_ne(r, null); 6807 s = toStringO(r); 6808 ck_assert_str_eq(s, "a"); 6809 free(s); 6810 // non json string toInsert 6811 toInsert = allocSmallJson(); 6812 setTopIntO(toInsert, 2); 6813 r = self->f->insertNFreeSmallJson(self, 0, toInsert); 6814 ck_assert_ptr_eq(r, null); 6815 // non smallJson toInsert 6816 terminateO(toInsert); 6817 toInsert = (smallJsont*) allocSmallInt(1); 6818 r = self->f->insertNFreeSmallJson(self, 0, toInsert); 6819 ck_assert_ptr_eq(r, null); 6820 terminateO(toInsert); 6821 toInsert = allocSmallJson(); 6822 // NULL insert string 6823 r = self->f->insertNFreeSmallJson(self, 0, NULL); 6824 ck_assert_ptr_eq(r, null); 6825 // NULL string 6826 freeO(self); 6827 setTopSO(toInsert, "s"); 6828 r = self->f->insertNFreeSmallJson(self, 1, toInsert); 6829 ck_assert_ptr_eq(r, null); 6830 r = self->f->insertNFreeSmallJson(self, 0, toInsert); 6831 ck_assert_ptr_ne(r, null); 6832 s = toStringO(r); 6833 ck_assert_str_eq(s, "s"); 6834 free(s); 6835 terminateO(self); 6836 6837 } 6838 6839 6840 void insertSNFreeSmallStringT(void) { 6841 6842 smallStringt* r; 6843 smallStringt *self = allocG(""); 6844 6845 // insert 6846 setValO(self, "sheepy"); 6847 r = insertSNFreeO(self, 0, strdup("lib")); 6848 ck_assert_ptr_ne(r, null); 6849 char *s = toStringO(r); 6850 ck_assert_str_eq(s, "libsheepy"); 6851 free(s); 6852 // negative index 6853 r = insertSNFreeO(self, -2, strdup("P")); 6854 ck_assert_ptr_ne(r, null); 6855 s = toStringO(r); 6856 ck_assert_str_eq(s, "libsheepPy"); 6857 free(s); 6858 // edge 6859 setValO(self, "qwe"); 6860 r = insertSNFreeO(self, 3, strdup("C")); 6861 ck_assert_ptr_ne(r, null); 6862 s = toStringO(r); 6863 ck_assert_str_eq(s, "qweC"); 6864 free(s); 6865 // outside string 6866 setValO(self, "qwe"); 6867 r = insertSNFreeO(self, 4, "C"); 6868 ck_assert_ptr_eq(r, NULL); 6869 r = insertSNFreeO(self, -5, "C"); 6870 ck_assert_ptr_eq(r, NULL); 6871 // negative index in a one char string 6872 setValO(self, "s"); 6873 r = insertSNFreeO(self, -1, strdup("S")); 6874 ck_assert_ptr_ne(r, null); 6875 s = toStringO(r); 6876 ck_assert_str_eq(s, "sS"); 6877 free(s); 6878 // empty string 6879 setValO(self, ""); 6880 r = insertSNFreeO(self, 0, strdup("s")); 6881 ck_assert_ptr_ne(r, null); 6882 s = toStringO(r); 6883 ck_assert_str_eq(s, "s"); 6884 free(s); 6885 setValO(self, ""); 6886 r = insertSNFreeO(self, -1, strdup("s")); 6887 ck_assert_ptr_ne(r, null); 6888 s = toStringO(r); 6889 ck_assert_str_eq(s, "s"); 6890 free(s); 6891 // empty insert string 6892 setValO(self, "a"); 6893 r = insertSNFreeO(self, 0, strdup("")); 6894 ck_assert_ptr_ne(r, null); 6895 s = toStringO(r); 6896 ck_assert_str_eq(s, "a"); 6897 free(s); 6898 // NULL insert string 6899 r = insertSNFreeO(self, 0, NULL); 6900 ck_assert_ptr_ne(r, null); 6901 s = toStringO(r); 6902 ck_assert_str_eq(s, "a"); 6903 free(s); 6904 // NULL string 6905 freeO(self); 6906 r = insertSNFreeO(self, 0, strdup("s")); 6907 ck_assert_ptr_ne(r, null); 6908 s = toStringO(r); 6909 ck_assert_str_eq(s, "s"); 6910 free(s); 6911 terminateO(self); 6912 6913 } 6914 6915 6916 void injectSmallStringT(void) { 6917 6918 smallStringt* r; 6919 smallStringt *self = allocG(""); 6920 6921 // insert 6922 setValO(self, "sheepy"); 6923 r = self->f->inject(self, 0, 'L'); 6924 ck_assert_ptr_ne(r, null); 6925 char *s = toStringO(r); 6926 ck_assert_str_eq(s, "Lsheepy"); 6927 free(s); 6928 // negative index 6929 setValO(self, "libsheepy"); 6930 r = self->f->inject(self, -2, 'P'); 6931 ck_assert_ptr_ne(r, null); 6932 s = toStringO(r); 6933 ck_assert_str_eq(s, "libsheepPy"); 6934 free(s); 6935 // edge 6936 setValO(self, "qwe"); 6937 r = self->f->inject(self, 3, 'C'); 6938 ck_assert_ptr_ne(r, null); 6939 s = toStringO(r); 6940 ck_assert_str_eq(s, "qweC"); 6941 free(s); 6942 // outside string 6943 setValO(self, "qwe"); 6944 r = self->f->inject(self, 4, 'C'); 6945 ck_assert_ptr_eq(r, NULL); 6946 r = self->f->inject(self, -5, 'C'); 6947 ck_assert_ptr_eq(r, NULL); 6948 // negative index in a one char string 6949 setValO(self, "s"); 6950 r = self->f->inject(self, -2, 'S'); 6951 ck_assert_ptr_ne(r, null); 6952 s = toStringO(r); 6953 ck_assert_str_eq(s, "Ss"); 6954 free(s); 6955 // empty string 6956 setValO(self, ""); 6957 r = self->f->inject(self, 0, 's'); 6958 ck_assert_ptr_ne(r, null); 6959 s = toStringO(r); 6960 ck_assert_str_eq(s, "s"); 6961 free(s); 6962 setValO(self, ""); 6963 r = self->f->inject(self, -1, 's'); 6964 ck_assert_ptr_ne(r, null); 6965 s = toStringO(r); 6966 ck_assert_str_eq(s, "s"); 6967 free(s); 6968 // NULL string 6969 freeO(self); 6970 r = self->f->inject(self, 1, 's'); 6971 ck_assert_ptr_eq(r, NULL); 6972 r = self->f->inject(self, 0, 's'); 6973 ck_assert_ptr_ne(r, null); 6974 s = toStringO(r); 6975 ck_assert_str_eq(s, "s"); 6976 free(s); 6977 terminateO(self); 6978 6979 } 6980 6981 6982 void delSmallStringT(void) { 6983 6984 smallStringt* r; 6985 smallStringt *self = allocG(""); 6986 6987 // del 6988 setValO(self, "sheepy"); 6989 r = delO(self, 0,2); 6990 ck_assert_ptr_ne(r, null); 6991 char *s = toStringO(r); 6992 ck_assert_str_eq(s, "eepy"); 6993 free(s); 6994 // negative index 6995 setValO(self, "sheepy"); 6996 r = delO(self, -2,0); 6997 ck_assert_ptr_ne(r, null); 6998 s = toStringO(r); 6999 ck_assert_str_eq(s, "shee"); 7000 free(s); 7001 // positive and negative indexes 7002 setValO(self, "sheepy"); 7003 r = delO(self, 2,-2); 7004 ck_assert_ptr_ne(r, null); 7005 s = toStringO(r); 7006 ck_assert_str_eq(s, "shpy"); 7007 free(s); 7008 // start = end 7009 setValO(self, "sheepy"); 7010 r = delO(self, 2,-4); 7011 ck_assert_ptr_ne(r, null); 7012 s = toStringO(r); 7013 ck_assert_str_eq(s, "sheepy"); 7014 free(s); 7015 // delete entire string 7016 setValO(self, "sheepy"); 7017 r = delO(self, 0,0); 7018 ck_assert_ptr_ne(r, null); 7019 s = toStringO(r); 7020 ck_assert_str_eq(s, ""); 7021 free(s); 7022 // end of string 7023 setValO(self, "sheepy"); 7024 r = delO(self, 2,6); 7025 ck_assert_ptr_ne(r, null); 7026 s = toStringO(r); 7027 ck_assert_str_eq(s, "sh"); 7028 free(s); 7029 // NULL string 7030 freeO(self); 7031 r = delO(self, 2,-4); 7032 ck_assert_ptr_eq(r, NULL); 7033 // start outside string 7034 setValO(self, "sheepy"); 7035 r = delO(self, 20,-4); 7036 ck_assert_ptr_eq(r, null); 7037 s = toStringO(self); 7038 ck_assert_str_eq(s, "sheepy"); 7039 free(s); 7040 r = delO(self, -20,-4); 7041 ck_assert_ptr_ne(r, null); 7042 s = toStringO(r); 7043 ck_assert_str_eq(s, "eepy"); 7044 free(s); 7045 // end outside string 7046 setValO(self, "sheepy"); 7047 r = delO(self, 2,40); 7048 ck_assert_ptr_ne(r, null); 7049 s = toStringO(r); 7050 ck_assert_str_eq(s, "sh"); 7051 free(s); 7052 setValO(self, "sheepy"); 7053 r = delO(self, 2,-40); 7054 ck_assert_ptr_eq(r, null); 7055 s = toStringO(self); 7056 ck_assert_str_eq(s, "sheepy"); 7057 free(s); 7058 // end before start 7059 setValO(self, "sheepy"); 7060 r = delO(self, 4,2); 7061 ck_assert_ptr_eq(r, null); 7062 s = toStringO(self); 7063 ck_assert_str_eq(s, "sheepy"); 7064 free(s); 7065 terminateO(self); 7066 7067 } 7068 7069 7070 void delElemSmallStringT(void) { 7071 7072 smallStringt* r; 7073 smallStringt *self = allocG(""); 7074 7075 // del 7076 setValO(self, "sheepy"); 7077 r = delElemO(self, 0); 7078 ck_assert_ptr_ne(r, null); 7079 char *s = toStringO(r); 7080 ck_assert_str_eq(s, "heepy"); 7081 free(s); 7082 setValO(self, "sheepy"); 7083 r = delElemO(self, 5); 7084 ck_assert_ptr_ne(r, null); 7085 s = toStringO(r); 7086 ck_assert_str_eq(s, "sheep"); 7087 free(s); 7088 // negative index 7089 setValO(self, "sheepy"); 7090 r = delElemO(self, -1); 7091 ck_assert_ptr_ne(r, null); 7092 s = toStringO(r); 7093 ck_assert_str_eq(s, "sheep"); 7094 free(s); 7095 setValO(self, "sheepy"); 7096 r = delElemO(self, -6); 7097 ck_assert_ptr_ne(r, null); 7098 s = toStringO(r); 7099 ck_assert_str_eq(s, "heepy"); 7100 free(s); 7101 // index outside string 7102 setValO(self, "sheepy"); 7103 r = delElemO(self, 6); 7104 ck_assert_ptr_eq(r, null); 7105 r = delElemO(self, -7); 7106 ck_assert_ptr_eq(r, null); 7107 // empty string 7108 setValO(self, ""); 7109 ck_assert_ptr_eq(delElemO(self, 0), null); 7110 // null string 7111 freeO(self); 7112 ck_assert_ptr_eq(delElemO(self, 0), null); 7113 terminateO(self); 7114 7115 } 7116 7117 7118 void hasSmallStringT(void) { 7119 7120 smallStringt *self = allocG(""); 7121 7122 // find string in the middle 7123 setValO(self, "sheepy"); 7124 ck_assert_str_eq(hasO(self, "ee"), "eepy"); 7125 // find non existing string 7126 ck_assert_ptr_eq(hasO(self, "$"), NULL); 7127 // find NULL 7128 ck_assert_ptr_eq(hasO(self, NULL), NULL); 7129 // empty string 7130 setValO(self, ""); 7131 ck_assert_ptr_eq(hasO(self, "$"), NULL); 7132 // NULL string 7133 freeO(self); 7134 ck_assert_ptr_eq(hasO(self, "$"), NULL); 7135 terminateO(self); 7136 7137 } 7138 7139 7140 void hasCharSmallStringT(void) { 7141 7142 smallStringt *self = allocG(""); 7143 7144 // find string in the middle 7145 setValO(self, "sheepy"); 7146 ck_assert_str_eq(hasCharO(self, 'e'), "eepy"); 7147 // find non existing string 7148 ck_assert_ptr_eq(hasCharO(self, '$'), NULL); 7149 // find 0 7150 ck_assert_str_eq(hasCharO(self, 0), ""); 7151 // empty string 7152 setValO(self, ""); 7153 ck_assert_ptr_eq(hasCharO(self, '$'), NULL); 7154 // NULL string 7155 freeO(self); 7156 ck_assert_ptr_eq(hasCharO(self, '$'), NULL); 7157 terminateO(self); 7158 7159 } 7160 7161 7162 void hasSmallJsonSmallStringT(void) { 7163 7164 smallStringt *self = allocG(""); 7165 smallJsont *needle = allocSmallJson(); 7166 7167 // find string in the middle 7168 setValO(self, "sheepy"); 7169 setTopSO(needle, "ee"); 7170 ck_assert_str_eq(self->f->hasSmallJson(self, needle), "eepy"); 7171 // find non existing string 7172 freeO(needle); 7173 setTopSO(needle, "$"); 7174 ck_assert_ptr_eq(self->f->hasSmallJson(self, needle), NULL); 7175 // non json string 7176 freeO(needle); 7177 ck_assert_ptr_eq(self->f->hasSmallJson(self, needle), NULL); 7178 // non json object 7179 terminateO(needle); 7180 needle = (smallJsont*) allocSmallInt(1); 7181 ck_assert_ptr_eq(self->f->hasSmallJson(self, needle), NULL); 7182 terminateO(needle); 7183 // find NULL 7184 ck_assert_ptr_eq(self->f->hasSmallJson(self, NULL), NULL); 7185 // empty string 7186 setValO(self, ""); 7187 needle = allocSmallJson(); 7188 setTopSO(needle, "$"); 7189 ck_assert_ptr_eq(self->f->hasSmallJson(self, needle), NULL); 7190 // NULL string 7191 freeO(self); 7192 ck_assert_ptr_eq(self->f->hasSmallJson(self, needle), NULL); 7193 terminateO(needle); 7194 terminateO(self); 7195 7196 } 7197 7198 7199 void hasSmallStringSmallStringT(void) { 7200 7201 smallStringt *self = allocG(""); 7202 smallStringt *needle = allocSmallString("ee"); 7203 7204 // find string in the middle 7205 setValO(self, "sheepy"); 7206 ck_assert_str_eq(self->f->hasSmallString(self, needle), "eepy"); 7207 // find non existing string 7208 setValO(needle, "$"); 7209 ck_assert_ptr_eq(self->f->hasSmallString(self, needle), NULL); 7210 // non smallString object 7211 terminateO(needle); 7212 needle = (smallStringt*) allocSmallInt(1); 7213 ck_assert_ptr_eq(self->f->hasSmallString(self, needle), NULL); 7214 terminateO(needle); 7215 // find NULL 7216 ck_assert_ptr_eq(self->f->hasSmallString(self, NULL), NULL); 7217 // empty string 7218 setValO(self, ""); 7219 needle = allocSmallString("$"); 7220 ck_assert_ptr_eq(self->f->hasSmallString(self, needle), NULL); 7221 // NULL string 7222 freeO(self); 7223 ck_assert_ptr_eq(self->f->hasSmallString(self, needle), NULL); 7224 terminateO(needle); 7225 terminateO(self); 7226 7227 } 7228 7229 7230 void findSmallStringT(void) { 7231 7232 smallStringt* r; 7233 smallStringt *self = allocG(""); 7234 7235 // find string in the middle 7236 setValO(self, "sheepy"); 7237 r = findO(self, "ee"); 7238 ck_assert_ptr_ne(r, null); 7239 ck_assert_str_eq(ssGet(r), "eepy"); 7240 terminateO(r); 7241 // find non existing string 7242 ck_assert_ptr_eq(findO(self, "$"), NULL); 7243 // find NULL 7244 ck_assert_ptr_eq(findO(self, NULL), NULL); 7245 // empty string 7246 setValO(self, ""); 7247 ck_assert_ptr_eq(findO(self, "$"), NULL); 7248 // NULL string 7249 freeO(self); 7250 ck_assert_ptr_eq(findO(self, "$"), NULL); 7251 terminateO(self); 7252 7253 } 7254 7255 7256 void findCharSmallStringT(void) { 7257 7258 smallStringt* r; 7259 smallStringt *self = allocG(""); 7260 7261 // find string in the middle 7262 setValO(self, "sheepy"); 7263 r = findCharO(self, 'e'); 7264 ck_assert_ptr_ne(r, null); 7265 ck_assert_str_eq(ssGet(r), "eepy"); 7266 terminateO(r); 7267 // find non existing string 7268 ck_assert_ptr_eq(findCharO(self, '$'), NULL); 7269 // find 0 7270 r = findCharO(self, 0); 7271 ck_assert_ptr_ne(r, null); 7272 ck_assert_str_eq(ssGet(r), ""); 7273 terminateO(r); 7274 // empty string 7275 setValO(self, ""); 7276 ck_assert_ptr_eq(findCharO(self, '$'), NULL); 7277 // NULL string 7278 freeO(self); 7279 ck_assert_ptr_eq(findCharO(self, '$'), NULL); 7280 terminateO(self); 7281 7282 } 7283 7284 7285 void findSmallJsonSmallStringT(void) { 7286 7287 smallStringt* r; 7288 smallStringt *self = allocG(""); 7289 smallJsont *needle = allocSmallJson(); 7290 7291 // find string in the middle 7292 setValO(self, "sheepy"); 7293 setTopSO(needle, "ee"); 7294 r = self->f->findSmallJson(self, needle); 7295 ck_assert_ptr_ne(r, null); 7296 ck_assert_str_eq(ssGet(r), "eepy"); 7297 terminateO(r); 7298 // find non existing string 7299 freeO(needle); 7300 setTopSO(needle, "$"); 7301 ck_assert_ptr_eq(self->f->findSmallJson(self, needle), NULL); 7302 // non json string 7303 freeO(needle); 7304 ck_assert_ptr_eq(self->f->findSmallJson(self, needle), NULL); 7305 // non json object 7306 terminateO(needle); 7307 needle = (smallJsont*) allocSmallInt(1); 7308 ck_assert_ptr_eq(self->f->findSmallJson(self, needle), NULL); 7309 terminateO(needle); 7310 // find NULL 7311 ck_assert_ptr_eq(self->f->findSmallJson(self, NULL), NULL); 7312 // empty string 7313 setValO(self, ""); 7314 needle = allocSmallJson(); 7315 setTopSO(needle, "$"); 7316 ck_assert_ptr_eq(self->f->findSmallJson(self, needle), NULL); 7317 // NULL string 7318 freeO(self); 7319 ck_assert_ptr_eq(self->f->findSmallJson(self, needle), NULL); 7320 terminateO(needle); 7321 terminateO(self); 7322 7323 } 7324 7325 7326 void findSmallStringSmallStringT(void) { 7327 7328 smallStringt* r; 7329 smallStringt *self = allocG(""); 7330 smallStringt *needle = allocSmallString("ee"); 7331 7332 // find string in the middle 7333 setValO(self, "sheepy"); 7334 r = self->f->findSmallString(self, needle); 7335 ck_assert_ptr_ne(r, null); 7336 ck_assert_str_eq(ssGet(r), "eepy"); 7337 terminateO(r); 7338 // find non existing string 7339 setValO(needle, "$"); 7340 ck_assert_ptr_eq(self->f->findSmallString(self, needle), NULL); 7341 // non smallString object 7342 terminateO(needle); 7343 needle = (smallStringt*) allocSmallInt(1); 7344 ck_assert_ptr_eq(self->f->findSmallString(self, needle), NULL); 7345 terminateO(needle); 7346 // find NULL 7347 ck_assert_ptr_eq(self->f->findSmallString(self, NULL), NULL); 7348 // empty string 7349 setValO(self, ""); 7350 needle = allocSmallString("$"); 7351 ck_assert_ptr_eq(self->f->findSmallString(self, needle), NULL); 7352 // NULL string 7353 freeO(self); 7354 ck_assert_ptr_eq(self->f->findSmallString(self, needle), NULL); 7355 terminateO(needle); 7356 terminateO(self); 7357 7358 } 7359 7360 7361 void indexOfSmallStringT(void) { 7362 7363 smallStringt *self = allocG(""); 7364 7365 // indexOf string in the middle 7366 setValO(self, "sheepy"); 7367 ck_assert_int_eq(indexOfO(self, "ee"), 2); 7368 // indexOf non existing string 7369 ck_assert_int_eq(indexOfO(self, "$"), -1); 7370 // indexOf NULL 7371 ck_assert_int_eq(indexOfO(self, NULL), -1); 7372 // NULL string 7373 freeO(self); 7374 ck_assert_int_eq(indexOfO(self, "$"), -1); 7375 terminateO(self); 7376 7377 } 7378 7379 7380 void indexOfCharSmallStringT(void) { 7381 7382 smallStringt *self = allocG(""); 7383 7384 // indexOf string in the middle 7385 setValO(self, "sheepy"); 7386 ck_assert_int_eq(indexOfCharO(self, 'e'), 2); 7387 // indexOf non existing string 7388 ck_assert_int_eq(indexOfCharO(self, '$'), -1); 7389 // indexOf 0 7390 ck_assert_int_eq(indexOfCharO(self, 0), 6); 7391 // NULL string 7392 freeO(self); 7393 ck_assert_int_eq(indexOfCharO(self, '$'), -1); 7394 terminateO(self); 7395 7396 } 7397 7398 7399 void indexOfSmallJsonSmallStringT(void) { 7400 7401 smallStringt *self = allocG(""); 7402 smallJsont *needle = allocSmallJson(); 7403 7404 // indexOf string in the middle 7405 setValO(self, "sheepy"); 7406 setTopSO(needle, "ee"); 7407 ck_assert_int_eq(self->f->indexOfSmallJson(self, needle), 2); 7408 // indexOf non existing string 7409 freeO(needle); 7410 setTopSO(needle, "$"); 7411 ck_assert_int_eq(self->f->indexOfSmallJson(self, needle), -1); 7412 // non json string 7413 freeO(needle); 7414 ck_assert_int_eq(self->f->indexOfSmallJson(self, needle), -1); 7415 // non json object 7416 terminateO(needle); 7417 needle = (smallJsont*) allocSmallInt(1); 7418 ck_assert_int_eq(self->f->indexOfSmallJson(self, needle), -1); 7419 terminateO(needle); 7420 // indexOf NULL 7421 ck_assert_int_eq(self->f->indexOfSmallJson(self, NULL), -1); 7422 // empty string 7423 setValO(self, ""); 7424 needle = allocSmallJson(); 7425 setTopSO(needle, "$"); 7426 ck_assert_int_eq(self->f->indexOfSmallJson(self, needle), -1); 7427 // NULL string 7428 freeO(self); 7429 ck_assert_int_eq(self->f->indexOfSmallJson(self, needle), -1); 7430 terminateO(needle); 7431 terminateO(self); 7432 7433 } 7434 7435 7436 void indexOfSmallStringSmallStringT(void) { 7437 7438 smallStringt *self = allocG(""); 7439 smallStringt *needle = allocSmallString("ee"); 7440 7441 // indexOf string in the middle 7442 setValO(self, "sheepy"); 7443 ck_assert_int_eq(self->f->indexOfSmallString(self, needle), 2); 7444 // indexOf non existing string 7445 setValO(needle, "$"); 7446 ck_assert_int_eq(self->f->indexOfSmallString(self, needle), -1); 7447 // non smallString object 7448 terminateO(needle); 7449 needle = (smallStringt*) allocSmallInt(1); 7450 ck_assert_int_eq(self->f->indexOfSmallString(self, needle), -1); 7451 terminateO(needle); 7452 // indexOf NULL 7453 ck_assert_int_eq(self->f->indexOfSmallString(self, NULL), -1); 7454 // empty string 7455 setValO(self, ""); 7456 needle = allocSmallString("$"); 7457 ck_assert_int_eq(self->f->indexOfSmallString(self, needle), -1); 7458 // NULL string 7459 freeO(self); 7460 ck_assert_int_eq(self->f->indexOfSmallString(self, needle), -1); 7461 terminateO(needle); 7462 terminateO(self); 7463 7464 } 7465 7466 7467 void icHasSmallStringT(void) { 7468 7469 smallStringt *self = allocG(""); 7470 7471 // find string in the middle 7472 setValO(self, "sheepy"); 7473 ck_assert_str_eq(icHasO(self, "EE"), "eepy"); 7474 // find non existing string 7475 ck_assert_ptr_eq(icHasO(self, "$"), NULL); 7476 // find NULL 7477 ck_assert_ptr_eq(icHasO(self, NULL), NULL); 7478 // empty string 7479 setValO(self, ""); 7480 ck_assert_ptr_eq(icHasO(self, "$"), NULL); 7481 // NULL string 7482 freeO(self); 7483 ck_assert_ptr_eq(icHasO(self, "$"), NULL); 7484 terminateO(self); 7485 7486 } 7487 7488 7489 void icHasCharSmallStringT(void) { 7490 7491 smallStringt *self = allocG(""); 7492 7493 // find string in the middle 7494 setValO(self, "sheepy"); 7495 ck_assert_str_eq(icHasCharO(self, 'E'), "eepy"); 7496 // find non existing string 7497 ck_assert_ptr_eq(icHasCharO(self, '$'), NULL); 7498 // find 0 7499 ck_assert_str_eq(icHasCharO(self, 0), ""); 7500 // empty string 7501 setValO(self, ""); 7502 ck_assert_ptr_eq(icHasCharO(self, '$'), NULL); 7503 ck_assert_ptr_eq(icHasCharO(self, 0), NULL); 7504 // NULL string 7505 freeO(self); 7506 ck_assert_ptr_eq(icHasCharO(self, '$'), NULL); 7507 ck_assert_ptr_eq(icHasCharO(self, 0), NULL); 7508 terminateO(self); 7509 7510 } 7511 7512 7513 void icHasSmallJsonSmallStringT(void) { 7514 7515 smallStringt *self = allocG(""); 7516 smallJsont *needle = allocSmallJson(); 7517 7518 // find string in the middle 7519 setValO(self, "sheepy"); 7520 setTopSO(needle, "EE"); 7521 ck_assert_str_eq(self->f->icHasSmallJson(self, needle), "eepy"); 7522 // find non existing string 7523 freeO(needle); 7524 setTopSO(needle, "$"); 7525 ck_assert_ptr_eq(self->f->icHasSmallJson(self, needle), NULL); 7526 // non json string 7527 freeO(needle); 7528 ck_assert_ptr_eq(self->f->icHasSmallJson(self, needle), NULL); 7529 // non json object 7530 terminateO(needle); 7531 needle = (smallJsont*) allocSmallInt(1); 7532 ck_assert_ptr_eq(self->f->icHasSmallJson(self, needle), NULL); 7533 terminateO(needle); 7534 // find NULL 7535 ck_assert_ptr_eq(self->f->icHasSmallJson(self, NULL), NULL); 7536 // empty string 7537 setValO(self, ""); 7538 needle = allocSmallJson(); 7539 setTopSO(needle, "$"); 7540 ck_assert_ptr_eq(self->f->icHasSmallJson(self, needle), NULL); 7541 // NULL string 7542 freeO(self); 7543 ck_assert_ptr_eq(self->f->icHasSmallJson(self, needle), NULL); 7544 terminateO(needle); 7545 terminateO(self); 7546 7547 } 7548 7549 7550 void icHasSmallStringSmallStringT(void) { 7551 7552 smallStringt *self = allocG(""); 7553 smallStringt *needle = allocSmallString("EE"); 7554 7555 // find string in the middle 7556 setValO(self, "sheepy"); 7557 ck_assert_str_eq(self->f->icHasSmallString(self, needle), "eepy"); 7558 // find non existing string 7559 setValO(needle, "$"); 7560 ck_assert_ptr_eq(self->f->icHasSmallString(self, needle), NULL); 7561 // non smallString object 7562 terminateO(needle); 7563 needle = (smallStringt*) allocSmallInt(1); 7564 ck_assert_ptr_eq(self->f->icHasSmallString(self, needle), NULL); 7565 terminateO(needle); 7566 // find NULL 7567 ck_assert_ptr_eq(self->f->icHasSmallString(self, NULL), NULL); 7568 // empty string 7569 setValO(self, ""); 7570 needle = allocSmallString("$"); 7571 ck_assert_ptr_eq(self->f->icHasSmallString(self, needle), NULL); 7572 // NULL string 7573 freeO(self); 7574 ck_assert_ptr_eq(self->f->icHasSmallString(self, needle), NULL); 7575 terminateO(needle); 7576 terminateO(self); 7577 7578 } 7579 7580 7581 void icFindSmallStringT(void) { 7582 7583 smallStringt* r; 7584 smallStringt *self = allocG(""); 7585 7586 // icFind string in the middle 7587 setValO(self, "sheepy"); 7588 r = icFindO(self, "EE"); 7589 ck_assert_ptr_ne(r, null); 7590 ck_assert_str_eq(ssGet(r), "eepy"); 7591 terminateO(r); 7592 // find non existing string 7593 ck_assert_ptr_eq(icFindO(self, "$"), NULL); 7594 // find NULL 7595 ck_assert_ptr_eq(icFindO(self, NULL), NULL); 7596 // empty string 7597 setValO(self, ""); 7598 ck_assert_ptr_eq(icFindO(self, "$"), NULL); 7599 // NULL string 7600 freeO(self); 7601 ck_assert_ptr_eq(icFindO(self, "$"), NULL); 7602 terminateO(self); 7603 7604 } 7605 7606 7607 void icFindCharSmallStringT(void) { 7608 7609 smallStringt* r; 7610 smallStringt *self = allocG(""); 7611 7612 // find string in the middle 7613 setValO(self, "sheepy"); 7614 r = icFindCharO(self, 'E'); 7615 ck_assert_ptr_ne(r, null); 7616 ck_assert_str_eq(ssGet(r), "eepy"); 7617 terminateO(r); 7618 // find non existing string 7619 ck_assert_ptr_eq(icFindCharO(self, '$'), NULL); 7620 // find 0 7621 r = icFindCharO(self, 0); 7622 ck_assert_ptr_ne(r, null); 7623 ck_assert_str_eq(ssGet(r), ""); 7624 terminateO(r); 7625 // empty string 7626 setValO(self, ""); 7627 ck_assert_ptr_eq(icFindCharO(self, '$'), NULL); 7628 ck_assert_ptr_eq(icFindCharO(self, 0), NULL); 7629 // NULL string 7630 freeO(self); 7631 ck_assert_ptr_eq(icFindCharO(self, '$'), NULL); 7632 ck_assert_ptr_eq(icFindCharO(self, 0), NULL); 7633 terminateO(self); 7634 7635 } 7636 7637 7638 void icFindSmallJsonSmallStringT(void) { 7639 7640 smallStringt* r; 7641 smallStringt *self = allocG(""); 7642 smallJsont *needle = allocSmallJson(); 7643 7644 // find string in the middle 7645 setValO(self, "sheepy"); 7646 setTopSO(needle, "EE"); 7647 r = self->f->icFindSmallJson(self, needle); 7648 ck_assert_ptr_ne(r, null); 7649 ck_assert_str_eq(ssGet(r), "eepy"); 7650 terminateO(r); 7651 // find non existing string 7652 freeO(needle); 7653 setTopSO(needle, "$"); 7654 ck_assert_ptr_eq(self->f->icFindSmallJson(self, needle), NULL); 7655 // non json string 7656 freeO(needle); 7657 ck_assert_ptr_eq(self->f->icFindSmallJson(self, needle), NULL); 7658 // non json object 7659 terminateO(needle); 7660 needle = (smallJsont*) allocSmallInt(1); 7661 ck_assert_ptr_eq(self->f->icFindSmallJson(self, needle), NULL); 7662 terminateO(needle); 7663 // find NULL 7664 ck_assert_ptr_eq(self->f->icFindSmallJson(self, NULL), NULL); 7665 // empty string 7666 setValO(self, ""); 7667 needle = allocSmallJson(); 7668 setTopSO(needle, "$"); 7669 ck_assert_ptr_eq(self->f->icFindSmallJson(self, needle), NULL); 7670 // NULL string 7671 freeO(self); 7672 ck_assert_ptr_eq(self->f->icFindSmallJson(self, needle), NULL); 7673 terminateO(needle); 7674 terminateO(self); 7675 7676 } 7677 7678 7679 void icFindSmallStringSmallStringT(void) { 7680 7681 smallStringt* r; 7682 smallStringt *self = allocG(""); 7683 smallStringt *needle = allocSmallString("EE"); 7684 7685 // find string in the middle 7686 setValO(self, "sheepy"); 7687 r = self->f->icFindSmallString(self, needle); 7688 ck_assert_ptr_ne(r, null); 7689 ck_assert_str_eq(ssGet(r), "eepy"); 7690 terminateO(r); 7691 // find non existing string 7692 setValO(needle, "$"); 7693 ck_assert_ptr_eq(self->f->icFindSmallString(self, needle), NULL); 7694 // non smallString object 7695 terminateO(needle); 7696 needle = (smallStringt*) allocSmallInt(1); 7697 ck_assert_ptr_eq(self->f->icFindSmallString(self, needle), NULL); 7698 terminateO(needle); 7699 // find NULL 7700 ck_assert_ptr_eq(self->f->icFindSmallString(self, NULL), NULL); 7701 // empty string 7702 setValO(self, ""); 7703 needle = allocSmallString("$"); 7704 ck_assert_ptr_eq(self->f->icFindSmallString(self, needle), NULL); 7705 // NULL string 7706 freeO(self); 7707 ck_assert_ptr_eq(self->f->icFindSmallString(self, needle), NULL); 7708 terminateO(needle); 7709 terminateO(self); 7710 7711 } 7712 7713 7714 void icIndexOfSmallStringT(void) { 7715 7716 smallStringt *self = allocG(""); 7717 7718 // indexOf string in the middle 7719 setValO(self, "sheepy"); 7720 ck_assert_int_eq(icIndexOfO(self, "EE"), 2); 7721 // indexOf non existing string 7722 ck_assert_int_eq(icIndexOfO(self, "$"), -1); 7723 // indexOf NULL 7724 ck_assert_int_eq(icIndexOfO(self, NULL), -1); 7725 // NULL string 7726 freeO(self); 7727 ck_assert_int_eq(icIndexOfO(self, "$"), -1); 7728 terminateO(self); 7729 7730 } 7731 7732 7733 void icIndexOfCharSmallStringT(void) { 7734 7735 smallStringt *self = allocG(""); 7736 7737 // indexOf string in the middle 7738 setValO(self, "sheepy"); 7739 ck_assert_int_eq(icIndexOfCharO(self, 'E'), 2); 7740 // indexOf non existing string 7741 ck_assert_int_eq(icIndexOfCharO(self, '$'), -1); 7742 // indexOf 0 7743 ck_assert_int_eq(icIndexOfCharO(self, 0), 6); 7744 // NULL string 7745 freeO(self); 7746 ck_assert_int_eq(icIndexOfCharO(self, '$'), -1); 7747 terminateO(self); 7748 7749 } 7750 7751 7752 void icIndexOfSmallJsonSmallStringT(void) { 7753 7754 smallStringt *self = allocG(""); 7755 smallJsont *needle = allocSmallJson(); 7756 7757 // indexOf string in the middle 7758 setValO(self, "sheepy"); 7759 setTopSO(needle, "EE"); 7760 ck_assert_int_eq(self->f->icIndexOfSmallJson(self, needle), 2); 7761 // indexOf non existing string 7762 freeO(needle); 7763 setTopSO(needle, "$"); 7764 ck_assert_int_eq(self->f->icIndexOfSmallJson(self, needle), -1); 7765 // non json string 7766 freeO(needle); 7767 ck_assert_int_eq(self->f->icIndexOfSmallJson(self, needle), -1); 7768 // non json object 7769 terminateO(needle); 7770 needle = (smallJsont*) allocSmallInt(1); 7771 ck_assert_int_eq(self->f->icIndexOfSmallJson(self, needle), -1); 7772 terminateO(needle); 7773 // indexOf NULL 7774 ck_assert_int_eq(self->f->icIndexOfSmallJson(self, NULL), -1); 7775 // empty string 7776 setValO(self, ""); 7777 needle = allocSmallJson(); 7778 setTopSO(needle, "$"); 7779 ck_assert_int_eq(self->f->icIndexOfSmallJson(self, needle), -1); 7780 // NULL string 7781 freeO(self); 7782 ck_assert_int_eq(self->f->icIndexOfSmallJson(self, needle), -1); 7783 terminateO(needle); 7784 terminateO(self); 7785 7786 } 7787 7788 7789 void icIndexOfSmallStringSmallStringT(void) { 7790 7791 smallStringt *self = allocG(""); 7792 smallStringt *needle = allocSmallString("EE"); 7793 7794 // indexOf string in the middle 7795 setValO(self, "sheepy"); 7796 ck_assert_int_eq(self->f->icIndexOfSmallString(self, needle), 2); 7797 // indexOf non existing string 7798 setValO(needle, "$"); 7799 ck_assert_int_eq(self->f->icIndexOfSmallString(self, needle), -1); 7800 // non smallString object 7801 terminateO(needle); 7802 needle = (smallStringt*) allocSmallInt(1); 7803 ck_assert_int_eq(self->f->icIndexOfSmallString(self, needle), -1); 7804 terminateO(needle); 7805 // indexOf NULL 7806 ck_assert_int_eq(self->f->icIndexOfSmallString(self, NULL), -1); 7807 // empty string 7808 setValO(self, ""); 7809 needle = allocSmallString("$"); 7810 ck_assert_int_eq(self->f->icIndexOfSmallString(self, needle), -1); 7811 // NULL string 7812 freeO(self); 7813 ck_assert_int_eq(self->f->icIndexOfSmallString(self, needle), -1); 7814 terminateO(needle); 7815 terminateO(self); 7816 7817 } 7818 7819 7820 void emptySmallStringT(void) { 7821 7822 smallStringt* r; 7823 smallStringt *self = allocG("qwe"); 7824 7825 r = emptyO(self); 7826 ck_assert_ptr_ne(r, null); 7827 char *s = toStringO(r); 7828 ck_assert_str_eq(s, ""); 7829 free(s); 7830 terminateO(self); 7831 7832 } 7833 7834 7835 void isEmptySmallStringT(void) { 7836 7837 smallStringt *self = allocG("qwe"); 7838 7839 ck_assert(!isEmptyO(self)); 7840 emptyO(self); 7841 ck_assert(isEmptyO(self)); 7842 freeO(self); 7843 ck_assert(isEmptyO(self)); 7844 terminateO(self); 7845 7846 } 7847 7848 7849 void isBlankSmallStringT(void) { 7850 7851 smallStringt *self = allocG("q w"); 7852 7853 ck_assert(!isBlankO(self)); 7854 setValO(self, " "); 7855 ck_assert(isBlankO(self)); 7856 emptyO(self); 7857 ck_assert(isBlankO(self)); 7858 freeO(self); 7859 ck_assert(isBlankO(self)); 7860 terminateO(self); 7861 7862 } 7863 7864 7865 void splitSmallStringT(void) { 7866 7867 smallArrayt* r; 7868 smallStringt *self = allocG(""); 7869 7870 // string 7871 setValO(self, "one/two"); 7872 r = splitO(self, "/"); 7873 ck_assert_ptr_ne(r, null); 7874 char *s = toStringO(r); 7875 ck_assert_str_eq(s, "[\"one\",\"two\"]"); 7876 free(s); 7877 terminateO(r); 7878 // delimiter on the edge 7879 setValO(self, "/one"); 7880 r = splitO(self, "/"); 7881 ck_assert_ptr_ne(r, null); 7882 s = toStringO(r); 7883 ck_assert_str_eq(s, "[\"\",\"one\"]"); 7884 free(s); 7885 terminateO(r); 7886 setValO(self, "one/"); 7887 r = splitO(self, "/"); 7888 ck_assert_ptr_ne(r, null); 7889 s = toStringO(r); 7890 ck_assert_str_eq(s, "[\"one\",\"\"]"); 7891 free(s); 7892 terminateO(r); 7893 // delimiter not found 7894 setValO(self, "one/two"); 7895 r = splitO(self, "||"); 7896 ck_assert_ptr_ne(r, null); 7897 s = toStringO(r); 7898 ck_assert_str_eq(s, "[\"one/two\"]"); 7899 free(s); 7900 terminateO(r); 7901 // split with several delimiters after each other 7902 setValO(self, "one/two three "); 7903 r = splitO(self, " "); 7904 ck_assert_ptr_ne(r, null); 7905 s = toStringO(r); 7906 ck_assert_str_eq(s, "[\"one/two\",\"\",\"three\",\"\"]"); 7907 free(s); 7908 terminateO(r); 7909 // multiple character delimiter 7910 setValO(self, "AAe three extract"); 7911 r = splitO(self, "e "); 7912 ck_assert_ptr_ne(r, null); 7913 s = toStringO(r); 7914 ck_assert_str_eq(s, "[\"AA\",\"thre\",\"extract\"]"); 7915 free(s); 7916 terminateO(r); 7917 // empty delimiter 7918 setValO(self, "AAd"); 7919 r = splitO(self, ""); 7920 ck_assert_ptr_ne(r, null); 7921 s = toStringO(r); 7922 ck_assert_str_eq(s, "[\"AAd\"]"); 7923 free(s); 7924 terminateO(r); 7925 // empty string 7926 emptyO(self); 7927 r = splitO(self, "$"); 7928 ck_assert_ptr_ne(r, null); 7929 s = toStringO(r); 7930 ck_assert_str_eq(s, "[\"\"]"); 7931 free(s); 7932 terminateO(r); 7933 // NULL list 7934 freeO(self); 7935 ck_assert_ptr_eq(splitO(self, ";"), NULL); 7936 // NULL delimiter 7937 setValO(self, "test"); 7938 ck_assert_ptr_eq(splitO(self, NULL), NULL); 7939 terminateO(self); 7940 7941 } 7942 7943 7944 void splitCharSmallStringT(void) { 7945 7946 smallArrayt* r; 7947 smallStringt *self = allocG(""); 7948 7949 // string 7950 setValO(self, "one/two"); 7951 r = splitCharO(self, '/'); 7952 ck_assert_ptr_ne(r, null); 7953 char *s = toStringO(r); 7954 ck_assert_str_eq(s, "[\"one\",\"two\"]"); 7955 free(s); 7956 terminateO(r); 7957 // delimiter on the edge 7958 setValO(self, "/one"); 7959 r = splitCharO(self, '/'); 7960 ck_assert_ptr_ne(r, null); 7961 s = toStringO(r); 7962 ck_assert_str_eq(s, "[\"\",\"one\"]"); 7963 free(s); 7964 terminateO(r); 7965 setValO(self, "one/"); 7966 r = splitCharO(self, '/'); 7967 ck_assert_ptr_ne(r, null); 7968 s = toStringO(r); 7969 ck_assert_str_eq(s, "[\"one\",\"\"]"); 7970 free(s); 7971 terminateO(r); 7972 // delimiter not found 7973 setValO(self, "one/two"); 7974 r = splitCharO(self, '|'); 7975 ck_assert_ptr_ne(r, null); 7976 s = toStringO(r); 7977 ck_assert_str_eq(s, "[\"one/two\"]"); 7978 free(s); 7979 terminateO(r); 7980 // split with several delimiters after each other 7981 setValO(self, "one/two three "); 7982 r = splitCharO(self, ' '); 7983 ck_assert_ptr_ne(r, null); 7984 s = toStringO(r); 7985 ck_assert_str_eq(s, "[\"one/two\",\"\",\"three\",\"\"]"); 7986 free(s); 7987 terminateO(r); 7988 // empty string 7989 emptyO(self); 7990 r = splitCharO(self, '$'); 7991 ck_assert_ptr_ne(r, null); 7992 s = toStringO(r); 7993 ck_assert_str_eq(s, "[\"\"]"); 7994 free(s); 7995 terminateO(r); 7996 // NULL list 7997 freeO(self); 7998 ck_assert_ptr_eq(splitCharO(self, ';'), NULL); 7999 terminateO(self); 8000 8001 } 8002 8003 8004 void splitSmallJsonSmallStringT(void) { 8005 8006 smallArrayt* r; 8007 smallStringt *self = allocG(""); 8008 smallJsont *delim = allocSmallJson(); 8009 8010 // string 8011 setValO(self, "one/two"); 8012 setTopSO(delim, "/"); 8013 r = self->f->splitSmallJson(self, delim); 8014 ck_assert_ptr_ne(r, null); 8015 char *s = toStringO(r); 8016 ck_assert_str_eq(s, "[\"one\",\"two\"]"); 8017 free(s); 8018 terminateO(r); 8019 // delimiter on the edge 8020 setValO(self, "/one"); 8021 r = self->f->splitSmallJson(self, delim); 8022 ck_assert_ptr_ne(r, null); 8023 s = toStringO(r); 8024 ck_assert_str_eq(s, "[\"\",\"one\"]"); 8025 free(s); 8026 terminateO(r); 8027 setValO(self, "one/"); 8028 r = self->f->splitSmallJson(self, delim); 8029 ck_assert_ptr_ne(r, null); 8030 s = toStringO(r); 8031 ck_assert_str_eq(s, "[\"one\",\"\"]"); 8032 free(s); 8033 terminateO(r); 8034 // delimiter not found 8035 setValO(self, "one/two"); 8036 freeO(delim); 8037 setTopSO(delim, "||"); 8038 r = self->f->splitSmallJson(self, delim); 8039 ck_assert_ptr_ne(r, null); 8040 s = toStringO(r); 8041 ck_assert_str_eq(s, "[\"one/two\"]"); 8042 free(s); 8043 terminateO(r); 8044 // split with several delimiters after each other 8045 setValO(self, "one/two three "); 8046 freeO(delim); 8047 setTopSO(delim, " "); 8048 r = self->f->splitSmallJson(self, delim); 8049 ck_assert_ptr_ne(r, null); 8050 s = toStringO(r); 8051 ck_assert_str_eq(s, "[\"one/two\",\"\",\"three\",\"\"]"); 8052 free(s); 8053 terminateO(r); 8054 // multiple character delimiter 8055 setValO(self, "AAe three extract"); 8056 freeO(delim); 8057 setTopSO(delim, "e "); 8058 r = self->f->splitSmallJson(self, delim); 8059 ck_assert_ptr_ne(r, null); 8060 s = toStringO(r); 8061 ck_assert_str_eq(s, "[\"AA\",\"thre\",\"extract\"]"); 8062 free(s); 8063 terminateO(r); 8064 // empty delimiter 8065 setValO(self, "AAd"); 8066 freeO(delim); 8067 setTopSO(delim, ""); 8068 r = self->f->splitSmallJson(self, delim); 8069 ck_assert_ptr_ne(r, null); 8070 s = toStringO(r); 8071 ck_assert_str_eq(s, "[\"AAd\"]"); 8072 free(s); 8073 terminateO(r); 8074 // empty string 8075 emptyO(self); 8076 freeO(delim); 8077 setTopSO(delim, "$"); 8078 r = self->f->splitSmallJson(self, delim); 8079 ck_assert_ptr_ne(r, null); 8080 s = toStringO(r); 8081 ck_assert_str_eq(s, "[\"\"]"); 8082 free(s); 8083 terminateO(r); 8084 // non json string delimiter 8085 freeO(delim); 8086 ck_assert_ptr_eq(self->f->splitSmallJson(self, delim), NULL); 8087 // non json object delimiter 8088 terminateO(delim); 8089 delim = (smallJsont*) allocSmallInt(1); 8090 ck_assert_ptr_eq(self->f->splitSmallJson(self, delim), NULL); 8091 terminateO(delim); 8092 delim = allocSmallJson(); 8093 // NULL list 8094 freeO(self); 8095 freeO(delim); 8096 setTopSO(delim, ";"); 8097 ck_assert_ptr_eq(self->f->splitSmallJson(self, delim), NULL); 8098 // NULL delimiter 8099 setValO(self, "test"); 8100 ck_assert_ptr_eq(self->f->splitSmallJson(self, NULL), NULL); 8101 terminateO(delim); 8102 terminateO(self); 8103 8104 } 8105 8106 8107 void splitSmallStringSmallStringT(void) { 8108 8109 smallArrayt* r; 8110 smallStringt *self = allocG(""); 8111 smallStringt *delim = allocSmallString("/"); 8112 8113 // string 8114 setValO(self, "one/two"); 8115 r = self->f->splitSmallString(self, delim); 8116 ck_assert_ptr_ne(r, null); 8117 char *s = toStringO(r); 8118 ck_assert_str_eq(s, "[\"one\",\"two\"]"); 8119 free(s); 8120 terminateO(r); 8121 // delimiter on the edge 8122 setValO(self, "/one"); 8123 r = self->f->splitSmallString(self, delim); 8124 ck_assert_ptr_ne(r, null); 8125 s = toStringO(r); 8126 ck_assert_str_eq(s, "[\"\",\"one\"]"); 8127 free(s); 8128 terminateO(r); 8129 setValO(self, "one/"); 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\",\"\"]"); 8134 free(s); 8135 terminateO(r); 8136 // delimiter not found 8137 setValO(self, "one/two"); 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\"]"); 8143 free(s); 8144 terminateO(r); 8145 // split with several delimiters after each other 8146 setValO(self, "one/two three "); 8147 setValO(delim, " "); 8148 r = self->f->splitSmallString(self, delim); 8149 ck_assert_ptr_ne(r, null); 8150 s = toStringO(r); 8151 ck_assert_str_eq(s, "[\"one/two\",\"\",\"three\",\"\"]"); 8152 free(s); 8153 terminateO(r); 8154 // multiple character delimiter 8155 setValO(self, "AAe three extract"); 8156 setValO(delim, "e "); 8157 r = self->f->splitSmallString(self, delim); 8158 ck_assert_ptr_ne(r, null); 8159 s = toStringO(r); 8160 ck_assert_str_eq(s, "[\"AA\",\"thre\",\"extract\"]"); 8161 free(s); 8162 terminateO(r); 8163 // empty delimiter 8164 setValO(self, "AAd"); 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, "[\"AAd\"]"); 8170 free(s); 8171 terminateO(r); 8172 // empty string 8173 emptyO(self); 8174 setValO(delim, "$"); 8175 r = self->f->splitSmallString(self, delim); 8176 ck_assert_ptr_ne(r, null); 8177 s = toStringO(r); 8178 ck_assert_str_eq(s, "[\"\"]"); 8179 free(s); 8180 terminateO(r); 8181 // null string delimiter 8182 freeO(delim); 8183 ck_assert_ptr_eq(self->f->splitSmallString(self, delim), NULL); 8184 // non json object delimiter 8185 terminateO(delim); 8186 delim = (smallStringt*) allocSmallInt(1); 8187 ck_assert_ptr_eq(self->f->splitSmallString(self, delim), NULL); 8188 terminateO(delim); 8189 // NULL list 8190 freeO(self); 8191 delim = allocSmallString(";"); 8192 ck_assert_ptr_eq(self->f->splitSmallString(self, delim), NULL); 8193 // NULL delimiter 8194 setValO(self, "test"); 8195 ck_assert_ptr_eq(self->f->splitSmallString(self, NULL), NULL); 8196 terminateO(delim); 8197 terminateO(self); 8198 8199 } 8200 8201 8202 void splitSSmallStringT(void) { 8203 8204 char** r; 8205 smallStringt *self = allocG(""); 8206 8207 // string 8208 setValO(self, "one/two"); 8209 r = splitSO(self, "/"); 8210 ck_assert_uint_eq(listLengthS(r),2); 8211 ck_assert_str_eq(r[0], "one"); 8212 ck_assert_str_eq(r[1], "two"); 8213 listFreeS(r); 8214 // delimiter on the edge 8215 setValO(self, "/one"); 8216 r = splitSO(self, "/"); 8217 ck_assert_uint_eq(listLengthS(r),2); 8218 ck_assert_str_eq(r[0], ""); 8219 ck_assert_str_eq(r[1], "one"); 8220 listFreeS(r); 8221 setValO(self, "one/"); 8222 r = splitSO(self, "/"); 8223 ck_assert_uint_eq(listLengthS(r),2); 8224 ck_assert_str_eq(r[0], "one"); 8225 ck_assert_str_eq(r[1], ""); 8226 listFreeS(r); 8227 // delimiter not found 8228 setValO(self, "one/two"); 8229 r = splitSO(self, "||"); 8230 ck_assert_uint_eq(listLengthS(r),1); 8231 ck_assert_str_eq(r[0], "one/two"); 8232 listFreeS(r); 8233 // split with several delimiters after each other 8234 setValO(self, "one/two three "); 8235 r = splitSO(self, " "); 8236 ck_assert_uint_eq(listLengthS(r),4); 8237 ck_assert_str_eq(r[0], "one/two"); 8238 ck_assert_str_eq(r[1], ""); 8239 ck_assert_str_eq(r[2], "three"); 8240 ck_assert_str_eq(r[3], ""); 8241 listFreeS(r); 8242 // multiple character delimiter 8243 setValO(self, "AAe three extract"); 8244 r = splitSO(self, "e "); 8245 ck_assert_uint_eq(listLengthS(r),3); 8246 ck_assert_str_eq(r[0], "AA"); 8247 ck_assert_str_eq(r[1], "thre"); 8248 ck_assert_str_eq(r[2], "extract"); 8249 listFreeS(r); 8250 // empty delimiter 8251 setValO(self, "AAd"); 8252 r = splitSO(self, ""); 8253 ck_assert_uint_eq(listLengthS(r),1); 8254 ck_assert_str_eq(r[0], "AAd"); 8255 listFreeS(r); 8256 // empty string 8257 emptyO(self); 8258 r = splitSO(self, "$"); 8259 ck_assert_uint_eq(listLengthS(r),1); 8260 ck_assert_str_eq(r[0], ""); 8261 listFreeS(r); 8262 // NULL list 8263 freeO(self); 8264 ck_assert_ptr_eq(splitSO(self, ";"), NULL); 8265 // NULL delimiter 8266 setValO(self, "test"); 8267 ck_assert_ptr_eq(splitSO(self, NULL), NULL); 8268 terminateO(self); 8269 8270 } 8271 8272 8273 void splitCharSSmallStringT(void) { 8274 8275 char** r; 8276 smallStringt *self = allocG(""); 8277 8278 // string 8279 setValO(self, "one/two"); 8280 r = splitCharSO(self, '/'); 8281 ck_assert_uint_eq(listLengthS(r),2); 8282 ck_assert_str_eq(r[0], "one"); 8283 ck_assert_str_eq(r[1], "two"); 8284 listFreeS(r); 8285 // delimiter on the edge 8286 setValO(self, "/one"); 8287 r = splitCharSO(self, '/'); 8288 ck_assert_uint_eq(listLengthS(r),2); 8289 ck_assert_str_eq(r[0], ""); 8290 ck_assert_str_eq(r[1], "one"); 8291 listFreeS(r); 8292 setValO(self, "one/"); 8293 r = splitCharSO(self, '/'); 8294 ck_assert_uint_eq(listLengthS(r),2); 8295 ck_assert_str_eq(r[0], "one"); 8296 ck_assert_str_eq(r[1], ""); 8297 listFreeS(r); 8298 // delimiter not found 8299 setValO(self, "one/two"); 8300 r = splitCharSO(self, '|'); 8301 ck_assert_uint_eq(listLengthS(r),1); 8302 ck_assert_str_eq(r[0], "one/two"); 8303 listFreeS(r); 8304 // split with several delimiters after each other 8305 setValO(self, "one/two three "); 8306 r = splitCharSO(self, ' '); 8307 ck_assert_uint_eq(listLengthS(r),4); 8308 ck_assert_str_eq(r[0], "one/two"); 8309 ck_assert_str_eq(r[1], ""); 8310 ck_assert_str_eq(r[2], "three"); 8311 ck_assert_str_eq(r[3], ""); 8312 listFreeS(r); 8313 // empty string 8314 emptyO(self); 8315 r = splitCharSO(self, '$'); 8316 ck_assert_uint_eq(listLengthS(r),1); 8317 ck_assert_str_eq(r[0], ""); 8318 listFreeS(r); 8319 // NULL list 8320 freeO(self); 8321 ck_assert_ptr_eq(splitCharSO(self, ';'), NULL); 8322 terminateO(self); 8323 8324 } 8325 8326 8327 void splitSmallJsonSSmallStringT(void) { 8328 8329 char** r; 8330 smallStringt *self = allocG(""); 8331 smallJsont *delim = allocSmallJson(); 8332 8333 // string 8334 setValO(self, "one/two"); 8335 setTopSO(delim, "/"); 8336 r = splitSmallJsonSO(self, delim); 8337 ck_assert_uint_eq(listLengthS(r),2); 8338 ck_assert_str_eq(r[0], "one"); 8339 ck_assert_str_eq(r[1], "two"); 8340 listFreeS(r); 8341 // delimiter on the edge 8342 setValO(self, "/one"); 8343 r = splitSmallJsonSO(self, delim); 8344 ck_assert_uint_eq(listLengthS(r),2); 8345 ck_assert_str_eq(r[0], ""); 8346 ck_assert_str_eq(r[1], "one"); 8347 listFreeS(r); 8348 setValO(self, "one/"); 8349 r = splitSmallJsonSO(self, delim); 8350 ck_assert_uint_eq(listLengthS(r),2); 8351 ck_assert_str_eq(r[0], "one"); 8352 ck_assert_str_eq(r[1], ""); 8353 listFreeS(r); 8354 // delimiter not found 8355 setValO(self, "one/two"); 8356 freeO(delim); 8357 setTopSO(delim, "||"); 8358 r = splitSmallJsonSO(self, delim); 8359 ck_assert_uint_eq(listLengthS(r),1); 8360 ck_assert_str_eq(r[0], "one/two"); 8361 listFreeS(r); 8362 // split with several delimiters after each other 8363 setValO(self, "one/two three "); 8364 freeO(delim); 8365 setTopSO(delim, " "); 8366 r = splitSmallJsonSO(self, delim); 8367 ck_assert_uint_eq(listLengthS(r),4); 8368 ck_assert_str_eq(r[0], "one/two"); 8369 ck_assert_str_eq(r[1], ""); 8370 ck_assert_str_eq(r[2], "three"); 8371 ck_assert_str_eq(r[3], ""); 8372 listFreeS(r); 8373 // multiple character delimiter 8374 setValO(self, "AAe three extract"); 8375 freeO(delim); 8376 setTopSO(delim, "e "); 8377 r = splitSmallJsonSO(self, delim); 8378 ck_assert_uint_eq(listLengthS(r),3); 8379 ck_assert_str_eq(r[0], "AA"); 8380 ck_assert_str_eq(r[1], "thre"); 8381 ck_assert_str_eq(r[2], "extract"); 8382 listFreeS(r); 8383 // empty delimiter 8384 setValO(self, "AAd"); 8385 freeO(delim); 8386 setTopSO(delim, ""); 8387 r = splitSmallJsonSO(self, delim); 8388 ck_assert_uint_eq(listLengthS(r),1); 8389 ck_assert_str_eq(r[0], "AAd"); 8390 listFreeS(r); 8391 // empty string 8392 emptyO(self); 8393 freeO(delim); 8394 setTopSO(delim, "$"); 8395 r = splitSmallJsonSO(self, delim); 8396 ck_assert_uint_eq(listLengthS(r),1); 8397 ck_assert_str_eq(r[0], ""); 8398 listFreeS(r); 8399 // non json string delimiter 8400 freeO(delim); 8401 ck_assert_ptr_eq(splitSmallJsonSO(self, delim), NULL); 8402 // non json object delimiter 8403 terminateO(delim); 8404 delim = (smallJsont*) allocSmallInt(1); 8405 ck_assert_ptr_eq(splitSmallJsonSO(self, delim), NULL); 8406 terminateO(delim); 8407 delim = allocSmallJson(); 8408 // NULL list 8409 freeO(self); 8410 freeO(delim); 8411 setTopSO(delim, ";"); 8412 ck_assert_ptr_eq(splitSmallJsonSO(self, delim), NULL); 8413 // NULL delimiter 8414 setValO(self, "test"); 8415 ck_assert_ptr_eq(splitSmallJsonSO(self, NULL), NULL); 8416 terminateO(delim); 8417 terminateO(self); 8418 8419 } 8420 8421 8422 void splitSmallStringSSmallStringT(void) { 8423 8424 char** r; 8425 smallStringt *self = allocG(""); 8426 smallStringt *delim = allocSmallString("/"); 8427 8428 // string 8429 setValO(self, "one/two"); 8430 r = splitSmallStringSO(self, delim); 8431 ck_assert_uint_eq(listLengthS(r),2); 8432 ck_assert_str_eq(r[0], "one"); 8433 ck_assert_str_eq(r[1], "two"); 8434 listFreeS(r); 8435 // delimiter on the edge 8436 setValO(self, "/one"); 8437 r = splitSmallStringSO(self, delim); 8438 ck_assert_uint_eq(listLengthS(r),2); 8439 ck_assert_str_eq(r[0], ""); 8440 ck_assert_str_eq(r[1], "one"); 8441 listFreeS(r); 8442 setValO(self, "one/"); 8443 r = splitSmallStringSO(self, delim); 8444 ck_assert_uint_eq(listLengthS(r),2); 8445 ck_assert_str_eq(r[0], "one"); 8446 ck_assert_str_eq(r[1], ""); 8447 listFreeS(r); 8448 // delimiter not found 8449 setValO(self, "one/two"); 8450 setValO(delim, "||"); 8451 r = splitSmallStringSO(self, delim); 8452 ck_assert_uint_eq(listLengthS(r),1); 8453 ck_assert_str_eq(r[0], "one/two"); 8454 listFreeS(r); 8455 // split with several delimiters after each other 8456 setValO(self, "one/two three "); 8457 setValO(delim, " "); 8458 r = splitSmallStringSO(self, delim); 8459 ck_assert_uint_eq(listLengthS(r),4); 8460 ck_assert_str_eq(r[0], "one/two"); 8461 ck_assert_str_eq(r[1], ""); 8462 ck_assert_str_eq(r[2], "three"); 8463 ck_assert_str_eq(r[3], ""); 8464 listFreeS(r); 8465 // multiple character delimiter 8466 setValO(self, "AAe three extract"); 8467 setValO(delim, "e "); 8468 r = splitSmallStringSO(self, delim); 8469 ck_assert_uint_eq(listLengthS(r),3); 8470 ck_assert_str_eq(r[0], "AA"); 8471 ck_assert_str_eq(r[1], "thre"); 8472 ck_assert_str_eq(r[2], "extract"); 8473 listFreeS(r); 8474 // empty delimiter 8475 setValO(self, "AAd"); 8476 setValO(delim, ""); 8477 r = splitSmallStringSO(self, delim); 8478 ck_assert_uint_eq(listLengthS(r),1); 8479 ck_assert_str_eq(r[0], "AAd"); 8480 listFreeS(r); 8481 // empty string 8482 emptyO(self); 8483 setValO(delim, "$"); 8484 r = splitSmallStringSO(self, delim); 8485 ck_assert_uint_eq(listLengthS(r),1); 8486 ck_assert_str_eq(r[0], ""); 8487 listFreeS(r); 8488 // non smallString object delimiter 8489 terminateO(delim); 8490 delim = (smallStringt*) allocSmallInt(1); 8491 ck_assert_ptr_eq(splitSmallStringSO(self, delim), NULL); 8492 terminateO(delim); 8493 // NULL list 8494 freeO(self); 8495 delim = allocSmallString(";"); 8496 ck_assert_ptr_eq(splitSmallStringSO(self, delim), NULL); 8497 // NULL delimiter 8498 setValO(self, "test"); 8499 ck_assert_ptr_eq(splitSmallStringSO(self, NULL), NULL); 8500 terminateO(delim); 8501 terminateO(self); 8502 8503 } 8504 8505 8506 void extractSmallStringT(void) { 8507 8508 smallArrayt* r; 8509 smallStringt *self = allocG(""); 8510 8511 // string 8512 setValO(self, "one/two|"); 8513 r = extractO(self, "/", "|"); 8514 ck_assert_ptr_ne(r, null); 8515 char *s = toStringO(r); 8516 ck_assert_str_eq(s, "[\"two\"]"); 8517 free(s); 8518 terminateO(r); 8519 // delimiter not found 8520 setValO(self, "one/two"); 8521 r = extractO(self, "||", "/"); 8522 ck_assert_ptr_eq(r, NULL); 8523 // extractO with several delimiters after each other 8524 setValO(self, "one/ two /three "); 8525 r = extractO(self, "/", " "); 8526 ck_assert_ptr_ne(r, null); 8527 s = toStringO(r); 8528 ck_assert_str_eq(s, "[\"\",\"three\"]"); 8529 free(s); 8530 terminateO(r); 8531 // multiple character delimiter 8532 setValO(self, "AAe thre|e extract"); 8533 r = extractO(self, "e ", "|"); 8534 ck_assert_ptr_ne(r, null); 8535 s = toStringO(r); 8536 ck_assert_str_eq(s, "[\"thre\"]"); 8537 free(s); 8538 terminateO(r); 8539 // empty delimiter 8540 setValO(self, "AAd"); 8541 r = extractO(self, "", "Ad"); 8542 ck_assert_ptr_eq(r, NULL); 8543 setValO(self, "AAd"); 8544 r = extractO(self, "A", ""); 8545 ck_assert_ptr_eq(r, NULL); 8546 // empty string 8547 setValO(self, ""); 8548 r = extractO(self, "$", "#"); 8549 ck_assert_ptr_eq(r, NULL); 8550 // delim1 = delim2 8551 setValO(self, ""); 8552 r = extractO(self, "$", "$"); 8553 ck_assert_ptr_eq(r, NULL); 8554 // NULL string 8555 freeO(self); 8556 ck_assert_ptr_eq(extractO(self, ";", ","), NULL); 8557 // NULL delimiter 8558 setValO(self, "test"); 8559 ck_assert_ptr_eq(extractO(self, NULL, ","), NULL); 8560 ck_assert_ptr_eq(extractO(self, ",", NULL), NULL); 8561 terminateO(self); 8562 8563 } 8564 8565 8566 void extractCharSSmallStringT(void) { 8567 8568 smallArrayt* r; 8569 smallStringt *self = allocG(""); 8570 8571 // string 8572 setValO(self, "one/two|"); 8573 r = extractCharSO(self, '/', "|"); 8574 ck_assert_ptr_ne(r, null); 8575 char *s = toStringO(r); 8576 ck_assert_str_eq(s, "[\"two\"]"); 8577 free(s); 8578 terminateO(r); 8579 // delimiter not found 8580 setValO(self, "one/two"); 8581 r = extractCharSO(self, '|', "/"); 8582 ck_assert_ptr_eq(r, NULL); 8583 // extractCharSO with several delimiters after each other 8584 setValO(self, "one/ two /three "); 8585 r = extractCharSO(self, '/', " "); 8586 ck_assert_ptr_ne(r, null); 8587 s = toStringO(r); 8588 ck_assert_str_eq(s, "[\"\",\"three\"]"); 8589 free(s); 8590 terminateO(r); 8591 // multiple character delimiter 8592 setValO(self, "AAe thre|e extract"); 8593 r = extractCharSO(self, ' ', "|e"); 8594 ck_assert_ptr_ne(r, null); 8595 s = toStringO(r); 8596 ck_assert_str_eq(s, "[\"thre\"]"); 8597 free(s); 8598 terminateO(r); 8599 // empty delimiter 8600 setValO(self, "AAd"); 8601 r = extractCharSO(self, 'A', ""); 8602 ck_assert_ptr_eq(r, NULL); 8603 // empty string 8604 setValO(self, ""); 8605 r = extractCharSO(self, '$', "#"); 8606 ck_assert_ptr_eq(r, NULL); 8607 // delim1 = delim2 8608 setValO(self, ""); 8609 r = extractCharSO(self, '$', "$"); 8610 ck_assert_ptr_eq(r, NULL); 8611 // NULL string 8612 freeO(self); 8613 ck_assert_ptr_eq(extractCharSO(self, ';', ","), NULL); 8614 // NULL delimiter 8615 setValO(self, "test"); 8616 ck_assert_ptr_eq(extractCharSO(self, ',', NULL), NULL); 8617 terminateO(self); 8618 8619 } 8620 8621 8622 void extractSCharSmallStringT(void) { 8623 8624 smallArrayt* r; 8625 smallStringt *self = allocG(""); 8626 8627 // string 8628 setValO(self, "one/two|"); 8629 r = extractSCharO(self, "/", '|'); 8630 ck_assert_ptr_ne(r, null); 8631 char *s = toStringO(r); 8632 ck_assert_str_eq(s, "[\"two\"]"); 8633 free(s); 8634 terminateO(r); 8635 // delimiter not found 8636 setValO(self, "one/two"); 8637 r = extractSCharO(self, "||", '/'); 8638 ck_assert_ptr_eq(r, NULL); 8639 // extractSCharO with several delimiters after each other 8640 setValO(self, "one/ two /three "); 8641 r = extractSCharO(self, "/", ' '); 8642 ck_assert_ptr_ne(r, null); 8643 s = toStringO(r); 8644 ck_assert_str_eq(s, "[\"\",\"three\"]"); 8645 free(s); 8646 terminateO(r); 8647 // multiple character delimiter 8648 setValO(self, "AAe thre|e extract"); 8649 r = extractSCharO(self, "e ", '|'); 8650 ck_assert_ptr_ne(r, null); 8651 s = toStringO(r); 8652 ck_assert_str_eq(s, "[\"thre\"]"); 8653 free(s); 8654 terminateO(r); 8655 // empty delimiter 8656 setValO(self, "AAd"); 8657 r = extractSCharO(self, "", 'A'); 8658 ck_assert_ptr_eq(r, NULL); 8659 // empty string 8660 setValO(self, ""); 8661 r = extractSCharO(self, "$", '#'); 8662 ck_assert_ptr_eq(r, NULL); 8663 // delim1 = delim2 8664 setValO(self, ""); 8665 r = extractSCharO(self, "$", '$'); 8666 ck_assert_ptr_eq(r, NULL); 8667 // NULL string 8668 freeO(self); 8669 ck_assert_ptr_eq(extractSCharO(self, ";", ','), NULL); 8670 // NULL delimiter 8671 setValO(self, "test"); 8672 ck_assert_ptr_eq(extractSCharO(self, NULL, ','), NULL); 8673 terminateO(self); 8674 8675 } 8676 8677 8678 void extractCharCharSmallStringT(void) { 8679 8680 smallArrayt* r; 8681 smallStringt *self = allocG(""); 8682 8683 // string 8684 setValO(self, "one/two|"); 8685 r = extractCharCharO(self, '/', '|'); 8686 ck_assert_ptr_ne(r, null); 8687 char *s = toStringO(r); 8688 ck_assert_str_eq(s, "[\"two\"]"); 8689 free(s); 8690 terminateO(r); 8691 // delimiter not found 8692 setValO(self, "one/two"); 8693 r = extractCharCharO(self, '|', '/'); 8694 ck_assert_ptr_eq(r, NULL); 8695 // extractCharCharO with several delimiters after each other 8696 setValO(self, "one/ two /three "); 8697 r = extractCharCharO(self, '/', ' '); 8698 ck_assert_ptr_ne(r, null); 8699 s = toStringO(r); 8700 ck_assert_str_eq(s, "[\"\",\"three\"]"); 8701 free(s); 8702 terminateO(r); 8703 // multiple character delimiter 8704 setValO(self, "AAe thre|e extract"); 8705 r = extractCharCharO(self, ' ', '|'); 8706 ck_assert_ptr_ne(r, null); 8707 s = toStringO(r); 8708 ck_assert_str_eq(s, "[\"thre\"]"); 8709 free(s); 8710 terminateO(r); 8711 // empty string 8712 setValO(self, ""); 8713 r = extractCharCharO(self, '$', '#'); 8714 ck_assert_ptr_eq(r, NULL); 8715 // delim1 = delim2 8716 setValO(self, ""); 8717 r = extractCharCharO(self, '$', '$'); 8718 ck_assert_ptr_eq(r, NULL); 8719 // NULL string 8720 freeO(self); 8721 ck_assert_ptr_eq(extractCharCharO(self, ';', ','), NULL); 8722 terminateO(self); 8723 8724 } 8725 8726 8727 void extractSmallJsonSmallJsonSmallStringT(void) { 8728 8729 smallArrayt* r; 8730 smallStringt *self = allocG(""); 8731 smallJsont* delim1 = allocSmallJson(); 8732 smallJsont* delim2 = allocSmallJson(); 8733 8734 // string 8735 setValO(self, "one/two|"); 8736 setTopSO(delim1, "/"); 8737 setTopSO(delim2, "|"); 8738 r = extractSmallJsonSmallJsonO(self, delim1, delim2); 8739 ck_assert_ptr_ne(r, null); 8740 char *s = toStringO(r); 8741 ck_assert_str_eq(s, "[\"two\"]"); 8742 free(s); 8743 terminateO(r); 8744 // delimiter not found 8745 setValO(self, "one/two"); 8746 freeO(delim1); 8747 freeO(delim2); 8748 setTopSO(delim1, "||"); 8749 setTopSO(delim2, "/"); 8750 r = extractSmallJsonSmallJsonO(self, delim1, delim2); 8751 ck_assert_ptr_eq(r, NULL); 8752 // extractSmallJsonSmallJsonO with several delimiters after each other 8753 setValO(self, "one/ two /three "); 8754 freeO(delim1); 8755 freeO(delim2); 8756 setTopSO(delim1, "/"); 8757 setTopSO(delim2, " "); 8758 r = extractSmallJsonSmallJsonO(self, delim1, delim2); 8759 ck_assert_ptr_ne(r, null); 8760 s = toStringO(r); 8761 ck_assert_str_eq(s, "[\"\",\"three\"]"); 8762 free(s); 8763 terminateO(r); 8764 // multiple character delimiter 8765 setValO(self, "AAe thre|e extract"); 8766 freeO(delim1); 8767 freeO(delim2); 8768 setTopSO(delim1, "e "); 8769 setTopSO(delim2, "|"); 8770 r = extractSmallJsonSmallJsonO(self, delim1, delim2); 8771 ck_assert_ptr_ne(r, null); 8772 s = toStringO(r); 8773 ck_assert_str_eq(s, "[\"thre\"]"); 8774 free(s); 8775 terminateO(r); 8776 // empty delimiter 8777 setValO(self, "AAd"); 8778 freeO(delim1); 8779 freeO(delim2); 8780 setTopSO(delim1, ""); 8781 setTopSO(delim2, "Ad"); 8782 r = extractSmallJsonSmallJsonO(self, delim1, delim2); 8783 ck_assert_ptr_eq(r, NULL); 8784 setValO(self, "AAd"); 8785 freeO(delim1); 8786 freeO(delim2); 8787 setTopSO(delim1, "A"); 8788 setTopSO(delim2, ""); 8789 r = extractSmallJsonSmallJsonO(self, delim1, delim2); 8790 ck_assert_ptr_eq(r, NULL); 8791 // empty string 8792 setValO(self, ""); 8793 freeO(delim1); 8794 freeO(delim2); 8795 setTopSO(delim1, "$"); 8796 setTopSO(delim2, "#"); 8797 r = extractSmallJsonSmallJsonO(self, delim1, delim2); 8798 ck_assert_ptr_eq(r, NULL); 8799 // delim1 = delim2 8800 setValO(self, "$qwe$"); 8801 freeO(delim1); 8802 freeO(delim2); 8803 setTopSO(delim1, "$"); 8804 setTopSO(delim2, "$"); 8805 r = extractSmallJsonSmallJsonO(self, delim1, delim2); 8806 ck_assert_ptr_eq(r, NULL); 8807 // non json string 8808 freeO(delim1); 8809 r = extractSmallJsonSmallJsonO(self, delim1, delim2); 8810 ck_assert_ptr_eq(r, NULL); 8811 setTopSO(delim1, "$"); 8812 freeO(delim2); 8813 r = extractSmallJsonSmallJsonO(self, delim1, delim2); 8814 ck_assert_ptr_eq(r, NULL); 8815 // non json object 8816 terminateO(delim1); 8817 delim1 = (smallJsont*) allocSmallInt(1); 8818 setTopSO(delim2, "$"); 8819 r = extractSmallJsonSmallJsonO(self, delim1, delim2); 8820 ck_assert_ptr_eq(r, NULL); 8821 terminateO(delim1); 8822 delim1 = allocSmallJson(); 8823 setTopSO(delim1, ";"); 8824 terminateO(delim2); 8825 delim2 = (smallJsont*) allocSmallInt(1); 8826 r = extractSmallJsonSmallJsonO(self, delim1, delim2); 8827 ck_assert_ptr_eq(r, NULL); 8828 terminateO(delim2); 8829 delim2 = allocSmallJson(); 8830 // NULL string 8831 freeO(self); 8832 freeO(delim1); 8833 freeO(delim2); 8834 setTopSO(delim1, ";"); 8835 setTopSO(delim2, ","); 8836 ck_assert_ptr_eq(extractSmallJsonSmallJsonO(self, delim1, delim2), NULL); 8837 // NULL delimiter 8838 setValO(self, "test"); 8839 ck_assert_ptr_eq(extractSmallJsonSmallJsonO(self, NULL, delim2), NULL); 8840 ck_assert_ptr_eq(extractSmallJsonSmallJsonO(self, delim1, NULL), NULL); 8841 terminateO(delim1); 8842 terminateO(delim2); 8843 terminateO(self); 8844 8845 } 8846 8847 8848 void extractSmallJsonSmallStringSmallStringT(void) { 8849 8850 smallArrayt* r; 8851 smallStringt *self = allocG(""); 8852 smallJsont* delim1 = allocSmallJson(); 8853 smallStringt* delim2 = allocSmallString("|"); 8854 8855 // string 8856 setValO(self, "one/two|"); 8857 setTopSO(delim1, "/"); 8858 r = extractSmallJsonSmallStringO(self, delim1, delim2); 8859 ck_assert_ptr_ne(r, null); 8860 char *s = toStringO(r); 8861 ck_assert_str_eq(s, "[\"two\"]"); 8862 free(s); 8863 terminateO(r); 8864 // delimiter not found 8865 setValO(self, "one/two"); 8866 freeO(delim1); 8867 setTopSO(delim1, "||"); 8868 setValO(delim2, "/"); 8869 r = extractSmallJsonSmallStringO(self, delim1, delim2); 8870 ck_assert_ptr_eq(r, NULL); 8871 // extractSmallJsonSmallStringO with several delimiters after each other 8872 setValO(self, "one/ two /three "); 8873 freeO(delim1); 8874 setTopSO(delim1, "/"); 8875 setValO(delim2, " "); 8876 r = extractSmallJsonSmallStringO(self, delim1, delim2); 8877 ck_assert_ptr_ne(r, null); 8878 s = toStringO(r); 8879 ck_assert_str_eq(s, "[\"\",\"three\"]"); 8880 free(s); 8881 terminateO(r); 8882 // multiple character delimiter 8883 setValO(self, "AAe thre|e extract"); 8884 freeO(delim1); 8885 setTopSO(delim1, "e "); 8886 setValO(delim2, "|"); 8887 r = extractSmallJsonSmallStringO(self, delim1, delim2); 8888 ck_assert_ptr_ne(r, null); 8889 s = toStringO(r); 8890 ck_assert_str_eq(s, "[\"thre\"]"); 8891 free(s); 8892 terminateO(r); 8893 // empty delimiter 8894 setValO(self, "AAd"); 8895 freeO(delim1); 8896 setTopSO(delim1, ""); 8897 setValO(delim2, "Ad"); 8898 r = extractSmallJsonSmallStringO(self, delim1, delim2); 8899 ck_assert_ptr_eq(r, NULL); 8900 setValO(self, "AAd"); 8901 freeO(delim1); 8902 setTopSO(delim1, "A"); 8903 setValO(delim2, ""); 8904 r = extractSmallJsonSmallStringO(self, delim1, delim2); 8905 ck_assert_ptr_eq(r, NULL); 8906 // empty string 8907 setValO(self, ""); 8908 freeO(delim1); 8909 setTopSO(delim1, "$"); 8910 setValO(delim2, "#"); 8911 r = extractSmallJsonSmallStringO(self, delim1, delim2); 8912 ck_assert_ptr_eq(r, NULL); 8913 // delim1 = delim2 8914 setValO(self, "$qwe$"); 8915 freeO(delim1); 8916 setTopSO(delim1, "$"); 8917 setValO(delim2, "$"); 8918 r = extractSmallJsonSmallStringO(self, delim1, delim2); 8919 ck_assert_ptr_eq(r, NULL); 8920 // non json string 8921 freeO(delim1); 8922 r = extractSmallJsonSmallStringO(self, delim1, delim2); 8923 ck_assert_ptr_eq(r, NULL); 8924 // non json object 8925 terminateO(delim1); 8926 delim1 = (smallJsont*) allocSmallInt(1); 8927 r = extractSmallJsonSmallStringO(self, delim1, delim2); 8928 ck_assert_ptr_eq(r, NULL); 8929 terminateO(delim1); 8930 delim1 = allocSmallJson(); 8931 setTopSO(delim1, ";"); 8932 terminateO(delim2); 8933 delim2 = (smallStringt*) allocSmallInt(1); 8934 r = extractSmallJsonSmallStringO(self, delim1, delim2); 8935 ck_assert_ptr_eq(r, NULL); 8936 terminateO(delim2); 8937 delim2 = allocSmallString(","); 8938 // NULL string 8939 freeO(self); 8940 freeO(delim1); 8941 setTopSO(delim1, ";"); 8942 ck_assert_ptr_eq(extractSmallJsonSmallStringO(self, delim1, delim2), NULL); 8943 // NULL delimiter 8944 setValO(self, "test"); 8945 ck_assert_ptr_eq(extractSmallJsonSmallStringO(self, NULL, delim2), NULL); 8946 ck_assert_ptr_eq(extractSmallJsonSmallStringO(self, delim1, NULL), NULL); 8947 terminateO(delim1); 8948 terminateO(delim2); 8949 terminateO(self); 8950 8951 } 8952 8953 8954 void extractSmallJsonSSmallStringT(void) { 8955 8956 smallArrayt* r; 8957 smallStringt *self = allocG(""); 8958 smallJsont* delim1 = allocSmallJson(); 8959 8960 // string 8961 setValO(self, "one/two|"); 8962 setTopSO(delim1, "/"); 8963 r = extractSmallJsonSO(self, delim1, "|"); 8964 ck_assert_ptr_ne(r, null); 8965 char *s = toStringO(r); 8966 ck_assert_str_eq(s, "[\"two\"]"); 8967 free(s); 8968 terminateO(r); 8969 // delimiter not found 8970 setValO(self, "one/two"); 8971 freeO(delim1); 8972 setTopSO(delim1, "||"); 8973 r = extractSmallJsonSO(self, delim1, "/"); 8974 ck_assert_ptr_eq(r, NULL); 8975 // extractSmallJsonSO with several delimiters after each other 8976 setValO(self, "one/ two /three "); 8977 freeO(delim1); 8978 setTopSO(delim1, "/"); 8979 r = extractSmallJsonSO(self, delim1, " "); 8980 ck_assert_ptr_ne(r, null); 8981 s = toStringO(r); 8982 ck_assert_str_eq(s, "[\"\",\"three\"]"); 8983 free(s); 8984 terminateO(r); 8985 // multiple character delimiter 8986 setValO(self, "AAe thre|e extract"); 8987 freeO(delim1); 8988 setTopSO(delim1, "e "); 8989 r = extractSmallJsonSO(self, delim1, "|"); 8990 ck_assert_ptr_ne(r, null); 8991 s = toStringO(r); 8992 ck_assert_str_eq(s, "[\"thre\"]"); 8993 free(s); 8994 terminateO(r); 8995 // empty delimiter 8996 setValO(self, "AAd"); 8997 freeO(delim1); 8998 setTopSO(delim1, ""); 8999 r = extractSmallJsonSO(self, delim1, "Ad"); 9000 ck_assert_ptr_eq(r, NULL); 9001 setValO(self, "AAd"); 9002 freeO(delim1); 9003 setTopSO(delim1, "A"); 9004 r = extractSmallJsonSO(self, delim1, ""); 9005 ck_assert_ptr_eq(r, NULL); 9006 // empty string 9007 setValO(self, ""); 9008 freeO(delim1); 9009 setTopSO(delim1, "$"); 9010 r = extractSmallJsonSO(self, delim1, "#"); 9011 ck_assert_ptr_eq(r, NULL); 9012 // delim1 = delim2 9013 setValO(self, "$qwe$"); 9014 freeO(delim1); 9015 setTopSO(delim1, "$"); 9016 r = extractSmallJsonSO(self, delim1, "$"); 9017 ck_assert_ptr_eq(r, NULL); 9018 // non json string 9019 freeO(delim1); 9020 r = extractSmallJsonSO(self, delim1, "$"); 9021 ck_assert_ptr_eq(r, NULL); 9022 // non json object 9023 terminateO(delim1); 9024 delim1 = (smallJsont*) allocSmallInt(1); 9025 r = extractSmallJsonSO(self, delim1, "$"); 9026 ck_assert_ptr_eq(r, NULL); 9027 terminateO(delim1); 9028 delim1 = allocSmallJson(); 9029 // NULL string 9030 freeO(self); 9031 freeO(delim1); 9032 setTopSO(delim1, ";"); 9033 ck_assert_ptr_eq(extractSmallJsonSO(self, delim1, ","), NULL); 9034 // NULL delimiter 9035 setValO(self, "test"); 9036 ck_assert_ptr_eq(extractSmallJsonSO(self, NULL, ","), NULL); 9037 ck_assert_ptr_eq(extractSmallJsonSO(self, delim1, NULL), NULL); 9038 terminateO(delim1); 9039 terminateO(self); 9040 9041 } 9042 9043 9044 void extractSmallJsonCharSmallStringT(void) { 9045 9046 smallArrayt* r; 9047 smallStringt *self = allocG(""); 9048 smallJsont* delim1 = allocSmallJson(); 9049 9050 // string 9051 setValO(self, "one/two|"); 9052 setTopSO(delim1, "/"); 9053 r = extractSmallJsonCharO(self, delim1, '|'); 9054 ck_assert_ptr_ne(r, null); 9055 char *s = toStringO(r); 9056 ck_assert_str_eq(s, "[\"two\"]"); 9057 free(s); 9058 terminateO(r); 9059 // delimiter not found 9060 setValO(self, "one/two"); 9061 freeO(delim1); 9062 setTopSO(delim1, "||"); 9063 r = extractSmallJsonCharO(self, delim1, '/'); 9064 ck_assert_ptr_eq(r, NULL); 9065 // extractSmallJsonCharO with several delimiters after each other 9066 setValO(self, "one/ two /three "); 9067 freeO(delim1); 9068 setTopSO(delim1, "/"); 9069 r = extractSmallJsonCharO(self, delim1, ' '); 9070 ck_assert_ptr_ne(r, null); 9071 s = toStringO(r); 9072 ck_assert_str_eq(s, "[\"\",\"three\"]"); 9073 free(s); 9074 terminateO(r); 9075 // multiple character delimiter 9076 setValO(self, "AAe thre|e extract"); 9077 freeO(delim1); 9078 setTopSO(delim1, "e "); 9079 r = extractSmallJsonCharO(self, delim1, '|'); 9080 ck_assert_ptr_ne(r, null); 9081 s = toStringO(r); 9082 ck_assert_str_eq(s, "[\"thre\"]"); 9083 free(s); 9084 terminateO(r); 9085 // empty delimiter 9086 setValO(self, "AAd"); 9087 freeO(delim1); 9088 setTopSO(delim1, ""); 9089 r = extractSmallJsonCharO(self, delim1, 'd'); 9090 ck_assert_ptr_eq(r, NULL); 9091 setValO(self, "AAd"); 9092 // empty string 9093 setValO(self, ""); 9094 freeO(delim1); 9095 setTopSO(delim1, "$"); 9096 r = extractSmallJsonCharO(self, delim1, '#'); 9097 ck_assert_ptr_eq(r, NULL); 9098 // delim1 = delim2 9099 setValO(self, "$qwe$"); 9100 freeO(delim1); 9101 setTopSO(delim1, "$"); 9102 r = extractSmallJsonCharO(self, delim1, '$'); 9103 ck_assert_ptr_eq(r, NULL); 9104 // non json string 9105 freeO(delim1); 9106 r = extractSmallJsonCharO(self, delim1, '$'); 9107 ck_assert_ptr_eq(r, NULL); 9108 // non json object 9109 terminateO(delim1); 9110 delim1 = (smallJsont*) allocSmallInt(1); 9111 r = extractSmallJsonCharO(self, delim1, '$'); 9112 ck_assert_ptr_eq(r, NULL); 9113 terminateO(delim1); 9114 delim1 = allocSmallJson(); 9115 // NULL string 9116 freeO(self); 9117 freeO(delim1); 9118 setTopSO(delim1, ";"); 9119 ck_assert_ptr_eq(extractSmallJsonCharO(self, delim1, ','), NULL); 9120 // NULL delimiter 9121 setValO(self, "test"); 9122 ck_assert_ptr_eq(extractSmallJsonCharO(self, NULL, ','), NULL); 9123 terminateO(delim1); 9124 terminateO(self); 9125 9126 } 9127 9128 9129 void extractSmallStringSmallJsonSmallStringT(void) { 9130 9131 smallArrayt* r; 9132 smallStringt *self = allocG(""); 9133 smallStringt* delim1 = allocSmallString("/"); 9134 smallJsont* delim2 = allocSmallJson(); 9135 9136 // string 9137 setValO(self, "one/two|"); 9138 setTopSO(delim2, "|"); 9139 r = extractSmallStringSmallJsonO(self, delim1, delim2); 9140 ck_assert_ptr_ne(r, null); 9141 char *s = toStringO(r); 9142 ck_assert_str_eq(s, "[\"two\"]"); 9143 free(s); 9144 terminateO(r); 9145 // delimiter not found 9146 setValO(self, "one/two"); 9147 freeO(delim2); 9148 setValO(delim1, "||"); 9149 setTopSO(delim2, "/"); 9150 r = extractSmallStringSmallJsonO(self, delim1, delim2); 9151 ck_assert_ptr_eq(r, NULL); 9152 // extractSmallStringSmallJsonO with several delimiters after each other 9153 setValO(self, "one/ two /three "); 9154 freeO(delim2); 9155 setValO(delim1, "/"); 9156 setTopSO(delim2, " "); 9157 r = extractSmallStringSmallJsonO(self, delim1, delim2); 9158 ck_assert_ptr_ne(r, null); 9159 s = toStringO(r); 9160 ck_assert_str_eq(s, "[\"\",\"three\"]"); 9161 free(s); 9162 terminateO(r); 9163 // multiple character delimiter 9164 setValO(self, "AAe thre|e extract"); 9165 freeO(delim2); 9166 setValO(delim1, "e "); 9167 setTopSO(delim2, "|"); 9168 r = extractSmallStringSmallJsonO(self, delim1, delim2); 9169 ck_assert_ptr_ne(r, null); 9170 s = toStringO(r); 9171 ck_assert_str_eq(s, "[\"thre\"]"); 9172 free(s); 9173 terminateO(r); 9174 // empty delimiter 9175 setValO(self, "AAd"); 9176 freeO(delim2); 9177 setValO(delim1, ""); 9178 setTopSO(delim2, "Ad"); 9179 r = extractSmallStringSmallJsonO(self, delim1, delim2); 9180 ck_assert_ptr_eq(r, NULL); 9181 setValO(self, "AAd"); 9182 freeO(delim2); 9183 setValO(delim1, "A"); 9184 setTopSO(delim2, ""); 9185 r = extractSmallStringSmallJsonO(self, delim1, delim2); 9186 ck_assert_ptr_eq(r, NULL); 9187 // empty string 9188 setValO(self, ""); 9189 freeO(delim2); 9190 setValO(delim1, "$"); 9191 setTopSO(delim2, "#"); 9192 r = extractSmallStringSmallJsonO(self, delim1, delim2); 9193 ck_assert_ptr_eq(r, NULL); 9194 // delim1 = delim2 9195 setValO(self, "$qwe$"); 9196 freeO(delim2); 9197 setValO(delim1, "$"); 9198 setTopSO(delim2, "$"); 9199 r = extractSmallStringSmallJsonO(self, delim1, delim2); 9200 ck_assert_ptr_eq(r, NULL); 9201 // non json string 9202 freeO(delim2); 9203 r = extractSmallStringSmallJsonO(self, delim1, delim2); 9204 ck_assert_ptr_eq(r, NULL); 9205 // non json object 9206 terminateO(delim1); 9207 delim1 = (smallStringt*) allocSmallInt(1); 9208 setTopSO(delim2, "$"); 9209 r = extractSmallStringSmallJsonO(self, delim1, delim2); 9210 ck_assert_ptr_eq(r, NULL); 9211 terminateO(delim1); 9212 delim1 = allocSmallString(";"); 9213 terminateO(delim2); 9214 delim2 = (smallJsont*) allocSmallInt(1); 9215 r = extractSmallStringSmallJsonO(self, delim1, delim2); 9216 ck_assert_ptr_eq(r, NULL); 9217 terminateO(delim2); 9218 delim2 = allocSmallJson(); 9219 // NULL string 9220 freeO(self); 9221 freeO(delim2); 9222 setValO(delim1, ";"); 9223 setTopSO(delim2, ","); 9224 ck_assert_ptr_eq(extractSmallStringSmallJsonO(self, delim1, delim2), NULL); 9225 // NULL delimiter 9226 setValO(self, "test"); 9227 ck_assert_ptr_eq(extractSmallStringSmallJsonO(self, NULL, delim2), NULL); 9228 ck_assert_ptr_eq(extractSmallStringSmallJsonO(self, delim1, NULL), NULL); 9229 terminateO(delim1); 9230 terminateO(delim2); 9231 terminateO(self); 9232 9233 } 9234 9235 9236 void extractSmallStringSmallStringSmallStringT(void) { 9237 9238 smallArrayt* r; 9239 smallStringt *self = allocG(""); 9240 smallStringt* delim1 = allocSmallString("/"); 9241 smallStringt* delim2 = allocSmallString("|"); 9242 9243 // string 9244 setValO(self, "one/two|"); 9245 setValO(delim2, "|"); 9246 r = extractSmallStringSmallStringO(self, delim1, delim2); 9247 ck_assert_ptr_ne(r, null); 9248 char *s = toStringO(r); 9249 ck_assert_str_eq(s, "[\"two\"]"); 9250 free(s); 9251 terminateO(r); 9252 // delimiter not found 9253 setValO(self, "one/two"); 9254 setValO(delim1, "||"); 9255 setValO(delim2, "/"); 9256 r = extractSmallStringSmallStringO(self, delim1, delim2); 9257 ck_assert_ptr_eq(r, NULL); 9258 // extractSmallStringSmallStringO with several delimiters after each other 9259 setValO(self, "one/ two /three "); 9260 setValO(delim1, "/"); 9261 setValO(delim2, " "); 9262 r = extractSmallStringSmallStringO(self, delim1, delim2); 9263 ck_assert_ptr_ne(r, null); 9264 s = toStringO(r); 9265 ck_assert_str_eq(s, "[\"\",\"three\"]"); 9266 free(s); 9267 terminateO(r); 9268 // multiple character delimiter 9269 setValO(self, "AAe thre|e extract"); 9270 setValO(delim1, "e "); 9271 setValO(delim2, "|"); 9272 r = extractSmallStringSmallStringO(self, delim1, delim2); 9273 ck_assert_ptr_ne(r, null); 9274 s = toStringO(r); 9275 ck_assert_str_eq(s, "[\"thre\"]"); 9276 free(s); 9277 terminateO(r); 9278 // empty delimiter 9279 setValO(self, "AAd"); 9280 setValO(delim1, ""); 9281 setValO(delim2, "Ad"); 9282 r = extractSmallStringSmallStringO(self, delim1, delim2); 9283 ck_assert_ptr_eq(r, NULL); 9284 setValO(self, "AAd"); 9285 setValO(delim1, "A"); 9286 setValO(delim2, ""); 9287 r = extractSmallStringSmallStringO(self, delim1, delim2); 9288 ck_assert_ptr_eq(r, NULL); 9289 // empty string 9290 setValO(self, ""); 9291 setValO(delim1, "$"); 9292 setValO(delim2, "#"); 9293 r = extractSmallStringSmallStringO(self, delim1, delim2); 9294 ck_assert_ptr_eq(r, NULL); 9295 // delim1 = delim2 9296 setValO(self, "$qwe$"); 9297 setValO(delim1, "$"); 9298 setValO(delim2, "$"); 9299 r = extractSmallStringSmallStringO(self, delim1, delim2); 9300 ck_assert_ptr_eq(r, NULL); 9301 // non json object 9302 terminateO(delim1); 9303 delim1 = (smallStringt*) allocSmallInt(1); 9304 r = extractSmallStringSmallStringO(self, delim1, delim2); 9305 ck_assert_ptr_eq(r, NULL); 9306 terminateO(delim1); 9307 delim1 = allocSmallString(";"); 9308 terminateO(delim2); 9309 delim2 = (smallStringt*) allocSmallInt(1); 9310 r = extractSmallStringSmallStringO(self, delim1, delim2); 9311 ck_assert_ptr_eq(r, NULL); 9312 terminateO(delim2); 9313 delim2 = allocSmallString(","); 9314 // NULL string 9315 freeO(self); 9316 setValO(delim1, ";"); 9317 ck_assert_ptr_eq(extractSmallStringSmallStringO(self, delim1, delim2), NULL); 9318 // NULL delimiter 9319 setValO(self, "test"); 9320 ck_assert_ptr_eq(extractSmallStringSmallStringO(self, NULL, delim2), NULL); 9321 ck_assert_ptr_eq(extractSmallStringSmallStringO(self, delim1, NULL), NULL); 9322 terminateO(delim1); 9323 terminateO(delim2); 9324 terminateO(self); 9325 9326 } 9327 9328 9329 void extractSmallStringSSmallStringT(void) { 9330 9331 smallArrayt* r; 9332 smallStringt *self = allocG(""); 9333 smallStringt* delim1 = allocSmallString("/"); 9334 9335 // string 9336 setValO(self, "one/two|"); 9337 r = extractSmallStringSO(self, delim1, "|"); 9338 ck_assert_ptr_ne(r, null); 9339 char *s = toStringO(r); 9340 ck_assert_str_eq(s, "[\"two\"]"); 9341 free(s); 9342 terminateO(r); 9343 // delimiter not found 9344 setValO(self, "one/two"); 9345 setValO(delim1, "||"); 9346 r = extractSmallStringSO(self, delim1, "/"); 9347 ck_assert_ptr_eq(r, NULL); 9348 // extractSmallStringSO with several delimiters after each other 9349 setValO(self, "one/ two /three "); 9350 setValO(delim1, "/"); 9351 r = extractSmallStringSO(self, delim1, " "); 9352 ck_assert_ptr_ne(r, null); 9353 s = toStringO(r); 9354 ck_assert_str_eq(s, "[\"\",\"three\"]"); 9355 free(s); 9356 terminateO(r); 9357 // multiple character delimiter 9358 setValO(self, "AAe thre|e extract"); 9359 setValO(delim1, "e "); 9360 r = extractSmallStringSO(self, delim1, "|"); 9361 ck_assert_ptr_ne(r, null); 9362 s = toStringO(r); 9363 ck_assert_str_eq(s, "[\"thre\"]"); 9364 free(s); 9365 terminateO(r); 9366 // empty delimiter 9367 setValO(self, "AAd"); 9368 setValO(delim1, ""); 9369 r = extractSmallStringSO(self, delim1, "Ad"); 9370 ck_assert_ptr_eq(r, NULL); 9371 setValO(self, "AAd"); 9372 setValO(delim1, "A"); 9373 r = extractSmallStringSO(self, delim1, ""); 9374 ck_assert_ptr_eq(r, NULL); 9375 // empty string 9376 setValO(self, ""); 9377 setValO(delim1, "$"); 9378 r = extractSmallStringSO(self, delim1, "#"); 9379 ck_assert_ptr_eq(r, NULL); 9380 // delim1 = delim2 9381 setValO(self, "$qwe$"); 9382 setValO(delim1, "$"); 9383 r = extractSmallStringSO(self, delim1, "$"); 9384 ck_assert_ptr_eq(r, NULL); 9385 // non json object 9386 terminateO(delim1); 9387 delim1 = (smallStringt*) allocSmallInt(1); 9388 r = extractSmallStringSO(self, delim1, "$"); 9389 ck_assert_ptr_eq(r, NULL); 9390 terminateO(delim1); 9391 delim1 = allocSmallString(";"); 9392 // NULL string 9393 freeO(self); 9394 setValO(delim1, ";"); 9395 ck_assert_ptr_eq(extractSmallStringSO(self, delim1, ","), NULL); 9396 // NULL delimiter 9397 setValO(self, "test"); 9398 ck_assert_ptr_eq(extractSmallStringSO(self, NULL, ","), NULL); 9399 ck_assert_ptr_eq(extractSmallStringSO(self, delim1, NULL), NULL); 9400 terminateO(delim1); 9401 terminateO(self); 9402 9403 } 9404 9405 9406 void extractSmallStringCharSmallStringT(void) { 9407 9408 smallArrayt* r; 9409 smallStringt *self = allocG(""); 9410 smallStringt* delim1 = allocSmallString("/"); 9411 9412 // string 9413 setValO(self, "one/two|"); 9414 r = extractSmallStringCharO(self, delim1, '|'); 9415 ck_assert_ptr_ne(r, null); 9416 char *s = toStringO(r); 9417 ck_assert_str_eq(s, "[\"two\"]"); 9418 free(s); 9419 terminateO(r); 9420 // delimiter not found 9421 setValO(self, "one/two"); 9422 setValO(delim1, "||"); 9423 r = extractSmallStringCharO(self, delim1, '/'); 9424 ck_assert_ptr_eq(r, NULL); 9425 // extractSmallStringCharO with several delimiters after each other 9426 setValO(self, "one/ two /three "); 9427 setValO(delim1, "/"); 9428 r = extractSmallStringCharO(self, delim1, ' '); 9429 ck_assert_ptr_ne(r, null); 9430 s = toStringO(r); 9431 ck_assert_str_eq(s, "[\"\",\"three\"]"); 9432 free(s); 9433 terminateO(r); 9434 // multiple character delimiter 9435 setValO(self, "AAe thre|e extract"); 9436 setValO(delim1, "e "); 9437 r = extractSmallStringCharO(self, delim1, '|'); 9438 ck_assert_ptr_ne(r, null); 9439 s = toStringO(r); 9440 ck_assert_str_eq(s, "[\"thre\"]"); 9441 free(s); 9442 terminateO(r); 9443 // empty delimiter 9444 setValO(self, "AAd"); 9445 setValO(delim1, ""); 9446 r = extractSmallStringCharO(self, delim1, 'A'); 9447 ck_assert_ptr_eq(r, NULL); 9448 setValO(self, "AAd"); 9449 setValO(delim1, "A"); 9450 // empty string 9451 setValO(self, ""); 9452 setValO(delim1, "$"); 9453 r = extractSmallStringCharO(self, delim1, '#'); 9454 ck_assert_ptr_eq(r, NULL); 9455 // delim1 = delim2 9456 setValO(self, "$qwe$"); 9457 setValO(delim1, "$"); 9458 r = extractSmallStringCharO(self, delim1, '$'); 9459 ck_assert_ptr_eq(r, NULL); 9460 // non json object 9461 terminateO(delim1); 9462 delim1 = (smallStringt*) allocSmallInt(1); 9463 r = extractSmallStringCharO(self, delim1, '$'); 9464 ck_assert_ptr_eq(r, NULL); 9465 terminateO(delim1); 9466 delim1 = allocSmallString(";"); 9467 // NULL string 9468 freeO(self); 9469 setValO(delim1, ";"); 9470 ck_assert_ptr_eq(extractSmallStringCharO(self, delim1, ','), NULL); 9471 // NULL delimiter 9472 setValO(self, "test"); 9473 ck_assert_ptr_eq(extractSmallStringCharO(self, NULL, ','), NULL); 9474 terminateO(delim1); 9475 terminateO(self); 9476 9477 } 9478 9479 9480 void extractSSmallJsonSmallStringT(void) { 9481 9482 smallArrayt* r; 9483 smallStringt *self = allocG(""); 9484 smallJsont* delim2 = allocSmallJson(); 9485 9486 // string 9487 setValO(self, "one/two|"); 9488 setTopSO(delim2, "|"); 9489 r = extractSSmallJsonO(self, "/", delim2); 9490 ck_assert_ptr_ne(r, null); 9491 char *s = toStringO(r); 9492 ck_assert_str_eq(s, "[\"two\"]"); 9493 free(s); 9494 terminateO(r); 9495 // delimiter not found 9496 setValO(self, "one/two"); 9497 freeO(delim2); 9498 setTopSO(delim2, "/"); 9499 r = extractSSmallJsonO(self, "||", delim2); 9500 ck_assert_ptr_eq(r, NULL); 9501 // extractSSmallJsonO with several delimiters after each other 9502 setValO(self, "one/ two /three "); 9503 freeO(delim2); 9504 setTopSO(delim2, " "); 9505 r = extractSSmallJsonO(self, "/", delim2); 9506 ck_assert_ptr_ne(r, null); 9507 s = toStringO(r); 9508 ck_assert_str_eq(s, "[\"\",\"three\"]"); 9509 free(s); 9510 terminateO(r); 9511 // multiple character delimiter 9512 setValO(self, "AAe thre|e extract"); 9513 freeO(delim2); 9514 setTopSO(delim2, "|"); 9515 r = extractSSmallJsonO(self, "e ", delim2); 9516 ck_assert_ptr_ne(r, null); 9517 s = toStringO(r); 9518 ck_assert_str_eq(s, "[\"thre\"]"); 9519 free(s); 9520 terminateO(r); 9521 // empty delimiter 9522 setValO(self, "AAd"); 9523 freeO(delim2); 9524 setTopSO(delim2, "Ad"); 9525 r = extractSSmallJsonO(self, "", delim2); 9526 ck_assert_ptr_eq(r, NULL); 9527 setValO(self, "AAd"); 9528 freeO(delim2); 9529 setTopSO(delim2, ""); 9530 r = extractSSmallJsonO(self, "A", delim2); 9531 ck_assert_ptr_eq(r, NULL); 9532 // empty string 9533 setValO(self, ""); 9534 freeO(delim2); 9535 setTopSO(delim2, "#"); 9536 r = extractSSmallJsonO(self, "$", delim2); 9537 ck_assert_ptr_eq(r, NULL); 9538 // delim1 = delim2 9539 setValO(self, "$qwe$"); 9540 freeO(delim2); 9541 setTopSO(delim2, "$"); 9542 r = extractSSmallJsonO(self, "$", delim2); 9543 ck_assert_ptr_eq(r, NULL); 9544 // non json string 9545 freeO(delim2); 9546 r = extractSSmallJsonO(self, "$", delim2); 9547 ck_assert_ptr_eq(r, NULL); 9548 // non json object 9549 terminateO(delim2); 9550 delim2 = (smallJsont*) allocSmallInt(1); 9551 r = extractSSmallJsonO(self, ";", delim2); 9552 ck_assert_ptr_eq(r, NULL); 9553 terminateO(delim2); 9554 delim2 = allocSmallJson(); 9555 // NULL string 9556 freeO(self); 9557 freeO(delim2); 9558 setTopSO(delim2, ","); 9559 ck_assert_ptr_eq(extractSSmallJsonO(self, ";", delim2), NULL); 9560 // NULL delimiter 9561 setValO(self, "test"); 9562 ck_assert_ptr_eq(extractSSmallJsonO(self, NULL, delim2), NULL); 9563 ck_assert_ptr_eq(extractSSmallJsonO(self, ";", NULL), NULL); 9564 terminateO(delim2); 9565 terminateO(self); 9566 9567 } 9568 9569 9570 void extractSSmallStringSmallStringT(void) { 9571 9572 smallArrayt* r; 9573 smallStringt *self = allocG(""); 9574 smallStringt* delim2 = allocSmallString("|"); 9575 9576 // string 9577 setValO(self, "one/two|"); 9578 setValO(delim2, "|"); 9579 r = extractSSmallStringO(self, "/", delim2); 9580 ck_assert_ptr_ne(r, null); 9581 char *s = toStringO(r); 9582 ck_assert_str_eq(s, "[\"two\"]"); 9583 free(s); 9584 terminateO(r); 9585 // delimiter not found 9586 setValO(self, "one/two"); 9587 setValO(delim2, "/"); 9588 r = extractSSmallStringO(self, "||", delim2); 9589 ck_assert_ptr_eq(r, NULL); 9590 // extractSSmallStringO with several delimiters after each other 9591 setValO(self, "one/ two /three "); 9592 setValO(delim2, " "); 9593 r = extractSSmallStringO(self, "/", delim2); 9594 ck_assert_ptr_ne(r, null); 9595 s = toStringO(r); 9596 ck_assert_str_eq(s, "[\"\",\"three\"]"); 9597 free(s); 9598 terminateO(r); 9599 // multiple character delimiter 9600 setValO(self, "AAe thre|e extract"); 9601 setValO(delim2, "|"); 9602 r = extractSSmallStringO(self, "e ", delim2); 9603 ck_assert_ptr_ne(r, null); 9604 s = toStringO(r); 9605 ck_assert_str_eq(s, "[\"thre\"]"); 9606 free(s); 9607 terminateO(r); 9608 // empty delimiter 9609 setValO(self, "AAd"); 9610 setValO(delim2, "Ad"); 9611 r = extractSSmallStringO(self, "", delim2); 9612 ck_assert_ptr_eq(r, NULL); 9613 setValO(self, "AAd"); 9614 setValO(delim2, ""); 9615 r = extractSSmallStringO(self, "A", delim2); 9616 ck_assert_ptr_eq(r, NULL); 9617 // empty string 9618 setValO(self, ""); 9619 setValO(delim2, "#"); 9620 r = extractSSmallStringO(self, "$", delim2); 9621 ck_assert_ptr_eq(r, NULL); 9622 // delim1 = delim2 9623 setValO(self, "$qwe$"); 9624 setValO(delim2, "$"); 9625 r = extractSSmallStringO(self, "$", delim2); 9626 ck_assert_ptr_eq(r, NULL); 9627 // non json object 9628 terminateO(delim2); 9629 delim2 = (smallStringt*) allocSmallInt(1); 9630 r = extractSSmallStringO(self, ";", delim2); 9631 ck_assert_ptr_eq(r, NULL); 9632 terminateO(delim2); 9633 delim2 = allocSmallString(","); 9634 // NULL string 9635 freeO(self); 9636 ck_assert_ptr_eq(extractSSmallStringO(self, ";", delim2), NULL); 9637 // NULL delimiter 9638 setValO(self, "test"); 9639 ck_assert_ptr_eq(extractSSmallStringO(self, NULL, delim2), NULL); 9640 ck_assert_ptr_eq(extractSSmallStringO(self, ";", NULL), NULL); 9641 terminateO(delim2); 9642 terminateO(self); 9643 9644 } 9645 9646 9647 void extractCharSmallJsonSmallStringT(void) { 9648 9649 smallArrayt* r; 9650 smallStringt *self = allocG(""); 9651 smallJsont* delim2 = allocSmallJson(); 9652 9653 // string 9654 setValO(self, "one/two|"); 9655 setTopSO(delim2, "|"); 9656 r = extractCharSmallJsonO(self, '/', delim2); 9657 ck_assert_ptr_ne(r, null); 9658 char *s = toStringO(r); 9659 ck_assert_str_eq(s, "[\"two\"]"); 9660 free(s); 9661 terminateO(r); 9662 // delimiter not found 9663 setValO(self, "one/two"); 9664 freeO(delim2); 9665 setTopSO(delim2, "/"); 9666 r = extractCharSmallJsonO(self, '|', delim2); 9667 ck_assert_ptr_eq(r, NULL); 9668 // extractCharSmallJsonO with several delimiters after each other 9669 setValO(self, "one/ two /three "); 9670 freeO(delim2); 9671 setTopSO(delim2, " "); 9672 r = extractCharSmallJsonO(self, '/', delim2); 9673 ck_assert_ptr_ne(r, null); 9674 s = toStringO(r); 9675 ck_assert_str_eq(s, "[\"\",\"three\"]"); 9676 free(s); 9677 terminateO(r); 9678 // multiple character delimiter 9679 setValO(self, "AAe thre|e extract"); 9680 freeO(delim2); 9681 setTopSO(delim2, "|"); 9682 r = extractCharSmallJsonO(self, ' ', delim2); 9683 ck_assert_ptr_ne(r, null); 9684 s = toStringO(r); 9685 ck_assert_str_eq(s, "[\"thre\"]"); 9686 free(s); 9687 terminateO(r); 9688 // empty delimiter 9689 setValO(self, "AAd"); 9690 freeO(delim2); 9691 setTopSO(delim2, ""); 9692 r = extractCharSmallJsonO(self, 'A', delim2); 9693 ck_assert_ptr_eq(r, NULL); 9694 // empty string 9695 setValO(self, ""); 9696 freeO(delim2); 9697 setTopSO(delim2, "#"); 9698 r = extractCharSmallJsonO(self, '$', delim2); 9699 ck_assert_ptr_eq(r, NULL); 9700 // delim1 = delim2 9701 setValO(self, "$qwe$"); 9702 freeO(delim2); 9703 setTopSO(delim2, "$"); 9704 r = extractCharSmallJsonO(self, '$', delim2); 9705 ck_assert_ptr_eq(r, NULL); 9706 // non json string 9707 freeO(delim2); 9708 r = extractCharSmallJsonO(self, '$', delim2); 9709 ck_assert_ptr_eq(r, NULL); 9710 // non json object 9711 terminateO(delim2); 9712 delim2 = (smallJsont*) allocSmallInt(1); 9713 r = extractCharSmallJsonO(self, ';', delim2); 9714 ck_assert_ptr_eq(r, NULL); 9715 terminateO(delim2); 9716 delim2 = allocSmallJson(); 9717 // NULL string 9718 freeO(self); 9719 freeO(delim2); 9720 setTopSO(delim2, ","); 9721 ck_assert_ptr_eq(extractCharSmallJsonO(self, ';', delim2), NULL); 9722 // NULL delimiter 9723 setValO(self, "test"); 9724 ck_assert_ptr_eq(extractCharSmallJsonO(self, ';', NULL), NULL); 9725 terminateO(delim2); 9726 terminateO(self); 9727 9728 } 9729 9730 9731 void extractCharSmallStringSmallStringT(void) { 9732 9733 smallArrayt* r; 9734 smallStringt *self = allocG(""); 9735 smallStringt* delim2 = allocSmallString("|"); 9736 9737 // string 9738 setValO(self, "one/two|"); 9739 setValO(delim2, "|"); 9740 r = extractCharSmallStringO(self, '/', delim2); 9741 ck_assert_ptr_ne(r, null); 9742 char *s = toStringO(r); 9743 ck_assert_str_eq(s, "[\"two\"]"); 9744 free(s); 9745 terminateO(r); 9746 // delimiter not found 9747 setValO(self, "one/two"); 9748 setValO(delim2, "/"); 9749 r = extractCharSmallStringO(self, '|', delim2); 9750 ck_assert_ptr_eq(r, NULL); 9751 // extractCharSmallStringO with several delimiters after each other 9752 setValO(self, "one/ two /three "); 9753 setValO(delim2, " "); 9754 r = extractCharSmallStringO(self, '/', delim2); 9755 ck_assert_ptr_ne(r, null); 9756 s = toStringO(r); 9757 ck_assert_str_eq(s, "[\"\",\"three\"]"); 9758 free(s); 9759 terminateO(r); 9760 // multiple character delimiter 9761 setValO(self, "AAe thre|e extract"); 9762 setValO(delim2, "|e"); 9763 r = extractCharSmallStringO(self, ' ', delim2); 9764 ck_assert_ptr_ne(r, null); 9765 s = toStringO(r); 9766 ck_assert_str_eq(s, "[\"thre\"]"); 9767 free(s); 9768 terminateO(r); 9769 // empty delimiter 9770 setValO(self, "AAd"); 9771 setValO(delim2, ""); 9772 r = extractCharSmallStringO(self, 'A', delim2); 9773 ck_assert_ptr_eq(r, NULL); 9774 // empty string 9775 setValO(self, ""); 9776 setValO(delim2, "#"); 9777 r = extractCharSmallStringO(self, '$', delim2); 9778 ck_assert_ptr_eq(r, NULL); 9779 // delim1 = delim2 9780 setValO(self, "$qwe$"); 9781 setValO(delim2, "$"); 9782 r = extractCharSmallStringO(self, '$', delim2); 9783 ck_assert_ptr_eq(r, NULL); 9784 // non json object 9785 terminateO(delim2); 9786 delim2 = (smallStringt*) allocSmallInt(1); 9787 r = extractCharSmallStringO(self, ';', delim2); 9788 ck_assert_ptr_eq(r, NULL); 9789 terminateO(delim2); 9790 delim2 = allocSmallString(","); 9791 // NULL string 9792 freeO(self); 9793 ck_assert_ptr_eq(extractCharSmallStringO(self, ';', delim2), NULL); 9794 // NULL delimiter 9795 setValO(self, "test"); 9796 ck_assert_ptr_eq(extractCharSmallStringO(self, ';', NULL), NULL); 9797 terminateO(delim2); 9798 terminateO(self); 9799 9800 } 9801 9802 9803 void icSplitSmallStringT(void) { 9804 9805 smallArrayt* r; 9806 smallStringt *self = allocG(""); 9807 9808 // string 9809 setValO(self, "one/two"); 9810 r = icSplitO(self, "/"); 9811 ck_assert_ptr_ne(r, null); 9812 char *s = toStringO(r); 9813 ck_assert_str_eq(s, "[\"one\",\"two\"]"); 9814 free(s); 9815 terminateO(r); 9816 // delimiter on the edge 9817 setValO(self, "/one"); 9818 r = icSplitO(self, "/"); 9819 ck_assert_ptr_ne(r, null); 9820 s = toStringO(r); 9821 ck_assert_str_eq(s, "[\"\",\"one\"]"); 9822 free(s); 9823 terminateO(r); 9824 setValO(self, "one/"); 9825 r = icSplitO(self, "/"); 9826 ck_assert_ptr_ne(r, null); 9827 s = toStringO(r); 9828 ck_assert_str_eq(s, "[\"one\",\"\"]"); 9829 free(s); 9830 terminateO(r); 9831 // delimiter not found 9832 setValO(self, "one/two"); 9833 r = icSplitO(self, "||"); 9834 ck_assert_ptr_ne(r, null); 9835 s = toStringO(r); 9836 ck_assert_str_eq(s, "[\"one/two\"]"); 9837 free(s); 9838 terminateO(r); 9839 // icSplit with several delimiters after each other 9840 setValO(self, "one/two three "); 9841 r = icSplitO(self, " "); 9842 ck_assert_ptr_ne(r, null); 9843 s = toStringO(r); 9844 ck_assert_str_eq(s, "[\"one/two\",\"\",\"three\",\"\"]"); 9845 free(s); 9846 terminateO(r); 9847 // multiple character delimiter 9848 setValO(self, "AAe three extract"); 9849 r = icSplitO(self, "E "); 9850 ck_assert_ptr_ne(r, null); 9851 s = toStringO(r); 9852 ck_assert_str_eq(s, "[\"AA\",\"thre\",\"extract\"]"); 9853 free(s); 9854 terminateO(r); 9855 // empty delimiter 9856 setValO(self, "AAd"); 9857 r = icSplitO(self, ""); 9858 ck_assert_ptr_ne(r, null); 9859 s = toStringO(r); 9860 ck_assert_str_eq(s, "[\"AAd\"]"); 9861 free(s); 9862 terminateO(r); 9863 // empty string 9864 emptyO(self); 9865 r = icSplitO(self, "$"); 9866 ck_assert_ptr_ne(r, null); 9867 s = toStringO(r); 9868 ck_assert_str_eq(s, "[\"\"]"); 9869 free(s); 9870 terminateO(r); 9871 // NULL list 9872 freeO(self); 9873 ck_assert_ptr_eq(icSplitO(self, ";"), NULL); 9874 // NULL delimiter 9875 setValO(self, "test"); 9876 ck_assert_ptr_eq(icSplitO(self, NULL), NULL); 9877 terminateO(self); 9878 9879 } 9880 9881 9882 void icSplitCharSmallStringT(void) { 9883 9884 smallArrayt* r; 9885 smallStringt *self = allocG(""); 9886 9887 // string 9888 setValO(self, "one/two"); 9889 r = icSplitCharO(self, 'T'); 9890 ck_assert_ptr_ne(r, null); 9891 char *s = toStringO(r); 9892 ck_assert_str_eq(s, "[\"one/\",\"wo\"]"); 9893 free(s); 9894 terminateO(r); 9895 // delimiter on the edge 9896 setValO(self, "/one"); 9897 r = icSplitCharO(self, '/'); 9898 ck_assert_ptr_ne(r, null); 9899 s = toStringO(r); 9900 ck_assert_str_eq(s, "[\"\",\"one\"]"); 9901 free(s); 9902 terminateO(r); 9903 setValO(self, "one/"); 9904 r = icSplitCharO(self, '/'); 9905 ck_assert_ptr_ne(r, null); 9906 s = toStringO(r); 9907 ck_assert_str_eq(s, "[\"one\",\"\"]"); 9908 free(s); 9909 terminateO(r); 9910 // delimiter not found 9911 setValO(self, "one/two"); 9912 r = icSplitCharO(self, '|'); 9913 ck_assert_ptr_ne(r, null); 9914 s = toStringO(r); 9915 ck_assert_str_eq(s, "[\"one/two\"]"); 9916 free(s); 9917 terminateO(r); 9918 // icSplit with several delimiters after each other 9919 setValO(self, "one/two three "); 9920 r = icSplitCharO(self, ' '); 9921 ck_assert_ptr_ne(r, null); 9922 s = toStringO(r); 9923 ck_assert_str_eq(s, "[\"one/two\",\"\",\"three\",\"\"]"); 9924 free(s); 9925 terminateO(r); 9926 // empty string 9927 emptyO(self); 9928 r = icSplitCharO(self, '$'); 9929 ck_assert_ptr_ne(r, null); 9930 s = toStringO(r); 9931 ck_assert_str_eq(s, "[\"\"]"); 9932 free(s); 9933 terminateO(r); 9934 // NULL list 9935 freeO(self); 9936 ck_assert_ptr_eq(icSplitCharO(self, ';'), NULL); 9937 terminateO(self); 9938 9939 } 9940 9941 9942 void icSplitSmallJsonSmallStringT(void) { 9943 9944 smallArrayt* r; 9945 smallStringt *self = allocG(""); 9946 smallJsont *delim = allocSmallJson(); 9947 9948 // string 9949 setValO(self, "one/two"); 9950 setTopSO(delim, "/"); 9951 r = self->f->icSplitSmallJson(self, delim); 9952 ck_assert_ptr_ne(r, null); 9953 char *s = toStringO(r); 9954 ck_assert_str_eq(s, "[\"one\",\"two\"]"); 9955 free(s); 9956 terminateO(r); 9957 // delimiter on the edge 9958 setValO(self, "/one"); 9959 r = self->f->icSplitSmallJson(self, delim); 9960 ck_assert_ptr_ne(r, null); 9961 s = toStringO(r); 9962 ck_assert_str_eq(s, "[\"\",\"one\"]"); 9963 free(s); 9964 terminateO(r); 9965 setValO(self, "one/"); 9966 r = self->f->icSplitSmallJson(self, delim); 9967 ck_assert_ptr_ne(r, null); 9968 s = toStringO(r); 9969 ck_assert_str_eq(s, "[\"one\",\"\"]"); 9970 free(s); 9971 terminateO(r); 9972 // delimiter not found 9973 setValO(self, "one/two"); 9974 freeO(delim); 9975 setTopSO(delim, "||"); 9976 r = self->f->icSplitSmallJson(self, delim); 9977 ck_assert_ptr_ne(r, null); 9978 s = toStringO(r); 9979 ck_assert_str_eq(s, "[\"one/two\"]"); 9980 free(s); 9981 terminateO(r); 9982 // icSplit with several delimiters after each other 9983 setValO(self, "one/two three "); 9984 freeO(delim); 9985 setTopSO(delim, " "); 9986 r = self->f->icSplitSmallJson(self, delim); 9987 ck_assert_ptr_ne(r, null); 9988 s = toStringO(r); 9989 ck_assert_str_eq(s, "[\"one/two\",\"\",\"three\",\"\"]"); 9990 free(s); 9991 terminateO(r); 9992 // multiple character delimiter 9993 setValO(self, "AAe three extract"); 9994 freeO(delim); 9995 setTopSO(delim, "E "); 9996 r = self->f->icSplitSmallJson(self, delim); 9997 ck_assert_ptr_ne(r, null); 9998 s = toStringO(r); 9999 ck_assert_str_eq(s, "[\"AA\",\"thre\",\"extract\"]"); 10000 free(s); 10001 terminateO(r); 10002 // empty delimiter 10003 setValO(self, "AAd"); 10004 freeO(delim); 10005 setTopSO(delim, ""); 10006 r = self->f->icSplitSmallJson(self, delim); 10007 ck_assert_ptr_ne(r, null); 10008 s = toStringO(r); 10009 ck_assert_str_eq(s, "[\"AAd\"]"); 10010 free(s); 10011 terminateO(r); 10012 // empty string 10013 emptyO(self); 10014 freeO(delim); 10015 setTopSO(delim, "$"); 10016 r = self->f->icSplitSmallJson(self, delim); 10017 ck_assert_ptr_ne(r, null); 10018 s = toStringO(r); 10019 ck_assert_str_eq(s, "[\"\"]"); 10020 free(s); 10021 terminateO(r); 10022 // non json string delimiter 10023 freeO(delim); 10024 ck_assert_ptr_eq(self->f->icSplitSmallJson(self, delim), NULL); 10025 // non json object delimiter 10026 terminateO(delim); 10027 delim = (smallJsont*) allocSmallInt(1); 10028 ck_assert_ptr_eq(self->f->icSplitSmallJson(self, delim), NULL); 10029 terminateO(delim); 10030 delim = allocSmallJson(); 10031 // NULL list 10032 freeO(self); 10033 freeO(delim); 10034 setTopSO(delim, ";"); 10035 ck_assert_ptr_eq(self->f->icSplitSmallJson(self, delim), NULL); 10036 // NULL delimiter 10037 setValO(self, "test"); 10038 ck_assert_ptr_eq(self->f->icSplitSmallJson(self, NULL), NULL); 10039 terminateO(delim); 10040 terminateO(self); 10041 10042 } 10043 10044 10045 void icSplitSmallStringSmallStringT(void) { 10046 10047 smallArrayt* r; 10048 smallStringt *self = allocG(""); 10049 smallStringt *delim = allocSmallString("/"); 10050 10051 // string 10052 setValO(self, "one/two"); 10053 r = self->f->icSplitSmallString(self, delim); 10054 ck_assert_ptr_ne(r, null); 10055 char *s = toStringO(r); 10056 ck_assert_str_eq(s, "[\"one\",\"two\"]"); 10057 free(s); 10058 terminateO(r); 10059 // delimiter on the edge 10060 setValO(self, "/one"); 10061 r = self->f->icSplitSmallString(self, delim); 10062 ck_assert_ptr_ne(r, null); 10063 s = toStringO(r); 10064 ck_assert_str_eq(s, "[\"\",\"one\"]"); 10065 free(s); 10066 terminateO(r); 10067 setValO(self, "one/"); 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\",\"\"]"); 10072 free(s); 10073 terminateO(r); 10074 // delimiter not found 10075 setValO(self, "one/two"); 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\"]"); 10081 free(s); 10082 terminateO(r); 10083 // icSplit with several delimiters after each other 10084 setValO(self, "one/two three "); 10085 setValO(delim, " "); 10086 r = self->f->icSplitSmallString(self, delim); 10087 ck_assert_ptr_ne(r, null); 10088 s = toStringO(r); 10089 ck_assert_str_eq(s, "[\"one/two\",\"\",\"three\",\"\"]"); 10090 free(s); 10091 terminateO(r); 10092 // multiple character delimiter 10093 setValO(self, "AAe three extract"); 10094 setValO(delim, "E "); 10095 r = self->f->icSplitSmallString(self, delim); 10096 ck_assert_ptr_ne(r, null); 10097 s = toStringO(r); 10098 ck_assert_str_eq(s, "[\"AA\",\"thre\",\"extract\"]"); 10099 free(s); 10100 terminateO(r); 10101 // empty delimiter 10102 setValO(self, "AAd"); 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, "[\"AAd\"]"); 10108 free(s); 10109 terminateO(r); 10110 // empty string 10111 emptyO(self); 10112 setValO(delim, "$"); 10113 r = self->f->icSplitSmallString(self, delim); 10114 ck_assert_ptr_ne(r, null); 10115 s = toStringO(r); 10116 ck_assert_str_eq(s, "[\"\"]"); 10117 free(s); 10118 terminateO(r); 10119 // null string delimiter 10120 freeO(delim); 10121 ck_assert_ptr_eq(self->f->icSplitSmallString(self, delim), NULL); 10122 // non json object delimiter 10123 terminateO(delim); 10124 delim = (smallStringt*) allocSmallInt(1); 10125 ck_assert_ptr_eq(self->f->icSplitSmallString(self, delim), NULL); 10126 terminateO(delim); 10127 // NULL list 10128 freeO(self); 10129 delim = allocSmallString(";"); 10130 ck_assert_ptr_eq(self->f->icSplitSmallString(self, delim), NULL); 10131 // NULL delimiter 10132 setValO(self, "test"); 10133 ck_assert_ptr_eq(self->f->icSplitSmallString(self, NULL), NULL); 10134 terminateO(delim); 10135 terminateO(self); 10136 10137 } 10138 10139 10140 void icSplitSSmallStringT(void) { 10141 10142 char** r; 10143 smallStringt *self = allocG(""); 10144 10145 // string 10146 setValO(self, "one/two"); 10147 r = icSplitSO(self, "/"); 10148 ck_assert_uint_eq(listLengthS(r),2); 10149 ck_assert_str_eq(r[0], "one"); 10150 ck_assert_str_eq(r[1], "two"); 10151 listFreeS(r); 10152 // delimiter on the edge 10153 setValO(self, "/one"); 10154 r = icSplitSO(self, "/"); 10155 ck_assert_uint_eq(listLengthS(r),2); 10156 ck_assert_str_eq(r[0], ""); 10157 ck_assert_str_eq(r[1], "one"); 10158 listFreeS(r); 10159 setValO(self, "one/"); 10160 r = icSplitSO(self, "/"); 10161 ck_assert_uint_eq(listLengthS(r),2); 10162 ck_assert_str_eq(r[0], "one"); 10163 ck_assert_str_eq(r[1], ""); 10164 listFreeS(r); 10165 // delimiter not found 10166 setValO(self, "one/two"); 10167 r = icSplitSO(self, "||"); 10168 ck_assert_uint_eq(listLengthS(r),1); 10169 ck_assert_str_eq(r[0], "one/two"); 10170 listFreeS(r); 10171 // icSplit with several delimiters after each other 10172 setValO(self, "one/two three "); 10173 r = icSplitSO(self, " "); 10174 ck_assert_uint_eq(listLengthS(r),4); 10175 ck_assert_str_eq(r[0], "one/two"); 10176 ck_assert_str_eq(r[1], ""); 10177 ck_assert_str_eq(r[2], "three"); 10178 ck_assert_str_eq(r[3], ""); 10179 listFreeS(r); 10180 // multiple character delimiter 10181 setValO(self, "AAe three extract"); 10182 r = icSplitSO(self, "E "); 10183 ck_assert_uint_eq(listLengthS(r),3); 10184 ck_assert_str_eq(r[0], "AA"); 10185 ck_assert_str_eq(r[1], "thre"); 10186 ck_assert_str_eq(r[2], "extract"); 10187 listFreeS(r); 10188 // empty delimiter 10189 setValO(self, "AAd"); 10190 r = icSplitSO(self, ""); 10191 ck_assert_uint_eq(listLengthS(r),1); 10192 ck_assert_str_eq(r[0], "AAd"); 10193 listFreeS(r); 10194 // empty string 10195 emptyO(self); 10196 r = icSplitSO(self, "$"); 10197 ck_assert_uint_eq(listLengthS(r),1); 10198 ck_assert_str_eq(r[0], ""); 10199 listFreeS(r); 10200 // NULL list 10201 freeO(self); 10202 ck_assert_ptr_eq(icSplitSO(self, ";"), NULL); 10203 // NULL delimiter 10204 setValO(self, "test"); 10205 ck_assert_ptr_eq(icSplitSO(self, NULL), NULL); 10206 terminateO(self); 10207 10208 } 10209 10210 10211 void icSplitCharSSmallStringT(void) { 10212 10213 char** r; 10214 smallStringt *self = allocG(""); 10215 10216 // string 10217 setValO(self, "one/two"); 10218 r = icSplitCharSO(self, 'T'); 10219 ck_assert_uint_eq(listLengthS(r),2); 10220 ck_assert_str_eq(r[0], "one/"); 10221 ck_assert_str_eq(r[1], "wo"); 10222 listFreeS(r); 10223 // delimiter on the edge 10224 setValO(self, "/one"); 10225 r = icSplitCharSO(self, '/'); 10226 ck_assert_uint_eq(listLengthS(r),2); 10227 ck_assert_str_eq(r[0], ""); 10228 ck_assert_str_eq(r[1], "one"); 10229 listFreeS(r); 10230 setValO(self, "one/"); 10231 r = icSplitCharSO(self, '/'); 10232 ck_assert_uint_eq(listLengthS(r),2); 10233 ck_assert_str_eq(r[0], "one"); 10234 ck_assert_str_eq(r[1], ""); 10235 listFreeS(r); 10236 // delimiter not found 10237 setValO(self, "one/two"); 10238 r = icSplitCharSO(self, '|'); 10239 ck_assert_uint_eq(listLengthS(r),1); 10240 ck_assert_str_eq(r[0], "one/two"); 10241 listFreeS(r); 10242 // icSplit with several delimiters after each other 10243 setValO(self, "one/two three "); 10244 r = icSplitCharSO(self, ' '); 10245 ck_assert_uint_eq(listLengthS(r),4); 10246 ck_assert_str_eq(r[0], "one/two"); 10247 ck_assert_str_eq(r[1], ""); 10248 ck_assert_str_eq(r[2], "three"); 10249 ck_assert_str_eq(r[3], ""); 10250 listFreeS(r); 10251 // empty string 10252 emptyO(self); 10253 r = icSplitCharSO(self, '$'); 10254 ck_assert_uint_eq(listLengthS(r),1); 10255 ck_assert_str_eq(r[0], ""); 10256 listFreeS(r); 10257 // NULL list 10258 freeO(self); 10259 ck_assert_ptr_eq(icSplitCharSO(self, ';'), NULL); 10260 terminateO(self); 10261 10262 } 10263 10264 10265 void icSplitSmallJsonSSmallStringT(void) { 10266 10267 char** r; 10268 smallStringt *self = allocG(""); 10269 smallJsont *delim = allocSmallJson(); 10270 10271 // string 10272 setValO(self, "one/two"); 10273 setTopSO(delim, "/"); 10274 r = icSplitSmallJsonSO(self, delim); 10275 ck_assert_uint_eq(listLengthS(r),2); 10276 ck_assert_str_eq(r[0], "one"); 10277 ck_assert_str_eq(r[1], "two"); 10278 listFreeS(r); 10279 // delimiter on the edge 10280 setValO(self, "/one"); 10281 r = icSplitSmallJsonSO(self, delim); 10282 ck_assert_uint_eq(listLengthS(r),2); 10283 ck_assert_str_eq(r[0], ""); 10284 ck_assert_str_eq(r[1], "one"); 10285 listFreeS(r); 10286 setValO(self, "one/"); 10287 r = icSplitSmallJsonSO(self, delim); 10288 ck_assert_uint_eq(listLengthS(r),2); 10289 ck_assert_str_eq(r[0], "one"); 10290 ck_assert_str_eq(r[1], ""); 10291 listFreeS(r); 10292 // delimiter not found 10293 setValO(self, "one/two"); 10294 freeO(delim); 10295 setTopSO(delim, "||"); 10296 r = icSplitSmallJsonSO(self, delim); 10297 ck_assert_uint_eq(listLengthS(r),1); 10298 ck_assert_str_eq(r[0], "one/two"); 10299 listFreeS(r); 10300 // icSplit with several delimiters after each other 10301 setValO(self, "one/two three "); 10302 freeO(delim); 10303 setTopSO(delim, " "); 10304 r = icSplitSmallJsonSO(self, delim); 10305 ck_assert_uint_eq(listLengthS(r),4); 10306 ck_assert_str_eq(r[0], "one/two"); 10307 ck_assert_str_eq(r[1], ""); 10308 ck_assert_str_eq(r[2], "three"); 10309 ck_assert_str_eq(r[3], ""); 10310 listFreeS(r); 10311 // multiple character delimiter 10312 setValO(self, "AAe three extract"); 10313 freeO(delim); 10314 setTopSO(delim, "E "); 10315 r = icSplitSmallJsonSO(self, delim); 10316 ck_assert_uint_eq(listLengthS(r),3); 10317 ck_assert_str_eq(r[0], "AA"); 10318 ck_assert_str_eq(r[1], "thre"); 10319 ck_assert_str_eq(r[2], "extract"); 10320 listFreeS(r); 10321 // empty delimiter 10322 setValO(self, "AAd"); 10323 freeO(delim); 10324 setTopSO(delim, ""); 10325 r = icSplitSmallJsonSO(self, delim); 10326 ck_assert_uint_eq(listLengthS(r),1); 10327 ck_assert_str_eq(r[0], "AAd"); 10328 listFreeS(r); 10329 // empty string 10330 emptyO(self); 10331 freeO(delim); 10332 setTopSO(delim, "$"); 10333 r = icSplitSmallJsonSO(self, delim); 10334 ck_assert_uint_eq(listLengthS(r),1); 10335 ck_assert_str_eq(r[0], ""); 10336 listFreeS(r); 10337 // non json string delimiter 10338 freeO(delim); 10339 ck_assert_ptr_eq(icSplitSmallJsonSO(self, delim), NULL); 10340 // non json object delimiter 10341 terminateO(delim); 10342 delim = (smallJsont*) allocSmallInt(1); 10343 ck_assert_ptr_eq(icSplitSmallJsonSO(self, delim), NULL); 10344 terminateO(delim); 10345 delim = allocSmallJson(); 10346 // NULL list 10347 freeO(self); 10348 freeO(delim); 10349 setTopSO(delim, ";"); 10350 ck_assert_ptr_eq(icSplitSmallJsonSO(self, delim), NULL); 10351 // NULL delimiter 10352 setValO(self, "test"); 10353 ck_assert_ptr_eq(icSplitSmallJsonSO(self, NULL), NULL); 10354 terminateO(delim); 10355 terminateO(self); 10356 10357 } 10358 10359 10360 void icSplitSmallStringSSmallStringT(void) { 10361 10362 char** r; 10363 smallStringt *self = allocG(""); 10364 smallStringt *delim = allocSmallString("/"); 10365 10366 // string 10367 setValO(self, "one/two"); 10368 r = icSplitSmallStringSO(self, delim); 10369 ck_assert_uint_eq(listLengthS(r),2); 10370 ck_assert_str_eq(r[0], "one"); 10371 ck_assert_str_eq(r[1], "two"); 10372 listFreeS(r); 10373 // delimiter on the edge 10374 setValO(self, "/one"); 10375 r = icSplitSmallStringSO(self, delim); 10376 ck_assert_uint_eq(listLengthS(r),2); 10377 ck_assert_str_eq(r[0], ""); 10378 ck_assert_str_eq(r[1], "one"); 10379 listFreeS(r); 10380 setValO(self, "one/"); 10381 r = icSplitSmallStringSO(self, delim); 10382 ck_assert_uint_eq(listLengthS(r),2); 10383 ck_assert_str_eq(r[0], "one"); 10384 ck_assert_str_eq(r[1], ""); 10385 listFreeS(r); 10386 // delimiter not found 10387 setValO(self, "one/two"); 10388 setValO(delim, "||"); 10389 r = icSplitSmallStringSO(self, delim); 10390 ck_assert_uint_eq(listLengthS(r),1); 10391 ck_assert_str_eq(r[0], "one/two"); 10392 listFreeS(r); 10393 // icSplit with several delimiters after each other 10394 setValO(self, "one/two three "); 10395 setValO(delim, " "); 10396 r = icSplitSmallStringSO(self, delim); 10397 ck_assert_uint_eq(listLengthS(r),4); 10398 ck_assert_str_eq(r[0], "one/two"); 10399 ck_assert_str_eq(r[1], ""); 10400 ck_assert_str_eq(r[2], "three"); 10401 ck_assert_str_eq(r[3], ""); 10402 listFreeS(r); 10403 // multiple character delimiter 10404 setValO(self, "AAe three extract"); 10405 setValO(delim, "E "); 10406 r = icSplitSmallStringSO(self, delim); 10407 ck_assert_uint_eq(listLengthS(r),3); 10408 ck_assert_str_eq(r[0], "AA"); 10409 ck_assert_str_eq(r[1], "thre"); 10410 ck_assert_str_eq(r[2], "extract"); 10411 listFreeS(r); 10412 // empty delimiter 10413 setValO(self, "AAd"); 10414 setValO(delim, ""); 10415 r = icSplitSmallStringSO(self, delim); 10416 ck_assert_uint_eq(listLengthS(r),1); 10417 ck_assert_str_eq(r[0], "AAd"); 10418 listFreeS(r); 10419 // empty string 10420 emptyO(self); 10421 setValO(delim, "$"); 10422 r = icSplitSmallStringSO(self, delim); 10423 ck_assert_uint_eq(listLengthS(r),1); 10424 ck_assert_str_eq(r[0], ""); 10425 listFreeS(r); 10426 // non smallString object delimiter 10427 terminateO(delim); 10428 delim = (smallStringt*) allocSmallInt(1); 10429 ck_assert_ptr_eq(icSplitSmallStringSO(self, delim), NULL); 10430 terminateO(delim); 10431 // NULL list 10432 freeO(self); 10433 delim = allocSmallString(";"); 10434 ck_assert_ptr_eq(icSplitSmallStringSO(self, delim), NULL); 10435 // NULL delimiter 10436 setValO(self, "test"); 10437 ck_assert_ptr_eq(icSplitSmallStringSO(self, NULL), NULL); 10438 terminateO(delim); 10439 terminateO(self); 10440 10441 } 10442 10443 10444 void icExtractSmallStringT(void) { 10445 10446 smallArrayt* r; 10447 smallStringt *self = allocG(""); 10448 10449 // string 10450 setValO(self, "one/twos"); 10451 r = icExtractO(self, "E", "S"); 10452 ck_assert_ptr_ne(r, null); 10453 char *s = toStringO(r); 10454 ck_assert_str_eq(s, "[\"/two\"]"); 10455 free(s); 10456 terminateO(r); 10457 // delimiter not found 10458 setValO(self, "one/two"); 10459 r = icExtractO(self, "||", "/"); 10460 ck_assert_ptr_eq(r, NULL); 10461 // icExtractO with several delimiters after each other 10462 setValO(self, "one/ two /three "); 10463 r = icExtractO(self, "/", " "); 10464 ck_assert_ptr_ne(r, null); 10465 s = toStringO(r); 10466 ck_assert_str_eq(s, "[\"\",\"three\"]"); 10467 free(s); 10468 terminateO(r); 10469 // multiple character delimiter 10470 setValO(self, "AAe thre|e icExtract"); 10471 r = icExtractO(self, "e ", "|"); 10472 ck_assert_ptr_ne(r, null); 10473 s = toStringO(r); 10474 ck_assert_str_eq(s, "[\"thre\"]"); 10475 free(s); 10476 terminateO(r); 10477 // empty delimiter 10478 setValO(self, "AAd"); 10479 r = icExtractO(self, "", "Ad"); 10480 ck_assert_ptr_eq(r, NULL); 10481 setValO(self, "AAd"); 10482 r = icExtractO(self, "A", ""); 10483 ck_assert_ptr_eq(r, NULL); 10484 // empty string 10485 setValO(self, ""); 10486 r = icExtractO(self, "$", "#"); 10487 ck_assert_ptr_eq(r, NULL); 10488 // delim1 = delim2 10489 setValO(self, ""); 10490 r = icExtractO(self, "$", "$"); 10491 ck_assert_ptr_eq(r, NULL); 10492 // NULL string 10493 freeO(self); 10494 ck_assert_ptr_eq(icExtractO(self, ";", ","), NULL); 10495 // NULL delimiter 10496 setValO(self, "test"); 10497 ck_assert_ptr_eq(icExtractO(self, NULL, ","), NULL); 10498 ck_assert_ptr_eq(icExtractO(self, ",", NULL), NULL); 10499 terminateO(self); 10500 10501 } 10502 10503 10504 void icExtractCharSSmallStringT(void) { 10505 10506 smallArrayt* r; 10507 smallStringt *self = allocG(""); 10508 10509 // string 10510 setValO(self, "one/twos"); 10511 r = icExtractCharSO(self, 'E', "S"); 10512 ck_assert_ptr_ne(r, null); 10513 char *s = toStringO(r); 10514 ck_assert_str_eq(s, "[\"/two\"]"); 10515 free(s); 10516 terminateO(r); 10517 // delimiter not found 10518 setValO(self, "one/two"); 10519 r = icExtractCharSO(self, '|', "/"); 10520 ck_assert_ptr_eq(r, NULL); 10521 // icExtractCharSO with several delimiters after each other 10522 setValO(self, "one/ two /three "); 10523 r = icExtractCharSO(self, '/', " "); 10524 ck_assert_ptr_ne(r, null); 10525 s = toStringO(r); 10526 ck_assert_str_eq(s, "[\"\",\"three\"]"); 10527 free(s); 10528 terminateO(r); 10529 // multiple character delimiter 10530 setValO(self, "AAe thre|e icExtract"); 10531 r = icExtractCharSO(self, ' ', "|e"); 10532 ck_assert_ptr_ne(r, null); 10533 s = toStringO(r); 10534 ck_assert_str_eq(s, "[\"thre\"]"); 10535 free(s); 10536 terminateO(r); 10537 // empty delimiter 10538 setValO(self, "AAd"); 10539 r = icExtractCharSO(self, 'A', ""); 10540 ck_assert_ptr_eq(r, NULL); 10541 // empty string 10542 setValO(self, ""); 10543 r = icExtractCharSO(self, '$', "#"); 10544 ck_assert_ptr_eq(r, NULL); 10545 // delim1 = delim2 10546 setValO(self, ""); 10547 r = icExtractCharSO(self, '$', "$"); 10548 ck_assert_ptr_eq(r, NULL); 10549 // NULL string 10550 freeO(self); 10551 ck_assert_ptr_eq(icExtractCharSO(self, ';', ","), NULL); 10552 // NULL delimiter 10553 setValO(self, "test"); 10554 ck_assert_ptr_eq(icExtractCharSO(self, ',', NULL), NULL); 10555 terminateO(self); 10556 10557 } 10558 10559 10560 void icExtractSCharSmallStringT(void) { 10561 10562 smallArrayt* r; 10563 smallStringt *self = allocG(""); 10564 10565 // string 10566 setValO(self, "one/twos"); 10567 r = icExtractSCharO(self, "E", 'S'); 10568 ck_assert_ptr_ne(r, null); 10569 char *s = toStringO(r); 10570 ck_assert_str_eq(s, "[\"/two\"]"); 10571 free(s); 10572 terminateO(r); 10573 // delimiter not found 10574 setValO(self, "one/two"); 10575 r = icExtractSCharO(self, "||", '/'); 10576 ck_assert_ptr_eq(r, NULL); 10577 // icExtractSCharO with several delimiters after each other 10578 setValO(self, "one/ two /three "); 10579 r = icExtractSCharO(self, "/", ' '); 10580 ck_assert_ptr_ne(r, null); 10581 s = toStringO(r); 10582 ck_assert_str_eq(s, "[\"\",\"three\"]"); 10583 free(s); 10584 terminateO(r); 10585 // multiple character delimiter 10586 setValO(self, "AAe thre|e icExtract"); 10587 r = icExtractSCharO(self, "e ", '|'); 10588 ck_assert_ptr_ne(r, null); 10589 s = toStringO(r); 10590 ck_assert_str_eq(s, "[\"thre\"]"); 10591 free(s); 10592 terminateO(r); 10593 // empty delimiter 10594 setValO(self, "AAd"); 10595 r = icExtractSCharO(self, "", 'A'); 10596 ck_assert_ptr_eq(r, NULL); 10597 // empty string 10598 setValO(self, ""); 10599 r = icExtractSCharO(self, "$", '#'); 10600 ck_assert_ptr_eq(r, NULL); 10601 // delim1 = delim2 10602 setValO(self, ""); 10603 r = icExtractSCharO(self, "$", '$'); 10604 ck_assert_ptr_eq(r, NULL); 10605 // NULL string 10606 freeO(self); 10607 ck_assert_ptr_eq(icExtractSCharO(self, ";", ','), NULL); 10608 // NULL delimiter 10609 setValO(self, "test"); 10610 ck_assert_ptr_eq(icExtractSCharO(self, NULL, ','), NULL); 10611 terminateO(self); 10612 10613 } 10614 10615 10616 void icExtractCharCharSmallStringT(void) { 10617 10618 smallArrayt* r; 10619 smallStringt *self = allocG(""); 10620 10621 // string 10622 setValO(self, "one/twos"); 10623 r = icExtractCharCharO(self, 'E', 'S'); 10624 ck_assert_ptr_ne(r, null); 10625 char *s = toStringO(r); 10626 ck_assert_str_eq(s, "[\"/two\"]"); 10627 free(s); 10628 terminateO(r); 10629 // delimiter not found 10630 setValO(self, "one/two"); 10631 r = icExtractCharCharO(self, '|', '/'); 10632 ck_assert_ptr_eq(r, NULL); 10633 // icExtractCharCharO with several delimiters after each other 10634 setValO(self, "one/ two /three "); 10635 r = icExtractCharCharO(self, '/', ' '); 10636 ck_assert_ptr_ne(r, null); 10637 s = toStringO(r); 10638 ck_assert_str_eq(s, "[\"\",\"three\"]"); 10639 free(s); 10640 terminateO(r); 10641 // multiple character delimiter 10642 setValO(self, "AAe thre|e icExtract"); 10643 r = icExtractCharCharO(self, ' ', '|'); 10644 ck_assert_ptr_ne(r, null); 10645 s = toStringO(r); 10646 ck_assert_str_eq(s, "[\"thre\"]"); 10647 free(s); 10648 terminateO(r); 10649 // empty string 10650 setValO(self, ""); 10651 r = icExtractCharCharO(self, '$', '#'); 10652 ck_assert_ptr_eq(r, NULL); 10653 // delim1 = delim2 10654 setValO(self, ""); 10655 r = icExtractCharCharO(self, '$', '$'); 10656 ck_assert_ptr_eq(r, NULL); 10657 // NULL string 10658 freeO(self); 10659 ck_assert_ptr_eq(icExtractCharCharO(self, ';', ','), NULL); 10660 terminateO(self); 10661 10662 } 10663 10664 10665 void icExtractSmallJsonSmallJsonSmallStringT(void) { 10666 10667 smallArrayt* r; 10668 smallStringt *self = allocG(""); 10669 smallJsont* delim1 = allocSmallJson(); 10670 smallJsont* delim2 = allocSmallJson(); 10671 10672 // string 10673 setValO(self, "one/twos"); 10674 setTopSO(delim1, "E"); 10675 setTopSO(delim2, "S"); 10676 r = icExtractSmallJsonSmallJsonO(self, delim1, delim2); 10677 ck_assert_ptr_ne(r, null); 10678 char *s = toStringO(r); 10679 ck_assert_str_eq(s, "[\"/two\"]"); 10680 free(s); 10681 terminateO(r); 10682 // delimiter not found 10683 setValO(self, "one/two"); 10684 freeO(delim1); 10685 freeO(delim2); 10686 setTopSO(delim1, "||"); 10687 setTopSO(delim2, "/"); 10688 r = icExtractSmallJsonSmallJsonO(self, delim1, delim2); 10689 ck_assert_ptr_eq(r, NULL); 10690 // icExtractSmallJsonSmallJsonO with several delimiters after each other 10691 setValO(self, "one/ two /three "); 10692 freeO(delim1); 10693 freeO(delim2); 10694 setTopSO(delim1, "/"); 10695 setTopSO(delim2, " "); 10696 r = icExtractSmallJsonSmallJsonO(self, delim1, delim2); 10697 ck_assert_ptr_ne(r, null); 10698 s = toStringO(r); 10699 ck_assert_str_eq(s, "[\"\",\"three\"]"); 10700 free(s); 10701 terminateO(r); 10702 // multiple character delimiter 10703 setValO(self, "AAe thre|e icExtract"); 10704 freeO(delim1); 10705 freeO(delim2); 10706 setTopSO(delim1, "e "); 10707 setTopSO(delim2, "|"); 10708 r = icExtractSmallJsonSmallJsonO(self, delim1, delim2); 10709 ck_assert_ptr_ne(r, null); 10710 s = toStringO(r); 10711 ck_assert_str_eq(s, "[\"thre\"]"); 10712 free(s); 10713 terminateO(r); 10714 // empty delimiter 10715 setValO(self, "AAd"); 10716 freeO(delim1); 10717 freeO(delim2); 10718 setTopSO(delim1, ""); 10719 setTopSO(delim2, "Ad"); 10720 r = icExtractSmallJsonSmallJsonO(self, delim1, delim2); 10721 ck_assert_ptr_eq(r, NULL); 10722 setValO(self, "AAd"); 10723 freeO(delim1); 10724 freeO(delim2); 10725 setTopSO(delim1, "A"); 10726 setTopSO(delim2, ""); 10727 r = icExtractSmallJsonSmallJsonO(self, delim1, delim2); 10728 ck_assert_ptr_eq(r, NULL); 10729 // empty string 10730 setValO(self, ""); 10731 freeO(delim1); 10732 freeO(delim2); 10733 setTopSO(delim1, "$"); 10734 setTopSO(delim2, "#"); 10735 r = icExtractSmallJsonSmallJsonO(self, delim1, delim2); 10736 ck_assert_ptr_eq(r, NULL); 10737 // delim1 = delim2 10738 setValO(self, "$qwe$"); 10739 freeO(delim1); 10740 freeO(delim2); 10741 setTopSO(delim1, "$"); 10742 setTopSO(delim2, "$"); 10743 r = icExtractSmallJsonSmallJsonO(self, delim1, delim2); 10744 ck_assert_ptr_eq(r, NULL); 10745 // non json string 10746 freeO(delim1); 10747 r = icExtractSmallJsonSmallJsonO(self, delim1, delim2); 10748 ck_assert_ptr_eq(r, NULL); 10749 setTopSO(delim1, "$"); 10750 freeO(delim2); 10751 r = icExtractSmallJsonSmallJsonO(self, delim1, delim2); 10752 ck_assert_ptr_eq(r, NULL); 10753 // non json object 10754 terminateO(delim1); 10755 delim1 = (smallJsont*) allocSmallInt(1); 10756 setTopSO(delim2, "$"); 10757 r = icExtractSmallJsonSmallJsonO(self, delim1, delim2); 10758 ck_assert_ptr_eq(r, NULL); 10759 terminateO(delim1); 10760 delim1 = allocSmallJson(); 10761 setTopSO(delim1, ";"); 10762 terminateO(delim2); 10763 delim2 = (smallJsont*) allocSmallInt(1); 10764 r = icExtractSmallJsonSmallJsonO(self, delim1, delim2); 10765 ck_assert_ptr_eq(r, NULL); 10766 terminateO(delim2); 10767 delim2 = allocSmallJson(); 10768 // NULL string 10769 freeO(self); 10770 freeO(delim1); 10771 freeO(delim2); 10772 setTopSO(delim1, ";"); 10773 setTopSO(delim2, ","); 10774 ck_assert_ptr_eq(icExtractSmallJsonSmallJsonO(self, delim1, delim2), NULL); 10775 // NULL delimiter 10776 setValO(self, "test"); 10777 ck_assert_ptr_eq(icExtractSmallJsonSmallJsonO(self, NULL, delim2), NULL); 10778 ck_assert_ptr_eq(icExtractSmallJsonSmallJsonO(self, delim1, NULL), NULL); 10779 terminateO(delim1); 10780 terminateO(delim2); 10781 terminateO(self); 10782 10783 } 10784 10785 10786 void icExtractSmallJsonSmallStringSmallStringT(void) { 10787 10788 smallArrayt* r; 10789 smallStringt *self = allocG(""); 10790 smallJsont* delim1 = allocSmallJson(); 10791 smallStringt* delim2 = allocSmallString("S"); 10792 10793 // string 10794 setValO(self, "one/twos"); 10795 setTopSO(delim1, "E"); 10796 r = icExtractSmallJsonSmallStringO(self, delim1, delim2); 10797 ck_assert_ptr_ne(r, null); 10798 char *s = toStringO(r); 10799 ck_assert_str_eq(s, "[\"/two\"]"); 10800 free(s); 10801 terminateO(r); 10802 // delimiter not found 10803 setValO(self, "one/two"); 10804 freeO(delim1); 10805 setTopSO(delim1, "||"); 10806 setValO(delim2, "/"); 10807 r = icExtractSmallJsonSmallStringO(self, delim1, delim2); 10808 ck_assert_ptr_eq(r, NULL); 10809 // icExtractSmallJsonSmallStringO with several delimiters after each other 10810 setValO(self, "one/ two /three "); 10811 freeO(delim1); 10812 setTopSO(delim1, "/"); 10813 setValO(delim2, " "); 10814 r = icExtractSmallJsonSmallStringO(self, delim1, delim2); 10815 ck_assert_ptr_ne(r, null); 10816 s = toStringO(r); 10817 ck_assert_str_eq(s, "[\"\",\"three\"]"); 10818 free(s); 10819 terminateO(r); 10820 // multiple character delimiter 10821 setValO(self, "AAe thre|e icExtract"); 10822 freeO(delim1); 10823 setTopSO(delim1, "e "); 10824 setValO(delim2, "|"); 10825 r = icExtractSmallJsonSmallStringO(self, delim1, delim2); 10826 ck_assert_ptr_ne(r, null); 10827 s = toStringO(r); 10828 ck_assert_str_eq(s, "[\"thre\"]"); 10829 free(s); 10830 terminateO(r); 10831 // empty delimiter 10832 setValO(self, "AAd"); 10833 freeO(delim1); 10834 setTopSO(delim1, ""); 10835 setValO(delim2, "Ad"); 10836 r = icExtractSmallJsonSmallStringO(self, delim1, delim2); 10837 ck_assert_ptr_eq(r, NULL); 10838 setValO(self, "AAd"); 10839 freeO(delim1); 10840 setTopSO(delim1, "A"); 10841 setValO(delim2, ""); 10842 r = icExtractSmallJsonSmallStringO(self, delim1, delim2); 10843 ck_assert_ptr_eq(r, NULL); 10844 // empty string 10845 setValO(self, ""); 10846 freeO(delim1); 10847 setTopSO(delim1, "$"); 10848 setValO(delim2, "#"); 10849 r = icExtractSmallJsonSmallStringO(self, delim1, delim2); 10850 ck_assert_ptr_eq(r, NULL); 10851 // delim1 = delim2 10852 setValO(self, "$qwe$"); 10853 freeO(delim1); 10854 setTopSO(delim1, "$"); 10855 setValO(delim2, "$"); 10856 r = icExtractSmallJsonSmallStringO(self, delim1, delim2); 10857 ck_assert_ptr_eq(r, NULL); 10858 // non json string 10859 freeO(delim1); 10860 r = icExtractSmallJsonSmallStringO(self, delim1, delim2); 10861 ck_assert_ptr_eq(r, NULL); 10862 // non json object 10863 terminateO(delim1); 10864 delim1 = (smallJsont*) allocSmallInt(1); 10865 r = icExtractSmallJsonSmallStringO(self, delim1, delim2); 10866 ck_assert_ptr_eq(r, NULL); 10867 terminateO(delim1); 10868 delim1 = allocSmallJson(); 10869 setTopSO(delim1, ";"); 10870 terminateO(delim2); 10871 delim2 = (smallStringt*) allocSmallInt(1); 10872 r = icExtractSmallJsonSmallStringO(self, delim1, delim2); 10873 ck_assert_ptr_eq(r, NULL); 10874 terminateO(delim2); 10875 delim2 = allocSmallString(","); 10876 // NULL string 10877 freeO(self); 10878 freeO(delim1); 10879 setTopSO(delim1, ";"); 10880 ck_assert_ptr_eq(icExtractSmallJsonSmallStringO(self, delim1, delim2), NULL); 10881 // NULL delimiter 10882 setValO(self, "test"); 10883 ck_assert_ptr_eq(icExtractSmallJsonSmallStringO(self, NULL, delim2), NULL); 10884 ck_assert_ptr_eq(icExtractSmallJsonSmallStringO(self, delim1, NULL), NULL); 10885 terminateO(delim1); 10886 terminateO(delim2); 10887 terminateO(self); 10888 10889 } 10890 10891 10892 void icExtractSmallJsonSSmallStringT(void) { 10893 10894 smallArrayt* r; 10895 smallStringt *self = allocG(""); 10896 smallJsont* delim1 = allocSmallJson(); 10897 10898 // string 10899 setValO(self, "one/twos"); 10900 setTopSO(delim1, "E"); 10901 r = icExtractSmallJsonSO(self, delim1, "S"); 10902 ck_assert_ptr_ne(r, null); 10903 char *s = toStringO(r); 10904 ck_assert_str_eq(s, "[\"/two\"]"); 10905 free(s); 10906 terminateO(r); 10907 // delimiter not found 10908 setValO(self, "one/two"); 10909 freeO(delim1); 10910 setTopSO(delim1, "||"); 10911 r = icExtractSmallJsonSO(self, delim1, "/"); 10912 ck_assert_ptr_eq(r, NULL); 10913 // icExtractSmallJsonSO with several delimiters after each other 10914 setValO(self, "one/ two /three "); 10915 freeO(delim1); 10916 setTopSO(delim1, "/"); 10917 r = icExtractSmallJsonSO(self, delim1, " "); 10918 ck_assert_ptr_ne(r, null); 10919 s = toStringO(r); 10920 ck_assert_str_eq(s, "[\"\",\"three\"]"); 10921 free(s); 10922 terminateO(r); 10923 // multiple character delimiter 10924 setValO(self, "AAe thre|e icExtract"); 10925 freeO(delim1); 10926 setTopSO(delim1, "e "); 10927 r = icExtractSmallJsonSO(self, delim1, "|"); 10928 ck_assert_ptr_ne(r, null); 10929 s = toStringO(r); 10930 ck_assert_str_eq(s, "[\"thre\"]"); 10931 free(s); 10932 terminateO(r); 10933 // empty delimiter 10934 setValO(self, "AAd"); 10935 freeO(delim1); 10936 setTopSO(delim1, ""); 10937 r = icExtractSmallJsonSO(self, delim1, "Ad"); 10938 ck_assert_ptr_eq(r, NULL); 10939 setValO(self, "AAd"); 10940 freeO(delim1); 10941 setTopSO(delim1, "A"); 10942 r = icExtractSmallJsonSO(self, delim1, ""); 10943 ck_assert_ptr_eq(r, NULL); 10944 // empty string 10945 setValO(self, ""); 10946 freeO(delim1); 10947 setTopSO(delim1, "$"); 10948 r = icExtractSmallJsonSO(self, delim1, "#"); 10949 ck_assert_ptr_eq(r, NULL); 10950 // delim1 = delim2 10951 setValO(self, "$qwe$"); 10952 freeO(delim1); 10953 setTopSO(delim1, "$"); 10954 r = icExtractSmallJsonSO(self, delim1, "$"); 10955 ck_assert_ptr_eq(r, NULL); 10956 // non json string 10957 freeO(delim1); 10958 r = icExtractSmallJsonSO(self, delim1, "$"); 10959 ck_assert_ptr_eq(r, NULL); 10960 // non json object 10961 terminateO(delim1); 10962 delim1 = (smallJsont*) allocSmallInt(1); 10963 r = icExtractSmallJsonSO(self, delim1, "$"); 10964 ck_assert_ptr_eq(r, NULL); 10965 terminateO(delim1); 10966 delim1 = allocSmallJson(); 10967 // NULL string 10968 freeO(self); 10969 freeO(delim1); 10970 setTopSO(delim1, ";"); 10971 ck_assert_ptr_eq(icExtractSmallJsonSO(self, delim1, ","), NULL); 10972 // NULL delimiter 10973 setValO(self, "test"); 10974 ck_assert_ptr_eq(icExtractSmallJsonSO(self, NULL, ","), NULL); 10975 ck_assert_ptr_eq(icExtractSmallJsonSO(self, delim1, NULL), NULL); 10976 terminateO(delim1); 10977 terminateO(self); 10978 10979 } 10980 10981 10982 void icExtractSmallJsonCharSmallStringT(void) { 10983 10984 smallArrayt* r; 10985 smallStringt *self = allocG(""); 10986 smallJsont* delim1 = allocSmallJson(); 10987 10988 // string 10989 setValO(self, "one/twos"); 10990 setTopSO(delim1, "E"); 10991 r = icExtractSmallJsonCharO(self, delim1, 'S'); 10992 ck_assert_ptr_ne(r, null); 10993 char *s = toStringO(r); 10994 ck_assert_str_eq(s, "[\"/two\"]"); 10995 free(s); 10996 terminateO(r); 10997 // delimiter not found 10998 setValO(self, "one/two"); 10999 freeO(delim1); 11000 setTopSO(delim1, "||"); 11001 r = icExtractSmallJsonCharO(self, delim1, '/'); 11002 ck_assert_ptr_eq(r, NULL); 11003 // icExtractSmallJsonCharO with several delimiters after each other 11004 setValO(self, "one/ two /three "); 11005 freeO(delim1); 11006 setTopSO(delim1, "/"); 11007 r = icExtractSmallJsonCharO(self, delim1, ' '); 11008 ck_assert_ptr_ne(r, null); 11009 s = toStringO(r); 11010 ck_assert_str_eq(s, "[\"\",\"three\"]"); 11011 free(s); 11012 terminateO(r); 11013 // multiple character delimiter 11014 setValO(self, "AAe thre|e icExtract"); 11015 freeO(delim1); 11016 setTopSO(delim1, "e "); 11017 r = icExtractSmallJsonCharO(self, delim1, '|'); 11018 ck_assert_ptr_ne(r, null); 11019 s = toStringO(r); 11020 ck_assert_str_eq(s, "[\"thre\"]"); 11021 free(s); 11022 terminateO(r); 11023 // empty delimiter 11024 setValO(self, "AAd"); 11025 freeO(delim1); 11026 setTopSO(delim1, ""); 11027 r = icExtractSmallJsonCharO(self, delim1, 'd'); 11028 ck_assert_ptr_eq(r, NULL); 11029 setValO(self, "AAd"); 11030 // empty string 11031 setValO(self, ""); 11032 freeO(delim1); 11033 setTopSO(delim1, "$"); 11034 r = icExtractSmallJsonCharO(self, delim1, '#'); 11035 ck_assert_ptr_eq(r, NULL); 11036 // delim1 = delim2 11037 setValO(self, "$qwe$"); 11038 freeO(delim1); 11039 setTopSO(delim1, "$"); 11040 r = icExtractSmallJsonCharO(self, delim1, '$'); 11041 ck_assert_ptr_eq(r, NULL); 11042 // non json string 11043 freeO(delim1); 11044 r = icExtractSmallJsonCharO(self, delim1, '$'); 11045 ck_assert_ptr_eq(r, NULL); 11046 // non json object 11047 terminateO(delim1); 11048 delim1 = (smallJsont*) allocSmallInt(1); 11049 r = icExtractSmallJsonCharO(self, delim1, '$'); 11050 ck_assert_ptr_eq(r, NULL); 11051 terminateO(delim1); 11052 delim1 = allocSmallJson(); 11053 // NULL string 11054 freeO(self); 11055 freeO(delim1); 11056 setTopSO(delim1, ";"); 11057 ck_assert_ptr_eq(icExtractSmallJsonCharO(self, delim1, ','), NULL); 11058 // NULL delimiter 11059 setValO(self, "test"); 11060 ck_assert_ptr_eq(icExtractSmallJsonCharO(self, NULL, ','), NULL); 11061 terminateO(delim1); 11062 terminateO(self); 11063 11064 } 11065 11066 11067 void icExtractSmallStringSmallJsonSmallStringT(void) { 11068 11069 smallArrayt* r; 11070 smallStringt *self = allocG(""); 11071 smallStringt* delim1 = allocSmallString("E"); 11072 smallJsont* delim2 = allocSmallJson(); 11073 11074 // string 11075 setValO(self, "one/twos"); 11076 setTopSO(delim2, "S"); 11077 r = icExtractSmallStringSmallJsonO(self, delim1, delim2); 11078 ck_assert_ptr_ne(r, null); 11079 char *s = toStringO(r); 11080 ck_assert_str_eq(s, "[\"/two\"]"); 11081 free(s); 11082 terminateO(r); 11083 // delimiter not found 11084 setValO(self, "one/two"); 11085 freeO(delim2); 11086 setValO(delim1, "||"); 11087 setTopSO(delim2, "/"); 11088 r = icExtractSmallStringSmallJsonO(self, delim1, delim2); 11089 ck_assert_ptr_eq(r, NULL); 11090 // icExtractSmallStringSmallJsonO with several delimiters after each other 11091 setValO(self, "one/ two /three "); 11092 freeO(delim2); 11093 setValO(delim1, "/"); 11094 setTopSO(delim2, " "); 11095 r = icExtractSmallStringSmallJsonO(self, delim1, delim2); 11096 ck_assert_ptr_ne(r, null); 11097 s = toStringO(r); 11098 ck_assert_str_eq(s, "[\"\",\"three\"]"); 11099 free(s); 11100 terminateO(r); 11101 // multiple character delimiter 11102 setValO(self, "AAe thre|e icExtract"); 11103 freeO(delim2); 11104 setValO(delim1, "e "); 11105 setTopSO(delim2, "|"); 11106 r = icExtractSmallStringSmallJsonO(self, delim1, delim2); 11107 ck_assert_ptr_ne(r, null); 11108 s = toStringO(r); 11109 ck_assert_str_eq(s, "[\"thre\"]"); 11110 free(s); 11111 terminateO(r); 11112 // empty delimiter 11113 setValO(self, "AAd"); 11114 freeO(delim2); 11115 setValO(delim1, ""); 11116 setTopSO(delim2, "Ad"); 11117 r = icExtractSmallStringSmallJsonO(self, delim1, delim2); 11118 ck_assert_ptr_eq(r, NULL); 11119 setValO(self, "AAd"); 11120 freeO(delim2); 11121 setValO(delim1, "A"); 11122 setTopSO(delim2, ""); 11123 r = icExtractSmallStringSmallJsonO(self, delim1, delim2); 11124 ck_assert_ptr_eq(r, NULL); 11125 // empty string 11126 setValO(self, ""); 11127 freeO(delim2); 11128 setValO(delim1, "$"); 11129 setTopSO(delim2, "#"); 11130 r = icExtractSmallStringSmallJsonO(self, delim1, delim2); 11131 ck_assert_ptr_eq(r, NULL); 11132 // delim1 = delim2 11133 setValO(self, "$qwe$"); 11134 freeO(delim2); 11135 setValO(delim1, "$"); 11136 setTopSO(delim2, "$"); 11137 r = icExtractSmallStringSmallJsonO(self, delim1, delim2); 11138 ck_assert_ptr_eq(r, NULL); 11139 // non json string 11140 freeO(delim2); 11141 r = icExtractSmallStringSmallJsonO(self, delim1, delim2); 11142 ck_assert_ptr_eq(r, NULL); 11143 // non json object 11144 terminateO(delim1); 11145 delim1 = (smallStringt*) allocSmallInt(1); 11146 setTopSO(delim2, "$"); 11147 r = icExtractSmallStringSmallJsonO(self, delim1, delim2); 11148 ck_assert_ptr_eq(r, NULL); 11149 terminateO(delim1); 11150 delim1 = allocSmallString(";"); 11151 terminateO(delim2); 11152 delim2 = (smallJsont*) allocSmallInt(1); 11153 r = icExtractSmallStringSmallJsonO(self, delim1, delim2); 11154 ck_assert_ptr_eq(r, NULL); 11155 terminateO(delim2); 11156 delim2 = allocSmallJson(); 11157 // NULL string 11158 freeO(self); 11159 freeO(delim2); 11160 setValO(delim1, ";"); 11161 setTopSO(delim2, ","); 11162 ck_assert_ptr_eq(icExtractSmallStringSmallJsonO(self, delim1, delim2), NULL); 11163 // NULL delimiter 11164 setValO(self, "test"); 11165 ck_assert_ptr_eq(icExtractSmallStringSmallJsonO(self, NULL, delim2), NULL); 11166 ck_assert_ptr_eq(icExtractSmallStringSmallJsonO(self, delim1, NULL), NULL); 11167 terminateO(delim1); 11168 terminateO(delim2); 11169 terminateO(self); 11170 11171 } 11172 11173 11174 void icExtractSmallStringSmallStringSmallStringT(void) { 11175 11176 smallArrayt* r; 11177 smallStringt *self = allocG(""); 11178 smallStringt* delim1 = allocSmallString("E"); 11179 smallStringt* delim2 = allocSmallString("|"); 11180 11181 // string 11182 setValO(self, "one/twos"); 11183 setValO(delim2, "S"); 11184 r = icExtractSmallStringSmallStringO(self, delim1, delim2); 11185 ck_assert_ptr_ne(r, null); 11186 char *s = toStringO(r); 11187 ck_assert_str_eq(s, "[\"/two\"]"); 11188 free(s); 11189 terminateO(r); 11190 // delimiter not found 11191 setValO(self, "one/two"); 11192 setValO(delim1, "||"); 11193 setValO(delim2, "/"); 11194 r = icExtractSmallStringSmallStringO(self, delim1, delim2); 11195 ck_assert_ptr_eq(r, NULL); 11196 // icExtractSmallStringSmallStringO with several delimiters after each other 11197 setValO(self, "one/ two /three "); 11198 setValO(delim1, "/"); 11199 setValO(delim2, " "); 11200 r = icExtractSmallStringSmallStringO(self, delim1, delim2); 11201 ck_assert_ptr_ne(r, null); 11202 s = toStringO(r); 11203 ck_assert_str_eq(s, "[\"\",\"three\"]"); 11204 free(s); 11205 terminateO(r); 11206 // multiple character delimiter 11207 setValO(self, "AAe thre|e icExtract"); 11208 setValO(delim1, "e "); 11209 setValO(delim2, "|"); 11210 r = icExtractSmallStringSmallStringO(self, delim1, delim2); 11211 ck_assert_ptr_ne(r, null); 11212 s = toStringO(r); 11213 ck_assert_str_eq(s, "[\"thre\"]"); 11214 free(s); 11215 terminateO(r); 11216 // empty delimiter 11217 setValO(self, "AAd"); 11218 setValO(delim1, ""); 11219 setValO(delim2, "Ad"); 11220 r = icExtractSmallStringSmallStringO(self, delim1, delim2); 11221 ck_assert_ptr_eq(r, NULL); 11222 setValO(self, "AAd"); 11223 setValO(delim1, "A"); 11224 setValO(delim2, ""); 11225 r = icExtractSmallStringSmallStringO(self, delim1, delim2); 11226 ck_assert_ptr_eq(r, NULL); 11227 // empty string 11228 setValO(self, ""); 11229 setValO(delim1, "$"); 11230 setValO(delim2, "#"); 11231 r = icExtractSmallStringSmallStringO(self, delim1, delim2); 11232 ck_assert_ptr_eq(r, NULL); 11233 // delim1 = delim2 11234 setValO(self, "$qwe$"); 11235 setValO(delim1, "$"); 11236 setValO(delim2, "$"); 11237 r = icExtractSmallStringSmallStringO(self, delim1, delim2); 11238 ck_assert_ptr_eq(r, NULL); 11239 // non json object 11240 terminateO(delim1); 11241 delim1 = (smallStringt*) allocSmallInt(1); 11242 r = icExtractSmallStringSmallStringO(self, delim1, delim2); 11243 ck_assert_ptr_eq(r, NULL); 11244 terminateO(delim1); 11245 delim1 = allocSmallString(";"); 11246 terminateO(delim2); 11247 delim2 = (smallStringt*) allocSmallInt(1); 11248 r = icExtractSmallStringSmallStringO(self, delim1, delim2); 11249 ck_assert_ptr_eq(r, NULL); 11250 terminateO(delim2); 11251 delim2 = allocSmallString(","); 11252 // NULL string 11253 freeO(self); 11254 setValO(delim1, ";"); 11255 ck_assert_ptr_eq(icExtractSmallStringSmallStringO(self, delim1, delim2), NULL); 11256 // NULL delimiter 11257 setValO(self, "test"); 11258 ck_assert_ptr_eq(icExtractSmallStringSmallStringO(self, NULL, delim2), NULL); 11259 ck_assert_ptr_eq(icExtractSmallStringSmallStringO(self, delim1, NULL), NULL); 11260 terminateO(delim1); 11261 terminateO(delim2); 11262 terminateO(self); 11263 11264 } 11265 11266 11267 void icExtractSmallStringSSmallStringT(void) { 11268 11269 smallArrayt* r; 11270 smallStringt *self = allocG(""); 11271 smallStringt* delim1 = allocSmallString("E"); 11272 11273 // string 11274 setValO(self, "one/twos"); 11275 r = icExtractSmallStringSO(self, delim1, "S"); 11276 ck_assert_ptr_ne(r, null); 11277 char *s = toStringO(r); 11278 ck_assert_str_eq(s, "[\"/two\"]"); 11279 free(s); 11280 terminateO(r); 11281 // delimiter not found 11282 setValO(self, "one/two"); 11283 setValO(delim1, "||"); 11284 r = icExtractSmallStringSO(self, delim1, "/"); 11285 ck_assert_ptr_eq(r, NULL); 11286 // icExtractSmallStringSO with several delimiters after each other 11287 setValO(self, "one/ two /three "); 11288 setValO(delim1, "/"); 11289 r = icExtractSmallStringSO(self, delim1, " "); 11290 ck_assert_ptr_ne(r, null); 11291 s = toStringO(r); 11292 ck_assert_str_eq(s, "[\"\",\"three\"]"); 11293 free(s); 11294 terminateO(r); 11295 // multiple character delimiter 11296 setValO(self, "AAe thre|e icExtract"); 11297 setValO(delim1, "e "); 11298 r = icExtractSmallStringSO(self, delim1, "|"); 11299 ck_assert_ptr_ne(r, null); 11300 s = toStringO(r); 11301 ck_assert_str_eq(s, "[\"thre\"]"); 11302 free(s); 11303 terminateO(r); 11304 // empty delimiter 11305 setValO(self, "AAd"); 11306 setValO(delim1, ""); 11307 r = icExtractSmallStringSO(self, delim1, "Ad"); 11308 ck_assert_ptr_eq(r, NULL); 11309 setValO(self, "AAd"); 11310 setValO(delim1, "A"); 11311 r = icExtractSmallStringSO(self, delim1, ""); 11312 ck_assert_ptr_eq(r, NULL); 11313 // empty string 11314 setValO(self, ""); 11315 setValO(delim1, "$"); 11316 r = icExtractSmallStringSO(self, delim1, "#"); 11317 ck_assert_ptr_eq(r, NULL); 11318 // delim1 = delim2 11319 setValO(self, "$qwe$"); 11320 setValO(delim1, "$"); 11321 r = icExtractSmallStringSO(self, delim1, "$"); 11322 ck_assert_ptr_eq(r, NULL); 11323 // non json object 11324 terminateO(delim1); 11325 delim1 = (smallStringt*) allocSmallInt(1); 11326 r = icExtractSmallStringSO(self, delim1, "$"); 11327 ck_assert_ptr_eq(r, NULL); 11328 terminateO(delim1); 11329 delim1 = allocSmallString(";"); 11330 // NULL string 11331 freeO(self); 11332 setValO(delim1, ";"); 11333 ck_assert_ptr_eq(icExtractSmallStringSO(self, delim1, ","), NULL); 11334 // NULL delimiter 11335 setValO(self, "test"); 11336 ck_assert_ptr_eq(icExtractSmallStringSO(self, NULL, ","), NULL); 11337 ck_assert_ptr_eq(icExtractSmallStringSO(self, delim1, NULL), NULL); 11338 terminateO(delim1); 11339 terminateO(self); 11340 11341 } 11342 11343 11344 void icExtractSmallStringCharSmallStringT(void) { 11345 11346 smallArrayt* r; 11347 smallStringt *self = allocG(""); 11348 smallStringt* delim1 = allocSmallString("E"); 11349 11350 // string 11351 setValO(self, "one/twos"); 11352 r = icExtractSmallStringCharO(self, delim1, 'S'); 11353 ck_assert_ptr_ne(r, null); 11354 char *s = toStringO(r); 11355 ck_assert_str_eq(s, "[\"/two\"]"); 11356 free(s); 11357 terminateO(r); 11358 // delimiter not found 11359 setValO(self, "one/two"); 11360 setValO(delim1, "||"); 11361 r = icExtractSmallStringCharO(self, delim1, '/'); 11362 ck_assert_ptr_eq(r, NULL); 11363 // icExtractSmallStringCharO with several delimiters after each other 11364 setValO(self, "one/ two /three "); 11365 setValO(delim1, "/"); 11366 r = icExtractSmallStringCharO(self, delim1, ' '); 11367 ck_assert_ptr_ne(r, null); 11368 s = toStringO(r); 11369 ck_assert_str_eq(s, "[\"\",\"three\"]"); 11370 free(s); 11371 terminateO(r); 11372 // multiple character delimiter 11373 setValO(self, "AAe thre|e icExtract"); 11374 setValO(delim1, "e "); 11375 r = icExtractSmallStringCharO(self, delim1, '|'); 11376 ck_assert_ptr_ne(r, null); 11377 s = toStringO(r); 11378 ck_assert_str_eq(s, "[\"thre\"]"); 11379 free(s); 11380 terminateO(r); 11381 // empty delimiter 11382 setValO(self, "AAd"); 11383 setValO(delim1, ""); 11384 r = icExtractSmallStringCharO(self, delim1, 'A'); 11385 ck_assert_ptr_eq(r, NULL); 11386 setValO(self, "AAd"); 11387 setValO(delim1, "A"); 11388 // empty string 11389 setValO(self, ""); 11390 setValO(delim1, "$"); 11391 r = icExtractSmallStringCharO(self, delim1, '#'); 11392 ck_assert_ptr_eq(r, NULL); 11393 // delim1 = delim2 11394 setValO(self, "$qwe$"); 11395 setValO(delim1, "$"); 11396 r = icExtractSmallStringCharO(self, delim1, '$'); 11397 ck_assert_ptr_eq(r, NULL); 11398 // non json object 11399 terminateO(delim1); 11400 delim1 = (smallStringt*) allocSmallInt(1); 11401 r = icExtractSmallStringCharO(self, delim1, '$'); 11402 ck_assert_ptr_eq(r, NULL); 11403 terminateO(delim1); 11404 delim1 = allocSmallString(";"); 11405 // NULL string 11406 freeO(self); 11407 setValO(delim1, ";"); 11408 ck_assert_ptr_eq(icExtractSmallStringCharO(self, delim1, ','), NULL); 11409 // NULL delimiter 11410 setValO(self, "test"); 11411 ck_assert_ptr_eq(icExtractSmallStringCharO(self, NULL, ','), NULL); 11412 terminateO(delim1); 11413 terminateO(self); 11414 11415 } 11416 11417 11418 void icExtractSSmallJsonSmallStringT(void) { 11419 11420 smallArrayt* r; 11421 smallStringt *self = allocG(""); 11422 smallJsont* delim2 = allocSmallJson(); 11423 11424 // string 11425 setValO(self, "one/twos"); 11426 setTopSO(delim2, "S"); 11427 r = icExtractSSmallJsonO(self, "E", delim2); 11428 ck_assert_ptr_ne(r, null); 11429 char *s = toStringO(r); 11430 ck_assert_str_eq(s, "[\"/two\"]"); 11431 free(s); 11432 terminateO(r); 11433 // delimiter not found 11434 setValO(self, "one/two"); 11435 freeO(delim2); 11436 setTopSO(delim2, "/"); 11437 r = icExtractSSmallJsonO(self, "||", delim2); 11438 ck_assert_ptr_eq(r, NULL); 11439 // icExtractSSmallJsonO with several delimiters after each other 11440 setValO(self, "one/ two /three "); 11441 freeO(delim2); 11442 setTopSO(delim2, " "); 11443 r = icExtractSSmallJsonO(self, "/", delim2); 11444 ck_assert_ptr_ne(r, null); 11445 s = toStringO(r); 11446 ck_assert_str_eq(s, "[\"\",\"three\"]"); 11447 free(s); 11448 terminateO(r); 11449 // multiple character delimiter 11450 setValO(self, "AAe thre|e icExtract"); 11451 freeO(delim2); 11452 setTopSO(delim2, "|"); 11453 r = icExtractSSmallJsonO(self, "e ", delim2); 11454 ck_assert_ptr_ne(r, null); 11455 s = toStringO(r); 11456 ck_assert_str_eq(s, "[\"thre\"]"); 11457 free(s); 11458 terminateO(r); 11459 // empty delimiter 11460 setValO(self, "AAd"); 11461 freeO(delim2); 11462 setTopSO(delim2, "Ad"); 11463 r = icExtractSSmallJsonO(self, "", delim2); 11464 ck_assert_ptr_eq(r, NULL); 11465 setValO(self, "AAd"); 11466 freeO(delim2); 11467 setTopSO(delim2, ""); 11468 r = icExtractSSmallJsonO(self, "A", delim2); 11469 ck_assert_ptr_eq(r, NULL); 11470 // empty string 11471 setValO(self, ""); 11472 freeO(delim2); 11473 setTopSO(delim2, "#"); 11474 r = icExtractSSmallJsonO(self, "$", delim2); 11475 ck_assert_ptr_eq(r, NULL); 11476 // delim1 = delim2 11477 setValO(self, "$qwe$"); 11478 freeO(delim2); 11479 setTopSO(delim2, "$"); 11480 r = icExtractSSmallJsonO(self, "$", delim2); 11481 ck_assert_ptr_eq(r, NULL); 11482 // non json string 11483 freeO(delim2); 11484 r = icExtractSSmallJsonO(self, "$", delim2); 11485 ck_assert_ptr_eq(r, NULL); 11486 // non json object 11487 terminateO(delim2); 11488 delim2 = (smallJsont*) allocSmallInt(1); 11489 r = icExtractSSmallJsonO(self, ";", delim2); 11490 ck_assert_ptr_eq(r, NULL); 11491 terminateO(delim2); 11492 delim2 = allocSmallJson(); 11493 // NULL string 11494 freeO(self); 11495 freeO(delim2); 11496 setTopSO(delim2, ","); 11497 ck_assert_ptr_eq(icExtractSSmallJsonO(self, ";", delim2), NULL); 11498 // NULL delimiter 11499 setValO(self, "test"); 11500 ck_assert_ptr_eq(icExtractSSmallJsonO(self, NULL, delim2), NULL); 11501 ck_assert_ptr_eq(icExtractSSmallJsonO(self, ";", NULL), NULL); 11502 terminateO(delim2); 11503 terminateO(self); 11504 11505 } 11506 11507 11508 void icExtractSSmallStringSmallStringT(void) { 11509 11510 smallArrayt* r; 11511 smallStringt *self = allocG(""); 11512 smallStringt* delim2 = allocSmallString("|"); 11513 11514 // string 11515 setValO(self, "one/twos"); 11516 setValO(delim2, "S"); 11517 r = icExtractSSmallStringO(self, "E", delim2); 11518 ck_assert_ptr_ne(r, null); 11519 char *s = toStringO(r); 11520 ck_assert_str_eq(s, "[\"/two\"]"); 11521 free(s); 11522 terminateO(r); 11523 // delimiter not found 11524 setValO(self, "one/two"); 11525 setValO(delim2, "/"); 11526 r = icExtractSSmallStringO(self, "||", delim2); 11527 ck_assert_ptr_eq(r, NULL); 11528 // icExtractSSmallStringO with several delimiters after each other 11529 setValO(self, "one/ two /three "); 11530 setValO(delim2, " "); 11531 r = icExtractSSmallStringO(self, "/", delim2); 11532 ck_assert_ptr_ne(r, null); 11533 s = toStringO(r); 11534 ck_assert_str_eq(s, "[\"\",\"three\"]"); 11535 free(s); 11536 terminateO(r); 11537 // multiple character delimiter 11538 setValO(self, "AAe thre|e icExtract"); 11539 setValO(delim2, "|"); 11540 r = icExtractSSmallStringO(self, "e ", delim2); 11541 ck_assert_ptr_ne(r, null); 11542 s = toStringO(r); 11543 ck_assert_str_eq(s, "[\"thre\"]"); 11544 free(s); 11545 terminateO(r); 11546 // empty delimiter 11547 setValO(self, "AAd"); 11548 setValO(delim2, "Ad"); 11549 r = icExtractSSmallStringO(self, "", delim2); 11550 ck_assert_ptr_eq(r, NULL); 11551 setValO(self, "AAd"); 11552 setValO(delim2, ""); 11553 r = icExtractSSmallStringO(self, "A", delim2); 11554 ck_assert_ptr_eq(r, NULL); 11555 // empty string 11556 setValO(self, ""); 11557 setValO(delim2, "#"); 11558 r = icExtractSSmallStringO(self, "$", delim2); 11559 ck_assert_ptr_eq(r, NULL); 11560 // delim1 = delim2 11561 setValO(self, "$qwe$"); 11562 setValO(delim2, "$"); 11563 r = icExtractSSmallStringO(self, "$", delim2); 11564 ck_assert_ptr_eq(r, NULL); 11565 // non json object 11566 terminateO(delim2); 11567 delim2 = (smallStringt*) allocSmallInt(1); 11568 r = icExtractSSmallStringO(self, ";", delim2); 11569 ck_assert_ptr_eq(r, NULL); 11570 terminateO(delim2); 11571 delim2 = allocSmallString(","); 11572 // NULL string 11573 freeO(self); 11574 ck_assert_ptr_eq(icExtractSSmallStringO(self, ";", delim2), NULL); 11575 // NULL delimiter 11576 setValO(self, "test"); 11577 ck_assert_ptr_eq(icExtractSSmallStringO(self, NULL, delim2), NULL); 11578 ck_assert_ptr_eq(icExtractSSmallStringO(self, ";", NULL), NULL); 11579 terminateO(delim2); 11580 terminateO(self); 11581 11582 } 11583 11584 11585 void icExtractCharSmallJsonSmallStringT(void) { 11586 11587 smallArrayt* r; 11588 smallStringt *self = allocG(""); 11589 smallJsont* delim2 = allocSmallJson(); 11590 11591 // string 11592 setValO(self, "one/twos"); 11593 setTopSO(delim2, "S"); 11594 r = icExtractCharSmallJsonO(self, 'E', delim2); 11595 ck_assert_ptr_ne(r, null); 11596 char *s = toStringO(r); 11597 ck_assert_str_eq(s, "[\"/two\"]"); 11598 free(s); 11599 terminateO(r); 11600 // delimiter not found 11601 setValO(self, "one/two"); 11602 freeO(delim2); 11603 setTopSO(delim2, "/"); 11604 r = icExtractCharSmallJsonO(self, '|', delim2); 11605 ck_assert_ptr_eq(r, NULL); 11606 // icExtractCharSmallJsonO with several delimiters after each other 11607 setValO(self, "one/ two /three "); 11608 freeO(delim2); 11609 setTopSO(delim2, " "); 11610 r = icExtractCharSmallJsonO(self, '/', delim2); 11611 ck_assert_ptr_ne(r, null); 11612 s = toStringO(r); 11613 ck_assert_str_eq(s, "[\"\",\"three\"]"); 11614 free(s); 11615 terminateO(r); 11616 // multiple character delimiter 11617 setValO(self, "AAe thre|e icExtract"); 11618 freeO(delim2); 11619 setTopSO(delim2, "|"); 11620 r = icExtractCharSmallJsonO(self, ' ', delim2); 11621 ck_assert_ptr_ne(r, null); 11622 s = toStringO(r); 11623 ck_assert_str_eq(s, "[\"thre\"]"); 11624 free(s); 11625 terminateO(r); 11626 // empty delimiter 11627 setValO(self, "AAd"); 11628 freeO(delim2); 11629 setTopSO(delim2, ""); 11630 r = icExtractCharSmallJsonO(self, 'A', delim2); 11631 ck_assert_ptr_eq(r, NULL); 11632 // empty string 11633 setValO(self, ""); 11634 freeO(delim2); 11635 setTopSO(delim2, "#"); 11636 r = icExtractCharSmallJsonO(self, '$', delim2); 11637 ck_assert_ptr_eq(r, NULL); 11638 // delim1 = delim2 11639 setValO(self, "$qwe$"); 11640 freeO(delim2); 11641 setTopSO(delim2, "$"); 11642 r = icExtractCharSmallJsonO(self, '$', delim2); 11643 ck_assert_ptr_eq(r, NULL); 11644 // non json string 11645 freeO(delim2); 11646 r = icExtractCharSmallJsonO(self, '$', delim2); 11647 ck_assert_ptr_eq(r, NULL); 11648 // non json object 11649 terminateO(delim2); 11650 delim2 = (smallJsont*) allocSmallInt(1); 11651 r = icExtractCharSmallJsonO(self, ';', delim2); 11652 ck_assert_ptr_eq(r, NULL); 11653 terminateO(delim2); 11654 delim2 = allocSmallJson(); 11655 // NULL string 11656 freeO(self); 11657 freeO(delim2); 11658 setTopSO(delim2, ","); 11659 ck_assert_ptr_eq(icExtractCharSmallJsonO(self, ';', delim2), NULL); 11660 // NULL delimiter 11661 setValO(self, "test"); 11662 ck_assert_ptr_eq(icExtractCharSmallJsonO(self, ';', NULL), NULL); 11663 terminateO(delim2); 11664 terminateO(self); 11665 11666 } 11667 11668 11669 void icExtractCharSmallStringSmallStringT(void) { 11670 11671 smallArrayt* r; 11672 smallStringt *self = allocG(""); 11673 smallStringt* delim2 = allocSmallString("|"); 11674 11675 // string 11676 setValO(self, "one/twos"); 11677 setValO(delim2, "S"); 11678 r = icExtractCharSmallStringO(self, 'E', delim2); 11679 ck_assert_ptr_ne(r, null); 11680 char *s = toStringO(r); 11681 ck_assert_str_eq(s, "[\"/two\"]"); 11682 free(s); 11683 terminateO(r); 11684 // delimiter not found 11685 setValO(self, "one/two"); 11686 setValO(delim2, "/"); 11687 r = icExtractCharSmallStringO(self, '|', delim2); 11688 ck_assert_ptr_eq(r, NULL); 11689 // icExtractCharSmallStringO with several delimiters after each other 11690 setValO(self, "one/ two /three "); 11691 setValO(delim2, " "); 11692 r = icExtractCharSmallStringO(self, '/', delim2); 11693 ck_assert_ptr_ne(r, null); 11694 s = toStringO(r); 11695 ck_assert_str_eq(s, "[\"\",\"three\"]"); 11696 free(s); 11697 terminateO(r); 11698 // multiple character delimiter 11699 setValO(self, "AAe thre|e icExtract"); 11700 setValO(delim2, "|e"); 11701 r = icExtractCharSmallStringO(self, ' ', delim2); 11702 ck_assert_ptr_ne(r, null); 11703 s = toStringO(r); 11704 ck_assert_str_eq(s, "[\"thre\"]"); 11705 free(s); 11706 terminateO(r); 11707 // empty delimiter 11708 setValO(self, "AAd"); 11709 setValO(delim2, ""); 11710 r = icExtractCharSmallStringO(self, 'A', delim2); 11711 ck_assert_ptr_eq(r, NULL); 11712 // empty string 11713 setValO(self, ""); 11714 setValO(delim2, "#"); 11715 r = icExtractCharSmallStringO(self, '$', delim2); 11716 ck_assert_ptr_eq(r, NULL); 11717 // delim1 = delim2 11718 setValO(self, "$qwe$"); 11719 setValO(delim2, "$"); 11720 r = icExtractCharSmallStringO(self, '$', delim2); 11721 ck_assert_ptr_eq(r, NULL); 11722 // non json object 11723 terminateO(delim2); 11724 delim2 = (smallStringt*) allocSmallInt(1); 11725 r = icExtractCharSmallStringO(self, ';', delim2); 11726 ck_assert_ptr_eq(r, NULL); 11727 terminateO(delim2); 11728 delim2 = allocSmallString(","); 11729 // NULL string 11730 freeO(self); 11731 ck_assert_ptr_eq(icExtractCharSmallStringO(self, ';', delim2), NULL); 11732 // NULL delimiter 11733 setValO(self, "test"); 11734 ck_assert_ptr_eq(icExtractCharSmallStringO(self, ';', NULL), NULL); 11735 terminateO(delim2); 11736 terminateO(self); 11737 11738 } 11739 11740 11741 void colorSmallStringT(void) { 11742 11743 smallStringt* r; 11744 smallStringt *self = allocG("qwe"); 11745 11746 r = colorO(self, RED); 11747 ck_assert_ptr_ne(r, null); 11748 char *s = toStringO(r); 11749 ck_assert_str_eq(s, RED"qwe"RST); 11750 free(s); 11751 // null color 11752 r = colorO(self, null); 11753 ck_assert_ptr_eq(r, NULL); 11754 // empty self 11755 freeO(self); 11756 r = colorO(self, RED); 11757 ck_assert_ptr_eq(r, NULL); 11758 terminateO(self); 11759 11760 } 11761 11762 11763 void colordSmallStringT(void) { 11764 11765 char* r; 11766 smallStringt *self = allocG("qwe"); 11767 11768 r = colordO(self, RED); 11769 ck_assert_ptr_ne(r, null); 11770 ck_assert_str_eq(r, RED"qwe"RST); 11771 free(r); 11772 // empty string 11773 emptyO(self); 11774 r = colordO(self, RED); 11775 ck_assert_ptr_ne(r, null); 11776 ck_assert_str_eq(r, ""); 11777 free(r); 11778 // null color 11779 r = colordO(self, null); 11780 ck_assert_ptr_eq(r, NULL); 11781 // empty self 11782 freeO(self); 11783 r = colordO(self, RED); 11784 ck_assert_ptr_eq(r, NULL); 11785 terminateO(self); 11786 11787 } 11788 11789 11790 void readFileSmallStringT(void) { 11791 11792 smallStringt* r; 11793 smallStringt *self = allocG(""); 11794 11795 // text 11796 r = readFileO(self, "../textTest.null"); 11797 ck_assert_ptr_ne(r, null); 11798 char *s = toStringO(r); 11799 ck_assert_str_eq(s, "LINE 1\nANOTHER line\n"); 11800 free(s); 11801 // empty text 11802 r = readFileO(self, "../chmodTest.null"); 11803 ck_assert_ptr_ne(r, null); 11804 s = toStringO(r); 11805 ck_assert_str_eq(s, ""); 11806 free(s); 11807 fileChmod("../writeOnlyText.null", S_IWUSR | S_IWGRP | S_IWOTH); 11808 ck_assert_ptr_eq(readFileO(self, "../writeOnlyText.null"), NULL); 11809 fileChmod("../writeOnlyText.null", S_IRUSR |S_IWUSR | S_IRGRP | S_IROTH); 11810 // blank path 11811 ck_assert_ptr_eq(readFileO(self, ""), NULL); 11812 // NULL path 11813 ck_assert_ptr_eq(readFileO(self, NULL), NULL); 11814 // non existing path 11815 if (fileExists("nonExistingFile")) 11816 rmAll("nonExistingFile"); 11817 ck_assert_ptr_eq(readFileO(self, "nonExistingFile"), NULL); 11818 terminateO(self); 11819 11820 } 11821 11822 11823 void readFileSmallJsonSmallStringT(void) { 11824 11825 smallStringt* r; 11826 smallStringt *self = allocG(""); 11827 smallJsont *filePath = allocSmallJson(); 11828 11829 // text 11830 setTopSO(filePath, "../textTest.null"); 11831 r = self->f->readFileSmallJson(self, filePath); 11832 ck_assert_ptr_ne(r, null); 11833 char *s = toStringO(r); 11834 ck_assert_str_eq(s, "LINE 1\nANOTHER line\n"); 11835 free(s); 11836 // empty text 11837 freeO(filePath); 11838 setTopSO(filePath, "../chmodTest.null"); 11839 r = self->f->readFileSmallJson(self, filePath); 11840 ck_assert_ptr_ne(r, null); 11841 s = toStringO(r); 11842 ck_assert_str_eq(s, ""); 11843 free(s); 11844 freeO(filePath); 11845 fileChmod("../writeOnlyText.null", S_IWUSR | S_IWGRP | S_IWOTH); 11846 setTopSO(filePath, "../writeOnlyText.null"); 11847 ck_assert_ptr_eq(self->f->readFileSmallJson(self, filePath), NULL); 11848 fileChmod("../writeOnlyText.null", S_IRUSR |S_IWUSR | S_IRGRP | S_IROTH); 11849 // blank path 11850 freeO(filePath); 11851 setTopSO(filePath, ""); 11852 ck_assert_ptr_eq(self->f->readFileSmallJson(self, filePath), NULL); 11853 // non json string 11854 freeO(filePath); 11855 ck_assert_ptr_eq(self->f->readFileSmallJson(self, filePath), NULL); 11856 // non json object 11857 terminateO(filePath); 11858 filePath = (smallJsont*) allocSmallInt(1); 11859 ck_assert_ptr_eq(self->f->readFileSmallJson(self, filePath), NULL); 11860 terminateO(filePath); 11861 // NULL path 11862 ck_assert_ptr_eq(self->f->readFileSmallJson(self, NULL), NULL); 11863 // non existing path 11864 if (fileExists("nonExistingFile")) 11865 rmAll("nonExistingFile"); 11866 filePath = allocSmallJson(); 11867 setTopSO(filePath, "nonExistingFile"); 11868 ck_assert_ptr_eq(self->f->readFileSmallJson(self, filePath), NULL); 11869 terminateO(filePath); 11870 terminateO(self); 11871 11872 } 11873 11874 11875 void readFileSmallStringSmallStringT(void) { 11876 11877 smallStringt* r; 11878 smallStringt *self = allocG(""); 11879 smallStringt *filePath = allocSmallString(""); 11880 11881 // text 11882 setValO(filePath, "../textTest.null"); 11883 r = self->f->readFileSmallString(self, filePath); 11884 ck_assert_ptr_ne(r, null); 11885 char *s = toStringO(r); 11886 ck_assert_str_eq(s, "LINE 1\nANOTHER line\n"); 11887 free(s); 11888 // empty text 11889 setValO(filePath, "../chmodTest.null"); 11890 r = self->f->readFileSmallString(self, filePath); 11891 ck_assert_ptr_ne(r, null); 11892 s = toStringO(r); 11893 ck_assert_str_eq(s, ""); 11894 free(s); 11895 fileChmod("../writeOnlyText.null", S_IWUSR | S_IWGRP | S_IWOTH); 11896 setValO(filePath, "../writeOnlyText.null"); 11897 ck_assert_ptr_eq(self->f->readFileSmallString(self, filePath), NULL); 11898 fileChmod("../writeOnlyText.null", S_IRUSR |S_IWUSR | S_IRGRP | S_IROTH); 11899 // blank path 11900 setValO(filePath, ""); 11901 ck_assert_ptr_eq(self->f->readFileSmallString(self, filePath), NULL); 11902 // non empty filePath 11903 freeO(filePath); 11904 ck_assert_ptr_eq(self->f->readFileSmallString(self, filePath), NULL); 11905 // non smallString object 11906 terminateO(filePath); 11907 filePath = (smallStringt*) allocSmallInt(1); 11908 ck_assert_ptr_eq(self->f->readFileSmallString(self, filePath), NULL); 11909 terminateO(filePath); 11910 // NULL path 11911 ck_assert_ptr_eq(self->f->readFileSmallString(self, NULL), NULL); 11912 // non existing path 11913 if (fileExists("nonExistingFile")) 11914 rmAll("nonExistingFile"); 11915 filePath = allocSmallString("nonExistingFile"); 11916 ck_assert_ptr_eq(self->f->readFileSmallString(self, filePath), NULL); 11917 terminateO(filePath); 11918 terminateO(self); 11919 11920 } 11921 11922 11923 void readStreamSmallStringT(void) { 11924 11925 smallStringt* r; 11926 smallStringt *self = allocG(""); 11927 FILE *f; 11928 11929 // text 11930 f = fopen("../textTest.null", "r"); 11931 r = readStreamO(self, f); 11932 ck_assert_ptr_ne(r, null); 11933 char *s = toStringO(r); 11934 ck_assert_str_eq(s, "LINE 1\nANOTHER line\n"); 11935 free(s); 11936 fclose(f); 11937 // empty text 11938 f = fopen("../chmodTest.null", "r"); 11939 r = readStreamO(self, f); 11940 ck_assert_ptr_ne(r, null); 11941 s = toStringO(r); 11942 ck_assert_str_eq(s, ""); 11943 free(s); 11944 fclose(f); 11945 // null file 11946 ck_assert_ptr_eq(readStreamO(self, null), null); 11947 terminateO(self); 11948 11949 } 11950 11951 11952 void writeFileSmallStringT(void) { 11953 11954 int r; 11955 smallStringt *self = allocG(""); 11956 11957 // write textOutTest.null 11958 readFileO(self, "../textTest.null"); 11959 r = writeFileO(self, "textOutTest.null"); 11960 ck_assert(r); 11961 // check textOutTest.null 11962 freeO(self); 11963 readFileO(self, "textOutTest.null"); 11964 ck_assert_uint_eq(lenO(self),20); 11965 char *s = toStringO(self); 11966 ck_assert_str_eq(s, "LINE 1\nANOTHER line\n"); 11967 free(s); 11968 // non existing file 11969 // make sure the file doesnt exist 11970 if (fileExists("nonExistingFile")) 11971 rmAll("nonExistingFile"); 11972 ck_assert(writeFileO(self, "nonExistingFile")); 11973 if (fileExists("nonExistingFile")) 11974 rmAll("nonExistingFile"); 11975 // blank file name 11976 ck_assert(!writeFileO(self, " ")); 11977 // read only path 11978 ck_assert(!writeFileO(self, "/nonExistingFile")); 11979 // NULL path 11980 ck_assert(!writeFileO(self, NULL)); 11981 // NULL string 11982 freeO(self); 11983 ck_assert(!writeFileO(self, "a")); 11984 terminateO(self); 11985 11986 } 11987 11988 11989 void writeFileSmallJsonSmallStringT(void) { 11990 11991 int r; 11992 smallStringt *self = allocG(""); 11993 smallJsont *filePath = allocSmallJson(); 11994 11995 // write textOutTest.null 11996 setTopSO(filePath, "textOutTest.null"); 11997 readFileO(self, "../textTest.null"); 11998 r = self->f->writeFileSmallJson(self, filePath); 11999 ck_assert(r); 12000 // check textOutTest.null 12001 freeO(self); 12002 readFileO(self, "textOutTest.null"); 12003 ck_assert_uint_eq(lenO(self),20); 12004 char *s = toStringO(self); 12005 ck_assert_str_eq(s, "LINE 1\nANOTHER line\n"); 12006 free(s); 12007 // non existing file 12008 // make sure the file doesnt exist 12009 if (fileExists("nonExistingFile")) 12010 rmAll("nonExistingFile"); 12011 freeO(filePath); 12012 setTopSO(filePath, "textOutTest.null"); 12013 ck_assert(self->f->writeFileSmallJson(self, filePath)); 12014 if (fileExists("nonExistingFile")) 12015 rmAll("nonExistingFile"); 12016 // blank file name 12017 freeO(filePath); 12018 setTopSO(filePath, " "); 12019 ck_assert(!self->f->writeFileSmallJson(self, filePath)); 12020 // read only path 12021 freeO(filePath); 12022 setTopSO(filePath, "/nonExistingFile"); 12023 ck_assert(!self->f->writeFileSmallJson(self, filePath)); 12024 // non json string 12025 freeO(filePath); 12026 ck_assert(!self->f->writeFileSmallJson(self, filePath)); 12027 // non json object 12028 terminateO(filePath); 12029 filePath = (smallJsont*) allocSmallInt(1); 12030 ck_assert(!self->f->writeFileSmallJson(self, filePath)); 12031 terminateO(filePath); 12032 // NULL path 12033 ck_assert(!self->f->writeFileSmallJson(self, NULL)); 12034 // NULL string 12035 freeO(self); 12036 filePath = allocSmallJson(); 12037 setTopSO(filePath, "a"); 12038 ck_assert(!self->f->writeFileSmallJson(self, filePath)); 12039 terminateO(filePath); 12040 terminateO(self); 12041 12042 } 12043 12044 12045 void writeFileSmallStringSmallStringT(void) { 12046 12047 int r; 12048 smallStringt *self = allocG(""); 12049 smallStringt *filePath = allocSmallString(""); 12050 12051 // write textOutTest.null 12052 setValO(filePath, "textOutTest.null"); 12053 readFileO(self, "../textTest.null"); 12054 r = self->f->writeFileSmallString(self, filePath); 12055 ck_assert(r); 12056 // check textOutTest.null 12057 freeO(self); 12058 readFileO(self, "textOutTest.null"); 12059 ck_assert_uint_eq(lenO(self),20); 12060 char *s = toStringO(self); 12061 ck_assert_str_eq(s, "LINE 1\nANOTHER line\n"); 12062 free(s); 12063 // non existing file 12064 // make sure the file doesnt exist 12065 if (fileExists("nonExistingFile")) 12066 rmAll("nonExistingFile"); 12067 setValO(filePath, "textOutTest.null"); 12068 ck_assert(self->f->writeFileSmallString(self, filePath)); 12069 if (fileExists("nonExistingFile")) 12070 rmAll("nonExistingFile"); 12071 // blank file name 12072 setValO(filePath, " "); 12073 ck_assert(!self->f->writeFileSmallString(self, filePath)); 12074 // read only path 12075 setValO(filePath, "/nonExistingFile"); 12076 ck_assert(!self->f->writeFileSmallString(self, filePath)); 12077 // non smallString object 12078 terminateO(filePath); 12079 filePath = (smallStringt*) allocSmallInt(1); 12080 ck_assert(!self->f->writeFileSmallString(self, filePath)); 12081 terminateO(filePath); 12082 // NULL path 12083 ck_assert(!self->f->writeFileSmallString(self, NULL)); 12084 // NULL string 12085 freeO(self); 12086 filePath = allocSmallString("a"); 12087 ck_assert(!self->f->writeFileSmallString(self, filePath)); 12088 terminateO(filePath); 12089 terminateO(self); 12090 12091 } 12092 12093 12094 void writeStreamSmallStringT(void) { 12095 12096 int r; 12097 smallStringt *self = allocG(""); 12098 FILE *f; 12099 12100 // write textOutTest.null 12101 readFileO(self, "../textTest.null"); 12102 f = fopen("textOutTest.null", "w"); 12103 r = writeStreamO(self, f); 12104 ck_assert(r); 12105 fclose(f); 12106 // check textOutTest.null 12107 freeO(self); 12108 readFileO(self, "textOutTest.null"); 12109 ck_assert_uint_eq(lenO(self),20); 12110 ck_assert_str_eq(ssGet(self), "LINE 1\nANOTHER line\n"); 12111 // NULL file 12112 setValO(self, "qwe"); 12113 ck_assert(!writeStreamO(self, NULL)); 12114 // NULL string 12115 freeO(self); 12116 ck_assert(!writeStreamO(self, f)); 12117 terminateO(self); 12118 12119 } 12120 12121 12122 void appendFileSmallStringT(void) { 12123 12124 int r; 12125 smallStringt *self = allocG(""); 12126 12127 // write textOutTest.null 12128 setValO(self, "appended line\n"); 12129 r = appendFileO(self, "appendTextOutTest.null"); 12130 ck_assert(r); 12131 setValO(self, "appended line 2\n"); 12132 r = appendFileO(self, "appendTextOutTest.null"); 12133 ck_assert(r); 12134 // check textOutTest.null 12135 freeO(self); 12136 readFileO(self, "appendTextOutTest.null"); 12137 ck_assert_uint_eq(lenO(self),30); 12138 ck_assert_str_eq(ssGet(self), "appended line\nappended line 2\n"); 12139 if (fileExists("appendTextOutTest.null")) 12140 rmAll("appendTextOutTest.null"); 12141 // blank file name 12142 ck_assert(!appendFileO(self, " ")); 12143 // read only path 12144 ck_assert(!appendFileO(self, "/nonExistingFile")); 12145 // NULL path 12146 ck_assert(!appendFileO(self, NULL)); 12147 // NULL string 12148 freeO(self); 12149 ck_assert(!appendFileO(self, "a")); 12150 terminateO(self); 12151 12152 } 12153 12154 12155 void appendFileSmallStringSmallStringT(void) { 12156 12157 int r; 12158 smallStringt *self = allocG(""); 12159 smallStringt *filePath = allocSmallString(""); 12160 12161 // write textOutTest.null 12162 setValO(self, "appended line\n"); 12163 setValO(filePath, "appendTextOutTest.null"); 12164 r = appendFileSmallStringO(self, filePath); 12165 ck_assert(r); 12166 setValO(self, "appended line 2\n"); 12167 r = appendFileSmallStringO(self, filePath); 12168 ck_assert(r); 12169 // check textOutTest.null 12170 freeO(self); 12171 readFileO(self, "appendTextOutTest.null"); 12172 ck_assert_uint_eq(lenO(self),30); 12173 ck_assert_str_eq(ssGet(self), "appended line\nappended line 2\n"); 12174 if (fileExists("appendTextOutTest.null")) 12175 rmAll("appendTextOutTest.null"); 12176 // blank file name 12177 setValO(filePath, " "); 12178 ck_assert(!appendFileSmallStringO(self, filePath)); 12179 // read only path 12180 setValO(filePath, "/nonExistingFile"); 12181 ck_assert(!appendFileSmallStringO(self, filePath)); 12182 // non smallString path 12183 terminateO(filePath); 12184 filePath = (smallStringt*) allocSmallInt(1); 12185 ck_assert(!appendFileSmallStringO(self, filePath)); 12186 terminateO(filePath); 12187 // NULL path 12188 ck_assert(!appendFileSmallStringO(self, NULL)); 12189 // NULL string 12190 freeO(self); 12191 filePath = allocSmallString("a"); 12192 ck_assert(!appendFileSmallStringO(self, filePath)); 12193 terminateO(filePath); 12194 terminateO(self); 12195 12196 } 12197 12198 12199 void duplicateSmallStringGT(void) { 12200 12201 smallStringt* r; 12202 smallStringt *self = allocG("qwe"); 12203 12204 r = duplicateSmallStringG(self); 12205 ck_assert_ptr_ne(r, null); 12206 ck_assert_str_eq(ssGet(r), ssGet(self)); 12207 terminateO(r); 12208 terminateO(self); 12209 12210 } 12211 12212 12213 void freeSmallStringGT(void) { 12214 12215 smallStringt *self = allocG(""); 12216 12217 freeSmallStringG(self); 12218 ck_assert_ptr_eq(self->data, null); 12219 terminateO(self); 12220 12221 } 12222 12223 12224 void setBoolSmallStringGT(void) { 12225 12226 smallStringt* r; 12227 smallStringt* self = allocG(""); 12228 12229 r = setBoolSmallStringG(self, false); 12230 ck_assert_ptr_ne(r, null); 12231 char *s = toStringO(r); 12232 ck_assert_str_eq(s, "false"); 12233 free(s); 12234 terminateO(self); 12235 12236 } 12237 12238 12239 void setDoubleSmallStringGT(void) { 12240 12241 smallStringt* r; 12242 smallStringt* self = allocG(""); 12243 12244 r = setDoubleSmallStringG(self, 2.2); 12245 ck_assert_ptr_ne(r, null); 12246 char *s = toStringO(r); 12247 ck_assert_str_eq(s, "2.200000e+00"); 12248 free(s); 12249 terminateO(self); 12250 12251 } 12252 12253 12254 void setInt64SmallStringGT(void) { 12255 12256 smallStringt* r; 12257 smallStringt* self = allocG(""); 12258 12259 r = setInt64SmallStringG(self, 2); 12260 ck_assert_ptr_ne(r, null); 12261 char *s = toStringO(r); 12262 ck_assert_str_eq(s, "2"); 12263 free(s); 12264 terminateO(self); 12265 12266 } 12267 12268 12269 void setInt32SmallStringGT(void) { 12270 12271 smallStringt* r; 12272 smallStringt* self = allocG(""); 12273 12274 r = setInt32SmallStringG(self, 2); 12275 ck_assert_ptr_ne(r, null); 12276 char *s = toStringO(r); 12277 ck_assert_str_eq(s, "2"); 12278 free(s); 12279 terminateO(self); 12280 12281 } 12282 12283 12284 void setUint32SmallStringGT(void) { 12285 12286 smallStringt* r; 12287 smallStringt* self = allocG(""); 12288 12289 r = setUint32SmallStringG(self, 2); 12290 ck_assert_ptr_ne(r, null); 12291 char *s = toStringO(r); 12292 ck_assert_str_eq(s, "2"); 12293 free(s); 12294 terminateO(self); 12295 12296 } 12297 12298 12299 void setUint64SmallStringGT(void) { 12300 12301 smallStringt* r; 12302 smallStringt* self = allocG(""); 12303 12304 r = setUint64SmallStringG(self, 2); 12305 ck_assert_ptr_ne(r, null); 12306 char *s = toStringO(r); 12307 ck_assert_str_eq(s, "2"); 12308 free(s); 12309 terminateO(self); 12310 12311 } 12312 12313 12314 void setSmallStringGT(void) { 12315 12316 smallStringt* r; 12317 smallStringt* self = allocG(""); 12318 12319 r = setSmallStringG(self, "qwe"); 12320 ck_assert_ptr_ne(r, null); 12321 char *s = toStringO(r); 12322 ck_assert_str_eq(s, "qwe"); 12323 free(s); 12324 terminateO(self); 12325 12326 } 12327 12328 12329 void setCharSmallStringGT(void) { 12330 12331 smallStringt* r; 12332 smallStringt *self = allocG(""); 12333 12334 r = setCharSmallStringG(self, 'q'); 12335 ck_assert_ptr_ne(r, null); 12336 char *s = toStringO(r); 12337 ck_assert_str_eq(s, "q"); 12338 free(s); 12339 terminateO(self); 12340 12341 } 12342 12343 12344 void setSmallArraySmallStringGT(void) { 12345 12346 smallStringt* r; 12347 smallStringt* self = allocG(""); 12348 smallArrayt* p2 = allocSmallArray(); 12349 12350 p2->f->pushS(p2, "asd"); 12351 r = setSmallArraySmallStringG(self, p2); 12352 ck_assert_ptr_ne(r, null); 12353 char *s = toStringO(r); 12354 ck_assert_str_eq(s, "[\"asd\"]"); 12355 free(s); 12356 terminateO(p2); 12357 terminateO(self); 12358 12359 } 12360 12361 12362 void setFromSmallDictSmallStringGT(void) { 12363 12364 smallStringt* r; 12365 smallStringt* self = allocG(""); 12366 smallDictt* p2 = allocSmallDict(); 12367 12368 p2->f->setS(p2, "1", "asd"); 12369 r = setFromSmallDictSmallStringG(self, p2); 12370 ck_assert_ptr_ne(r, null); 12371 char *s = toStringO(r); 12372 ck_assert_str_eq(s, "{\"1\":\"asd\"}"); 12373 free(s); 12374 terminateO(p2); 12375 terminateO(self); 12376 12377 } 12378 12379 12380 void setFromSmallJsonSmallStringGT(void) { 12381 12382 smallStringt* r; 12383 smallStringt* self = allocG(""); 12384 smallJsont* p2 = allocSmallJson(); 12385 12386 p2->f->setS(p2, "1", "asd"); 12387 r = setFromSmallJsonSmallStringG(self, p2); 12388 ck_assert_ptr_ne(r, null); 12389 char *s = toStringO(r); 12390 ck_assert_str_eq(s, "{\"1\":\"asd\"}"); 12391 free(s); 12392 terminateO(p2); 12393 terminateO(self); 12394 12395 } 12396 12397 12398 void setSmallBoolSmallStringGT(void) { 12399 12400 smallStringt* r; 12401 smallStringt* self = allocG(""); 12402 smallBoolt* p2 = allocSmallBool(true); 12403 12404 r = setSmallBoolSmallStringG(self, p2); 12405 ck_assert_ptr_ne(r, null); 12406 char *s = toStringO(r); 12407 ck_assert_str_eq(s, "true"); 12408 free(s); 12409 terminateO(p2); 12410 terminateO(self); 12411 12412 } 12413 12414 12415 void setSmallDoubleSmallStringGT(void) { 12416 12417 smallStringt* r; 12418 smallStringt* self = allocG(""); 12419 smallDoublet* p2 = allocSmallDouble(2.2); 12420 12421 r = setSmallDoubleSmallStringG(self, p2); 12422 ck_assert_ptr_ne(r, null); 12423 char *s = toStringO(r); 12424 ck_assert_str_eq(s, "2.200000e+00"); 12425 free(s); 12426 terminateO(p2); 12427 terminateO(self); 12428 12429 } 12430 12431 12432 void setSmallIntSmallStringGT(void) { 12433 12434 smallStringt* r; 12435 smallStringt* self = allocG(""); 12436 smallIntt* p2 = allocSmallInt(2); 12437 12438 r = setSmallIntSmallStringG(self, p2); 12439 ck_assert_ptr_ne(r, null); 12440 char *s = toStringO(r); 12441 ck_assert_str_eq(s, "2"); 12442 free(s); 12443 terminateO(p2); 12444 terminateO(self); 12445 12446 } 12447 12448 12449 void setSmallJsonSmallStringGT(void) { 12450 12451 smallStringt* r; 12452 smallStringt* self = allocG(""); 12453 smallJsont* p2 = allocSmallJson(); 12454 12455 setTopBoolO(p2, true); 12456 r = setSmallJsonSmallStringG(self, p2); 12457 ck_assert_ptr_ne(r, null); 12458 char *s = toStringO(r); 12459 ck_assert_str_eq(s, "true"); 12460 free(s); 12461 terminateO(p2); 12462 terminateO(self); 12463 12464 } 12465 12466 12467 void setSmallStringSmallStringGT(void) { 12468 12469 smallStringt* r; 12470 smallStringt* self = allocG(""); 12471 smallStringt* p2 = allocSmallString("qwe"); 12472 12473 r = setSmallStringSmallStringG(self, p2); 12474 ck_assert_ptr_ne(r, null); 12475 char *s = toStringO(r); 12476 ck_assert_str_eq(s, "qwe"); 12477 free(s); 12478 terminateO(p2); 12479 terminateO(self); 12480 12481 } 12482 12483 12484 void getAtSmallStringGT(void) { 12485 12486 smallStringt *self = allocG(""); 12487 12488 setValO(self, "sheepy"); 12489 ck_assert_uint_eq(getAtSmallStringG(self, 0, 0), 's'); 12490 terminateO(self); 12491 12492 } 12493 12494 12495 void setAtSmallStringGT(void) { 12496 12497 smallStringt* r; 12498 smallStringt *self = allocG("a"); 12499 12500 r = setAtSmallStringG(self, 0, 'S'); 12501 ck_assert_ptr_ne(r, null); 12502 ck_assert_uint_eq(ssGet(self)[0], 'S'); 12503 terminateO(self); 12504 12505 } 12506 12507 12508 void appendSmallStringGT(void) { 12509 12510 smallStringt* r; 12511 smallStringt *self = allocG("qwe"); 12512 smallStringt *string = allocSmallString("!@#"); 12513 12514 r = appendSmallStringG(self, string); 12515 ck_assert_ptr_ne(r, null); 12516 char *s = toStringO(r); 12517 ck_assert_str_eq(s, "qwe!@#"); 12518 free(s); 12519 terminateO(string); 12520 terminateO(self); 12521 12522 } 12523 12524 12525 void appendSmallJsonSmallStringGT(void) { 12526 12527 smallStringt* r; 12528 smallStringt *self = allocG("qwe"); 12529 smallJsont *string = allocSmallJson(); 12530 12531 setTopSO(string, "!@#"); 12532 r = appendSmallJsonSmallStringG(self, string); 12533 ck_assert_ptr_ne(r, null); 12534 char *s = toStringO(r); 12535 ck_assert_str_eq(s, "qwe!@#"); 12536 free(s); 12537 terminateO(string); 12538 terminateO(self); 12539 12540 } 12541 12542 12543 void appendSSmallStringGT(void) { 12544 12545 smallStringt* r; 12546 smallStringt *self = allocG("qwe"); 12547 12548 r = appendSSmallStringG(self, "!@#"); 12549 ck_assert_ptr_ne(r, null); 12550 char *s = toStringO(r); 12551 ck_assert_str_eq(s, "qwe!@#"); 12552 free(s); 12553 terminateO(self); 12554 12555 } 12556 12557 12558 void appendCharSmallStringGT(void) { 12559 12560 smallStringt* r; 12561 smallStringt *self = allocG("qwe"); 12562 12563 r = appendCharSmallStringG(self, '!'); 12564 ck_assert_ptr_ne(r, null); 12565 char *s = toStringO(r); 12566 ck_assert_str_eq(s, "qwe!"); 12567 free(s); 12568 terminateO(self); 12569 12570 } 12571 12572 12573 void appendNSmashSmallStringGT(void) { 12574 12575 smallStringt* r; 12576 smallStringt *self = allocG("qwe"); 12577 smallStringt *string = allocSmallString("!@#"); 12578 12579 r = appendNSmashSmallStringG(self, string); 12580 ck_assert_ptr_ne(r, null); 12581 char *s = toStringO(r); 12582 ck_assert_str_eq(s, "qwe!@#"); 12583 free(s); 12584 terminateO(self); 12585 12586 } 12587 12588 12589 void appendNSmashSmallJsonSmallStringGT(void) { 12590 12591 smallStringt* r; 12592 smallStringt *self = allocG("qwe"); 12593 smallJsont *string = allocSmallJson(); 12594 12595 setTopSO(string, "!@#"); 12596 r = appendNSmashSmallJsonSmallStringG(self, string); 12597 ck_assert_ptr_ne(r, null); 12598 char *s = toStringO(r); 12599 ck_assert_str_eq(s, "qwe!@#"); 12600 free(s); 12601 terminateO(self); 12602 12603 } 12604 12605 12606 void appendNSmashSSmallStringGT(void) { 12607 12608 smallStringt* r; 12609 smallStringt *self = allocG("qwe"); 12610 12611 r = appendNSmashSSmallStringG(self, strdup("!@#")); 12612 ck_assert_ptr_ne(r, null); 12613 char *s = toStringO(r); 12614 ck_assert_str_eq(s, "qwe!@#"); 12615 free(s); 12616 terminateO(self); 12617 12618 } 12619 12620 12621 void prependSmallStringGT(void) { 12622 12623 smallStringt* r; 12624 smallStringt *self = allocG("qwe"); 12625 smallStringt *string = allocSmallString("!@#"); 12626 12627 r = prependSmallStringG(self, string); 12628 ck_assert_ptr_ne(r, null); 12629 char *s = toStringO(r); 12630 ck_assert_str_eq(s, "!@#qwe"); 12631 free(s); 12632 terminateO(string); 12633 terminateO(self); 12634 12635 } 12636 12637 12638 void prependSmallJsonSmallStringGT(void) { 12639 12640 smallStringt* r; 12641 smallStringt *self = allocG("qwe"); 12642 smallJsont *string = allocSmallJson(); 12643 12644 setTopSO(string, "!@#"); 12645 r = prependSmallJsonSmallStringG(self, string); 12646 ck_assert_ptr_ne(r, null); 12647 char *s = toStringO(r); 12648 ck_assert_str_eq(s, "!@#qwe"); 12649 free(s); 12650 terminateO(string); 12651 terminateO(self); 12652 12653 } 12654 12655 12656 void prependSSmallStringGT(void) { 12657 12658 smallStringt* r; 12659 smallStringt *self = allocG("qwe"); 12660 12661 r = prependSSmallStringG(self, "!@#"); 12662 ck_assert_ptr_ne(r, null); 12663 char *s = toStringO(r); 12664 ck_assert_str_eq(s, "!@#qwe"); 12665 free(s); 12666 terminateO(self); 12667 12668 } 12669 12670 12671 void prependCharSmallStringGT(void) { 12672 12673 smallStringt* r; 12674 smallStringt *self = allocG("qwe"); 12675 12676 r = prependCharSmallStringG(self, '!'); 12677 ck_assert_ptr_ne(r, null); 12678 char *s = toStringO(r); 12679 ck_assert_str_eq(s, "!qwe"); 12680 free(s); 12681 terminateO(self); 12682 12683 } 12684 12685 12686 void prependNSmashSmallStringGT(void) { 12687 12688 smallStringt* r; 12689 smallStringt *self = allocG("qwe"); 12690 smallStringt *string = allocSmallString("!@#"); 12691 12692 r = prependNSmashSmallStringG(self, string); 12693 ck_assert_ptr_ne(r, null); 12694 char *s = toStringO(r); 12695 ck_assert_str_eq(s, "!@#qwe"); 12696 free(s); 12697 terminateO(self); 12698 12699 } 12700 12701 12702 void prependNSmashSmallJsonSmallStringGT(void) { 12703 12704 smallStringt* r; 12705 smallStringt *self = allocG("qwe"); 12706 smallJsont *string = allocSmallJson(); 12707 12708 setTopSO(string, "!@#"); 12709 r = prependNSmashSmallJsonSmallStringG(self, string); 12710 ck_assert_ptr_ne(r, null); 12711 char *s = toStringO(r); 12712 ck_assert_str_eq(s, "!@#qwe"); 12713 free(s); 12714 terminateO(self); 12715 12716 } 12717 12718 12719 void prependNSmashSSmallStringGT(void) { 12720 12721 smallStringt* r; 12722 smallStringt *self = allocG("qwe"); 12723 12724 r = prependNSmashSSmallStringG(self, strdup("!@#")); 12725 ck_assert_ptr_ne(r, null); 12726 char *s = toStringO(r); 12727 ck_assert_str_eq(s, "!@#qwe"); 12728 free(s); 12729 terminateO(self); 12730 12731 } 12732 12733 12734 void replaceSmallStringGT(void) { 12735 12736 smallStringt* r; 12737 smallStringt *self = allocG("#ee#ee#ad"); 12738 12739 // replace string, multiple character new delimeter 12740 r = replaceSmallStringG(self, "#","^^", 0); 12741 ck_assert_ptr_ne(r, null); 12742 char *s = toStringO(r); 12743 ck_assert_str_eq(s, "^^ee^^ee^^ad"); 12744 free(s); 12745 terminateO(self); 12746 12747 } 12748 12749 12750 void replaceCharSSmallStringGT(void) { 12751 12752 smallStringt* r; 12753 smallStringt *self = allocG(""); 12754 12755 // replace string, multiple character new delimeter 12756 setValO(self, "#ee#ee#ad"); 12757 r = replaceCharSSmallStringG(self, '#',"^^", 0); 12758 ck_assert_ptr_ne(r, null); 12759 char *s = toStringO(r); 12760 ck_assert_str_eq(s, "^^ee^^ee^^ad"); 12761 free(s); 12762 terminateO(self); 12763 12764 } 12765 12766 12767 void replaceSCharSmallStringGT(void) { 12768 12769 smallStringt* r; 12770 smallStringt *self = allocG(""); 12771 12772 // replace string, multiple character new delimeter 12773 setValO(self, "#ee#ee#ad"); 12774 r = replaceSCharSmallStringG(self, "#",'^',0); 12775 ck_assert_ptr_ne(r, null); 12776 char *s = toStringO(r); 12777 ck_assert_str_eq(s, "^ee^ee^ad"); 12778 free(s); 12779 terminateO(self); 12780 12781 } 12782 12783 12784 void replaceCharCharSmallStringGT(void) { 12785 12786 smallStringt* r; 12787 smallStringt *self = allocG(""); 12788 12789 // replace string, multiple character new delimeter 12790 setValO(self, "#ee#ee#ad"); 12791 r = replaceCharCharSmallStringG(self, '#','^', 0); 12792 ck_assert_ptr_ne(r, null); 12793 char *s = toStringO(r); 12794 ck_assert_str_eq(s, "^ee^ee^ad"); 12795 free(s); 12796 terminateO(self); 12797 12798 } 12799 12800 12801 void replaceSmallJsonSmallJsonSmallStringGT(void) { 12802 12803 smallStringt* r; 12804 smallStringt *self = allocG("#ee#ee#ad"); 12805 smallJsont *olds = allocSmallJson(); 12806 smallJsont *news = allocSmallJson(); 12807 12808 // replace string, multiple character new delimeter 12809 freeO(olds); 12810 freeO(news); 12811 setTopSO(olds, "#"); 12812 setTopSO(news, "^^"); 12813 r = replaceSmallJsonSmallJsonSmallStringG(self, olds, news, 0); 12814 ck_assert_ptr_ne(r, null); 12815 char *s = toStringO(r); 12816 ck_assert_str_eq(s, "^^ee^^ee^^ad"); 12817 free(s); 12818 terminateO(olds); 12819 terminateO(news); 12820 terminateO(self); 12821 12822 } 12823 12824 12825 void replaceSmallJsonSmallStringSmallStringGT(void) { 12826 12827 smallStringt* r; 12828 smallStringt *self = allocG("#ee#ee#ad"); 12829 smallJsont *olds = allocSmallJson(); 12830 smallStringt *news = allocSmallString(""); 12831 12832 // replace string, multiple character new delimeter 12833 freeO(olds); 12834 setTopSO(olds, "#"); 12835 setValO(news, "^^"); 12836 r = replaceSmallJsonSmallStringSmallStringG(self, olds, news, 0); 12837 ck_assert_ptr_ne(r, null); 12838 char *s = toStringO(r); 12839 ck_assert_str_eq(s, "^^ee^^ee^^ad"); 12840 free(s); 12841 terminateO(olds); 12842 terminateO(news); 12843 terminateO(self); 12844 12845 } 12846 12847 12848 void replaceSmallJsonSSmallStringGT(void) { 12849 12850 smallStringt* r; 12851 smallStringt *self = allocG("#ee#ee#ad"); 12852 smallJsont *olds = allocSmallJson(); 12853 const char *news; 12854 12855 // replace string, multiple character new delimeter 12856 freeO(olds); 12857 setTopSO(olds, "#"); 12858 news = "^^"; 12859 r = replaceSmallJsonSSmallStringG(self, olds, news, 0); 12860 ck_assert_ptr_ne(r, null); 12861 char *s = toStringO(r); 12862 ck_assert_str_eq(s, "^^ee^^ee^^ad"); 12863 free(s); 12864 terminateO(olds); 12865 terminateO(self); 12866 12867 } 12868 12869 12870 void replaceSmallJsonCharSmallStringGT(void) { 12871 12872 smallStringt* r; 12873 smallStringt *self = allocG("#ee#ee#ad"); 12874 smallJsont *olds = allocSmallJson(); 12875 char news; 12876 12877 // replace string, multiple character new delimeter 12878 freeO(olds); 12879 setTopSO(olds, "#"); 12880 news = '^'; 12881 r = replaceSmallJsonCharSmallStringG(self, olds, news, 0); 12882 ck_assert_ptr_ne(r, null); 12883 char *s = toStringO(r); 12884 ck_assert_str_eq(s, "^ee^ee^ad"); 12885 free(s); 12886 terminateO(olds); 12887 terminateO(self); 12888 12889 } 12890 12891 12892 void replaceSmallStringSmallJsonSmallStringGT(void) { 12893 12894 smallStringt* r; 12895 smallStringt *self = allocG("#ee#ee#ad"); 12896 smallStringt *olds = allocSmallString(""); 12897 smallJsont *news = allocSmallJson(); 12898 12899 // replace string, multiple character new delimeter 12900 freeO(news); 12901 setValO(olds, "#"); 12902 setTopSO(news, "^^"); 12903 r = replaceSmallStringSmallJsonSmallStringG(self, olds, news, 0); 12904 ck_assert_ptr_ne(r, null); 12905 char *s = toStringO(r); 12906 ck_assert_str_eq(s, "^^ee^^ee^^ad"); 12907 free(s); 12908 terminateO(olds); 12909 terminateO(news); 12910 terminateO(self); 12911 12912 } 12913 12914 12915 void replaceSmallStringSmallStringSmallStringGT(void) { 12916 12917 smallStringt* r; 12918 smallStringt *self = allocG("#ee#ee#ad"); 12919 smallStringt *olds = allocSmallString(""); 12920 smallStringt *news = allocSmallString(""); 12921 12922 // replace string, multiple character new delimeter 12923 setValO(olds, "#"); 12924 setValO(news, "^^"); 12925 r = replaceSmallStringSmallStringSmallStringG(self, olds, news, 0); 12926 ck_assert_ptr_ne(r, null); 12927 char *s = toStringO(r); 12928 ck_assert_str_eq(s, "^^ee^^ee^^ad"); 12929 free(s); 12930 terminateO(olds); 12931 terminateO(news); 12932 terminateO(self); 12933 12934 } 12935 12936 12937 void replaceSmallStringSSmallStringGT(void) { 12938 12939 smallStringt* r; 12940 smallStringt *self = allocG("#ee#ee#ad"); 12941 smallStringt *olds = allocSmallString(""); 12942 const char *news; 12943 12944 // replace string, multiple character new delimeter 12945 setValO(olds, "#"); 12946 news = "^^"; 12947 r = replaceSmallStringSSmallStringG(self, olds, news, 0); 12948 ck_assert_ptr_ne(r, null); 12949 char *s = toStringO(r); 12950 ck_assert_str_eq(s, "^^ee^^ee^^ad"); 12951 free(s); 12952 terminateO(olds); 12953 terminateO(self); 12954 12955 } 12956 12957 12958 void replaceSmallStringCharSmallStringGT(void) { 12959 12960 smallStringt* r; 12961 smallStringt *self = allocG("#ee#ee#ad"); 12962 smallStringt *olds = allocSmallString(""); 12963 char news; 12964 12965 // replace string, multiple character new delimeter 12966 setValO(olds, "#"); 12967 news = '^'; 12968 r = replaceSmallStringCharSmallStringG(self, olds, news, 0); 12969 ck_assert_ptr_ne(r, null); 12970 char *s = toStringO(r); 12971 ck_assert_str_eq(s, "^ee^ee^ad"); 12972 free(s); 12973 terminateO(olds); 12974 terminateO(self); 12975 12976 } 12977 12978 12979 void replaceSSmallJsonSmallStringGT(void) { 12980 12981 smallStringt* r; 12982 smallStringt *self = allocG("#ee#ee#ad"); 12983 const char *olds; 12984 smallJsont *news = allocSmallJson(); 12985 12986 // replace string, multiple character new delimeter 12987 freeO(news); 12988 olds = "#"; 12989 setTopSO(news, "^^"); 12990 r = replaceSSmallJsonSmallStringG(self, olds, news, 0); 12991 ck_assert_ptr_ne(r, null); 12992 char *s = toStringO(r); 12993 ck_assert_str_eq(s, "^^ee^^ee^^ad"); 12994 free(s); 12995 terminateO(news); 12996 terminateO(self); 12997 12998 } 12999 13000 13001 void replaceSSmallStringSmallStringGT(void) { 13002 13003 smallStringt* r; 13004 smallStringt *self = allocG("#ee#ee#ad"); 13005 const char *olds; 13006 smallStringt *news = allocSmallString(""); 13007 13008 // replace string, multiple character new delimeter 13009 olds = "#"; 13010 setValO(news, "^^"); 13011 r = replaceSSmallStringSmallStringG(self, olds, news, 0); 13012 ck_assert_ptr_ne(r, null); 13013 char *s = toStringO(r); 13014 ck_assert_str_eq(s, "^^ee^^ee^^ad"); 13015 free(s); 13016 terminateO(news); 13017 terminateO(self); 13018 13019 } 13020 13021 13022 void replaceCharSmallJsonSmallStringGT(void) { 13023 13024 smallStringt* r; 13025 smallStringt *self = allocG("#ee#ee#ad"); 13026 char olds; 13027 smallJsont *news = allocSmallJson(); 13028 13029 // replace string, multiple character new delimeter 13030 freeO(news); 13031 olds = '#'; 13032 setTopSO(news, "^^"); 13033 r = replaceCharSmallJsonSmallStringG(self, olds, news, 0); 13034 ck_assert_ptr_ne(r, null); 13035 char *s = toStringO(r); 13036 ck_assert_str_eq(s, "^^ee^^ee^^ad"); 13037 free(s); 13038 terminateO(news); 13039 terminateO(self); 13040 13041 } 13042 13043 13044 void replaceCharSmallStringSmallStringGT(void) { 13045 13046 smallStringt* r; 13047 smallStringt *self = allocG("#ee#ee#ad"); 13048 char olds; 13049 smallStringt *news = allocSmallString(""); 13050 13051 // replace string, multiple character new delimeter 13052 olds = '#'; 13053 setValO(news, "^^"); 13054 r = replaceCharSmallStringSmallStringG(self, olds, news, 0); 13055 ck_assert_ptr_ne(r, null); 13056 char *s = toStringO(r); 13057 ck_assert_str_eq(s, "^^ee^^ee^^ad"); 13058 free(s); 13059 terminateO(news); 13060 terminateO(self); 13061 13062 } 13063 13064 13065 void icReplaceSmallStringGT(void) { 13066 13067 smallStringt* r; 13068 smallStringt *self = allocG("BeebeeBad"); 13069 13070 // replace string, multiple character new delimeter 13071 r = icReplaceSmallStringG(self, "b","^^", 0); 13072 ck_assert_ptr_ne(r, null); 13073 char *s = toStringO(r); 13074 ck_assert_str_eq(s, "^^ee^^ee^^ad"); 13075 free(s); 13076 terminateO(self); 13077 13078 } 13079 13080 13081 void icReplaceCharSSmallStringGT(void) { 13082 13083 smallStringt* r; 13084 smallStringt *self = allocG(""); 13085 13086 // replace string, multiple character new delimeter 13087 setValO(self, "BeebeeBad"); 13088 r = icReplaceCharSSmallStringG(self, 'B',"^^", 0); 13089 ck_assert_ptr_ne(r, null); 13090 char *s = toStringO(r); 13091 ck_assert_str_eq(s, "^^ee^^ee^^ad"); 13092 free(s); 13093 terminateO(self); 13094 13095 } 13096 13097 13098 void icReplaceSCharSmallStringGT(void) { 13099 13100 smallStringt* r; 13101 smallStringt *self = allocG(""); 13102 13103 // replace string, multiple character new delimeter 13104 setValO(self, "BeebeeBad"); 13105 r = icReplaceSCharSmallStringG(self, "b",'^',0); 13106 ck_assert_ptr_ne(r, null); 13107 char *s = toStringO(r); 13108 ck_assert_str_eq(s, "^ee^ee^ad"); 13109 free(s); 13110 terminateO(self); 13111 13112 } 13113 13114 13115 void icReplaceCharCharSmallStringGT(void) { 13116 13117 smallStringt* r; 13118 smallStringt *self = allocG(""); 13119 13120 // replace string, multiple character new delimeter 13121 setValO(self, "beeBeebad"); 13122 r = icReplaceCharCharSmallStringG(self, 'b','^', 0); 13123 ck_assert_ptr_ne(r, null); 13124 char *s = toStringO(r); 13125 ck_assert_str_eq(s, "^ee^ee^ad"); 13126 free(s); 13127 terminateO(self); 13128 13129 } 13130 13131 13132 void icReplaceSmallJsonSmallJsonSmallStringGT(void) { 13133 13134 smallStringt* r; 13135 smallStringt *self = allocG("BeebeeBad"); 13136 smallJsont *olds = allocSmallJson(); 13137 smallJsont *news = allocSmallJson(); 13138 13139 // replace string, multiple character new delimeter 13140 freeO(olds); 13141 freeO(news); 13142 setTopSO(olds, "B"); 13143 setTopSO(news, "^^"); 13144 r = icReplaceSmallJsonSmallJsonSmallStringG(self, olds, news, 0); 13145 ck_assert_ptr_ne(r, null); 13146 char *s = toStringO(r); 13147 ck_assert_str_eq(s, "^^ee^^ee^^ad"); 13148 free(s); 13149 terminateO(olds); 13150 terminateO(news); 13151 terminateO(self); 13152 13153 } 13154 13155 13156 void icReplaceSmallJsonSmallStringSmallStringGT(void) { 13157 13158 smallStringt* r; 13159 smallStringt *self = allocG("BeebeeBad"); 13160 smallJsont *olds = allocSmallJson(); 13161 smallStringt *news = allocSmallString(""); 13162 13163 // replace string, multiple character new delimeter 13164 freeO(olds); 13165 setTopSO(olds, "B"); 13166 setValO(news, "^^"); 13167 r = icReplaceSmallJsonSmallStringSmallStringG(self, olds, news, 0); 13168 ck_assert_ptr_ne(r, null); 13169 char *s = toStringO(r); 13170 ck_assert_str_eq(s, "^^ee^^ee^^ad"); 13171 free(s); 13172 terminateO(olds); 13173 terminateO(news); 13174 terminateO(self); 13175 13176 } 13177 13178 13179 void icReplaceSmallJsonSSmallStringGT(void) { 13180 13181 smallStringt* r; 13182 smallStringt *self = allocG("BeebeeBad"); 13183 smallJsont *olds = allocSmallJson(); 13184 const char *news; 13185 13186 // replace string, multiple character new delimeter 13187 freeO(olds); 13188 setTopSO(olds, "b"); 13189 news = "^^"; 13190 r = icReplaceSmallJsonSSmallStringG(self, olds, news, 0); 13191 ck_assert_ptr_ne(r, null); 13192 char *s = toStringO(r); 13193 ck_assert_str_eq(s, "^^ee^^ee^^ad"); 13194 free(s); 13195 terminateO(olds); 13196 terminateO(self); 13197 13198 } 13199 13200 13201 void icReplaceSmallJsonCharSmallStringGT(void) { 13202 13203 smallStringt* r; 13204 smallStringt *self = allocG("beeBeebad"); 13205 smallJsont *olds = allocSmallJson(); 13206 char news; 13207 13208 // replace string, multiple character new delimeter 13209 freeO(olds); 13210 setTopSO(olds, "B"); 13211 news = '^'; 13212 r = icReplaceSmallJsonCharSmallStringG(self, olds, news, 0); 13213 ck_assert_ptr_ne(r, null); 13214 char *s = toStringO(r); 13215 ck_assert_str_eq(s, "^ee^ee^ad"); 13216 free(s); 13217 terminateO(olds); 13218 terminateO(self); 13219 13220 } 13221 13222 13223 void icReplaceSmallStringSmallJsonSmallStringGT(void) { 13224 13225 smallStringt* r; 13226 smallStringt *self = allocG("BeeBeeBad"); 13227 smallStringt *olds = allocSmallString(""); 13228 smallJsont *news = allocSmallJson(); 13229 13230 // replace string, multiple character new delimeter 13231 freeO(news); 13232 setValO(olds, "b"); 13233 setTopSO(news, "^^"); 13234 r = icReplaceSmallStringSmallJsonSmallStringG(self, olds, news, 0); 13235 ck_assert_ptr_ne(r, null); 13236 char *s = toStringO(r); 13237 ck_assert_str_eq(s, "^^ee^^ee^^ad"); 13238 free(s); 13239 terminateO(olds); 13240 terminateO(news); 13241 terminateO(self); 13242 13243 } 13244 13245 13246 void icReplaceSmallStringSmallStringSmallStringGT(void) { 13247 13248 smallStringt* r; 13249 smallStringt *self = allocG("beebeebad"); 13250 smallStringt *olds = allocSmallString(""); 13251 smallStringt *news = allocSmallString(""); 13252 13253 // replace string, multiple character new delimeter 13254 setValO(olds, "B"); 13255 setValO(news, "^^"); 13256 r = icReplaceSmallStringSmallStringSmallStringG(self, olds, news, 0); 13257 ck_assert_ptr_ne(r, null); 13258 char *s = toStringO(r); 13259 ck_assert_str_eq(s, "^^ee^^ee^^ad"); 13260 free(s); 13261 terminateO(olds); 13262 terminateO(news); 13263 terminateO(self); 13264 13265 } 13266 13267 13268 void icReplaceSmallStringSSmallStringGT(void) { 13269 13270 smallStringt* r; 13271 smallStringt *self = allocG("beebeebad"); 13272 smallStringt *olds = allocSmallString(""); 13273 const char *news; 13274 13275 // replace string, multiple character new delimeter 13276 setValO(olds, "B"); 13277 news = "^^"; 13278 r = icReplaceSmallStringSSmallStringG(self, olds, news, 0); 13279 ck_assert_ptr_ne(r, null); 13280 char *s = toStringO(r); 13281 ck_assert_str_eq(s, "^^ee^^ee^^ad"); 13282 free(s); 13283 terminateO(olds); 13284 terminateO(self); 13285 13286 } 13287 13288 13289 void icReplaceSmallStringCharSmallStringGT(void) { 13290 13291 smallStringt* r; 13292 smallStringt *self = allocG("beebeebad"); 13293 smallStringt *olds = allocSmallString(""); 13294 char news; 13295 13296 // replace string, multiple character new delimeter 13297 setValO(olds, "B"); 13298 news = '^'; 13299 r = icReplaceSmallStringCharSmallStringG(self, olds, news, 0); 13300 ck_assert_ptr_ne(r, null); 13301 char *s = toStringO(r); 13302 ck_assert_str_eq(s, "^ee^ee^ad"); 13303 free(s); 13304 terminateO(olds); 13305 terminateO(self); 13306 13307 } 13308 13309 13310 void icReplaceSSmallJsonSmallStringGT(void) { 13311 13312 smallStringt* r; 13313 smallStringt *self = allocG("beebeebad"); 13314 const char *olds; 13315 smallJsont *news = allocSmallJson(); 13316 13317 // replace string, multiple character new delimeter 13318 freeO(news); 13319 olds = "B"; 13320 setTopSO(news, "^^"); 13321 r = icReplaceSSmallJsonSmallStringG(self, olds, news, 0); 13322 ck_assert_ptr_ne(r, null); 13323 char *s = toStringO(r); 13324 ck_assert_str_eq(s, "^^ee^^ee^^ad"); 13325 free(s); 13326 terminateO(news); 13327 terminateO(self); 13328 13329 } 13330 13331 13332 void icReplaceSSmallStringSmallStringGT(void) { 13333 13334 smallStringt* r; 13335 smallStringt *self = allocG("beebeebad"); 13336 const char *olds; 13337 smallStringt *news = allocSmallString(""); 13338 13339 // replace string, multiple character new delimeter 13340 olds = "B"; 13341 setValO(news, "^^"); 13342 r = icReplaceSSmallStringSmallStringG(self, olds, news, 0); 13343 ck_assert_ptr_ne(r, null); 13344 char *s = toStringO(r); 13345 ck_assert_str_eq(s, "^^ee^^ee^^ad"); 13346 free(s); 13347 terminateO(news); 13348 terminateO(self); 13349 13350 } 13351 13352 13353 void icReplaceCharSmallJsonSmallStringGT(void) { 13354 13355 smallStringt* r; 13356 smallStringt *self = allocG("beebeebad"); 13357 char olds; 13358 smallJsont *news = allocSmallJson(); 13359 13360 // replace string, multiple character new delimeter 13361 freeO(news); 13362 olds = 'B'; 13363 setTopSO(news, "^^"); 13364 r = icReplaceCharSmallJsonSmallStringG(self, olds, news, 0); 13365 ck_assert_ptr_ne(r, null); 13366 char *s = toStringO(r); 13367 ck_assert_str_eq(s, "^^ee^^ee^^ad"); 13368 free(s); 13369 terminateO(news); 13370 terminateO(self); 13371 13372 } 13373 13374 13375 void icReplaceCharSmallStringSmallStringGT(void) { 13376 13377 smallStringt* r; 13378 smallStringt *self = allocG("beebeebad"); 13379 char olds; 13380 smallStringt *news = allocSmallString(""); 13381 13382 // replace string, multiple character new delimeter 13383 olds = 'B'; 13384 setValO(news, "^^"); 13385 r = icReplaceCharSmallStringSmallStringG(self, olds, news, 0); 13386 ck_assert_ptr_ne(r, null); 13387 char *s = toStringO(r); 13388 ck_assert_str_eq(s, "^^ee^^ee^^ad"); 13389 free(s); 13390 terminateO(news); 13391 terminateO(self); 13392 13393 } 13394 13395 13396 void equalSmallStringFGT(void) { 13397 13398 bool r; 13399 smallStringt* self = allocG("qwe"); 13400 smallStringt *string = allocSmallString("qwe"); 13401 13402 r = equalSmallStringFG(self,string); 13403 ck_assert(r); 13404 terminateO(string); 13405 terminateO(self); 13406 13407 } 13408 13409 13410 void equalCharSmallStringGT(void) { 13411 13412 bool r; 13413 smallStringt *self = allocG("q"); 13414 13415 r = equalCharSmallStringG(self,'q'); 13416 ck_assert(r); 13417 terminateO(self); 13418 13419 } 13420 13421 13422 void equalSSmallStringGT(void) { 13423 13424 bool r; 13425 smallStringt *self = allocG("qwe"); 13426 13427 r = equalSSmallStringG(self,"qwe"); 13428 ck_assert(r); 13429 terminateO(self); 13430 13431 } 13432 13433 13434 void equalSmallStringBaseGT(void) { 13435 13436 bool r; 13437 smallStringt *self = allocG("12"); 13438 baset* p2 = (baset*) allocSmallInt(12); 13439 13440 r = equalSmallStringBaseG(self, p2); 13441 ck_assert(r); 13442 terminateO(p2); 13443 terminateO(self); 13444 13445 } 13446 13447 13448 void equalSmallStringBoolGT(void) { 13449 13450 bool r; 13451 smallStringt* self = allocG("true"); 13452 13453 r = equalSmallStringBoolG(self, true); 13454 ck_assert(r); 13455 terminateO(self); 13456 13457 } 13458 13459 13460 void equalSmallStringDoubleGT(void) { 13461 13462 bool r; 13463 smallStringt* self = allocG("2.2"); 13464 13465 r = equalSmallStringDoubleG(self, 2.2); 13466 ck_assert(r); 13467 terminateO(self); 13468 13469 } 13470 13471 13472 void equalSmallStringInt64GT(void) { 13473 13474 bool r; 13475 smallStringt* self = allocG("2"); 13476 13477 r = equalSmallStringInt64G(self, 2); 13478 ck_assert(r); 13479 terminateO(self); 13480 13481 } 13482 13483 13484 void equalSmallStringInt32GT(void) { 13485 13486 bool r; 13487 smallStringt* self = allocG("2"); 13488 13489 r = equalSmallStringInt32G(self, 2); 13490 ck_assert(r); 13491 terminateO(self); 13492 13493 } 13494 13495 13496 void equalSmallStringUint32GT(void) { 13497 13498 bool r; 13499 smallStringt* self = allocG("2"); 13500 13501 r = equalSmallStringUint32G(self, 2); 13502 ck_assert(r); 13503 terminateO(self); 13504 13505 } 13506 13507 13508 void equalSmallStringUint64GT(void) { 13509 13510 bool r; 13511 smallStringt* self = allocG("2"); 13512 13513 r = equalSmallStringUint64G(self, 2); 13514 ck_assert(r); 13515 terminateO(self); 13516 13517 } 13518 13519 13520 void equalSmallStringSmallBoolGT(void) { 13521 13522 bool r; 13523 smallStringt* self = allocG("TRUE"); 13524 smallBoolt* p2 = allocSmallBool(true); 13525 13526 r = equalSmallStringSmallBoolG(self, p2); 13527 ck_assert(r); 13528 terminateO(p2); 13529 terminateO(self); 13530 13531 } 13532 13533 13534 void equalSmallStringSmallBytesGT(void) { 13535 13536 bool r; 13537 smallStringt* self = allocG("qwe"); 13538 smallBytest* p2 = allocSmallBytes("qwe", sizeof("qwe")); 13539 13540 r = equalSmallStringSmallBytesG(self, p2); 13541 ck_assert(r); 13542 terminateO(p2); 13543 terminateO(self); 13544 13545 } 13546 13547 13548 void equalSmallStringSmallDoubleGT(void) { 13549 13550 bool r; 13551 smallStringt* self = allocG("2.2"); 13552 smallDoublet* p2 = allocSmallDouble(2.2); 13553 13554 r = equalSmallStringSmallDoubleG(self, p2); 13555 ck_assert(r); 13556 terminateO(p2); 13557 terminateO(self); 13558 13559 } 13560 13561 13562 void equalSmallStringSmallIntGT(void) { 13563 13564 bool r; 13565 smallStringt* self = allocG("2"); 13566 smallIntt* p2 = allocSmallInt(2); 13567 13568 r = equalSmallStringSmallIntG(self, p2); 13569 ck_assert(r); 13570 terminateO(p2); 13571 terminateO(self); 13572 13573 } 13574 13575 13576 void equalSmallStringSmallJsonGT(void) { 13577 13578 bool r; 13579 smallStringt* self = allocG("qwe"); 13580 smallJsont* p2 = allocSmallJson(); 13581 13582 setTopSO(p2, "qwe"); 13583 r = equalSmallStringSmallJsonG(self, p2); 13584 ck_assert(r); 13585 terminateO(p2); 13586 terminateO(self); 13587 13588 } 13589 13590 13591 void icEqualSmallStringFGT(void) { 13592 13593 bool r; 13594 smallStringt *self = allocG("qwe"); 13595 smallStringt *string = allocSmallString("Qwe"); 13596 13597 r = icEqualSmallStringFG(self,string); 13598 ck_assert(r); 13599 terminateO(string); 13600 terminateO(self); 13601 13602 } 13603 13604 13605 void icEqualCharSmallStringGT(void) { 13606 13607 bool r; 13608 smallStringt *self = allocG("q"); 13609 13610 r = icEqualCharSmallStringG(self,'Q'); 13611 ck_assert(r); 13612 terminateO(self); 13613 13614 } 13615 13616 13617 void icEqualSSmallStringGT(void) { 13618 13619 bool r; 13620 smallStringt *self = allocG("qwe"); 13621 13622 r = icEqualSSmallStringG(self, "Qwe"); 13623 ck_assert(r); 13624 terminateO(self); 13625 13626 } 13627 13628 13629 void icEqualSmallStringBaseGT(void) { 13630 13631 bool r; 13632 smallStringt* self = allocG("qwe"); 13633 baset* p2 = (baset*) allocSmallString("QWE"); 13634 13635 r = icEqualSmallStringBaseG(self, p2); 13636 ck_assert(r); 13637 terminateO(p2); 13638 terminateO(self); 13639 13640 } 13641 13642 13643 void icEqualSmallStringSmallJsonGT(void) { 13644 13645 bool r; 13646 smallStringt* self = allocG("qwe"); 13647 smallJsont* p2 = allocSmallJson(); 13648 13649 setTopSO(p2, "Qwe"); 13650 r = icEqualSmallStringSmallJsonG(self, p2); 13651 ck_assert(r); 13652 terminateO(p2); 13653 terminateO(self); 13654 13655 } 13656 13657 13658 void equalISSmallStringGT(void) { 13659 13660 smallStringt *self = allocG("Ashee|"); 13661 13662 ck_assert(equalISSmallStringG(self, "shee", 1)); 13663 terminateO(self); 13664 13665 } 13666 13667 13668 void equalICharSmallStringGT(void) { 13669 13670 smallStringt *self = allocG("Ashee"); 13671 13672 ck_assert(equalICharSmallStringG(self, 's', 1)); 13673 terminateO(self); 13674 13675 } 13676 13677 13678 void equalISmallJsonSmallStringGT(void) { 13679 13680 smallStringt *self = allocG("Ashee|"); 13681 smallJsont *string = allocSmallJson(); 13682 13683 setTopSO(string, "shee"); 13684 ck_assert(equalISmallJsonSmallStringG(self, string, 1)); 13685 terminateO(string); 13686 terminateO(self); 13687 13688 } 13689 13690 13691 void equalISmallStringSmallStringGT(void) { 13692 13693 smallStringt *self = allocG("Ashee|"); 13694 smallStringt *string = allocSmallString("shee"); 13695 13696 ck_assert(equalISmallStringSmallStringG(self, string, 1)); 13697 terminateO(string); 13698 terminateO(self); 13699 13700 } 13701 13702 13703 void startsWithSSmallStringGT(void) { 13704 13705 smallStringt *self = allocG("sheepy"); 13706 13707 ck_assert(startsWithSSmallStringG(self, "shee")); 13708 terminateO(self); 13709 13710 } 13711 13712 13713 void startsWithCharSmallStringGT(void) { 13714 13715 smallStringt *self = allocG("shee"); 13716 13717 ck_assert(startsWithCharSmallStringG(self, 's')); 13718 terminateO(self); 13719 13720 } 13721 13722 13723 void startsWithSmallJsonSmallStringGT(void) { 13724 13725 smallStringt *self = allocG("sheepy"); 13726 smallJsont *string = allocSmallJson(); 13727 13728 setTopSO(string, "shee"); 13729 ck_assert(startsWithSmallJsonSmallStringG(self, string)); 13730 terminateO(string); 13731 terminateO(self); 13732 13733 } 13734 13735 13736 void startsWithSmallStringSmallStringGT(void) { 13737 13738 smallStringt *self = allocG("sheepy"); 13739 smallStringt *string = allocSmallString("shee"); 13740 13741 ck_assert(startsWithSmallStringSmallStringG(self, string)); 13742 terminateO(string); 13743 terminateO(self); 13744 13745 } 13746 13747 13748 void endsWithSSmallStringGT(void) { 13749 13750 smallStringt *self = allocG("sheepy"); 13751 13752 ck_assert(endsWithSSmallStringG(self, "eepy")); 13753 terminateO(self); 13754 13755 } 13756 13757 13758 void endsWithCharSmallStringGT(void) { 13759 13760 smallStringt *self = allocG("sheepy"); 13761 13762 ck_assert(endsWithCharSmallStringG(self, 'y')); 13763 terminateO(self); 13764 13765 } 13766 13767 13768 void endsWithSmallJsonSmallStringGT(void) { 13769 13770 smallStringt *self = allocG("shee"); 13771 smallJsont *string = allocSmallJson(); 13772 13773 setValO(self, "sheepy"); 13774 setTopSO(string, "eepy"); 13775 ck_assert(endsWithSmallJsonSmallStringG(self, string)); 13776 terminateO(string); 13777 terminateO(self); 13778 13779 } 13780 13781 13782 void endsWithSmallStringSmallStringGT(void) { 13783 13784 smallStringt *self = allocG("sheepy"); 13785 smallStringt *string = allocSmallString("eepy"); 13786 13787 ck_assert(endsWithSmallStringSmallStringG(self, string)); 13788 terminateO(string); 13789 terminateO(self); 13790 13791 } 13792 13793 13794 void countSSmallStringGT(void) { 13795 13796 smallStringt *self = allocG("sheepy"); 13797 13798 // positive count 13799 ck_assert_int_eq(countSSmallStringG(self, "shee"), 1); 13800 terminateO(self); 13801 13802 } 13803 13804 13805 void countCharSmallStringGT(void) { 13806 13807 smallStringt *self = allocG("shee"); 13808 13809 // positive count 13810 ck_assert_int_eq(countCharSmallStringG(self, 's'), 1); 13811 terminateO(self); 13812 13813 } 13814 13815 13816 void countSmallJsonSmallStringGT(void) { 13817 13818 smallStringt *self = allocG("sheepy"); 13819 smallJsont *string = allocSmallJson(); 13820 13821 // positive count 13822 setTopSO(string, "shee"); 13823 ck_assert_int_eq(countSmallJsonSmallStringG(self, string), 1); 13824 terminateO(string); 13825 terminateO(self); 13826 13827 } 13828 13829 13830 void countSmallStringSmallStringGT(void) { 13831 13832 smallStringt *self = allocG("sheepy"); 13833 smallStringt *string = allocSmallString("shee"); 13834 13835 ck_assert_int_eq(countSmallStringSmallStringG(self, string), 1); 13836 terminateO(string); 13837 terminateO(self); 13838 13839 } 13840 13841 13842 void icStartsWithSSmallStringGT(void) { 13843 13844 smallStringt *self = allocG("sheepy"); 13845 13846 ck_assert(icStartsWithSSmallStringG(self, "shee")); 13847 terminateO(self); 13848 13849 } 13850 13851 13852 void icStartsWithCharSmallStringGT(void) { 13853 13854 smallStringt *self = allocG("shee"); 13855 13856 ck_assert(icStartsWithCharSmallStringG(self, 'S')); 13857 terminateO(self); 13858 13859 } 13860 13861 13862 void icStartsWithSmallJsonSmallStringGT(void) { 13863 13864 smallStringt *self = allocG("sheepy"); 13865 smallJsont *string = allocSmallJson(); 13866 13867 setTopSO(string, "shee"); 13868 ck_assert(icStartsWithSmallJsonSmallStringG(self, string)); 13869 terminateO(string); 13870 terminateO(self); 13871 13872 } 13873 13874 13875 void icStartsWithSmallStringSmallStringGT(void) { 13876 13877 smallStringt *self = allocG("sheepy"); 13878 smallStringt *string = allocSmallString("shee"); 13879 13880 ck_assert(icStartsWithSmallStringSmallStringG(self, string)); 13881 terminateO(string); 13882 terminateO(self); 13883 13884 } 13885 13886 13887 void icEndsWithSSmallStringGT(void) { 13888 13889 smallStringt *self = allocG("sheepy"); 13890 13891 ck_assert(icEndsWithSSmallStringG(self, "EEPY")); 13892 terminateO(self); 13893 13894 } 13895 13896 13897 void icEndsWithCharSmallStringGT(void) { 13898 13899 smallStringt *self = allocG("shee"); 13900 13901 ck_assert(icEndsWithCharSmallStringG(self, 'e')); 13902 terminateO(self); 13903 13904 } 13905 13906 13907 void icEndsWithSmallJsonSmallStringGT(void) { 13908 13909 smallStringt *self = allocG("sheepy"); 13910 smallJsont *string = allocSmallJson(); 13911 13912 setTopSO(string, "EEPY"); 13913 ck_assert(icEndsWithSmallJsonSmallStringG(self, string)); 13914 terminateO(string); 13915 terminateO(self); 13916 13917 } 13918 13919 13920 void icEndsWithSmallStringSmallStringGT(void) { 13921 13922 smallStringt *self = allocG("sheepy"); 13923 smallStringt *string = allocSmallString("EEPY"); 13924 13925 ck_assert(icEndsWithSmallStringSmallStringG(self, string)); 13926 terminateO(string); 13927 terminateO(self); 13928 13929 } 13930 13931 13932 void icCountSSmallStringGT(void) { 13933 13934 smallStringt *self = allocG("sheepy"); 13935 13936 // positive count 13937 ck_assert_int_eq(icCountSSmallStringG(self, "Shee"), 1); 13938 terminateO(self); 13939 13940 } 13941 13942 13943 void icCountCharSmallStringGT(void) { 13944 13945 smallStringt *self = allocG("shee"); 13946 13947 // positive count 13948 ck_assert_int_eq(icCountCharSmallStringG(self, 'S'), 1); 13949 terminateO(self); 13950 13951 } 13952 13953 13954 void icCountSmallJsonSmallStringGT(void) { 13955 13956 smallStringt *self = allocG("sheepy"); 13957 smallJsont *string = allocSmallJson(); 13958 13959 // positive count 13960 setTopSO(string, "Shee"); 13961 ck_assert_int_eq(icCountSmallJsonSmallStringG(self, string), 1); 13962 terminateO(string); 13963 terminateO(self); 13964 13965 } 13966 13967 13968 void icCountSmallStringSmallStringGT(void) { 13969 13970 smallStringt *self = allocG("sheepy"); 13971 smallStringt *string = allocSmallString("shee"); 13972 13973 // positive count 13974 ck_assert_int_eq(icCountSmallStringSmallStringG(self, string), 1); 13975 terminateO(string); 13976 terminateO(self); 13977 13978 } 13979 13980 13981 void isNumberSmallStringGT(void) { 13982 13983 smallStringt *self = allocG(""); 13984 13985 setValO(self, "-12.3"); 13986 ck_assert(isNumberSmallStringG(self)); 13987 terminateO(self); 13988 13989 } 13990 13991 13992 void isIntSmallStringGT(void) { 13993 13994 smallStringt *self = allocG(""); 13995 13996 setValO(self, "-123"); 13997 ck_assert(isIntSmallStringG(self)); 13998 terminateO(self); 13999 14000 } 14001 14002 14003 void parseIntSmallStringGT(void) { 14004 14005 smallStringt *self = allocG("123asd"); 14006 14007 ck_assert_int_eq(parseIntSmallStringG(self), 123); 14008 terminateO(self); 14009 14010 } 14011 14012 14013 void intToSmallStringGT(void) { 14014 14015 smallStringt* r; 14016 smallStringt *self = allocG(""); 14017 14018 r = intToSmallStringG(self, 123); 14019 ck_assert_ptr_ne(r, null); 14020 char *s = toStringO(r); 14021 ck_assert_str_eq(s, "123"); 14022 free(s); 14023 terminateO(self); 14024 14025 } 14026 14027 14028 void parseDoubleSmallStringGT(void) { 14029 14030 smallStringt *self = allocG("123.2sheepy"); 14031 14032 ck_assert(parseDoubleSmallStringG(self) == 123.2); 14033 terminateO(self); 14034 14035 } 14036 14037 14038 void doubleToSmallStringGT(void) { 14039 14040 smallStringt* r; 14041 smallStringt *self = allocG(""); 14042 14043 r = doubleToSmallStringG(self, 123.4); 14044 ck_assert_ptr_ne(r, null); 14045 char *s = toStringO(r); 14046 ck_assert_str_eq(s, "1.234000e+02"); 14047 free(s); 14048 terminateO(self); 14049 14050 } 14051 14052 14053 void lenSmallStringGT(void) { 14054 14055 size_t r; 14056 smallStringt *self = allocG("123"); 14057 14058 r = lenSmallStringG(self); 14059 ck_assert_int_eq(r, 3); 14060 terminateO(self); 14061 14062 } 14063 14064 14065 void upperSmallStringGT(void) { 14066 14067 smallStringt* r; 14068 smallStringt *self = allocG("sheepy"); 14069 14070 r = upperSmallStringG(self); 14071 ck_assert_ptr_ne(r, null); 14072 char *s = toStringO(r); 14073 ck_assert_str_eq(s, "SHEEPY"); 14074 free(s); 14075 terminateO(self); 14076 14077 } 14078 14079 14080 void lowerSmallStringGT(void) { 14081 14082 smallStringt* r; 14083 smallStringt *self = allocG("SHeePY"); 14084 14085 r = lowerSmallStringG(self); 14086 ck_assert_ptr_ne(r, null); 14087 char *s = toStringO(r); 14088 ck_assert_str_eq(s, "sheepy"); 14089 free(s); 14090 terminateO(self); 14091 14092 } 14093 14094 14095 void trimSmallStringGT(void) { 14096 14097 smallStringt* r; 14098 smallStringt *self = allocG(" SHeePY"); 14099 14100 r = trimSmallStringG(self); 14101 ck_assert_ptr_ne(r, null); 14102 char *s = toStringO(r); 14103 ck_assert_str_eq(s, "SHeePY"); 14104 free(s); 14105 terminateO(self); 14106 14107 } 14108 14109 14110 void lTrimSmallStringGT(void) { 14111 14112 smallStringt* r; 14113 smallStringt *self = allocG(" SHeePY "); 14114 14115 r = lTrimSmallStringG(self); 14116 ck_assert_ptr_ne(r, null); 14117 char *s = toStringO(r); 14118 ck_assert_str_eq(s, "SHeePY "); 14119 free(s); 14120 terminateO(self); 14121 14122 } 14123 14124 14125 void rTrimSmallStringGT(void) { 14126 14127 smallStringt* r; 14128 smallStringt *self = allocG(" SHeePY "); 14129 14130 r = rTrimSmallStringG(self); 14131 ck_assert_ptr_ne(r, null); 14132 char *s = toStringO(r); 14133 ck_assert_str_eq(s, " SHeePY"); 14134 free(s); 14135 terminateO(self); 14136 14137 } 14138 14139 14140 void uniqSmallStringGT(void) { 14141 14142 smallStringt* r; 14143 smallStringt *self = allocG("/qwd///"); 14144 14145 r = uniqSmallStringG(self, '/'); 14146 ck_assert_ptr_ne(r, null); 14147 char *s = toStringO(r); 14148 ck_assert_str_eq(s, "/qwd/"); 14149 free(s); 14150 terminateO(self); 14151 14152 } 14153 14154 14155 void icUniqSmallStringGT(void) { 14156 14157 smallStringt* r; 14158 smallStringt *self = allocG("/qQwd///"); 14159 14160 r = icUniqSmallStringG(self, 'q'); 14161 ck_assert_ptr_ne(r, null); 14162 char *s = toStringO(r); 14163 ck_assert_str_eq(s, "/qwd///"); 14164 free(s); 14165 terminateO(self); 14166 14167 } 14168 14169 14170 void sliceSmallStringGT(void) { 14171 14172 smallStringt* r; 14173 smallStringt *self = allocG("sheepy"); 14174 14175 r = sliceSmallStringG(self, 0,2); 14176 ck_assert_ptr_ne(r, null); 14177 ck_assert_str_eq(ssGet(self), "sh"); 14178 terminateO(self); 14179 14180 } 14181 14182 14183 void cropSmallStringGT(void) { 14184 14185 smallStringt* r; 14186 smallStringt *self = allocG("sheepy"); 14187 14188 r = cropSmallStringG(self, 0,2); 14189 ck_assert_ptr_ne(r, null); 14190 ck_assert_str_eq(ssGet(r), "sh"); 14191 ck_assert_str_eq(ssGet(self), "eepy"); 14192 terminateO(r); 14193 terminateO(self); 14194 14195 } 14196 14197 14198 void cropSSmallStringGT(void) { 14199 14200 char* s; 14201 smallStringt *self = allocG("sheepy"); 14202 14203 s = cropSSmallStringG(self, 0,2); 14204 ck_assert_str_eq(s, "sh"); 14205 ck_assert_str_eq(ssGet(self), "eepy"); 14206 free(s); 14207 terminateO(self); 14208 14209 } 14210 14211 14212 void cropSmallJsonSmallStringGT(void) { 14213 14214 smallJsont* r; 14215 smallStringt *self = allocG("sheepy"); 14216 14217 r = cropSmallJsonSmallStringG(self, 0,2); 14218 ck_assert_ptr_ne(r, null); 14219 ck_assert_str_eq(sjGet(r), "sh"); 14220 ck_assert_str_eq(ssGet(self), "eepy"); 14221 terminateO(r); 14222 terminateO(self); 14223 14224 } 14225 14226 14227 void cropElemSmallStringGT(void) { 14228 14229 char r; 14230 smallStringt *self = allocG("sheepy"); 14231 14232 r = cropElemSmallStringG(self, 0); 14233 ck_assert_int_eq(r, 's'); 14234 ck_assert_str_eq(ssGet(self), "heepy"); 14235 terminateO(self); 14236 14237 } 14238 14239 14240 void copySmallStringGT(void) { 14241 14242 smallStringt* r; 14243 smallStringt *self = allocG("sheepy"); 14244 14245 r = copySmallStringG(self, 0,2); 14246 ck_assert_ptr_ne(r, null); 14247 ck_assert_str_eq(ssGet(r), "sh"); 14248 ck_assert_str_eq(ssGet(self), "sheepy"); 14249 terminateO(r); 14250 terminateO(self); 14251 14252 } 14253 14254 14255 void insertSmallStringGT(void) { 14256 14257 smallStringt* r; 14258 smallStringt *self = allocG("sheepy"); 14259 smallStringt *toInsert = allocSmallString("lib"); 14260 14261 r = insertSmallStringG(self, 0, toInsert); 14262 ck_assert_ptr_ne(r, null); 14263 char *s = toStringO(r); 14264 ck_assert_str_eq(s, "libsheepy"); 14265 free(s); 14266 terminateO(toInsert); 14267 terminateO(self); 14268 14269 } 14270 14271 14272 void insertSmallJsonSmallStringGT(void) { 14273 14274 smallStringt* r; 14275 smallStringt *self = allocG("sheepy"); 14276 smallJsont *toInsert = allocSmallJson(); 14277 14278 setTopSO(toInsert, "lib"); 14279 r = insertSmallJsonSmallStringG(self, 0, toInsert); 14280 ck_assert_ptr_ne(r, null); 14281 char *s = toStringO(r); 14282 ck_assert_str_eq(s, "libsheepy"); 14283 free(s); 14284 terminateO(toInsert); 14285 terminateO(self); 14286 14287 } 14288 14289 14290 void insertSSmallStringGT(void) { 14291 14292 smallStringt* r; 14293 smallStringt *self = allocG("sheepy"); 14294 14295 r = insertSSmallStringG(self, 0, "lib"); 14296 ck_assert_ptr_ne(r, null); 14297 char *s = toStringO(r); 14298 ck_assert_str_eq(s, "libsheepy"); 14299 free(s); 14300 terminateO(self); 14301 14302 } 14303 14304 14305 void insertNFreeSmallStringGT(void) { 14306 14307 smallStringt* r; 14308 smallStringt *self = allocG(""); 14309 smallStringt *toInsert = allocSmallString(""); 14310 14311 setValO(self, "sheepy"); 14312 setValO(toInsert, "lib"); 14313 r = insertNFreeSmallStringG(self, 0, toInsert); 14314 ck_assert_ptr_ne(r, null); 14315 char *s = toStringO(r); 14316 ck_assert_str_eq(s, "libsheepy"); 14317 free(s); 14318 terminateO(self); 14319 14320 } 14321 14322 14323 void insertNFreeSmallJsonSmallStringGT(void) { 14324 14325 smallStringt* r; 14326 smallStringt *self = allocG(""); 14327 smallJsont *toInsert = allocSmallJson(); 14328 14329 setValO(self, "sheepy"); 14330 setTopSO(toInsert, "lib"); 14331 r = insertNFreeSmallJsonSmallStringG(self, 0, toInsert); 14332 ck_assert_ptr_ne(r, null); 14333 char *s = toStringO(r); 14334 ck_assert_str_eq(s, "libsheepy"); 14335 free(s); 14336 terminateO(self); 14337 14338 } 14339 14340 14341 void insertSNFreeSmallStringGT(void) { 14342 14343 smallStringt* r; 14344 smallStringt *self = allocG(""); 14345 14346 setValO(self, "sheepy"); 14347 r = insertSNFreeSmallStringG(self, 0, strdup("lib")); 14348 ck_assert_ptr_ne(r, null); 14349 char *s = toStringO(r); 14350 ck_assert_str_eq(s, "libsheepy"); 14351 free(s); 14352 terminateO(self); 14353 14354 } 14355 14356 14357 void injectSmallStringGT(void) { 14358 14359 smallStringt* r; 14360 smallStringt *self = allocG(""); 14361 14362 setValO(self, "sheepy"); 14363 r = injectSmallStringG(self, 0, 'L'); 14364 ck_assert_ptr_ne(r, null); 14365 char *s = toStringO(r); 14366 ck_assert_str_eq(s, "Lsheepy"); 14367 free(s); 14368 terminateO(self); 14369 14370 } 14371 14372 14373 void delSmallStringGT(void) { 14374 14375 smallStringt* r; 14376 smallStringt *self = allocG(""); 14377 14378 setValO(self, "sheepy"); 14379 r = delSmallStringG(self, 0,2); 14380 ck_assert_ptr_ne(r, null); 14381 char *s = toStringO(r); 14382 ck_assert_str_eq(s, "eepy"); 14383 free(s); 14384 terminateO(self); 14385 14386 } 14387 14388 14389 void delElemSmallStringGT(void) { 14390 14391 smallStringt* r; 14392 smallStringt *self = allocG(""); 14393 14394 setValO(self, "sheepy"); 14395 r = delElemSmallStringG(self, 0); 14396 ck_assert_ptr_ne(r, null); 14397 char *s = toStringO(r); 14398 ck_assert_str_eq(s, "heepy"); 14399 free(s); 14400 terminateO(self); 14401 14402 } 14403 14404 14405 void hasSmallStringGT(void) { 14406 14407 smallStringt *self = allocG(""); 14408 14409 setValO(self, "sheepy"); 14410 ck_assert_str_eq(hasSmallStringG(self, "ee"), "eepy"); 14411 terminateO(self); 14412 14413 } 14414 14415 14416 void hasCharSmallStringGT(void) { 14417 14418 smallStringt *self = allocG(""); 14419 14420 setValO(self, "sheepy"); 14421 ck_assert_str_eq(hasCharSmallStringG(self, 'e'), "eepy"); 14422 terminateO(self); 14423 14424 } 14425 14426 14427 void hasSmallJsonSmallStringGT(void) { 14428 14429 smallStringt *self = allocG(""); 14430 smallJsont *needle = allocSmallJson(); 14431 14432 // find string in the middle 14433 setValO(self, "sheepy"); 14434 setTopSO(needle, "ee"); 14435 ck_assert_str_eq(hasSmallJsonSmallStringG(self, needle), "eepy"); 14436 terminateO(needle); 14437 terminateO(self); 14438 14439 } 14440 14441 14442 void hasSmallStringSmallStringGT(void) { 14443 14444 smallStringt *self = allocG(""); 14445 smallStringt *needle = allocSmallString("ee"); 14446 14447 // find string in the middle 14448 setValO(self, "sheepy"); 14449 ck_assert_str_eq(hasSmallStringSmallStringG(self, needle), "eepy"); 14450 terminateO(needle); 14451 terminateO(self); 14452 14453 } 14454 14455 14456 void findSmallStringGT(void) { 14457 14458 smallStringt* r; 14459 smallStringt *self = allocG(""); 14460 14461 setValO(self, "sheepy"); 14462 r = findSmallStringG(self, "ee"); 14463 ck_assert_ptr_ne(r, null); 14464 ck_assert_str_eq(ssGet(r), "eepy"); 14465 terminateO(r); 14466 terminateO(self); 14467 14468 } 14469 14470 14471 void findCharSmallStringGT(void) { 14472 14473 smallStringt* r; 14474 smallStringt *self = allocG(""); 14475 14476 setValO(self, "sheepy"); 14477 r = findCharSmallStringG(self, 'e'); 14478 ck_assert_ptr_ne(r, null); 14479 ck_assert_str_eq(ssGet(r), "eepy"); 14480 terminateO(r); 14481 terminateO(self); 14482 14483 } 14484 14485 14486 void findSmallJsonSmallStringGT(void) { 14487 14488 smallStringt* r; 14489 smallStringt *self = allocG(""); 14490 smallJsont *needle = allocSmallJson(); 14491 14492 // find string in the middle 14493 setValO(self, "sheepy"); 14494 setTopSO(needle, "ee"); 14495 r = findSmallJsonSmallStringG(self, needle); 14496 ck_assert_ptr_ne(r, null); 14497 ck_assert_str_eq(ssGet(r), "eepy"); 14498 terminateO(r); 14499 terminateO(needle); 14500 terminateO(self); 14501 14502 } 14503 14504 14505 void findSmallStringSmallStringGT(void) { 14506 14507 smallStringt* r; 14508 smallStringt *self = allocG(""); 14509 smallStringt *needle = allocSmallString("ee"); 14510 14511 // find string in the middle 14512 setValO(self, "sheepy"); 14513 r = findSmallStringSmallStringG(self, needle); 14514 ck_assert_ptr_ne(r, null); 14515 ck_assert_str_eq(ssGet(r), "eepy"); 14516 terminateO(r); 14517 terminateO(needle); 14518 terminateO(self); 14519 14520 } 14521 14522 14523 void indexOfSmallStringGT(void) { 14524 14525 smallStringt *self = allocG(""); 14526 14527 setValO(self, "sheepy"); 14528 ck_assert_int_eq(indexOfSmallStringG(self, "ee"), 2); 14529 terminateO(self); 14530 14531 } 14532 14533 14534 void indexOfCharSmallStringGT(void) { 14535 14536 smallStringt *self = allocG(""); 14537 14538 setValO(self, "sheepy"); 14539 ck_assert_int_eq(indexOfCharSmallStringG(self, 'e'), 2); 14540 terminateO(self); 14541 14542 } 14543 14544 14545 void indexOfSmallJsonSmallStringGT(void) { 14546 14547 smallStringt *self = allocG(""); 14548 smallJsont *needle = allocSmallJson(); 14549 14550 // indexOf string in the middle 14551 setValO(self, "sheepy"); 14552 setTopSO(needle, "ee"); 14553 ck_assert_int_eq(indexOfSmallJsonSmallStringG(self, needle), 2); 14554 terminateO(needle); 14555 terminateO(self); 14556 14557 } 14558 14559 14560 void indexOfSmallStringSmallStringGT(void) { 14561 14562 smallStringt *self = allocG(""); 14563 smallStringt *needle = allocSmallString("ee"); 14564 14565 // indexOf string in the middle 14566 setValO(self, "sheepy"); 14567 ck_assert_int_eq(indexOfSmallStringSmallStringG(self, needle), 2); 14568 terminateO(needle); 14569 terminateO(self); 14570 14571 } 14572 14573 14574 void icHasSmallStringGT(void) { 14575 14576 smallStringt *self = allocG(""); 14577 14578 setValO(self, "sheepy"); 14579 ck_assert_str_eq(icHasSmallStringG(self, "EE"), "eepy"); 14580 terminateO(self); 14581 14582 } 14583 14584 14585 void icHasCharSmallStringGT(void) { 14586 14587 smallStringt *self = allocG(""); 14588 14589 setValO(self, "sheepy"); 14590 ck_assert_str_eq(icHasCharSmallStringG(self, 'E'), "eepy"); 14591 terminateO(self); 14592 14593 } 14594 14595 14596 void icHasSmallJsonSmallStringGT(void) { 14597 14598 smallStringt *self = allocG(""); 14599 smallJsont *needle = allocSmallJson(); 14600 14601 // find string in the middle 14602 setValO(self, "sheepy"); 14603 setTopSO(needle, "EE"); 14604 ck_assert_str_eq(icHasSmallJsonSmallStringG(self, needle), "eepy"); 14605 terminateO(needle); 14606 terminateO(self); 14607 14608 } 14609 14610 14611 void icHasSmallStringSmallStringGT(void) { 14612 14613 smallStringt *self = allocG(""); 14614 smallStringt *needle = allocSmallString("EE"); 14615 14616 // find string in the middle 14617 setValO(self, "sheepy"); 14618 ck_assert_str_eq(icHasSmallStringSmallStringG(self, needle), "eepy"); 14619 terminateO(needle); 14620 terminateO(self); 14621 14622 } 14623 14624 14625 void icFindSmallStringGT(void) { 14626 14627 smallStringt* r; 14628 smallStringt *self = allocG(""); 14629 14630 setValO(self, "sheepy"); 14631 r = icFindSmallStringG(self, "EE"); 14632 ck_assert_ptr_ne(r, null); 14633 ck_assert_str_eq(ssGet(r), "eepy"); 14634 terminateO(r); 14635 terminateO(self); 14636 14637 } 14638 14639 14640 void icFindCharSmallStringGT(void) { 14641 14642 smallStringt* r; 14643 smallStringt *self = allocG(""); 14644 14645 setValO(self, "sheepy"); 14646 r = icFindCharSmallStringG(self, 'E'); 14647 ck_assert_ptr_ne(r, null); 14648 ck_assert_str_eq(ssGet(r), "eepy"); 14649 terminateO(r); 14650 terminateO(self); 14651 14652 } 14653 14654 14655 void icFindSmallJsonSmallStringGT(void) { 14656 14657 smallStringt* r; 14658 smallStringt *self = allocG(""); 14659 smallJsont *needle = allocSmallJson(); 14660 14661 // find string in the middle 14662 setValO(self, "sheepy"); 14663 setTopSO(needle, "EE"); 14664 r = icFindSmallJsonSmallStringG(self, needle); 14665 ck_assert_ptr_ne(r, null); 14666 ck_assert_str_eq(ssGet(r), "eepy"); 14667 terminateO(r); 14668 terminateO(needle); 14669 terminateO(self); 14670 14671 } 14672 14673 14674 void icFindSmallStringSmallStringGT(void) { 14675 14676 smallStringt* r; 14677 smallStringt *self = allocG(""); 14678 smallStringt *needle = allocSmallString("EE"); 14679 14680 // find string in the middle 14681 setValO(self, "sheepy"); 14682 r = icFindSmallStringSmallStringG(self, needle); 14683 ck_assert_ptr_ne(r, null); 14684 ck_assert_str_eq(ssGet(r), "eepy"); 14685 terminateO(r); 14686 terminateO(needle); 14687 terminateO(self); 14688 14689 } 14690 14691 14692 void icIndexOfSmallStringGT(void) { 14693 14694 smallStringt *self = allocG(""); 14695 14696 setValO(self, "sheepy"); 14697 ck_assert_int_eq(icIndexOfSmallStringG(self, "EE"), 2); 14698 terminateO(self); 14699 14700 } 14701 14702 14703 void icIndexOfCharSmallStringGT(void) { 14704 14705 smallStringt *self = allocG(""); 14706 14707 setValO(self, "sheepy"); 14708 ck_assert_int_eq(icIndexOfCharSmallStringG(self, 'E'), 2); 14709 terminateO(self); 14710 14711 } 14712 14713 14714 void icIndexOfSmallJsonSmallStringGT(void) { 14715 14716 smallStringt *self = allocG(""); 14717 smallJsont *needle = allocSmallJson(); 14718 14719 // indexOf string in the middle 14720 setValO(self, "sheepy"); 14721 setTopSO(needle, "EE"); 14722 ck_assert_int_eq(icIndexOfSmallJsonSmallStringG(self, needle), 2); 14723 terminateO(needle); 14724 terminateO(self); 14725 14726 } 14727 14728 14729 void icIndexOfSmallStringSmallStringGT(void) { 14730 14731 smallStringt *self = allocG(""); 14732 smallStringt *needle = allocSmallString("EE"); 14733 14734 // indexOf string in the middle 14735 setValO(self, "sheepy"); 14736 ck_assert_int_eq(icIndexOfSmallStringSmallStringG(self, needle), 2); 14737 terminateO(needle); 14738 terminateO(self); 14739 14740 } 14741 14742 14743 void emptySmallStringGT(void) { 14744 14745 smallStringt* r; 14746 smallStringt *self = allocG("qwe"); 14747 14748 r = emptySmallStringG(self); 14749 ck_assert_ptr_ne(r, null); 14750 char *s = toStringO(r); 14751 ck_assert_str_eq(s, ""); 14752 free(s); 14753 terminateO(self); 14754 14755 } 14756 14757 14758 void isEmptySmallStringGT(void) { 14759 14760 smallStringt *self = allocG("qwe"); 14761 14762 ck_assert(!isEmptySmallStringG(self)); 14763 terminateO(self); 14764 14765 } 14766 14767 14768 void isBlankSmallStringGT(void) { 14769 14770 smallStringt *self = allocG(""); 14771 14772 setValO(self, " "); 14773 ck_assert(isBlankSmallStringG(self)); 14774 terminateO(self); 14775 14776 } 14777 14778 14779 void splitSmallStringGT(void) { 14780 14781 smallArrayt* r; 14782 smallStringt *self = allocG(""); 14783 14784 setValO(self, "one/two"); 14785 r = splitSmallStringG(self, "/"); 14786 ck_assert_ptr_ne(r, null); 14787 char *s = toStringO(r); 14788 ck_assert_str_eq(s, "[\"one\",\"two\"]"); 14789 free(s); 14790 terminateO(r); 14791 terminateO(self); 14792 14793 } 14794 14795 14796 void splitCharSmallStringGT(void) { 14797 14798 smallArrayt* r; 14799 smallStringt *self = allocG(""); 14800 14801 setValO(self, "one/two"); 14802 r = splitCharSmallStringG(self, '/'); 14803 ck_assert_ptr_ne(r, null); 14804 char *s = toStringO(r); 14805 ck_assert_str_eq(s, "[\"one\",\"two\"]"); 14806 free(s); 14807 terminateO(r); 14808 terminateO(self); 14809 14810 } 14811 14812 14813 void splitSmallJsonSmallStringGT(void) { 14814 14815 smallArrayt* r; 14816 smallStringt *self = allocG(""); 14817 smallJsont *delim = allocSmallJson(); 14818 14819 // string 14820 setValO(self, "one/two"); 14821 setTopSO(delim, "/"); 14822 r = splitSmallJsonSmallStringG(self, delim); 14823 ck_assert_ptr_ne(r, null); 14824 char *s = toStringO(r); 14825 ck_assert_str_eq(s, "[\"one\",\"two\"]"); 14826 free(s); 14827 terminateO(r); 14828 terminateO(delim); 14829 terminateO(self); 14830 14831 } 14832 14833 14834 void splitSmallStringSmallStringGT(void) { 14835 14836 smallArrayt* r; 14837 smallStringt *self = allocG(""); 14838 smallStringt *delim = allocSmallString("/"); 14839 14840 // string 14841 setValO(self, "one/two"); 14842 r = splitSmallStringSmallStringG(self, delim); 14843 ck_assert_ptr_ne(r, null); 14844 char *s = toStringO(r); 14845 ck_assert_str_eq(s, "[\"one\",\"two\"]"); 14846 free(s); 14847 terminateO(r); 14848 terminateO(delim); 14849 terminateO(self); 14850 14851 } 14852 14853 14854 void splitCharPSSmallStringGT(void) { 14855 14856 char** r; 14857 smallStringt *self = allocG(""); 14858 14859 setValO(self, "one/two"); 14860 r = splitCharPSSmallStringG(self, "/"); 14861 ck_assert_uint_eq(listLengthS(r),2); 14862 ck_assert_str_eq(r[0], "one"); 14863 ck_assert_str_eq(r[1], "two"); 14864 listFreeS(r); 14865 terminateO(self); 14866 14867 } 14868 14869 14870 void splitCharSSmallStringGT(void) { 14871 14872 char** r; 14873 smallStringt *self = allocG(""); 14874 14875 setValO(self, "one/two"); 14876 r = splitCharSSmallStringG(self, '/'); 14877 ck_assert_uint_eq(listLengthS(r),2); 14878 ck_assert_str_eq(r[0], "one"); 14879 ck_assert_str_eq(r[1], "two"); 14880 listFreeS(r); 14881 terminateO(self); 14882 14883 } 14884 14885 14886 void splitSmallJsonSSmallStringGT(void) { 14887 14888 char** r; 14889 smallStringt *self = allocG(""); 14890 smallJsont *delim = allocSmallJson(); 14891 14892 // string 14893 setValO(self, "one/two"); 14894 setTopSO(delim, "/"); 14895 r = splitSmallJsonSSmallStringG(self, delim); 14896 ck_assert_uint_eq(listLengthS(r),2); 14897 ck_assert_str_eq(r[0], "one"); 14898 ck_assert_str_eq(r[1], "two"); 14899 listFreeS(r); 14900 terminateO(delim); 14901 terminateO(self); 14902 14903 } 14904 14905 14906 void splitSmallStringSSmallStringGT(void) { 14907 14908 char** r; 14909 smallStringt *self = allocG(""); 14910 smallStringt *delim = allocSmallString("/"); 14911 14912 // string 14913 setValO(self, "one/two"); 14914 r = splitSmallStringSSmallStringG(self, delim); 14915 ck_assert_uint_eq(listLengthS(r),2); 14916 ck_assert_str_eq(r[0], "one"); 14917 ck_assert_str_eq(r[1], "two"); 14918 listFreeS(r); 14919 terminateO(delim); 14920 terminateO(self); 14921 14922 } 14923 14924 14925 void extractSmallStringGT(void) { 14926 14927 smallArrayt* r; 14928 smallStringt *self = allocG(""); 14929 14930 setValO(self, "one/two|"); 14931 r = extractSmallStringG(self, "/", "|"); 14932 ck_assert_ptr_ne(r, null); 14933 char *s = toStringO(r); 14934 ck_assert_str_eq(s, "[\"two\"]"); 14935 free(s); 14936 terminateO(r); 14937 terminateO(self); 14938 14939 } 14940 14941 14942 void extractCharSSmallStringGT(void) { 14943 14944 smallArrayt* r; 14945 smallStringt *self = allocG(""); 14946 14947 setValO(self, "one/two|"); 14948 r = extractCharSSmallStringG(self, '/', "|"); 14949 ck_assert_ptr_ne(r, null); 14950 char *s = toStringO(r); 14951 ck_assert_str_eq(s, "[\"two\"]"); 14952 free(s); 14953 terminateO(r); 14954 terminateO(self); 14955 14956 } 14957 14958 14959 void extractSCharSmallStringGT(void) { 14960 14961 smallArrayt* r; 14962 smallStringt *self = allocG(""); 14963 14964 setValO(self, "one/two|"); 14965 r = extractSCharSmallStringG(self, "/", '|'); 14966 ck_assert_ptr_ne(r, null); 14967 char *s = toStringO(r); 14968 ck_assert_str_eq(s, "[\"two\"]"); 14969 free(s); 14970 terminateO(r); 14971 terminateO(self); 14972 14973 } 14974 14975 14976 void extractCharCharSmallStringGT(void) { 14977 14978 smallArrayt* r; 14979 smallStringt *self = allocG(""); 14980 14981 setValO(self, "one/two|"); 14982 r = extractCharCharSmallStringG(self, '/', '|'); 14983 ck_assert_ptr_ne(r, null); 14984 char *s = toStringO(r); 14985 ck_assert_str_eq(s, "[\"two\"]"); 14986 free(s); 14987 terminateO(r); 14988 terminateO(self); 14989 14990 } 14991 14992 14993 void extractSmallJsonSmallJsonSmallStringGT(void) { 14994 14995 smallArrayt* r; 14996 smallStringt *self = allocG(""); 14997 smallJsont* delim1 = allocSmallJson(); 14998 smallJsont* delim2 = allocSmallJson(); 14999 15000 // string 15001 setValO(self, "one/two|"); 15002 setTopSO(delim1, "/"); 15003 setTopSO(delim2, "|"); 15004 r = extractSmallJsonSmallJsonSmallStringG(self, delim1, delim2); 15005 ck_assert_ptr_ne(r, null); 15006 char *s = toStringO(r); 15007 ck_assert_str_eq(s, "[\"two\"]"); 15008 free(s); 15009 terminateO(r); 15010 terminateO(delim1); 15011 terminateO(delim2); 15012 terminateO(self); 15013 15014 } 15015 15016 15017 void extractSmallJsonSmallStringSmallStringGT(void) { 15018 15019 smallArrayt* r; 15020 smallStringt *self = allocG(""); 15021 smallJsont* delim1 = allocSmallJson(); 15022 smallStringt* delim2 = allocSmallString("|"); 15023 15024 // string 15025 setValO(self, "one/two|"); 15026 setTopSO(delim1, "/"); 15027 r = extractSmallJsonSmallStringSmallStringG(self, delim1, delim2); 15028 ck_assert_ptr_ne(r, null); 15029 char *s = toStringO(r); 15030 ck_assert_str_eq(s, "[\"two\"]"); 15031 free(s); 15032 terminateO(r); 15033 terminateO(delim1); 15034 terminateO(delim2); 15035 terminateO(self); 15036 15037 } 15038 15039 15040 void extractSmallJsonSSmallStringGT(void) { 15041 15042 smallArrayt* r; 15043 smallStringt *self = allocG(""); 15044 smallJsont* delim1 = allocSmallJson(); 15045 15046 // string 15047 setValO(self, "one/two|"); 15048 setTopSO(delim1, "/"); 15049 r = extractSmallJsonSSmallStringG(self, delim1, "|"); 15050 ck_assert_ptr_ne(r, null); 15051 char *s = toStringO(r); 15052 ck_assert_str_eq(s, "[\"two\"]"); 15053 free(s); 15054 terminateO(r); 15055 terminateO(delim1); 15056 terminateO(self); 15057 15058 } 15059 15060 15061 void extractSmallJsonCharSmallStringGT(void) { 15062 15063 smallArrayt* r; 15064 smallStringt *self = allocG(""); 15065 smallJsont* delim1 = allocSmallJson(); 15066 15067 // string 15068 setValO(self, "one/two|"); 15069 setTopSO(delim1, "/"); 15070 r = extractSmallJsonCharSmallStringG(self, delim1, '|'); 15071 ck_assert_ptr_ne(r, null); 15072 char *s = toStringO(r); 15073 ck_assert_str_eq(s, "[\"two\"]"); 15074 free(s); 15075 terminateO(r); 15076 terminateO(delim1); 15077 terminateO(self); 15078 15079 } 15080 15081 15082 void extractSmallStringSmallJsonSmallStringGT(void) { 15083 15084 smallArrayt* r; 15085 smallStringt *self = allocG(""); 15086 smallStringt* delim1 = allocSmallString("/"); 15087 smallJsont* delim2 = allocSmallJson(); 15088 15089 // string 15090 setValO(self, "one/two|"); 15091 setTopSO(delim2, "|"); 15092 r = extractSmallStringSmallJsonSmallStringG(self, delim1, delim2); 15093 ck_assert_ptr_ne(r, null); 15094 char *s = toStringO(r); 15095 ck_assert_str_eq(s, "[\"two\"]"); 15096 free(s); 15097 terminateO(r); 15098 terminateO(delim1); 15099 terminateO(delim2); 15100 terminateO(self); 15101 15102 } 15103 15104 15105 void extractSmallStringSmallStringSmallStringGT(void) { 15106 15107 smallArrayt* r; 15108 smallStringt *self = allocG(""); 15109 smallStringt* delim1 = allocSmallString("/"); 15110 smallStringt* delim2 = allocSmallString("|"); 15111 15112 // string 15113 setValO(self, "one/two|"); 15114 setValO(delim2, "|"); 15115 r = extractSmallStringSmallStringSmallStringG(self, delim1, delim2); 15116 ck_assert_ptr_ne(r, null); 15117 char *s = toStringO(r); 15118 ck_assert_str_eq(s, "[\"two\"]"); 15119 free(s); 15120 terminateO(r); 15121 terminateO(delim1); 15122 terminateO(delim2); 15123 terminateO(self); 15124 15125 } 15126 15127 15128 void extractSmallStringSSmallStringGT(void) { 15129 15130 smallArrayt* r; 15131 smallStringt *self = allocG(""); 15132 smallStringt* delim1 = allocSmallString("/"); 15133 15134 // string 15135 setValO(self, "one/two|"); 15136 r = extractSmallStringSSmallStringG(self, delim1, "|"); 15137 ck_assert_ptr_ne(r, null); 15138 char *s = toStringO(r); 15139 ck_assert_str_eq(s, "[\"two\"]"); 15140 free(s); 15141 terminateO(r); 15142 terminateO(delim1); 15143 terminateO(self); 15144 15145 } 15146 15147 15148 void extractSmallStringCharSmallStringGT(void) { 15149 15150 smallArrayt* r; 15151 smallStringt *self = allocG(""); 15152 smallStringt* delim1 = allocSmallString("/"); 15153 15154 // string 15155 setValO(self, "one/two|"); 15156 r = extractSmallStringCharSmallStringG(self, delim1, '|'); 15157 ck_assert_ptr_ne(r, null); 15158 char *s = toStringO(r); 15159 ck_assert_str_eq(s, "[\"two\"]"); 15160 free(s); 15161 terminateO(r); 15162 terminateO(delim1); 15163 terminateO(self); 15164 15165 } 15166 15167 15168 void extractSSmallJsonSmallStringGT(void) { 15169 15170 smallArrayt* r; 15171 smallStringt *self = allocG(""); 15172 smallJsont* delim2 = allocSmallJson(); 15173 15174 // string 15175 setValO(self, "one/two|"); 15176 setTopSO(delim2, "|"); 15177 r = extractSSmallJsonSmallStringG(self, "/", delim2); 15178 ck_assert_ptr_ne(r, null); 15179 char *s = toStringO(r); 15180 ck_assert_str_eq(s, "[\"two\"]"); 15181 free(s); 15182 terminateO(r); 15183 terminateO(delim2); 15184 terminateO(self); 15185 15186 } 15187 15188 15189 void extractSSmallStringSmallStringGT(void) { 15190 15191 smallArrayt* r; 15192 smallStringt *self = allocG(""); 15193 smallStringt* delim2 = allocSmallString("|"); 15194 15195 // string 15196 setValO(self, "one/two|"); 15197 setValO(delim2, "|"); 15198 r = extractSSmallStringSmallStringG(self, "/", delim2); 15199 ck_assert_ptr_ne(r, null); 15200 char *s = toStringO(r); 15201 ck_assert_str_eq(s, "[\"two\"]"); 15202 free(s); 15203 terminateO(r); 15204 terminateO(delim2); 15205 terminateO(self); 15206 15207 } 15208 15209 15210 void extractCharSmallJsonSmallStringGT(void) { 15211 15212 smallArrayt* r; 15213 smallStringt *self = allocG(""); 15214 smallJsont* delim2 = allocSmallJson(); 15215 15216 // string 15217 setValO(self, "one/two|"); 15218 setTopSO(delim2, "|"); 15219 r = extractCharSmallJsonSmallStringG(self, '/', delim2); 15220 ck_assert_ptr_ne(r, null); 15221 char *s = toStringO(r); 15222 ck_assert_str_eq(s, "[\"two\"]"); 15223 free(s); 15224 terminateO(r); 15225 terminateO(delim2); 15226 terminateO(self); 15227 15228 } 15229 15230 15231 void extractCharSmallStringSmallStringGT(void) { 15232 15233 smallArrayt* r; 15234 smallStringt *self = allocG(""); 15235 smallStringt* delim2 = allocSmallString("|"); 15236 15237 // string 15238 setValO(self, "one/two|"); 15239 setValO(delim2, "|"); 15240 r = extractCharSmallStringSmallStringG(self, '/', delim2); 15241 ck_assert_ptr_ne(r, null); 15242 char *s = toStringO(r); 15243 ck_assert_str_eq(s, "[\"two\"]"); 15244 free(s); 15245 terminateO(r); 15246 terminateO(delim2); 15247 terminateO(self); 15248 15249 } 15250 15251 15252 void icSplitSmallStringGT(void) { 15253 15254 smallArrayt* r; 15255 smallStringt *self = allocG(""); 15256 15257 setValO(self, "one/two"); 15258 r = icSplitSmallStringG(self, "/"); 15259 ck_assert_ptr_ne(r, null); 15260 char *s = toStringO(r); 15261 ck_assert_str_eq(s, "[\"one\",\"two\"]"); 15262 free(s); 15263 terminateO(r); 15264 terminateO(self); 15265 15266 } 15267 15268 15269 void icSplitCharSmallStringGT(void) { 15270 15271 smallArrayt* r; 15272 smallStringt *self = allocG(""); 15273 15274 setValO(self, "one/two"); 15275 r = icSplitCharSmallStringG(self, 'T'); 15276 ck_assert_ptr_ne(r, null); 15277 char *s = toStringO(r); 15278 ck_assert_str_eq(s, "[\"one/\",\"wo\"]"); 15279 free(s); 15280 terminateO(r); 15281 terminateO(self); 15282 15283 } 15284 15285 15286 void icSplitSmallJsonSmallStringGT(void) { 15287 15288 smallArrayt* r; 15289 smallStringt *self = allocG(""); 15290 smallJsont *delim = allocSmallJson(); 15291 15292 // string 15293 setValO(self, "one/two"); 15294 setTopSO(delim, "T"); 15295 r = icSplitSmallJsonSmallStringG(self, delim); 15296 ck_assert_ptr_ne(r, null); 15297 char *s = toStringO(r); 15298 ck_assert_str_eq(s, "[\"one/\",\"wo\"]"); 15299 free(s); 15300 terminateO(r); 15301 terminateO(delim); 15302 terminateO(self); 15303 15304 } 15305 15306 15307 void icSplitSmallStringSmallStringGT(void) { 15308 15309 smallArrayt* r; 15310 smallStringt *self = allocG(""); 15311 smallStringt *delim = allocSmallString("T"); 15312 15313 // string 15314 setValO(self, "one/two"); 15315 r = icSplitSmallStringSmallStringG(self, delim); 15316 ck_assert_ptr_ne(r, null); 15317 char *s = toStringO(r); 15318 ck_assert_str_eq(s, "[\"one/\",\"wo\"]"); 15319 free(s); 15320 terminateO(r); 15321 terminateO(delim); 15322 terminateO(self); 15323 15324 } 15325 15326 15327 void icSplitCharPSSmallStringGT(void) { 15328 15329 char** r; 15330 smallStringt *self = allocG(""); 15331 15332 setValO(self, "one/two"); 15333 r = icSplitCharPSSmallStringG(self, "T"); 15334 ck_assert_uint_eq(listLengthS(r),2); 15335 ck_assert_str_eq(r[0], "one/"); 15336 ck_assert_str_eq(r[1], "wo"); 15337 listFreeS(r); 15338 terminateO(self); 15339 15340 } 15341 15342 15343 void icSplitCharSSmallStringGT(void) { 15344 15345 char** r; 15346 smallStringt *self = allocG(""); 15347 15348 setValO(self, "one/two"); 15349 r = icSplitCharSSmallStringG(self, 'T'); 15350 ck_assert_uint_eq(listLengthS(r),2); 15351 ck_assert_str_eq(r[0], "one/"); 15352 ck_assert_str_eq(r[1], "wo"); 15353 listFreeS(r); 15354 terminateO(self); 15355 15356 } 15357 15358 15359 void icSplitSmallJsonSSmallStringGT(void) { 15360 15361 char** r; 15362 smallStringt *self = allocG(""); 15363 smallJsont *delim = allocSmallJson(); 15364 15365 // string 15366 setValO(self, "one/two"); 15367 setTopSO(delim, "T"); 15368 r = icSplitSmallJsonSSmallStringG(self, delim); 15369 ck_assert_uint_eq(listLengthS(r),2); 15370 ck_assert_str_eq(r[0], "one/"); 15371 ck_assert_str_eq(r[1], "wo"); 15372 listFreeS(r); 15373 terminateO(delim); 15374 terminateO(self); 15375 15376 } 15377 15378 15379 void icSplitSmallStringSSmallStringGT(void) { 15380 15381 char** r; 15382 smallStringt *self = allocG(""); 15383 smallStringt *delim = allocSmallString("T"); 15384 15385 // string 15386 setValO(self, "one/two"); 15387 r = icSplitSmallStringSSmallStringG(self, delim); 15388 ck_assert_uint_eq(listLengthS(r),2); 15389 ck_assert_str_eq(r[0], "one/"); 15390 ck_assert_str_eq(r[1], "wo"); 15391 listFreeS(r); 15392 terminateO(delim); 15393 terminateO(self); 15394 15395 } 15396 15397 15398 void icExtractSmallStringGT(void) { 15399 15400 smallArrayt* r; 15401 smallStringt *self = allocG(""); 15402 15403 setValO(self, "one/twos"); 15404 r = icExtractSmallStringG(self, "E", "S"); 15405 ck_assert_ptr_ne(r, null); 15406 char *s = toStringO(r); 15407 ck_assert_str_eq(s, "[\"/two\"]"); 15408 free(s); 15409 terminateO(r); 15410 terminateO(self); 15411 15412 } 15413 15414 15415 void icExtractCharSSmallStringGT(void) { 15416 15417 smallArrayt* r; 15418 smallStringt *self = allocG(""); 15419 15420 setValO(self, "one/twos"); 15421 r = icExtractCharSSmallStringG(self, 'E', "S"); 15422 ck_assert_ptr_ne(r, null); 15423 char *s = toStringO(r); 15424 ck_assert_str_eq(s, "[\"/two\"]"); 15425 free(s); 15426 terminateO(r); 15427 terminateO(self); 15428 15429 } 15430 15431 15432 void icExtractSCharSmallStringGT(void) { 15433 15434 smallArrayt* r; 15435 smallStringt *self = allocG(""); 15436 15437 setValO(self, "one/twos"); 15438 r = icExtractSCharSmallStringG(self, "E", 'S'); 15439 ck_assert_ptr_ne(r, null); 15440 char *s = toStringO(r); 15441 ck_assert_str_eq(s, "[\"/two\"]"); 15442 free(s); 15443 terminateO(r); 15444 terminateO(self); 15445 15446 } 15447 15448 15449 void icExtractCharCharSmallStringGT(void) { 15450 15451 smallArrayt* r; 15452 smallStringt *self = allocG(""); 15453 15454 setValO(self, "one/twos"); 15455 r = icExtractCharCharSmallStringG(self, 'E', 'S'); 15456 ck_assert_ptr_ne(r, null); 15457 char *s = toStringO(r); 15458 ck_assert_str_eq(s, "[\"/two\"]"); 15459 free(s); 15460 terminateO(r); 15461 terminateO(self); 15462 15463 } 15464 15465 15466 void icExtractSmallJsonSmallJsonSmallStringGT(void) { 15467 15468 smallArrayt* r; 15469 smallStringt *self = allocG(""); 15470 smallJsont* delim1 = allocSmallJson(); 15471 smallJsont* delim2 = allocSmallJson(); 15472 15473 // string 15474 setValO(self, "one/twos"); 15475 setTopSO(delim1, "E"); 15476 setTopSO(delim2, "S"); 15477 r = icExtractSmallJsonSmallJsonSmallStringG(self, delim1, delim2); 15478 ck_assert_ptr_ne(r, null); 15479 char *s = toStringO(r); 15480 ck_assert_str_eq(s, "[\"/two\"]"); 15481 free(s); 15482 terminateO(r); 15483 terminateO(delim1); 15484 terminateO(delim2); 15485 terminateO(self); 15486 15487 } 15488 15489 15490 void icExtractSmallJsonSmallStringSmallStringGT(void) { 15491 15492 smallArrayt* r; 15493 smallStringt *self = allocG(""); 15494 smallJsont* delim1 = allocSmallJson(); 15495 smallStringt* delim2 = allocSmallString("S"); 15496 15497 // string 15498 setValO(self, "one/twos"); 15499 setTopSO(delim1, "E"); 15500 r = icExtractSmallJsonSmallStringSmallStringG(self, delim1, delim2); 15501 ck_assert_ptr_ne(r, null); 15502 char *s = toStringO(r); 15503 ck_assert_str_eq(s, "[\"/two\"]"); 15504 free(s); 15505 terminateO(r); 15506 terminateO(delim1); 15507 terminateO(delim2); 15508 terminateO(self); 15509 15510 } 15511 15512 15513 void icExtractSmallJsonSSmallStringGT(void) { 15514 15515 smallArrayt* r; 15516 smallStringt *self = allocG(""); 15517 smallJsont* delim1 = allocSmallJson(); 15518 15519 // string 15520 setValO(self, "one/twos"); 15521 setTopSO(delim1, "E"); 15522 r = icExtractSmallJsonSSmallStringG(self, delim1, "S"); 15523 ck_assert_ptr_ne(r, null); 15524 char *s = toStringO(r); 15525 ck_assert_str_eq(s, "[\"/two\"]"); 15526 free(s); 15527 terminateO(r); 15528 terminateO(delim1); 15529 terminateO(self); 15530 15531 } 15532 15533 15534 void icExtractSmallJsonCharSmallStringGT(void) { 15535 15536 smallArrayt* r; 15537 smallStringt *self = allocG(""); 15538 smallJsont* delim1 = allocSmallJson(); 15539 15540 // string 15541 setValO(self, "one/twos"); 15542 setTopSO(delim1, "E"); 15543 r = icExtractSmallJsonCharSmallStringG(self, delim1, 'S'); 15544 ck_assert_ptr_ne(r, null); 15545 char *s = toStringO(r); 15546 ck_assert_str_eq(s, "[\"/two\"]"); 15547 free(s); 15548 terminateO(r); 15549 terminateO(delim1); 15550 terminateO(self); 15551 15552 } 15553 15554 15555 void icExtractSmallStringSmallJsonSmallStringGT(void) { 15556 15557 smallArrayt* r; 15558 smallStringt *self = allocG(""); 15559 smallStringt* delim1 = allocSmallString("E"); 15560 smallJsont* delim2 = allocSmallJson(); 15561 15562 // string 15563 setValO(self, "one/twos"); 15564 setTopSO(delim2, "S"); 15565 r = icExtractSmallStringSmallJsonSmallStringG(self, delim1, delim2); 15566 ck_assert_ptr_ne(r, null); 15567 char *s = toStringO(r); 15568 ck_assert_str_eq(s, "[\"/two\"]"); 15569 free(s); 15570 terminateO(r); 15571 terminateO(delim1); 15572 terminateO(delim2); 15573 terminateO(self); 15574 15575 } 15576 15577 15578 void icExtractSmallStringSmallStringSmallStringGT(void) { 15579 15580 smallArrayt* r; 15581 smallStringt *self = allocG(""); 15582 smallStringt* delim1 = allocSmallString("E"); 15583 smallStringt* delim2 = allocSmallString("|"); 15584 15585 // string 15586 setValO(self, "one/twos"); 15587 setValO(delim2, "S"); 15588 r = icExtractSmallStringSmallStringSmallStringG(self, delim1, delim2); 15589 ck_assert_ptr_ne(r, null); 15590 char *s = toStringO(r); 15591 ck_assert_str_eq(s, "[\"/two\"]"); 15592 free(s); 15593 terminateO(r); 15594 terminateO(delim1); 15595 terminateO(delim2); 15596 terminateO(self); 15597 15598 } 15599 15600 15601 void icExtractSmallStringSSmallStringGT(void) { 15602 15603 smallArrayt* r; 15604 smallStringt *self = allocG(""); 15605 smallStringt* delim1 = allocSmallString("E"); 15606 15607 // string 15608 setValO(self, "one/twos"); 15609 r = icExtractSmallStringSSmallStringG(self, delim1, "S"); 15610 ck_assert_ptr_ne(r, null); 15611 char *s = toStringO(r); 15612 ck_assert_str_eq(s, "[\"/two\"]"); 15613 free(s); 15614 terminateO(r); 15615 terminateO(delim1); 15616 terminateO(self); 15617 15618 } 15619 15620 15621 void icExtractSmallStringCharSmallStringGT(void) { 15622 15623 smallArrayt* r; 15624 smallStringt *self = allocG(""); 15625 smallStringt* delim1 = allocSmallString("E"); 15626 15627 // string 15628 setValO(self, "one/twos"); 15629 r = icExtractSmallStringCharSmallStringG(self, delim1, 'S'); 15630 ck_assert_ptr_ne(r, null); 15631 char *s = toStringO(r); 15632 ck_assert_str_eq(s, "[\"/two\"]"); 15633 free(s); 15634 terminateO(r); 15635 terminateO(delim1); 15636 terminateO(self); 15637 15638 } 15639 15640 15641 void icExtractSSmallJsonSmallStringGT(void) { 15642 15643 smallArrayt* r; 15644 smallStringt *self = allocG(""); 15645 smallJsont* delim2 = allocSmallJson(); 15646 15647 // string 15648 setValO(self, "one/twos"); 15649 setTopSO(delim2, "S"); 15650 r = icExtractSSmallJsonSmallStringG(self, "E", delim2); 15651 ck_assert_ptr_ne(r, null); 15652 char *s = toStringO(r); 15653 ck_assert_str_eq(s, "[\"/two\"]"); 15654 free(s); 15655 terminateO(r); 15656 terminateO(delim2); 15657 terminateO(self); 15658 15659 } 15660 15661 15662 void icExtractSSmallStringSmallStringGT(void) { 15663 15664 smallArrayt* r; 15665 smallStringt *self = allocG(""); 15666 smallStringt* delim2 = allocSmallString("|"); 15667 15668 // string 15669 setValO(self, "one/twos"); 15670 setValO(delim2, "S"); 15671 r = icExtractSSmallStringSmallStringG(self, "E", delim2); 15672 ck_assert_ptr_ne(r, null); 15673 char *s = toStringO(r); 15674 ck_assert_str_eq(s, "[\"/two\"]"); 15675 free(s); 15676 terminateO(r); 15677 terminateO(delim2); 15678 terminateO(self); 15679 15680 } 15681 15682 15683 void icExtractCharSmallJsonSmallStringGT(void) { 15684 15685 smallArrayt* r; 15686 smallStringt *self = allocG(""); 15687 smallJsont* delim2 = allocSmallJson(); 15688 15689 // string 15690 setValO(self, "one/twos"); 15691 setTopSO(delim2, "S"); 15692 r = icExtractCharSmallJsonSmallStringG(self, 'E', delim2); 15693 ck_assert_ptr_ne(r, null); 15694 char *s = toStringO(r); 15695 ck_assert_str_eq(s, "[\"/two\"]"); 15696 free(s); 15697 terminateO(r); 15698 terminateO(delim2); 15699 terminateO(self); 15700 15701 } 15702 15703 15704 void icExtractCharSmallStringSmallStringGT(void) { 15705 15706 smallArrayt* r; 15707 smallStringt *self = allocG(""); 15708 smallStringt* delim2 = allocSmallString("|"); 15709 15710 // string 15711 setValO(self, "one/twos"); 15712 setValO(delim2, "S"); 15713 r = icExtractCharSmallStringSmallStringG(self, 'E', delim2); 15714 ck_assert_ptr_ne(r, null); 15715 char *s = toStringO(r); 15716 ck_assert_str_eq(s, "[\"/two\"]"); 15717 free(s); 15718 terminateO(r); 15719 terminateO(delim2); 15720 terminateO(self); 15721 15722 } 15723 15724 15725 void readFileSmallStringGT(void) { 15726 15727 smallStringt* r; 15728 smallStringt *self = allocG(""); 15729 15730 r = readFileSmallStringG(self, "../textTest.null"); 15731 ck_assert_ptr_ne(r, null); 15732 char *s = toStringO(r); 15733 ck_assert_str_eq(s, "LINE 1\nANOTHER line\n"); 15734 free(s); 15735 terminateO(self); 15736 15737 } 15738 15739 15740 void readFileSmallJsonSmallStringGT(void) { 15741 15742 smallStringt* r; 15743 smallStringt *self = allocG(""); 15744 smallJsont *filePath = allocSmallJson(); 15745 15746 // text 15747 setTopSO(filePath, "../textTest.null"); 15748 r = readFileSmallJsonSmallStringG(self, filePath); 15749 ck_assert_ptr_ne(r, null); 15750 char *s = toStringO(r); 15751 ck_assert_str_eq(s, "LINE 1\nANOTHER line\n"); 15752 free(s); 15753 terminateO(filePath); 15754 terminateO(self); 15755 15756 } 15757 15758 15759 void readFileSmallStringSmallStringGT(void) { 15760 15761 smallStringt* r; 15762 smallStringt *self = allocG(""); 15763 smallStringt *filePath = allocSmallString(""); 15764 15765 // text 15766 setValO(filePath, "../textTest.null"); 15767 r = readFileSmallStringSmallStringG(self, filePath); 15768 ck_assert_ptr_ne(r, null); 15769 char *s = toStringO(r); 15770 ck_assert_str_eq(s, "LINE 1\nANOTHER line\n"); 15771 free(s); 15772 terminateO(filePath); 15773 terminateO(self); 15774 15775 } 15776 15777 15778 void readStreamSmallStringGT(void) { 15779 15780 smallStringt* r; 15781 smallStringt *self = allocG(""); 15782 FILE *f; 15783 15784 // text 15785 f = fopen("../textTest.null", "r"); 15786 r = readStreamSmallStringG(self, f); 15787 ck_assert_ptr_ne(r, null); 15788 char *s = toStringO(r); 15789 ck_assert_str_eq(s, "LINE 1\nANOTHER line\n"); 15790 free(s); 15791 fclose(f); 15792 terminateO(self); 15793 15794 } 15795 15796 15797 void writeFileSmallStringGT(void) { 15798 15799 int r; 15800 smallStringt *self = allocG(""); 15801 15802 readFileO(self, "../textTest.null"); 15803 r = writeFileSmallStringG(self, "textOutTest.null"); 15804 ck_assert(r); 15805 // check textOutTest.null 15806 freeO(self); 15807 readFileO(self, "textOutTest.null"); 15808 ck_assert_uint_eq(lenO(self),20); 15809 char *s = toStringO(self); 15810 ck_assert_str_eq(s, "LINE 1\nANOTHER line\n"); 15811 free(s); 15812 terminateO(self); 15813 15814 } 15815 15816 15817 void writeFileSmallJsonSmallStringGT(void) { 15818 15819 int r; 15820 smallStringt *self = allocG(""); 15821 smallJsont *filePath = allocSmallJson(); 15822 15823 // write textOutTest.null 15824 setTopSO(filePath, "textOutTest.null"); 15825 readFileO(self, "../textTest.null"); 15826 r = writeFileSmallJsonSmallStringG(self, filePath); 15827 ck_assert(r); 15828 // check textOutTest.null 15829 freeO(self); 15830 readFileO(self, "textOutTest.null"); 15831 ck_assert_uint_eq(lenO(self),20); 15832 char *s = toStringO(self); 15833 ck_assert_str_eq(s, "LINE 1\nANOTHER line\n"); 15834 free(s); 15835 terminateO(filePath); 15836 terminateO(self); 15837 15838 } 15839 15840 15841 void writeFileSmallStringSmallStringGT(void) { 15842 15843 int r; 15844 smallStringt *self = allocG(""); 15845 smallStringt *filePath = allocSmallString(""); 15846 15847 // write textOutTest.null 15848 setValO(filePath, "textOutTest.null"); 15849 readFileO(self, "../textTest.null"); 15850 r = writeFileSmallStringSmallStringG(self, filePath); 15851 ck_assert(r); 15852 // check textOutTest.null 15853 freeO(self); 15854 readFileO(self, "textOutTest.null"); 15855 ck_assert_uint_eq(lenO(self),20); 15856 char *s = toStringO(self); 15857 ck_assert_str_eq(s, "LINE 1\nANOTHER line\n"); 15858 free(s); 15859 terminateO(filePath); 15860 terminateO(self); 15861 15862 } 15863 15864 15865 void writeStreamSmallStringGT(void) { 15866 15867 int r; 15868 smallStringt *self = allocG(""); 15869 FILE *f; 15870 15871 // write textOutTest.null 15872 readFileO(self, "../textTest.null"); 15873 f = fopen("textOutTest.null", "w"); 15874 r = writeStreamSmallStringG(self, f); 15875 ck_assert(r); 15876 fclose(f); 15877 // check textOutTest.null 15878 freeO(self); 15879 readFileO(self, "textOutTest.null"); 15880 ck_assert_uint_eq(lenO(self),20); 15881 ck_assert_str_eq(ssGet(self), "LINE 1\nANOTHER line\n"); 15882 terminateO(self); 15883 15884 } 15885 15886 15887 void appendFileSmallStringFGT(void) { 15888 15889 int r; 15890 smallStringt *self = allocG(""); 15891 15892 setValO(self, "appended line\n"); 15893 r = appendFileSmallStringFG(self, "appendTextOutTest.null"); 15894 ck_assert(r); 15895 setValO(self, "appended line 2\n"); 15896 r = appendFileSmallStringFG(self, "appendTextOutTest.null"); 15897 ck_assert(r); 15898 // check textOutTest.null 15899 freeO(self); 15900 readFileO(self, "appendTextOutTest.null"); 15901 ck_assert_uint_eq(lenO(self),30); 15902 ck_assert_str_eq(ssGet(self), "appended line\nappended line 2\n"); 15903 if (fileExists("appendTextOutTest.null")) 15904 rmAll("appendTextOutTest.null"); 15905 terminateO(self); 15906 15907 } 15908 15909 15910 void appendFileSmallStringSmallStringGT(void) { 15911 15912 int r; 15913 smallStringt *self = allocG(""); 15914 smallStringt *filePath = allocSmallString(""); 15915 15916 // write textOutTest.null 15917 setValO(self, "appended line\n"); 15918 setValO(filePath, "appendTextOutTest.null"); 15919 r = appendFileSmallStringSmallStringG(self, filePath); 15920 ck_assert(r); 15921 setValO(self, "appended line 2\n"); 15922 r = appendFileSmallStringSmallStringG(self, filePath); 15923 ck_assert(r); 15924 // check textOutTest.null 15925 freeO(self); 15926 readFileO(self, "appendTextOutTest.null"); 15927 ck_assert_uint_eq(lenO(self),30); 15928 ck_assert_str_eq(ssGet(self), "appended line\nappended line 2\n"); 15929 if (fileExists("appendTextOutTest.null")) 15930 rmAll("appendTextOutTest.null"); 15931 terminateO(filePath); 15932 terminateO(self); 15933 15934 } 15935 15936 15937 15938 15939 15940 15941 int main(int n UNUSED, char**v UNUSED) { 15942 // disable btrace to make the test run faster 15943 btraceDisable(); 15944 initiateSmallStringT(); 15945 initiateAllocateSmallStringT(); 15946 allocSmallStringT(); 15947 createSFT(); 15948 freeSmallStringT(); 15949 terminateSmallStringT(); 15950 toStringSmallStringT(); 15951 duplicateSmallStringT(); 15952 smashSmallStringT(); 15953 finishSmallStringT(); 15954 getSmallStringT(); 15955 setSmallStringT(); 15956 setCharSmallStringT(); 15957 setBoolSmallStringT(); 15958 setDoubleSmallStringT(); 15959 setInt64SmallStringT(); 15960 setInt32SmallStringT(); 15961 setUint32SmallStringT(); 15962 setUint64SmallStringT(); 15963 setSmallArraySmallStringT(); 15964 setFromSmallDictSmallStringT(); 15965 setFromSmallJsonSmallStringT(); 15966 setSmallBoolSmallStringT(); 15967 setSmallDoubleSmallStringT(); 15968 setSmallIntSmallStringT(); 15969 setSmallJsonSmallStringT(); 15970 setSmallStringSmallStringT(); 15971 setNFreeSmallStringT(); 15972 appendSmallStringT(); 15973 appendSmallJsonSmallStringT(); 15974 appendNSmashSmallStringT(); 15975 appendSSmallStringT(); 15976 appendCharSmallStringT(); 15977 appendNSmashSmallJsonSmallStringT(); 15978 appendNSmashSSmallStringT(); 15979 prependSmallStringT(); 15980 prependSmallJsonSmallStringT(); 15981 prependNSmashSmallStringT(); 15982 prependNSmashSmallJsonSmallStringT(); 15983 prependSSmallStringT(); 15984 prependCharSmallStringT(); 15985 prependNSmashSSmallStringT(); 15986 catSmallStringT(); 15987 catSSmallStringT(); 15988 pushNFreeManySmallStringT(); 15989 pushNFreeManySSmallStringT(); 15990 replaceSmallStringT(); 15991 replaceCharSSmallStringT(); 15992 replaceSCharSmallStringT(); 15993 replaceCharCharSmallStringT(); 15994 replaceSmallJsonSmallJsonSmallStringT(); 15995 replaceSmallJsonSmallStringSmallStringT(); 15996 replaceSmallJsonSSmallStringT(); 15997 replaceSmallJsonCharSmallStringT(); 15998 replaceSmallStringSmallJsonSmallStringT(); 15999 replaceSmallStringSmallStringSmallStringT(); 16000 replaceSmallStringSSmallStringT(); 16001 replaceSmallStringCharSmallStringT(); 16002 replaceSSmallJsonSmallStringT(); 16003 replaceSSmallStringSmallStringT(); 16004 replaceCharSmallJsonSmallStringT(); 16005 replaceCharSmallStringSmallStringT(); 16006 replaceManySmallStringT(); 16007 icReplaceSmallStringT(); 16008 icReplaceCharSSmallStringT(); 16009 icReplaceSCharSmallStringT(); 16010 icReplaceCharCharSmallStringT(); 16011 icReplaceSmallJsonSmallJsonSmallStringT(); 16012 icReplaceSmallJsonSmallStringSmallStringT(); 16013 icReplaceSmallJsonSSmallStringT(); 16014 icReplaceSmallJsonCharSmallStringT(); 16015 icReplaceSmallStringSmallJsonSmallStringT(); 16016 icReplaceSmallStringSmallStringSmallStringT(); 16017 icReplaceSmallStringSSmallStringT(); 16018 icReplaceSmallStringCharSmallStringT(); 16019 icReplaceSSmallJsonSmallStringT(); 16020 icReplaceSSmallStringSmallStringT(); 16021 icReplaceCharSmallJsonSmallStringT(); 16022 icReplaceCharSmallStringSmallStringT(); 16023 icReplaceManySmallStringT(); 16024 equalSmallStringT(); 16025 equalSSmallStringT(); 16026 equalCharSmallStringT(); 16027 equalSmallStringBaseT(); 16028 equalSmallStringBoolT(); 16029 equalSmallStringDoubleT(); 16030 equalSmallStringInt64T(); 16031 equalSmallStringInt32T(); 16032 equalSmallStringUint32T(); 16033 equalSmallStringUint64T(); 16034 equalSmallStringSmallBoolT(); 16035 equalSmallStringSmallBytesT(); 16036 equalSmallStringSmallDoubleT(); 16037 equalSmallStringSmallIntT(); 16038 equalSmallStringSmallJsonT(); 16039 icEqualSmallStringT(); 16040 icEqualSSmallStringT(); 16041 icEqualCharSmallStringT(); 16042 icEqualSmallStringBaseT(); 16043 icEqualSmallStringSmallJsonT(); 16044 equalISSmallStringT(); 16045 equalICharSmallStringT(); 16046 equalISmallJsonSmallStringT(); 16047 equalISmallStringSmallStringT(); 16048 startsWithSSmallStringT(); 16049 startsWithCharSmallStringT(); 16050 startsWithSmallJsonSmallStringT(); 16051 startsWithSmallStringSmallStringT(); 16052 endsWithSSmallStringT(); 16053 endsWithCharSmallStringT(); 16054 endsWithSmallJsonSmallStringT(); 16055 endsWithSmallStringSmallStringT(); 16056 countSSmallStringT(); 16057 countCharSmallStringT(); 16058 countSmallJsonSmallStringT(); 16059 countSmallStringSmallStringT(); 16060 icStartsWithSSmallStringT(); 16061 icStartsWithCharSmallStringT(); 16062 icStartsWithSmallJsonSmallStringT(); 16063 icStartsWithSmallStringSmallStringT(); 16064 icEndsWithSSmallStringT(); 16065 icEndsWithCharSmallStringT(); 16066 icEndsWithSmallJsonSmallStringT(); 16067 icEndsWithSmallStringSmallStringT(); 16068 icCountSSmallStringT(); 16069 icCountCharSmallStringT(); 16070 icCountSmallJsonSmallStringT(); 16071 icCountSmallStringSmallStringT(); 16072 isNumberSmallStringT(); 16073 isIntSmallStringT(); 16074 parseIntSmallStringT(); 16075 parseDoubleSmallStringT(); 16076 intToSmallStringT(); 16077 doubleToSmallStringT(); 16078 lenSmallStringT(); 16079 upperSmallStringT(); 16080 lowerSmallStringT(); 16081 trimSmallStringT(); 16082 lTrimSmallStringT(); 16083 rTrimSmallStringT(); 16084 uniqSmallStringT(); 16085 icUniqSmallStringT(); 16086 getAtSmallStringT(); 16087 setAtSmallStringT(); 16088 sliceSmallStringT(); 16089 cropSmallStringT(); 16090 cropSSmallStringT(); 16091 cropSmallJsonSmallStringT(); 16092 cropElemSmallStringT(); 16093 copySmallStringT(); 16094 insertSmallStringT(); 16095 insertSmallJsonSmallStringT(); 16096 insertSSmallStringT(); 16097 insertNFreeSmallStringT(); 16098 insertNFreeSmallJsonSmallStringT(); 16099 insertSNFreeSmallStringT(); 16100 injectSmallStringT(); 16101 delSmallStringT(); 16102 delElemSmallStringT(); 16103 hasSmallStringT(); 16104 hasCharSmallStringT(); 16105 hasSmallJsonSmallStringT(); 16106 hasSmallStringSmallStringT(); 16107 findSmallStringT(); 16108 findCharSmallStringT(); 16109 findSmallJsonSmallStringT(); 16110 findSmallStringSmallStringT(); 16111 indexOfSmallStringT(); 16112 indexOfCharSmallStringT(); 16113 indexOfSmallJsonSmallStringT(); 16114 indexOfSmallStringSmallStringT(); 16115 icHasSmallStringT(); 16116 icHasCharSmallStringT(); 16117 icHasSmallJsonSmallStringT(); 16118 icHasSmallStringSmallStringT(); 16119 icFindSmallStringT(); 16120 icFindCharSmallStringT(); 16121 icFindSmallJsonSmallStringT(); 16122 icFindSmallStringSmallStringT(); 16123 icIndexOfSmallStringT(); 16124 icIndexOfCharSmallStringT(); 16125 icIndexOfSmallJsonSmallStringT(); 16126 icIndexOfSmallStringSmallStringT(); 16127 emptySmallStringT(); 16128 isEmptySmallStringT(); 16129 isBlankSmallStringT(); 16130 splitSmallStringT(); 16131 splitCharSmallStringT(); 16132 splitSmallJsonSmallStringT(); 16133 splitSmallStringSmallStringT(); 16134 splitSSmallStringT(); 16135 splitCharSSmallStringT(); 16136 splitSmallJsonSSmallStringT(); 16137 splitSmallStringSSmallStringT(); 16138 extractSmallStringT(); 16139 extractCharSSmallStringT(); 16140 extractSCharSmallStringT(); 16141 extractCharCharSmallStringT(); 16142 extractSmallJsonSmallJsonSmallStringT(); 16143 extractSmallJsonSmallStringSmallStringT(); 16144 extractSmallJsonSSmallStringT(); 16145 extractSmallJsonCharSmallStringT(); 16146 extractSmallStringSmallJsonSmallStringT(); 16147 extractSmallStringSmallStringSmallStringT(); 16148 extractSmallStringSSmallStringT(); 16149 extractSmallStringCharSmallStringT(); 16150 extractSSmallJsonSmallStringT(); 16151 extractSSmallStringSmallStringT(); 16152 extractCharSmallJsonSmallStringT(); 16153 extractCharSmallStringSmallStringT(); 16154 icSplitSmallStringT(); 16155 icSplitCharSmallStringT(); 16156 icSplitSmallJsonSmallStringT(); 16157 icSplitSmallStringSmallStringT(); 16158 icSplitSSmallStringT(); 16159 icSplitCharSSmallStringT(); 16160 icSplitSmallJsonSSmallStringT(); 16161 icSplitSmallStringSSmallStringT(); 16162 icExtractSmallStringT(); 16163 icExtractCharSSmallStringT(); 16164 icExtractSCharSmallStringT(); 16165 icExtractCharCharSmallStringT(); 16166 icExtractSmallJsonSmallJsonSmallStringT(); 16167 icExtractSmallJsonSmallStringSmallStringT(); 16168 icExtractSmallJsonSSmallStringT(); 16169 icExtractSmallJsonCharSmallStringT(); 16170 icExtractSmallStringSmallJsonSmallStringT(); 16171 icExtractSmallStringSmallStringSmallStringT(); 16172 icExtractSmallStringSSmallStringT(); 16173 icExtractSmallStringCharSmallStringT(); 16174 icExtractSSmallJsonSmallStringT(); 16175 icExtractSSmallStringSmallStringT(); 16176 icExtractCharSmallJsonSmallStringT(); 16177 icExtractCharSmallStringSmallStringT(); 16178 colorSmallStringT(); 16179 colordSmallStringT(); 16180 readFileSmallStringT(); 16181 readFileSmallJsonSmallStringT(); 16182 readFileSmallStringSmallStringT(); 16183 readStreamSmallStringT(); 16184 writeFileSmallStringT(); 16185 writeFileSmallJsonSmallStringT(); 16186 writeFileSmallStringSmallStringT(); 16187 writeStreamSmallStringT(); 16188 appendFileSmallStringT(); 16189 appendFileSmallStringSmallStringT(); 16190 duplicateSmallStringGT(); 16191 freeSmallStringGT(); 16192 setBoolSmallStringGT(); 16193 setDoubleSmallStringGT(); 16194 setInt64SmallStringGT(); 16195 setInt32SmallStringGT(); 16196 setUint32SmallStringGT(); 16197 setUint64SmallStringGT(); 16198 setSmallStringGT(); 16199 setCharSmallStringGT(); 16200 setSmallArraySmallStringGT(); 16201 setFromSmallDictSmallStringGT(); 16202 setFromSmallJsonSmallStringGT(); 16203 setSmallBoolSmallStringGT(); 16204 setSmallDoubleSmallStringGT(); 16205 setSmallIntSmallStringGT(); 16206 setSmallJsonSmallStringGT(); 16207 setSmallStringSmallStringGT(); 16208 getAtSmallStringGT(); 16209 setAtSmallStringGT(); 16210 appendSmallStringGT(); 16211 appendSmallJsonSmallStringGT(); 16212 appendSSmallStringGT(); 16213 appendCharSmallStringGT(); 16214 appendNSmashSmallStringGT(); 16215 appendNSmashSmallJsonSmallStringGT(); 16216 appendNSmashSSmallStringGT(); 16217 prependSmallStringGT(); 16218 prependSmallJsonSmallStringGT(); 16219 prependSSmallStringGT(); 16220 prependCharSmallStringGT(); 16221 prependNSmashSmallStringGT(); 16222 prependNSmashSmallJsonSmallStringGT(); 16223 prependNSmashSSmallStringGT(); 16224 replaceSmallStringGT(); 16225 replaceCharSSmallStringGT(); 16226 replaceSCharSmallStringGT(); 16227 replaceCharCharSmallStringGT(); 16228 replaceSmallJsonSmallJsonSmallStringGT(); 16229 replaceSmallJsonSmallStringSmallStringGT(); 16230 replaceSmallJsonSSmallStringGT(); 16231 replaceSmallJsonCharSmallStringGT(); 16232 replaceSmallStringSmallJsonSmallStringGT(); 16233 replaceSmallStringSmallStringSmallStringGT(); 16234 replaceSmallStringSSmallStringGT(); 16235 replaceSmallStringCharSmallStringGT(); 16236 replaceSSmallJsonSmallStringGT(); 16237 replaceSSmallStringSmallStringGT(); 16238 replaceCharSmallJsonSmallStringGT(); 16239 replaceCharSmallStringSmallStringGT(); 16240 icReplaceSmallStringGT(); 16241 icReplaceCharSSmallStringGT(); 16242 icReplaceSCharSmallStringGT(); 16243 icReplaceCharCharSmallStringGT(); 16244 icReplaceSmallJsonSmallJsonSmallStringGT(); 16245 icReplaceSmallJsonSmallStringSmallStringGT(); 16246 icReplaceSmallJsonSSmallStringGT(); 16247 icReplaceSmallJsonCharSmallStringGT(); 16248 icReplaceSmallStringSmallJsonSmallStringGT(); 16249 icReplaceSmallStringSmallStringSmallStringGT(); 16250 icReplaceSmallStringSSmallStringGT(); 16251 icReplaceSmallStringCharSmallStringGT(); 16252 icReplaceSSmallJsonSmallStringGT(); 16253 icReplaceSSmallStringSmallStringGT(); 16254 icReplaceCharSmallJsonSmallStringGT(); 16255 icReplaceCharSmallStringSmallStringGT(); 16256 equalSmallStringFGT(); 16257 equalCharSmallStringGT(); 16258 equalSSmallStringGT(); 16259 equalSmallStringBaseGT(); 16260 equalSmallStringBoolGT(); 16261 equalSmallStringDoubleGT(); 16262 equalSmallStringInt64GT(); 16263 equalSmallStringInt32GT(); 16264 equalSmallStringUint32GT(); 16265 equalSmallStringUint64GT(); 16266 equalSmallStringSmallBoolGT(); 16267 equalSmallStringSmallBytesGT(); 16268 equalSmallStringSmallDoubleGT(); 16269 equalSmallStringSmallIntGT(); 16270 equalSmallStringSmallJsonGT(); 16271 icEqualSmallStringFGT(); 16272 icEqualCharSmallStringGT(); 16273 icEqualSSmallStringGT(); 16274 icEqualSmallStringBaseGT(); 16275 icEqualSmallStringSmallJsonGT(); 16276 equalISSmallStringGT(); 16277 equalICharSmallStringGT(); 16278 equalISmallJsonSmallStringGT(); 16279 equalISmallStringSmallStringGT(); 16280 startsWithSSmallStringGT(); 16281 startsWithCharSmallStringGT(); 16282 startsWithSmallJsonSmallStringGT(); 16283 startsWithSmallStringSmallStringGT(); 16284 endsWithSSmallStringGT(); 16285 endsWithCharSmallStringGT(); 16286 endsWithSmallJsonSmallStringGT(); 16287 endsWithSmallStringSmallStringGT(); 16288 countSSmallStringGT(); 16289 countCharSmallStringGT(); 16290 countSmallJsonSmallStringGT(); 16291 countSmallStringSmallStringGT(); 16292 icStartsWithSSmallStringGT(); 16293 icStartsWithCharSmallStringGT(); 16294 icStartsWithSmallJsonSmallStringGT(); 16295 icStartsWithSmallStringSmallStringGT(); 16296 icEndsWithSSmallStringGT(); 16297 icEndsWithCharSmallStringGT(); 16298 icEndsWithSmallJsonSmallStringGT(); 16299 icEndsWithSmallStringSmallStringGT(); 16300 icCountSSmallStringGT(); 16301 icCountCharSmallStringGT(); 16302 icCountSmallJsonSmallStringGT(); 16303 icCountSmallStringSmallStringGT(); 16304 isNumberSmallStringGT(); 16305 isIntSmallStringGT(); 16306 parseIntSmallStringGT(); 16307 intToSmallStringGT(); 16308 parseDoubleSmallStringGT(); 16309 doubleToSmallStringGT(); 16310 lenSmallStringGT(); 16311 upperSmallStringGT(); 16312 lowerSmallStringGT(); 16313 trimSmallStringGT(); 16314 lTrimSmallStringGT(); 16315 rTrimSmallStringGT(); 16316 uniqSmallStringGT(); 16317 icUniqSmallStringGT(); 16318 sliceSmallStringGT(); 16319 cropSmallStringGT(); 16320 cropSSmallStringGT(); 16321 cropSmallJsonSmallStringGT(); 16322 cropElemSmallStringGT(); 16323 copySmallStringGT(); 16324 insertSmallStringGT(); 16325 insertSmallJsonSmallStringGT(); 16326 insertSSmallStringGT(); 16327 insertNFreeSmallStringGT(); 16328 insertNFreeSmallJsonSmallStringGT(); 16329 insertSNFreeSmallStringGT(); 16330 injectSmallStringGT(); 16331 delSmallStringGT(); 16332 delElemSmallStringGT(); 16333 hasSmallStringGT(); 16334 hasCharSmallStringGT(); 16335 hasSmallJsonSmallStringGT(); 16336 hasSmallStringSmallStringGT(); 16337 findSmallStringGT(); 16338 findCharSmallStringGT(); 16339 findSmallJsonSmallStringGT(); 16340 findSmallStringSmallStringGT(); 16341 indexOfSmallStringGT(); 16342 indexOfCharSmallStringGT(); 16343 indexOfSmallJsonSmallStringGT(); 16344 indexOfSmallStringSmallStringGT(); 16345 icHasSmallStringGT(); 16346 icHasCharSmallStringGT(); 16347 icHasSmallJsonSmallStringGT(); 16348 icHasSmallStringSmallStringGT(); 16349 icFindSmallStringGT(); 16350 icFindCharSmallStringGT(); 16351 icFindSmallJsonSmallStringGT(); 16352 icFindSmallStringSmallStringGT(); 16353 icIndexOfSmallStringGT(); 16354 icIndexOfCharSmallStringGT(); 16355 icIndexOfSmallJsonSmallStringGT(); 16356 icIndexOfSmallStringSmallStringGT(); 16357 emptySmallStringGT(); 16358 isEmptySmallStringGT(); 16359 isBlankSmallStringGT(); 16360 splitSmallStringGT(); 16361 splitCharSmallStringGT(); 16362 splitSmallJsonSmallStringGT(); 16363 splitSmallStringSmallStringGT(); 16364 splitCharPSSmallStringGT(); 16365 splitCharSSmallStringGT(); 16366 splitSmallJsonSSmallStringGT(); 16367 splitSmallStringSSmallStringGT(); 16368 extractSmallStringGT(); 16369 extractCharSSmallStringGT(); 16370 extractSCharSmallStringGT(); 16371 extractCharCharSmallStringGT(); 16372 extractSmallJsonSmallJsonSmallStringGT(); 16373 extractSmallJsonSmallStringSmallStringGT(); 16374 extractSmallJsonSSmallStringGT(); 16375 extractSmallJsonCharSmallStringGT(); 16376 extractSmallStringSmallJsonSmallStringGT(); 16377 extractSmallStringSmallStringSmallStringGT(); 16378 extractSmallStringSSmallStringGT(); 16379 extractSmallStringCharSmallStringGT(); 16380 extractSSmallJsonSmallStringGT(); 16381 extractSSmallStringSmallStringGT(); 16382 extractCharSmallJsonSmallStringGT(); 16383 extractCharSmallStringSmallStringGT(); 16384 icSplitSmallStringGT(); 16385 icSplitCharSmallStringGT(); 16386 icSplitSmallJsonSmallStringGT(); 16387 icSplitSmallStringSmallStringGT(); 16388 icSplitCharPSSmallStringGT(); 16389 icSplitCharSSmallStringGT(); 16390 icSplitSmallJsonSSmallStringGT(); 16391 icSplitSmallStringSSmallStringGT(); 16392 icExtractSmallStringGT(); 16393 icExtractCharSSmallStringGT(); 16394 icExtractSCharSmallStringGT(); 16395 icExtractCharCharSmallStringGT(); 16396 icExtractSmallJsonSmallJsonSmallStringGT(); 16397 icExtractSmallJsonSmallStringSmallStringGT(); 16398 icExtractSmallJsonSSmallStringGT(); 16399 icExtractSmallJsonCharSmallStringGT(); 16400 icExtractSmallStringSmallJsonSmallStringGT(); 16401 icExtractSmallStringSmallStringSmallStringGT(); 16402 icExtractSmallStringSSmallStringGT(); 16403 icExtractSmallStringCharSmallStringGT(); 16404 icExtractSSmallJsonSmallStringGT(); 16405 icExtractSSmallStringSmallStringGT(); 16406 icExtractCharSmallJsonSmallStringGT(); 16407 icExtractCharSmallStringSmallStringGT(); 16408 readFileSmallStringGT(); 16409 readFileSmallJsonSmallStringGT(); 16410 readFileSmallStringSmallStringGT(); 16411 readStreamSmallStringGT(); 16412 writeFileSmallStringGT(); 16413 writeFileSmallJsonSmallStringGT(); 16414 writeFileSmallStringSmallStringGT(); 16415 writeStreamSmallStringGT(); 16416 appendFileSmallStringFGT(); 16417 appendFileSmallStringSmallStringGT(); 16418 16419 finalizeSmallDict(); 16420 finalizeSmallArray(); 16421 finalizeSmallJson(); 16422 finalizeUndefined(); 16423 finalizeSmallBytes(); 16424 finalizeSmallBool(); 16425 finalizeSmallContainer(); 16426 finalizeSmallDouble(); 16427 finalizeSmallInt(); 16428 finalizeSmallString(); 16429 }