libsheepyObjectFuncCuTest.c (165440B)
1 #include <stdlib.h> 2 #include <stdio.h> 3 #include <string.h> 4 5 #include "CuTest/CuTest.h" 6 7 #define ck_assert_str_eq(a,b) CuAssertStrEquals(tc, b, a) 8 #define ck_assert_str_ne(a,b) CuAssertStrNotEquals(tc, b, a) 9 #define ck_assert_ptr_eq(a,b) CuAssertPtrEquals(tc, b, a) 10 #define ck_assert_ptr_ne(a,b) CuAssertPtrNotEquals(tc, b, a) 11 #define ck_assert_uint_eq(a,b) CuAssertUintEquals(tc, b, a) 12 #define ck_assert_uint_ne(a,b) CuAssertUintNotEquals(tc, b, a) 13 #define ck_assert_int_eq(a,b) CuAssertIntEquals(tc, b, a) 14 #define ck_assert_int_ne(a,b) CuAssertIntNotEquals(tc, b, a) 15 #define ck_assert(a) CuAssertTrue(tc, a) 16 17 18 #include "../libsheepy.h" 19 #include "../libsheepyObject.h" 20 21 #ifdef __GNUC__ 22 #define UNUSED __attribute__ ((unused)) 23 #else 24 #define UNUSED 25 #endif 26 27 // TODO redirect stderr 28 29 30 void shSysinfoT(CuTest *tc UNUSED) { 31 32 smallDictt *r; 33 34 r = shSysinfo(); 35 ck_assert_ptr_ne(r, null); 36 terminateO(r); 37 38 } 39 40 41 void duplicateBaseGT(CuTest *tc UNUSED) { 42 43 baset *r; 44 baset *self = (baset*) allocSmallInt(1); 45 46 r = duplicateBaseG(self); 47 terminateO(self); 48 char *s = toStringO(r); 49 ck_assert_str_eq(s, "1"); 50 free(s); 51 terminateO(r); 52 53 } 54 55 56 void freeManyOFT(CuTest *tc UNUSED) { 57 58 smallIntt *i0 = allocSmallInt(1); 59 smallIntt *i1 = allocSmallInt(2); 60 smallIntt *i2 = allocSmallInt(3); 61 62 freeManyOF(i0, i1, i2, null); 63 char *s = toStringO(i0); 64 ck_assert_ptr_eq(s, null); 65 s = toStringO(i1); 66 ck_assert_ptr_eq(s, null); 67 s = toStringO(i2); 68 ck_assert_ptr_eq(s, null); 69 terminateO(i0); 70 terminateO(i1); 71 terminateO(i2); 72 73 } 74 75 76 void terminateManyOFT(CuTest *tc UNUSED) { 77 78 smallIntt *i0 = allocSmallInt(1); 79 smallIntt *i1 = allocSmallInt(2); 80 smallIntt *i2 = allocSmallInt(3); 81 82 terminateManyOF(i0, i1, i2, null); 83 84 } 85 86 87 void smashManyOFT(CuTest *tc UNUSED) { 88 89 createAllocateSmallInt(i0); 90 createAllocateSmallInt(i1); 91 createAllocateSmallInt(i2); 92 93 smashManyOF(i0, i1, i2, null); 94 95 } 96 97 98 void finishManyOFT(CuTest *tc UNUSED) { 99 100 createAllocateSmallInt(i0); 101 createAllocateSmallInt(i1); 102 createAllocateSmallInt(i2); 103 104 finishManyOF(i0, i1, i2, null); 105 106 } 107 108 109 void getProgPathJOT(CuTest *tc UNUSED) { 110 111 smallJsont *r; 112 113 r = getProgPathJO(); 114 ck_assert_ptr_ne(r, null); 115 terminateO(r); 116 117 } 118 119 120 void getProgPathOT(CuTest *tc UNUSED) { 121 122 smallStringt *r; 123 124 r = getProgPathO(); 125 ck_assert_ptr_ne(r, null); 126 terminateO(r); 127 128 } 129 130 131 void getRealProgPathJOT(CuTest *tc UNUSED) { 132 133 smallJsont *r; 134 135 r = getRealProgPathJO(); 136 ck_assert_ptr_ne(r, null); 137 terminateO(r); 138 139 } 140 141 142 void getRealProgPathOT(CuTest *tc UNUSED) { 143 144 smallStringt *r; 145 146 r = getRealProgPathO(); 147 ck_assert_ptr_ne(r, null); 148 terminateO(r); 149 freeRealProgPath(); 150 151 } 152 153 154 void systemJOT(CuTest *tc UNUSED) { 155 156 int r; 157 smallJsont *command = allocSmallJson(); 158 setTopStringO(command, "echo TEST"); 159 160 r = systemJO(command); 161 ck_assert_int_eq(r, 0); 162 // non json string 163 freeO(command); 164 r = systemJO(command); 165 ck_assert_int_eq(r, -1); 166 // null command 167 r = systemJO(null); 168 ck_assert_int_eq(r, -1); 169 terminateO(command); 170 171 } 172 173 174 void systemOT(CuTest *tc UNUSED) { 175 176 int r; 177 smallStringt *command = allocSmallString("echo TEST"); 178 179 r = systemO(command); 180 ck_assert_int_eq(r, 0); 181 // null command 182 r = systemO(null); 183 ck_assert_int_eq(r, -1); 184 terminateO(command); 185 186 } 187 188 189 void systemNFreeJOFT(CuTest *tc UNUSED) { 190 191 int r; 192 smallJsont *command = allocSmallJson(); 193 setTopStringO(command, "echo TEST"); 194 195 r = systemNFreeOJ(command); 196 ck_assert_int_eq(r, 0); 197 // unknown command 198 command = allocSmallJson(); 199 setTopStringO(command, "randomCommand"); 200 r = systemNFreeOJ(command); 201 ck_assert_int_ne(r, 0); 202 // non json string 203 command = allocSmallJson(); 204 r = systemNFreeOJ(command); 205 ck_assert_int_eq(r, -1); 206 terminateO(command); 207 // null command 208 r = systemNFreeOJ(null); 209 ck_assert_int_eq(r, -1); 210 211 } 212 213 214 void systemNFreeOFT(CuTest *tc UNUSED) { 215 216 int r; 217 smallStringt *command = allocSmallString("echo TEST"); 218 219 r = systemNFreeO(command); 220 ck_assert_int_eq(r, 0); 221 // unknown command 222 command = allocSmallString("randomCommand"); 223 r = systemNFreeO(command); 224 ck_assert_int_ne(r, 0); 225 // null command 226 r = systemNFreeO(null); 227 ck_assert_int_eq(r, -1); 228 229 } 230 231 232 void print_mT(CuTest *tc UNUSED) { 233 234 // TODO 235 /* int r; */ 236 /* FILE *stream; */ 237 /* const struct printf_info *info; */ 238 /* const void *const *args; */ 239 240 //r = print_m(); 241 242 } 243 244 245 void print_m_arginfoT(CuTest *tc UNUSED) { 246 247 // TODO 248 /* int r; */ 249 /* const struct printf_info *info UNUSED; */ 250 /* size_t n; */ 251 /* int *argtypes; */ 252 /* int* size; */ 253 254 //r = print_m_arginfo(); 255 256 } 257 258 259 void putsUndefinedGFT(CuTest *tc UNUSED) { 260 261 undefinedt* object = allocUndefined(); 262 263 putsUndefinedGF(object); 264 ck_assert_ptr_ne(object, null); 265 terminateO(object); 266 putsUndefinedGF(null); 267 268 } 269 270 271 void putsBoolGFT(CuTest *tc UNUSED) { 272 273 putsBoolGF(true); 274 275 } 276 277 278 void putsBoolPGFT(CuTest *tc UNUSED) { 279 280 bool v = true; 281 282 putsBoolPGF(&v); 283 putsBoolPGF(null); 284 285 } 286 287 288 void putsDoubleGFT(CuTest *tc UNUSED) { 289 290 putsDoubleGF(1.5); 291 292 } 293 294 295 void putsDoublePGFT(CuTest *tc UNUSED) { 296 297 double object = 1.5; 298 299 putsDoublePGF(&object); 300 putsDoublePGF(null); 301 302 } 303 304 305 void putsIntGFT(CuTest *tc UNUSED) { 306 307 putsIntGF(2); 308 309 } 310 311 312 void putsIntPGFT(CuTest *tc UNUSED) { 313 314 int64_t object = 2; 315 316 putsIntPGF(&object); 317 putsIntPGF(null); 318 319 } 320 321 322 void putsInt32GFT(CuTest *tc UNUSED) { 323 324 putsInt32GF(2); 325 326 } 327 328 329 void putsInt32PGFT(CuTest *tc UNUSED) { 330 331 int32_t object = 2; 332 333 putsInt32PGF(&object); 334 putsInt32PGF(null); 335 336 } 337 338 339 void putsUintGFT(CuTest *tc UNUSED) { 340 341 putsUintGF(2); 342 343 } 344 345 346 void putsUintPGFT(CuTest *tc UNUSED) { 347 348 uint64_t object = 2; 349 350 putsUintPGF(&object); 351 putsUintPGF(null); 352 353 } 354 355 356 void putsUint32GFT(CuTest *tc UNUSED) { 357 358 putsUint32GF(2); 359 360 } 361 362 363 void putsUint32PGFT(CuTest *tc UNUSED) { 364 365 uint32_t object = 2; 366 367 putsUint32PGF(&object); 368 putsUint32PGF(null); 369 370 } 371 372 373 void putsSGFT(CuTest *tc UNUSED) { 374 375 putsSGF("puts"); 376 putsSGF(null); 377 378 } 379 380 381 void putsListSGFT(CuTest *tc UNUSED) { 382 383 char** object = listCreateS("a", "bb"); 384 385 putsListSGF(object); 386 listFreeS(object); 387 putsListSGF(null); 388 389 } 390 391 392 void putsListCSGFT(CuTest *tc UNUSED) { 393 394 const char* object[] = {"a", "bb", null}; 395 396 putsListCSGF(object); 397 putsListCSGF(null); 398 399 } 400 401 402 void putsDictGFT(CuTest *tc UNUSED) { 403 404 smallDictt* object = allocSmallDict(); 405 406 putsDictGF(object); 407 terminateO(object); 408 putsDictGF(null); 409 410 } 411 412 413 void putsJsonGFT(CuTest *tc UNUSED) { 414 415 smallJsont* object = allocSmallJson(); 416 417 putsJsonGF(object); 418 terminateO(object); 419 putsJsonGF(null); 420 421 } 422 423 424 void putsArrayGFT(CuTest *tc UNUSED) { 425 426 smallArrayt* object = allocSmallArray(); 427 428 putsArrayGF(object); 429 terminateO(object); 430 putsArrayGF(null); 431 432 } 433 434 435 void putsSmallBoolGFT(CuTest *tc UNUSED) { 436 437 smallBoolt* object = allocSmallBool(true); 438 439 putsSmallBoolGF(object); 440 freeO(object); 441 putsSmallBoolGF(object); 442 terminateO(object); 443 putsSmallBoolGF(null); 444 445 } 446 447 448 void putsSmallBytesGFT(CuTest *tc UNUSED) { 449 450 smallBytest* object = allocSmallBytes("qwe", sizeof("qwe")); 451 452 putsSmallBytesGF(object); 453 freeO(object); 454 putsSmallBytesGF(object); 455 terminateO(object); 456 putsSmallBytesGF(null); 457 458 } 459 460 461 void putsSmallDoubleGFT(CuTest *tc UNUSED) { 462 463 smallDoublet* object = allocSmallDouble(1.5); 464 465 putsSmallDoubleGF(object); 466 freeO(object); 467 putsSmallDoubleGF(object); 468 terminateO(object); 469 putsSmallDoubleGF(null); 470 471 } 472 473 474 void putsSmallIntGFT(CuTest *tc UNUSED) { 475 476 smallIntt* object = allocSmallInt(3); 477 478 putsSmallIntGF(object); 479 freeO(object); 480 putsSmallIntGF(object); 481 terminateO(object); 482 putsSmallIntGF(null); 483 484 } 485 486 487 void putsSmallStringGFT(CuTest *tc UNUSED) { 488 489 smallStringt* object = allocSmallString("str"); 490 491 putsSmallStringGF(object); 492 freeO(object); 493 putsSmallStringGF(object); 494 terminateO(object); 495 putsSmallStringGF(null); 496 497 } 498 499 500 void putsVoidGFT(CuTest *tc UNUSED) { 501 502 void* object = null; 503 504 putsVoidGF(&object); 505 putsVoidGF(null); 506 507 } 508 509 510 void putsSmallContainerGFT(CuTest *tc UNUSED) { 511 512 smallContainert* object = allocSmallContainer(null); 513 514 putsSmallContainerGF(object); 515 freeO(object); 516 putsSmallContainerGF(object); 517 terminateO(object); 518 putsSmallContainerGF(null); 519 520 } 521 522 523 void toStringOFT(CuTest *tc UNUSED) { 524 525 char *r; 526 baset* object = (baset*) allocSmallInt(22); 527 528 r = toStringOF(object); 529 ck_assert_str_eq(r, "22"); 530 free(r); 531 // empty object 532 freeO(object); 533 r = toStringOF(object); 534 ck_assert_ptr_eq(r, null); 535 terminateO(object); 536 // null object 537 r = toStringOF(null); 538 ck_assert_ptr_eq(r, null); 539 540 } 541 542 543 void toStringUndefinedGFT(CuTest *tc UNUSED) { 544 545 char *r; 546 undefinedt* object = allocUndefined(); 547 548 r = toStringUndefinedGF(object); 549 ck_assert_str_eq(r, "null"); 550 free(r); 551 terminateO(object); 552 // null object 553 r = toStringUndefinedGF(null); 554 ck_assert_ptr_eq(r, null); 555 556 } 557 558 559 void toStringBoolGFT(CuTest *tc UNUSED) { 560 561 char *r; 562 563 r = toStringBoolGF(true); 564 ck_assert_str_eq(r, "true"); 565 free(r); 566 r = toStringBoolGF(false); 567 ck_assert_str_eq(r, "false"); 568 free(r); 569 570 } 571 572 573 void toStringBoolPGFT(CuTest *tc UNUSED) { 574 575 char *r; 576 bool object = true; 577 578 r = toStringBoolPGF(&object); 579 ck_assert_str_eq(r, "true"); 580 free(r); 581 object = false; 582 r = toStringBoolPGF(&object); 583 ck_assert_str_eq(r, "false"); 584 free(r); 585 // null object 586 r = toStringBoolPGF(null); 587 ck_assert_ptr_eq(r, null); 588 589 } 590 591 592 void toStringFloatGFT(CuTest *tc UNUSED) { 593 594 char *r; 595 596 r = toStringFloatGF(2.5); 597 ck_assert_str_eq(r, "2.500000"); 598 free(r); 599 600 } 601 602 603 void toStringFloatPGFT(CuTest *tc UNUSED) { 604 605 char *r; 606 float object = 2.5; 607 608 r = toStringFloatPGF(&object); 609 ck_assert_str_eq(r, "2.500000"); 610 free(r); 611 r = toStringFloatPGF(null); 612 ck_assert_ptr_eq(r, null); 613 614 } 615 616 617 void toStringDoubleGFT(CuTest *tc UNUSED) { 618 619 char *r; 620 621 r = toStringDoubleGF(2.5); 622 ck_assert_str_eq(r, "2.500000e+00"); 623 free(r); 624 625 } 626 627 628 void toStringDoublePGFT(CuTest *tc UNUSED) { 629 630 char *r; 631 double object = 2.5; 632 633 r = toStringDoublePGF(&object); 634 ck_assert_str_eq(r, "2.500000e+00"); 635 free(r); 636 r = toStringDoublePGF(null); 637 ck_assert_ptr_eq(r, null); 638 639 } 640 641 642 void toStringIntGFT(CuTest *tc UNUSED) { 643 644 char *r; 645 646 r = toStringIntGF(2); 647 ck_assert_str_eq(r, "2"); 648 free(r); 649 650 } 651 652 653 void toStringIntPGFT(CuTest *tc UNUSED) { 654 655 char *r; 656 int64_t object = 2; 657 658 r = toStringIntPGF(&object); 659 ck_assert_str_eq(r, "2"); 660 free(r); 661 r = toStringIntPGF(null); 662 ck_assert_ptr_eq(r, null); 663 664 } 665 666 667 void toStringInt32GFT(CuTest *tc UNUSED) { 668 669 char *r; 670 671 r = toStringInt32GF(2); 672 ck_assert_str_eq(r, "2"); 673 free(r); 674 675 } 676 677 678 void toStringInt32PGFT(CuTest *tc UNUSED) { 679 680 char *r; 681 int32_t object = 2; 682 683 r = toStringInt32PGF(&object); 684 ck_assert_str_eq(r, "2"); 685 free(r); 686 r = toStringInt32PGF(null); 687 ck_assert_ptr_eq(r, null); 688 689 } 690 691 692 void toStringInt16GFT(CuTest *tc UNUSED) { 693 694 char *r; 695 696 r = toStringInt16GF(2); 697 ck_assert_str_eq(r, "2"); 698 free(r); 699 700 } 701 702 703 void toStringInt16PGFT(CuTest *tc UNUSED) { 704 705 char *r; 706 int16_t object = 2; 707 708 r = toStringInt16PGF(&object); 709 ck_assert_str_eq(r, "2"); 710 free(r); 711 r = toStringInt16PGF(null); 712 ck_assert_ptr_eq(r, null); 713 714 } 715 716 717 void toStringUintGFT(CuTest *tc UNUSED) { 718 719 char *r; 720 721 r = toStringUintGF(2); 722 ck_assert_str_eq(r, "2"); 723 free(r); 724 725 } 726 727 728 void toStringUintPGFT(CuTest *tc UNUSED) { 729 730 char *r; 731 uint64_t object = 2; 732 733 r = toStringUintPGF(&object); 734 ck_assert_str_eq(r, "2"); 735 free(r); 736 r = toStringUintPGF(null); 737 ck_assert_ptr_eq(r, null); 738 739 } 740 741 742 void toStringUint32GFT(CuTest *tc UNUSED) { 743 744 char *r; 745 746 r = toStringUint32GF(2); 747 ck_assert_str_eq(r, "2"); 748 free(r); 749 750 } 751 752 753 void toStringUint32PGFT(CuTest *tc UNUSED) { 754 755 char *r; 756 uint32_t object = 2; 757 758 r = toStringUint32PGF(&object); 759 ck_assert_str_eq(r, "2"); 760 free(r); 761 r = toStringUintPGF(null); 762 ck_assert_ptr_eq(r, null); 763 764 } 765 766 767 void toStringUint16GFT(CuTest *tc UNUSED) { 768 769 char *r; 770 771 r = toStringUint16GF(2); 772 ck_assert_str_eq(r, "2"); 773 free(r); 774 775 } 776 777 778 void toStringUint16PGFT(CuTest *tc UNUSED) { 779 780 char *r; 781 uint16_t object = 2; 782 783 r = toStringUint16PGF(&object); 784 ck_assert_str_eq(r, "2"); 785 free(r); 786 r = toStringUint16PGF(null); 787 ck_assert_ptr_eq(r, null); 788 789 } 790 791 792 void toStringUint8GFT(CuTest *tc UNUSED) { 793 794 char *r; 795 796 r = toStringUint8GF(2); 797 ck_assert_str_eq(r, "2"); 798 free(r); 799 800 } 801 802 803 void toStringUint8PGFT(CuTest *tc UNUSED) { 804 805 char *r; 806 uint8_t object = 2; 807 808 r = toStringUint8PGF(&object); 809 ck_assert_str_eq(r, "2"); 810 free(r); 811 r = toStringUint8PGF(null); 812 ck_assert_ptr_eq(r, null); 813 814 } 815 816 817 void toStringCharGFT(CuTest *tc UNUSED) { 818 819 char *r; 820 821 r = toStringCharGF('2'); 822 ck_assert_str_eq(r, "2"); 823 free(r); 824 825 } 826 827 828 void toStringSGFT(CuTest *tc UNUSED) { 829 830 char *r; 831 832 r = toStringSGF("2"); 833 ck_assert_str_eq(r, "2"); 834 free(r); 835 836 } 837 838 839 void toStringListSGFT(CuTest *tc UNUSED) { 840 841 char *r; 842 char** object = listCreateS("a", "bb"); 843 844 r = toStringListSGF(object); 845 ck_assert_str_eq(r, "[\"a\",\"bb\"]"); 846 free(r); 847 listFreeS(object); 848 r = toStringListSGF(null); 849 ck_assert_ptr_eq(r, null); 850 851 } 852 853 854 void toStringListCSGFT(CuTest *tc UNUSED) { 855 856 char *r; 857 const char* object[] = {"a", "bb", null}; 858 859 r = toStringListCSGF(object); 860 ck_assert_str_eq(r, "[\"a\",\"bb\"]"); 861 free(r); 862 r = toStringListSGF(null); 863 ck_assert_ptr_eq(r, null); 864 865 } 866 867 868 void toStringDictGFT(CuTest *tc UNUSED) { 869 870 char *r; 871 smallDictt* object = allocSmallDict(); 872 873 r = toStringDictGF(object); 874 ck_assert_str_eq(r, "{}"); 875 free(r); 876 terminateO(object); 877 r = toStringDictGF(null); 878 ck_assert_ptr_eq(r, null); 879 880 } 881 882 883 void toStringArrayGFT(CuTest *tc UNUSED) { 884 885 char *r; 886 smallArrayt* object = allocSmallArray(); 887 888 r = toStringArrayGF(object); 889 ck_assert_str_eq(r, "[]"); 890 free(r); 891 terminateO(object); 892 r = toStringArrayGF(null); 893 ck_assert_ptr_eq(r, null); 894 895 } 896 897 898 void toStringSmallBoolGFT(CuTest *tc UNUSED) { 899 900 char *r; 901 smallBoolt* object = allocSmallBool(true); 902 903 r = toStringSmallBoolGF(object); 904 ck_assert_str_eq(r, "true"); 905 free(r); 906 terminateO(object); 907 r = toStringSmallBoolGF(null); 908 ck_assert_ptr_eq(r, null); 909 910 } 911 912 913 void toStringSmallBytesGFT(CuTest *tc UNUSED) { 914 915 char *r; 916 smallBytest* object = allocSmallBytes("qwe", sizeof("qwe")); 917 918 r = toStringSmallBytesGF(object); 919 ck_assert_str_eq(r, "[0x71,0x77,0x65,0x00]"); 920 free(r); 921 terminateO(object); 922 r = toStringSmallBytesGF(null); 923 ck_assert_ptr_eq(r, null); 924 925 } 926 927 928 void toStringSmallDoubleGFT(CuTest *tc UNUSED) { 929 930 char *r; 931 smallDoublet* object = allocSmallDouble(2.5); 932 933 r = toStringSmallDoubleGF(object); 934 ck_assert_str_eq(r, "2.500000e+00"); 935 free(r); 936 terminateO(object); 937 r = toStringSmallDoubleGF(null); 938 ck_assert_ptr_eq(r, null); 939 940 } 941 942 943 void toStringSmallIntGFT(CuTest *tc UNUSED) { 944 945 char *r; 946 smallIntt* object = allocSmallInt(2); 947 948 r = toStringSmallIntGF(object); 949 ck_assert_str_eq(r, "2"); 950 free(r); 951 terminateO(object); 952 r = toStringSmallIntGF(null); 953 ck_assert_ptr_eq(r, null); 954 955 } 956 957 958 void toStringSmallStringGFT(CuTest *tc UNUSED) { 959 960 char *r; 961 smallStringt* object = allocSmallString("qwe"); 962 963 r = toStringSmallStringGF(object); 964 ck_assert_str_eq(r, "qwe"); 965 free(r); 966 terminateO(object); 967 r = toStringSmallStringGF(null); 968 ck_assert_ptr_eq(r, null); 969 970 } 971 972 973 void toStringVoidGFT(CuTest *tc UNUSED) { 974 975 char *r; 976 void* object = null; 977 978 r = toStringVoidGF(&object); 979 ck_assert_str_eq(r, "Unsupported toStringG type or void pointer"); 980 free(r); 981 r = toStringVoidGF(null); 982 ck_assert_ptr_eq(r, null); 983 984 } 985 986 987 void toStringSmallContainerGFT(CuTest *tc UNUSED) { 988 989 char *r; 990 smallContainert* object = allocSmallContainer(null); 991 992 r = toStringSmallContainerGF(object); 993 ck_assert_str_eq(r, "<data smallContainer>"); 994 free(r); 995 terminateO(object); 996 r = toStringSmallContainerGF(null); 997 ck_assert_ptr_eq(r, null); 998 999 } 1000 1001 1002 void toStringSmallJsonGFT(CuTest *tc UNUSED) { 1003 1004 char *r; 1005 smallJsont* object = allocSmallJson(); 1006 1007 r = toStringSmallJsonGF(object); 1008 ck_assert_str_eq(r, "{}"); 1009 free(r); 1010 terminateO(object); 1011 r = toStringSmallJsonGF(null); 1012 ck_assert_ptr_eq(r, null); 1013 1014 } 1015 1016 1017 void otosT(CuTest *tc UNUSED) { 1018 1019 char *r; 1020 smallIntt *i = allocSmallInt(2); 1021 void *basetObj = i; 1022 1023 r = otos(basetObj); 1024 ck_assert_str_eq(r, "2"); 1025 free(r); 1026 terminateO(i); 1027 1028 } 1029 1030 1031 void formatOT(CuTest *tc UNUSED) { 1032 1033 smallStringt *r; 1034 1035 r = formatO("%d", 2); 1036 char *s = toStringO(r); 1037 terminateO(r); 1038 ck_assert_str_eq(s, "2"); 1039 free(s); 1040 r = formatO(null, 2); 1041 ck_assert_ptr_eq(r, null); 1042 1043 } 1044 1045 1046 void execSmallJsonOT(CuTest *tc UNUSED) { 1047 1048 int r; 1049 smallJsont *cmd = allocSmallJson(); 1050 createAllocateSmallArray(l); 1051 1052 // command 1053 setTopStringO(cmd, "ls libsheepyObjectTest.c"); 1054 r = execSmallJsonO(cmd, l, NULL); 1055 ck_assert_int_eq(r, 1); 1056 ck_assert_uint_eq(l->f->len(l),1); 1057 ck_assert_str_eq(l->f->getAtS(l, 0), "libsheepyObjectTest.c"); 1058 freeO(l); 1059 // invalid command 1060 freeO(cmd); 1061 setTopStringO(cmd, "randomCommand"); 1062 r = execSmallJsonO(cmd, l, NULL); 1063 ck_assert_int_eq(r, 1); 1064 ck_assert_uint_eq(l->f->len(l),0); 1065 // NULL out array 1066 freeO(cmd); 1067 setTopStringO(cmd, "ls libsheepyObjectTest.c"); 1068 r = execSmallJsonO(cmd, NULL, NULL); 1069 ck_assert_int_eq(r, 0); 1070 ck_assert_uint_eq(l->f->len(l),0); 1071 // non json string 1072 freeO(cmd); 1073 setTopIntO(cmd, 2); 1074 r = execSmallJsonO(cmd, l, NULL); 1075 ck_assert_int_eq(r, 0); 1076 terminateO(cmd); 1077 ck_assert_uint_eq(l->f->len(l),0); 1078 terminateO(l); 1079 // NULL command 1080 ck_assert_int_eq(execSmallJsonO(NULL, NULL, NULL), 0); 1081 1082 } 1083 1084 1085 void execSmallStringOT(CuTest *tc UNUSED) { 1086 1087 int r; 1088 smallStringt *cmd = allocSmallString(""); 1089 createAllocateSmallArray(l); 1090 1091 // command 1092 setValO(cmd, "ls libsheepyObjectTest.c"); 1093 r = execSmallStringO(cmd, l, NULL); 1094 ck_assert_int_eq(r, 1); 1095 ck_assert_uint_eq(l->f->len(l),1); 1096 ck_assert_str_eq(l->f->getAtS(l, 0), "libsheepyObjectTest.c"); 1097 freeO(l); 1098 // invalid command 1099 setValO(cmd, "randomCommand"); 1100 r = execSmallStringO(cmd, l, NULL); 1101 ck_assert_int_eq(r, 1); 1102 ck_assert_uint_eq(l->f->len(l),0); 1103 // NULL out array 1104 setValO(cmd, "ls libsheepyObjectTest.c"); 1105 r = execSmallStringO(cmd, NULL, NULL); 1106 ck_assert_int_eq(r, 0); 1107 terminateO(cmd); 1108 ck_assert_uint_eq(l->f->len(l),0); 1109 terminateO(cmd); 1110 terminateO(l); 1111 // NULL command 1112 ck_assert_int_eq(execSmallStringO(NULL, NULL, NULL), 0); 1113 1114 } 1115 1116 1117 void walkDirSmallJsonOT(CuTest *tc UNUSED) { 1118 1119 smallArrayt *r; 1120 smallJsont* dirPath = allocSmallJson(); 1121 1122 // existing directory 1123 setTopStringO(dirPath, "../dirTest.null"); 1124 r = walkDirSmallJsonO(dirPath); 1125 char *s = toStringO(r); 1126 ck_assert_str_eq(s, "[\"../dirTest.null/one\",\"../dirTest.null/two/four\",\"../dirTest.null/two/three\"]"); 1127 free(s); 1128 terminateO(r); 1129 // empty path 1130 freeO(dirPath); 1131 setTopStringO(dirPath, ""); 1132 ck_assert_ptr_eq(walkDirSmallJsonO(dirPath), NULL); 1133 // non existing directory 1134 freeO(dirPath); 1135 setTopStringO(dirPath, "nonExisting.null"); 1136 r = walkDirSmallJsonO(dirPath); 1137 ck_assert(isEmptyO(r)); 1138 terminateO(r); 1139 // non json string 1140 freeO(dirPath); 1141 setTopIntO(dirPath, 2); 1142 ck_assert_ptr_eq(walkDirSmallJsonO(dirPath), NULL); 1143 // NULL path 1144 ck_assert_ptr_eq(walkDirSmallJsonO(NULL), NULL); 1145 terminateO(dirPath); 1146 1147 } 1148 1149 1150 void walkDirSmallStringOT(CuTest *tc UNUSED) { 1151 1152 smallArrayt *r; 1153 smallStringt* dirPath = allocSmallString(""); 1154 1155 // existing directory 1156 setValO(dirPath, "../dirTest.null"); 1157 r = walkDirSmallStringO(dirPath); 1158 ck_assert_ptr_ne(r, null); 1159 char *s = toStringO(r); 1160 ck_assert_str_eq(s, "[\"../dirTest.null/one\",\"../dirTest.null/two/four\",\"../dirTest.null/two/three\"]"); 1161 free(s); 1162 terminateO(r); 1163 // empty path 1164 freeO(dirPath); 1165 setValO(dirPath, ""); 1166 ck_assert_ptr_eq(walkDirSmallStringO(dirPath), NULL); 1167 // non existing directory 1168 freeO(dirPath); 1169 setValO(dirPath, "nonExisting.null"); 1170 r = walkDirSmallStringO(dirPath); 1171 ck_assert_ptr_ne(r, null); 1172 ck_assert(isEmptyO(r)); 1173 terminateO(r); 1174 // NULL path 1175 ck_assert_ptr_eq(walkDirSmallStringO(NULL), NULL); 1176 terminateO(dirPath); 1177 1178 } 1179 1180 1181 void walkDirDirOT(CuTest *tc UNUSED) { 1182 1183 smallArrayt* r; 1184 1185 // existing directory 1186 r = walkDirDirO("../dirTest.null"); 1187 ck_assert_ptr_ne(r, null); 1188 char *s = toStringO(r); 1189 ck_assert_str_eq(s, "[\"../dirTest.null/symlinkLoop\",\"../dirTest.null/two\"]"); 1190 free(s); 1191 terminateO(r); 1192 // empty path 1193 ck_assert_ptr_eq(walkDirDirO(""), NULL); 1194 // non existing directory 1195 r = walkDirDirO("nonExisting.null"); 1196 ck_assert_ptr_ne(r, null); 1197 ck_assert(isEmptyO(r)); 1198 terminateO(r); 1199 // NULL path 1200 ck_assert_ptr_eq(walkDirDirO(NULL), NULL); 1201 1202 } 1203 1204 1205 void walkDirDirSmallJsonOT(CuTest *tc UNUSED) { 1206 1207 smallArrayt *r; 1208 smallJsont* dirPath = allocSmallJson(); 1209 1210 // existing directory 1211 setTopStringO(dirPath, "../dirTest.null"); 1212 r = walkDirDirSmallJsonO(dirPath); 1213 ck_assert_ptr_ne(r, null); 1214 char *s = toStringO(r); 1215 ck_assert_str_eq(s, "[\"../dirTest.null/symlinkLoop\",\"../dirTest.null/two\"]"); 1216 free(s); 1217 terminateO(r); 1218 // empty path 1219 freeO(dirPath); 1220 setTopStringO(dirPath, ""); 1221 ck_assert_ptr_eq(walkDirDirSmallJsonO(dirPath), NULL); 1222 // non existing directory 1223 freeO(dirPath); 1224 setTopStringO(dirPath, "nonExisting.null"); 1225 r = walkDirDirSmallJsonO(dirPath); 1226 ck_assert_ptr_ne(r, null); 1227 ck_assert(isEmptyO(r)); 1228 terminateO(r); 1229 // non json string 1230 freeO(dirPath); 1231 setTopIntO(dirPath, 2); 1232 ck_assert_ptr_eq(walkDirDirSmallJsonO(dirPath), NULL); 1233 // NULL path 1234 ck_assert_ptr_eq(walkDirDirSmallJsonO(NULL), NULL); 1235 terminateO(dirPath); 1236 1237 } 1238 1239 1240 void walkDirDirSmallStringOT(CuTest *tc UNUSED) { 1241 1242 smallArrayt *r; 1243 smallStringt* dirPath = allocSmallString(""); 1244 1245 // existing directory 1246 setValO(dirPath, "../dirTest.null"); 1247 r = walkDirDirSmallStringO(dirPath); 1248 ck_assert_ptr_ne(r, null); 1249 char *s = toStringO(r); 1250 ck_assert_str_eq(s, "[\"../dirTest.null/symlinkLoop\",\"../dirTest.null/two\"]"); 1251 free(s); 1252 terminateO(r); 1253 // empty path 1254 setValO(dirPath, ""); 1255 ck_assert_ptr_eq(walkDirDirSmallStringO(dirPath), NULL); 1256 // non existing directory 1257 setValO(dirPath, "nonExisting.null"); 1258 r = walkDirDirSmallStringO(dirPath); 1259 ck_assert_ptr_ne(r, null); 1260 ck_assert(isEmptyO(r)); 1261 terminateO(r); 1262 // NULL path 1263 ck_assert_ptr_eq(walkDirDirSmallStringO(NULL), NULL); 1264 terminateO(dirPath); 1265 1266 } 1267 1268 1269 void readDirOT(CuTest *tc UNUSED) { 1270 1271 smallArrayt *r; 1272 1273 // existing directory 1274 r = readDirO("../dirTest.null"); 1275 ck_assert_ptr_ne(r, null); 1276 char *s = toStringO(r); 1277 ck_assert_str_eq(s, "[\"one\"]"); 1278 free(s); 1279 terminateO(r); 1280 // empty path 1281 ck_assert_ptr_eq(readDirO(""), NULL); 1282 // non existing directory 1283 r = readDirO("nonExisting.null"); 1284 ck_assert_ptr_ne(r, null); 1285 ck_assert(isEmptyO(r)); 1286 terminateO(r); 1287 // NULL path 1288 ck_assert_ptr_eq(readDirO(NULL), NULL); 1289 1290 } 1291 1292 1293 void readDirSmallJsonOT(CuTest *tc UNUSED) { 1294 1295 smallArrayt *r; 1296 smallJsont *dirPath = allocSmallJson(); 1297 1298 // existing directory 1299 setTopStringO(dirPath, "../dirTest.null"); 1300 r = readDirSmallJsonO(dirPath); 1301 ck_assert_ptr_ne(r, null); 1302 char *s = toStringO(r); 1303 ck_assert_str_eq(s, "[\"one\"]"); 1304 free(s); 1305 terminateO(r); 1306 // empty path 1307 freeO(dirPath); 1308 setTopStringO(dirPath, ""); 1309 ck_assert_ptr_eq(readDirSmallJsonO(dirPath), NULL); 1310 // non existing directory 1311 freeO(dirPath); 1312 setTopStringO(dirPath, "nonExisting.null"); 1313 r = readDirSmallJsonO(dirPath); 1314 ck_assert_ptr_ne(r, null); 1315 ck_assert(isEmptyO(r)); 1316 terminateO(r); 1317 // non json string 1318 freeO(dirPath); 1319 setTopIntO(dirPath, 2); 1320 ck_assert_ptr_eq(readDirSmallJsonO(dirPath), NULL); 1321 // NULL path 1322 ck_assert_ptr_eq(readDirSmallJsonO(NULL), NULL); 1323 terminateO(dirPath); 1324 1325 } 1326 1327 1328 void readDirSmallStringOT(CuTest *tc UNUSED) { 1329 1330 smallArrayt *r; 1331 smallStringt *dirPath = allocSmallString(""); 1332 1333 //r = readDirSmallStringO(); 1334 // existing directory 1335 setValO(dirPath, "../dirTest.null"); 1336 r = readDirSmallStringO(dirPath); 1337 ck_assert_ptr_ne(r, null); 1338 char *s = toStringO(r); 1339 ck_assert_str_eq(s, "[\"one\"]"); 1340 free(s); 1341 terminateO(r); 1342 // empty path 1343 setValO(dirPath, ""); 1344 ck_assert_ptr_eq(readDirSmallStringO(dirPath), NULL); 1345 // non existing directory 1346 setValO(dirPath, "nonExisting.null"); 1347 r = readDirSmallStringO(dirPath); 1348 ck_assert_ptr_ne(r, null); 1349 ck_assert(isEmptyO(r)); 1350 terminateO(r); 1351 // NULL path 1352 ck_assert_ptr_eq(readDirSmallStringO(NULL), NULL); 1353 terminateO(dirPath); 1354 1355 } 1356 1357 1358 void readDirDirOT(CuTest *tc UNUSED) { 1359 1360 smallArrayt *r; 1361 1362 // existing directory 1363 r = readDirDirO("../dirTest.null"); 1364 ck_assert_ptr_ne(r, null); 1365 char *s = toStringO(r); 1366 ck_assert_str_eq(s, "[\"symlinkLoop\",\"two\"]"); 1367 free(s); 1368 terminateO(r); 1369 // empty path 1370 ck_assert_ptr_eq(readDirDirO(""), NULL); 1371 // non existing directory 1372 r = readDirDirO("nonExisting.null"); 1373 ck_assert_ptr_ne(r, null); 1374 ck_assert(isEmptyO(r)); 1375 terminateO(r); 1376 // NULL path 1377 ck_assert_ptr_eq(readDirDirO(NULL), NULL); 1378 1379 } 1380 1381 1382 void readDirDirSmallJsonOT(CuTest *tc UNUSED) { 1383 1384 smallArrayt *r; 1385 smallJsont *dirPath = allocSmallJson(); 1386 1387 // existing directory 1388 setTopStringO(dirPath, "../dirTest.null"); 1389 r = readDirDirSmallJsonO(dirPath); 1390 ck_assert_ptr_ne(r, null); 1391 char *s = toStringO(r); 1392 ck_assert_str_eq(s, "[\"symlinkLoop\",\"two\"]"); 1393 free(s); 1394 terminateO(r); 1395 // empty path 1396 freeO(dirPath); 1397 setTopStringO(dirPath, ""); 1398 ck_assert_ptr_eq(readDirDirSmallJsonO(dirPath), NULL); 1399 // non existing directory 1400 freeO(dirPath); 1401 setTopStringO(dirPath, "nonExisting.null"); 1402 r = readDirDirSmallJsonO(dirPath); 1403 ck_assert_ptr_ne(r, null); 1404 ck_assert(isEmptyO(r)); 1405 terminateO(r); 1406 // non json string 1407 freeO(dirPath); 1408 setTopIntO(dirPath, 2); 1409 ck_assert_ptr_eq(readDirDirSmallJsonO(dirPath), NULL); 1410 // NULL path 1411 ck_assert_ptr_eq(readDirDirSmallJsonO(NULL), NULL); 1412 terminateO(dirPath); 1413 1414 } 1415 1416 1417 void readDirDirSmallStringOT(CuTest *tc UNUSED) { 1418 1419 smallArrayt *r; 1420 smallStringt *dirPath = allocSmallString(""); 1421 1422 // existing directory 1423 setValO(dirPath, "../dirTest.null"); 1424 r = readDirDirSmallStringO(dirPath); 1425 ck_assert_ptr_ne(r, null); 1426 char *s = toStringO(r); 1427 ck_assert_str_eq(s, "[\"symlinkLoop\",\"two\"]"); 1428 free(s); 1429 terminateO(r); 1430 // empty path 1431 setValO(dirPath, ""); 1432 ck_assert_ptr_eq(readDirDirSmallStringO(dirPath), NULL); 1433 // non existing directory 1434 setValO(dirPath, "nonExisting.null"); 1435 r = readDirDirSmallStringO(dirPath); 1436 ck_assert_ptr_ne(r, null); 1437 ck_assert(isEmptyO(r)); 1438 terminateO(r); 1439 // NULL path 1440 ck_assert_ptr_eq(readDirDirSmallStringO(NULL), NULL); 1441 terminateO(dirPath); 1442 1443 } 1444 1445 1446 void walkDirAllOT(CuTest *tc UNUSED) { 1447 1448 smallArrayt *r; 1449 1450 // existing directory 1451 r = walkDirAllO("../dirTest.null"); 1452 ck_assert_ptr_ne(r, null); 1453 char *s = toStringO(r); 1454 ck_assert_str_eq(s, "[\"../dirTest.null/one\",\"../dirTest.null/symlinkLoop\",\"../dirTest.null/two\",\"../dirTest.null/two/four\",\"../dirTest.null/two/three\"]"); 1455 free(s); 1456 terminateO(r); 1457 // empty path 1458 ck_assert_ptr_eq(walkDirAllO(""), NULL); 1459 // non existing directory 1460 r = walkDirAllO("nonExisting.null"); 1461 ck_assert_ptr_ne(r, null); 1462 ck_assert(isEmptyO(r)); 1463 terminateO(r); 1464 // NULL path 1465 ck_assert_ptr_eq(walkDirAllO(NULL), NULL); 1466 1467 } 1468 1469 1470 void walkDirAllSmallJsonOT(CuTest *tc UNUSED) { 1471 1472 smallArrayt *r; 1473 smallJsont* dirPath = allocSmallJson(); 1474 1475 // existing directory 1476 setTopStringO(dirPath, "../dirTest.null"); 1477 r = walkDirAllSmallJsonO(dirPath); 1478 ck_assert_ptr_ne(r, null); 1479 char *s = toStringO(r); 1480 ck_assert_str_eq(s, "[\"../dirTest.null/one\",\"../dirTest.null/symlinkLoop\",\"../dirTest.null/two\",\"../dirTest.null/two/four\",\"../dirTest.null/two/three\"]"); 1481 free(s); 1482 terminateO(r); 1483 // empty path 1484 freeO(dirPath); 1485 setTopStringO(dirPath, ""); 1486 ck_assert_ptr_eq(walkDirAllSmallJsonO(dirPath), NULL); 1487 // non existing directory 1488 freeO(dirPath); 1489 setTopStringO(dirPath, "nonExisting.null"); 1490 r = walkDirAllSmallJsonO(dirPath); 1491 ck_assert_ptr_ne(r, null); 1492 ck_assert(isEmptyO(r)); 1493 terminateO(r); 1494 // non json string 1495 freeO(dirPath); 1496 setTopIntO(dirPath, 2); 1497 ck_assert_ptr_eq(walkDirAllSmallJsonO(dirPath), NULL); 1498 // NULL path 1499 ck_assert_ptr_eq(walkDirAllSmallJsonO(NULL), NULL); 1500 terminateO(dirPath); 1501 1502 } 1503 1504 1505 void walkDirAllSmallStringOT(CuTest *tc UNUSED) { 1506 1507 smallArrayt *r; 1508 smallStringt* dirPath = allocSmallString(""); 1509 1510 // existing directory 1511 setValO(dirPath, "../dirTest.null"); 1512 r = walkDirAllSmallStringO(dirPath); 1513 ck_assert_ptr_ne(r, null); 1514 char *s = toStringO(r); 1515 ck_assert_str_eq(s, "[\"../dirTest.null/one\",\"../dirTest.null/symlinkLoop\",\"../dirTest.null/two\",\"../dirTest.null/two/four\",\"../dirTest.null/two/three\"]"); 1516 free(s); 1517 terminateO(r); 1518 // empty path 1519 setValO(dirPath, ""); 1520 ck_assert_ptr_eq(walkDirAllSmallStringO(dirPath), NULL); 1521 // non existing directory 1522 setValO(dirPath, "nonExisting.null"); 1523 r = walkDirAllSmallStringO(dirPath); 1524 ck_assert_ptr_ne(r, null); 1525 ck_assert(isEmptyO(r)); 1526 terminateO(r); 1527 // NULL path 1528 ck_assert_ptr_eq(walkDirAllSmallStringO(NULL), NULL); 1529 terminateO(dirPath); 1530 1531 } 1532 1533 1534 void readDirAllOT(CuTest *tc UNUSED) { 1535 1536 smallArrayt *r; 1537 1538 // existing directory 1539 r = readDirAllO("../dirTest.null"); 1540 ck_assert_ptr_ne(r, null); 1541 char *s = toStringO(r); 1542 ck_assert_str_eq(s, "[\"one\",\"symlinkLoop\",\"two\"]"); 1543 free(s); 1544 terminateO(r); 1545 // empty path 1546 ck_assert_ptr_eq(readDirAllO(""), NULL); 1547 // non existing directory 1548 r = readDirAllO("nonExisting.null"); 1549 ck_assert_ptr_ne(r, null); 1550 ck_assert(isEmptyO(r)); 1551 terminateO(r); 1552 // NULL path 1553 ck_assert_ptr_eq(readDirAllO(NULL), NULL); 1554 1555 } 1556 1557 1558 void readDirAllSmallJsonOT(CuTest *tc UNUSED) { 1559 1560 smallArrayt *r; 1561 smallJsont *dirPath = allocSmallJson(); 1562 1563 // existing directory 1564 setTopStringO(dirPath, "../dirTest.null"); 1565 r = readDirAllSmallJsonO(dirPath); 1566 ck_assert_ptr_ne(r, null); 1567 char *s = toStringO(r); 1568 ck_assert_str_eq(s, "[\"one\",\"symlinkLoop\",\"two\"]"); 1569 free(s); 1570 terminateO(r); 1571 // empty path 1572 freeO(dirPath); 1573 setTopStringO(dirPath, ""); 1574 ck_assert_ptr_eq(readDirAllSmallJsonO(dirPath), NULL); 1575 // non existing directory 1576 freeO(dirPath); 1577 setTopStringO(dirPath, "nonExisting.null"); 1578 r = readDirAllSmallJsonO(dirPath); 1579 ck_assert_ptr_ne(r, null); 1580 ck_assert(isEmptyO(r)); 1581 terminateO(r); 1582 // non json string 1583 freeO(dirPath); 1584 setTopIntO(dirPath, 2); 1585 ck_assert_ptr_eq(readDirAllSmallJsonO(dirPath), NULL); 1586 // NULL path 1587 ck_assert_ptr_eq(readDirAllSmallJsonO(NULL), NULL); 1588 terminateO(dirPath); 1589 1590 } 1591 1592 1593 void readDirAllSmallStringOT(CuTest *tc UNUSED) { 1594 1595 smallArrayt *r; 1596 smallStringt *dirPath = allocSmallString(""); 1597 1598 // existing directory 1599 setValO(dirPath, "../dirTest.null"); 1600 r = readDirAllSmallStringO(dirPath); 1601 ck_assert_ptr_ne(r, null); 1602 char *s = toStringO(r); 1603 ck_assert_str_eq(s, "[\"one\",\"symlinkLoop\",\"two\"]"); 1604 free(s); 1605 terminateO(r); 1606 // empty path 1607 setValO(dirPath, ""); 1608 ck_assert_ptr_eq(readDirAllSmallStringO(dirPath), NULL); 1609 // non existing directory 1610 setValO(dirPath, "nonExisting.null"); 1611 r = readDirAllSmallStringO(dirPath); 1612 ck_assert_ptr_ne(r, null); 1613 ck_assert(isEmptyO(r)); 1614 terminateO(r); 1615 // NULL path 1616 ck_assert_ptr_eq(readDirAllSmallStringO(NULL), NULL); 1617 terminateO(dirPath); 1618 1619 } 1620 1621 1622 void getModificationTimeJOT(CuTest *tc UNUSED) { 1623 1624 smallJsont *path = allocSmallJson(); 1625 1626 // get time 1627 setTopStringO(path, "libsheepyObject.c"); 1628 ck_assert_int_ne(getModificationTimeJO(path), 0); 1629 // missing file 1630 freeO(path); 1631 setTopStringO(path, "nonExisting.null"); 1632 ck_assert_int_eq(getModificationTimeJO(path), 0); 1633 // non json string 1634 freeO(path); 1635 setTopIntO(path, 2); 1636 ck_assert_int_eq(getModificationTimeJO(path), 0); 1637 // NULL 1638 ck_assert_int_eq(getModificationTimeJO(NULL), 0); 1639 terminateO(path); 1640 1641 } 1642 1643 1644 void getModificationTimeOT(CuTest *tc UNUSED) { 1645 1646 smallStringt *path = allocSmallString(""); 1647 1648 // get time 1649 setValO(path, "libsheepyObject.c"); 1650 ck_assert_int_ne(getModificationTimeO(path), 0); 1651 // missing file 1652 setValO(path, "nonExisting.null"); 1653 ck_assert_int_eq(getModificationTimeO(path), 0); 1654 // NULL 1655 ck_assert_int_eq(getModificationTimeO(NULL), 0); 1656 terminateO(path); 1657 1658 } 1659 1660 1661 void setModificationTimeJOT(CuTest *tc UNUSED) { 1662 1663 smallJsont *path = allocSmallJson(); 1664 time_t t; 1665 1666 // set time 1667 setTopStringO(path, "../chmodTest.null"); 1668 t = getModificationTimeJO(path); 1669 ck_assert_int_eq(setModificationTimeJO(path, t), 1); 1670 // non existing file 1671 freeO(path); 1672 setTopStringO(path, "/chmodTest.null"); 1673 ck_assert_int_eq(setModificationTimeJO(path, t), 0); 1674 // non json string 1675 freeO(path); 1676 setTopIntO(path, 2); 1677 ck_assert_int_eq(setModificationTimeJO(path, t), 0); 1678 // NULL 1679 ck_assert_int_eq(setModificationTimeJO(NULL, t), 0); 1680 terminateO(path); 1681 1682 } 1683 1684 1685 void setModificationTimeOT(CuTest *tc UNUSED) { 1686 1687 smallStringt *path = allocSmallString(""); 1688 time_t t; 1689 1690 // set time 1691 setValO(path, "../chmodTest.null"); 1692 t = getModificationTimeO(path); 1693 ck_assert_int_eq(setModificationTimeO(path, t), 1); 1694 // non existing file 1695 setValO(path, "/chmodTest.null"); 1696 ck_assert_int_eq(setModificationTimeO(path, t), 0); 1697 // NULL 1698 ck_assert_int_eq(setModificationTimeO(NULL, t), 0); 1699 terminateO(path); 1700 1701 } 1702 1703 1704 void equalModificationTimesJOT(CuTest *tc UNUSED) { 1705 1706 smallJsont *path1 = allocSmallJson(); 1707 smallJsont *path2 = allocSmallJson(); 1708 1709 // equal time 1710 setTopStringO(path1, "../chmodTest.null"); 1711 setTopStringO(path2, "../chmodTest.null"); 1712 ck_assert(equalModificationTimesJO(path1, path2)); 1713 // not equal 1714 freeO(path2); 1715 setTopStringO(path2, "libsheepyObject.c"); 1716 ck_assert(!equalModificationTimesJO(path1, path2)); 1717 // non existing 1718 freeO(path1); 1719 setTopStringO(path1, "/chmodTest.null"); 1720 ck_assert(!equalModificationTimesJO(path1, path2)); 1721 freeO(path1); 1722 setTopStringO(path1, "../chmodTest.null"); 1723 freeO(path2); 1724 setTopStringO(path2, "/libsheepyObject.c"); 1725 ck_assert(!equalModificationTimesJO(path1, path2)); 1726 // non json string 1727 freeO(path1); 1728 setTopIntO(path1, 2); 1729 freeO(path2); 1730 setTopStringO(path2, "libsheepyObject.c"); 1731 ck_assert(!equalModificationTimesJO(path1, path2)); 1732 freeO(path1); 1733 setTopStringO(path1, "../chmodTest.null"); 1734 freeO(path2); 1735 setTopIntO(path2, 2); 1736 ck_assert(!equalModificationTimesJO(path1, path2)); 1737 // NULL 1738 freeO(path2); 1739 setTopStringO(path2, "libsheepyObject.c"); 1740 ck_assert(!equalModificationTimesJO(NULL, path2)); 1741 ck_assert(!equalModificationTimesJO(path1, NULL)); 1742 terminateO(path1); 1743 terminateO(path2); 1744 1745 } 1746 1747 1748 void equalModificationTimesSJOT(CuTest *tc UNUSED) { 1749 1750 smallJsont *path2 = allocSmallJson(); 1751 1752 // equal time 1753 setTopStringO(path2, "../chmodTest.null"); 1754 ck_assert(equalModificationTimesSJO("../chmodTest.null", path2)); 1755 // not equal 1756 freeO(path2); 1757 setTopStringO(path2, "libsheepyObject.c"); 1758 ck_assert(!equalModificationTimesSJO("../chmodTest.null", path2)); 1759 // non existing 1760 ck_assert(!equalModificationTimesSJO("/chmodTest.null", path2)); 1761 freeO(path2); 1762 setTopStringO(path2, "/libsheepyObject.c"); 1763 ck_assert(!equalModificationTimesSJO("../chmodTest.null", path2)); 1764 // non json string 1765 freeO(path2); 1766 setTopIntO(path2, 2); 1767 ck_assert(!equalModificationTimesSJO("../chmodTest.null", path2)); 1768 // NULL 1769 freeO(path2); 1770 setTopStringO(path2, "libsheepyObject.c"); 1771 ck_assert(!equalModificationTimesSJO(NULL, path2)); 1772 ck_assert(!equalModificationTimesSJO("../chmodTest.null", NULL)); 1773 terminateO(path2); 1774 1775 } 1776 1777 1778 void equalModificationTimesJOST(CuTest *tc UNUSED) { 1779 1780 smallJsont *path1 = allocSmallJson(); 1781 1782 // equal time 1783 setTopStringO(path1, "../chmodTest.null"); 1784 ck_assert(equalModificationTimesJOS(path1, "../chmodTest.null")); 1785 // not equal 1786 ck_assert(!equalModificationTimesJOS(path1, "libsheepyObject.c")); 1787 // non existing 1788 freeO(path1); 1789 setTopStringO(path1, "/chmodTest.null"); 1790 ck_assert(!equalModificationTimesJOS(path1, "libsheepyObject.c")); 1791 freeO(path1); 1792 setTopStringO(path1, "../chmodTest.null"); 1793 ck_assert(!equalModificationTimesJOS(path1, "/libsheepyObject.c")); 1794 // non json string 1795 freeO(path1); 1796 setTopIntO(path1, 2); 1797 ck_assert(!equalModificationTimesJOS(path1, "libsheepyObject.c")); 1798 // NULL 1799 freeO(path1); 1800 setTopStringO(path1, "../chmodTest.null"); 1801 ck_assert(!equalModificationTimesJOS(NULL, "libsheepyObject.c")); 1802 ck_assert(!equalModificationTimesJOS(path1, NULL)); 1803 terminateO(path1); 1804 1805 } 1806 1807 1808 void equalModificationTimesJOOT(CuTest *tc UNUSED) { 1809 1810 smallJsont *path1 = allocSmallJson(); 1811 smallStringt *path2 = allocSmallString(""); 1812 1813 // equal time 1814 setTopStringO(path1, "../chmodTest.null"); 1815 setValO(path2, "../chmodTest.null"); 1816 ck_assert(equalModificationTimesJOO(path1, path2)); 1817 // not equal 1818 setValO(path2, "libsheepyObject.c"); 1819 ck_assert(!equalModificationTimesJOO(path1, path2)); 1820 // non existing 1821 freeO(path1); 1822 setTopStringO(path1, "/chmodTest.null"); 1823 ck_assert(!equalModificationTimesJOO(path1, path2)); 1824 freeO(path1); 1825 setTopStringO(path1, "../chmodTest.null"); 1826 setValO(path2, "/libsheepyObject.c"); 1827 ck_assert(!equalModificationTimesJOO(path1, path2)); 1828 // non json string 1829 freeO(path1); 1830 setTopIntO(path1, 2); 1831 setValO(path2, "libsheepyObject.c"); 1832 ck_assert(!equalModificationTimesJOO(path1, path2)); 1833 // NULL 1834 freeO(path1); 1835 setTopStringO(path1, "../chmodTest.null"); 1836 setValO(path2, "libsheepyObject.c"); 1837 ck_assert(!equalModificationTimesJOO(NULL, path2)); 1838 ck_assert(!equalModificationTimesJOO(path1, NULL)); 1839 terminateO(path1); 1840 terminateO(path2); 1841 1842 } 1843 1844 1845 void equalModificationTimesOJOT(CuTest *tc UNUSED) { 1846 1847 smallStringt *path1 = allocSmallString(""); 1848 smallJsont *path2 = allocSmallJson(); 1849 1850 // equal time 1851 setValO(path1, "../chmodTest.null"); 1852 setTopStringO(path2, "../chmodTest.null"); 1853 ck_assert(equalModificationTimesOJO(path1, path2)); 1854 // not equal 1855 freeO(path2); 1856 setTopStringO(path2, "libsheepyObject.c"); 1857 ck_assert(!equalModificationTimesOJO(path1, path2)); 1858 // non existing 1859 setValO(path1, "/chmodTest.null"); 1860 ck_assert(!equalModificationTimesOJO(path1, path2)); 1861 setValO(path1, "../chmodTest.null"); 1862 freeO(path2); 1863 setTopStringO(path2, "/libsheepyObject.c"); 1864 ck_assert(!equalModificationTimesOJO(path1, path2)); 1865 // non json string 1866 freeO(path2); 1867 setTopIntO(path2, 2); 1868 ck_assert(!equalModificationTimesOJO(path1, path2)); 1869 // NULL 1870 freeO(path2); 1871 setTopStringO(path2, "libsheepyObject.c"); 1872 ck_assert(!equalModificationTimesOJO(NULL, path2)); 1873 ck_assert(!equalModificationTimesOJO(path1, NULL)); 1874 terminateO(path1); 1875 terminateO(path2); 1876 1877 } 1878 1879 1880 void equalModificationTimesOT(CuTest *tc UNUSED) { 1881 1882 smallStringt *path1 = allocSmallString(""); 1883 smallStringt *path2 = allocSmallString(""); 1884 1885 // equal time 1886 setValO(path1, "../chmodTest.null"); 1887 setValO(path2, "../chmodTest.null"); 1888 ck_assert(equalModificationTimesO(path1, path2)); 1889 // not equal 1890 setValO(path2, "libsheepyObject.c"); 1891 ck_assert(!equalModificationTimesO(path1, path2)); 1892 // non existing 1893 setValO(path1, "/chmodTest.null"); 1894 ck_assert(!equalModificationTimesO(path1, path2)); 1895 setValO(path1, "../chmodTest.null"); 1896 setValO(path2, "/libsheepyObject.c"); 1897 ck_assert(!equalModificationTimesO(path1, path2)); 1898 // NULL 1899 setValO(path2, "libsheepyObject.c"); 1900 ck_assert(!equalModificationTimesO(NULL, path2)); 1901 ck_assert(!equalModificationTimesO(path1, NULL)); 1902 terminateO(path1); 1903 terminateO(path2); 1904 1905 } 1906 1907 1908 void equalModificationTimesSOT(CuTest *tc UNUSED) { 1909 1910 smallStringt *path2 = allocSmallString(""); 1911 1912 // equal time 1913 setValO(path2, "../chmodTest.null"); 1914 ck_assert(equalModificationTimesSO("../chmodTest.null", path2)); 1915 // not equal 1916 setValO(path2, "libsheepyObject.c"); 1917 ck_assert(!equalModificationTimesSO("../chmodTest.null", path2)); 1918 // non existing 1919 ck_assert(!equalModificationTimesSO("/chmodTest.null", path2)); 1920 setValO(path2, "/libsheepyObject.c"); 1921 ck_assert(!equalModificationTimesSO("../chmodTest.null", path2)); 1922 // NULL 1923 setValO(path2, "libsheepyObject.c"); 1924 ck_assert(!equalModificationTimesSO(NULL, path2)); 1925 ck_assert(!equalModificationTimesSO("../chmodTest.null", NULL)); 1926 terminateO(path2); 1927 1928 } 1929 1930 1931 void equalModificationTimesOST(CuTest *tc UNUSED) { 1932 1933 smallStringt *path1 = allocSmallString(""); 1934 1935 // equal time 1936 setValO(path1, "../chmodTest.null"); 1937 ck_assert(equalModificationTimesOS(path1, "../chmodTest.null")); 1938 // not equal 1939 ck_assert(!equalModificationTimesOS(path1, "libsheepyObject.c")); 1940 // non existing 1941 setValO(path1, "/chmodTest.null"); 1942 ck_assert(!equalModificationTimesOS(path1, "libsheepyObject.c")); 1943 setValO(path1, "../chmodTest.null"); 1944 ck_assert(!equalModificationTimesOS(path1, "/libsheepyObject.c")); 1945 // NULL 1946 ck_assert(!equalModificationTimesOS(NULL, "libsheepyObject.c")); 1947 ck_assert(!equalModificationTimesOS(path1, NULL)); 1948 terminateO(path1); 1949 1950 } 1951 1952 1953 void timeToJOT(CuTest *tc UNUSED) { 1954 1955 smallJsont *r; 1956 1957 r = timeToJO(0); 1958 ck_assert_ptr_ne(r, null); 1959 ck_assert_str_eq(sjGet(r), "Thu Jan 1 01:00:00 1970"); 1960 terminateO(r); 1961 1962 } 1963 1964 1965 void timeToSOT(CuTest *tc UNUSED) { 1966 1967 smallStringt *r; 1968 1969 r = timeToSO(0); 1970 ck_assert_ptr_ne(r, null); 1971 ck_assert_str_eq(ssGet(r), "Thu Jan 1 01:00:00 1970"); 1972 terminateO(r); 1973 1974 } 1975 1976 1977 void shDirnameJOT(CuTest *tc UNUSED) { 1978 1979 smallJsont *r; 1980 smallJsont *path = allocSmallJson(); 1981 1982 setTopStringO(path, "release/libsheepy.a"); 1983 r = shDirnameJO(path); 1984 ck_assert_ptr_ne(r, null); 1985 ck_assert_str_eq(sjGet(r), "release"); 1986 terminateO(r); 1987 // non json string 1988 freeO(path); 1989 setTopIntO(path, 2); 1990 r = shDirnameJO(path); 1991 ck_assert_ptr_eq(r, null); 1992 terminateO(path); 1993 // NULL path 1994 r = shDirnameJO(null); 1995 ck_assert_ptr_eq(r, null); 1996 1997 } 1998 1999 2000 void shDirnameOT(CuTest *tc UNUSED) { 2001 2002 smallStringt *r; 2003 smallStringt *path = allocSmallString("release/libsheepy.a"); 2004 2005 r = shDirnameO(path); 2006 ck_assert_ptr_ne(r, null); 2007 ck_assert_str_eq(ssGet(r), "release"); 2008 terminateO(r); 2009 // one item path 2010 setValO(path, "sheepy.lib"); 2011 r = shDirnameO(path); 2012 ck_assert_ptr_ne(r, null); 2013 ck_assert_str_eq(ssGet(r), "./"); 2014 terminateO(r); 2015 // blank path 2016 setValO(path, ""); 2017 r = shDirnameO(path); 2018 ck_assert_ptr_ne(r, null); 2019 ck_assert_str_eq(ssGet(r), "./"); 2020 terminateO(r); 2021 terminateO(path); 2022 // NULL path 2023 r = shDirnameO(null); 2024 ck_assert_ptr_eq(r, null); 2025 2026 } 2027 2028 2029 void expandHomeJOT(CuTest *tc UNUSED) { 2030 2031 smallJsont *r; 2032 smallJsont *path = allocSmallJson(); 2033 2034 // no ~/ 2035 setTopStringO(path, "sheepy"); 2036 r = expandHomeJO(path); 2037 ck_assert_ptr_ne(r, null); 2038 ck_assert_str_eq(sjGet(r), "sheepy"); 2039 // non json string 2040 freeO(path); 2041 setTopIntO(path, 2); 2042 ck_assert_ptr_eq(expandHomeJO(path), NULL); 2043 // NULL path 2044 ck_assert_ptr_eq(expandHomeJO(NULL), NULL); 2045 terminateO(path); 2046 2047 } 2048 2049 2050 void normalizePathJOT(CuTest *tc UNUSED) { 2051 2052 smallJsont *r; 2053 smallJsont *path = allocSmallJson(); 2054 2055 setTopStringO(path, "test/.././file.txt"); 2056 r = normalizePathJO(path); 2057 ck_assert_ptr_ne(r, null); 2058 ck_assert_str_eq(sjGet(r), "file.txt"); 2059 // empty json object 2060 freeO(path); 2061 r = normalizePathJO(path); 2062 ck_assert_ptr_eq(r, null); 2063 // non json string 2064 freeO(path); 2065 setTopIntO(path, 2); 2066 ck_assert_ptr_eq(normalizePathJO(path), NULL); 2067 // NULL path 2068 ck_assert_ptr_eq(normalizePathJO(NULL), NULL); 2069 terminateO(path); 2070 2071 } 2072 2073 2074 void normalizePathOT(CuTest *tc UNUSED) { 2075 2076 smallStringt *r; 2077 smallStringt *path = allocSmallString("test/.././file.txt"); 2078 2079 r = normalizePathO(path); 2080 ck_assert_ptr_ne(r, null); 2081 ck_assert_str_eq(ssGet(r), "file.txt"); 2082 // blank string 2083 setValO(path, " "); 2084 r = normalizePathO(path); 2085 ck_assert_ptr_ne(r, null); 2086 ck_assert_str_eq(ssGet(r), "/"); 2087 // remove end / 2088 setValO(path, "/home/"); 2089 r = normalizePathO(path); 2090 ck_assert_ptr_ne(r, null); 2091 ck_assert_str_eq(ssGet(r), "/home"); 2092 // cancel path and keep leading / 2093 setValO(path, "/home/../"); 2094 r = normalizePathO(path); 2095 ck_assert_ptr_ne(r, null); 2096 ck_assert_str_eq(ssGet(r), "/"); 2097 // cancel path 2098 setValO(path, "home/../"); 2099 r = normalizePathO(path); 2100 ck_assert_ptr_ne(r, null); 2101 ck_assert_str_eq(ssGet(r), ""); 2102 // multiple / 2103 setValO(path, "/home///stuff"); 2104 r = normalizePathO(path); 2105 ck_assert_ptr_ne(r, null); 2106 ck_assert_str_eq(ssGet(r), "/home/stuff"); 2107 // remove . and .. and keep leading / 2108 setValO(path, "/a/./b/../../c/"); 2109 r = normalizePathO(path); 2110 ck_assert_ptr_ne(r, null); 2111 ck_assert_str_eq(ssGet(r), "/c"); 2112 // keep leading / 2113 setValO(path, "/../"); 2114 r = normalizePathO(path); 2115 ck_assert_str_eq(ssGet(r), "/"); 2116 // keep leading .. 2117 setValO(path, ".././/"); 2118 r = normalizePathO(path); 2119 ck_assert_str_eq(ssGet(r), ".."); 2120 // remove . 2121 setValO(path, "./"); 2122 r = normalizePathO(path); 2123 ck_assert_str_eq(ssGet(r), ""); 2124 // keep / before . 2125 setValO(path, "/."); 2126 r = normalizePathO(path); 2127 ck_assert_str_eq(ssGet(r), "/"); 2128 // remove . 2129 setValO(path, "."); 2130 r = normalizePathO(path); 2131 ck_assert_str_eq(ssGet(r), ""); 2132 // / not changed 2133 setValO(path, "/"); 2134 r = normalizePathO(path); 2135 ck_assert_str_eq(ssGet(r), "/"); 2136 // // becomes / 2137 setValO(path, "//"); 2138 r = normalizePathO(path); 2139 ck_assert_str_eq(ssGet(r), "/"); 2140 // remove leading . 2141 setValO(path, "/./werwer"); 2142 r = normalizePathO(path); 2143 ck_assert_str_eq(ssGet(r), "/werwer"); 2144 // keep leading .. and remove .. in path 2145 setValO(path, ".././test/../test/file"); 2146 r = normalizePathO(path); 2147 ck_assert_str_eq(ssGet(r), "../test/file"); 2148 setValO(path, "../d1/./d2/../f1"); 2149 r = normalizePathO(path); 2150 ck_assert_str_eq(ssGet(r), "../d1/f1"); 2151 setValO(path, "a/b/c/../d/../e"); 2152 r = normalizePathO(path); 2153 ck_assert_str_eq(ssGet(r), "a/b/e"); 2154 // dont remove .. when there are only .. in front 2155 setValO(path, "../../test/test/file"); 2156 r = normalizePathO(path); 2157 ck_assert_str_eq(ssGet(r), "../../test/test/file"); 2158 // empty path 2159 setValO(path, ""); 2160 r = normalizePathO(path); 2161 ck_assert_str_eq(ssGet(r), ""); 2162 // empty smallString 2163 freeO(path); 2164 r = normalizePathO(path); 2165 ck_assert_ptr_eq(r, null); 2166 // NULL path 2167 ck_assert_ptr_eq(normalizePathO(NULL), NULL); 2168 terminateO(path); 2169 2170 } 2171 2172 2173 void getCwdJOT(CuTest *tc UNUSED) { 2174 2175 smallJsont *r; 2176 2177 r = getCwdJO(); 2178 ck_assert_ptr_ne(r, null); 2179 terminateO(r); 2180 2181 } 2182 2183 2184 void chDirJOT(CuTest *tc UNUSED) { 2185 2186 int r; 2187 smallJsont *path = allocSmallJson(); 2188 2189 // change directory 2190 char *c = getCwd(); 2191 setTopStringO(path, "../dirTest.null"); 2192 r = chDirJO(path); 2193 ck_assert_int_ne(r, 0); 2194 char *s = getCwd(); 2195 ck_assert((size_t)findS(s, "dirTest.null")); 2196 chDir(c); 2197 freeManyS(c,s); 2198 // non json string 2199 freeO(path); 2200 setTopIntO(path, 2); 2201 ck_assert(!chDirJO(path)); 2202 // NULL path 2203 ck_assert(!chDirJO(NULL)); 2204 terminateO(path); 2205 2206 } 2207 2208 2209 void isDirJOT(CuTest *tc UNUSED) { 2210 2211 smallJsont *path = allocSmallJson(); 2212 2213 // dir 2214 setTopStringO(path, "../dirTest.null"); 2215 ck_assert(isDirJO(path)); 2216 // non json string 2217 freeO(path); 2218 setTopIntO(path, 2); 2219 ck_assert(!isDirJO(path)); 2220 // NULL path 2221 ck_assert(!isDirJO(NULL)); 2222 terminateO(path); 2223 2224 } 2225 2226 2227 void isDirOT(CuTest *tc UNUSED) { 2228 2229 smallStringt *path = allocSmallString("../dirTest.null"); 2230 2231 // dir 2232 ck_assert(isDirO(path)); 2233 // not a dir 2234 setValO(path, "libsheepyObject.c"); 2235 ck_assert(!isDirO(path)); 2236 // non existing dir 2237 setValO(path, "RandomNonExistingDir"); 2238 ck_assert(!isDirO(path)); 2239 // NULL path 2240 ck_assert(!isDirO(NULL)); 2241 terminateO(path); 2242 2243 } 2244 2245 2246 void isLinkJOT(CuTest *tc UNUSED) { 2247 2248 smallJsont *path = allocSmallJson(); 2249 2250 // link 2251 setTopStringO(path, "../linkTest.null"); 2252 ck_assert(isLinkJO(path)); 2253 // non json string 2254 freeO(path); 2255 setTopIntO(path, 2); 2256 ck_assert(!isLinkJO(path)); 2257 // NULL path 2258 ck_assert(!isLinkJO(NULL)); 2259 terminateO(path); 2260 2261 } 2262 2263 2264 void isLinkOT(CuTest *tc UNUSED) { 2265 2266 smallStringt *path = allocSmallString("../linkTest.null"); 2267 2268 // link 2269 ck_assert(isLinkO(path)); 2270 // not a link 2271 setValO(path, "libsheepyObject.c"); 2272 ck_assert(!isLinkO(path)); 2273 // non existing file 2274 setValO(path, "RandomNonExistingDir"); 2275 ck_assert(!isLinkO(path)); 2276 // NULL path 2277 ck_assert(!isLinkO(NULL)); 2278 terminateO(path); 2279 2280 } 2281 2282 2283 void fileExistsJOT(CuTest *tc UNUSED) { 2284 2285 smallJsont *path = allocSmallJson(); 2286 2287 // detect existing file 2288 setTopStringO(path, "libsheepyObject.c"); 2289 ck_assert(fileExistsJO(path)); 2290 // non json string 2291 freeO(path); 2292 setTopIntO(path, 2); 2293 ck_assert(!fileExistsJO(path)); 2294 // NULL path 2295 ck_assert(!fileExistsJO(NULL)); 2296 terminateO(path); 2297 2298 } 2299 2300 2301 void fileChmodJOT(CuTest *tc UNUSED) { 2302 2303 smallJsont *path = allocSmallJson(); 2304 2305 // existing file 2306 setTopStringO(path, "../chmodTest.null"); 2307 ck_assert(fileChmodJO(path, S_IRUSR | S_IWUSR | S_IXUSR | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH)); 2308 ck_assert(fileChmodJO(path, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH)); 2309 // non json string 2310 freeO(path); 2311 setTopIntO(path, 2); 2312 ck_assert(!fileChmodJO(path, 0)); 2313 // NULL path 2314 ck_assert(!fileChmodJO(NULL, 0)); 2315 terminateO(path); 2316 2317 } 2318 2319 2320 void fileSizeJOT(CuTest *tc UNUSED) { 2321 2322 smallJsont *path = allocSmallJson(); 2323 2324 // existing file 2325 setTopStringO(path, "../sizeTest.null"); 2326 ck_assert_int_eq(fileSizeJO(path), 743); 2327 // non json string 2328 freeO(path); 2329 setTopIntO(path, 2); 2330 ck_assert_int_eq(fileSizeJO(path), -1); 2331 // NULL path 2332 ck_assert_int_eq(fileSizeJO(NULL), -1); 2333 terminateO(path); 2334 2335 } 2336 2337 2338 void readFileToNewGT(CuTest *tc UNUSED) { 2339 2340 char *r = readFileToNewG(null, "../textTest.null"); 2341 ck_assert_str_eq(r, "LINE 1\nANOTHER line\n"); 2342 free(r); 2343 2344 } 2345 2346 2347 void readStreamToNewGT(CuTest *tc UNUSED) { 2348 2349 FILE *f; 2350 2351 f = fopen("../textTest.null", "r"); 2352 char *r = readStreamToNewG(null, f); 2353 ck_assert_str_eq(r, "LINE 1\nANOTHER line\n"); 2354 free(r); 2355 fclose(f); 2356 2357 } 2358 2359 2360 void readFileToGT(CuTest *tc UNUSED) { 2361 2362 char *r; 2363 char *string; 2364 2365 r = readFileToG(&string, "../textTest.null"); 2366 ck_assert_ptr_ne(r, null); 2367 ck_assert_ptr_eq(r, string); 2368 ck_assert_str_eq(r, "LINE 1\nANOTHER line\n"); 2369 free(r); 2370 // NULL string 2371 ck_assert_ptr_eq(readFileToG(null, "../textTest.null"), null); 2372 2373 } 2374 2375 2376 void readStreamToGT(CuTest *tc UNUSED) { 2377 2378 char *r; 2379 char *string; 2380 FILE *f; 2381 2382 f = fopen("../textTest.null", "r"); 2383 r = readStreamToG(&string, f); 2384 ck_assert_ptr_ne(r, null); 2385 ck_assert_ptr_eq(r, string); 2386 ck_assert_str_eq(r, "LINE 1\nANOTHER line\n"); 2387 free(r); 2388 // NULL string 2389 ck_assert_ptr_eq(readStreamToG(null, f), null); 2390 fclose(f); 2391 2392 } 2393 2394 2395 void readTextSmallJsonNotSupportedT(CuTest *tc UNUSED) { 2396 2397 readTextSmallJsonNotSupported(null, null); 2398 2399 } 2400 2401 2402 void readTextSmallStringNotSupportedT(CuTest *tc UNUSED) { 2403 2404 readTextSmallStringNotSupported(null, null); 2405 2406 } 2407 2408 2409 void readToFileSmallJsonNotSupportedT(CuTest *tc UNUSED) { 2410 2411 readToFileSmallJsonNotSupported(null, null); 2412 2413 } 2414 2415 2416 void readToFileSmallStringNotSupportedT(CuTest *tc UNUSED) { 2417 2418 readToFileSmallStringNotSupported(null, null); 2419 2420 } 2421 2422 2423 void writeFileFromGT(CuTest *tc UNUSED) { 2424 2425 int r; 2426 char *l; 2427 2428 // write textOutTest.null 2429 l = readFileToS("../textTest.null"); 2430 r = writeFileFromG(l, "textOutTest.null"); 2431 ck_assert(r); 2432 free(l); 2433 // check textOutTest.null 2434 l = readFileToS("textOutTest.null"); 2435 ck_assert_uint_eq(strlen(l),20); 2436 ck_assert_str_eq(l, "LINE 1\nANOTHER line\n"); 2437 free(l); 2438 2439 } 2440 2441 2442 void writeStreamFromGT(CuTest *tc UNUSED) { 2443 2444 int r; 2445 char *l; 2446 FILE *f; 2447 2448 // write textOutTest.null 2449 l = readFileToS("../textTest.null"); 2450 f = fopen("textOutTest.null", "w"); 2451 r = writeStreamFromG(l, f); 2452 ck_assert(r); 2453 fclose(f); 2454 free(l); 2455 // check textOutTest.null 2456 l = readFileToS("textOutTest.null"); 2457 ck_assert_uint_eq(strlen(l),20); 2458 ck_assert_str_eq(l, "LINE 1\nANOTHER line\n"); 2459 free(l); 2460 2461 } 2462 2463 2464 void writeTextSmallJsonNotSupportedT(CuTest *tc UNUSED) { 2465 2466 ck_assert_int_eq(writeTextSmallJsonNotSupported(null, null), 0); 2467 2468 } 2469 2470 2471 void writeTextSmallStringNotSupportedT(CuTest *tc UNUSED) { 2472 2473 ck_assert_int_eq(writeTextSmallStringNotSupported(null, null), 0); 2474 2475 } 2476 2477 2478 void writeTextCCSmallJsonNotSupportedT(CuTest *tc UNUSED) { 2479 2480 ck_assert_int_eq(writeTextCCSmallJsonNotSupported(null, null), 0); 2481 2482 } 2483 2484 2485 void writeTextCCSmallStringNotSupportedT(CuTest *tc UNUSED) { 2486 2487 ck_assert_int_eq(writeTextCCSmallStringNotSupported(null, null), 0); 2488 2489 } 2490 2491 2492 void readTextSGT(CuTest *tc UNUSED) { 2493 2494 char **r; 2495 char **list; 2496 2497 // text 2498 r = readTextSG(&list, "../textTest.null"); 2499 ck_assert_ptr_ne(r, null); 2500 ck_assert_uint_eq(listLengthS(r),2); 2501 ck_assert_str_eq(r[0], "LINE 1"); 2502 ck_assert_str_eq(r[1], "ANOTHER line"); 2503 listFreeS(r); 2504 // NULL list 2505 r = readTextSG(null, "../textTest.null"); 2506 ck_assert_ptr_eq(r, null); 2507 2508 } 2509 2510 2511 void readTextStreamGT(CuTest *tc UNUSED) { 2512 2513 char **r; 2514 char **list; 2515 FILE *fp; 2516 2517 // stream 2518 fp = fopen("../textTest.null", "r"); 2519 r = readTextStreamG(&list, fp); 2520 ck_assert_ptr_ne(r, null); 2521 ck_assert_uint_eq(listLengthS(r),2); 2522 ck_assert_str_eq(r[0], "LINE 1"); 2523 ck_assert_str_eq(r[1], "ANOTHER line"); 2524 listFreeS(r); 2525 // NULL list 2526 r = readTextStreamG(null, fp); 2527 ck_assert_ptr_eq(r, null); 2528 fclose(fp); 2529 2530 } 2531 2532 2533 void writeTextSGT(CuTest *tc UNUSED) { 2534 2535 bool r; 2536 char **l; 2537 2538 // write textOutTest.null 2539 l = readText("../textTest.null"); 2540 r = writeTextSG(l, "textOutTest.null"); 2541 ck_assert(r); 2542 listFreeS(l); 2543 // check textOutTest.null 2544 l = readText("textOutTest.null"); 2545 ck_assert_uint_eq(listLengthS(l),2); 2546 ck_assert_str_eq(l[0], "LINE 1"); 2547 ck_assert_str_eq(l[1], "ANOTHER line"); 2548 listFreeS(l); 2549 rmAll("textOutTest.null"); 2550 2551 } 2552 2553 2554 void writeTextStreamGT(CuTest *tc UNUSED) { 2555 2556 bool r; 2557 char **l; 2558 FILE *fp; 2559 2560 // write textOutTest.null 2561 l = readText("../textTest.null"); 2562 fp = fopen("textOutTest.null", "w"); 2563 r = writeTextStreamG(l, fp); 2564 ck_assert(r); 2565 fclose(fp); 2566 listFreeS(l); 2567 // check textOutTest.null 2568 l = readText("textOutTest.null"); 2569 ck_assert_uint_eq(listLengthS(l),2); 2570 ck_assert_str_eq(l[0], "LINE 1"); 2571 ck_assert_str_eq(l[1], "ANOTHER line"); 2572 listFreeS(l); 2573 rmAll("textOutTest.null"); 2574 2575 } 2576 2577 2578 void writeTextCGT(CuTest *tc UNUSED) { 2579 2580 bool r; 2581 const char *list[] = {"LINE 1", "ANOTHER line", null}; 2582 char **l; 2583 2584 r = writeTextCG(list, "textOutTest.null"); 2585 ck_assert(r); 2586 // check textOutTest.null 2587 l = readText("textOutTest.null"); 2588 ck_assert_uint_eq(listLengthS(l),2); 2589 ck_assert_str_eq(l[0], "LINE 1"); 2590 ck_assert_str_eq(l[1], "ANOTHER line"); 2591 listFreeS(l); 2592 rmAll("textOutTest.null"); 2593 2594 } 2595 2596 2597 void writeTextStreamCGT(CuTest *tc UNUSED) { 2598 2599 bool r; 2600 const char *list[] = {"LINE 1", "ANOTHER line", null}; 2601 char **l; 2602 FILE *fp; 2603 2604 fp = fopen("textOutTest.null", "w"); 2605 r = writeTextStreamCG(list, fp); 2606 fclose(fp); 2607 ck_assert(r); 2608 // check textOutTest.null 2609 l = readText("textOutTest.null"); 2610 ck_assert_uint_eq(listLengthS(l),2); 2611 ck_assert_str_eq(l[0], "LINE 1"); 2612 ck_assert_str_eq(l[1], "ANOTHER line"); 2613 listFreeS(l); 2614 rmAll("textOutTest.null"); 2615 2616 } 2617 2618 2619 void appendFileSGT(CuTest *tc UNUSED) { 2620 2621 bool r; 2622 char *l; 2623 2624 r = appendFileSG("appended line\n", "appendTextOutTest.null"); 2625 ck_assert(r); 2626 r = appendFileSG("appended line 2\n", "appendTextOutTest.null"); 2627 ck_assert(r); 2628 // check textOutTest.null 2629 l = readFileToS("appendTextOutTest.null"); 2630 ck_assert_uint_eq(strlen(l),30); 2631 ck_assert_str_eq(l, "appended line\nappended line 2\n"); 2632 free(l); 2633 if (fileExists("appendTextOutTest.null")) 2634 rmAll("appendTextOutTest.null"); 2635 2636 } 2637 2638 2639 void appendTextSGT(CuTest *tc UNUSED) { 2640 2641 bool r; 2642 char **l; 2643 2644 // append to textOutTest.null 2645 l = readText("../textTest.null"); 2646 r = writeText("textOutTest.null", l); 2647 ck_assert(r); 2648 char **c = listCreateS("A","B"); 2649 r = appendTextSG(c, "textOutTest.null"); 2650 listFreeManyS(l,c); 2651 // check textOutTest.null 2652 l = readText("textOutTest.null"); 2653 ck_assert_uint_eq(listLengthS(l),4); 2654 ck_assert_str_eq(l[0], "LINE 1"); 2655 ck_assert_str_eq(l[1], "ANOTHER line"); 2656 ck_assert_str_eq(l[2], "A"); 2657 ck_assert_str_eq(l[3], "B"); 2658 listFreeS(l); 2659 rmAll("textOutTest.null"); 2660 2661 } 2662 2663 2664 void appendTextCGT(CuTest *tc UNUSED) { 2665 2666 bool r; 2667 const char *list[] = {"A", "B", null}; 2668 char **l; 2669 2670 // append to textOutTest.null 2671 l = readText("../textTest.null"); 2672 r = writeText("textOutTest.null", l); 2673 ck_assert(r); 2674 r = appendTextCG(list, "textOutTest.null"); 2675 listFreeS(l); 2676 // check textOutTest.null 2677 l = readText("textOutTest.null"); 2678 ck_assert_uint_eq(listLengthS(l),4); 2679 ck_assert_str_eq(l[0], "LINE 1"); 2680 ck_assert_str_eq(l[1], "ANOTHER line"); 2681 ck_assert_str_eq(l[2], "A"); 2682 ck_assert_str_eq(l[3], "B"); 2683 listFreeS(l); 2684 rmAll("textOutTest.null"); 2685 2686 } 2687 2688 2689 void mkdirParentsSmallJsonOT(CuTest *tc UNUSED) { 2690 2691 smallJsont* path = allocSmallJson(); 2692 2693 // directory 2694 rmAll("mkdirTest.null"); 2695 setTopStringO(path, "mkdirTest.null/null"); 2696 ck_assert_int_eq(mkdirParentsSmallJsonO(path),1); 2697 // non json string 2698 freeO(path); 2699 setTopIntO(path, 2); 2700 ck_assert_int_eq(mkdirParentsSmallJsonO(path),0); 2701 terminateO(path); 2702 // null path 2703 ck_assert_int_eq(mkdirParentsSmallJsonO(null),0); 2704 rmAll("mkdirTest.null"); 2705 2706 } 2707 2708 2709 void rmAllSmallJsonOT(CuTest *tc UNUSED) { 2710 2711 smallJsont* path = allocSmallJson(); 2712 2713 // directory 2714 mkdirParents("rmAllTest.null/null"); 2715 setTopStringO(path, "rmAllTest.null"); 2716 ck_assert_int_eq(rmAllSmallJsonO(path), 1); 2717 // non json string 2718 freeO(path); 2719 setTopIntO(path, 2); 2720 ck_assert_int_eq(rmAllSmallJsonO(path),0); 2721 terminateO(path); 2722 // null path 2723 ck_assert_int_eq(rmAllSmallJsonO(null),0); 2724 2725 } 2726 2727 2728 void copySSmallJsonOT(CuTest *tc UNUSED) { 2729 2730 smallJsont* dst = allocSmallJson(); 2731 2732 // file 2733 rmAll("copyTest.null"); 2734 setTopStringO(dst, "copyTest.null"); 2735 ck_assert_int_eq(copySSmallJsonO("../chmodTest.null", dst),1); 2736 ck_assert(fileExists("copyTest.null")); 2737 rmAll("copyTest.null"); 2738 // non json string 2739 freeO(dst); 2740 setTopIntO(dst, 2); 2741 ck_assert_int_eq(copySSmallJsonO("../chmodTest.null", dst),0); 2742 terminateO(dst); 2743 // non json object 2744 dst = (smallJsont*) allocSmallInt(2); 2745 ck_assert_int_eq(copySSmallJsonO("../chmodTest.null", dst),0); 2746 terminateO(dst); 2747 // blank src 2748 dst = allocSmallJson(); 2749 setTopStringO(dst, ""); 2750 ck_assert_int_eq(copySSmallJsonO("", dst),0); 2751 // blank dst 2752 ck_assert_int_eq(copySSmallJsonO("../chmodTest.null", dst),0); 2753 // null src 2754 ck_assert_int_eq(copySSmallJsonO(null, dst),0); 2755 // null dst 2756 ck_assert_int_eq(copySSmallJsonO("../chmodTest.null", null),0); 2757 terminateO(dst); 2758 2759 } 2760 2761 2762 void copySOT(CuTest *tc UNUSED) { 2763 2764 smallStringt* dst = allocSmallString("copyTest.null"); 2765 2766 // file 2767 rmAll("copyTest.null"); 2768 ck_assert_int_eq(copySO("../chmodTest.null", dst),1); 2769 ck_assert(fileExists("copyTest.null")); 2770 rmAll("copyTest.null"); 2771 // blank src 2772 setValO(dst, ""); 2773 ck_assert_int_eq(copySO("", dst),0); 2774 // blank dst 2775 ck_assert_int_eq(copySO("../chmodTest.null", dst),0); 2776 // null src 2777 ck_assert_int_eq(copySO(null, dst),0); 2778 // null dst 2779 ck_assert_int_eq(copySO("../chmodTest.null", null),0); 2780 terminateO(dst); 2781 2782 } 2783 2784 2785 void copySmallJsonOST(CuTest *tc UNUSED) { 2786 2787 smallJsont* src = allocSmallJson(); 2788 2789 // file 2790 rmAll("copyTest.null"); 2791 setTopStringO(src, "../chmodTest.null"); 2792 ck_assert_int_eq(copySmallJsonOS(src, "copyTest.null"),1); 2793 ck_assert(fileExists("copyTest.null")); 2794 rmAll("copyTest.null"); 2795 // non json string 2796 freeO(src); 2797 setTopIntO(src, 2); 2798 ck_assert_int_eq(copySmallJsonOS(src, "copyTest.null"),0); 2799 terminateO(src); 2800 // non json object 2801 src = (smallJsont*) allocSmallInt(2); 2802 ck_assert_int_eq(copySmallJsonOS(src, "copyTest.null"),0); 2803 terminateO(src); 2804 // blank src 2805 src = allocSmallJson(); 2806 setTopStringO(src, ""); 2807 ck_assert_int_eq(copySmallJsonOS(src, "asd"),0); 2808 // blank dst 2809 freeO(src); 2810 setTopStringO(src, "../chmodTest.null"); 2811 ck_assert_int_eq(copySmallJsonOS(src, ""),0); 2812 // null src 2813 ck_assert_int_eq(copySmallJsonOS(null, "qwe"),0); 2814 // null dst 2815 ck_assert_int_eq(copySmallJsonOS(src, null),0); 2816 terminateO(src); 2817 2818 } 2819 2820 2821 void copySmallJsonSmallJsonT(CuTest *tc UNUSED) { 2822 2823 smallJsont* src = allocSmallJson(); 2824 smallJsont* dst = allocSmallJson(); 2825 2826 // file 2827 rmAll("copyTest.null"); 2828 setTopStringO(src, "../chmodTest.null"); 2829 setTopStringO(dst, "copyTest.null"); 2830 ck_assert_int_eq(copySmallJsonSmallJson(src, dst),1); 2831 ck_assert(fileExists("copyTest.null")); 2832 rmAll("copyTest.null"); 2833 // non json string 2834 freeO(src); 2835 setTopIntO(src, 2); 2836 ck_assert_int_eq(copySmallJsonSmallJson(src, dst),0); 2837 terminateO(src); 2838 src = allocSmallJson(); 2839 setTopStringO(src, "../chmodTest.null"); 2840 freeO(dst); 2841 setTopIntO(dst, 2); 2842 ck_assert_int_eq(copySmallJsonSmallJson(src, dst),0); 2843 terminateO(src); 2844 terminateO(dst); 2845 // non json object 2846 dst = allocSmallJson(); 2847 setTopStringO(dst, "copyTest.null"); 2848 src = (smallJsont*) allocSmallInt(2); 2849 ck_assert_int_eq(copySmallJsonSmallJson(src, dst),0); 2850 terminateO(src); 2851 terminateO(dst); 2852 src = allocSmallJson(); 2853 setTopStringO(src, "../chmodTest.null"); 2854 dst = (smallJsont*) allocSmallInt(2); 2855 ck_assert_int_eq(copySmallJsonSmallJson(src, dst),0); 2856 terminateO(dst); 2857 // blank src 2858 dst = allocSmallJson(); 2859 setTopStringO(dst, "copyTest.null"); 2860 freeO(src); 2861 setTopStringO(src, ""); 2862 ck_assert_int_eq(copySmallJsonSmallJson(src, dst),0); 2863 // blank dst 2864 freeO(src); 2865 setTopStringO(src, "../chmodTest.null"); 2866 freeO(dst); 2867 setTopStringO(dst, ""); 2868 ck_assert_int_eq(copySmallJsonSmallJson(src, dst),0); 2869 // null src 2870 ck_assert_int_eq(copySmallJsonSmallJson(null, dst),0); 2871 // null dst 2872 ck_assert_int_eq(copySmallJsonSmallJson(src, null),0); 2873 terminateO(src); 2874 terminateO(dst); 2875 2876 } 2877 2878 2879 void copySmallJsonOT(CuTest *tc UNUSED) { 2880 2881 smallJsont* src = allocSmallJson(); 2882 smallStringt* dst = allocSmallString(""); 2883 2884 // file 2885 rmAll("copyTest.null"); 2886 setTopStringO(src, "../chmodTest.null"); 2887 setValO(dst, "copyTest.null"); 2888 ck_assert_int_eq(copySmallJsonO(src, dst),1); 2889 ck_assert(fileExists("copyTest.null")); 2890 rmAll("copyTest.null"); 2891 // non json string 2892 freeO(src); 2893 setTopIntO(src, 2); 2894 ck_assert_int_eq(copySmallJsonO(src, dst),0); 2895 terminateO(src); 2896 // non json object 2897 src = (smallJsont*) allocSmallInt(2); 2898 ck_assert_int_eq(copySmallJsonO(src, dst),0); 2899 terminateO(src); 2900 src = allocSmallJson(); 2901 setTopStringO(src, "qwe"); 2902 terminateO(dst); 2903 dst = (smallStringt*) allocSmallInt(2); 2904 ck_assert_int_eq(copySmallJsonO(src, dst),0); 2905 terminateO(dst); 2906 // blank src 2907 dst = allocSmallString("copyTest.null"); 2908 freeO(src); 2909 setTopStringO(src, ""); 2910 ck_assert_int_eq(copySmallJsonO(src, dst),0); 2911 // blank dst 2912 freeO(src); 2913 setTopStringO(src, "../chmodTest.null"); 2914 setValO(dst, ""); 2915 ck_assert_int_eq(copySmallJsonO(src, dst),0); 2916 // null src 2917 ck_assert_int_eq(copySmallJsonO(null, dst),0); 2918 // null dst 2919 ck_assert_int_eq(copySmallJsonO(src, null),0); 2920 terminateO(src); 2921 terminateO(dst); 2922 2923 } 2924 2925 2926 void copyOST(CuTest *tc UNUSED) { 2927 2928 smallStringt* src = allocSmallString(""); 2929 2930 // file 2931 rmAll("copyTest.null"); 2932 setValO(src, "../chmodTest.null"); 2933 ck_assert_int_eq(copyOS(src, "copyTest.null"),1); 2934 ck_assert(fileExists("copyTest.null")); 2935 rmAll("copyTest.null"); 2936 // blank src 2937 setValO(src, ""); 2938 ck_assert_int_eq(copyOS(src, "asd"),0); 2939 // blank dst 2940 setValO(src, "../chmodTest.null"); 2941 ck_assert_int_eq(copyOS(src, ""),0); 2942 // null src 2943 ck_assert_int_eq(copyOS(null, "qwe"),0); 2944 // null dst 2945 ck_assert_int_eq(copyOS(src, null),0); 2946 terminateO(src); 2947 2948 } 2949 2950 2951 void copyOSmallJsonT(CuTest *tc UNUSED) { 2952 2953 smallStringt* src = allocSmallString(""); 2954 smallJsont* dst = allocSmallJson(); 2955 2956 // file 2957 rmAll("copyTest.null"); 2958 setValO(src, "../chmodTest.null"); 2959 setTopStringO(dst, "copyTest.null"); 2960 ck_assert_int_eq(copyOSmallJson(src, dst),1); 2961 ck_assert(fileExists("copyTest.null")); 2962 rmAll("copyTest.null"); 2963 // non json string 2964 freeO(dst); 2965 setTopIntO(dst, 2); 2966 ck_assert_int_eq(copyOSmallJson(src, dst),0); 2967 terminateO(dst); 2968 // non json object 2969 dst = (smallJsont*) allocSmallInt(2); 2970 ck_assert_int_eq(copyOSmallJson(src, dst),0); 2971 terminateO(src); 2972 terminateO(dst); 2973 dst = allocSmallJson(); 2974 setTopStringO(dst, "copyTest.null"); 2975 src = (smallStringt*) allocSmallInt(2); 2976 ck_assert_int_eq(copyOSmallJson(src, dst),0); 2977 terminateO(src); 2978 // blank src 2979 src = allocSmallString(""); 2980 ck_assert_int_eq(copyOSmallJson(src, dst),0); 2981 // blank dst 2982 setValO(src, "../chmodTest.null"); 2983 freeO(dst); 2984 setTopStringO(dst, ""); 2985 ck_assert_int_eq(copyOSmallJson(src, dst),0); 2986 // null src 2987 ck_assert_int_eq(copyOSmallJson(null, dst),0); 2988 // null dst 2989 ck_assert_int_eq(copyOSmallJson(src, null),0); 2990 terminateO(src); 2991 terminateO(dst); 2992 2993 } 2994 2995 2996 void renameSmallJsonOT(CuTest *tc UNUSED) { 2997 2998 smallJsont* src = allocSmallJson(); 2999 smallStringt* dst = allocSmallString("rename2Test.null"); 3000 3001 // regualar file 3002 setTopStringO(src, "renameTest.null"); 3003 ck_assert_int_eq(renameSmallJsonO(src, dst), 1); 3004 freeO(src); 3005 setTopStringO(src, "rename2Test.null"); 3006 setValO(dst, "renameTest.null"); 3007 ck_assert_int_eq(renameSmallJsonO(src, dst), 1); 3008 // blank src 3009 freeO(src); 3010 setTopStringO(src, ""); 3011 ck_assert_int_eq(renameSmallJsonO(src, dst), 0); 3012 // blank dst 3013 freeO(src); 3014 setTopStringO(src, "renameTest.null"); 3015 setValO(dst, ""); 3016 ck_assert_int_eq(renameSmallJsonO(src, dst), 0); 3017 // non json string 3018 freeO(src); 3019 setTopIntO(src, 2); 3020 ck_assert_int_eq(renameSmallJsonO(src, dst), 0); 3021 // non smallJson/smallString objects 3022 terminateO(src); 3023 src = (smallJsont*) allocSmallInt(2); 3024 ck_assert_int_eq(renameSmallJsonO(src, dst), 0); 3025 terminateO(src); 3026 terminateO(dst); 3027 src = allocSmallJson(); 3028 dst = (smallStringt*) allocSmallInt(2); 3029 ck_assert_int_eq(renameSmallJsonO(src, dst), 0); 3030 terminateO(dst); 3031 dst = allocSmallString("qwe"); 3032 // null paths 3033 ck_assert_int_eq(renameSmallJsonO(null, dst), 0); 3034 ck_assert_int_eq(renameSmallJsonO(src, null), 0); 3035 terminateO(src); 3036 terminateO(dst); 3037 3038 } 3039 3040 3041 void renameSmallJsonSmallJsonT(CuTest *tc UNUSED) { 3042 3043 smallJsont* src = allocSmallJson(); 3044 smallJsont* dst = allocSmallJson(); 3045 3046 // regualar file 3047 setTopStringO(src, "renameTest.null"); 3048 setTopStringO(dst, "rename2Test.null"); 3049 ck_assert_int_eq(renameSmallJsonSmallJson(src, dst), 1); 3050 freeO(src); 3051 setTopStringO(src, "rename2Test.null"); 3052 freeO(dst); 3053 setTopStringO(dst, "renameTest.null"); 3054 ck_assert_int_eq(renameSmallJsonSmallJson(src, dst), 1); 3055 // blank src 3056 freeO(src); 3057 setTopStringO(src, ""); 3058 ck_assert_int_eq(renameSmallJsonSmallJson(src, dst), 0); 3059 // blank dst 3060 freeO(src); 3061 setTopStringO(src, "renameTest.null"); 3062 freeO(dst); 3063 setTopStringO(dst, ""); 3064 ck_assert_int_eq(renameSmallJsonSmallJson(src, dst), 0); 3065 // non json string 3066 freeO(src); 3067 setTopIntO(src, 2); 3068 ck_assert_int_eq(renameSmallJsonSmallJson(src, dst), 0); 3069 freeO(src); 3070 setTopStringO(src, "renameTest.null"); 3071 freeO(dst); 3072 setTopIntO(dst, 2); 3073 ck_assert_int_eq(renameSmallJsonSmallJson(src, dst), 0); 3074 freeO(dst); 3075 setTopStringO(dst, "rename2Test.null"); 3076 // non smallJson/smallString objects 3077 terminateO(src); 3078 src = (smallJsont*) allocSmallInt(2); 3079 ck_assert_int_eq(renameSmallJsonSmallJson(src, dst), 0); 3080 terminateO(src); 3081 terminateO(dst); 3082 src = allocSmallJson(); 3083 dst = (smallJsont*) allocSmallInt(2); 3084 ck_assert_int_eq(renameSmallJsonSmallJson(src, dst), 0); 3085 terminateO(dst); 3086 dst = allocSmallJson(); 3087 // null paths 3088 ck_assert_int_eq(renameSmallJsonSmallJson(null, dst), 0); 3089 ck_assert_int_eq(renameSmallJsonSmallJson(src, null), 0); 3090 terminateO(src); 3091 terminateO(dst); 3092 3093 } 3094 3095 3096 void renameSmallJsonOST(CuTest *tc UNUSED) { 3097 3098 smallJsont* src = allocSmallJson(); 3099 const char* dst = "rename2Test.null"; 3100 3101 // regualar file 3102 setTopStringO(src, "renameTest.null"); 3103 ck_assert_int_eq(renameSmallJsonOS(src, dst), 1); 3104 freeO(src); 3105 setTopStringO(src, "rename2Test.null"); 3106 dst = "renameTest.null"; 3107 ck_assert_int_eq(renameSmallJsonOS(src, dst), 1); 3108 // blank src 3109 freeO(src); 3110 setTopStringO(src, ""); 3111 ck_assert_int_eq(renameSmallJsonOS(src, dst), 0); 3112 // blank dst 3113 freeO(src); 3114 setTopStringO(src, "renameTest.null"); 3115 dst = ""; 3116 ck_assert_int_eq(renameSmallJsonOS(src, dst), 0); 3117 // non json string 3118 dst = "qwe"; 3119 freeO(src); 3120 setTopIntO(src, 2); 3121 ck_assert_int_eq(renameSmallJsonOS(src, dst), 0); 3122 // non smallJson object 3123 terminateO(src); 3124 src = (smallJsont*) allocSmallInt(2); 3125 ck_assert_int_eq(renameSmallJsonOS(src, dst), 0); 3126 terminateO(src); 3127 // null paths 3128 ck_assert_int_eq(renameSmallJsonOS(null, dst), 0); 3129 ck_assert_int_eq(renameSmallJsonOS(src, null), 0); 3130 terminateO(src); 3131 3132 } 3133 3134 3135 void renameOT(CuTest *tc UNUSED) { 3136 3137 smallStringt* src = allocSmallString("renameTest.null"); 3138 smallStringt* dst = allocSmallString("rename2Test.null"); 3139 3140 // regualar file 3141 ck_assert_int_eq(renameO(src, dst), 1); 3142 ck_assert_int_eq(renameO(dst, src), 1); 3143 // blank src 3144 setValO(src, ""); 3145 ck_assert_int_eq(renameO(src, dst), 0); 3146 // blank dst 3147 setValO(src, "renameTest.null"); 3148 setValO(dst, ""); 3149 ck_assert_int_eq(renameO(src, dst), 0); 3150 // null paths 3151 setValO(dst, "qwe"); 3152 ck_assert_int_eq(renameO(null, dst), 0); 3153 ck_assert_int_eq(renameO(src, null), 0); 3154 terminateO(src); 3155 terminateO(dst); 3156 3157 } 3158 3159 3160 void renameOSmallJsonT(CuTest *tc UNUSED) { 3161 3162 smallStringt* src = allocSmallString(""); 3163 smallJsont* dst = allocSmallJson(); 3164 3165 // regualar file 3166 setValO(src, "renameTest.null"); 3167 setTopStringO(dst, "rename2Test.null"); 3168 ck_assert_int_eq(renameOSmallJson(src, dst), 1); 3169 setValO(src, "rename2Test.null"); 3170 freeO(dst); 3171 setTopStringO(dst, "renameTest.null"); 3172 ck_assert_int_eq(renameOSmallJson(src, dst), 1); 3173 // blank src 3174 setValO(src, ""); 3175 ck_assert_int_eq(renameOSmallJson(src, dst), 0); 3176 // blank dst 3177 setValO(src, "renameTest.null"); 3178 freeO(dst); 3179 setTopStringO(dst, ""); 3180 ck_assert_int_eq(renameOSmallJson(src, dst), 0); 3181 // non json string 3182 freeO(dst); 3183 setTopIntO(dst, 2); 3184 ck_assert_int_eq(renameOSmallJson(src, dst), 0); 3185 freeO(dst); 3186 setTopStringO(dst, "rename2Test.null"); 3187 // non smallJson/smallString objects 3188 terminateO(src); 3189 src = (smallStringt*) allocSmallInt(2); 3190 ck_assert_int_eq(renameOSmallJson(src, dst), 0); 3191 terminateO(src); 3192 terminateO(dst); 3193 src = allocSmallString("qwe"); 3194 dst = (smallJsont*) allocSmallInt(2); 3195 ck_assert_int_eq(renameOSmallJson(src, dst), 0); 3196 terminateO(dst); 3197 dst = allocSmallJson(); 3198 // null paths 3199 ck_assert_int_eq(renameOSmallJson(null, dst), 0); 3200 ck_assert_int_eq(renameOSmallJson(src, null), 0); 3201 terminateO(src); 3202 terminateO(dst); 3203 3204 } 3205 3206 3207 void renameSSmallJsonOT(CuTest *tc UNUSED) { 3208 3209 const char* src = "renameTest.null"; 3210 smallJsont* dst = allocSmallJson(); 3211 3212 // regualar file 3213 setTopStringO(dst, "rename2Test.null"); 3214 ck_assert_int_eq(renameSSmallJsonO(src, dst), 1); 3215 src = "rename2Test.null"; 3216 freeO(dst); 3217 setTopStringO(dst, "renameTest.null"); 3218 ck_assert_int_eq(renameSSmallJsonO(src, dst), 1); 3219 // blank src 3220 src = ""; 3221 ck_assert_int_eq(renameSSmallJsonO(src, dst), 0); 3222 // blank dst 3223 src = "renameTest.null"; 3224 freeO(dst); 3225 setTopStringO(dst, ""); 3226 ck_assert_int_eq(renameSSmallJsonO(src, dst), 0); 3227 // non json string 3228 freeO(dst); 3229 setTopIntO(dst, 2); 3230 ck_assert_int_eq(renameSSmallJsonO(src, dst), 0); 3231 freeO(dst); 3232 setTopStringO(dst, "rename2Test.null"); 3233 // non smallJson/smallString objects 3234 terminateO(dst); 3235 src = "qwe"; 3236 dst = (smallJsont*) allocSmallInt(2); 3237 ck_assert_int_eq(renameSSmallJsonO(src, dst), 0); 3238 terminateO(dst); 3239 dst = allocSmallJson(); 3240 // null paths 3241 ck_assert_int_eq(renameSSmallJsonO(null, dst), 0); 3242 ck_assert_int_eq(renameSSmallJsonO(src, null), 0); 3243 terminateO(dst); 3244 3245 } 3246 3247 3248 void renameSOT(CuTest *tc UNUSED) { 3249 3250 const char* src = "renameTest.null"; 3251 smallStringt* dst = allocSmallString("rename2Test.null"); 3252 3253 // regualar file 3254 ck_assert_int_eq(renameSO(src, dst), 1); 3255 src = "rename2Test.null"; 3256 setValO(dst, "renameTest.null"); 3257 ck_assert_int_eq(renameSO(src, dst), 1); 3258 // null paths 3259 ck_assert_int_eq(renameSO(null, dst), 0); 3260 ck_assert_int_eq(renameSO(src, null), 0); 3261 terminateO(dst); 3262 3263 } 3264 3265 3266 void renameOST(CuTest *tc UNUSED) { 3267 3268 smallStringt* src = allocSmallString("renameTest.null"); 3269 const char* dst = "rename2Test.null"; 3270 3271 // regualar file 3272 ck_assert_int_eq(renameOS(src, dst), 1); 3273 setValO(src, "rename2Test.null"); 3274 dst = "renameTest.null"; 3275 ck_assert_int_eq(renameOS(src, dst), 1); 3276 // null paths 3277 ck_assert_int_eq(renameOS(null, dst), 0); 3278 ck_assert_int_eq(renameOS(src, null), 0); 3279 terminateO(src); 3280 3281 } 3282 3283 3284 void moveSmallJsonOT(CuTest *tc UNUSED) { 3285 3286 smallJsont* src = allocSmallJson(); 3287 smallStringt* dst = allocSmallString("../../rename2Test.null"); 3288 3289 // regualar file 3290 setTopStringO(src, "renameTest.null"); 3291 ck_assert_int_eq(moveSmallJsonO(src, dst), 1); 3292 freeO(src); 3293 setTopStringO(src, "../../rename2Test.null"); 3294 setValO(dst, "renameTest.null"); 3295 ck_assert_int_eq(moveSmallJsonO(src, dst), 1); 3296 // blank src 3297 freeO(src); 3298 setTopStringO(src, ""); 3299 ck_assert_int_eq(moveSmallJsonO(src, dst), 0); 3300 // blank dst 3301 freeO(src); 3302 setTopStringO(src, "renameTest.null"); 3303 setValO(dst, ""); 3304 ck_assert_int_eq(moveSmallJsonO(src, dst), 0); 3305 // non json string 3306 freeO(src); 3307 setTopIntO(src, 2); 3308 ck_assert_int_eq(moveSmallJsonO(src, dst), 0); 3309 // non smallJson/smallString objects 3310 terminateO(src); 3311 src = (smallJsont*) allocSmallInt(2); 3312 ck_assert_int_eq(moveSmallJsonO(src, dst), 0); 3313 terminateO(src); 3314 terminateO(dst); 3315 src = allocSmallJson(); 3316 dst = (smallStringt*) allocSmallInt(2); 3317 ck_assert_int_eq(moveSmallJsonO(src, dst), 0); 3318 terminateO(dst); 3319 dst = allocSmallString("qwe"); 3320 // null paths 3321 ck_assert_int_eq(moveSmallJsonO(null, dst), 0); 3322 ck_assert_int_eq(moveSmallJsonO(src, null), 0); 3323 terminateO(src); 3324 terminateO(dst); 3325 3326 } 3327 3328 3329 void moveSmallJsonSmallJsonT(CuTest *tc UNUSED) { 3330 3331 smallJsont* src = allocSmallJson(); 3332 smallJsont* dst = allocSmallJson(); 3333 3334 // regualar file 3335 setTopStringO(src, "renameTest.null"); 3336 setTopStringO(dst, "../../rename2Test.null"); 3337 ck_assert_int_eq(moveSmallJsonSmallJson(src, dst), 1); 3338 freeO(src); 3339 setTopStringO(src, "../../rename2Test.null"); 3340 freeO(dst); 3341 setTopStringO(dst, "renameTest.null"); 3342 ck_assert_int_eq(moveSmallJsonSmallJson(src, dst), 1); 3343 // blank src 3344 freeO(src); 3345 setTopStringO(src, ""); 3346 ck_assert_int_eq(moveSmallJsonSmallJson(src, dst), 0); 3347 // blank dst 3348 freeO(src); 3349 setTopStringO(src, "renameTest.null"); 3350 freeO(dst); 3351 setTopStringO(dst, ""); 3352 ck_assert_int_eq(moveSmallJsonSmallJson(src, dst), 0); 3353 // non json string 3354 freeO(src); 3355 setTopIntO(src, 2); 3356 ck_assert_int_eq(moveSmallJsonSmallJson(src, dst), 0); 3357 freeO(src); 3358 setTopStringO(src, "renameTest.null"); 3359 freeO(dst); 3360 setTopIntO(dst, 2); 3361 ck_assert_int_eq(moveSmallJsonSmallJson(src, dst), 0); 3362 freeO(dst); 3363 setTopStringO(dst, "rename2Test.null"); 3364 // non smallJson/smallString objects 3365 terminateO(src); 3366 src = (smallJsont*) allocSmallInt(2); 3367 ck_assert_int_eq(moveSmallJsonSmallJson(src, dst), 0); 3368 terminateO(src); 3369 terminateO(dst); 3370 src = allocSmallJson(); 3371 dst = (smallJsont*) allocSmallInt(2); 3372 ck_assert_int_eq(moveSmallJsonSmallJson(src, dst), 0); 3373 terminateO(dst); 3374 dst = allocSmallJson(); 3375 // null paths 3376 ck_assert_int_eq(moveSmallJsonSmallJson(null, dst), 0); 3377 ck_assert_int_eq(moveSmallJsonSmallJson(src, null), 0); 3378 terminateO(src); 3379 terminateO(dst); 3380 3381 } 3382 3383 3384 void moveSmallJsonOST(CuTest *tc UNUSED) { 3385 3386 smallJsont* src = allocSmallJson(); 3387 const char* dst = "../../rename2Test.null"; 3388 3389 // regualar file 3390 setTopStringO(src, "renameTest.null"); 3391 ck_assert_int_eq(moveSmallJsonOS(src, dst), 1); 3392 freeO(src); 3393 setTopStringO(src, "../../rename2Test.null"); 3394 dst = "renameTest.null"; 3395 ck_assert_int_eq(moveSmallJsonOS(src, dst), 1); 3396 // blank src 3397 freeO(src); 3398 setTopStringO(src, ""); 3399 ck_assert_int_eq(moveSmallJsonOS(src, dst), 0); 3400 // blank dst 3401 freeO(src); 3402 setTopStringO(src, "renameTest.null"); 3403 dst = ""; 3404 ck_assert_int_eq(moveSmallJsonOS(src, dst), 0); 3405 // non json string 3406 dst = "qwe"; 3407 freeO(src); 3408 setTopIntO(src, 2); 3409 ck_assert_int_eq(moveSmallJsonOS(src, dst), 0); 3410 // non smallJson object 3411 terminateO(src); 3412 src = (smallJsont*) allocSmallInt(2); 3413 ck_assert_int_eq(moveSmallJsonOS(src, dst), 0); 3414 terminateO(src); 3415 // null paths 3416 ck_assert_int_eq(moveSmallJsonOS(null, dst), 0); 3417 ck_assert_int_eq(moveSmallJsonOS(src, null), 0); 3418 terminateO(src); 3419 3420 } 3421 3422 3423 void moveOT(CuTest *tc UNUSED) { 3424 3425 smallStringt* src = allocSmallString("renameTest.null"); 3426 smallStringt* dst = allocSmallString("../../rename2Test.null"); 3427 3428 // regualar file 3429 ck_assert_int_eq(moveO(src, dst), 1); 3430 ck_assert_int_eq(moveO(dst, src), 1); 3431 // blank src 3432 setValO(src, ""); 3433 ck_assert_int_eq(moveO(src, dst), 0); 3434 // blank dst 3435 setValO(src, "renameTest.null"); 3436 setValO(dst, ""); 3437 ck_assert_int_eq(moveO(src, dst), 0); 3438 // null paths 3439 setValO(dst, "qwe"); 3440 ck_assert_int_eq(moveO(null, dst), 0); 3441 ck_assert_int_eq(moveO(src, null), 0); 3442 terminateO(src); 3443 terminateO(dst); 3444 3445 } 3446 3447 3448 void moveOSmallJsonT(CuTest *tc UNUSED) { 3449 3450 smallStringt* src = allocSmallString(""); 3451 smallJsont* dst = allocSmallJson(); 3452 3453 // regualar file 3454 setValO(src, "renameTest.null"); 3455 setTopStringO(dst, "../../rename2Test.null"); 3456 ck_assert_int_eq(moveOSmallJson(src, dst), 1); 3457 setValO(src, "../../rename2Test.null"); 3458 freeO(dst); 3459 setTopStringO(dst, "renameTest.null"); 3460 ck_assert_int_eq(moveOSmallJson(src, dst), 1); 3461 // blank src 3462 setValO(src, ""); 3463 ck_assert_int_eq(moveOSmallJson(src, dst), 0); 3464 // blank dst 3465 setValO(src, "renameTest.null"); 3466 freeO(dst); 3467 setTopStringO(dst, ""); 3468 ck_assert_int_eq(moveOSmallJson(src, dst), 0); 3469 // non json string 3470 freeO(dst); 3471 setTopIntO(dst, 2); 3472 ck_assert_int_eq(moveOSmallJson(src, dst), 0); 3473 freeO(dst); 3474 setTopStringO(dst, "rename2Test.null"); 3475 // non smallJson/smallString objects 3476 terminateO(src); 3477 src = (smallStringt*) allocSmallInt(2); 3478 ck_assert_int_eq(moveOSmallJson(src, dst), 0); 3479 terminateO(src); 3480 terminateO(dst); 3481 src = allocSmallString("qwe"); 3482 dst = (smallJsont*) allocSmallInt(2); 3483 ck_assert_int_eq(moveOSmallJson(src, dst), 0); 3484 terminateO(dst); 3485 dst = allocSmallJson(); 3486 // null paths 3487 ck_assert_int_eq(moveOSmallJson(null, dst), 0); 3488 ck_assert_int_eq(moveOSmallJson(src, null), 0); 3489 terminateO(src); 3490 terminateO(dst); 3491 3492 } 3493 3494 3495 void moveSSmallJsonOT(CuTest *tc UNUSED) { 3496 3497 const char* src = "renameTest.null"; 3498 smallJsont* dst = allocSmallJson(); 3499 3500 // regualar file 3501 setTopStringO(dst, "../../rename2Test.null"); 3502 ck_assert_int_eq(moveSSmallJsonO(src, dst), 1); 3503 src = "../../rename2Test.null"; 3504 freeO(dst); 3505 setTopStringO(dst, "renameTest.null"); 3506 ck_assert_int_eq(moveSSmallJsonO(src, dst), 1); 3507 // blank src 3508 src = ""; 3509 ck_assert_int_eq(moveSSmallJsonO(src, dst), 0); 3510 // blank dst 3511 src = "renameTest.null"; 3512 freeO(dst); 3513 setTopStringO(dst, ""); 3514 ck_assert_int_eq(moveSSmallJsonO(src, dst), 0); 3515 // non json string 3516 freeO(dst); 3517 setTopIntO(dst, 2); 3518 ck_assert_int_eq(moveSSmallJsonO(src, dst), 0); 3519 freeO(dst); 3520 setTopStringO(dst, "rename2Test.null"); 3521 // non smallJson/smallString objects 3522 terminateO(dst); 3523 src = "qwe"; 3524 dst = (smallJsont*) allocSmallInt(2); 3525 ck_assert_int_eq(moveSSmallJsonO(src, dst), 0); 3526 terminateO(dst); 3527 dst = allocSmallJson(); 3528 // null paths 3529 ck_assert_int_eq(moveSSmallJsonO(null, dst), 0); 3530 ck_assert_int_eq(moveSSmallJsonO(src, null), 0); 3531 terminateO(dst); 3532 3533 } 3534 3535 3536 void moveSOT(CuTest *tc UNUSED) { 3537 3538 const char* src = "renameTest.null"; 3539 smallStringt* dst = allocSmallString("../../rename2Test.null"); 3540 3541 // regualar file 3542 ck_assert_int_eq(moveSO(src, dst), 1); 3543 src = "../../rename2Test.null"; 3544 setValO(dst, "renameTest.null"); 3545 ck_assert_int_eq(moveSO(src, dst), 1); 3546 // null paths 3547 ck_assert_int_eq(moveSO(null, dst), 0); 3548 ck_assert_int_eq(moveSO(src, null), 0); 3549 terminateO(dst); 3550 3551 } 3552 3553 3554 void moveOST(CuTest *tc UNUSED) { 3555 3556 smallStringt* src = allocSmallString("renameTest.null"); 3557 const char* dst = "../../rename2Test.null"; 3558 3559 // regualar file 3560 ck_assert_int_eq(moveOS(src, dst), 1); 3561 setValO(src, "../../rename2Test.null"); 3562 dst = "renameTest.null"; 3563 ck_assert_int_eq(moveOS(src, dst), 1); 3564 // null paths 3565 ck_assert_int_eq(moveOS(null, dst), 0); 3566 ck_assert_int_eq(moveOS(src, null), 0); 3567 terminateO(src); 3568 3569 } 3570 3571 3572 void randomSmallJsonOT(CuTest *tc UNUSED) { 3573 3574 smallJsont *r; 3575 uint64_t length = 20; 3576 3577 r = randomSmallJsonO(length); 3578 ck_assert_ptr_ne(r, null); 3579 ck_assert_int_eq(lenO(r), length); 3580 terminateO(r); 3581 // invalid length (0) 3582 ck_assert_ptr_eq(randomSmallJsonO(0), null); 3583 3584 } 3585 3586 3587 void randomAlphaNumSmallJsonOT(CuTest *tc UNUSED) { 3588 3589 smallJsont *r; 3590 uint64_t length = 20; 3591 3592 r = randomAlphaNumSmallJsonO(length); 3593 ck_assert_ptr_ne(r, null); 3594 ck_assert_int_eq(lenO(r), length); 3595 terminateO(r); 3596 // invalid length (0) 3597 ck_assert_ptr_eq(randomAlphaNumSmallJsonO(0), null); 3598 3599 } 3600 3601 3602 void readSmallJsonOT(CuTest *tc UNUSED) { 3603 3604 smallJsont *r; 3605 3606 r = readSmallJsonO(); 3607 char *s = toStringO(r); 3608 terminateO(r); 3609 ck_assert_str_eq(s, "aaaaaaaaaaaaaaaaaaaa"); 3610 free(s); 3611 3612 } 3613 3614 3615 void readOT(CuTest *tc UNUSED) { 3616 3617 smallStringt *r; 3618 3619 r = readO(); 3620 char *s = toStringO(r); 3621 terminateO(r); 3622 ck_assert_str_eq(s, "aaaaaaaaaaaaaaaaaaaa"); 3623 free(s); 3624 3625 } 3626 3627 3628 void readLineSmallJsonOT(CuTest *tc UNUSED) { 3629 3630 smallJsont *r; 3631 FILE *fp; 3632 3633 // file with data 3634 fp = fopen("../textTest.null", "r"); 3635 r = readLineSmallJsonO(fp); 3636 fclose(fp); 3637 char *s = toStringO(r); 3638 terminateO(r); 3639 ck_assert_str_eq(s, "LINE 1"); 3640 free(s); 3641 3642 } 3643 3644 3645 void intToSGT(CuTest *tc UNUSED) { 3646 3647 char *s; 3648 3649 s = intToSG(null, 123); 3650 ck_assert_str_eq(s, "123"); 3651 free(s); 3652 s = intToSG(null, -465464123); 3653 ck_assert_str_eq(s, "-465464123"); 3654 free(s); 3655 3656 } 3657 3658 3659 void doubleToSGT(CuTest *tc UNUSED) { 3660 3661 char *s; 3662 3663 s = doubleToSG(null, 123.4); 3664 ck_assert_str_eq(s, "1.234000e+02"); 3665 free(s); 3666 s = doubleToSG(null, -4652445e5); 3667 ck_assert_str_eq(s, "-4.652445e+11"); 3668 free(s); 3669 3670 } 3671 3672 3673 void iListUniqGT(CuTest *tc UNUSED) { 3674 3675 char **l = NULL; 3676 char **l2; 3677 3678 // list with unique elements 3679 listPushS(&l, "1"); 3680 listPushS(&l, "22"); 3681 listPushS(&l, "333"); 3682 listPushS(&l, "4444"); 3683 l2 = listDupS(l); 3684 iListUniqG(&l2, 0); 3685 ck_assert(listEqS(l,l2)); 3686 // list with identical elements 3687 l[2][0] = '2'; 3688 l[2][1] = '2'; 3689 l[2][2] = 0; 3690 listFreeS(l2); 3691 l2 = listDupS(l); 3692 iListUniqG(&l2, 0); 3693 ck_assert_uint_eq(listLengthS(l2),3); 3694 ck_assert_str_eq(l2[2], "4444"); 3695 listFreeS(l); 3696 listFreeS(l2); 3697 3698 } 3699 3700 3701 void iicListUniqGT(CuTest *tc UNUSED) { 3702 3703 char **l = NULL; 3704 char **l2; 3705 3706 // list with unique elements 3707 listPushS(&l, "1"); 3708 listPushS(&l, "BB"); 3709 listPushS(&l, "333"); 3710 listPushS(&l, "4444"); 3711 l2 = listDupS(l); 3712 iicListUniqG(&l2, 0); 3713 ck_assert(listEqS(l,l2)); 3714 // list with identical elements 3715 l[2][0] = 'b'; 3716 l[2][1] = 'b'; 3717 l[2][2] = 0; 3718 listFreeS(l2); 3719 l2 = listDupS(l); 3720 iicListUniqG(&l2, 0); 3721 ck_assert_uint_eq(listLengthS(l2),3); 3722 ck_assert_str_eq(l2[2], "4444"); 3723 listFreeS(l); 3724 listFreeS(l2); 3725 3726 } 3727 3728 3729 void listFromArrayGT(CuTest *tc UNUSED) { 3730 3731 char **l = NULL; 3732 char *array[] = {"1", "22", "333"}; 3733 3734 // copy array to list 3735 l = listFromArrayG(null, array, 3); 3736 ck_assert_uint_eq(listLengthS(l),3); 3737 ck_assert_str_eq(l[0], "1"); 3738 ck_assert_str_eq(l[1], "22"); 3739 ck_assert_str_eq(l[2], "333"); 3740 listFreeS(l); 3741 3742 } 3743 3744 3745 void listFromCArrayGT(CuTest *tc UNUSED) { 3746 3747 char **l = NULL; 3748 const char *array[] = {"1", "22", "333"}; 3749 3750 // copy array to list 3751 l = listFromCArrayG(null, array, 3); 3752 ck_assert_uint_eq(listLengthS(l),3); 3753 ck_assert_str_eq(l[0], "1"); 3754 ck_assert_str_eq(l[1], "22"); 3755 ck_assert_str_eq(l[2], "333"); 3756 listFreeS(l); 3757 3758 } 3759 3760 3761 void getSGT(CuTest *tc UNUSED) { 3762 3763 // get char 3764 ck_assert_uint_eq(getSG("sheepy", 0/*type unused*/, 1), 'h'); 3765 3766 } 3767 3768 3769 void listGetGT(CuTest *tc UNUSED) { 3770 3771 char **l = NULL; 3772 3773 // get string 3774 listPushS(&l, "1"); 3775 listPushS(&l, "22"); 3776 listPushS(&l, "333"); 3777 listPushS(&l, "4444"); 3778 char *s = listGetG(l, 0/*type unused*/, 1); 3779 ck_assert_str_eq(s, "22"); 3780 free(s); 3781 listFreeS(l); 3782 3783 } 3784 3785 3786 void listGetCGT(CuTest *tc UNUSED) { 3787 3788 const char *array[] = {"1", "22", "333", null}; 3789 3790 char *s = listGetCG(array, 0/*type unused*/, 1); 3791 ck_assert_str_eq(s, "22"); 3792 free(s); 3793 3794 } 3795 3796 3797 void iListGetGT(CuTest *tc UNUSED) { 3798 3799 char **l = NULL; 3800 3801 // get string 3802 listPushS(&l, "1"); 3803 listPushS(&l, "22"); 3804 listPushS(&l, "333"); 3805 listPushS(&l, "4444"); 3806 ck_assert_str_eq(iListGetG(l, 0/*type unused*/, 1), "22"); 3807 listFreeS(l); 3808 3809 } 3810 3811 3812 void iListGetCGT(CuTest *tc UNUSED) { 3813 3814 const char *array[] = {"1", "22", "333", null}; 3815 3816 ck_assert_str_eq(iListGetCG(array, 0/*type unused*/, 1), "22"); 3817 3818 } 3819 3820 3821 void listPopGT(CuTest *tc UNUSED) { 3822 3823 char **l = NULL; 3824 char *s; 3825 3826 // pop string 3827 listPushS(&l, "sheepy"); 3828 listPushS(&l, "SHEEPY"); 3829 s = listPopG(&l, 0/*unused*/); 3830 ck_assert_str_eq(s, "SHEEPY"); 3831 ck_assert_uint_eq(listLengthS(l),1); 3832 free(s); 3833 listFreeS(l); 3834 3835 } 3836 3837 3838 void listDequeueGT(CuTest *tc UNUSED) { 3839 3840 char **l = NULL; 3841 char *s; 3842 3843 // dequeue string 3844 listPushS(&l, "sheepy"); 3845 listPushS(&l, "SHEEPY"); 3846 s = listDequeueG(&l, 0/*unused*/); 3847 ck_assert_str_eq(s, "sheepy"); 3848 ck_assert_uint_eq(listLengthS(l),1); 3849 free(s); 3850 listFreeS(l); 3851 3852 } 3853 3854 3855 void listDupCGT(CuTest *tc UNUSED) { 3856 3857 const char *l[] = {"1", "22", "333", "4444", null}; 3858 char **l2; 3859 3860 // list 3861 l2 = listDupCG(l); 3862 ck_assert_uint_eq(listLengthS(l2),4); 3863 ck_assert_str_eq(l2[0], "1"); 3864 ck_assert_str_eq(l2[3], "4444"); 3865 listFreeS(l2); 3866 3867 } 3868 3869 3870 void listEqCGT(CuTest *tc UNUSED) { 3871 3872 char **l = null; 3873 const char *l2[] = {"1", "22", "333", "4444", null}; 3874 3875 // identical lists 3876 listPushS(&l, "1"); 3877 listPushS(&l, "22"); 3878 listPushS(&l, "333"); 3879 listPushS(&l, "4444"); 3880 ck_assert(listEqCG(l,l2)); 3881 listFreeS(l); 3882 3883 } 3884 3885 3886 void listEqC1GT(CuTest *tc UNUSED) { 3887 3888 char **l = null; 3889 const char *l2[] = {"1", "22", "333", "4444", null}; 3890 3891 // identical lists 3892 listPushS(&l, "1"); 3893 listPushS(&l, "22"); 3894 listPushS(&l, "333"); 3895 listPushS(&l, "4444"); 3896 ck_assert(listEqC1G(l2,l)); 3897 listFreeS(l); 3898 3899 } 3900 3901 3902 void listEqCCGT(CuTest *tc UNUSED) { 3903 3904 const char *l[] = {"1", "22", "333", "4444", null}; 3905 const char *l2[] = {"1", "22", "333", "4444", null}; 3906 ck_assert(listEqCCG(l,l2)); 3907 3908 } 3909 3910 3911 void icListEqCGT(CuTest *tc UNUSED) { 3912 3913 char **l = null; 3914 const char *l2[] = {"a", "22", "333", "4444", null}; 3915 3916 listPushS(&l, "A"); 3917 listPushS(&l, "22"); 3918 listPushS(&l, "333"); 3919 listPushS(&l, "4444"); 3920 ck_assert(icListEqCG(l,l2)); 3921 listFreeS(l); 3922 3923 } 3924 3925 3926 void icListEqC1GT(CuTest *tc UNUSED) { 3927 3928 char **l = null; 3929 const char *l2[] = {"a", "22", "333", "4444", null}; 3930 3931 listPushS(&l, "A"); 3932 listPushS(&l, "22"); 3933 listPushS(&l, "333"); 3934 listPushS(&l, "4444"); 3935 ck_assert(icListEqC1G(l2,l)); 3936 listFreeS(l); 3937 3938 } 3939 3940 3941 void icListEqCCGT(CuTest *tc UNUSED) { 3942 3943 const char *l[] = {"a", "22", "333", "4444", null}; 3944 const char *l2[] = {"A", "22", "333", "4444", null}; 3945 ck_assert(icListEqCCG(l,l2)); 3946 3947 } 3948 3949 3950 void listLengthCGT(CuTest *tc UNUSED) { 3951 3952 const char *l[] = {"a", "22", "333", "4444", null}; 3953 3954 ck_assert_int_eq(listLengthCG(l), 4); 3955 3956 } 3957 3958 3959 void listIndexOfCGT(CuTest *tc UNUSED) { 3960 3961 const char *l[] = {"a", "22", "333", "4444", null}; 3962 3963 ck_assert_int_eq(listIndexOfCG(l, "333"), 2); 3964 3965 } 3966 3967 3968 void listIndexOfCharCGT(CuTest *tc UNUSED) { 3969 3970 const char *l[] = {"a", "22", "333", "4444", null}; 3971 3972 ck_assert_int_eq(listIndexOfCharCG(l, 'a'), 0); 3973 3974 } 3975 3976 3977 void icListIndexOfCGT(CuTest *tc UNUSED) { 3978 3979 const char *l[] = {"a", "22", "333", "4444", null}; 3980 3981 ck_assert_int_eq(icListIndexOfCG(l, "A"), 0); 3982 3983 } 3984 3985 3986 void icListIndexOfCharCGT(CuTest *tc UNUSED) { 3987 3988 const char *l[] = {"a", "22", "333", "4444", null}; 3989 3990 ck_assert_int_eq(icListIndexOfCharCG(l, 'A'), 0); 3991 3992 } 3993 3994 3995 void listHasCharCGT(CuTest *tc UNUSED) { 3996 3997 const char *l[] = {"a", "22", "333", "4444", null}; 3998 3999 ck_assert(listHasCharCG(l, 'a')); 4000 4001 } 4002 4003 4004 void listHasCGT(CuTest *tc UNUSED) { 4005 4006 const char *l[] = {"a", "22", "333", "4444", null}; 4007 4008 ck_assert(listHasCG(l, "333")); 4009 4010 } 4011 4012 4013 void icListHasCGT(CuTest *tc UNUSED) { 4014 4015 const char *l[] = {"a", "22", "333", "4444", null}; 4016 4017 ck_assert(icListHasCG(l, "A")); 4018 4019 } 4020 4021 4022 void icListHasCharCGT(CuTest *tc UNUSED) { 4023 4024 const char *l[] = {"a", "22", "333", "4444", null}; 4025 4026 ck_assert(icListHasCharCG(l, 'A')); 4027 4028 } 4029 4030 4031 void joinCGT(CuTest *tc UNUSED) { 4032 4033 char *r; 4034 const char *list[] = {"one", "two", null}; 4035 4036 r = joinCG(list, "/"); 4037 ck_assert_ptr_ne(r, null); 4038 ck_assert_str_eq(r, "one/two"); 4039 free(r); 4040 4041 } 4042 4043 4044 void joinCharCGT(CuTest *tc UNUSED) { 4045 4046 char *r; 4047 const char *list[] = {"one", "two", null}; 4048 4049 r = joinCharCG(list, '/'); 4050 ck_assert_ptr_ne(r, null); 4051 ck_assert_str_eq(r, "one/two"); 4052 free(r); 4053 4054 } 4055 4056 4057 void listAddCGT(CuTest *tc UNUSED) { 4058 4059 char **r; 4060 char **l = null; 4061 const char *l2[] = {"A", "BB", "CCC", "DDDD", null}; 4062 4063 // lists 4064 listPushS(&l, "1"); 4065 listPushS(&l, "22"); 4066 listPushS(&l, "333"); 4067 listPushS(&l, "4444"); 4068 r = listAddCG(l, l2); 4069 ck_assert_uint_eq(listLengthS(r),8); 4070 ck_assert_str_eq(r[0], "1"); 4071 ck_assert_str_eq(r[3], "4444"); 4072 ck_assert_str_eq(r[4],"A"); 4073 ck_assert_str_eq(r[7],"DDDD"); 4074 listFreeS(r); 4075 listFreeS(l); 4076 4077 } 4078 4079 4080 void listPrintCGT(CuTest *tc UNUSED) { 4081 4082 const char *list[] = {"1", "22", null}; 4083 4084 listPrintCG(list); 4085 4086 } 4087 4088 4089 void eqCharCharT(CuTest *tc UNUSED) { 4090 4091 ck_assert(eqCharChar('a', 'a')); 4092 4093 } 4094 4095 4096 void equalChaOGT(CuTest *tc UNUSED) { 4097 4098 baset* value = (baset*) allocSmallString("a"); 4099 4100 ck_assert(equalChaOG('a', value)); 4101 terminateO(value); 4102 4103 } 4104 4105 4106 void equalChaBoolGT(CuTest *tc UNUSED) { 4107 4108 ck_assert(!equalChaBoolG('a', false)); 4109 4110 } 4111 4112 4113 void equalChaDoubleGT(CuTest *tc UNUSED) { 4114 4115 ck_assert(!equalChaDoubleG('1', 1)); 4116 4117 } 4118 4119 4120 void equalChaInt64GT(CuTest *tc UNUSED) { 4121 4122 ck_assert(equalChaInt64G('2', 2)); 4123 4124 } 4125 4126 4127 void equalChaInt32GT(CuTest *tc UNUSED) { 4128 4129 ck_assert(equalChaInt32G('2', 2)); 4130 4131 } 4132 4133 4134 void equalChaUint32GT(CuTest *tc UNUSED) { 4135 4136 ck_assert(equalChaUint32G('2', 2)); 4137 4138 } 4139 4140 4141 void equalChaUint64GT(CuTest *tc UNUSED) { 4142 4143 ck_assert(equalChaUint64G('2', 2)); 4144 4145 } 4146 4147 4148 void equalChaSmallBytesGT(CuTest *tc UNUSED) { 4149 4150 smallBytest* value = allocSmallBytes("a", sizeof("a")); 4151 4152 ck_assert(equalChaSmallBytesG('a', value)); 4153 freeO(value); 4154 ck_assert(!equalChaSmallBytesG('a', value)); 4155 terminateO(value); 4156 ck_assert(!equalChaSmallBytesG('a', value)); 4157 4158 } 4159 4160 4161 void equalChaSmallDoubleGT(CuTest *tc UNUSED) { 4162 4163 smallDoublet* value = allocSmallDouble(0); 4164 4165 ck_assert(!equalChaSmallDoubleG('0', value)); 4166 freeO(value); 4167 ck_assert(!equalChaSmallDoubleG('0', value)); 4168 terminateO(value); 4169 ck_assert(!equalChaSmallDoubleG('0', value)); 4170 4171 } 4172 4173 4174 void equalChaSmallIntGT(CuTest *tc UNUSED) { 4175 4176 smallIntt* value = allocSmallInt(2); 4177 4178 ck_assert(equalChaSmallIntG('2', value)); 4179 freeO(value); 4180 ck_assert(!equalChaSmallIntG('2', value)); 4181 terminateO(value); 4182 ck_assert(!equalChaSmallIntG('2', value)); 4183 4184 } 4185 4186 4187 void equalChaSmallJsonGT(CuTest *tc UNUSED) { 4188 4189 smallJsont* value = allocSmallJson(); 4190 4191 setTopStringO(value, "a"); 4192 ck_assert(equalChaSmallJsonG('a', value)); 4193 // non json string 4194 freeO(value); 4195 setTopIntO(value, 2); 4196 ck_assert(!equalChaSmallJsonG('a', value)); 4197 // non json object 4198 terminateO(value); 4199 value = (smallJsont*) allocSmallInt(0); 4200 ck_assert(!equalChaSmallJsonG('a', value)); 4201 terminateO(value); 4202 ck_assert(!equalChaSmallJsonG('a', value)); 4203 4204 } 4205 4206 4207 void equalChaSmallStringGT(CuTest *tc UNUSED) { 4208 4209 smallStringt* value = allocSmallString("a"); 4210 4211 ck_assert(equalChaSmallStringG('a', value)); 4212 freeO(value); 4213 ck_assert(!equalChaSmallStringG('a', value)); 4214 terminateO(value); 4215 ck_assert(!equalChaSmallStringG('a', value)); 4216 4217 } 4218 4219 4220 void equalCharOGT(CuTest *tc UNUSED) { 4221 4222 baset* value = (baset*) allocSmallInt(2); 4223 4224 ck_assert(equalCharOG("2", value)); 4225 ck_assert(!equalCharOG(null, value)); 4226 terminateO(value); 4227 ck_assert(!equalCharOG("2", value)); 4228 4229 } 4230 4231 4232 void equalCharBoolGT(CuTest *tc UNUSED) { 4233 4234 ck_assert(equalCharBoolG("true", true)); 4235 4236 } 4237 4238 4239 void equalCharDoubleGT(CuTest *tc UNUSED) { 4240 4241 ck_assert(equalCharDoubleG("1.0", 1)); 4242 4243 } 4244 4245 4246 void equalCharInt64GT(CuTest *tc UNUSED) { 4247 4248 ck_assert(equalCharInt64G("2", 2)); 4249 4250 } 4251 4252 4253 void equalCharInt32GT(CuTest *tc UNUSED) { 4254 4255 ck_assert(equalCharInt32G("2", 2)); 4256 4257 } 4258 4259 4260 void equalCharUint32GT(CuTest *tc UNUSED) { 4261 4262 ck_assert(equalCharUint32G("2", 2)); 4263 4264 } 4265 4266 4267 void equalCharUint64GT(CuTest *tc UNUSED) { 4268 4269 ck_assert(equalCharUint64G("2", 2)); 4270 4271 } 4272 4273 4274 void equalCharSmallBoolGT(CuTest *tc UNUSED) { 4275 4276 smallBoolt* value = allocSmallBool(true); 4277 4278 ck_assert(equalCharSmallBoolG("true", value)); 4279 terminateO(value); 4280 ck_assert(!equalCharSmallBoolG("false", value)); 4281 4282 } 4283 4284 4285 void equalCharSmallBytesGT(CuTest *tc UNUSED) { 4286 4287 smallBytest* value = allocSmallBytes("qwe", sizeof("qwe")); 4288 4289 ck_assert(equalCharSmallBytesG("qwe", value)); 4290 terminateO(value); 4291 ck_assert(!equalCharSmallBytesG("qwe", value)); 4292 4293 } 4294 4295 4296 void equalCharSmallDoubleGT(CuTest *tc UNUSED) { 4297 4298 smallDoublet* value = allocSmallDouble(1); 4299 4300 ck_assert(equalCharSmallDoubleG("1.0", value)); 4301 terminateO(value); 4302 ck_assert(!equalCharSmallDoubleG("1.0", value)); 4303 4304 } 4305 4306 4307 void equalCharSmallIntGT(CuTest *tc UNUSED) { 4308 4309 smallIntt* value = allocSmallInt(2); 4310 4311 ck_assert(equalCharSmallIntG("2", value)); 4312 terminateO(value); 4313 ck_assert(!equalCharSmallIntG("2", value)); 4314 4315 } 4316 4317 4318 void equalCharPSmallJsonGT(CuTest *tc UNUSED) { 4319 4320 smallJsont* value = allocSmallJson(); 4321 4322 setTopStringO(value, "qwe"); 4323 ck_assert(equalCharPSmallJsonG("qwe", value)); 4324 // non json string 4325 freeO(value); 4326 setTopIntO(value, 2); 4327 ck_assert(!equalCharPSmallJsonG("2", value)); 4328 // non json object 4329 terminateO(value); 4330 value = (smallJsont*) allocSmallInt(2); 4331 ck_assert(!equalCharPSmallJsonG("2", value)); 4332 terminateO(value); 4333 ck_assert(!equalCharPSmallJsonG("qwe", value)); 4334 4335 } 4336 4337 4338 void equalCharPSmallStringGT(CuTest *tc UNUSED) { 4339 4340 smallStringt* value = allocSmallString("qwe"); 4341 4342 ck_assert(equalCharPSmallStringG("qwe", value)); 4343 terminateO(value); 4344 ck_assert(!equalCharPSmallStringG("qwe", value)); 4345 4346 } 4347 4348 4349 void equalArrayOGT(CuTest *tc UNUSED) { 4350 4351 char ** p1 = listCreateS("A", "bb"); 4352 smallArrayt* a = createSA("A", "BB"); 4353 baset* p2 = (baset*)a; 4354 4355 ck_assert(!equalArrayOG(p1, p2)); 4356 iUpperS(&p1[1]); 4357 ck_assert(equalArrayOG(p1, p2)); 4358 // array with deleted elements 4359 a->f->pushS(a, "BB"); 4360 delElemO(a, 1); 4361 ck_assert(!equalArrayOG(p1, p2)); 4362 trimO(a); 4363 // p1 empty 4364 forEachS(p1, e) free(e); 4365 p1[0] = null; 4366 ck_assert(!equalArrayOG(p1, p2)); 4367 // p2 empty 4368 listPushS(&p1, "A"); 4369 listPushS(&p1, "BB"); 4370 emptyO(a); 4371 ck_assert(!equalArrayOG(p1, p2)); 4372 // non smallArray object 4373 terminateO(p2); 4374 p2 = (baset*) allocSmallInt(2); 4375 ck_assert(!equalArrayOG(p1, p2)); 4376 // null parameters 4377 ck_assert(!equalArrayOG(null, p2)); 4378 ck_assert(!equalArrayOG(p1, null)); 4379 terminateO(p2); 4380 listFreeS(p1); 4381 4382 4383 } 4384 4385 4386 void equalCArrayOGT(CuTest *tc UNUSED) { 4387 4388 const char *p1[] = {"A", "bb", null}; 4389 smallArrayt* a = createSA("A", "BB"); 4390 baset* p2 = (baset*)a; 4391 4392 ck_assert(!equalCArrayOG(p1, p2)); 4393 p1[1] = "BB"; 4394 ck_assert(equalCArrayOG(p1, p2)); 4395 terminateO(p2); 4396 4397 } 4398 4399 4400 void equalArraySmallJsonGT(CuTest *tc UNUSED) { 4401 4402 char ** p1 = listCreateS("A", "bb"); 4403 smallJsont* p2 = createSJ("A", "BB"); 4404 4405 ck_assert(!equalArraySmallJsonG(p1, p2)); 4406 iUpperS(&p1[1]); 4407 ck_assert(equalArraySmallJsonG(p1, p2)); 4408 // array with deleted elements 4409 p2->f->pushS(p2, "BB"); 4410 delElemIndexO(p2, 1); 4411 ck_assert(!equalArraySmallJsonG(p1, p2)); 4412 trimO(p2); 4413 // p1 empty 4414 forEachS(p1, e) free(e); 4415 p1[0] = null; 4416 ck_assert(!equalArraySmallJsonG(p1, p2)); 4417 // p2 empty 4418 listPushS(&p1, "A"); 4419 listPushS(&p1, "BB"); 4420 emptyO(p2); 4421 ck_assert(!equalArraySmallJsonG(p1, p2)); 4422 // non json array 4423 freeO(p2); 4424 setTopIntO(p2, 2); 4425 ck_assert(!equalArraySmallJsonG(p1, p2)); 4426 // non smallJson object 4427 terminateO(p2); 4428 p2 = (smallJsont*) allocSmallInt(2); 4429 ck_assert(!equalArraySmallJsonG(p1, p2)); 4430 // null parameters 4431 ck_assert(!equalArraySmallJsonG(null, p2)); 4432 ck_assert(!equalArraySmallJsonG(p1, null)); 4433 terminateO(p2); 4434 listFreeS(p1); 4435 4436 } 4437 4438 4439 void equalArraySmallArrayGT(CuTest *tc UNUSED) { 4440 4441 char ** p1 = listCreateS("A", "bb"); 4442 smallArrayt* p2 = createSA("A", "BB"); 4443 4444 ck_assert(!equalArraySmallArrayG(p1, p2)); 4445 iUpperS(&p1[1]); 4446 ck_assert(equalArraySmallArrayG(p1, p2)); 4447 // array with deleted elements 4448 p2->f->pushS(p2, "BB"); 4449 delElemO(p2, 1); 4450 ck_assert(!equalArraySmallArrayG(p1, p2)); 4451 trimO(p2); 4452 // p1 empty 4453 forEachS(p1, e) free(e); 4454 p1[0] = null; 4455 ck_assert(!equalArraySmallArrayG(p1, p2)); 4456 // p2 empty 4457 listPushS(&p1, "A"); 4458 listPushS(&p1, "BB"); 4459 emptyO(p2); 4460 ck_assert(!equalArraySmallArrayG(p1, p2)); 4461 // non smallArray object 4462 terminateO(p2); 4463 p2 = (smallArrayt*) allocSmallInt(2); 4464 ck_assert(!equalArraySmallArrayG(p1, p2)); 4465 // null parameters 4466 ck_assert(!equalArraySmallArrayG(null, p2)); 4467 ck_assert(!equalArraySmallArrayG(p1, null)); 4468 terminateO(p2); 4469 listFreeS(p1); 4470 4471 } 4472 4473 4474 void equalCArraySmallJsonGT(CuTest *tc UNUSED) { 4475 4476 const char * p1[] = {"a", null}; 4477 smallJsont* p2 = allocSmallJson(); 4478 4479 ck_assert(!equalCArraySmallJsonG(p1, p2)); 4480 terminateO(p2); 4481 4482 } 4483 4484 4485 void equalCArraySmallArrayGT(CuTest *tc UNUSED) { 4486 4487 const char * p1[] = {"a", null}; 4488 smallArrayt* p2 = allocSmallArray(); 4489 4490 ck_assert(!equalCArraySmallArrayG(p1, p2)); 4491 terminateO(p2); 4492 4493 } 4494 4495 4496 void equalOCharGT(CuTest *tc UNUSED) { 4497 4498 baset* p1 = (baset*) allocSmallString("asd"); 4499 const char * p2 = "asd"; 4500 4501 ck_assert(equalOCharG(p1, p2)); 4502 terminateO(p1); 4503 4504 } 4505 4506 4507 void equalOChaGT(CuTest *tc UNUSED) { 4508 4509 baset* p1 = (baset*) allocSmallString("a"); 4510 4511 ck_assert(equalOChaG(p1, 'a')); 4512 terminateO(p1); 4513 4514 } 4515 4516 4517 void equalOArrayGT(CuTest *tc UNUSED) { 4518 4519 baset* p1 = (baset*) createSA("A", "BB"); 4520 char ** p2 = listCreateS("A", "BB"); 4521 4522 ck_assert(equalOArrayG(p1, p2)); 4523 terminateO(p1); 4524 listFreeS(p2); 4525 4526 } 4527 4528 4529 void equalOCArrayGT(CuTest *tc UNUSED) { 4530 4531 baset* p1 = (baset*) createSA("A", "BB"); 4532 const char * p2[] = {"A", "BB", null}; 4533 4534 ck_assert(equalOCArrayG(p1, p2)); 4535 terminateO(p1); 4536 4537 } 4538 4539 4540 void equalOOGT(CuTest *tc UNUSED) { 4541 4542 baset* p1 = (baset*) allocSmallString("2"); 4543 smallJsont* P2 = allocSmallJson(); 4544 baset* p2 = (baset*)P2; 4545 4546 setTopIntO(P2, 2); 4547 ck_assert(equalOOG(p1, p2)); 4548 freeO(P2); 4549 setTopIntO(P2, 0); 4550 ck_assert(!equalOOG(p1, p2)); 4551 freeO(P2); 4552 setTopIntO(P2, 2); 4553 // null parameters 4554 ck_assert(!equalOOG(null, p2)); 4555 ck_assert(!equalOOG(p1, null)); 4556 terminateO(p1); 4557 terminateO(p2); 4558 4559 } 4560 4561 4562 void equalOBoolGT(CuTest *tc UNUSED) { 4563 4564 baset* p1 = (baset*)allocSmallString("TRUE"); 4565 4566 ck_assert(equalOBoolG(p1, true)); 4567 terminateO(p1); 4568 4569 } 4570 4571 4572 void equalODoubleGT(CuTest *tc UNUSED) { 4573 4574 baset* p1 = (baset*) allocSmallDouble(2.2); 4575 4576 ck_assert(equalODoubleG(p1, 2.2)); 4577 terminateO(p1); 4578 4579 } 4580 4581 4582 void equalOInt64GT(CuTest *tc UNUSED) { 4583 4584 baset* p1 = (baset*) allocSmallString("2"); 4585 4586 ck_assert(equalOInt64G(p1, 2)); 4587 terminateO(p1); 4588 4589 } 4590 4591 4592 void equalOInt32GT(CuTest *tc UNUSED) { 4593 4594 baset* p1 = (baset*) allocSmallString("2"); 4595 4596 ck_assert(equalOInt32G(p1, 2)); 4597 terminateO(p1); 4598 4599 } 4600 4601 4602 void equalOUint32GT(CuTest *tc UNUSED) { 4603 4604 baset* p1 = (baset*) allocSmallString("2"); 4605 4606 ck_assert(equalOUint32G(p1, 2)); 4607 terminateO(p1); 4608 4609 } 4610 4611 4612 void equalOUint64GT(CuTest *tc UNUSED) { 4613 4614 baset* p1 = (baset*) allocSmallString("2"); 4615 4616 ck_assert(equalOUint64G(p1, 2)); 4617 terminateO(p1); 4618 4619 } 4620 4621 4622 void equalOSmallArrayGT(CuTest *tc UNUSED) { 4623 4624 baset* p1 = (baset*) createSA("A"); 4625 smallArrayt* p2 = createSA("A"); 4626 4627 ck_assert(equalOSmallArrayG(p1, p2)); 4628 terminateO(p2); 4629 // non smallArray object 4630 p2 = (smallArrayt*) allocSmallInt(2); 4631 ck_assert(!equalOSmallArrayG(p1, p2)); 4632 // null p2 4633 terminateO(p2); 4634 ck_assert(!equalOSmallArrayG(p1, p2)); 4635 terminateO(p1); 4636 4637 } 4638 4639 4640 void equalOSmallBoolGT(CuTest *tc UNUSED) { 4641 4642 baset* p1 = (baset*) allocSmallBool(true); 4643 smallBoolt* p2 = allocSmallBool(true); 4644 4645 ck_assert(equalOSmallBoolG(p1, p2)); 4646 // non smallBool p2 4647 terminateO(p2); 4648 p2 = (smallBoolt*) allocSmallInt(2); 4649 ck_assert(!equalOSmallBoolG(p1, p2)); 4650 // null p2 4651 ck_assert(!equalOSmallBoolG(p1, null)); 4652 terminateO(p1); 4653 terminateO(p2); 4654 4655 } 4656 4657 4658 void equalOSmallBytesGT(CuTest *tc UNUSED) { 4659 4660 baset* p1 = (baset*) allocSmallString("qwe"); 4661 smallBytest* p2 = allocSmallBytes("qwe", sizeof("qwe")); 4662 4663 ck_assert(equalOSmallBytesG(p1, p2)); 4664 // non smallBytes p2 4665 terminateO(p2); 4666 p2 = (smallBytest*) allocSmallInt(2); 4667 ck_assert(!equalOSmallBytesG(p1, p2)); 4668 // null p2 4669 ck_assert(!equalOSmallBytesG(p1, null)); 4670 terminateO(p1); 4671 terminateO(p2); 4672 4673 } 4674 4675 4676 void equalOSmallDoubleGT(CuTest *tc UNUSED) { 4677 4678 baset* p1 = (baset*) allocSmallDouble(2.2); 4679 smallDoublet* p2 = allocSmallDouble(2.2); 4680 4681 ck_assert(equalOSmallDoubleG(p1, p2)); 4682 // non smallDouble p2 4683 terminateO(p2); 4684 p2 = (smallDoublet*) allocSmallInt(2); 4685 ck_assert(!equalOSmallDoubleG(p1, p2)); 4686 // null p2 4687 ck_assert(!equalOSmallDoubleG(p1, null)); 4688 terminateO(p1); 4689 terminateO(p2); 4690 4691 } 4692 4693 4694 void equalOSmallDictGT(CuTest *tc UNUSED) { 4695 4696 smallDictt* P1 = allocSmallDict(); 4697 baset* p1 = (baset*) P1; 4698 smallDictt* p2 = allocSmallDict(); 4699 4700 P1->f->setS(P1, "qwe", "qwe"); 4701 p2->f->setS(p2, "qwe", "qwe"); 4702 ck_assert(equalOSmallDictG(p1, p2)); 4703 // non smallDict p2 4704 terminateO(p2); 4705 p2 = (smallDictt*) allocSmallInt(2); 4706 ck_assert(!equalOSmallDictG(p1, p2)); 4707 // null p2 4708 ck_assert(!equalOSmallDictG(p1, null)); 4709 terminateO(p1); 4710 terminateO(p2); 4711 4712 } 4713 4714 4715 void equalOSmallIntGT(CuTest *tc UNUSED) { 4716 4717 baset* p1 = (baset*) allocSmallInt(2); 4718 smallIntt* p2 = allocSmallInt(2); 4719 4720 ck_assert(equalOSmallIntG(p1, p2)); 4721 // non smallInt p2 4722 terminateO(p2); 4723 p2 = (smallIntt*) allocSmallBool(true); 4724 ck_assert(!equalOSmallIntG(p1, p2)); 4725 // null p2 4726 ck_assert(!equalOSmallIntG(p1, null)); 4727 terminateO(p1); 4728 terminateO(p2); 4729 4730 } 4731 4732 4733 void equalOSmallJsonGT(CuTest *tc UNUSED) { 4734 4735 baset* p1 = (baset*) allocSmallInt(2); 4736 smallJsont* p2 = allocSmallJson(); 4737 4738 setTopIntO(p2, 2); 4739 ck_assert(equalOSmallJsonG(p1, p2)); 4740 // non smallJson p2 4741 terminateO(p2); 4742 p2 = (smallJsont*) allocSmallInt(2); 4743 ck_assert(!equalOSmallJsonG(p1, p2)); 4744 // null p2 4745 ck_assert(!equalOSmallJsonG(p1, null)); 4746 terminateO(p1); 4747 terminateO(p2); 4748 4749 } 4750 4751 4752 void equalOSmallStringGT(CuTest *tc UNUSED) { 4753 4754 baset* p1 = (baset*) allocSmallString("qwe"); 4755 smallStringt* p2 = allocSmallString("qwe"); 4756 4757 ck_assert(equalOSmallStringG(p1, p2)); 4758 // non smallString p2 4759 terminateO(p2); 4760 p2 = (smallStringt*) allocSmallInt(2); 4761 ck_assert(!equalOSmallStringG(p1, p2)); 4762 // null p2 4763 ck_assert(!equalOSmallStringG(p1, null)); 4764 terminateO(p1); 4765 terminateO(p2); 4766 4767 } 4768 4769 4770 void equalBoolChaGT(CuTest *tc UNUSED) { 4771 4772 ck_assert(!equalBoolChaG(false, '0')); 4773 4774 } 4775 4776 4777 void equalBoolCharGT(CuTest *tc UNUSED) { 4778 4779 bool p1 = true; 4780 const char * p2 = "TRUE"; 4781 4782 ck_assert(equalBoolCharG(p1, p2)); 4783 p1 = false; 4784 p2 = "false"; 4785 ck_assert(equalBoolCharG(p1, p2)); 4786 // p2 is anything 4787 p2 = "qwe"; 4788 ck_assert(!equalBoolCharG(p1, p2)); 4789 // null p2 4790 ck_assert(!equalBoolCharG(p1, null)); 4791 4792 } 4793 4794 4795 void equalBoolOGT(CuTest *tc UNUSED) { 4796 4797 bool p1 = true; 4798 smallBoolt* P2 = allocSmallBool(true); 4799 baset* p2 = (baset*) P2; 4800 4801 ck_assert(equalBoolOG(p1, p2)); 4802 p1 = false; 4803 setValO(P2, false); 4804 ck_assert(equalBoolOG(p1, p2)); 4805 // p2 is anything 4806 terminateO(p2); 4807 p2 = (baset*) allocSmallString("qwe"); 4808 ck_assert(!equalBoolOG(p1, p2)); 4809 // null p2 4810 ck_assert(!equalBoolOG(p1, null)); 4811 terminateO(p2); 4812 4813 } 4814 4815 4816 void equalBoolFGT(CuTest *tc UNUSED) { 4817 4818 bool p1 = true; 4819 bool p2 = true; 4820 4821 ck_assert(equalBoolFG(p1, p2)); 4822 4823 } 4824 4825 4826 void equalBoolDoubleGT(CuTest *tc UNUSED) { 4827 4828 bool p1 = true; 4829 double p2 = 1; 4830 4831 ck_assert(equalBoolDoubleG(p1, p2)); 4832 4833 } 4834 4835 4836 void equalBoolInt64GT(CuTest *tc UNUSED) { 4837 4838 bool p1 = true; 4839 int64_t p2 = 1; 4840 4841 ck_assert(equalBoolInt64G(p1, p2)); 4842 4843 } 4844 4845 4846 void equalBoolInt32GT(CuTest *tc UNUSED) { 4847 4848 bool p1 = true; 4849 int32_t p2 = 1; 4850 4851 ck_assert(equalBoolInt32G(p1, p2)); 4852 4853 } 4854 4855 4856 void equalBoolUint32GT(CuTest *tc UNUSED) { 4857 4858 bool p1 = true; 4859 uint32_t p2 = 1; 4860 4861 ck_assert(equalBoolUint32G(p1, p2)); 4862 4863 } 4864 4865 4866 void equalBoolUint64GT(CuTest *tc UNUSED) { 4867 4868 bool p1 = true; 4869 uint64_t p2 = 1; 4870 4871 ck_assert(equalBoolUint64G(p1, p2)); 4872 4873 } 4874 4875 4876 void equalBoolSmallBoolGT(CuTest *tc UNUSED) { 4877 4878 bool p1 = true; 4879 smallBoolt* p2 = allocSmallBool(true); 4880 4881 ck_assert(equalBoolSmallBoolG(p1, p2)); 4882 // empty smallBool 4883 freeO(p2); 4884 ck_assert(!equalBoolSmallBoolG(p1, p2)); 4885 // null p2 4886 ck_assert(!equalBoolSmallBoolG(p1, null)); 4887 terminateO(p2); 4888 4889 } 4890 4891 4892 void equalBoolSmallBytesGT(CuTest *tc UNUSED) { 4893 4894 bool p1 = true; 4895 smallBytest* p2 = allocSmallBytes("TRUE", sizeof("true")); 4896 4897 ck_assert(equalBoolSmallBytesG(p1, p2)); 4898 p1 = false; 4899 terminateO(p2); 4900 p2 = allocSmallBytes("false", sizeof("false")); 4901 ck_assert(equalBoolSmallBytesG(p1, p2)); 4902 // p2 is anything 4903 terminateO(p2); 4904 p2 = allocSmallBytes("qwe", strlen("qwe")); 4905 ck_assert(!equalBoolSmallBytesG(p1, p2)); 4906 // null p2 4907 ck_assert(!equalBoolSmallBytesG(p1, null)); 4908 terminateO(p2); 4909 4910 } 4911 4912 4913 void equalBoolSmallDoubleGT(CuTest *tc UNUSED) { 4914 4915 bool p1 = true; 4916 smallDoublet* p2 = allocSmallDouble(1); 4917 4918 ck_assert(equalBoolSmallDoubleG(p1, p2)); 4919 // empty object 4920 freeO(p2); 4921 ck_assert(!equalBoolSmallDoubleG(p1, p2)); 4922 terminateO(p2); 4923 // null object 4924 ck_assert(!equalBoolSmallDoubleG(p1, p2)); 4925 4926 } 4927 4928 4929 void equalBoolSmallIntGT(CuTest *tc UNUSED) { 4930 4931 bool p1 = true; 4932 smallIntt* p2 = allocSmallInt(1); 4933 4934 ck_assert(equalBoolSmallIntG(p1, p2)); 4935 // empty object 4936 freeO(p2); 4937 ck_assert(!equalBoolSmallIntG(p1, p2)); 4938 terminateO(p2); 4939 // null object 4940 ck_assert(!equalBoolSmallIntG(p1, p2)); 4941 4942 } 4943 4944 4945 void equalBoolSmallJsonGT(CuTest *tc UNUSED) { 4946 4947 bool p1 = true; 4948 smallJsont* p2 = allocSmallJson(); 4949 4950 setTopBoolO(p2, true); 4951 ck_assert(equalBoolSmallJsonG(p1, p2)); 4952 // empty object 4953 freeO(p2); 4954 ck_assert(!equalBoolSmallJsonG(p1, p2)); 4955 terminateO(p2); 4956 // non json object 4957 p2 = (smallJsont*) allocSmallInt(2); 4958 ck_assert(!equalBoolSmallJsonG(p1, p2)); 4959 terminateO(p2); 4960 // null object 4961 ck_assert(!equalBoolSmallJsonG(p1, p2)); 4962 4963 } 4964 4965 4966 void equalBoolSmallStringGT(CuTest *tc UNUSED) { 4967 4968 bool p1 = true; 4969 smallStringt* p2 = allocSmallString("true"); 4970 4971 ck_assert(equalBoolSmallStringG(p1, p2)); 4972 p1 = false; 4973 setValO(p2, "false"); 4974 ck_assert(equalBoolSmallStringG(p1, p2)); 4975 // p2 is anything 4976 setValO(p2, "qwe"); 4977 ck_assert(!equalBoolSmallStringG(p1, p2)); 4978 // empty object 4979 freeO(p2); 4980 ck_assert(!equalBoolSmallStringG(p1, p2)); 4981 terminateO(p2); 4982 // null object 4983 ck_assert(!equalBoolSmallStringG(p1, p2)); 4984 4985 } 4986 4987 4988 void equalDoubleChaGT(CuTest *tc UNUSED) { 4989 4990 ck_assert(!equalDoubleChaG(1, '1')); 4991 4992 } 4993 4994 4995 void equalDoubleCharGT(CuTest *tc UNUSED) { 4996 4997 double p1 = 2.2; 4998 const char * p2 = "2.2"; 4999 5000 ck_assert(equalDoubleCharG(p1, p2)); 5001 p1 = 2; 5002 p2 = "2.2"; 5003 ck_assert(!equalDoubleCharG(p1, p2)); 5004 // p2 is not double 5005 p2 = "2"; 5006 ck_assert(!equalDoubleCharG(p1, p2)); 5007 // null p2 5008 ck_assert(!equalDoubleCharG(p1, null)); 5009 5010 } 5011 5012 5013 void equalDoubleBaseGT(CuTest *tc UNUSED) { 5014 5015 double p1 = 2.2; 5016 smallStringt* P2 = allocSmallString("2.2"); 5017 baset* p2 = (baset*) P2; 5018 5019 ck_assert(equalDoubleBaseG(p1, p2)); 5020 p1 = 2; 5021 setValO(P2, "2.2"); 5022 ck_assert(!equalDoubleBaseG(p1, p2)); 5023 // p2 is not double 5024 setValO(P2, "2"); 5025 ck_assert(!equalDoubleBaseG(p1, p2)); 5026 // null p2 5027 ck_assert(!equalDoubleBaseG(p1, null)); 5028 terminateO(p2); 5029 5030 } 5031 5032 5033 void equalDoubleBoolGT(CuTest *tc UNUSED) { 5034 5035 ck_assert(equalDoubleBoolG(1,true)); 5036 5037 } 5038 5039 5040 void equalDoubleFGT(CuTest *tc UNUSED) { 5041 5042 ck_assert(equalDoubleFG(2,2)); 5043 5044 } 5045 5046 5047 void equalDoubleInt64GT(CuTest *tc UNUSED) { 5048 5049 ck_assert(equalDoubleInt64G(2,2)); 5050 5051 } 5052 5053 5054 void equalDoubleInt32GT(CuTest *tc UNUSED) { 5055 5056 ck_assert(equalDoubleInt32G(2,2)); 5057 5058 } 5059 5060 5061 void equalDoubleUint32GT(CuTest *tc UNUSED) { 5062 5063 ck_assert(equalDoubleUint32G(2,2)); 5064 5065 } 5066 5067 5068 void equalDoubleUint64GT(CuTest *tc UNUSED) { 5069 5070 ck_assert(equalDoubleUint64G(2,2)); 5071 5072 } 5073 5074 5075 void equalDoubleSmallBoolGT(CuTest *tc UNUSED) { 5076 5077 double p1 = 1; 5078 smallBoolt* p2 = allocSmallBool(true); 5079 5080 ck_assert(equalDoubleSmallBoolG(p1, p2)); 5081 // empty smallBool 5082 freeO(p2); 5083 ck_assert(!equalDoubleSmallBoolG(p1, p2)); 5084 // null p2 5085 ck_assert(!equalDoubleSmallBoolG(p1, null)); 5086 terminateO(p2); 5087 5088 } 5089 5090 5091 void equalDoubleSmallBytesGT(CuTest *tc UNUSED) { 5092 5093 double p1 = 2.2; 5094 smallBytest* p2 = allocSmallBytes("2.2", sizeof("2.2")); 5095 5096 ck_assert(equalDoubleSmallBytesG(p1, p2)); 5097 // p2 not double 5098 p1 = 2; 5099 terminateO(p2); 5100 p2 = allocSmallBytes("2", sizeof("2")); 5101 ck_assert(!equalDoubleSmallBytesG(p1, p2)); 5102 // p2 is anything 5103 terminateO(p2); 5104 p2 = allocSmallBytes("qwe", strlen("qwe")); 5105 ck_assert(!equalDoubleSmallBytesG(p1, p2)); 5106 // empty p2 5107 freeO(p2); 5108 ck_assert(!equalDoubleSmallBytesG(p1, p2)); 5109 // null p2 5110 ck_assert(!equalDoubleSmallBytesG(p1, null)); 5111 terminateO(p2); 5112 5113 } 5114 5115 5116 void equalDoubleSmallDoubleGT(CuTest *tc UNUSED) { 5117 5118 double p1 = 2.2; 5119 smallDoublet* p2 = allocSmallDouble(2.2); 5120 5121 ck_assert(equalDoubleSmallDoubleG(p1, p2)); 5122 // empty object 5123 freeO(p2); 5124 ck_assert(!equalDoubleSmallDoubleG(p1, p2)); 5125 terminateO(p2); 5126 // null object 5127 ck_assert(!equalDoubleSmallDoubleG(p1, p2)); 5128 5129 } 5130 5131 5132 void equalDoubleSmallIntGT(CuTest *tc UNUSED) { 5133 5134 double p1 = 2; 5135 smallIntt* p2 = allocSmallInt(2); 5136 5137 ck_assert(equalDoubleSmallIntG(p1, p2)); 5138 // empty object 5139 freeO(p2); 5140 ck_assert(!equalDoubleSmallIntG(p1, p2)); 5141 terminateO(p2); 5142 // null object 5143 ck_assert(!equalDoubleSmallIntG(p1, p2)); 5144 5145 } 5146 5147 5148 void equalDoubleSmallJsonGT(CuTest *tc UNUSED) { 5149 5150 double p1 = 2.2; 5151 smallJsont* p2 = allocSmallJson(); 5152 5153 setTopDoubleO(p2, 2.2); 5154 ck_assert(equalDoubleSmallJsonG(p1, p2)); 5155 // empty object 5156 freeO(p2); 5157 ck_assert(!equalDoubleSmallJsonG(p1, p2)); 5158 terminateO(p2); 5159 // non json object 5160 p2 = (smallJsont*) allocSmallInt(2); 5161 ck_assert(!equalDoubleSmallJsonG(p1, p2)); 5162 terminateO(p2); 5163 // null object 5164 ck_assert(!equalDoubleSmallJsonG(p1, p2)); 5165 5166 } 5167 5168 5169 void equalDoubleSmallStringGT(CuTest *tc UNUSED) { 5170 5171 double p1 = 2.2; 5172 smallStringt* p2 = allocSmallString("2.2"); 5173 5174 ck_assert(equalDoubleSmallStringG(p1, p2)); 5175 // p2 is anything 5176 setValO(p2, "qwe"); 5177 ck_assert(!equalDoubleSmallStringG(p1, p2)); 5178 // empty object 5179 freeO(p2); 5180 ck_assert(!equalDoubleSmallStringG(p1, p2)); 5181 terminateO(p2); 5182 // null object 5183 ck_assert(!equalDoubleSmallStringG(p1, p2)); 5184 5185 } 5186 5187 5188 void equalInt64ChaGT(CuTest *tc UNUSED) { 5189 5190 ck_assert(equalInt64ChaG(2,'2')); 5191 5192 } 5193 5194 5195 void equalInt64CharGT(CuTest *tc UNUSED) { 5196 5197 ck_assert(equalInt64CharG(2, "2")); 5198 ck_assert(!equalInt64CharG(2, "qwe")); 5199 ck_assert(!equalInt64CharG(2, null)); 5200 5201 } 5202 5203 5204 void equalInt64BaseGT(CuTest *tc UNUSED) { 5205 5206 smallStringt* P2 = allocSmallString("2"); 5207 baset* p2 = (baset*) P2; 5208 5209 ck_assert(equalInt64BaseG(2, p2)); 5210 ck_assert(!equalInt64BaseG(1, p2)); 5211 setValO(P2, "qwe"); 5212 ck_assert(!equalInt64BaseG(2, p2)); 5213 ck_assert(!equalInt64BaseG(2, null)); 5214 terminateO(p2); 5215 5216 } 5217 5218 5219 void equalInt64BoolGT(CuTest *tc UNUSED) { 5220 5221 ck_assert(equalInt64BoolG(1, true)); 5222 5223 } 5224 5225 5226 void equalInt64DoubleGT(CuTest *tc UNUSED) { 5227 5228 ck_assert(equalInt64DoubleG(2, 2)); 5229 5230 } 5231 5232 5233 void equalInt64FGT(CuTest *tc UNUSED) { 5234 5235 ck_assert(equalInt64FG(2,2)); 5236 5237 } 5238 5239 5240 void equalInt64Int32GT(CuTest *tc UNUSED) { 5241 5242 ck_assert(equalInt64Int32G(2,2)); 5243 5244 } 5245 5246 5247 void equalInt64Uint32GT(CuTest *tc UNUSED) { 5248 5249 ck_assert(equalInt64Uint32G(2,2)); 5250 5251 } 5252 5253 5254 void equalInt64Uint64GT(CuTest *tc UNUSED) { 5255 5256 ck_assert(equalInt64Uint64G(2,2)); 5257 5258 } 5259 5260 5261 void equalInt64SmallBoolGT(CuTest *tc UNUSED) { 5262 5263 int64_t p1 = 1; 5264 smallBoolt* p2 = allocSmallBool(true); 5265 5266 ck_assert(equalInt64SmallBoolG(p1, p2)); 5267 // empty smallBool 5268 freeO(p2); 5269 ck_assert(!equalInt64SmallBoolG(p1, p2)); 5270 // null p2 5271 ck_assert(!equalInt64SmallBoolG(p1, null)); 5272 terminateO(p2); 5273 5274 } 5275 5276 5277 void equalInt64SmallBytesGT(CuTest *tc UNUSED) { 5278 5279 int64_t p1 = 2; 5280 smallBytest* p2 = allocSmallBytes("2", sizeof("2")); 5281 5282 ck_assert(equalInt64SmallBytesG(p1, p2)); 5283 // p2 not int 5284 terminateO(p2); 5285 p2 = allocSmallBytes("qwe", sizeof("qwe")); 5286 ck_assert(!equalInt64SmallBytesG(p1, p2)); 5287 // p2 is anything without 0 ending 5288 terminateO(p2); 5289 p2 = allocSmallBytes("qwe", strlen("qwe")); 5290 ck_assert(!equalInt64SmallBytesG(p1, p2)); 5291 // empty p2 5292 freeO(p2); 5293 ck_assert(!equalInt64SmallBytesG(p1, p2)); 5294 // null p2 5295 ck_assert(!equalInt64SmallBytesG(p1, null)); 5296 terminateO(p2); 5297 5298 } 5299 5300 5301 void equalInt64SmallDoubleGT(CuTest *tc UNUSED) { 5302 5303 int64_t p1 = 2; 5304 smallDoublet* p2 = allocSmallDouble(2); 5305 5306 ck_assert(equalInt64SmallDoubleG(p1, p2)); 5307 // empty object 5308 freeO(p2); 5309 ck_assert(!equalInt64SmallDoubleG(p1, p2)); 5310 terminateO(p2); 5311 // null object 5312 ck_assert(!equalInt64SmallDoubleG(p1, p2)); 5313 5314 } 5315 5316 5317 void equalInt64SmallIntGT(CuTest *tc UNUSED) { 5318 5319 int64_t p1 = 2; 5320 smallIntt* p2 = allocSmallInt(2); 5321 5322 ck_assert(equalInt64SmallIntG(p1, p2)); 5323 // empty object 5324 freeO(p2); 5325 ck_assert(!equalInt64SmallIntG(p1, p2)); 5326 terminateO(p2); 5327 // null object 5328 ck_assert(!equalInt64SmallIntG(p1, p2)); 5329 5330 } 5331 5332 5333 void equalInt64SmallJsonGT(CuTest *tc UNUSED) { 5334 5335 int64_t p1 = 2; 5336 smallJsont* p2 = allocSmallJson(); 5337 5338 setTopIntO(p2, 2); 5339 ck_assert(equalInt64SmallJsonG(p1, p2)); 5340 // empty object 5341 freeO(p2); 5342 ck_assert(!equalInt64SmallJsonG(p1, p2)); 5343 terminateO(p2); 5344 // non json object 5345 p2 = (smallJsont*) allocSmallInt(2); 5346 ck_assert(!equalInt64SmallJsonG(p1, p2)); 5347 terminateO(p2); 5348 // null object 5349 ck_assert(!equalInt64SmallJsonG(p1, p2)); 5350 5351 } 5352 5353 5354 void equalInt64SmallStringGT(CuTest *tc UNUSED) { 5355 5356 int64_t p1 = 2; 5357 smallStringt* p2 = allocSmallString("2"); 5358 5359 ck_assert(equalInt64SmallStringG(p1, p2)); 5360 // p2 is anything 5361 setValO(p2, "qwe"); 5362 ck_assert(!equalInt64SmallStringG(p1, p2)); 5363 // empty object 5364 freeO(p2); 5365 ck_assert(!equalInt64SmallStringG(p1, p2)); 5366 terminateO(p2); 5367 // null object 5368 ck_assert(!equalInt64SmallStringG(p1, p2)); 5369 5370 } 5371 5372 5373 void equalInt32ChaGT(CuTest *tc UNUSED) { 5374 5375 ck_assert(equalInt32ChaG(2,'2')); 5376 5377 } 5378 5379 5380 void equalInt32CharGT(CuTest *tc UNUSED) { 5381 5382 ck_assert(equalInt32CharG(2, "2")); 5383 ck_assert(!equalInt32CharG(2, "qwe")); 5384 ck_assert(!equalInt32CharG(2, null)); 5385 5386 } 5387 5388 5389 void equalInt32BaseGT(CuTest *tc UNUSED) { 5390 5391 smallStringt* P2 = allocSmallString("2"); 5392 baset* p2 = (baset*) P2; 5393 5394 ck_assert(equalInt32BaseG(2, p2)); 5395 ck_assert(!equalInt32BaseG(1, p2)); 5396 setValO(P2, "qwe"); 5397 ck_assert(!equalInt32BaseG(2, p2)); 5398 ck_assert(!equalInt32BaseG(2, null)); 5399 terminateO(p2); 5400 5401 } 5402 5403 5404 void equalInt32BoolGT(CuTest *tc UNUSED) { 5405 5406 ck_assert(equalInt32BoolG(1, true)); 5407 5408 } 5409 5410 5411 void equalInt32DoubleGT(CuTest *tc UNUSED) { 5412 5413 ck_assert(equalInt32DoubleG(2, 2)); 5414 5415 } 5416 5417 5418 void equalInt32Int64GT(CuTest *tc UNUSED) { 5419 5420 ck_assert(equalInt32Int64G(2,2)); 5421 5422 } 5423 5424 5425 void equalInt32FGT(CuTest *tc UNUSED) { 5426 5427 ck_assert(equalInt32FG(2,2)); 5428 5429 } 5430 5431 5432 void equalInt32Uint32GT(CuTest *tc UNUSED) { 5433 5434 ck_assert(equalInt32Uint32G(2,2)); 5435 5436 } 5437 5438 5439 void equalInt32Uint64GT(CuTest *tc UNUSED) { 5440 5441 ck_assert(equalInt32Uint64G(2,2)); 5442 5443 } 5444 5445 5446 void equalInt32SmallBoolGT(CuTest *tc UNUSED) { 5447 5448 int32_t p1 = 1; 5449 smallBoolt* p2 = allocSmallBool(true); 5450 5451 ck_assert(equalInt32SmallBoolG(p1, p2)); 5452 // empty smallBool 5453 freeO(p2); 5454 ck_assert(!equalInt32SmallBoolG(p1, p2)); 5455 // null p2 5456 ck_assert(!equalInt32SmallBoolG(p1, null)); 5457 terminateO(p2); 5458 5459 } 5460 5461 5462 void equalInt32SmallBytesGT(CuTest *tc UNUSED) { 5463 5464 int32_t p1 = 2; 5465 smallBytest* p2 = allocSmallBytes("2", sizeof("2")); 5466 5467 ck_assert(equalInt32SmallBytesG(p1, p2)); 5468 // p2 not int 5469 terminateO(p2); 5470 p2 = allocSmallBytes("qwe", sizeof("qwe")); 5471 ck_assert(!equalInt32SmallBytesG(p1, p2)); 5472 // p2 is anything without 0 ending 5473 terminateO(p2); 5474 p2 = allocSmallBytes("qwe", strlen("qwe")); 5475 ck_assert(!equalInt32SmallBytesG(p1, p2)); 5476 // empty p2 5477 freeO(p2); 5478 ck_assert(!equalInt32SmallBytesG(p1, p2)); 5479 // null p2 5480 ck_assert(!equalInt32SmallBytesG(p1, null)); 5481 terminateO(p2); 5482 5483 } 5484 5485 5486 void equalInt32SmallDoubleGT(CuTest *tc UNUSED) { 5487 5488 int32_t p1 = 2; 5489 smallDoublet* p2 = allocSmallDouble(2); 5490 5491 ck_assert(equalInt32SmallDoubleG(p1, p2)); 5492 // empty object 5493 freeO(p2); 5494 ck_assert(!equalInt32SmallDoubleG(p1, p2)); 5495 terminateO(p2); 5496 // null object 5497 ck_assert(!equalInt32SmallDoubleG(p1, p2)); 5498 5499 } 5500 5501 5502 void equalInt32SmallIntGT(CuTest *tc UNUSED) { 5503 5504 int32_t p1 = 2; 5505 smallIntt* p2 = allocSmallInt(2); 5506 5507 ck_assert(equalInt32SmallIntG(p1, p2)); 5508 // empty object 5509 freeO(p2); 5510 ck_assert(!equalInt32SmallIntG(p1, p2)); 5511 terminateO(p2); 5512 // null object 5513 ck_assert(!equalInt32SmallIntG(p1, p2)); 5514 5515 } 5516 5517 5518 void equalInt32SmallJsonGT(CuTest *tc UNUSED) { 5519 5520 int32_t p1 = 2; 5521 smallJsont* p2 = allocSmallJson(); 5522 5523 setTopIntO(p2, 2); 5524 ck_assert(equalInt32SmallJsonG(p1, p2)); 5525 // empty object 5526 freeO(p2); 5527 ck_assert(!equalInt32SmallJsonG(p1, p2)); 5528 terminateO(p2); 5529 // non json object 5530 p2 = (smallJsont*) allocSmallInt(2); 5531 ck_assert(!equalInt32SmallJsonG(p1, p2)); 5532 terminateO(p2); 5533 // null object 5534 ck_assert(!equalInt32SmallJsonG(p1, p2)); 5535 5536 } 5537 5538 5539 void equalInt32SmallStringGT(CuTest *tc UNUSED) { 5540 5541 int32_t p1 = 2; 5542 smallStringt* p2 = allocSmallString("2"); 5543 5544 ck_assert(equalInt32SmallStringG(p1, p2)); 5545 // p2 is anything 5546 setValO(p2, "qwe"); 5547 ck_assert(!equalInt32SmallStringG(p1, p2)); 5548 // empty object 5549 freeO(p2); 5550 ck_assert(!equalInt32SmallStringG(p1, p2)); 5551 terminateO(p2); 5552 // null object 5553 ck_assert(!equalInt32SmallStringG(p1, p2)); 5554 5555 } 5556 5557 5558 void equalUint32ChaGT(CuTest *tc UNUSED) { 5559 5560 ck_assert(equalUint32ChaG(2,'2')); 5561 5562 } 5563 5564 5565 void equalUint32CharGT(CuTest *tc UNUSED) { 5566 5567 ck_assert(equalUint32CharG(2, "2")); 5568 ck_assert(!equalUint32CharG(2, "qwe")); 5569 ck_assert(!equalUint32CharG(2, null)); 5570 5571 } 5572 5573 5574 void equalUint32BaseGT(CuTest *tc UNUSED) { 5575 5576 smallStringt* P2 = allocSmallString("2"); 5577 baset* p2 = (baset*) P2; 5578 5579 ck_assert(equalUint32BaseG(2, p2)); 5580 ck_assert(!equalUint32BaseG(1, p2)); 5581 setValO(P2, "qwe"); 5582 ck_assert(!equalUint32BaseG(2, p2)); 5583 ck_assert(!equalUint32BaseG(2, null)); 5584 terminateO(p2); 5585 5586 } 5587 5588 5589 void equalUint32BoolGT(CuTest *tc UNUSED) { 5590 5591 ck_assert(equalUint32BoolG(1, true)); 5592 5593 } 5594 5595 5596 void equalUint32DoubleGT(CuTest *tc UNUSED) { 5597 5598 ck_assert(equalUint32DoubleG(2, 2)); 5599 5600 } 5601 5602 5603 void equalUint32Int64GT(CuTest *tc UNUSED) { 5604 5605 ck_assert(equalUint32Int64G(2,2)); 5606 5607 } 5608 5609 5610 void equalUint32Int32GT(CuTest *tc UNUSED) { 5611 5612 ck_assert(equalUint32Int32G(2,2)); 5613 5614 } 5615 5616 5617 void equalUint32FGT(CuTest *tc UNUSED) { 5618 5619 ck_assert(equalUint32FG(2,2)); 5620 5621 } 5622 5623 5624 void equalUint32Uint64GT(CuTest *tc UNUSED) { 5625 5626 ck_assert(equalUint32Uint64G(2,2)); 5627 5628 } 5629 5630 5631 void equalUint32SmallBoolGT(CuTest *tc UNUSED) { 5632 5633 uint32_t p1 = 1; 5634 smallBoolt* p2 = allocSmallBool(true); 5635 5636 ck_assert(equalUint32SmallBoolG(p1, p2)); 5637 // empty smallBool 5638 freeO(p2); 5639 ck_assert(!equalUint32SmallBoolG(p1, p2)); 5640 // null p2 5641 ck_assert(!equalUint32SmallBoolG(p1, null)); 5642 terminateO(p2); 5643 5644 } 5645 5646 5647 void equalUint32SmallBytesGT(CuTest *tc UNUSED) { 5648 5649 uint32_t p1 = 2; 5650 smallBytest* p2 = allocSmallBytes("2", sizeof("2")); 5651 5652 ck_assert(equalUint32SmallBytesG(p1, p2)); 5653 // p2 not int 5654 terminateO(p2); 5655 p2 = allocSmallBytes("qwe", sizeof("qwe")); 5656 ck_assert(!equalUint32SmallBytesG(p1, p2)); 5657 // p2 is anything without 0 ending 5658 terminateO(p2); 5659 p2 = allocSmallBytes("qwe", strlen("qwe")); 5660 ck_assert(!equalUint32SmallBytesG(p1, p2)); 5661 // empty p2 5662 freeO(p2); 5663 ck_assert(!equalUint32SmallBytesG(p1, p2)); 5664 // null p2 5665 ck_assert(!equalUint32SmallBytesG(p1, null)); 5666 terminateO(p2); 5667 5668 } 5669 5670 5671 void equalUint32SmallDoubleGT(CuTest *tc UNUSED) { 5672 5673 uint32_t p1 = 2; 5674 smallDoublet* p2 = allocSmallDouble(2); 5675 5676 ck_assert(equalUint32SmallDoubleG(p1, p2)); 5677 // empty object 5678 freeO(p2); 5679 ck_assert(!equalUint32SmallDoubleG(p1, p2)); 5680 terminateO(p2); 5681 // null object 5682 ck_assert(!equalUint32SmallDoubleG(p1, p2)); 5683 5684 } 5685 5686 5687 void equalUint32SmallIntGT(CuTest *tc UNUSED) { 5688 5689 uint32_t p1 = 2; 5690 smallIntt* p2 = allocSmallInt(2); 5691 5692 ck_assert(equalUint32SmallIntG(p1, p2)); 5693 // empty object 5694 freeO(p2); 5695 ck_assert(!equalUint32SmallIntG(p1, p2)); 5696 terminateO(p2); 5697 // null object 5698 ck_assert(!equalUint32SmallIntG(p1, p2)); 5699 5700 } 5701 5702 5703 void equalUint32SmallJsonGT(CuTest *tc UNUSED) { 5704 5705 uint32_t p1 = 2; 5706 smallJsont* p2 = allocSmallJson(); 5707 5708 setTopIntO(p2, 2); 5709 ck_assert(equalUint32SmallJsonG(p1, p2)); 5710 // empty object 5711 freeO(p2); 5712 ck_assert(!equalUint32SmallJsonG(p1, p2)); 5713 terminateO(p2); 5714 // non json object 5715 p2 = (smallJsont*) allocSmallInt(2); 5716 ck_assert(!equalUint32SmallJsonG(p1, p2)); 5717 terminateO(p2); 5718 // null object 5719 ck_assert(!equalUint32SmallJsonG(p1, p2)); 5720 5721 } 5722 5723 5724 void equalUint32SmallStringGT(CuTest *tc UNUSED) { 5725 5726 uint32_t p1 = 2; 5727 smallStringt* p2 = allocSmallString("2"); 5728 5729 ck_assert(equalUint32SmallStringG(p1, p2)); 5730 // p2 is anything 5731 setValO(p2, "qwe"); 5732 ck_assert(!equalUint32SmallStringG(p1, p2)); 5733 // empty object 5734 freeO(p2); 5735 ck_assert(!equalUint32SmallStringG(p1, p2)); 5736 terminateO(p2); 5737 // null object 5738 ck_assert(!equalUint32SmallStringG(p1, p2)); 5739 5740 } 5741 5742 5743 void equalUint64ChaGT(CuTest *tc UNUSED) { 5744 5745 ck_assert(equalUint64ChaG(2,'2')); 5746 5747 } 5748 5749 5750 void equalUint64CharGT(CuTest *tc UNUSED) { 5751 5752 ck_assert(equalUint64CharG(2, "2")); 5753 ck_assert(!equalUint64CharG(2, "qwe")); 5754 ck_assert(!equalUint64CharG(2, null)); 5755 5756 } 5757 5758 5759 void equalUint64BaseGT(CuTest *tc UNUSED) { 5760 5761 smallStringt* P2 = allocSmallString("2"); 5762 baset* p2 = (baset*) P2; 5763 5764 ck_assert(equalUint64BaseG(2, p2)); 5765 ck_assert(!equalUint64BaseG(1, p2)); 5766 setValO(P2, "qwe"); 5767 ck_assert(!equalUint64BaseG(2, p2)); 5768 ck_assert(!equalUint64BaseG(2, null)); 5769 terminateO(p2); 5770 5771 } 5772 5773 5774 void equalUint64BoolGT(CuTest *tc UNUSED) { 5775 5776 ck_assert(equalUint64BoolG(1, true)); 5777 5778 } 5779 5780 5781 void equalUint64DoubleGT(CuTest *tc UNUSED) { 5782 5783 ck_assert(equalUint64DoubleG(2, 2)); 5784 5785 } 5786 5787 5788 void equalUint64Int64GT(CuTest *tc UNUSED) { 5789 5790 ck_assert(equalUint64Int64G(2,2)); 5791 5792 } 5793 5794 5795 void equalUint64Int32GT(CuTest *tc UNUSED) { 5796 5797 ck_assert(equalUint64Int32G(2,2)); 5798 5799 } 5800 5801 5802 void equalUint64Uint32GT(CuTest *tc UNUSED) { 5803 5804 ck_assert(equalUint64Uint32G(2,2)); 5805 5806 } 5807 5808 5809 void equalUint64FGT(CuTest *tc UNUSED) { 5810 5811 ck_assert(equalUint64FG(2,2)); 5812 5813 } 5814 5815 5816 void equalUint64SmallBoolGT(CuTest *tc UNUSED) { 5817 5818 uint64_t p1 = 1; 5819 smallBoolt* p2 = allocSmallBool(true); 5820 5821 ck_assert(equalUint64SmallBoolG(p1, p2)); 5822 // empty smallBool 5823 freeO(p2); 5824 ck_assert(!equalUint64SmallBoolG(p1, p2)); 5825 // null p2 5826 ck_assert(!equalUint64SmallBoolG(p1, null)); 5827 terminateO(p2); 5828 5829 } 5830 5831 5832 void equalUint64SmallBytesGT(CuTest *tc UNUSED) { 5833 5834 uint64_t p1 = 2; 5835 smallBytest* p2 = allocSmallBytes("2", sizeof("2")); 5836 5837 ck_assert(equalUint64SmallBytesG(p1, p2)); 5838 // p2 not int 5839 terminateO(p2); 5840 p2 = allocSmallBytes("qwe", sizeof("qwe")); 5841 ck_assert(!equalUint64SmallBytesG(p1, p2)); 5842 // p2 is anything without 0 ending 5843 terminateO(p2); 5844 p2 = allocSmallBytes("qwe", strlen("qwe")); 5845 ck_assert(!equalUint64SmallBytesG(p1, p2)); 5846 // empty p2 5847 freeO(p2); 5848 ck_assert(!equalUint64SmallBytesG(p1, p2)); 5849 // null p2 5850 ck_assert(!equalUint64SmallBytesG(p1, null)); 5851 terminateO(p2); 5852 5853 } 5854 5855 5856 void equalUint64SmallDoubleGT(CuTest *tc UNUSED) { 5857 5858 uint64_t p1 = 2; 5859 smallDoublet* p2 = allocSmallDouble(2); 5860 5861 ck_assert(equalUint64SmallDoubleG(p1, p2)); 5862 // empty object 5863 freeO(p2); 5864 ck_assert(!equalUint64SmallDoubleG(p1, p2)); 5865 terminateO(p2); 5866 // null object 5867 ck_assert(!equalUint64SmallDoubleG(p1, p2)); 5868 5869 } 5870 5871 5872 void equalUint64SmallIntGT(CuTest *tc UNUSED) { 5873 5874 uint64_t p1 = 2; 5875 smallIntt* p2 = allocSmallInt(2); 5876 5877 ck_assert(equalUint64SmallIntG(p1, p2)); 5878 // empty object 5879 freeO(p2); 5880 ck_assert(!equalUint64SmallIntG(p1, p2)); 5881 terminateO(p2); 5882 // null object 5883 ck_assert(!equalUint64SmallIntG(p1, p2)); 5884 5885 } 5886 5887 5888 void equalUint64SmallJsonGT(CuTest *tc UNUSED) { 5889 5890 uint64_t p1 = 2; 5891 smallJsont* p2 = allocSmallJson(); 5892 5893 setTopIntO(p2, 2); 5894 ck_assert(equalUint64SmallJsonG(p1, p2)); 5895 // empty object 5896 freeO(p2); 5897 ck_assert(!equalUint64SmallJsonG(p1, p2)); 5898 terminateO(p2); 5899 // non json object 5900 p2 = (smallJsont*) allocSmallInt(2); 5901 ck_assert(!equalUint64SmallJsonG(p1, p2)); 5902 terminateO(p2); 5903 // null object 5904 ck_assert(!equalUint64SmallJsonG(p1, p2)); 5905 5906 } 5907 5908 5909 void equalUint64SmallStringGT(CuTest *tc UNUSED) { 5910 5911 uint64_t p1 = 2; 5912 smallStringt* p2 = allocSmallString("2"); 5913 5914 ck_assert(equalUint64SmallStringG(p1, p2)); 5915 // p2 is anything 5916 setValO(p2, "qwe"); 5917 ck_assert(!equalUint64SmallStringG(p1, p2)); 5918 // empty object 5919 freeO(p2); 5920 ck_assert(!equalUint64SmallStringG(p1, p2)); 5921 terminateO(p2); 5922 // null object 5923 ck_assert(!equalUint64SmallStringG(p1, p2)); 5924 5925 } 5926 5927 5928 void notEqualCharGT(CuTest *tc UNUSED) { 5929 5930 ck_assert(!notEqualCharG('0', null)); 5931 5932 } 5933 5934 5935 void notEqualOCharGT(CuTest *tc UNUSED) { 5936 5937 ck_assert(!notEqualOCharG(null, '1')); 5938 5939 } 5940 5941 5942 void notEqualOGT(CuTest *tc UNUSED) { 5943 5944 ck_assert(!notEqualOG(null, null)); 5945 5946 } 5947 5948 5949 void notEqualCCOGT(CuTest *tc UNUSED) { 5950 5951 ck_assert(!notEqualCCOG("","")); 5952 5953 } 5954 5955 5956 void notEqualBoolOGT(CuTest *tc UNUSED) { 5957 5958 ck_assert(!notEqualBoolOG(true,"")); 5959 5960 } 5961 5962 5963 void notEqualDoubleOGT(CuTest *tc UNUSED) { 5964 5965 ck_assert(!notEqualDoubleOG(2.2,"")); 5966 5967 } 5968 5969 5970 void notEqualInt64OGT(CuTest *tc UNUSED) { 5971 5972 ck_assert(!notEqualInt64OG(2,"2")); 5973 5974 } 5975 5976 5977 void notEqualInt32OGT(CuTest *tc UNUSED) { 5978 5979 ck_assert(!notEqualInt32OG(2,"")); 5980 5981 } 5982 5983 5984 void notEqualUint32OGT(CuTest *tc UNUSED) { 5985 5986 ck_assert(!notEqualUint32OG(2,"2")); 5987 5988 } 5989 5990 5991 void notEqualUint64OGT(CuTest *tc UNUSED) { 5992 5993 ck_assert(!notEqualUint64OG(2,null)); 5994 5995 } 5996 5997 5998 void notEqualOBoolGT(CuTest *tc UNUSED) { 5999 6000 ck_assert(!notEqualOBoolG("",true)); 6001 6002 } 6003 6004 6005 void notEqualDoubleGT(CuTest *tc UNUSED) { 6006 6007 ck_assert(!notEqualDoubleG("",1.1)); 6008 6009 } 6010 6011 6012 void notEqualOInt64GT(CuTest *tc UNUSED) { 6013 6014 ck_assert(!notEqualOInt64G("",0)); 6015 6016 } 6017 6018 6019 void notEqualOInt32GT(CuTest *tc UNUSED) { 6020 6021 ck_assert(!notEqualOInt32G(null,0)); 6022 6023 } 6024 6025 6026 void notEqualOUint32GT(CuTest *tc UNUSED) { 6027 6028 ck_assert(!notEqualOUint32G("",0)); 6029 6030 } 6031 6032 6033 void notEqualOUint64GT(CuTest *tc UNUSED) { 6034 6035 ck_assert(!notEqualOUint64G("",0)); 6036 6037 } 6038 6039 6040 void icEqCharCharT(CuTest *tc UNUSED) { 6041 6042 ck_assert(icEqCharChar('a', 'A')); 6043 6044 } 6045 6046 6047 void icEqualChaOGT(CuTest *tc UNUSED) { 6048 6049 baset* value = (baset*) allocSmallString("A"); 6050 6051 ck_assert(icEqualChaOG('a', value)); 6052 terminateO(value); 6053 6054 } 6055 6056 6057 void icEqualChaSmallJsonGT(CuTest *tc UNUSED) { 6058 6059 smallJsont* value = allocSmallJson(); 6060 6061 setTopStringO(value, "A"); 6062 ck_assert(icEqualChaSmallJsonG('a', value)); 6063 // non json string 6064 freeO(value); 6065 setTopIntO(value, 2); 6066 ck_assert(!icEqualChaSmallJsonG('a', value)); 6067 // non json object 6068 terminateO(value); 6069 value = (smallJsont*) allocSmallInt(0); 6070 ck_assert(!icEqualChaSmallJsonG('a', value)); 6071 terminateO(value); 6072 ck_assert(!icEqualChaSmallJsonG('a', value)); 6073 6074 } 6075 6076 6077 void icEqualChaSmallStringGT(CuTest *tc UNUSED) { 6078 6079 smallStringt* value = allocSmallString("A"); 6080 6081 ck_assert(icEqualChaSmallStringG('a', value)); 6082 freeO(value); 6083 ck_assert(!icEqualChaSmallStringG('a', value)); 6084 terminateO(value); 6085 ck_assert(!icEqualChaSmallStringG('a', value)); 6086 6087 } 6088 6089 6090 void icEqualCharOGT(CuTest *tc UNUSED) { 6091 6092 baset* value = (baset*) allocSmallString("A"); 6093 6094 ck_assert(icEqualCharOG("a", value)); 6095 ck_assert(!icEqualCharOG(null, value)); 6096 terminateO(value); 6097 ck_assert(!icEqualCharOG("a", value)); 6098 6099 } 6100 6101 6102 void icEqualCharPSmallJsonGT(CuTest *tc UNUSED) { 6103 6104 smallJsont* value = allocSmallJson(); 6105 6106 setTopStringO(value, "QWE"); 6107 ck_assert(icEqualCharPSmallJsonG("qwe", value)); 6108 // non json string 6109 freeO(value); 6110 setTopIntO(value, 2); 6111 ck_assert(!icEqualCharPSmallJsonG("2", value)); 6112 // non json object 6113 terminateO(value); 6114 value = (smallJsont*) allocSmallInt(2); 6115 ck_assert(!icEqualCharPSmallJsonG("2", value)); 6116 terminateO(value); 6117 ck_assert(!icEqualCharPSmallJsonG("qwe", value)); 6118 6119 } 6120 6121 6122 void icEqualCharPSmallStringGT(CuTest *tc UNUSED) { 6123 6124 smallStringt* value = allocSmallString("QWE"); 6125 6126 ck_assert(icEqualCharPSmallStringG("qwe", value)); 6127 terminateO(value); 6128 ck_assert(!icEqualCharPSmallStringG("qwe", value)); 6129 6130 } 6131 6132 6133 void icEqualArrayOGT(CuTest *tc UNUSED) { 6134 6135 char ** p1 = listCreateS("A", "bb"); 6136 smallArrayt* a = createSA("A", "BB"); 6137 baset* p2 = (baset*)a; 6138 6139 ck_assert(icEqualArrayOG(p1, p2)); 6140 free(p1[1]); 6141 p1[1] = strdup("qwe"); 6142 ck_assert(!icEqualArrayOG(p1, p2)); 6143 // array with deleted elements 6144 a->f->pushS(a, "BB"); 6145 delElemO(a, 1); 6146 ck_assert(!icEqualArrayOG(p1, p2)); 6147 trimO(a); 6148 // p1 empty 6149 forEachS(p1, e) free(e); 6150 p1[0] = null; 6151 ck_assert(!icEqualArrayOG(p1, p2)); 6152 // p2 empty 6153 listPushS(&p1, "A"); 6154 listPushS(&p1, "BB"); 6155 emptyO(a); 6156 ck_assert(!icEqualArrayOG(p1, p2)); 6157 // non smallArray object 6158 terminateO(p2); 6159 p2 = (baset*) allocSmallInt(2); 6160 ck_assert(!icEqualArrayOG(p1, p2)); 6161 // null parameters 6162 ck_assert(!icEqualArrayOG(null, p2)); 6163 ck_assert(!icEqualArrayOG(p1, null)); 6164 terminateO(p2); 6165 listFreeS(p1); 6166 6167 } 6168 6169 6170 void icEqualCArrayOGT(CuTest *tc UNUSED) { 6171 6172 const char *p1[] = {"A", "qwe", null}; 6173 smallArrayt* a = createSA("A", "BB"); 6174 baset* p2 = (baset*)a; 6175 6176 ck_assert(!icEqualCArrayOG(p1, p2)); 6177 p1[1] = "bb"; 6178 ck_assert(icEqualCArrayOG(p1, p2)); 6179 terminateO(p2); 6180 6181 } 6182 6183 6184 void icEqualArraySmallJsonGT(CuTest *tc UNUSED) { 6185 6186 char ** p1 = listCreateS("A", "qwe"); 6187 smallJsont* p2 = createSJ("A", "BB"); 6188 6189 ck_assert(!icEqualArraySmallJsonG(p1, p2)); 6190 listSetS(p1, 1, "bb"); 6191 ck_assert(icEqualArraySmallJsonG(p1, p2)); 6192 // array with deleted elements 6193 p2->f->pushS(p2, "BB"); 6194 delElemIndexO(p2, 1); 6195 ck_assert(!icEqualArraySmallJsonG(p1, p2)); 6196 trimO(p2); 6197 // p1 empty 6198 forEachS(p1, e) free(e); 6199 p1[0] = null; 6200 ck_assert(!icEqualArraySmallJsonG(p1, p2)); 6201 // p2 empty 6202 listPushS(&p1, "A"); 6203 listPushS(&p1, "BB"); 6204 emptyO(p2); 6205 ck_assert(!icEqualArraySmallJsonG(p1, p2)); 6206 // non json array 6207 freeO(p2); 6208 setTopIntO(p2, 2); 6209 ck_assert(!icEqualArraySmallJsonG(p1, p2)); 6210 // non smallJson object 6211 terminateO(p2); 6212 p2 = (smallJsont*) allocSmallInt(2); 6213 ck_assert(!icEqualArraySmallJsonG(p1, p2)); 6214 // null parameters 6215 ck_assert(!icEqualArraySmallJsonG(null, p2)); 6216 ck_assert(!icEqualArraySmallJsonG(p1, null)); 6217 terminateO(p2); 6218 listFreeS(p1); 6219 6220 } 6221 6222 6223 void icEqualArraySmallArrayGT(CuTest *tc UNUSED) { 6224 6225 char ** p1 = listCreateS("A", "qwe"); 6226 smallArrayt* p2 = createSA("A", "BB"); 6227 6228 ck_assert(!icEqualArraySmallArrayG(p1, p2)); 6229 listSetS(p1, 1, "bb"); 6230 ck_assert(icEqualArraySmallArrayG(p1, p2)); 6231 // array with deleted elements 6232 p2->f->pushS(p2, "BB"); 6233 delElemO(p2, 1); 6234 ck_assert(!icEqualArraySmallArrayG(p1, p2)); 6235 trimO(p2); 6236 // p1 empty 6237 forEachS(p1, e) free(e); 6238 p1[0] = null; 6239 ck_assert(!icEqualArraySmallArrayG(p1, p2)); 6240 // p2 empty 6241 listPushS(&p1, "A"); 6242 listPushS(&p1, "BB"); 6243 emptyO(p2); 6244 ck_assert(!icEqualArraySmallArrayG(p1, p2)); 6245 /* // non smallArray object */ 6246 terminateO(p2); 6247 p2 = (smallArrayt*) allocSmallInt(2); 6248 ck_assert(!icEqualArraySmallArrayG(p1, p2)); 6249 /* // null parameters */ 6250 ck_assert(!icEqualArraySmallArrayG(null, p2)); 6251 ck_assert(!icEqualArraySmallArrayG(p1, null)); 6252 terminateO(p2); 6253 listFreeS(p1); 6254 6255 } 6256 6257 6258 void icEqualCArraySmallJsonGT(CuTest *tc UNUSED) { 6259 6260 const char * p1[] = {"a", null}; 6261 smallJsont* p2 = allocSmallJson(); 6262 6263 ck_assert(!icEqualCArraySmallJsonG(p1, p2)); 6264 terminateO(p2); 6265 6266 } 6267 6268 6269 void icEqualCArraySmallArrayGT(CuTest *tc UNUSED) { 6270 6271 const char * p1[] = {"a", null}; 6272 smallArrayt* p2 = allocSmallArray(); 6273 6274 ck_assert(!icEqualCArraySmallArrayG(p1, p2)); 6275 terminateO(p2); 6276 6277 } 6278 6279 6280 void icEqualOCharGT(CuTest *tc UNUSED) { 6281 6282 baset* p1 = (baset*) allocSmallString("ASD"); 6283 const char * p2 = "asd"; 6284 6285 ck_assert(icEqualOCharG(p1, p2)); 6286 terminateO(p1); 6287 6288 } 6289 6290 6291 void icEqualOChaGT(CuTest *tc UNUSED) { 6292 6293 baset* p1 = (baset*) allocSmallString("A"); 6294 6295 ck_assert(icEqualOChaG(p1, 'a')); 6296 terminateO(p1); 6297 6298 } 6299 6300 6301 void icEqualOArrayGT(CuTest *tc UNUSED) { 6302 6303 baset* p1 = (baset*) createSA("a", "bb"); 6304 char ** p2 = listCreateS("A", "BB"); 6305 6306 ck_assert(icEqualOArrayG(p1, p2)); 6307 terminateO(p1); 6308 listFreeS(p2); 6309 6310 } 6311 6312 6313 void icEqualOCArrayGT(CuTest *tc UNUSED) { 6314 6315 baset* p1 = (baset*) createSA("A", "bb"); 6316 const char * p2[] = {"A", "BB", null}; 6317 6318 ck_assert(icEqualOCArrayG(p1, p2)); 6319 terminateO(p1); 6320 6321 } 6322 6323 6324 void icEqualOOGT(CuTest *tc UNUSED) { 6325 6326 baset* p1 = (baset*) allocSmallString("a"); 6327 smallJsont* P2 = allocSmallJson(); 6328 baset* p2 = (baset*)P2; 6329 6330 setTopStringO(P2, "A"); 6331 ck_assert(icEqualOOG(p1, p2)); 6332 freeO(P2); 6333 setTopIntO(P2, 0); 6334 ck_assert(!icEqualOOG(p1, p2)); 6335 freeO(P2); 6336 setTopIntO(P2, 2); 6337 // null parameters 6338 ck_assert(!icEqualOOG(null, p2)); 6339 ck_assert(!icEqualOOG(p1, null)); 6340 terminateO(p1); 6341 terminateO(p2); 6342 6343 } 6344 6345 6346 void icEqualOSmallArrayGT(CuTest *tc UNUSED) { 6347 6348 baset* p1 = (baset*) createSA("a"); 6349 smallArrayt* p2 = createSA("A"); 6350 6351 ck_assert(icEqualOSmallArrayG(p1, p2)); 6352 terminateO(p2); 6353 // non smallArray object 6354 p2 = (smallArrayt*) allocSmallInt(2); 6355 ck_assert(!icEqualOSmallArrayG(p1, p2)); 6356 // null p2 6357 terminateO(p2); 6358 ck_assert(!icEqualOSmallArrayG(p1, p2)); 6359 terminateO(p1); 6360 6361 } 6362 6363 6364 void icEqualOSmallDictGT(CuTest *tc UNUSED) { 6365 6366 smallDictt* P1 = allocSmallDict(); 6367 baset* p1 = (baset*) P1; 6368 smallDictt* p2 = allocSmallDict(); 6369 6370 P1->f->setS(P1, "qwe", "QWE"); 6371 p2->f->setS(p2, "qwe", "qwe"); 6372 ck_assert(icEqualOSmallDictG(p1, p2)); 6373 // non smallDict p2 6374 terminateO(p2); 6375 p2 = (smallDictt*) allocSmallInt(2); 6376 ck_assert(!icEqualOSmallDictG(p1, p2)); 6377 // null p2 6378 ck_assert(!icEqualOSmallDictG(p1, null)); 6379 terminateO(p1); 6380 terminateO(p2); 6381 6382 } 6383 6384 6385 void icEqualOSmallJsonGT(CuTest *tc UNUSED) { 6386 6387 baset* p1 = (baset*) allocSmallString("A"); 6388 smallJsont* p2 = allocSmallJson(); 6389 6390 setTopStringO(p2, "a"); 6391 ck_assert(icEqualOSmallJsonG(p1, p2)); 6392 // non smallJson p2 6393 terminateO(p2); 6394 p2 = (smallJsont*) allocSmallInt(2); 6395 ck_assert(!icEqualOSmallJsonG(p1, p2)); 6396 // null p2 6397 ck_assert(!icEqualOSmallJsonG(p1, null)); 6398 terminateO(p1); 6399 terminateO(p2); 6400 6401 } 6402 6403 6404 void icEqualOSmallStringGT(CuTest *tc UNUSED) { 6405 6406 baset* p1 = (baset*) allocSmallString("QWE"); 6407 smallStringt* p2 = allocSmallString("qwe"); 6408 6409 ck_assert(icEqualOSmallStringG(p1, p2)); 6410 // non smallString p2 6411 terminateO(p2); 6412 p2 = (smallStringt*) allocSmallInt(2); 6413 ck_assert(!icEqualOSmallStringG(p1, p2)); 6414 // null p2 6415 ck_assert(!icEqualOSmallStringG(p1, null)); 6416 terminateO(p1); 6417 terminateO(p2); 6418 6419 } 6420 6421 6422 void cpuCountT(CuTest *tc UNUSED) { 6423 6424 ck_assert_int_ne(cpuCount(), 0); 6425 6426 } 6427 6428 6429 void registerFinalizeRecycleContainersInThreadPoolT(CuTest *tc UNUSED) { 6430 6431 //TODO r = registerFinalizeRecycleContainersInThreadPool(); 6432 6433 } 6434 6435 6436 void initLibsheepyObjectT(CuTest *tc UNUSED) { 6437 6438 //TODO r = initLibsheepyObject(); 6439 6440 } 6441 6442 6443 void putsOT(CuTest *tc UNUSED) { 6444 6445 createAllocateSmallArray(l); 6446 6447 // object 6448 putsO(l); 6449 // NULL 6450 putsO(NULL); 6451 6452 terminateO(l); 6453 6454 } 6455 6456 6457 void execOT(CuTest *tc UNUSED) { 6458 6459 int r; 6460 6461 createAllocateSmallArray(l); 6462 6463 // command 6464 r = execO("ls libsheepyObjectTest.c", l, NULL); 6465 ck_assert_int_eq(r, 1); 6466 ck_assert_uint_eq(l->f->len(l),1); 6467 ck_assert_str_eq(l->f->getAtS(l, 0), "libsheepyObjectTest.c"); 6468 freeO(l); 6469 // invalid command 6470 r = execO("randomCommand", l, NULL); 6471 ck_assert_int_eq(r, 1); 6472 ck_assert_uint_eq(l->f->len(l),0); 6473 // NULL out array 6474 r = execO("ls libsheepyObjectTest.c", NULL, NULL); 6475 ck_assert_int_eq(r, 0); 6476 ck_assert_uint_eq(l->f->len(l),0); 6477 terminateO(l); 6478 // NULL command 6479 ck_assert_int_eq(execO(NULL, NULL, NULL), 0); 6480 6481 } 6482 6483 6484 void walkDirOT(CuTest *tc UNUSED) { 6485 6486 smallArrayt *l; 6487 6488 // existing directory 6489 l = walkDirO("../dirTest.null"); 6490 ck_assert_uint_eq(l->f->len(l),3); 6491 ck_assert_str_eq(l->f->getAtS(l, 0), "../dirTest.null/one"); 6492 ck_assert_str_eq(l->f->getAtS(l, 1), "../dirTest.null/two/four"); 6493 ck_assert_str_eq(l->f->getAtS(l, 2), "../dirTest.null/two/three"); 6494 terminateO(l); 6495 // empty path 6496 ck_assert_ptr_eq(walkDirO(""), NULL); 6497 // non existing directory 6498 l = walkDirO("nonExisting.null"); 6499 ck_assert(l->f->isEmpty(l)); 6500 terminateO(l); 6501 // NULL path 6502 ck_assert_ptr_eq(walkDirO(NULL), NULL); 6503 6504 } 6505 6506 6507 void expandHomeOT(CuTest *tc UNUSED) { 6508 6509 // no ~/ 6510 createAllocateSmallString(v); 6511 v->f->set(v, "sheepy"); 6512 expandHomeO(v); 6513 ck_assert(v->f->equalS(v, "sheepy")); 6514 terminateO(v); 6515 // NULL var 6516 expandHomeO(NULL); 6517 6518 } 6519 6520 6521 void chDirOT(CuTest *tc UNUSED) { 6522 6523 // change directory 6524 smallStringt *c; 6525 c = getCwdO(); 6526 createAllocateSmallString(v); 6527 v->f->set(v, "../dirTest.null"); 6528 ck_assert(chDirO(v)); 6529 char *s = getCwd(); 6530 ck_assert((size_t)findS(s, "dirTest.null")); 6531 chDirO(c); 6532 free(s); 6533 terminateO(c); 6534 // non existing dir 6535 createAllocateSmallString(n); 6536 n->f->set(n, "RandomNonExistingDir"); 6537 ck_assert(!chDirO(n)); 6538 // NULL path 6539 ck_assert(!chDirO(NULL)); 6540 terminateO(v); 6541 terminateO(n); 6542 6543 } 6544 6545 6546 void fileExistsOT(CuTest *tc UNUSED) { 6547 6548 createAllocateSmallArray(sA); 6549 char **l = listCreateS("../libsheepyTest.c", "wefwepfk34.c", "../../src", ""); 6550 sA->f->fromArrayNFree(sA, l, 0); 6551 // detect existing file 6552 smallStringt *S = sA->f->getAtSmallString(sA, 0); 6553 ck_assert(fileExistsO(S)); 6554 finishO(S); 6555 // non existing file 6556 S = sA->f->getAtSmallString(sA, 1); 6557 ck_assert(!fileExistsO(S)); 6558 finishO(S); 6559 // folder 6560 S = sA->f->getAtSmallString(sA, 2); 6561 ck_assert(fileExistsO(S)); 6562 finishO(S); 6563 // empty path 6564 S = sA->f->getAtSmallString(sA, 3); 6565 ck_assert(!fileExistsO(S)); 6566 finishO(S); 6567 // NULL path 6568 ck_assert(!fileExistsO(NULL)); 6569 terminateO(sA); 6570 6571 } 6572 6573 6574 void fileChmodOT(CuTest *tc UNUSED) { 6575 6576 // existing file 6577 createAllocateSmallString(v); 6578 v->f->set(v, "../chmodTest.null"); 6579 ck_assert(fileChmodO(v, S_IRUSR | S_IWUSR | S_IXUSR | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH)); 6580 ck_assert(fileChmodO(v, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH)); 6581 // non existing file 6582 createAllocateSmallString(n); 6583 n->f->set(n, "qweqwe_null"); 6584 ck_assert(!fileChmodO(n, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH)); 6585 // empty path 6586 createAllocateSmallString(e); 6587 e->f->set(e, ""); 6588 ck_assert(!fileChmodO(e,0)); 6589 // NULL path 6590 ck_assert(!fileChmodO(NULL,0)); 6591 terminateO(v); 6592 terminateO(n); 6593 terminateO(e); 6594 6595 } 6596 6597 6598 void fileSizeOT(CuTest *tc UNUSED) { 6599 6600 // existing file 6601 createAllocateSmallString(s); 6602 s->f->set(s, "../sizeTest.null"); 6603 ck_assert_uint_eq(fileSizeO(s), 743); 6604 // empty file 6605 createAllocateSmallString(v); 6606 v->f->set(v, "../chmodTest.null"); 6607 ck_assert_uint_eq(fileSizeO(v), 0); 6608 // non existing file 6609 createAllocateSmallString(n); 6610 n->f->set(n, "qweqwe_null"); 6611 ck_assert_int_eq(fileSizeO(n), -1); 6612 // empty path 6613 createAllocateSmallString(e); 6614 e->f->set(e, ""); 6615 ck_assert_int_eq(fileSizeO(e), -1); 6616 // NULL path 6617 ck_assert_int_eq(fileSizeO(NULL), -1); 6618 terminateO(s); 6619 terminateO(v); 6620 terminateO(n); 6621 terminateO(e); 6622 6623 } 6624 6625 6626 void mkdirParentsOT(CuTest *tc UNUSED) { 6627 6628 // directory 6629 rmAll("mkdirTest.null/null"); 6630 createAllocateSmallString(s); 6631 s->f->set(s, "mkdirTest.null/null"); 6632 ck_assert_int_eq(mkdirParentsO(s),1); 6633 // not allowed 6634 createAllocateSmallString(v); 6635 v->f->set(v, "/usr/null"); 6636 ck_assert_int_eq(mkdirParentsO(v),0); 6637 // empty path 6638 createAllocateSmallString(e); 6639 e->f->set(e, ""); 6640 ck_assert_int_eq(mkdirParentsO(e),0); 6641 // NULL path 6642 ck_assert_int_eq(mkdirParentsO(NULL),0); 6643 terminateO(s); 6644 terminateO(e); 6645 terminateO(v); 6646 6647 } 6648 6649 6650 void rmAllOT(CuTest *tc UNUSED) { 6651 6652 // directory 6653 createAllocateSmallString(s); 6654 s->f->set(s, "rmAllTest.null/null"); 6655 mkdirParents("rmAllTest.null/null"); 6656 ck_assert_int_eq(rmAllO(s),1); 6657 // empty path 6658 createAllocateSmallString(e); 6659 e->f->set(e,""); 6660 ck_assert_int_eq(rmAllO(e),0); 6661 // too little permissions 6662 createAllocateSmallString(v); 6663 v->f->set(v,"/var/lock"); 6664 ck_assert_int_eq(rmAllO(v),0); 6665 // NULL path 6666 ck_assert_int_eq(rmAllO(NULL),0); 6667 terminateO(s); 6668 terminateO(e); 6669 terminateO(v); 6670 6671 6672 } 6673 6674 6675 void copyOT(CuTest *tc UNUSED) { 6676 6677 // file 6678 createAllocateSmallString(s); 6679 createAllocateSmallString(d); 6680 s->f->set(s, "../chmodTest.null"); 6681 d->f->set(d, "../copyTest.null"); 6682 ck_assert_int_eq(copyO(s, d),1); 6683 ck_assert(fileExists("../copyTest.null")); 6684 // too little permissions 6685 fileChmod("../copyTest.null", 1); 6686 ck_assert_int_eq(copyO(d, d),0); 6687 fileChmod("../copyTest.null", 777); 6688 rmAll("../copyTest.null"); 6689 // empty path 6690 createAllocateSmallString(e); 6691 e->f->set(e, ""); 6692 ck_assert_int_eq(copyO(e, d),0); 6693 ck_assert(!fileExists("copyTest.null")); 6694 ck_assert_int_eq(copyO(s, e),0); 6695 ck_assert(!fileExists("copyTest.null")); 6696 // NULL path 6697 ck_assert_int_eq(copyO(NULL, d),0); 6698 ck_assert_int_eq(copyO(s, NULL),0); 6699 ck_assert_int_eq(copyO(NULL, NULL),0); 6700 terminateO(s); 6701 terminateO(d); 6702 terminateO(e); 6703 6704 } 6705 6706 6707 void randomSOT(CuTest *tc UNUSED) { 6708 6709 // get random string 6710 smallStringt *s = randomSO(10); 6711 ck_assert_ptr_ne(s, NULL); 6712 terminateO(s); 6713 // invalid length (0) 6714 ck_assert_ptr_eq(randomSO(0), NULL); 6715 6716 randomUrandomClose(); 6717 6718 } 6719 6720 6721 void randomAlphaNumSOT(CuTest *tc UNUSED) { 6722 6723 // get random string 6724 smallStringt *s = randomAlphaNumSO(10); 6725 ck_assert_ptr_ne(s, NULL); 6726 terminateO(s); 6727 // invalid length (0) 6728 ck_assert_ptr_eq(randomAlphaNumSO(0), NULL); 6729 6730 randomUrandomClose(); 6731 6732 } 6733 6734 6735 void readLineOT(CuTest *tc UNUSED) { 6736 6737 FILE *fp; 6738 smallStringt *s; 6739 6740 // file with data 6741 fp = fopen("../textTest.null", "r"); 6742 s = readLineO(fp); 6743 fclose(fp); 6744 ck_assert_str_eq(s->f->get(s), "LINE 1"); 6745 terminateO(s); 6746 // empty file or end of stream 6747 fp = fopen("../chmodTest.null", "r"); 6748 s = readLineO(fp); 6749 fclose(fp); 6750 ck_assert_str_eq(ssGet(s), ""); 6751 terminateO(s); 6752 // NULL stream 6753 ck_assert_ptr_eq(readLineO(NULL), NULL); 6754 6755 6756 } 6757 6758 6759 void toSmalltT(CuTest *tc UNUSED) { 6760 6761 smallStringt *s; 6762 smallIntt *i; 6763 6764 // undefined 6765 createAllocateUndefined(u); 6766 sUndefinedt *su = (sUndefinedt *) toSmallt((baset *)u); 6767 finishO(u); 6768 ck_assert(isSType(su, UNDEFINED)); 6769 sFree((smallt *) su); 6770 // smallArray 6771 createAllocateSmallArray(a); 6772 initiateAllocateSmallString(&s); 6773 s->f->set(s, "sheepy"); 6774 a->f->push(a, (baset *) s); 6775 finishO(s); 6776 initiateAllocateSmallInt(&i); 6777 i->f->set(i, 20); 6778 a->f->push(a, (baset *) i); 6779 finishO(i); 6780 sArrayt *sa = (sArrayt *) toSmallt((baset *)a); 6781 ck_assert_uint_eq(sa->count, 2); 6782 char *S = sToString((smallt *) sa); 6783 ck_assert_str_eq(S, "[\"sheepy\",20]"); 6784 free(S); 6785 freeO(a); 6786 sa = (sArrayt *) toSmallt((baset *)a); 6787 ck_assert_uint_eq(sa->count, 0); 6788 S = sToString((smallt *) sa); 6789 ck_assert_str_eq(S, "[]"); 6790 free(S); 6791 sFree((smallt *) sa); 6792 finishO(a); 6793 // smallDict 6794 createAllocateSmallDict(d); 6795 initiateAllocateSmallString(&s); 6796 s->f->set(s, "sheepy"); 6797 d->f->set(d, "s", (baset *) s); 6798 finishO(s); 6799 initiateAllocateSmallInt(&i); 6800 i->f->set(i, 20); 6801 d->f->set(d, "i", (baset *) i); 6802 finishO(i); 6803 sDictt *sd = (sDictt *) toSmallt((baset *)d); 6804 ck_assert_uint_eq(sd->count, 2); 6805 S = sToString((smallt *) sd); 6806 ck_assert_str_eq(S, "{\"s\":\"sheepy\",\"i\":20}"); 6807 free(S); 6808 freeO(d); 6809 sd = (sDictt *) toSmallt((baset *)d); 6810 ck_assert_uint_eq(sd->count, 0); 6811 S = sToString((smallt *) sd); 6812 ck_assert_str_eq(S, "{}"); 6813 free(S); 6814 sFree((smallt *) sd); 6815 finishO(d); 6816 // smallJson 6817 createAllocateSmallJson(j); 6818 smallt *so = toSmallt((baset *)j); 6819 ck_assert_ptr_ne(so, NULL); 6820 ck_assert_int_eq(so->type, CONTAINER); 6821 ck_assert_ptr_eq(((sContainert*)so)->data, j); 6822 sFree(so); // sFree does terminateO(j); because smallJson is stored in a container 6823 // smallBool 6824 smallBoolt *b = allocSmallBool(true); 6825 sBoolt *sb = (sBoolt*) toSmallt((baset*)b); 6826 S = sToString((smallt *) sb); 6827 ck_assert_str_eq(S, "true"); 6828 free(S); 6829 freeO(b); 6830 sb = (sBoolt*) toSmallt((baset*)b); 6831 S = sToString((smallt *) sb); 6832 ck_assert_str_eq(S, "false"); 6833 free(S); 6834 sFree((smallt*) sb); 6835 finishO(b); 6836 // smallBytes 6837 smallBytest *B = allocSmallBytes("qwe", sizeof("qwe")); 6838 sBytest *sB = (sBytest*) toSmallt((baset*)B); 6839 S = sToString((smallt *) sB); 6840 ck_assert_str_eq(S, "[0x71,0x77,0x65,0x00]"); 6841 free(S); 6842 freeO(B); 6843 sB = (sBytest*) toSmallt((baset*)B); 6844 S = sToString((smallt *) sB); 6845 ck_assert_str_eq(S, "[]"); 6846 free(S); 6847 sFree((smallt*) sB); 6848 finishO(B); 6849 // smallContainer 6850 smallContainert *c = allocSmallContainer("qwe"); 6851 sContainert *sc = (sContainert*) toSmallt((baset*)c); 6852 S = sToString((smallt *) sc); 6853 ck_assert_str_eq(S, "<data container>"); 6854 free(S); 6855 freeO(c); 6856 sc = (sContainert*) toSmallt((baset*)c); 6857 S = sToString((smallt *) sc); 6858 ck_assert_str_eq(S, "<data container>"); 6859 free(S); 6860 sFree((smallt*) sc); 6861 finishO(c); 6862 // smallDouble 6863 smallDoublet *D = allocSmallDouble(1); 6864 sDoublet *sD = (sDoublet*) toSmallt((baset*)D); 6865 S = sToString((smallt *) sD); 6866 ck_assert_str_eq(S, "1.000000e+00"); 6867 free(S); 6868 freeO(D); 6869 sD = (sDoublet*) toSmallt((baset*)D); 6870 S = sToString((smallt *) sD); 6871 ck_assert_str_eq(S, "0.000000e+00"); 6872 free(S); 6873 sFree((smallt*) sD); 6874 finishO(D); 6875 // smallInt 6876 i = allocSmallInt(2); 6877 sIntt *si = (sIntt*) toSmallt((baset*)i); 6878 S = sToString((smallt *) si); 6879 ck_assert_str_eq(S, "2"); 6880 free(S); 6881 freeO(i); 6882 si = (sIntt*) toSmallt((baset*)i); 6883 S = sToString((smallt *) si); 6884 ck_assert_str_eq(S, "0"); 6885 free(S); 6886 sFree((smallt*) si); 6887 finishO(i); 6888 // smallString 6889 s = allocSmallString("qwe"); 6890 sStringt *ss = (sStringt*) toSmallt((baset*)s); 6891 S = sToString((smallt *) ss); 6892 ck_assert_str_eq(S, "qwe"); 6893 free(S); 6894 freeO(s); 6895 ss = (sStringt*) toSmallt((baset*)s); 6896 S = sToString((smallt *) ss); 6897 ck_assert_str_eq(S, ""); 6898 free(S); 6899 sFree((smallt*) ss); 6900 finishO(s); 6901 // any class 6902 i = allocSmallInt(2); 6903 i->type = "randomClass"; 6904 sc = (sContainert*) toSmallt((baset*)i); 6905 S = sToString((smallt *) sc); 6906 ck_assert_str_eq(S, "<data container>"); 6907 free(S); 6908 sFree((smallt*) sc); 6909 // NULL 6910 ck_assert_ptr_eq(toSmallt(NULL), NULL); 6911 6912 } 6913 6914 6915 void toBasetT(CuTest *tc UNUSED) { 6916 6917 // bool 6918 sBoolt *sb = allocSBool(true); 6919 smallBoolt *b = (smallBoolt *) toBaset((smallt *)sb); 6920 ck_assert(b->value->value); 6921 terminateO(b); 6922 // smallBytes 6923 sBytest *sB = allocSBytes(); 6924 smallBytest *B = (smallBytest *) toBaset((smallt *)sB); 6925 ck_assert_ptr_eq(B->B, sB); 6926 terminateO(B); 6927 // container 6928 sContainert *sc = allocSContainer(strdup("sheepy")); 6929 smallContainert *c = (smallContainert *) toBaset((smallt *)sc); 6930 ck_assert_str_eq(c->data->data, "sheepy"); 6931 free(c->data->data); 6932 terminateO(c); 6933 // any class 6934 smallIntt *n = allocSmallInt(2); 6935 n->type = "randomClass"; 6936 sc = (sContainert*) toSmallt((baset*)n); 6937 smallIntt *x = (smallIntt *) toBaset((smallt *)sc); 6938 ck_assert_str_eq(x->type, "randomClass"); 6939 sFree((smallt*) sc); 6940 // double 6941 sDoublet *sD = allocSDouble(10); 6942 smallDoublet *D = (smallDoublet *) toBaset((smallt *)sD); 6943 ck_assert_uint_eq((uint)D->value->value, 10); 6944 terminateO(D); 6945 // int 6946 sIntt *si = allocSInt(10); 6947 smallIntt *i = (smallIntt *) toBaset((smallt *)si); 6948 ck_assert_uint_eq(i->value->value, 10); 6949 terminateO(i); 6950 // string 6951 sStringt *ss = allocSStringTiny("sheepy"); 6952 smallStringt *s = (smallStringt *) toBaset((smallt *)ss); 6953 ck_assert_str_eq(sStringGetTiny(ss), "sheepy"); 6954 terminateO(s); 6955 // undefined 6956 sUndefinedt *su = allocSUndefined(); 6957 undefinedt *u = (undefinedt *) toBaset((smallt *)su); 6958 ck_assert(isOType(u, "undefined")); 6959 sFree((smallt *) su); 6960 terminateO(u); 6961 // smallArray 6962 sArrayt *sa = allocSArray(); 6963 ss = allocSStringTiny("sheepy"); 6964 sArrayPushTiny(&sa, (smallt *) ss); 6965 si = allocSInt(20); 6966 sArrayPushTiny(&sa, (smallt *) si); 6967 smallArrayt *a = (smallArrayt *) toBaset((smallt *)sa); 6968 ck_assert_uint_eq(a->a->count, 2); 6969 char *S = toStringO(a); 6970 ck_assert_str_eq(S, "[\"sheepy\",20]"); 6971 free(S); 6972 terminateO(a); 6973 // smallDict 6974 sDictt *sd = allocSDict(); 6975 ss = allocSStringTiny("sheepy"); 6976 sDictPushTiny(&sd, "s", (smallt *) ss); 6977 si = allocSInt(20); 6978 sDictPushTiny(&sd, "i", (smallt *) si); 6979 smallDictt *d = (smallDictt *) toBaset((smallt *)sd); 6980 ck_assert_uint_eq(d->d->count, 2); 6981 S = toStringO(d); 6982 ck_assert_str_eq(S, "{\"s\":\"sheepy\",\"i\":20}"); 6983 free(S); 6984 terminateO(d); 6985 // NULL 6986 ck_assert_ptr_eq(toBaset(NULL), NULL); 6987 6988 } 6989 6990 6991 6992 6993 int main(int n UNUSED, char**v UNUSED) { 6994 // disable btrace to make the test run faster 6995 btraceDisable(); 6996 CuString *output = CuStringNew(); 6997 CuSuite *suite = CuSuiteNew(); 6998 6999 SUITE_ADD_TEST(suite, shSysinfoT); 7000 SUITE_ADD_TEST(suite, duplicateBaseGT); 7001 SUITE_ADD_TEST(suite, freeManyOFT); 7002 SUITE_ADD_TEST(suite, terminateManyOFT); 7003 SUITE_ADD_TEST(suite, smashManyOFT); 7004 SUITE_ADD_TEST(suite, finishManyOFT); 7005 SUITE_ADD_TEST(suite, getProgPathJOT); 7006 SUITE_ADD_TEST(suite, getProgPathOT); 7007 SUITE_ADD_TEST(suite, getRealProgPathJOT); 7008 SUITE_ADD_TEST(suite, getRealProgPathOT); 7009 SUITE_ADD_TEST(suite, systemJOT); 7010 SUITE_ADD_TEST(suite, systemOT); 7011 SUITE_ADD_TEST(suite, systemNFreeJOFT); 7012 SUITE_ADD_TEST(suite, systemNFreeOFT); 7013 SUITE_ADD_TEST(suite, print_mT); 7014 SUITE_ADD_TEST(suite, print_m_arginfoT); 7015 SUITE_ADD_TEST(suite, putsUndefinedGFT); 7016 SUITE_ADD_TEST(suite, putsBoolGFT); 7017 SUITE_ADD_TEST(suite, putsBoolPGFT); 7018 SUITE_ADD_TEST(suite, putsDoubleGFT); 7019 SUITE_ADD_TEST(suite, putsDoublePGFT); 7020 SUITE_ADD_TEST(suite, putsIntGFT); 7021 SUITE_ADD_TEST(suite, putsIntPGFT); 7022 SUITE_ADD_TEST(suite, putsInt32GFT); 7023 SUITE_ADD_TEST(suite, putsInt32PGFT); 7024 SUITE_ADD_TEST(suite, putsUintGFT); 7025 SUITE_ADD_TEST(suite, putsUintPGFT); 7026 SUITE_ADD_TEST(suite, putsUint32GFT); 7027 SUITE_ADD_TEST(suite, putsUint32PGFT); 7028 SUITE_ADD_TEST(suite, putsSGFT); 7029 SUITE_ADD_TEST(suite, putsListSGFT); 7030 SUITE_ADD_TEST(suite, putsListCSGFT); 7031 SUITE_ADD_TEST(suite, putsDictGFT); 7032 SUITE_ADD_TEST(suite, putsJsonGFT); 7033 SUITE_ADD_TEST(suite, putsArrayGFT); 7034 SUITE_ADD_TEST(suite, putsSmallBoolGFT); 7035 SUITE_ADD_TEST(suite, putsSmallBytesGFT); 7036 SUITE_ADD_TEST(suite, putsSmallDoubleGFT); 7037 SUITE_ADD_TEST(suite, putsSmallIntGFT); 7038 SUITE_ADD_TEST(suite, putsSmallStringGFT); 7039 SUITE_ADD_TEST(suite, putsVoidGFT); 7040 SUITE_ADD_TEST(suite, putsSmallContainerGFT); 7041 SUITE_ADD_TEST(suite, toStringOFT); 7042 SUITE_ADD_TEST(suite, toStringUndefinedGFT); 7043 SUITE_ADD_TEST(suite, toStringBoolGFT); 7044 SUITE_ADD_TEST(suite, toStringBoolPGFT); 7045 SUITE_ADD_TEST(suite, toStringFloatGFT); 7046 SUITE_ADD_TEST(suite, toStringFloatPGFT); 7047 SUITE_ADD_TEST(suite, toStringDoubleGFT); 7048 SUITE_ADD_TEST(suite, toStringDoublePGFT); 7049 SUITE_ADD_TEST(suite, toStringIntGFT); 7050 SUITE_ADD_TEST(suite, toStringIntPGFT); 7051 SUITE_ADD_TEST(suite, toStringInt32GFT); 7052 SUITE_ADD_TEST(suite, toStringInt32PGFT); 7053 SUITE_ADD_TEST(suite, toStringInt16GFT); 7054 SUITE_ADD_TEST(suite, toStringInt16PGFT); 7055 SUITE_ADD_TEST(suite, toStringUintGFT); 7056 SUITE_ADD_TEST(suite, toStringUintPGFT); 7057 SUITE_ADD_TEST(suite, toStringUint32GFT); 7058 SUITE_ADD_TEST(suite, toStringUint32PGFT); 7059 SUITE_ADD_TEST(suite, toStringUint16GFT); 7060 SUITE_ADD_TEST(suite, toStringUint16PGFT); 7061 SUITE_ADD_TEST(suite, toStringUint8GFT); 7062 SUITE_ADD_TEST(suite, toStringUint8PGFT); 7063 SUITE_ADD_TEST(suite, toStringCharGFT); 7064 SUITE_ADD_TEST(suite, toStringSGFT); 7065 SUITE_ADD_TEST(suite, toStringListSGFT); 7066 SUITE_ADD_TEST(suite, toStringListCSGFT); 7067 SUITE_ADD_TEST(suite, toStringDictGFT); 7068 SUITE_ADD_TEST(suite, toStringArrayGFT); 7069 SUITE_ADD_TEST(suite, toStringSmallBoolGFT); 7070 SUITE_ADD_TEST(suite, toStringSmallBytesGFT); 7071 SUITE_ADD_TEST(suite, toStringSmallDoubleGFT); 7072 SUITE_ADD_TEST(suite, toStringSmallIntGFT); 7073 SUITE_ADD_TEST(suite, toStringSmallStringGFT); 7074 SUITE_ADD_TEST(suite, toStringVoidGFT); 7075 SUITE_ADD_TEST(suite, toStringSmallContainerGFT); 7076 SUITE_ADD_TEST(suite, toStringSmallJsonGFT); 7077 SUITE_ADD_TEST(suite, otosT); 7078 SUITE_ADD_TEST(suite, formatOT); 7079 SUITE_ADD_TEST(suite, execSmallJsonOT); 7080 SUITE_ADD_TEST(suite, execSmallStringOT); 7081 SUITE_ADD_TEST(suite, walkDirSmallJsonOT); 7082 SUITE_ADD_TEST(suite, walkDirSmallStringOT); 7083 SUITE_ADD_TEST(suite, walkDirDirOT); 7084 SUITE_ADD_TEST(suite, walkDirDirSmallJsonOT); 7085 SUITE_ADD_TEST(suite, walkDirDirSmallStringOT); 7086 SUITE_ADD_TEST(suite, readDirOT); 7087 SUITE_ADD_TEST(suite, readDirSmallJsonOT); 7088 SUITE_ADD_TEST(suite, readDirSmallStringOT); 7089 SUITE_ADD_TEST(suite, readDirDirOT); 7090 SUITE_ADD_TEST(suite, readDirDirSmallJsonOT); 7091 SUITE_ADD_TEST(suite, readDirDirSmallStringOT); 7092 SUITE_ADD_TEST(suite, walkDirAllOT); 7093 SUITE_ADD_TEST(suite, walkDirAllSmallJsonOT); 7094 SUITE_ADD_TEST(suite, walkDirAllSmallStringOT); 7095 SUITE_ADD_TEST(suite, readDirAllOT); 7096 SUITE_ADD_TEST(suite, readDirAllSmallJsonOT); 7097 SUITE_ADD_TEST(suite, readDirAllSmallStringOT); 7098 SUITE_ADD_TEST(suite, getModificationTimeJOT); 7099 SUITE_ADD_TEST(suite, getModificationTimeOT); 7100 SUITE_ADD_TEST(suite, setModificationTimeJOT); 7101 SUITE_ADD_TEST(suite, setModificationTimeOT); 7102 SUITE_ADD_TEST(suite, equalModificationTimesJOT); 7103 SUITE_ADD_TEST(suite, equalModificationTimesSJOT); 7104 SUITE_ADD_TEST(suite, equalModificationTimesJOST); 7105 SUITE_ADD_TEST(suite, equalModificationTimesJOOT); 7106 SUITE_ADD_TEST(suite, equalModificationTimesOJOT); 7107 SUITE_ADD_TEST(suite, equalModificationTimesOT); 7108 SUITE_ADD_TEST(suite, equalModificationTimesSOT); 7109 SUITE_ADD_TEST(suite, equalModificationTimesOST); 7110 SUITE_ADD_TEST(suite, timeToJOT); 7111 SUITE_ADD_TEST(suite, timeToSOT); 7112 SUITE_ADD_TEST(suite, shDirnameJOT); 7113 SUITE_ADD_TEST(suite, shDirnameOT); 7114 SUITE_ADD_TEST(suite, expandHomeJOT); 7115 SUITE_ADD_TEST(suite, normalizePathJOT); 7116 SUITE_ADD_TEST(suite, normalizePathOT); 7117 SUITE_ADD_TEST(suite, getCwdJOT); 7118 SUITE_ADD_TEST(suite, chDirJOT); 7119 SUITE_ADD_TEST(suite, isDirJOT); 7120 SUITE_ADD_TEST(suite, isDirOT); 7121 SUITE_ADD_TEST(suite, isLinkJOT); 7122 SUITE_ADD_TEST(suite, isLinkOT); 7123 SUITE_ADD_TEST(suite, fileExistsJOT); 7124 SUITE_ADD_TEST(suite, fileChmodJOT); 7125 SUITE_ADD_TEST(suite, fileSizeJOT); 7126 SUITE_ADD_TEST(suite, readFileToNewGT); 7127 SUITE_ADD_TEST(suite, readStreamToNewGT); 7128 SUITE_ADD_TEST(suite, readFileToGT); 7129 SUITE_ADD_TEST(suite, readStreamToGT); 7130 SUITE_ADD_TEST(suite, readTextSmallJsonNotSupportedT); 7131 SUITE_ADD_TEST(suite, readTextSmallStringNotSupportedT); 7132 SUITE_ADD_TEST(suite, readToFileSmallJsonNotSupportedT); 7133 SUITE_ADD_TEST(suite, readToFileSmallStringNotSupportedT); 7134 SUITE_ADD_TEST(suite, writeFileFromGT); 7135 SUITE_ADD_TEST(suite, writeStreamFromGT); 7136 SUITE_ADD_TEST(suite, writeTextSmallJsonNotSupportedT); 7137 SUITE_ADD_TEST(suite, writeTextSmallStringNotSupportedT); 7138 SUITE_ADD_TEST(suite, writeTextCCSmallJsonNotSupportedT); 7139 SUITE_ADD_TEST(suite, writeTextCCSmallStringNotSupportedT); 7140 SUITE_ADD_TEST(suite, readTextSGT); 7141 SUITE_ADD_TEST(suite, readTextStreamGT); 7142 SUITE_ADD_TEST(suite, writeTextSGT); 7143 SUITE_ADD_TEST(suite, writeTextStreamGT); 7144 SUITE_ADD_TEST(suite, writeTextCGT); 7145 SUITE_ADD_TEST(suite, writeTextStreamCGT); 7146 SUITE_ADD_TEST(suite, appendFileSGT); 7147 SUITE_ADD_TEST(suite, appendTextSGT); 7148 SUITE_ADD_TEST(suite, appendTextCGT); 7149 SUITE_ADD_TEST(suite, mkdirParentsSmallJsonOT); 7150 SUITE_ADD_TEST(suite, rmAllSmallJsonOT); 7151 SUITE_ADD_TEST(suite, copySSmallJsonOT); 7152 SUITE_ADD_TEST(suite, copySOT); 7153 SUITE_ADD_TEST(suite, copySmallJsonOST); 7154 SUITE_ADD_TEST(suite, copySmallJsonSmallJsonT); 7155 SUITE_ADD_TEST(suite, copySmallJsonOT); 7156 SUITE_ADD_TEST(suite, copyOST); 7157 SUITE_ADD_TEST(suite, copyOSmallJsonT); 7158 SUITE_ADD_TEST(suite, renameSmallJsonOT); 7159 SUITE_ADD_TEST(suite, renameSmallJsonSmallJsonT); 7160 SUITE_ADD_TEST(suite, renameSmallJsonOST); 7161 SUITE_ADD_TEST(suite, renameOT); 7162 SUITE_ADD_TEST(suite, renameOSmallJsonT); 7163 SUITE_ADD_TEST(suite, renameSSmallJsonOT); 7164 SUITE_ADD_TEST(suite, renameSOT); 7165 SUITE_ADD_TEST(suite, renameOST); 7166 SUITE_ADD_TEST(suite, moveSmallJsonOT); 7167 SUITE_ADD_TEST(suite, moveSmallJsonSmallJsonT); 7168 SUITE_ADD_TEST(suite, moveSmallJsonOST); 7169 SUITE_ADD_TEST(suite, moveOT); 7170 SUITE_ADD_TEST(suite, moveOSmallJsonT); 7171 SUITE_ADD_TEST(suite, moveSSmallJsonOT); 7172 SUITE_ADD_TEST(suite, moveSOT); 7173 SUITE_ADD_TEST(suite, moveOST); 7174 SUITE_ADD_TEST(suite, randomSmallJsonOT); 7175 SUITE_ADD_TEST(suite, randomAlphaNumSmallJsonOT); 7176 SUITE_ADD_TEST(suite, readSmallJsonOT); 7177 SUITE_ADD_TEST(suite, readOT); 7178 SUITE_ADD_TEST(suite, readLineSmallJsonOT); 7179 SUITE_ADD_TEST(suite, intToSGT); 7180 SUITE_ADD_TEST(suite, doubleToSGT); 7181 SUITE_ADD_TEST(suite, iListUniqGT); 7182 SUITE_ADD_TEST(suite, iicListUniqGT); 7183 SUITE_ADD_TEST(suite, listFromArrayGT); 7184 SUITE_ADD_TEST(suite, listFromCArrayGT); 7185 SUITE_ADD_TEST(suite, getSGT); 7186 SUITE_ADD_TEST(suite, listGetGT); 7187 SUITE_ADD_TEST(suite, listGetCGT); 7188 SUITE_ADD_TEST(suite, iListGetGT); 7189 SUITE_ADD_TEST(suite, iListGetCGT); 7190 SUITE_ADD_TEST(suite, listPopGT); 7191 SUITE_ADD_TEST(suite, listDequeueGT); 7192 SUITE_ADD_TEST(suite, listDupCGT); 7193 SUITE_ADD_TEST(suite, listEqCGT); 7194 SUITE_ADD_TEST(suite, listEqC1GT); 7195 SUITE_ADD_TEST(suite, listEqCCGT); 7196 SUITE_ADD_TEST(suite, icListEqCGT); 7197 SUITE_ADD_TEST(suite, icListEqC1GT); 7198 SUITE_ADD_TEST(suite, icListEqCCGT); 7199 SUITE_ADD_TEST(suite, listLengthCGT); 7200 SUITE_ADD_TEST(suite, listIndexOfCGT); 7201 SUITE_ADD_TEST(suite, listIndexOfCharCGT); 7202 SUITE_ADD_TEST(suite, icListIndexOfCGT); 7203 SUITE_ADD_TEST(suite, icListIndexOfCharCGT); 7204 SUITE_ADD_TEST(suite, listHasCharCGT); 7205 SUITE_ADD_TEST(suite, listHasCGT); 7206 SUITE_ADD_TEST(suite, icListHasCGT); 7207 SUITE_ADD_TEST(suite, icListHasCharCGT); 7208 SUITE_ADD_TEST(suite, joinCGT); 7209 SUITE_ADD_TEST(suite, joinCharCGT); 7210 SUITE_ADD_TEST(suite, listAddCGT); 7211 SUITE_ADD_TEST(suite, listPrintCGT); 7212 SUITE_ADD_TEST(suite, eqCharCharT); 7213 SUITE_ADD_TEST(suite, equalChaOGT); 7214 SUITE_ADD_TEST(suite, equalChaBoolGT); 7215 SUITE_ADD_TEST(suite, equalChaDoubleGT); 7216 SUITE_ADD_TEST(suite, equalChaInt64GT); 7217 SUITE_ADD_TEST(suite, equalChaInt32GT); 7218 SUITE_ADD_TEST(suite, equalChaUint32GT); 7219 SUITE_ADD_TEST(suite, equalChaUint64GT); 7220 SUITE_ADD_TEST(suite, equalChaSmallBytesGT); 7221 SUITE_ADD_TEST(suite, equalChaSmallDoubleGT); 7222 SUITE_ADD_TEST(suite, equalChaSmallIntGT); 7223 SUITE_ADD_TEST(suite, equalChaSmallJsonGT); 7224 SUITE_ADD_TEST(suite, equalChaSmallStringGT); 7225 SUITE_ADD_TEST(suite, equalCharOGT); 7226 SUITE_ADD_TEST(suite, equalCharBoolGT); 7227 SUITE_ADD_TEST(suite, equalCharDoubleGT); 7228 SUITE_ADD_TEST(suite, equalCharInt64GT); 7229 SUITE_ADD_TEST(suite, equalCharInt32GT); 7230 SUITE_ADD_TEST(suite, equalCharUint32GT); 7231 SUITE_ADD_TEST(suite, equalCharUint64GT); 7232 SUITE_ADD_TEST(suite, equalCharSmallBoolGT); 7233 SUITE_ADD_TEST(suite, equalCharSmallBytesGT); 7234 SUITE_ADD_TEST(suite, equalCharSmallDoubleGT); 7235 SUITE_ADD_TEST(suite, equalCharSmallIntGT); 7236 SUITE_ADD_TEST(suite, equalCharPSmallJsonGT); 7237 SUITE_ADD_TEST(suite, equalCharPSmallStringGT); 7238 SUITE_ADD_TEST(suite, equalArrayOGT); 7239 SUITE_ADD_TEST(suite, equalCArrayOGT); 7240 SUITE_ADD_TEST(suite, equalArraySmallJsonGT); 7241 SUITE_ADD_TEST(suite, equalArraySmallArrayGT); 7242 SUITE_ADD_TEST(suite, equalCArraySmallJsonGT); 7243 SUITE_ADD_TEST(suite, equalCArraySmallArrayGT); 7244 SUITE_ADD_TEST(suite, equalOCharGT); 7245 SUITE_ADD_TEST(suite, equalOChaGT); 7246 SUITE_ADD_TEST(suite, equalOArrayGT); 7247 SUITE_ADD_TEST(suite, equalOCArrayGT); 7248 SUITE_ADD_TEST(suite, equalOOGT); 7249 SUITE_ADD_TEST(suite, equalOBoolGT); 7250 SUITE_ADD_TEST(suite, equalODoubleGT); 7251 SUITE_ADD_TEST(suite, equalOInt64GT); 7252 SUITE_ADD_TEST(suite, equalOInt32GT); 7253 SUITE_ADD_TEST(suite, equalOUint32GT); 7254 SUITE_ADD_TEST(suite, equalOUint64GT); 7255 SUITE_ADD_TEST(suite, equalOSmallArrayGT); 7256 SUITE_ADD_TEST(suite, equalOSmallBoolGT); 7257 SUITE_ADD_TEST(suite, equalOSmallBytesGT); 7258 SUITE_ADD_TEST(suite, equalOSmallDoubleGT); 7259 SUITE_ADD_TEST(suite, equalOSmallDictGT); 7260 SUITE_ADD_TEST(suite, equalOSmallIntGT); 7261 SUITE_ADD_TEST(suite, equalOSmallJsonGT); 7262 SUITE_ADD_TEST(suite, equalOSmallStringGT); 7263 SUITE_ADD_TEST(suite, equalBoolChaGT); 7264 SUITE_ADD_TEST(suite, equalBoolCharGT); 7265 SUITE_ADD_TEST(suite, equalBoolOGT); 7266 SUITE_ADD_TEST(suite, equalBoolFGT); 7267 SUITE_ADD_TEST(suite, equalBoolDoubleGT); 7268 SUITE_ADD_TEST(suite, equalBoolInt64GT); 7269 SUITE_ADD_TEST(suite, equalBoolInt32GT); 7270 SUITE_ADD_TEST(suite, equalBoolUint32GT); 7271 SUITE_ADD_TEST(suite, equalBoolUint64GT); 7272 SUITE_ADD_TEST(suite, equalBoolSmallBoolGT); 7273 SUITE_ADD_TEST(suite, equalBoolSmallBytesGT); 7274 SUITE_ADD_TEST(suite, equalBoolSmallDoubleGT); 7275 SUITE_ADD_TEST(suite, equalBoolSmallIntGT); 7276 SUITE_ADD_TEST(suite, equalBoolSmallJsonGT); 7277 SUITE_ADD_TEST(suite, equalBoolSmallStringGT); 7278 SUITE_ADD_TEST(suite, equalDoubleChaGT); 7279 SUITE_ADD_TEST(suite, equalDoubleCharGT); 7280 SUITE_ADD_TEST(suite, equalDoubleBaseGT); 7281 SUITE_ADD_TEST(suite, equalDoubleBoolGT); 7282 SUITE_ADD_TEST(suite, equalDoubleFGT); 7283 SUITE_ADD_TEST(suite, equalDoubleInt64GT); 7284 SUITE_ADD_TEST(suite, equalDoubleInt32GT); 7285 SUITE_ADD_TEST(suite, equalDoubleUint32GT); 7286 SUITE_ADD_TEST(suite, equalDoubleUint64GT); 7287 SUITE_ADD_TEST(suite, equalDoubleSmallBoolGT); 7288 SUITE_ADD_TEST(suite, equalDoubleSmallBytesGT); 7289 SUITE_ADD_TEST(suite, equalDoubleSmallDoubleGT); 7290 SUITE_ADD_TEST(suite, equalDoubleSmallIntGT); 7291 SUITE_ADD_TEST(suite, equalDoubleSmallJsonGT); 7292 SUITE_ADD_TEST(suite, equalDoubleSmallStringGT); 7293 SUITE_ADD_TEST(suite, equalInt64ChaGT); 7294 SUITE_ADD_TEST(suite, equalInt64CharGT); 7295 SUITE_ADD_TEST(suite, equalInt64BaseGT); 7296 SUITE_ADD_TEST(suite, equalInt64BoolGT); 7297 SUITE_ADD_TEST(suite, equalInt64DoubleGT); 7298 SUITE_ADD_TEST(suite, equalInt64FGT); 7299 SUITE_ADD_TEST(suite, equalInt64Int32GT); 7300 SUITE_ADD_TEST(suite, equalInt64Uint32GT); 7301 SUITE_ADD_TEST(suite, equalInt64Uint64GT); 7302 SUITE_ADD_TEST(suite, equalInt64SmallBoolGT); 7303 SUITE_ADD_TEST(suite, equalInt64SmallBytesGT); 7304 SUITE_ADD_TEST(suite, equalInt64SmallDoubleGT); 7305 SUITE_ADD_TEST(suite, equalInt64SmallIntGT); 7306 SUITE_ADD_TEST(suite, equalInt64SmallJsonGT); 7307 SUITE_ADD_TEST(suite, equalInt64SmallStringGT); 7308 SUITE_ADD_TEST(suite, equalInt32ChaGT); 7309 SUITE_ADD_TEST(suite, equalInt32CharGT); 7310 SUITE_ADD_TEST(suite, equalInt32BaseGT); 7311 SUITE_ADD_TEST(suite, equalInt32BoolGT); 7312 SUITE_ADD_TEST(suite, equalInt32DoubleGT); 7313 SUITE_ADD_TEST(suite, equalInt32Int64GT); 7314 SUITE_ADD_TEST(suite, equalInt32FGT); 7315 SUITE_ADD_TEST(suite, equalInt32Uint32GT); 7316 SUITE_ADD_TEST(suite, equalInt32Uint64GT); 7317 SUITE_ADD_TEST(suite, equalInt32SmallBoolGT); 7318 SUITE_ADD_TEST(suite, equalInt32SmallBytesGT); 7319 SUITE_ADD_TEST(suite, equalInt32SmallDoubleGT); 7320 SUITE_ADD_TEST(suite, equalInt32SmallIntGT); 7321 SUITE_ADD_TEST(suite, equalInt32SmallJsonGT); 7322 SUITE_ADD_TEST(suite, equalInt32SmallStringGT); 7323 SUITE_ADD_TEST(suite, equalUint32ChaGT); 7324 SUITE_ADD_TEST(suite, equalUint32CharGT); 7325 SUITE_ADD_TEST(suite, equalUint32BaseGT); 7326 SUITE_ADD_TEST(suite, equalUint32BoolGT); 7327 SUITE_ADD_TEST(suite, equalUint32DoubleGT); 7328 SUITE_ADD_TEST(suite, equalUint32Int64GT); 7329 SUITE_ADD_TEST(suite, equalUint32Int32GT); 7330 SUITE_ADD_TEST(suite, equalUint32FGT); 7331 SUITE_ADD_TEST(suite, equalUint32Uint64GT); 7332 SUITE_ADD_TEST(suite, equalUint32SmallBoolGT); 7333 SUITE_ADD_TEST(suite, equalUint32SmallBytesGT); 7334 SUITE_ADD_TEST(suite, equalUint32SmallDoubleGT); 7335 SUITE_ADD_TEST(suite, equalUint32SmallIntGT); 7336 SUITE_ADD_TEST(suite, equalUint32SmallJsonGT); 7337 SUITE_ADD_TEST(suite, equalUint32SmallStringGT); 7338 SUITE_ADD_TEST(suite, equalUint64ChaGT); 7339 SUITE_ADD_TEST(suite, equalUint64CharGT); 7340 SUITE_ADD_TEST(suite, equalUint64BaseGT); 7341 SUITE_ADD_TEST(suite, equalUint64BoolGT); 7342 SUITE_ADD_TEST(suite, equalUint64DoubleGT); 7343 SUITE_ADD_TEST(suite, equalUint64Int64GT); 7344 SUITE_ADD_TEST(suite, equalUint64Int32GT); 7345 SUITE_ADD_TEST(suite, equalUint64Uint32GT); 7346 SUITE_ADD_TEST(suite, equalUint64FGT); 7347 SUITE_ADD_TEST(suite, equalUint64SmallBoolGT); 7348 SUITE_ADD_TEST(suite, equalUint64SmallBytesGT); 7349 SUITE_ADD_TEST(suite, equalUint64SmallDoubleGT); 7350 SUITE_ADD_TEST(suite, equalUint64SmallIntGT); 7351 SUITE_ADD_TEST(suite, equalUint64SmallJsonGT); 7352 SUITE_ADD_TEST(suite, equalUint64SmallStringGT); 7353 SUITE_ADD_TEST(suite, notEqualCharGT); 7354 SUITE_ADD_TEST(suite, notEqualOCharGT); 7355 SUITE_ADD_TEST(suite, notEqualOGT); 7356 SUITE_ADD_TEST(suite, notEqualCCOGT); 7357 SUITE_ADD_TEST(suite, notEqualBoolOGT); 7358 SUITE_ADD_TEST(suite, notEqualDoubleOGT); 7359 SUITE_ADD_TEST(suite, notEqualInt64OGT); 7360 SUITE_ADD_TEST(suite, notEqualInt32OGT); 7361 SUITE_ADD_TEST(suite, notEqualUint32OGT); 7362 SUITE_ADD_TEST(suite, notEqualUint64OGT); 7363 SUITE_ADD_TEST(suite, notEqualOBoolGT); 7364 SUITE_ADD_TEST(suite, notEqualDoubleGT); 7365 SUITE_ADD_TEST(suite, notEqualOInt64GT); 7366 SUITE_ADD_TEST(suite, notEqualOInt32GT); 7367 SUITE_ADD_TEST(suite, notEqualOUint32GT); 7368 SUITE_ADD_TEST(suite, notEqualOUint64GT); 7369 SUITE_ADD_TEST(suite, icEqCharCharT); 7370 SUITE_ADD_TEST(suite, icEqualChaOGT); 7371 SUITE_ADD_TEST(suite, icEqualChaSmallJsonGT); 7372 SUITE_ADD_TEST(suite, icEqualChaSmallStringGT); 7373 SUITE_ADD_TEST(suite, icEqualCharOGT); 7374 SUITE_ADD_TEST(suite, icEqualCharPSmallJsonGT); 7375 SUITE_ADD_TEST(suite, icEqualCharPSmallStringGT); 7376 SUITE_ADD_TEST(suite, icEqualArrayOGT); 7377 SUITE_ADD_TEST(suite, icEqualCArrayOGT); 7378 SUITE_ADD_TEST(suite, icEqualArraySmallJsonGT); 7379 SUITE_ADD_TEST(suite, icEqualArraySmallArrayGT); 7380 SUITE_ADD_TEST(suite, icEqualCArraySmallJsonGT); 7381 SUITE_ADD_TEST(suite, icEqualCArraySmallArrayGT); 7382 SUITE_ADD_TEST(suite, icEqualOCharGT); 7383 SUITE_ADD_TEST(suite, icEqualOChaGT); 7384 SUITE_ADD_TEST(suite, icEqualOArrayGT); 7385 SUITE_ADD_TEST(suite, icEqualOCArrayGT); 7386 SUITE_ADD_TEST(suite, icEqualOOGT); 7387 SUITE_ADD_TEST(suite, icEqualOSmallArrayGT); 7388 SUITE_ADD_TEST(suite, icEqualOSmallDictGT); 7389 SUITE_ADD_TEST(suite, icEqualOSmallJsonGT); 7390 SUITE_ADD_TEST(suite, icEqualOSmallStringGT); 7391 SUITE_ADD_TEST(suite, cpuCountT); 7392 SUITE_ADD_TEST(suite, registerFinalizeRecycleContainersInThreadPoolT); 7393 SUITE_ADD_TEST(suite, initLibsheepyObjectT); 7394 SUITE_ADD_TEST(suite, putsOT); 7395 SUITE_ADD_TEST(suite, execOT); 7396 SUITE_ADD_TEST(suite, walkDirOT); 7397 SUITE_ADD_TEST(suite, expandHomeOT); 7398 SUITE_ADD_TEST(suite, chDirOT); 7399 SUITE_ADD_TEST(suite, fileExistsOT); 7400 SUITE_ADD_TEST(suite, fileChmodOT); 7401 SUITE_ADD_TEST(suite, fileSizeOT); 7402 SUITE_ADD_TEST(suite, mkdirParentsOT); 7403 SUITE_ADD_TEST(suite, rmAllOT); 7404 SUITE_ADD_TEST(suite, copyOT); 7405 SUITE_ADD_TEST(suite, randomSOT); 7406 SUITE_ADD_TEST(suite, randomAlphaNumSOT); 7407 SUITE_ADD_TEST(suite, readLineOT); 7408 SUITE_ADD_TEST(suite, toSmalltT); 7409 SUITE_ADD_TEST(suite, toBasetT); 7410 7411 7412 CuSuiteRun(suite); 7413 CuSuiteDetails(suite, output); 7414 printf ("%s\n", output->buffer); 7415 return suite->failCount; 7416 }