libsheepyCSmallDictTest.c (332306B)
1 #include <stdlib.h> 2 #include <stdio.h> 3 #include <check.h> 4 5 //START MEM TEST ANCHOR 6 7 #include "../libsheepy.h" 8 #include "../libsheepyObject.h" 9 10 #ifdef __GNUC__ 11 #define UNUSED __attribute__ ((unused)) 12 #else 13 #define UNUSED 14 #endif 15 16 // TODO redirect stderr 17 18 19 START_TEST(getsoSmallDictT) 20 21 sDictt* r; 22 smallDictt *self = allocG(rtSmallDictt); 23 24 self->f->setS(self, "qwe", "asd"); 25 r = getsoO(self); 26 ck_assert_ptr_eq(r, self->d); 27 terminateO(self); 28 29 END_TEST 30 31 32 START_TEST(setsoSmallDictT) 33 34 smallDictt *self = allocG(rtSmallDictt); 35 sDictt *so; 36 37 createSmallDict(d); 38 (&d)->f->setS(&d, "1", "1"); 39 (&d)->f->setS(&d, "2", "2"); 40 char *as = null; 41 // reset test: free iterElement in d 42 iter(&d, E) { 43 as = toStringO(E); 44 break; 45 } 46 ck_assert_ptr_ne(as, null); 47 ck_assert_str_eq(as, "1"); 48 free(as); 49 so = getsoO(&d); 50 resetO(&d); 51 setsoO(self, so); 52 ck_assert_ptr_eq(so, self->d); 53 terminateO(self); 54 55 END_TEST 56 57 58 START_TEST(mirrorSmallDictT) 59 60 smallDictt* r; 61 smallDictt *self = allocG(rtSmallDictt); 62 63 // empty self 64 r = mirrorO(self); 65 ck_assert_ptr_eq(r->d, null); 66 finishO(r); 67 // non empty with iterator 68 self->f->setS(self, "1", "1"); 69 self->f->setS(self, "2", "2"); 70 char *as = null; 71 iter(self, E) { 72 as = toStringO(E); 73 break; 74 } 75 ck_assert_str_eq(as, "1"); 76 free(as); 77 r = mirrorO(self); 78 ck_assert_ptr_eq(r->d, self->d); 79 finishO(r); 80 terminateO(self); 81 82 END_TEST 83 84 85 START_TEST(setUndefinedSmallDictT) 86 87 smallDictt* r; 88 smallDictt *self = allocG(rtSmallDictt); 89 90 r = self->f->setUndefined(self, "1"); 91 ck_assert_ptr_ne(r, null); 92 char *s = toStringO(r); 93 ck_assert_str_eq(s, "{\"1\":null}"); 94 free(s); 95 // null key 96 r = self->f->setUndefined(self, null); 97 ck_assert_ptr_eq(r, null); 98 terminateO(self); 99 100 END_TEST 101 102 103 START_TEST(setBoolSmallDictT) 104 105 smallDictt* r; 106 smallDictt *self = allocG(rtSmallDictt); 107 108 r = self->f->setBool(self, "1", true); 109 ck_assert_ptr_ne(r, null); 110 char *s = toStringO(r); 111 ck_assert_str_eq(s, "{\"1\":true}"); 112 free(s); 113 // null key 114 r = self->f->setBool(self, null, false); 115 ck_assert_ptr_eq(r, null); 116 terminateO(self); 117 118 END_TEST 119 120 121 START_TEST(setDoubleSmallDictT) 122 123 smallDictt* r; 124 smallDictt *self = allocG(rtSmallDictt); 125 126 r = self->f->setDouble(self, "1", 2.2); 127 ck_assert_ptr_ne(r, null); 128 char *s = toStringO(r); 129 ck_assert_str_eq(s, "{\"1\":2.200000e+00}"); 130 free(s); 131 // null key 132 r = self->f->setDouble(self, null, 1); 133 ck_assert_ptr_eq(r, null); 134 terminateO(self); 135 136 END_TEST 137 138 139 START_TEST(setIntSmallDictT) 140 141 smallDictt* r; 142 smallDictt *self = allocG(rtSmallDictt); 143 144 r = self->f->setInt(self, "1", 2); 145 ck_assert_ptr_ne(r, null); 146 char *s = toStringO(r); 147 ck_assert_str_eq(s, "{\"1\":2}"); 148 free(s); 149 // null key 150 r = self->f->setInt(self, null, 1); 151 ck_assert_ptr_eq(r, null); 152 terminateO(self); 153 154 END_TEST 155 156 157 START_TEST(setSSmallDictT) 158 159 smallDictt* r; 160 smallDictt *self = allocG(rtSmallDictt); 161 162 r = self->f->setS(self, "1", "qwe"); 163 ck_assert_ptr_ne(r, null); 164 char *s = toStringO(r); 165 ck_assert_str_eq(s, "{\"1\":\"qwe\"}"); 166 free(s); 167 // null value 168 r = self->f->setS(self, "1", null); 169 ck_assert_ptr_eq(r, null); 170 // null key 171 r = self->f->setS(self, null, ""); 172 ck_assert_ptr_eq(r, null); 173 terminateO(self); 174 175 END_TEST 176 177 178 START_TEST(setCharSmallDictT) 179 180 smallDictt* r; 181 smallDictt *self = allocG(rtSmallDictt); 182 183 r = self->f->setChar(self, "1", 'x'); 184 ck_assert_ptr_ne(r, null); 185 char *s = toStringO(r); 186 ck_assert_str_eq(s, "{\"1\":\"x\"}"); 187 free(s); 188 // null key 189 r = self->f->setChar(self, null, '1'); 190 ck_assert_ptr_eq(r, null); 191 terminateO(self); 192 193 END_TEST 194 195 196 START_TEST(setDictSmallDictT) 197 198 smallDictt* r; 199 smallDictt *self = allocG(rtSmallDictt); 200 smallDictt *dict = allocSmallDict(); 201 202 // empty dict 203 r = self->f->setDict(self, "1", dict); 204 ck_assert_ptr_ne(r, null); 205 finishO(dict); 206 char *s = toStringO(r); 207 ck_assert_str_eq(s, "{\"1\":{}}"); 208 free(s); 209 // set dict 210 dict = allocSmallDict(); 211 dict->f->setS(dict, "a", "zxc"); 212 r = self->f->setDict(self, "1", dict); 213 ck_assert_ptr_ne(r, null); 214 finishO(dict); 215 s = toStringO(r); 216 ck_assert_str_eq(s, "{\"1\":{\"a\":\"zxc\"}}"); 217 free(s); 218 // non smallDict object 219 dict = (smallDictt*) allocSmallInt(2); 220 r = self->f->setDict(self, "1", dict); 221 ck_assert_ptr_eq(r, null); 222 terminateO(dict); 223 // null value 224 r = self->f->setDict(self, "1", null); 225 ck_assert_ptr_eq(r, null); 226 // null key 227 r = self->f->setDict(self, null, dict); 228 ck_assert_ptr_eq(r, null); 229 terminateO(self); 230 231 END_TEST 232 233 234 START_TEST(setArraySmallDictT) 235 236 smallDictt* r; 237 smallDictt *self = allocG(rtSmallDictt); 238 smallArrayt *array = allocSmallArray(); 239 240 // empty array 241 r = self->f->setArray(self, "1", array); 242 ck_assert_ptr_ne(r, null); 243 finishO(array); 244 char *s = toStringO(r); 245 ck_assert_str_eq(s, "{\"1\":[]}"); 246 free(s); 247 // set array 248 array = allocSmallArray(); 249 array->f->pushS(array, "zxc"); 250 r = self->f->setArray(self, "1", array); 251 ck_assert_ptr_ne(r, null); 252 finishO(array); 253 s = toStringO(r); 254 ck_assert_str_eq(s, "{\"1\":[\"zxc\"]}"); 255 free(s); 256 // non smallArray object 257 array = (smallArrayt*) allocSmallInt(2); 258 r = self->f->setArray(self, "1", array); 259 ck_assert_ptr_eq(r, null); 260 terminateO(array); 261 // null value 262 r = self->f->setArray(self, "1", null); 263 ck_assert_ptr_eq(r, null); 264 // null key 265 r = self->f->setArray(self, null, array); 266 ck_assert_ptr_eq(r, null); 267 terminateO(self); 268 269 END_TEST 270 271 272 START_TEST(setArraycSmallDictT) 273 274 smallDictt* r; 275 smallDictt *self = allocG(rtSmallDictt); 276 char **array = listCreateS("a", "b"); 277 278 r = self->f->setArrayc(self, "1", array); 279 ck_assert_ptr_ne(r, null); 280 char *s = toStringO(r); 281 ck_assert_str_eq(s, "{\"1\":[\"a\",\"b\"]}"); 282 free(s); 283 // zero element list 284 char *e0 = array[0]; 285 array[0] = null; 286 r = self->f->setArrayc(self, "1", array); 287 ck_assert_ptr_ne(r, null); 288 array[0] = e0; 289 listFreeS(array); 290 s = toStringO(r); 291 ck_assert_str_eq(s, "{\"1\":[]}"); 292 free(s); 293 // null value 294 r = self->f->setArrayc(self, "1", null); 295 ck_assert_ptr_eq(r, null); 296 // null key 297 r = self->f->setArrayc(self, null, array); 298 ck_assert_ptr_eq(r, null); 299 terminateO(self); 300 301 END_TEST 302 303 304 START_TEST(setSmallBoolSmallDictT) 305 306 smallDictt* r; 307 smallDictt *self = allocG(rtSmallDictt); 308 smallBoolt *value = allocSmallBool(true); 309 310 r = self->f->setSmallBool(self, "1", value); 311 ck_assert_ptr_ne(r, null); 312 char *s = toStringO(r); 313 ck_assert_str_eq(s, "{\"1\":true}"); 314 free(s); 315 // empty smallBool 316 value->value = null; 317 r = self->f->setSmallBool(self, "1", value); 318 ck_assert_ptr_ne(r, null); 319 finishO(value); 320 s = toStringO(r); 321 ck_assert_str_eq(s, "{\"1\":false}"); 322 free(s); 323 // non smallBool object 324 value = (smallBoolt*) allocSmallInt(2); 325 r = self->f->setSmallBool(self, "1", value); 326 ck_assert_ptr_eq(r, null); 327 terminateO(value); 328 // null value 329 r = self->f->setSmallBool(self, "1", null); 330 ck_assert_ptr_eq(r, null); 331 // null key 332 r = self->f->setSmallBool(self, null, value); 333 ck_assert_ptr_eq(r, null); 334 terminateO(self); 335 336 END_TEST 337 338 339 START_TEST(setSmallBytesSmallDictT) 340 341 smallDictt* r; 342 smallDictt *self = allocG(rtSmallDictt); 343 smallBytest *value = allocSmallBytes("qwe", sizeof("qwe")); 344 345 r = self->f->setSmallBytes(self, "1", value); 346 ck_assert_ptr_ne(r, null); 347 char *s = toStringO(r); 348 ck_assert_str_eq(s, "{\"1\":[0x71,0x77,0x65,0x00]}"); 349 free(s); 350 // empty smallBytes 351 value->B = null; 352 r = self->f->setSmallBytes(self, "1", value); 353 ck_assert_ptr_ne(r, null); 354 finishO(value); 355 s = toStringO(r); 356 ck_assert_str_eq(s, "{\"1\":[]}"); 357 free(s); 358 // non smallByes object 359 value = (smallBytest*) allocSmallInt(2); 360 r = self->f->setSmallBytes(self, "1", value); 361 ck_assert_ptr_eq(r, null); 362 terminateO(value); 363 // null value 364 r = self->f->setSmallBytes(self, "1", null); 365 ck_assert_ptr_eq(r, null); 366 // null key 367 r = self->f->setSmallBytes(self, null, value); 368 ck_assert_ptr_eq(r, null); 369 terminateO(self); 370 371 END_TEST 372 373 374 START_TEST(setSmallDoubleSmallDictT) 375 376 smallDictt* r; 377 smallDictt *self = allocG(rtSmallDictt); 378 smallDoublet *value = allocSmallDouble(2.2); 379 380 r = self->f->setSmallDouble(self, "1", value); 381 ck_assert_ptr_ne(r, null); 382 char *s = toStringO(r); 383 ck_assert_str_eq(s, "{\"1\":2.200000e+00}"); 384 free(s); 385 // empty smallDouble 386 value->value = null; 387 r = self->f->setSmallDouble(self, "1", value); 388 ck_assert_ptr_ne(r, null); 389 finishO(value); 390 s = toStringO(r); 391 ck_assert_str_eq(s, "{\"1\":0.000000e+00}"); 392 free(s); 393 // non smallDouble object 394 value = (smallDoublet*) allocSmallInt(2); 395 r = self->f->setSmallDouble(self, "1", value); 396 ck_assert_ptr_eq(r, null); 397 terminateO(value); 398 // null value 399 r = self->f->setSmallDouble(self, "1", null); 400 ck_assert_ptr_eq(r, null); 401 // null key 402 r = self->f->setSmallDouble(self, null, value); 403 ck_assert_ptr_eq(r, null); 404 terminateO(self); 405 406 END_TEST 407 408 409 START_TEST(setSmallIntSmallDictT) 410 411 smallDictt* r; 412 smallDictt *self = allocG(rtSmallDictt); 413 smallIntt *value = allocSmallInt(2); 414 415 r = self->f->setSmallInt(self, "1", value); 416 ck_assert_ptr_ne(r, null); 417 char *s = toStringO(r); 418 ck_assert_str_eq(s, "{\"1\":2}"); 419 free(s); 420 // empty smallInt 421 value->value = null; 422 r = self->f->setSmallInt(self, "1", value); 423 ck_assert_ptr_ne(r, null); 424 finishO(value); 425 s = toStringO(r); 426 ck_assert_str_eq(s, "{\"1\":0}"); 427 free(s); 428 // non smallInt object 429 value = (smallIntt*) allocSmallBool(true); 430 r = self->f->setSmallInt(self, "1", value); 431 ck_assert_ptr_eq(r, null); 432 terminateO(value); 433 // null value 434 r = self->f->setSmallInt(self, "1", null); 435 ck_assert_ptr_eq(r, null); 436 // null key 437 r = self->f->setSmallInt(self, null, value); 438 ck_assert_ptr_eq(r, null); 439 terminateO(self); 440 441 END_TEST 442 443 444 START_TEST(setSmallJsonSmallDictT) 445 446 smallDictt* r; 447 smallDictt *self = allocG(rtSmallDictt); 448 smallJsont *value = allocSmallJson(); 449 450 setTopIntO(value, 2); 451 r = self->f->setSmallJson(self, "1", value); 452 ck_assert_ptr_ne(r, null); 453 char *s = toStringO(r); 454 ck_assert_str_eq(s, "{\"1\":2}"); 455 free(s); 456 // empty smallJson 457 resetO(value); 458 r = self->f->setSmallJson(self, "1", value); 459 ck_assert_ptr_ne(r, null); 460 finishO(value); 461 s = toStringO(r); 462 ck_assert_str_eq(s, "{\"1\":{}}"); 463 free(s); 464 // non smallJson object 465 value = (smallJsont*) allocSmallInt(2); 466 r = self->f->setSmallJson(self, "1", value); 467 ck_assert_ptr_eq(r, null); 468 terminateO(value); 469 // null value 470 r = self->f->setSmallJson(self, "1", null); 471 ck_assert_ptr_eq(r, null); 472 // null key 473 r = self->f->setSmallJson(self, null, value); 474 ck_assert_ptr_eq(r, null); 475 terminateO(self); 476 477 END_TEST 478 479 480 START_TEST(setSmallStringSmallDictT) 481 482 smallDictt* r; 483 smallDictt *self = allocG(rtSmallDictt); 484 smallStringt *string = allocSmallString("qwe"); 485 486 r = self->f->setSmallString(self, "1", string); 487 ck_assert_ptr_ne(r, null); 488 char *s = toStringO(r); 489 ck_assert_str_eq(s, "{\"1\":\"qwe\"}"); 490 free(s); 491 // empty smallString 492 string->data = null; 493 r = self->f->setSmallString(self, "1", string); 494 ck_assert_ptr_ne(r, null); 495 finishO(string); 496 s = toStringO(r); 497 ck_assert_str_eq(s, "{\"1\":\"\"}"); 498 free(s); 499 // non smallString object 500 string = (smallStringt*) allocSmallInt(2); 501 r = self->f->setSmallString(self, "1", string); 502 ck_assert_ptr_eq(r, null); 503 terminateO(string); 504 // null value 505 r = self->f->setSmallString(self, "1", null); 506 ck_assert_ptr_eq(r, null); 507 // null key 508 r = self->f->setSmallString(self, null, string); 509 ck_assert_ptr_eq(r, null); 510 terminateO(self); 511 512 END_TEST 513 514 515 START_TEST(setSmallContainerSmallDictT) 516 517 smallDictt* r; 518 smallDictt *self = allocG(rtSmallDictt); 519 smallContainert *container = allocSmallContainer(null); 520 521 r = self->f->setSmallContainer(self, "1", container); 522 ck_assert_ptr_ne(r, null); 523 char *s = toStringO(r); 524 ck_assert_str_eq(s, "{\"1\":\"<data container>\"}"); 525 free(s); 526 // empty smallContainer 527 container->data = null; 528 r = self->f->setSmallContainer(self, "1", container); 529 ck_assert_ptr_ne(r, null); 530 finishO(container); 531 s = toStringO(r); 532 ck_assert_str_eq(s, "{\"1\":\"<data container>\"}"); 533 free(s); 534 // non smallContainer object 535 container = (smallContainert*) allocSmallInt(2); 536 r = self->f->setSmallContainer(self, "1", container); 537 ck_assert_ptr_eq(r, null); 538 terminateO(container); 539 // null value 540 r = self->f->setSmallContainer(self, "1", null); 541 ck_assert_ptr_eq(r, null); 542 // null key 543 r = self->f->setSmallContainer(self, null, container); 544 ck_assert_ptr_eq(r, null); 545 terminateO(self); 546 547 END_TEST 548 549 550 START_TEST(setKCharSmallDictT) 551 552 smallDictt* r; 553 smallDictt *self = allocG(rtSmallDictt); 554 baset *value = (baset*) allocSmallInt(2); 555 556 r = setKCharO(self, '1', value); 557 char *s = toStringO(r); 558 ck_assert_str_eq(s, "{\"1\":2}"); 559 free(s); 560 finishO(value); 561 terminateO(self); 562 563 END_TEST 564 565 566 START_TEST(setUndefinedKCharSmallDictT) 567 568 smallDictt* r; 569 smallDictt *self = allocG(rtSmallDictt); 570 571 r = setUndefinedKCharO(self, '1'); 572 char *s = toStringO(r); 573 ck_assert_str_eq(s, "{\"1\":null}"); 574 free(s); 575 terminateO(self); 576 577 END_TEST 578 579 580 START_TEST(setBoolKCharSmallDictT) 581 582 smallDictt* r; 583 smallDictt *self = allocG(rtSmallDictt); 584 585 r = setBoolKCharO(self, '1', true); 586 char *s = toStringO(r); 587 ck_assert_str_eq(s, "{\"1\":true}"); 588 free(s); 589 terminateO(self); 590 591 END_TEST 592 593 594 START_TEST(setDoubleKCharSmallDictT) 595 596 smallDictt* r; 597 smallDictt *self = allocG(rtSmallDictt); 598 599 r = setDoubleKCharO(self, '1', 2.2); 600 char *s = toStringO(r); 601 ck_assert_str_eq(s, "{\"1\":2.200000e+00}"); 602 free(s); 603 terminateO(self); 604 605 END_TEST 606 607 608 START_TEST(setIntKCharSmallDictT) 609 610 smallDictt* r; 611 smallDictt *self = allocG(rtSmallDictt); 612 613 r = setIntKCharO(self, '1', 2); 614 char *s = toStringO(r); 615 ck_assert_str_eq(s, "{\"1\":2}"); 616 free(s); 617 terminateO(self); 618 619 END_TEST 620 621 622 START_TEST(setSKCharSmallDictT) 623 624 smallDictt* r; 625 smallDictt *self = allocG(rtSmallDictt); 626 627 r = setSKCharO(self, '1', "qwe"); 628 char *s = toStringO(r); 629 ck_assert_str_eq(s, "{\"1\":\"qwe\"}"); 630 free(s); 631 terminateO(self); 632 633 END_TEST 634 635 636 START_TEST(setCharKCharSmallDictT) 637 638 smallDictt* r; 639 smallDictt *self = allocG(rtSmallDictt); 640 641 r = setCharKCharO(self, '1', 'c'); 642 char *s = toStringO(r); 643 ck_assert_str_eq(s, "{\"1\":\"c\"}"); 644 free(s); 645 terminateO(self); 646 647 END_TEST 648 649 650 START_TEST(setDictKCharSmallDictT) 651 652 smallDictt* r; 653 smallDictt *self = allocG(rtSmallDictt); 654 smallDictt *dict = allocSmallDict(); 655 656 r = setDictKCharO(self, '1', dict); 657 char *s = toStringO(r); 658 ck_assert_str_eq(s, "{\"1\":{}}"); 659 free(s); 660 finishO(dict); 661 terminateO(self); 662 663 END_TEST 664 665 666 START_TEST(setArrayKCharSmallDictT) 667 668 smallDictt* r; 669 smallDictt *self = allocG(rtSmallDictt); 670 smallArrayt *array = allocSmallArray(); 671 672 r = setArrayKCharO(self, '1', array); 673 char *s = toStringO(r); 674 ck_assert_str_eq(s, "{\"1\":[]}"); 675 free(s); 676 finishO(array); 677 terminateO(self); 678 679 END_TEST 680 681 682 START_TEST(setArraycKCharSmallDictT) 683 684 smallDictt* r; 685 smallDictt *self = allocG(rtSmallDictt); 686 char **array = listCreateS("a", "bb"); 687 688 r = setArraycKCharO(self, '1', array); 689 char *s = toStringO(r); 690 ck_assert_str_eq(s, "{\"1\":[\"a\",\"bb\"]}"); 691 free(s); 692 listFreeS(array); 693 terminateO(self); 694 695 END_TEST 696 697 698 START_TEST(setSmallBoolKCharSmallDictT) 699 700 smallDictt* r; 701 smallDictt *self = allocG(rtSmallDictt); 702 smallBoolt *value = allocSmallBool(true); 703 704 r = setSmallBoolKCharO(self, '1', value); 705 char *s = toStringO(r); 706 ck_assert_str_eq(s, "{\"1\":true}"); 707 free(s); 708 finishO(value); 709 terminateO(self); 710 711 END_TEST 712 713 714 START_TEST(setSmallBytesKCharSmallDictT) 715 716 smallDictt* r; 717 smallDictt *self = allocG(rtSmallDictt); 718 smallBytest *value = allocSmallBytes("qwe", sizeof("qwe")); 719 720 r = setSmallBytesKCharO(self, '1', value); 721 char *s = toStringO(r); 722 ck_assert_str_eq(s, "{\"1\":[0x71,0x77,0x65,0x00]}"); 723 free(s); 724 finishO(value); 725 terminateO(self); 726 727 END_TEST 728 729 730 START_TEST(setSmallDoubleKCharSmallDictT) 731 732 smallDictt* r; 733 smallDictt *self = allocG(rtSmallDictt); 734 smallDoublet *value = allocSmallDouble(2.2); 735 736 r = setSmallDoubleKCharO(self, '1', value); 737 char *s = toStringO(r); 738 ck_assert_str_eq(s, "{\"1\":2.200000e+00}"); 739 free(s); 740 finishO(value); 741 terminateO(self); 742 743 END_TEST 744 745 746 START_TEST(setSmallIntKCharSmallDictT) 747 748 smallDictt* r; 749 smallDictt *self = allocG(rtSmallDictt); 750 smallIntt *value = allocSmallInt(2); 751 752 r = setSmallIntKCharO(self, '1', value); 753 char *s = toStringO(r); 754 ck_assert_str_eq(s, "{\"1\":2}"); 755 free(s); 756 finishO(value); 757 terminateO(self); 758 759 END_TEST 760 761 762 START_TEST(setSmallJsonKCharSmallDictT) 763 764 smallDictt* r; 765 smallDictt *self = allocG(rtSmallDictt); 766 smallJsont *value = allocSmallJson(); 767 768 r = setSmallJsonKCharO(self, '1', value); 769 char *s = toStringO(r); 770 ck_assert_str_eq(s, "{\"1\":{}}"); 771 free(s); 772 finishO(value); 773 terminateO(self); 774 775 END_TEST 776 777 778 START_TEST(setSmallStringKCharSmallDictT) 779 780 smallDictt* r; 781 smallDictt *self = allocG(rtSmallDictt); 782 smallStringt *string = allocSmallString("qwe"); 783 784 r = setSmallStringKCharO(self, '1', string); 785 char *s = toStringO(r); 786 ck_assert_str_eq(s, "{\"1\":\"qwe\"}"); 787 free(s); 788 finishO(string); 789 terminateO(self); 790 791 END_TEST 792 793 794 START_TEST(setSmallContainerKCharSmallDictT) 795 796 smallDictt* r; 797 smallDictt *self = allocG(rtSmallDictt); 798 smallContainert *container = allocSmallContainer(null); 799 800 r = setSmallContainerKCharO(self, '1', container); 801 char *s = toStringO(r); 802 ck_assert_str_eq(s, "{\"1\":\"<data container>\"}"); 803 free(s); 804 finishO(container); 805 terminateO(self); 806 807 END_TEST 808 809 810 START_TEST(setNFreeSmallDictT) 811 812 smallDictt* r; 813 smallDictt *self = allocG(rtSmallDictt); 814 baset *value; 815 816 // undefined object 817 value = (baset*)allocUndefined(); 818 r = self->f->setNFree(self, "1", value); 819 ck_assert_ptr_ne(r, null); 820 char *s = toStringO(r); 821 ck_assert_str_eq(s, "{\"1\":null}"); 822 free(s); 823 // container 824 createAllocateSmallContainer(c); 825 r = self->f->setNFree(self, "1", (baset*)c); 826 ck_assert_ptr_ne(r, null); 827 s = toStringO(r); 828 ck_assert_str_eq(s, "{\"1\":\"<data container>\"}"); 829 free(s); 830 // base object in container 831 createAllocateSmallInt(I); 832 setValG(I, 11); 833 I->type = "anothertype"; 834 r = self->f->setNFree(self, "1", (baset*)I); 835 ck_assert_ptr_ne(r, null); 836 s = toStringO(r); 837 ck_assert_str_eq(s, "{\"1\":\"<data container>\"}"); 838 free(s); 839 // null value 840 r = self->f->setNFree(self, "1", null); 841 ck_assert_ptr_eq(r, null); 842 // null key 843 r = self->f->setNFree(self, null, value); 844 ck_assert_ptr_eq(r, null); 845 terminateO(self); 846 847 END_TEST 848 849 850 START_TEST(setNFreeUndefinedSmallDictT) 851 852 smallDictt* r; 853 smallDictt *self = allocG(rtSmallDictt); 854 undefinedt *undefined = allocUndefined(); 855 856 r = self->f->setNFreeUndefined(self, "1", undefined); 857 ck_assert_ptr_ne(r, null); 858 char *s = toStringO(r); 859 ck_assert_str_eq(s, "{\"1\":null}"); 860 free(s); 861 // null value 862 r = self->f->setNFreeUndefined(self, "1", null); 863 ck_assert_ptr_eq(r, null); 864 // null key 865 undefined = allocUndefined(); 866 r = self->f->setNFreeUndefined(self, null, undefined); 867 ck_assert_ptr_eq(r, null); 868 terminateO(self); 869 terminateO(undefined); 870 871 END_TEST 872 873 874 START_TEST(setNFreeSSmallDictT) 875 876 smallDictt* r; 877 smallDictt *self = allocG(rtSmallDictt); 878 char *string = strdup("qwe"); 879 880 r = self->f->setNFreeS(self, "1", string); 881 ck_assert_ptr_ne(r, null); 882 char *s = toStringO(r); 883 ck_assert_str_eq(s, "{\"1\":\"qwe\"}"); 884 free(s); 885 // null value 886 r = self->f->setNFreeS(self, "1", null); 887 ck_assert_ptr_eq(r, null); 888 // null key 889 string = strdup("qwe"); 890 r = self->f->setNFreeS(self, null, string); 891 ck_assert_ptr_eq(r, null); 892 terminateO(self); 893 free(string); 894 895 END_TEST 896 897 898 START_TEST(setNFreeDictSmallDictT) 899 900 smallDictt* r; 901 smallDictt *self = allocG(rtSmallDictt); 902 smallDictt *dict = allocSmallDict(); 903 904 r = self->f->setNFreeDict(self, "1", dict); 905 ck_assert_ptr_ne(r, null); 906 char *s = toStringO(r); 907 ck_assert_str_eq(s, "{\"1\":{}}"); 908 free(s); 909 // null value 910 r = self->f->setNFreeDict(self, "1", null); 911 ck_assert_ptr_eq(r, null); 912 // null key 913 dict = allocSmallDict(); 914 r = self->f->setNFreeDict(self, null, dict); 915 ck_assert_ptr_eq(r, null); 916 terminateO(self); 917 terminateO(dict); 918 919 END_TEST 920 921 922 START_TEST(setNFreeArraySmallDictT) 923 924 smallDictt* r; 925 smallDictt *self = allocG(rtSmallDictt); 926 smallArrayt *array = allocSmallArray(); 927 928 // empty array 929 r = self->f->setNFreeArray(self, "1", array); 930 ck_assert_ptr_ne(r, null); 931 char *s = toStringO(r); 932 ck_assert_str_eq(s, "{\"1\":[]}"); 933 free(s); 934 // null value 935 r = self->f->setNFreeArray(self, "1", null); 936 ck_assert_ptr_eq(r, null); 937 // null key 938 r = self->f->setNFreeArray(self, null, array); 939 ck_assert_ptr_eq(r, null); 940 terminateO(self); 941 942 END_TEST 943 944 945 START_TEST(setNFreeArraycSmallDictT) 946 947 smallDictt* r; 948 smallDictt *self = allocG(rtSmallDictt); 949 char **array = listCreateS("a", "b"); 950 951 r = self->f->setNFreeArrayc(self, "1", array); 952 ck_assert_ptr_ne(r, null); 953 char *s = toStringO(r); 954 ck_assert_str_eq(s, "{\"1\":[\"a\",\"b\"]}"); 955 free(s); 956 // null value 957 r = self->f->setNFreeArrayc(self, "1", null); 958 ck_assert_ptr_eq(r, null); 959 // null key 960 r = self->f->setNFreeArrayc(self, null, array); 961 ck_assert_ptr_eq(r, null); 962 terminateO(self); 963 964 END_TEST 965 966 967 START_TEST(setNFreeSmallBoolSmallDictT) 968 969 smallDictt* r; 970 smallDictt *self = allocG(rtSmallDictt); 971 smallBoolt *value = allocSmallBool(true); 972 973 r = self->f->setNFreeSmallBool(self, "1", value); 974 ck_assert_ptr_ne(r, null); 975 char *s = toStringO(r); 976 ck_assert_str_eq(s, "{\"1\":true}"); 977 free(s); 978 // null value 979 r = self->f->setNFreeSmallBool(self, "1", null); 980 ck_assert_ptr_eq(r, null); 981 // null key 982 r = self->f->setNFreeSmallBool(self, null, value); 983 ck_assert_ptr_eq(r, null); 984 terminateO(self); 985 986 END_TEST 987 988 989 START_TEST(setNFreeSmallBytesSmallDictT) 990 991 smallDictt* r; 992 smallDictt *self = allocG(rtSmallDictt); 993 smallBytest *value = allocSmallBytes("qwe", sizeof("qwe")); 994 995 r = self->f->setNFreeSmallBytes(self, "1", value); 996 ck_assert_ptr_ne(r, null); 997 char *s = toStringO(r); 998 ck_assert_str_eq(s, "{\"1\":[0x71,0x77,0x65,0x00]}"); 999 free(s); 1000 // null value 1001 r = self->f->setNFreeSmallBytes(self, "1", null); 1002 ck_assert_ptr_eq(r, null); 1003 // null key 1004 r = self->f->setNFreeSmallBytes(self, null, value); 1005 ck_assert_ptr_eq(r, null); 1006 terminateO(self); 1007 1008 END_TEST 1009 1010 1011 START_TEST(setNFreeSmallDoubleSmallDictT) 1012 1013 smallDictt* r; 1014 smallDictt *self = allocG(rtSmallDictt); 1015 smallDoublet *value = allocSmallDouble(2.2); 1016 1017 r = self->f->setNFreeSmallDouble(self, "1", value); 1018 ck_assert_ptr_ne(r, null); 1019 char *s = toStringO(r); 1020 ck_assert_str_eq(s, "{\"1\":2.200000e+00}"); 1021 free(s); 1022 // null value 1023 r = self->f->setNFreeSmallDouble(self, "1", null); 1024 ck_assert_ptr_eq(r, null); 1025 // null key 1026 r = self->f->setNFreeSmallDouble(self, null, value); 1027 ck_assert_ptr_eq(r, null); 1028 terminateO(self); 1029 1030 END_TEST 1031 1032 1033 START_TEST(setNFreeSmallIntSmallDictT) 1034 1035 smallDictt* r; 1036 smallDictt *self = allocG(rtSmallDictt); 1037 smallIntt *value = allocSmallInt(2); 1038 1039 r = self->f->setNFreeSmallInt(self, "1", value); 1040 ck_assert_ptr_ne(r, null); 1041 char *s = toStringO(r); 1042 ck_assert_str_eq(s, "{\"1\":2}"); 1043 free(s); 1044 // null value 1045 r = self->f->setNFreeSmallInt(self, "1", null); 1046 ck_assert_ptr_eq(r, null); 1047 // null key 1048 r = self->f->setNFreeSmallInt(self, null, value); 1049 ck_assert_ptr_eq(r, null); 1050 terminateO(self); 1051 1052 END_TEST 1053 1054 1055 START_TEST(setNFreeSmallJsonSmallDictT) 1056 1057 smallDictt* r; 1058 smallDictt *self = allocG(rtSmallDictt); 1059 smallJsont *value = allocSmallJson(); 1060 1061 setTopIntO(value, 2); 1062 r = self->f->setNFreeSmallJson(self, "1", value); 1063 ck_assert_ptr_ne(r, null); 1064 char *s = toStringO(r); 1065 ck_assert_str_eq(s, "{\"1\":2}"); 1066 free(s); 1067 // null value 1068 r = self->f->setNFreeSmallJson(self, "1", null); 1069 ck_assert_ptr_eq(r, null); 1070 // null key 1071 r = self->f->setNFreeSmallJson(self, null, value); 1072 ck_assert_ptr_eq(r, null); 1073 terminateO(self); 1074 1075 END_TEST 1076 1077 1078 START_TEST(setNFreeSmallStringSmallDictT) 1079 1080 smallDictt* r; 1081 smallDictt *self = allocG(rtSmallDictt); 1082 smallStringt *string = allocSmallString("qwe"); 1083 1084 r = self->f->setNFreeSmallString(self, "1", string); 1085 ck_assert_ptr_ne(r, null); 1086 char *s = toStringO(r); 1087 ck_assert_str_eq(s, "{\"1\":\"qwe\"}"); 1088 free(s); 1089 // null value 1090 r = self->f->setNFreeSmallString(self, "1", null); 1091 ck_assert_ptr_eq(r, null); 1092 // null key 1093 r = self->f->setNFreeSmallString(self, null, string); 1094 ck_assert_ptr_eq(r, null); 1095 terminateO(self); 1096 1097 END_TEST 1098 1099 1100 START_TEST(setNFreeSmallContainerSmallDictT) 1101 1102 smallDictt* r; 1103 smallDictt *self = allocG(rtSmallDictt); 1104 smallContainert *container = allocSmallContainer(null); 1105 1106 r = self->f->setNFreeSmallContainer(self, "1", container); 1107 ck_assert_ptr_ne(r, null); 1108 char *s = toStringO(r); 1109 ck_assert_str_eq(s, "{\"1\":\"<data container>\"}"); 1110 free(s); 1111 // null value 1112 r = self->f->setNFreeSmallContainer(self, "1", null); 1113 ck_assert_ptr_eq(r, null); 1114 // null key 1115 r = self->f->setNFreeSmallContainer(self, null, container); 1116 ck_assert_ptr_eq(r, null); 1117 terminateO(self); 1118 1119 END_TEST 1120 1121 1122 START_TEST(setNFreeKCharSmallDictT) 1123 1124 smallDictt* r; 1125 smallDictt *self = allocG(rtSmallDictt); 1126 baset *value; 1127 1128 value = (baset*)allocUndefined(); 1129 r = self->f->setNFreeKChar(self, '1', value); 1130 ck_assert_ptr_ne(r, null); 1131 char *s = toStringO(r); 1132 ck_assert_str_eq(s, "{\"1\":null}"); 1133 free(s); 1134 terminateO(self); 1135 1136 END_TEST 1137 1138 1139 START_TEST(setNFreeUndefinedKCharSmallDictT) 1140 1141 smallDictt* r; 1142 smallDictt *self = allocG(rtSmallDictt); 1143 undefinedt *undefined = allocUndefined(); 1144 1145 r = self->f->setNFreeUndefinedKChar(self, '1', undefined); 1146 ck_assert_ptr_ne(r, null); 1147 char *s = toStringO(r); 1148 ck_assert_str_eq(s, "{\"1\":null}"); 1149 free(s); 1150 terminateO(self); 1151 1152 END_TEST 1153 1154 1155 START_TEST(setNFreeSKCharSmallDictT) 1156 1157 smallDictt* r; 1158 smallDictt *self = allocG(rtSmallDictt); 1159 char *string = strdup("qwe"); 1160 1161 r = self->f->setNFreeSKChar(self, '1', string); 1162 ck_assert_ptr_ne(r, null); 1163 char *s = toStringO(r); 1164 ck_assert_str_eq(s, "{\"1\":\"qwe\"}"); 1165 free(s); 1166 terminateO(self); 1167 1168 END_TEST 1169 1170 1171 START_TEST(setNFreeDictKCharSmallDictT) 1172 1173 smallDictt* r; 1174 smallDictt *self = allocG(rtSmallDictt); 1175 smallDictt *dict = allocSmallDict(); 1176 1177 r = self->f->setNFreeDictKChar(self, '1', dict); 1178 ck_assert_ptr_ne(r, null); 1179 char *s = toStringO(r); 1180 ck_assert_str_eq(s, "{\"1\":{}}"); 1181 free(s); 1182 terminateO(self); 1183 1184 END_TEST 1185 1186 1187 START_TEST(setNFreeArrayKCharSmallDictT) 1188 1189 smallDictt* r; 1190 smallDictt *self = allocG(rtSmallDictt); 1191 smallArrayt *array = allocSmallArray(); 1192 1193 r = self->f->setNFreeArrayKChar(self, '1', array); 1194 ck_assert_ptr_ne(r, null); 1195 char *s = toStringO(r); 1196 ck_assert_str_eq(s, "{\"1\":[]}"); 1197 free(s); 1198 terminateO(self); 1199 1200 END_TEST 1201 1202 1203 START_TEST(setNFreeArraycKCharSmallDictT) 1204 1205 smallDictt* r; 1206 smallDictt *self = allocG(rtSmallDictt); 1207 char **array = listCreateS("a", "b"); 1208 1209 r = self->f->setNFreeArraycKChar(self, '1', array); 1210 ck_assert_ptr_ne(r, null); 1211 char *s = toStringO(r); 1212 ck_assert_str_eq(s, "{\"1\":[\"a\",\"b\"]}"); 1213 free(s); 1214 terminateO(self); 1215 1216 END_TEST 1217 1218 1219 START_TEST(setNFreeSmallBoolKCharSmallDictT) 1220 1221 smallDictt* r; 1222 smallDictt *self = allocG(rtSmallDictt); 1223 smallBoolt *value = allocSmallBool(true); 1224 1225 r = self->f->setNFreeSmallBoolKChar(self, '1', value); 1226 ck_assert_ptr_ne(r, null); 1227 char *s = toStringO(r); 1228 ck_assert_str_eq(s, "{\"1\":true}"); 1229 free(s); 1230 terminateO(self); 1231 1232 END_TEST 1233 1234 1235 START_TEST(setNFreeSmallBytesKCharSmallDictT) 1236 1237 smallDictt* r; 1238 smallDictt *self = allocG(rtSmallDictt); 1239 smallBytest *value = allocSmallBytes("qwe", sizeof("qwe")); 1240 1241 r = self->f->setNFreeSmallBytesKChar(self, '1', value); 1242 ck_assert_ptr_ne(r, null); 1243 char *s = toStringO(r); 1244 ck_assert_str_eq(s, "{\"1\":[0x71,0x77,0x65,0x00]}"); 1245 free(s); 1246 terminateO(self); 1247 1248 END_TEST 1249 1250 1251 START_TEST(setNFreeSmallDoubleKCharSmallDictT) 1252 1253 smallDictt* r; 1254 smallDictt *self = allocG(rtSmallDictt); 1255 smallDoublet *value = allocSmallDouble(2.2); 1256 1257 r = self->f->setNFreeSmallDoubleKChar(self, '1', value); 1258 ck_assert_ptr_ne(r, null); 1259 char *s = toStringO(r); 1260 ck_assert_str_eq(s, "{\"1\":2.200000e+00}"); 1261 free(s); 1262 terminateO(self); 1263 1264 END_TEST 1265 1266 1267 START_TEST(setNFreeSmallIntKCharSmallDictT) 1268 1269 smallDictt* r; 1270 smallDictt *self = allocG(rtSmallDictt); 1271 smallIntt *value = allocSmallInt(2); 1272 1273 r = self->f->setNFreeSmallIntKChar(self, '1', value); 1274 ck_assert_ptr_ne(r, null); 1275 char *s = toStringO(r); 1276 ck_assert_str_eq(s, "{\"1\":2}"); 1277 free(s); 1278 terminateO(self); 1279 1280 END_TEST 1281 1282 1283 START_TEST(setNFreeSmallJsonKCharSmallDictT) 1284 1285 smallDictt* r; 1286 smallDictt *self = allocG(rtSmallDictt); 1287 smallJsont *value = allocSmallJson(); 1288 1289 setTopIntO(value, 2); 1290 r = self->f->setNFreeSmallJsonKChar(self, '1', value); 1291 ck_assert_ptr_ne(r, null); 1292 char *s = toStringO(r); 1293 ck_assert_str_eq(s, "{\"1\":2}"); 1294 free(s); 1295 terminateO(self); 1296 1297 END_TEST 1298 1299 1300 START_TEST(setNFreeSmallStringKCharSmallDictT) 1301 1302 smallDictt* r; 1303 smallDictt *self = allocG(rtSmallDictt); 1304 smallStringt *string = allocSmallString("qwe"); 1305 1306 r = self->f->setNFreeSmallStringKChar(self, '1', string); 1307 ck_assert_ptr_ne(r, null); 1308 char *s = toStringO(r); 1309 ck_assert_str_eq(s, "{\"1\":\"qwe\"}"); 1310 free(s); 1311 terminateO(self); 1312 1313 END_TEST 1314 1315 1316 START_TEST(setNFreeSmallContainerKCharSmallDictT) 1317 1318 smallDictt* r; 1319 smallDictt *self = allocG(rtSmallDictt); 1320 smallContainert *container = allocSmallContainer(null); 1321 1322 r = self->f->setNFreeSmallContainerKChar(self, '1', container); 1323 ck_assert_ptr_ne(r, null); 1324 char *s = toStringO(r); 1325 ck_assert_str_eq(s, "{\"1\":\"<data container>\"}"); 1326 free(s); 1327 terminateO(self); 1328 1329 END_TEST 1330 1331 1332 START_TEST(setPDictSmallDictT) 1333 1334 smallDictt* r; 1335 smallDictt *self = allocG(rtSmallDictt); 1336 smallDictt *dict; 1337 1338 dict = allocSmallDict(); 1339 r = self->f->setDict(self, "1", dict); 1340 ck_assert_ptr_ne(r, null); 1341 dict->f->setInt(dict, "a", 1); 1342 r = self->f->setPDict(self, "1", dict); 1343 ck_assert_ptr_ne(r, null); 1344 char *s = toStringO(r); 1345 ck_assert_str_eq(s, "{\"1\":{\"a\":1}}"); 1346 free(s); 1347 // empty dict 1348 finishO(dict); 1349 dict = allocSmallDict(); 1350 r = self->f->setPDict(self, "1", dict); 1351 ck_assert_ptr_eq(r, null); 1352 finishO(dict); 1353 s = toStringO(self); 1354 ck_assert_str_eq(s, "{\"1\":{\"a\":1}}"); 1355 free(s); 1356 // non smallDict object 1357 dict = (smallDictt*) allocSmallInt(2); 1358 r = self->f->setPDict(self, "1", dict); 1359 ck_assert_ptr_eq(r, null); 1360 terminateO(dict); 1361 // null value 1362 r = self->f->setPDict(self, "1", null); 1363 ck_assert_ptr_eq(r, null); 1364 // null key 1365 r = self->f->setPDict(self, null, dict); 1366 ck_assert_ptr_eq(r, null); 1367 terminateO(self); 1368 1369 END_TEST 1370 1371 1372 START_TEST(setPArraySmallDictT) 1373 1374 smallDictt* r; 1375 smallDictt *self = allocG(rtSmallDictt); 1376 smallArrayt *array; 1377 1378 array = allocSmallArray(); 1379 r = self->f->setArray(self, "1", array); 1380 ck_assert_ptr_ne(r, null); 1381 array->f->pushInt(array, 1); 1382 r = self->f->setPArray(self, "1", array); 1383 ck_assert_ptr_ne(r, null); 1384 char *s = toStringO(r); 1385 ck_assert_str_eq(s, "{\"1\":[1]}"); 1386 free(s); 1387 // empty array 1388 finishO(array); 1389 array = allocSmallArray(); 1390 r = self->f->setPArray(self, "1", array); 1391 ck_assert_ptr_eq(r, null); 1392 finishO(array); 1393 s = toStringO(self); 1394 ck_assert_str_eq(s, "{\"1\":[1]}"); 1395 free(s); 1396 // non smallDict object 1397 array = (smallArrayt*) allocSmallInt(2); 1398 r = self->f->setPArray(self, "1", array); 1399 ck_assert_ptr_eq(r, null); 1400 terminateO(array); 1401 // null value 1402 r = self->f->setPArray(self, "1", null); 1403 ck_assert_ptr_eq(r, null); 1404 // null key 1405 r = self->f->setPArray(self, null, array); 1406 ck_assert_ptr_eq(r, null); 1407 terminateO(self); 1408 1409 END_TEST 1410 1411 1412 START_TEST(setPSmallJsonSmallDictT) 1413 1414 smallDictt* r; 1415 smallDictt *self = allocG(rtSmallDictt); 1416 smallJsont *json; 1417 1418 json = allocSmallJson(); 1419 r = self->f->setSmallJson(self, "1", json); 1420 ck_assert_ptr_ne(r, null); 1421 json->f->setInt(json, "a", 1); 1422 r = self->f->setPSmallJson(self, "1", json); 1423 ck_assert_ptr_ne(r, null); 1424 finishO(json); 1425 char *s = toStringO(r); 1426 ck_assert_str_eq(s, "{\"1\":{\"a\":1}}"); 1427 free(s); 1428 // empty smallJson 1429 json = allocSmallJson(); 1430 r = self->f->setPSmallJson(self, "1", json); 1431 ck_assert_ptr_eq(r, null); 1432 terminateO(json); 1433 // non smallJson object 1434 json = (smallJsont*) allocSmallInt(2); 1435 r = self->f->setPSmallJson(self, "1", json); 1436 ck_assert_ptr_eq(r, null); 1437 // null value 1438 r = self->f->setPSmallJson(self, "1", null); 1439 ck_assert_ptr_eq(r, null); 1440 // null key 1441 r = self->f->setPSmallJson(self, null, json); 1442 ck_assert_ptr_eq(r, null); 1443 terminateO(self); 1444 terminateO(json); 1445 1446 END_TEST 1447 1448 1449 START_TEST(setPSmallStringSmallDictT) 1450 1451 smallDictt* r; 1452 smallDictt *self = allocG(rtSmallDictt); 1453 smallStringt *string; 1454 1455 string = allocSmallString(""); 1456 r = self->f->setSmallString(self, "1", string); 1457 ck_assert_ptr_ne(r, null); 1458 string->f->appendS(string, "s"); 1459 r = self->f->setPSmallString(self, "1", string); 1460 ck_assert_ptr_ne(r, null); 1461 finishO(string); 1462 char *s = toStringO(r); 1463 ck_assert_str_eq(s, "{\"1\":\"s\"}"); 1464 free(s); 1465 // empty SmallString 1466 string = allocSmallString(""); 1467 freeO(string); 1468 r = self->f->setPSmallString(self, "1", string); 1469 ck_assert_ptr_eq(r, null); 1470 terminateO(string); 1471 // non smallString object 1472 string = (smallStringt*) allocSmallInt(2); 1473 r = self->f->setPSmallString(self, "1", string); 1474 ck_assert_ptr_eq(r, null); 1475 terminateO(string); 1476 // null value 1477 r = self->f->setPSmallString(self, "1", null); 1478 ck_assert_ptr_eq(r, null); 1479 // null key 1480 string = allocSmallString(""); 1481 r = self->f->setPSmallString(self, null, string); 1482 ck_assert_ptr_eq(r, null); 1483 terminateO(self); 1484 terminateO(string); 1485 1486 END_TEST 1487 1488 1489 START_TEST(setNFreePDictSmallDictT) 1490 1491 smallDictt* r; 1492 smallDictt *self = allocG(rtSmallDictt); 1493 smallDictt *value; 1494 1495 value = allocSmallDict(); 1496 r = self->f->setDict(self, "1", value); 1497 ck_assert_ptr_ne(r, null); 1498 value->f->setInt(value, "a", 1); 1499 r = self->f->setNFreePDict(self, "1", value); 1500 ck_assert_ptr_ne(r, null); 1501 char *s = toStringO(r); 1502 ck_assert_str_eq(s, "{\"1\":{\"a\":1}}"); 1503 free(s); 1504 // empty smallDict 1505 value = allocSmallDict(); 1506 r = self->f->setNFreePDict(self, "1", value); 1507 ck_assert_ptr_eq(r, null); 1508 terminateO(value); 1509 // non smallDict object 1510 value = (smallDictt*) allocSmallInt(2); 1511 r = self->f->setNFreePDict(self, "1", value); 1512 ck_assert_ptr_eq(r, null); 1513 terminateO(value); 1514 // null value 1515 value = allocSmallDict(); 1516 r = self->f->setNFreePDict(self, "1", null); 1517 ck_assert_ptr_eq(r, null); 1518 // null key 1519 r = self->f->setNFreePDict(self, null, value); 1520 ck_assert_ptr_eq(r, null); 1521 terminateO(self); 1522 terminateO(value); 1523 1524 END_TEST 1525 1526 1527 START_TEST(setNFreePArraySmallDictT) 1528 1529 smallDictt* r; 1530 smallDictt *self = allocG(rtSmallDictt); 1531 smallArrayt *value; 1532 1533 value = allocSmallArray(); 1534 r = self->f->setArray(self, "1", value); 1535 ck_assert_ptr_ne(r, null); 1536 value->f->pushInt(value, 2); 1537 r = self->f->setNFreePArray(self, "1", value); 1538 ck_assert_ptr_ne(r, null); 1539 char *s = toStringO(r); 1540 ck_assert_str_eq(s, "{\"1\":[2]}"); 1541 free(s); 1542 // empty smallArray 1543 value = allocSmallArray(); 1544 r = self->f->setNFreePArray(self, "1", value); 1545 ck_assert_ptr_eq(r, null); 1546 terminateO(value); 1547 // non smallArray object 1548 value = (smallArrayt*) allocSmallInt(2); 1549 r = self->f->setNFreePArray(self, "1", value); 1550 ck_assert_ptr_eq(r, null); 1551 terminateO(value); 1552 // null value 1553 value = allocSmallArray(); 1554 r = self->f->setNFreePArray(self, "1", null); 1555 ck_assert_ptr_eq(r, null); 1556 // null key 1557 r = self->f->setNFreePArray(self, null, value); 1558 ck_assert_ptr_eq(r, null); 1559 terminateO(self); 1560 terminateO(value); 1561 1562 END_TEST 1563 1564 1565 START_TEST(setNFreePSmallJsonSmallDictT) 1566 1567 smallDictt* r; 1568 smallDictt *self = allocG(rtSmallDictt); 1569 smallJsont *value; 1570 1571 value = allocSmallJson(); 1572 r = self->f->setSmallJson(self, "1", value); 1573 ck_assert_ptr_ne(r, null); 1574 value->f->setInt(value, "a", 1); 1575 r = self->f->setNFreePSmallJson(self, "1", value); 1576 ck_assert_ptr_ne(r, null); 1577 char *s = toStringO(r); 1578 ck_assert_str_eq(s, "{\"1\":{\"a\":1}}"); 1579 free(s); 1580 // empty smallJson 1581 value = allocSmallJson(); 1582 r = self->f->setNFreePSmallJson(self, "1", value); 1583 ck_assert_ptr_eq(r, null); 1584 terminateO(value); 1585 // non smallJson object 1586 value = (smallJsont*) allocSmallInt(2); 1587 r = self->f->setNFreePSmallJson(self, "1", value); 1588 ck_assert_ptr_eq(r, null); 1589 terminateO(value); 1590 // null value 1591 value = allocSmallJson(); 1592 r = self->f->setNFreePSmallJson(self, "1", null); 1593 ck_assert_ptr_eq(r, null); 1594 // null key 1595 r = self->f->setNFreePSmallJson(self, null, value); 1596 ck_assert_ptr_eq(r, null); 1597 terminateO(self); 1598 terminateO(value); 1599 1600 END_TEST 1601 1602 1603 START_TEST(setNFreePSmallStringSmallDictT) 1604 1605 smallDictt* r; 1606 smallDictt *self = allocG(rtSmallDictt); 1607 smallStringt *value; 1608 1609 value = allocSmallString(""); 1610 r = self->f->setSmallString(self, "1", value); 1611 ck_assert_ptr_ne(r, null); 1612 value->f->appendS(value, "2"); 1613 r = self->f->setNFreePSmallString(self, "1", value); 1614 ck_assert_ptr_ne(r, null); 1615 char *s = toStringO(r); 1616 ck_assert_str_eq(s, "{\"1\":\"2\"}"); 1617 free(s); 1618 // empty SmallString 1619 value = allocSmallString(""); 1620 freeO(value); 1621 r = self->f->setNFreePSmallString(self, "1", value); 1622 ck_assert_ptr_eq(r, null); 1623 terminateO(value); 1624 // non smallString object 1625 value = (smallStringt*) allocSmallInt(2); 1626 r = self->f->setNFreePSmallString(self, "1", value); 1627 ck_assert_ptr_eq(r, null); 1628 terminateO(value); 1629 // null value 1630 value = allocSmallString(""); 1631 r = self->f->setNFreePSmallString(self, "1", null); 1632 ck_assert_ptr_eq(r, null); 1633 // null key 1634 r = self->f->setNFreePSmallString(self, null, value); 1635 ck_assert_ptr_eq(r, null); 1636 terminateO(self); 1637 terminateO(value); 1638 1639 END_TEST 1640 1641 1642 START_TEST(setPArrayKCharSmallDictT) 1643 1644 smallDictt* r; 1645 smallDictt *self = allocG(rtSmallDictt); 1646 smallArrayt *array; 1647 1648 array = allocSmallArray(); 1649 r = self->f->setArray(self, "1", array); 1650 ck_assert_ptr_ne(r, null); 1651 array->f->pushInt(array, 2); 1652 r = self->f->setPArrayKChar(self, '1', array); 1653 ck_assert_ptr_ne(r, null); 1654 char *s = toStringO(r); 1655 ck_assert_str_eq(s, "{\"1\":[2]}"); 1656 free(s); 1657 terminateO(self); 1658 finishO(array); 1659 1660 END_TEST 1661 1662 1663 START_TEST(setPDictKCharSmallDictT) 1664 1665 smallDictt* r; 1666 smallDictt *self = allocG(rtSmallDictt); 1667 smallDictt *dict; 1668 1669 dict = allocSmallDict(); 1670 r = self->f->setDict(self, "1", dict); 1671 ck_assert_ptr_ne(r, null); 1672 dict->f->setInt(dict, "a", 1); 1673 r = self->f->setPDictKChar(self, '1', dict); 1674 ck_assert_ptr_ne(r, null); 1675 char *s = toStringO(r); 1676 ck_assert_str_eq(s, "{\"1\":{\"a\":1}}"); 1677 free(s); 1678 terminateO(self); 1679 finishO(dict); 1680 1681 END_TEST 1682 1683 1684 START_TEST(setPSmallJsonKCharSmallDictT) 1685 1686 smallDictt* r; 1687 smallDictt *self = allocG(rtSmallDictt); 1688 smallJsont *json; 1689 1690 json = allocSmallJson(); 1691 r = self->f->setSmallJson(self, "1", json); 1692 ck_assert_ptr_ne(r, null); 1693 json->f->setInt(json, "a", 1); 1694 r = self->f->setPSmallJsonKChar(self, '1', json); 1695 ck_assert_ptr_ne(r, null); 1696 finishO(json); 1697 char *s = toStringO(r); 1698 ck_assert_str_eq(s, "{\"1\":{\"a\":1}}"); 1699 free(s); 1700 terminateO(self); 1701 1702 END_TEST 1703 1704 1705 START_TEST(setPSmallStringKCharSmallDictT) 1706 1707 smallDictt* r; 1708 smallDictt *self = allocG(rtSmallDictt); 1709 smallStringt *string; 1710 1711 string = allocSmallString(""); 1712 r = self->f->setSmallString(self, "1", string); 1713 ck_assert_ptr_ne(r, null); 1714 string->f->appendS(string, "s"); 1715 r = self->f->setPSmallStringKChar(self, '1', string); 1716 ck_assert_ptr_ne(r, null); 1717 finishO(string); 1718 char *s = toStringO(r); 1719 ck_assert_str_eq(s, "{\"1\":\"s\"}"); 1720 free(s); 1721 terminateO(self); 1722 1723 END_TEST 1724 1725 1726 START_TEST(setNFreePArrayKCharSmallDictT) 1727 1728 smallDictt* r; 1729 smallDictt *self = allocG(rtSmallDictt); 1730 smallArrayt *value; 1731 1732 value = allocSmallArray(); 1733 r = self->f->setArray(self, "1", value); 1734 ck_assert_ptr_ne(r, null); 1735 value->f->pushInt(value, 2); 1736 r = self->f->setNFreePArrayKChar(self, '1', value); 1737 ck_assert_ptr_ne(r, null); 1738 char *s = toStringO(r); 1739 ck_assert_str_eq(s, "{\"1\":[2]}"); 1740 free(s); 1741 terminateO(self); 1742 1743 END_TEST 1744 1745 1746 START_TEST(setNFreePDictKCharSmallDictT) 1747 1748 smallDictt* r; 1749 smallDictt *self = allocG(rtSmallDictt); 1750 smallDictt *value; 1751 1752 value = allocSmallDict(); 1753 r = self->f->setDict(self, "1", value); 1754 ck_assert_ptr_ne(r, null); 1755 value->f->setInt(value, "a", 1); 1756 r = self->f->setNFreePDictKChar(self, '1', value); 1757 ck_assert_ptr_ne(r, null); 1758 char *s = toStringO(r); 1759 ck_assert_str_eq(s, "{\"1\":{\"a\":1}}"); 1760 free(s); 1761 terminateO(self); 1762 1763 END_TEST 1764 1765 1766 START_TEST(setNFreePSmallJsonKCharSmallDictT) 1767 1768 smallDictt* r; 1769 smallDictt *self = allocG(rtSmallDictt); 1770 smallJsont *value; 1771 1772 value = allocSmallJson(); 1773 r = self->f->setSmallJson(self, "1", value); 1774 ck_assert_ptr_ne(r, null); 1775 value->f->setInt(value, "a", 1); 1776 r = self->f->setNFreePSmallJsonKChar(self, '1', value); 1777 ck_assert_ptr_ne(r, null); 1778 char *s = toStringO(r); 1779 ck_assert_str_eq(s, "{\"1\":{\"a\":1}}"); 1780 free(s); 1781 terminateO(self); 1782 1783 END_TEST 1784 1785 1786 START_TEST(setNFreePSmallStringKCharSmallDictT) 1787 1788 smallDictt* r; 1789 smallDictt *self = allocG(rtSmallDictt); 1790 smallStringt *value; 1791 1792 value = allocSmallString(""); 1793 r = self->f->setSmallString(self, "1", value); 1794 ck_assert_ptr_ne(r, null); 1795 value->f->appendS(value, "2"); 1796 r = self->f->setNFreePSmallStringKChar(self, '1', value); 1797 ck_assert_ptr_ne(r, null); 1798 char *s = toStringO(r); 1799 ck_assert_str_eq(s, "{\"1\":\"2\"}"); 1800 free(s); 1801 terminateO(self); 1802 1803 END_TEST 1804 1805 1806 START_TEST(getUndefinedSmallDictT) 1807 1808 undefinedt* r; 1809 smallDictt *self = allocG(rtSmallDictt); 1810 1811 smallDictt *r2 = self->f->setUndefined(self, "1"); 1812 ck_assert_ptr_ne(r2, null); 1813 r = self->f->getUndefined(self, "1"); 1814 ck_assert_ptr_ne(r, null); 1815 terminateO(r); 1816 // non undefined object 1817 r2 = self->f->setInt(self, "1", 2); 1818 ck_assert_ptr_ne(r2, null); 1819 r = self->f->getUndefined(self, "1"); 1820 ck_assert_ptr_eq(r, null); 1821 // null key 1822 r = self->f->getUndefined(self, null); 1823 ck_assert_ptr_eq(r, null); 1824 // empty self 1825 freeO(self); 1826 r = self->f->getUndefined(self, "1"); 1827 ck_assert_ptr_eq(r, null); 1828 terminateO(self); 1829 1830 END_TEST 1831 1832 1833 START_TEST(getBoolSmallDictT) 1834 1835 bool r; 1836 smallDictt *self = allocG(rtSmallDictt); 1837 1838 smallDictt *r2 = self->f->setBool(self, "1", true); 1839 ck_assert_ptr_ne(r2, null); 1840 r = self->f->getBool(self, "1"); 1841 ck_assert(r); 1842 // non bool object 1843 r2 = self->f->setInt(self, "1", 2); 1844 ck_assert_ptr_ne(r2, null); 1845 r = self->f->getBool(self, "1"); 1846 ck_assert(!r); 1847 // null key 1848 r = self->f->getBool(self, null); 1849 ck_assert(!r); 1850 // empty self 1851 freeO(self); 1852 r = self->f->getBool(self, "1"); 1853 ck_assert(!r); 1854 terminateO(self); 1855 1856 END_TEST 1857 1858 1859 START_TEST(getBoolPSmallDictT) 1860 1861 bool* r; 1862 smallDictt *self = allocG(rtSmallDictt); 1863 1864 smallDictt *r2 = self->f->setBool(self, "1", true); 1865 ck_assert_ptr_ne(r2, null); 1866 r = self->f->getBoolP(self, "1"); 1867 ck_assert_ptr_ne(r, null); 1868 ck_assert(*r); 1869 // non bool object 1870 r2 = self->f->setInt(self, "1", 2); 1871 ck_assert_ptr_ne(r2, null); 1872 r = self->f->getBoolP(self, "1"); 1873 ck_assert_ptr_eq(r, null); 1874 // null key 1875 r = self->f->getBoolP(self, null); 1876 ck_assert_ptr_eq(r, null); 1877 // empty self 1878 freeO(self); 1879 r = self->f->getBoolP(self, "1"); 1880 ck_assert_ptr_eq(r, null); 1881 terminateO(self); 1882 1883 END_TEST 1884 1885 1886 START_TEST(getDoubleSmallDictT) 1887 1888 double r; 1889 smallDictt *self = allocG(rtSmallDictt); 1890 1891 smallDictt *r2 = self->f->setDouble(self, "1", 2.2); 1892 ck_assert_ptr_ne(r2, null); 1893 r = self->f->getDouble(self, "1"); 1894 ck_assert(r == 2.2); 1895 // non double object 1896 r2 = self->f->setInt(self, "1", 2); 1897 ck_assert_ptr_ne(r2, null); 1898 r = self->f->getDouble(self, "1"); 1899 ck_assert(r == 0); 1900 // null key 1901 r = self->f->getDouble(self, null); 1902 ck_assert(!r); 1903 // empty self 1904 freeO(self); 1905 r = self->f->getDouble(self, "1"); 1906 ck_assert(!r); 1907 terminateO(self); 1908 1909 END_TEST 1910 1911 1912 START_TEST(getDoublePSmallDictT) 1913 1914 double* r; 1915 smallDictt *self = allocG(rtSmallDictt); 1916 1917 smallDictt *r2 = self->f->setDouble(self, "1", 2.2); 1918 ck_assert_ptr_ne(r2, null); 1919 r = self->f->getDoubleP(self, "1"); 1920 ck_assert_ptr_ne(r, null); 1921 ck_assert(*r == 2.2); 1922 // non double object 1923 r2 = self->f->setInt(self, "1", 2); 1924 ck_assert_ptr_ne(r2, null); 1925 r = self->f->getDoubleP(self, "1"); 1926 ck_assert_ptr_eq(r, null); 1927 // null key 1928 r = self->f->getDoubleP(self, null); 1929 ck_assert_ptr_eq(r, null); 1930 // empty self 1931 freeO(self); 1932 r = self->f->getDoubleP(self, "1"); 1933 ck_assert_ptr_eq(r, null); 1934 terminateO(self); 1935 1936 END_TEST 1937 1938 1939 START_TEST(getIntSmallDictT) 1940 1941 int64_t r; 1942 smallDictt *self = allocG(rtSmallDictt); 1943 1944 smallDictt *r2 = self->f->setInt(self, "1", 2); 1945 ck_assert_ptr_ne(r2, null); 1946 r = self->f->getInt(self, "1"); 1947 ck_assert_int_eq(r, 2); 1948 // non int object 1949 r2 = self->f->setBool(self, "1", true); 1950 ck_assert_ptr_ne(r2, null); 1951 r = self->f->getInt(self, "1"); 1952 ck_assert(!r); 1953 // null key 1954 r = self->f->getInt(self, null); 1955 ck_assert(!r); 1956 // empty self 1957 freeO(self); 1958 r = self->f->getInt(self, "1"); 1959 ck_assert(!r); 1960 terminateO(self); 1961 1962 END_TEST 1963 1964 1965 START_TEST(getIntPSmallDictT) 1966 1967 int64_t* r; 1968 smallDictt *self = allocG(rtSmallDictt); 1969 1970 smallDictt *r2 = self->f->setInt(self, "1", 2); 1971 ck_assert_ptr_ne(r2, null); 1972 r = self->f->getIntP(self, "1"); 1973 ck_assert_ptr_ne(r, null); 1974 ck_assert_int_eq(*r, 2); 1975 // non int object 1976 r2 = self->f->setBool(self, "1", true); 1977 ck_assert_ptr_ne(r2, null); 1978 r = self->f->getIntP(self, "1"); 1979 ck_assert_ptr_eq(r, null); 1980 // null key 1981 r = self->f->getIntP(self, null); 1982 ck_assert_ptr_eq(r, null); 1983 // empty self 1984 freeO(self); 1985 r = self->f->getIntP(self, "1"); 1986 ck_assert_ptr_eq(r, null); 1987 terminateO(self); 1988 1989 END_TEST 1990 1991 1992 START_TEST(getInt32SmallDictT) 1993 1994 int32_t r; 1995 smallDictt *self = allocG(rtSmallDictt); 1996 1997 smallDictt *r2 = self->f->setInt(self, "1", 2); 1998 ck_assert_ptr_ne(r2, null); 1999 r = self->f->getInt32(self, "1"); 2000 ck_assert_int_eq(r, 2); 2001 // non int object 2002 r2 = self->f->setBool(self, "1", true); 2003 ck_assert_ptr_ne(r2, null); 2004 r = self->f->getInt32(self, "1"); 2005 ck_assert(!r); 2006 // null key 2007 r = self->f->getInt32(self, null); 2008 ck_assert(!r); 2009 // empty self 2010 freeO(self); 2011 r = self->f->getInt32(self, "1"); 2012 ck_assert(!r); 2013 terminateO(self); 2014 2015 END_TEST 2016 2017 2018 START_TEST(getInt32PSmallDictT) 2019 2020 int32_t* r; 2021 smallDictt *self = allocG(rtSmallDictt); 2022 2023 smallDictt *r2 = self->f->setInt(self, "1", 2); 2024 ck_assert_ptr_ne(r2, null); 2025 r = self->f->getInt32P(self, "1"); 2026 ck_assert_ptr_ne(r, null); 2027 ck_assert_int_eq(*r, 2); 2028 // non int object 2029 r2 = self->f->setBool(self, "1", true); 2030 ck_assert_ptr_ne(r2, null); 2031 r = self->f->getInt32P(self, "1"); 2032 ck_assert_ptr_eq(r, null); 2033 // null key 2034 r = self->f->getInt32P(self, null); 2035 ck_assert_ptr_eq(r, null); 2036 // empty self 2037 freeO(self); 2038 r = self->f->getInt32P(self, "1"); 2039 ck_assert_ptr_eq(r, null); 2040 terminateO(self); 2041 2042 END_TEST 2043 2044 2045 START_TEST(getUintSmallDictT) 2046 2047 uint64_t r; 2048 smallDictt *self = allocG(rtSmallDictt); 2049 2050 smallDictt *r2 = self->f->setInt(self, "1", 2); 2051 ck_assert_ptr_ne(r2, null); 2052 r = self->f->getUint(self, "1"); 2053 ck_assert_int_eq(r, 2); 2054 // non int object 2055 r2 = self->f->setBool(self, "1", true); 2056 ck_assert_ptr_ne(r2, null); 2057 r = self->f->getUint(self, "1"); 2058 ck_assert(!r); 2059 // null key 2060 r = self->f->getUint(self, null); 2061 ck_assert(!r); 2062 // empty self 2063 freeO(self); 2064 r = self->f->getUint(self, "1"); 2065 ck_assert(!r); 2066 terminateO(self); 2067 2068 END_TEST 2069 2070 2071 START_TEST(getUintPSmallDictT) 2072 2073 uint64_t* r; 2074 smallDictt *self = allocG(rtSmallDictt); 2075 2076 smallDictt *r2 = self->f->setInt(self, "1", 2); 2077 ck_assert_ptr_ne(r2, null); 2078 r = self->f->getUintP(self, "1"); 2079 ck_assert_ptr_ne(r, null); 2080 ck_assert_int_eq(*r, 2); 2081 // non int object 2082 r2 = self->f->setBool(self, "1", true); 2083 ck_assert_ptr_ne(r2, null); 2084 r = self->f->getUintP(self, "1"); 2085 ck_assert_ptr_eq(r, null); 2086 // null key 2087 r = self->f->getUintP(self, null); 2088 ck_assert_ptr_eq(r, null); 2089 // empty self 2090 freeO(self); 2091 r = self->f->getUintP(self, "1"); 2092 ck_assert_ptr_eq(r, null); 2093 terminateO(self); 2094 2095 END_TEST 2096 2097 2098 START_TEST(getUint32SmallDictT) 2099 2100 uint32_t r; 2101 smallDictt *self = allocG(rtSmallDictt); 2102 2103 smallDictt *r2 = self->f->setInt(self, "1", 2); 2104 ck_assert_ptr_ne(r2, null); 2105 r = self->f->getUint32(self, "1"); 2106 ck_assert_int_eq(r, 2); 2107 // non int object 2108 r2 = self->f->setBool(self, "1", true); 2109 ck_assert_ptr_ne(r2, null); 2110 r = self->f->getUint32(self, "1"); 2111 ck_assert(!r); 2112 // null key 2113 r = self->f->getUint32(self, null); 2114 ck_assert(!r); 2115 // empty self 2116 freeO(self); 2117 r = self->f->getUint32(self, "1"); 2118 ck_assert(!r); 2119 terminateO(self); 2120 2121 END_TEST 2122 2123 2124 START_TEST(getUint32PSmallDictT) 2125 2126 uint32_t* r; 2127 smallDictt *self = allocG(rtSmallDictt); 2128 2129 smallDictt *r2 = self->f->setInt(self, "1", 2); 2130 ck_assert_ptr_ne(r2, null); 2131 r = self->f->getUint32P(self, "1"); 2132 ck_assert_ptr_ne(r, null); 2133 ck_assert_int_eq(*r, 2); 2134 // non int object 2135 r2 = self->f->setBool(self, "1", true); 2136 ck_assert_ptr_ne(r2, null); 2137 r = self->f->getUint32P(self, "1"); 2138 ck_assert_ptr_eq(r, null); 2139 // null key 2140 r = self->f->getUint32P(self, null); 2141 ck_assert_ptr_eq(r, null); 2142 // empty self 2143 freeO(self); 2144 r = self->f->getUint32P(self, "1"); 2145 ck_assert_ptr_eq(r, null); 2146 terminateO(self); 2147 2148 END_TEST 2149 2150 2151 START_TEST(getSSmallDictT) 2152 2153 char* r; 2154 smallDictt *self = allocG(rtSmallDictt); 2155 2156 smallDictt *r2 = self->f->setS(self, "1", "qwe"); 2157 ck_assert_ptr_ne(r2, null); 2158 r = self->f->getS(self, "1"); 2159 ck_assert_ptr_ne(r, null); 2160 ck_assert_str_eq(r, "qwe"); 2161 // non string object 2162 r2 = self->f->setBool(self, "1", true); 2163 ck_assert_ptr_ne(r2, null); 2164 r = self->f->getS(self, "1"); 2165 ck_assert_ptr_eq(r, null); 2166 // null key 2167 r = self->f->getS(self, null); 2168 ck_assert_ptr_eq(r, null); 2169 // empty self 2170 freeO(self); 2171 r = self->f->getS(self, "1"); 2172 ck_assert_ptr_eq(r, null); 2173 terminateO(self); 2174 2175 END_TEST 2176 2177 2178 START_TEST(getDictSmallDictT) 2179 2180 smallDictt* r; 2181 smallDictt *self = allocG(rtSmallDictt); 2182 2183 createAllocateSmallDict(d); 2184 smallDictt *r2 = self->f->setNFreeDict(self, "1", d); 2185 ck_assert_ptr_ne(r2, null); 2186 r = self->f->getDict(self, "1"); 2187 ck_assert_ptr_ne(r, null); 2188 char *s = toStringO(r); 2189 finishO(r); 2190 ck_assert_str_eq(s, "{}"); 2191 free(s); 2192 // non dict object 2193 r2 = self->f->setBool(self, "1", true); 2194 ck_assert_ptr_ne(r2, null); 2195 r = self->f->getDict(self, "1"); 2196 ck_assert_ptr_eq(r, null); 2197 // null key 2198 r = self->f->getDict(self, null); 2199 ck_assert_ptr_eq(r, null); 2200 // empty self 2201 freeO(self); 2202 r = self->f->getDict(self, "1"); 2203 ck_assert_ptr_eq(r, null); 2204 terminateO(self); 2205 2206 END_TEST 2207 2208 2209 START_TEST(getArraySmallDictT) 2210 2211 smallArrayt* r; 2212 smallDictt *self = allocG(rtSmallDictt); 2213 2214 createAllocateSmallArray(d); 2215 smallDictt *r2 = self->f->setNFreeArray(self, "1", d); 2216 ck_assert_ptr_ne(r2, null); 2217 r = self->f->getArray(self, "1"); 2218 ck_assert_ptr_ne(r, null); 2219 char *s = toStringO(r); 2220 finishO(r); 2221 ck_assert_str_eq(s, "[]"); 2222 free(s); 2223 // non Array object 2224 r2 = self->f->setBool(self, "1", true); 2225 ck_assert_ptr_ne(r2, null); 2226 r = self->f->getArray(self, "1"); 2227 ck_assert_ptr_eq(r, null); 2228 // null key 2229 r = self->f->getArray(self, null); 2230 ck_assert_ptr_eq(r, null); 2231 // empty self 2232 freeO(self); 2233 r = self->f->getArray(self, "1"); 2234 ck_assert_ptr_eq(r, null); 2235 terminateO(self); 2236 2237 END_TEST 2238 2239 2240 START_TEST(getSmallBoolSmallDictT) 2241 2242 smallBoolt* r; 2243 smallDictt *self = allocG(rtSmallDictt); 2244 2245 createAllocateSmallBool(d); 2246 smallDictt *r2 = self->f->setNFreeSmallBool(self, "1", d); 2247 ck_assert_ptr_ne(r2, null); 2248 r = self->f->getSmallBool(self, "1"); 2249 ck_assert_ptr_ne(r, null); 2250 char *s = toStringO(r); 2251 finishO(r); 2252 ck_assert_str_eq(s, "false"); 2253 free(s); 2254 // non SmallBool object 2255 r2 = self->f->setInt(self, "1", 0); 2256 ck_assert_ptr_ne(r2, null); 2257 r = self->f->getSmallBool(self, "1"); 2258 ck_assert_ptr_eq(r, null); 2259 // null key 2260 r = self->f->getSmallBool(self, null); 2261 ck_assert_ptr_eq(r, null); 2262 // empty self 2263 freeO(self); 2264 r = self->f->getSmallBool(self, "1"); 2265 ck_assert_ptr_eq(r, null); 2266 terminateO(self); 2267 2268 END_TEST 2269 2270 2271 START_TEST(getSmallBytesSmallDictT) 2272 2273 smallBytest* r; 2274 smallDictt *self = allocG(rtSmallDictt); 2275 2276 createAllocateSmallBytes(d); 2277 smallDictt *r2 = self->f->setNFreeSmallBytes(self, "1", d); 2278 ck_assert_ptr_ne(r2, null); 2279 r = self->f->getSmallBytes(self, "1"); 2280 ck_assert_ptr_ne(r, null); 2281 char *s = toStringO(r); 2282 finishO(r); 2283 ck_assert_str_eq(s, "[]"); 2284 free(s); 2285 // non SmallBytes object 2286 r2 = self->f->setBool(self, "1", true); 2287 ck_assert_ptr_ne(r2, null); 2288 r = self->f->getSmallBytes(self, "1"); 2289 ck_assert_ptr_eq(r, null); 2290 // null key 2291 r = self->f->getSmallBytes(self, null); 2292 ck_assert_ptr_eq(r, null); 2293 // empty self 2294 freeO(self); 2295 r = self->f->getSmallBytes(self, "1"); 2296 ck_assert_ptr_eq(r, null); 2297 terminateO(self); 2298 2299 END_TEST 2300 2301 2302 START_TEST(getSmallDoubleSmallDictT) 2303 2304 smallDoublet* r; 2305 smallDictt *self = allocG(rtSmallDictt); 2306 2307 createAllocateSmallDouble(d); 2308 smallDictt *r2 = self->f->setNFreeSmallDouble(self, "1", d); 2309 ck_assert_ptr_ne(r2, null); 2310 r = self->f->getSmallDouble(self, "1"); 2311 ck_assert_ptr_ne(r, null); 2312 char *s = toStringO(r); 2313 finishO(r); 2314 ck_assert_str_eq(s, "0.000000e+00"); 2315 free(s); 2316 // non SmallDouble object 2317 r2 = self->f->setBool(self, "1", true); 2318 ck_assert_ptr_ne(r2, null); 2319 r = self->f->getSmallDouble(self, "1"); 2320 ck_assert_ptr_eq(r, null); 2321 // null key 2322 r = self->f->getSmallDouble(self, null); 2323 ck_assert_ptr_eq(r, null); 2324 // empty self 2325 freeO(self); 2326 r = self->f->getSmallDouble(self, "1"); 2327 ck_assert_ptr_eq(r, null); 2328 terminateO(self); 2329 2330 END_TEST 2331 2332 2333 START_TEST(getSmallIntSmallDictT) 2334 2335 smallIntt* r; 2336 smallDictt *self = allocG(rtSmallDictt); 2337 2338 createAllocateSmallInt(d); 2339 smallDictt *r2 = self->f->setNFreeSmallInt(self, "1", d); 2340 ck_assert_ptr_ne(r2, null); 2341 r = self->f->getSmallInt(self, "1"); 2342 ck_assert_ptr_ne(r, null); 2343 char *s = toStringO(r); 2344 finishO(r); 2345 ck_assert_str_eq(s, "0"); 2346 free(s); 2347 // non SmallInt object 2348 r2 = self->f->setBool(self, "1", true); 2349 ck_assert_ptr_ne(r2, null); 2350 r = self->f->getSmallInt(self, "1"); 2351 ck_assert_ptr_eq(r, null); 2352 // null key 2353 r = self->f->getSmallInt(self, null); 2354 ck_assert_ptr_eq(r, null); 2355 // empty self 2356 freeO(self); 2357 r = self->f->getSmallInt(self, "1"); 2358 ck_assert_ptr_eq(r, null); 2359 terminateO(self); 2360 2361 END_TEST 2362 2363 2364 START_TEST(getSmallJsonSmallDictT) 2365 2366 smallJsont* r; 2367 smallDictt *self = allocG(rtSmallDictt); 2368 2369 createAllocateSmallJson(d); 2370 smallDictt *r2 = self->f->setNFreeSmallJson(self, "1", d); 2371 ck_assert_ptr_ne(r2, null); 2372 r = self->f->getSmallJson(self, "1"); 2373 ck_assert_ptr_ne(r, null); 2374 char *s = toStringO(r); 2375 finishO(r); 2376 ck_assert_str_eq(s, "{}"); 2377 free(s); 2378 r2 = self->f->setBool(self, "1", true); 2379 ck_assert_ptr_ne(r2, null); 2380 r = self->f->getSmallJson(self, "1"); 2381 ck_assert_ptr_ne(r, null); 2382 s = toStringO(r); 2383 finishO(r); 2384 ck_assert_str_eq(s, "true"); 2385 free(s); 2386 // non SmallJson object 2387 smallContainert *c = allocSmallContainer(NULL); 2388 r2 = self->f->setNFreeSmallContainer(self, "1", c); 2389 ck_assert_ptr_ne(r2, null); 2390 r = self->f->getSmallJson(self, "1"); 2391 ck_assert_ptr_eq(r, null); 2392 // null key 2393 r = self->f->getSmallJson(self, null); 2394 ck_assert_ptr_eq(r, null); 2395 // empty self 2396 freeO(self); 2397 r = self->f->getSmallJson(self, "1"); 2398 ck_assert_ptr_eq(r, null); 2399 terminateO(self); 2400 2401 END_TEST 2402 2403 2404 START_TEST(getSmallStringSmallDictT) 2405 2406 smallStringt* r; 2407 smallDictt *self = allocG(rtSmallDictt); 2408 2409 createAllocateSmallString(d); 2410 smallDictt *r2 = self->f->setNFreeSmallString(self, "1", d); 2411 ck_assert_ptr_ne(r2, null); 2412 r = self->f->getSmallString(self, "1"); 2413 ck_assert_ptr_ne(r, null); 2414 char *s = toStringO(r); 2415 finishO(r); 2416 ck_assert_str_eq(s, ""); 2417 free(s); 2418 // non SmallString object 2419 r2 = self->f->setBool(self, "1", true); 2420 ck_assert_ptr_ne(r2, null); 2421 r = self->f->getSmallString(self, "1"); 2422 ck_assert_ptr_eq(r, null); 2423 // null key 2424 r = self->f->getSmallString(self, null); 2425 ck_assert_ptr_eq(r, null); 2426 // empty self 2427 freeO(self); 2428 r = self->f->getSmallString(self, "1"); 2429 ck_assert_ptr_eq(r, null); 2430 terminateO(self); 2431 2432 END_TEST 2433 2434 2435 START_TEST(getVoidSmallDictT) 2436 2437 void* r; 2438 smallDictt *self = allocG(rtSmallDictt); 2439 2440 smallContainert* d = allocSmallContainer(&r); 2441 smallDictt *r2 = self->f->setNFreeSmallContainer(self, "1", d); 2442 ck_assert_ptr_ne(r2, null); 2443 r = self->f->getVoid(self, "1"); 2444 ck_assert_ptr_eq(r, &r); 2445 // non container object 2446 r2 = self->f->setBool(self, "1", true); 2447 ck_assert_ptr_ne(r2, null); 2448 r = self->f->getVoid(self, "1"); 2449 ck_assert_ptr_eq(r, null); 2450 // null key 2451 r = self->f->getVoid(self, null); 2452 ck_assert_ptr_eq(r, null); 2453 // empty self 2454 freeO(self); 2455 r = self->f->getVoid(self, "1"); 2456 ck_assert_ptr_eq(r, null); 2457 terminateO(self); 2458 2459 END_TEST 2460 2461 2462 START_TEST(getSmallContainerSmallDictT) 2463 2464 smallContainert* r; 2465 smallDictt *self = allocG(rtSmallDictt); 2466 2467 createAllocateSmallContainer(d); 2468 smallDictt *r2 = self->f->setNFreeSmallContainer(self, "1", d); 2469 ck_assert_ptr_ne(r2, null); 2470 r = self->f->getSmallContainer(self, "1"); 2471 ck_assert_ptr_ne(r, null); 2472 char *s = toStringO(r); 2473 finishO(r); 2474 ck_assert_str_eq(s, "<data smallContainer>"); 2475 free(s); 2476 // other base class 2477 smallIntt *t = allocSmallInt(2); 2478 t->type = "randomClass"; 2479 r2 = self->f->setNFree(self, "1", (baset*)t); 2480 ck_assert_ptr_ne(r2, null); 2481 r = self->f->getSmallContainer(self, "1"); 2482 ck_assert_ptr_eq(r, null); 2483 // non SmallContainer object 2484 r2 = self->f->setBool(self, "1", true); 2485 ck_assert_ptr_ne(r2, null); 2486 r = self->f->getSmallContainer(self, "1"); 2487 ck_assert_ptr_eq(r, null); 2488 // null key 2489 r = self->f->getSmallContainer(self, null); 2490 ck_assert_ptr_eq(r, null); 2491 // empty self 2492 freeO(self); 2493 r = self->f->getSmallContainer(self, "1"); 2494 ck_assert_ptr_eq(r, null); 2495 terminateO(self); 2496 2497 END_TEST 2498 2499 2500 START_TEST(getKCharSmallDictT) 2501 2502 baset* r; 2503 smallDictt *self = allocG(rtSmallDictt); 2504 2505 smallIntt *c = allocSmallInt(2); 2506 smallDictt *r2 = self->f->setNFreeKChar(self, '1', (baset*) c); 2507 ck_assert_ptr_ne(r2, null); 2508 r = self->f->getKChar(self, '1'); 2509 ck_assert_ptr_ne(r, null); 2510 char *s = toStringO(r); 2511 finishO(r); 2512 ck_assert_str_eq(s, "2"); 2513 free(s); 2514 terminateO(self); 2515 2516 END_TEST 2517 2518 2519 START_TEST(getUndefinedKCharSmallDictT) 2520 2521 undefinedt* r; 2522 smallDictt *self = allocG(rtSmallDictt); 2523 2524 smallDictt *r2 = self->f->setUndefined(self, "1"); 2525 ck_assert_ptr_ne(r2, null); 2526 r = self->f->getUndefinedKChar(self, '1'); 2527 ck_assert_ptr_ne(r, null); 2528 terminateO(r); 2529 terminateO(self); 2530 2531 END_TEST 2532 2533 2534 START_TEST(getBoolKCharSmallDictT) 2535 2536 bool r; 2537 smallDictt *self = allocG(rtSmallDictt); 2538 2539 smallDictt *r2 = self->f->setBool(self, "1", true); 2540 ck_assert_ptr_ne(r2, null); 2541 r = self->f->getBoolKChar(self, '1'); 2542 ck_assert(r); 2543 terminateO(self); 2544 2545 END_TEST 2546 2547 2548 START_TEST(getBoolPKCharSmallDictT) 2549 2550 bool* r; 2551 smallDictt *self = allocG(rtSmallDictt); 2552 2553 smallDictt *r2 = self->f->setBool(self, "1", true); 2554 ck_assert_ptr_ne(r2, null); 2555 r = self->f->getBoolPKChar(self, '1'); 2556 ck_assert_ptr_ne(r, null); 2557 ck_assert(*r); 2558 terminateO(self); 2559 2560 END_TEST 2561 2562 2563 START_TEST(getDoubleKCharSmallDictT) 2564 2565 double r; 2566 smallDictt *self = allocG(rtSmallDictt); 2567 2568 smallDictt *r2 = self->f->setDouble(self, "1", 2.2); 2569 ck_assert_ptr_ne(r2, null); 2570 r = self->f->getDoubleKChar(self, '1'); 2571 ck_assert(r == 2.2); 2572 terminateO(self); 2573 2574 END_TEST 2575 2576 2577 START_TEST(getDoublePKCharSmallDictT) 2578 2579 double* r; 2580 smallDictt *self = allocG(rtSmallDictt); 2581 2582 smallDictt *r2 = self->f->setDouble(self, "1", 2.2); 2583 ck_assert_ptr_ne(r2, null); 2584 r = self->f->getDoublePKChar(self, '1'); 2585 ck_assert_ptr_ne(r, null); 2586 ck_assert(*r == 2.2); 2587 terminateO(self); 2588 2589 END_TEST 2590 2591 2592 START_TEST(getIntKCharSmallDictT) 2593 2594 int64_t r; 2595 smallDictt *self = allocG(rtSmallDictt); 2596 2597 smallDictt *r2 = self->f->setInt(self, "1", 2); 2598 ck_assert_ptr_ne(r2, null); 2599 r = self->f->getIntKChar(self, '1'); 2600 ck_assert_int_eq(r, 2); 2601 terminateO(self); 2602 2603 END_TEST 2604 2605 2606 START_TEST(getIntPKCharSmallDictT) 2607 2608 int64_t* r; 2609 smallDictt *self = allocG(rtSmallDictt); 2610 2611 smallDictt *r2 = self->f->setInt(self, "1", 2); 2612 ck_assert_ptr_ne(r2, null); 2613 r = self->f->getIntPKChar(self, '1'); 2614 ck_assert_ptr_ne(r, null); 2615 ck_assert_int_eq(*r, 2); 2616 terminateO(self); 2617 2618 END_TEST 2619 2620 2621 START_TEST(getInt32KCharSmallDictT) 2622 2623 int32_t r; 2624 smallDictt *self = allocG(rtSmallDictt); 2625 2626 smallDictt *r2 = self->f->setInt(self, "1", 2); 2627 ck_assert_ptr_ne(r2, null); 2628 r = self->f->getInt32KChar(self, '1'); 2629 ck_assert_int_eq(r, 2); 2630 terminateO(self); 2631 2632 END_TEST 2633 2634 2635 START_TEST(getInt32PKCharSmallDictT) 2636 2637 int32_t* r; 2638 smallDictt *self = allocG(rtSmallDictt); 2639 2640 smallDictt *r2 = self->f->setInt(self, "1", 2); 2641 ck_assert_ptr_ne(r2, null); 2642 r = self->f->getInt32PKChar(self, '1'); 2643 ck_assert_ptr_ne(r, null); 2644 ck_assert_int_eq(*r, 2); 2645 terminateO(self); 2646 2647 END_TEST 2648 2649 2650 START_TEST(getUintKCharSmallDictT) 2651 2652 uint64_t r; 2653 smallDictt *self = allocG(rtSmallDictt); 2654 2655 smallDictt *r2 = self->f->setInt(self, "1", 2); 2656 ck_assert_ptr_ne(r2, null); 2657 r = self->f->getUintKChar(self, '1'); 2658 ck_assert_int_eq(r, 2); 2659 terminateO(self); 2660 2661 END_TEST 2662 2663 2664 START_TEST(getUintPKCharSmallDictT) 2665 2666 uint64_t* r; 2667 smallDictt *self = allocG(rtSmallDictt); 2668 2669 smallDictt *r2 = self->f->setInt(self, "1", 2); 2670 ck_assert_ptr_ne(r2, null); 2671 r = self->f->getUintPKChar(self, '1'); 2672 ck_assert_ptr_ne(r, null); 2673 ck_assert_int_eq(*r, 2); 2674 terminateO(self); 2675 2676 END_TEST 2677 2678 2679 START_TEST(getUint32KCharSmallDictT) 2680 2681 uint32_t r; 2682 smallDictt *self = allocG(rtSmallDictt); 2683 2684 smallDictt *r2 = self->f->setInt(self, "1", 2); 2685 ck_assert_ptr_ne(r2, null); 2686 r = self->f->getUint32KChar(self, '1'); 2687 ck_assert_int_eq(r, 2); 2688 terminateO(self); 2689 2690 END_TEST 2691 2692 2693 START_TEST(getUint32PKCharSmallDictT) 2694 2695 uint32_t* r; 2696 smallDictt *self = allocG(rtSmallDictt); 2697 2698 smallDictt *r2 = self->f->setInt(self, "1", 2); 2699 ck_assert_ptr_ne(r2, null); 2700 r = self->f->getUint32PKChar(self, '1'); 2701 ck_assert_ptr_ne(r, null); 2702 ck_assert_int_eq(*r, 2); 2703 terminateO(self); 2704 2705 END_TEST 2706 2707 2708 START_TEST(getSKCharSmallDictT) 2709 2710 char* r; 2711 smallDictt *self = allocG(rtSmallDictt); 2712 2713 smallDictt *r2 = self->f->setS(self, "1", "qwe"); 2714 ck_assert_ptr_ne(r2, null); 2715 r = self->f->getSKChar(self, '1'); 2716 ck_assert_ptr_ne(r, null); 2717 ck_assert_str_eq(r, "qwe"); 2718 terminateO(self); 2719 2720 END_TEST 2721 2722 2723 START_TEST(getDictKCharSmallDictT) 2724 2725 smallDictt* r; 2726 smallDictt *self = allocG(rtSmallDictt); 2727 2728 createAllocateSmallDict(d); 2729 smallDictt *r2 = self->f->setNFreeDict(self, "1", d); 2730 ck_assert_ptr_ne(r2, null); 2731 r = self->f->getDictKChar(self, '1'); 2732 ck_assert_ptr_ne(r, null); 2733 char *s = toStringO(r); 2734 finishO(r); 2735 ck_assert_str_eq(s, "{}"); 2736 free(s); 2737 terminateO(self); 2738 2739 END_TEST 2740 2741 2742 START_TEST(getArrayKCharSmallDictT) 2743 2744 smallArrayt* r; 2745 smallDictt *self = allocG(rtSmallDictt); 2746 2747 createAllocateSmallArray(d); 2748 smallDictt *r2 = self->f->setNFreeArray(self, "1", d); 2749 ck_assert_ptr_ne(r2, null); 2750 r = self->f->getArrayKChar(self, '1'); 2751 ck_assert_ptr_ne(r, null); 2752 char *s = toStringO(r); 2753 finishO(r); 2754 ck_assert_str_eq(s, "[]"); 2755 free(s); 2756 terminateO(self); 2757 2758 END_TEST 2759 2760 2761 START_TEST(getSmallBoolKCharSmallDictT) 2762 2763 smallBoolt* r; 2764 smallDictt *self = allocG(rtSmallDictt); 2765 2766 createAllocateSmallBool(d); 2767 smallDictt *r2 = self->f->setNFreeSmallBool(self, "1", d); 2768 ck_assert_ptr_ne(r2, null); 2769 r = self->f->getSmallBoolKChar(self, '1'); 2770 ck_assert_ptr_ne(r, null); 2771 char *s = toStringO(r); 2772 finishO(r); 2773 ck_assert_str_eq(s, "false"); 2774 free(s); 2775 terminateO(self); 2776 2777 END_TEST 2778 2779 2780 START_TEST(getSmallBytesKCharSmallDictT) 2781 2782 smallBytest* r; 2783 smallDictt *self = allocG(rtSmallDictt); 2784 2785 createAllocateSmallBytes(d); 2786 smallDictt *r2 = self->f->setNFreeSmallBytes(self, "1", d); 2787 ck_assert_ptr_ne(r2, null); 2788 r = self->f->getSmallBytesKChar(self, '1'); 2789 ck_assert_ptr_ne(r, null); 2790 char *s = toStringO(r); 2791 finishO(r); 2792 ck_assert_str_eq(s, "[]"); 2793 free(s); 2794 terminateO(self); 2795 2796 END_TEST 2797 2798 2799 START_TEST(getSmallDoubleKCharSmallDictT) 2800 2801 smallDoublet* r; 2802 smallDictt *self = allocG(rtSmallDictt); 2803 2804 createAllocateSmallDouble(d); 2805 smallDictt *r2 = self->f->setNFreeSmallDouble(self, "1", d); 2806 ck_assert_ptr_ne(r2, null); 2807 r = self->f->getSmallDoubleKChar(self, '1'); 2808 ck_assert_ptr_ne(r, null); 2809 char *s = toStringO(r); 2810 finishO(r); 2811 ck_assert_str_eq(s, "0.000000e+00"); 2812 free(s); 2813 terminateO(self); 2814 2815 END_TEST 2816 2817 2818 START_TEST(getSmallIntKCharSmallDictT) 2819 2820 smallIntt* r; 2821 smallDictt *self = allocG(rtSmallDictt); 2822 2823 createAllocateSmallInt(d); 2824 smallDictt *r2 = self->f->setNFreeSmallInt(self, "1", d); 2825 ck_assert_ptr_ne(r2, null); 2826 r = self->f->getSmallIntKChar(self, '1'); 2827 ck_assert_ptr_ne(r, null); 2828 char *s = toStringO(r); 2829 finishO(r); 2830 ck_assert_str_eq(s, "0"); 2831 free(s); 2832 terminateO(self); 2833 2834 END_TEST 2835 2836 2837 START_TEST(getSmallJsonKCharSmallDictT) 2838 2839 smallJsont* r; 2840 smallDictt *self = allocG(rtSmallDictt); 2841 2842 createAllocateSmallJson(d); 2843 smallDictt *r2 = self->f->setNFreeSmallJson(self, "1", d); 2844 ck_assert_ptr_ne(r2, null); 2845 r = self->f->getSmallJsonKChar(self, '1'); 2846 ck_assert_ptr_ne(r, null); 2847 char *s = toStringO(r); 2848 finishO(r); 2849 ck_assert_str_eq(s, "{}"); 2850 free(s); 2851 terminateO(self); 2852 2853 END_TEST 2854 2855 2856 START_TEST(getSmallStringKCharSmallDictT) 2857 2858 smallStringt* r; 2859 smallDictt *self = allocG(rtSmallDictt); 2860 2861 createAllocateSmallString(d); 2862 smallDictt *r2 = self->f->setNFreeSmallString(self, "1", d); 2863 ck_assert_ptr_ne(r2, null); 2864 r = self->f->getSmallStringKChar(self, '1'); 2865 ck_assert_ptr_ne(r, null); 2866 char *s = toStringO(r); 2867 finishO(r); 2868 ck_assert_str_eq(s, ""); 2869 free(s); 2870 terminateO(self); 2871 2872 END_TEST 2873 2874 2875 START_TEST(getVoidKCharSmallDictT) 2876 2877 void* r; 2878 smallDictt *self = allocG(rtSmallDictt); 2879 2880 smallContainert* d = allocSmallContainer(&r); 2881 smallDictt *r2 = self->f->setNFreeSmallContainer(self, "1", d); 2882 ck_assert_ptr_ne(r2, null); 2883 r = self->f->getVoidKChar(self, '1'); 2884 ck_assert_ptr_eq(r, &r); 2885 terminateO(self); 2886 2887 END_TEST 2888 2889 2890 START_TEST(getSmallContainerKCharSmallDictT) 2891 2892 smallContainert* r; 2893 smallDictt *self = allocG(rtSmallDictt); 2894 2895 createAllocateSmallContainer(d); 2896 smallDictt *r2 = self->f->setNFreeSmallContainer(self, "1", d); 2897 ck_assert_ptr_ne(r2, null); 2898 r = self->f->getSmallContainerKChar(self, '1'); 2899 ck_assert_ptr_ne(r, null); 2900 char *s = toStringO(r); 2901 finishO(r); 2902 ck_assert_str_eq(s, "<data smallContainer>"); 2903 free(s); 2904 terminateO(self); 2905 2906 END_TEST 2907 2908 2909 START_TEST(getNDupSmallDictT) 2910 2911 baset* r; 2912 smallDictt *self = allocG(rtSmallDictt); 2913 2914 smallIntt *c = allocSmallInt(2); 2915 smallDictt *r2 = self->f->setNFreeKChar(self, '1', (baset*) c); 2916 ck_assert_ptr_ne(r2, null); 2917 r = self->f->getNDup(self, "1"); 2918 ck_assert_ptr_ne(r, null); 2919 char *s = toStringO(r); 2920 terminateO(r); 2921 ck_assert_str_eq(s, "2"); 2922 free(s); 2923 // other base class 2924 smallIntt *t = allocSmallInt(3); 2925 t->type = "randomClass"; 2926 r2 = self->f->setNFree(self, "1", (baset*)t); 2927 ck_assert_ptr_ne(r2, null); 2928 r = self->f->getNDup(self, "1"); 2929 ck_assert_ptr_ne(r, null); 2930 s = toStringO(r); 2931 terminateO(r); 2932 ck_assert_str_eq(s, "3"); 2933 free(s); 2934 // null key 2935 r = self->f->getNDup(self, null); 2936 ck_assert_ptr_eq(r, null); 2937 // empty self 2938 freeO(self); 2939 r = self->f->getNDup(self, "1"); 2940 ck_assert_ptr_eq(r, null); 2941 terminateO(self); 2942 2943 END_TEST 2944 2945 2946 START_TEST(getNDupUndefinedSmallDictT) 2947 2948 undefinedt* r; 2949 smallDictt *self = allocG(rtSmallDictt); 2950 2951 smallDictt *r2 = self->f->setUndefined(self, "1"); 2952 ck_assert_ptr_ne(r2, null); 2953 r = self->f->getNDupUndefined(self, "1"); 2954 ck_assert_ptr_ne(r, null); 2955 terminateO(r); 2956 // non undefined object 2957 r2 = self->f->setInt(self, "1", 2); 2958 ck_assert_ptr_ne(r2, null); 2959 r = self->f->getNDupUndefined(self, "1"); 2960 ck_assert_ptr_eq(r, null); 2961 // null key 2962 r = self->f->getNDupUndefined(self, null); 2963 ck_assert_ptr_eq(r, null); 2964 // empty self 2965 freeO(self); 2966 r = self->f->getNDupUndefined(self, "1"); 2967 ck_assert_ptr_eq(r, null); 2968 terminateO(self); 2969 2970 END_TEST 2971 2972 2973 START_TEST(getNDupBoolSmallDictT) 2974 2975 bool r; 2976 smallDictt *self = allocG(rtSmallDictt); 2977 2978 smallDictt *r2 = self->f->setBool(self, "1", true); 2979 ck_assert_ptr_ne(r2, null); 2980 r = self->f->getNDupBool(self, "1"); 2981 ck_assert(r); 2982 // non bool object 2983 r2 = self->f->setInt(self, "1", 2); 2984 ck_assert_ptr_ne(r2, null); 2985 r = self->f->getNDupBool(self, "1"); 2986 ck_assert(!r); 2987 // null key 2988 r = self->f->getNDupBool(self, null); 2989 ck_assert(!r); 2990 // empty self 2991 freeO(self); 2992 r = self->f->getNDupBool(self, "1"); 2993 ck_assert(!r); 2994 terminateO(self); 2995 2996 END_TEST 2997 2998 2999 START_TEST(getNDupDoubleSmallDictT) 3000 3001 double r; 3002 smallDictt *self = allocG(rtSmallDictt); 3003 3004 smallDictt *r2 = self->f->setDouble(self, "1", 2.2); 3005 ck_assert_ptr_ne(r2, null); 3006 r = self->f->getNDupDouble(self, "1"); 3007 ck_assert(r == 2.2); 3008 // non double object 3009 r2 = self->f->setInt(self, "1", 2); 3010 ck_assert_ptr_ne(r2, null); 3011 r = self->f->getNDupDouble(self, "1"); 3012 ck_assert(r == 0); 3013 // null key 3014 r = self->f->getNDupDouble(self, null); 3015 ck_assert(r == 0); 3016 // empty self 3017 freeO(self); 3018 r = self->f->getNDupDouble(self, "1"); 3019 ck_assert(!r); 3020 terminateO(self); 3021 3022 END_TEST 3023 3024 3025 START_TEST(getNDupIntSmallDictT) 3026 3027 int64_t r; 3028 smallDictt *self = allocG(rtSmallDictt); 3029 3030 smallDictt *r2 = self->f->setInt(self, "1", 2); 3031 ck_assert_ptr_ne(r2, null); 3032 r = self->f->getNDupInt(self, "1"); 3033 ck_assert_int_eq(r, 2); 3034 // non int object 3035 r2 = self->f->setBool(self, "1", true); 3036 ck_assert_ptr_ne(r2, null); 3037 r = self->f->getNDupInt(self, "1"); 3038 ck_assert(!r); 3039 // null key 3040 r = self->f->getNDupInt(self, null); 3041 ck_assert_int_eq(r, 0); 3042 // empty self 3043 freeO(self); 3044 r = self->f->getNDupInt(self, "1"); 3045 ck_assert(!r); 3046 terminateO(self); 3047 3048 END_TEST 3049 3050 3051 START_TEST(getNDupInt32SmallDictT) 3052 3053 int32_t r; 3054 smallDictt *self = allocG(rtSmallDictt); 3055 3056 smallDictt *r2 = self->f->setInt(self, "1", 2); 3057 ck_assert_ptr_ne(r2, null); 3058 r = self->f->getNDupInt32(self, "1"); 3059 ck_assert_int_eq(r, 2); 3060 // non int object 3061 r2 = self->f->setBool(self, "1", true); 3062 ck_assert_ptr_ne(r2, null); 3063 r = self->f->getNDupInt32(self, "1"); 3064 ck_assert(!r); 3065 // null key 3066 r = self->f->getNDupInt32(self, null); 3067 ck_assert_int_eq(r, 0); 3068 // empty self 3069 freeO(self); 3070 r = self->f->getNDupInt32(self, "1"); 3071 ck_assert(!r); 3072 terminateO(self); 3073 3074 END_TEST 3075 3076 3077 START_TEST(getNDupUintSmallDictT) 3078 3079 uint64_t r; 3080 smallDictt *self = allocG(rtSmallDictt); 3081 3082 smallDictt *r2 = self->f->setInt(self, "1", 2); 3083 ck_assert_ptr_ne(r2, null); 3084 r = self->f->getNDupUint(self, "1"); 3085 ck_assert_int_eq(r, 2); 3086 // non int object 3087 r2 = self->f->setBool(self, "1", true); 3088 ck_assert_ptr_ne(r2, null); 3089 r = self->f->getNDupUint(self, "1"); 3090 ck_assert(!r); 3091 // null key 3092 r = self->f->getNDupUint(self, null); 3093 ck_assert_int_eq(r, 0); 3094 // empty self 3095 freeO(self); 3096 r = self->f->getNDupUint(self, "1"); 3097 ck_assert(!r); 3098 terminateO(self); 3099 3100 END_TEST 3101 3102 3103 START_TEST(getNDupUint32SmallDictT) 3104 3105 uint32_t r; 3106 smallDictt *self = allocG(rtSmallDictt); 3107 3108 smallDictt *r2 = self->f->setInt(self, "1", 2); 3109 ck_assert_ptr_ne(r2, null); 3110 r = self->f->getNDupUint32(self, "1"); 3111 ck_assert_int_eq(r, 2); 3112 // non int object 3113 r2 = self->f->setBool(self, "1", true); 3114 ck_assert_ptr_ne(r2, null); 3115 r = self->f->getNDupUint32(self, "1"); 3116 ck_assert(!r); 3117 // null key 3118 r = self->f->getNDupUint32(self, null); 3119 ck_assert_int_eq(r, 0); 3120 // empty self 3121 freeO(self); 3122 r = self->f->getNDupUint32(self, "1"); 3123 ck_assert(!r); 3124 terminateO(self); 3125 3126 END_TEST 3127 3128 3129 START_TEST(getNDupSSmallDictT) 3130 3131 char* r; 3132 smallDictt *self = allocG(rtSmallDictt); 3133 3134 smallDictt *r2 = self->f->setS(self, "1", "qwe"); 3135 ck_assert_ptr_ne(r2, null); 3136 r = self->f->getNDupS(self, "1"); 3137 ck_assert_ptr_ne(r, null); 3138 ck_assert_str_eq(r, "qwe"); 3139 free(r); 3140 // non string object 3141 r2 = self->f->setBool(self, "1", true); 3142 ck_assert_ptr_ne(r2, null); 3143 r = self->f->getNDupS(self, "1"); 3144 ck_assert_ptr_eq(r, null); 3145 // null key 3146 r = self->f->getNDupS(self, null); 3147 ck_assert_ptr_eq(r, null); 3148 // empty self 3149 freeO(self); 3150 r = self->f->getNDupS(self, "1"); 3151 ck_assert_ptr_eq(r, null); 3152 terminateO(self); 3153 3154 END_TEST 3155 3156 3157 START_TEST(getNDupDictSmallDictT) 3158 3159 smallDictt* r; 3160 smallDictt *self = allocG(rtSmallDictt); 3161 3162 createAllocateSmallDict(d); 3163 smallDictt *r2 = self->f->setNFreeDict(self, "1", d); 3164 ck_assert_ptr_ne(r2, null); 3165 r = self->f->getNDupDict(self, "1"); 3166 ck_assert_ptr_ne(r, null); 3167 char *s = toStringO(r); 3168 terminateO(r); 3169 ck_assert_str_eq(s, "{}"); 3170 free(s); 3171 // non dict object 3172 r2 = self->f->setBool(self, "1", true); 3173 ck_assert_ptr_ne(r2, null); 3174 r = self->f->getNDupDict(self, "1"); 3175 ck_assert_ptr_eq(r, null); 3176 // null key 3177 r = self->f->getNDupDict(self, null); 3178 ck_assert_ptr_eq(r, null); 3179 // empty self 3180 freeO(self); 3181 r = self->f->getNDupDict(self, "1"); 3182 ck_assert_ptr_eq(r, null); 3183 terminateO(self); 3184 3185 END_TEST 3186 3187 3188 START_TEST(getNDupArraySmallDictT) 3189 3190 smallArrayt* r; 3191 smallDictt *self = allocG(rtSmallDictt); 3192 3193 createAllocateSmallArray(d); 3194 smallDictt *r2 = self->f->setNFreeArray(self, "1", d); 3195 ck_assert_ptr_ne(r2, null); 3196 r = self->f->getNDupArray(self, "1"); 3197 ck_assert_ptr_ne(r, null); 3198 char *s = toStringO(r); 3199 terminateO(r); 3200 ck_assert_str_eq(s, "[]"); 3201 free(s); 3202 // non Array object 3203 r2 = self->f->setBool(self, "1", true); 3204 ck_assert_ptr_ne(r2, null); 3205 r = self->f->getNDupArray(self, "1"); 3206 ck_assert_ptr_eq(r, null); 3207 // null key 3208 r = self->f->getNDupArray(self, null); 3209 ck_assert_ptr_eq(r, null); 3210 // empty self 3211 freeO(self); 3212 r = self->f->getNDupArray(self, "1"); 3213 ck_assert_ptr_eq(r, null); 3214 terminateO(self); 3215 3216 END_TEST 3217 3218 3219 START_TEST(getNDupSmallBoolSmallDictT) 3220 3221 smallBoolt* r; 3222 smallDictt *self = allocG(rtSmallDictt); 3223 3224 createAllocateSmallBool(d); 3225 smallDictt *r2 = self->f->setNFreeSmallBool(self, "1", d); 3226 ck_assert_ptr_ne(r2, null); 3227 r = self->f->getNDupSmallBool(self, "1"); 3228 ck_assert_ptr_ne(r, null); 3229 char *s = toStringO(r); 3230 terminateO(r); 3231 ck_assert_str_eq(s, "false"); 3232 free(s); 3233 // non SmallBool object 3234 r2 = self->f->setInt(self, "1", 0); 3235 ck_assert_ptr_ne(r2, null); 3236 r = self->f->getNDupSmallBool(self, "1"); 3237 ck_assert_ptr_eq(r, null); 3238 // null key 3239 r = self->f->getNDupSmallBool(self, null); 3240 ck_assert_ptr_eq(r, null); 3241 // empty self 3242 freeO(self); 3243 r = self->f->getNDupSmallBool(self, "1"); 3244 ck_assert_ptr_eq(r, null); 3245 terminateO(self); 3246 3247 END_TEST 3248 3249 3250 START_TEST(getNDupSmallBytesSmallDictT) 3251 3252 smallBytest* r; 3253 smallDictt *self = allocG(rtSmallDictt); 3254 3255 createAllocateSmallBytes(d); 3256 smallDictt *r2 = self->f->setNFreeSmallBytes(self, "1", d); 3257 ck_assert_ptr_ne(r2, null); 3258 r = self->f->getNDupSmallBytes(self, "1"); 3259 ck_assert_ptr_ne(r, null); 3260 char *s = toStringO(r); 3261 terminateO(r); 3262 ck_assert_str_eq(s, "[]"); 3263 free(s); 3264 // non SmallBytes object 3265 r2 = self->f->setBool(self, "1", true); 3266 ck_assert_ptr_ne(r2, null); 3267 r = self->f->getNDupSmallBytes(self, "1"); 3268 ck_assert_ptr_eq(r, null); 3269 // null key 3270 r = self->f->getNDupSmallBytes(self, null); 3271 ck_assert_ptr_eq(r, null); 3272 // empty self 3273 freeO(self); 3274 r = self->f->getNDupSmallBytes(self, "1"); 3275 ck_assert_ptr_eq(r, null); 3276 terminateO(self); 3277 3278 END_TEST 3279 3280 3281 START_TEST(getNDupSmallDoubleSmallDictT) 3282 3283 smallDoublet* r; 3284 smallDictt *self = allocG(rtSmallDictt); 3285 3286 createAllocateSmallDouble(d); 3287 smallDictt *r2 = self->f->setNFreeSmallDouble(self, "1", d); 3288 ck_assert_ptr_ne(r2, null); 3289 r = self->f->getNDupSmallDouble(self, "1"); 3290 ck_assert_ptr_ne(r, null); 3291 char *s = toStringO(r); 3292 terminateO(r); 3293 ck_assert_str_eq(s, "0.000000e+00"); 3294 free(s); 3295 // non SmallDouble object 3296 r2 = self->f->setBool(self, "1", true); 3297 ck_assert_ptr_ne(r2, null); 3298 r = self->f->getNDupSmallDouble(self, "1"); 3299 ck_assert_ptr_eq(r, null); 3300 // null key 3301 r = self->f->getNDupSmallDouble(self, null); 3302 ck_assert_ptr_eq(r, null); 3303 // empty self 3304 freeO(self); 3305 r = self->f->getNDupSmallDouble(self, "1"); 3306 ck_assert_ptr_eq(r, null); 3307 terminateO(self); 3308 3309 END_TEST 3310 3311 3312 START_TEST(getNDupSmallIntSmallDictT) 3313 3314 smallIntt* r; 3315 smallDictt *self = allocG(rtSmallDictt); 3316 3317 createAllocateSmallInt(d); 3318 smallDictt *r2 = self->f->setNFreeSmallInt(self, "1", d); 3319 ck_assert_ptr_ne(r2, null); 3320 r = self->f->getNDupSmallInt(self, "1"); 3321 ck_assert_ptr_ne(r, null); 3322 char *s = toStringO(r); 3323 terminateO(r); 3324 ck_assert_str_eq(s, "0"); 3325 free(s); 3326 // non SmallInt object 3327 r2 = self->f->setBool(self, "1", true); 3328 ck_assert_ptr_ne(r2, null); 3329 r = self->f->getNDupSmallInt(self, "1"); 3330 ck_assert_ptr_eq(r, null); 3331 // null key 3332 r = self->f->getNDupSmallInt(self, null); 3333 ck_assert_ptr_eq(r, null); 3334 // empty self 3335 freeO(self); 3336 r = self->f->getNDupSmallInt(self, "1"); 3337 ck_assert_ptr_eq(r, null); 3338 terminateO(self); 3339 3340 END_TEST 3341 3342 3343 START_TEST(getNDupSmallJsonSmallDictT) 3344 3345 smallJsont* r; 3346 smallDictt *self = allocG(rtSmallDictt); 3347 3348 createAllocateSmallJson(d); 3349 smallDictt *r2 = self->f->setNFreeSmallJson(self, "1", d); 3350 ck_assert_ptr_ne(r2, null); 3351 r = self->f->getNDupSmallJson(self, "1"); 3352 ck_assert_ptr_ne(r, null); 3353 char *s = toStringO(r); 3354 terminateO(r); 3355 ck_assert_str_eq(s, "{}"); 3356 free(s); 3357 r2 = self->f->setBool(self, "1", true); 3358 ck_assert_ptr_ne(r2, null); 3359 r = self->f->getNDupSmallJson(self, "1"); 3360 ck_assert_ptr_ne(r, null); 3361 s = toStringO(r); 3362 terminateO(r); 3363 ck_assert_str_eq(s, "true"); 3364 free(s); 3365 // non SmallJson object 3366 smallContainert *c = allocSmallContainer(NULL); 3367 r2 = self->f->setNFreeSmallContainer(self, "1", c); 3368 ck_assert_ptr_ne(r2, null); 3369 r = self->f->getNDupSmallJson(self, "1"); 3370 ck_assert_ptr_eq(r, null); 3371 // null key 3372 r = self->f->getNDupSmallJson(self, null); 3373 ck_assert_ptr_eq(r, null); 3374 // empty self 3375 freeO(self); 3376 r = self->f->getNDupSmallJson(self, "1"); 3377 ck_assert_ptr_eq(r, null); 3378 terminateO(self); 3379 3380 END_TEST 3381 3382 3383 START_TEST(getNDupSmallStringSmallDictT) 3384 3385 smallStringt* r; 3386 smallDictt *self = allocG(rtSmallDictt); 3387 3388 createAllocateSmallString(d); 3389 smallDictt *r2 = self->f->setNFreeSmallString(self, "1", d); 3390 ck_assert_ptr_ne(r2, null); 3391 r = self->f->getNDupSmallString(self, "1"); 3392 ck_assert_ptr_ne(r, null); 3393 char *s = toStringO(r); 3394 terminateO(r); 3395 ck_assert_str_eq(s, ""); 3396 free(s); 3397 // non SmallString object 3398 r2 = self->f->setBool(self, "1", true); 3399 ck_assert_ptr_ne(r2, null); 3400 r = self->f->getNDupSmallString(self, "1"); 3401 ck_assert_ptr_eq(r, null); 3402 // null key 3403 r = self->f->getNDupSmallString(self, null); 3404 ck_assert_ptr_eq(r, null); 3405 // empty self 3406 freeO(self); 3407 r = self->f->getNDupSmallString(self, "1"); 3408 ck_assert_ptr_eq(r, null); 3409 terminateO(self); 3410 3411 END_TEST 3412 3413 3414 START_TEST(getNDupVoidSmallDictT) 3415 3416 void* r; 3417 smallDictt *self = allocG(rtSmallDictt); 3418 3419 smallContainert* d = allocSmallContainer(&r); 3420 smallDictt *r2 = self->f->setNFreeSmallContainer(self, "1", d); 3421 ck_assert_ptr_ne(r2, null); 3422 r = self->f->getNDupVoid(self, "1"); 3423 // result is null because the duplicate function in the container 3424 // is not set. 3425 ck_assert_ptr_eq(r, null); 3426 // non container object 3427 r2 = self->f->setBool(self, "1", true); 3428 ck_assert_ptr_ne(r2, null); 3429 r = self->f->getNDupVoid(self, "1"); 3430 ck_assert_ptr_eq(r, null); 3431 // null key 3432 r = self->f->getNDupVoid(self, null); 3433 ck_assert_ptr_eq(r, null); 3434 // empty self 3435 freeO(self); 3436 r = self->f->getNDupVoid(self, "1"); 3437 ck_assert_ptr_eq(r, null); 3438 terminateO(self); 3439 3440 END_TEST 3441 3442 3443 START_TEST(getNDupSmallContainerSmallDictT) 3444 3445 smallContainert* r; 3446 smallDictt *self = allocG(rtSmallDictt); 3447 3448 createAllocateSmallContainer(d); 3449 smallDictt *r2 = self->f->setNFreeSmallContainer(self, "1", d); 3450 ck_assert_ptr_ne(r2, null); 3451 r = self->f->getNDupSmallContainer(self, "1"); 3452 ck_assert_ptr_ne(r, null); 3453 char *s = toStringO(r); 3454 terminateO(r); 3455 ck_assert_str_eq(s, "<data smallContainer>"); 3456 free(s); 3457 // other base class 3458 smallIntt *t = allocSmallInt(2); 3459 t->type = "randomClass"; 3460 r2 = self->f->setNFree(self, "1", (baset*)t); 3461 ck_assert_ptr_ne(r2, null); 3462 r = self->f->getNDupSmallContainer(self, "1"); 3463 ck_assert_ptr_eq(r, null); 3464 // non SmallContainer object 3465 r2 = self->f->setBool(self, "1", true); 3466 ck_assert_ptr_ne(r2, null); 3467 r = self->f->getNDupSmallContainer(self, "1"); 3468 ck_assert_ptr_eq(r, null); 3469 // null key 3470 r = self->f->getNDupSmallContainer(self, null); 3471 ck_assert_ptr_eq(r, null); 3472 // empty self 3473 freeO(self); 3474 r = self->f->getNDupSmallContainer(self, "1"); 3475 ck_assert_ptr_eq(r, null); 3476 terminateO(self); 3477 3478 END_TEST 3479 3480 3481 START_TEST(getNDupKCharSmallDictT) 3482 3483 baset* r; 3484 smallDictt *self = allocG(rtSmallDictt); 3485 3486 smallIntt *c = allocSmallInt(2); 3487 smallDictt *r2 = self->f->setNFreeKChar(self, '1', (baset*) c); 3488 ck_assert_ptr_ne(r2, null); 3489 r = self->f->getNDupKChar(self, '1'); 3490 ck_assert_ptr_ne(r, null); 3491 char *s = toStringO(r); 3492 terminateO(r); 3493 ck_assert_str_eq(s, "2"); 3494 free(s); 3495 terminateO(self); 3496 3497 END_TEST 3498 3499 3500 START_TEST(getNDupUndefinedKCharSmallDictT) 3501 3502 undefinedt* r; 3503 smallDictt *self = allocG(rtSmallDictt); 3504 3505 smallDictt *r2 = self->f->setUndefined(self, "1"); 3506 ck_assert_ptr_ne(r2, null); 3507 r = self->f->getNDupUndefinedKChar(self, '1'); 3508 ck_assert_ptr_ne(r, null); 3509 terminateO(r); 3510 terminateO(self); 3511 3512 END_TEST 3513 3514 3515 START_TEST(getNDupBoolKCharSmallDictT) 3516 3517 bool r; 3518 smallDictt *self = allocG(rtSmallDictt); 3519 3520 smallDictt *r2 = self->f->setBool(self, "1", true); 3521 ck_assert_ptr_ne(r2, null); 3522 r = self->f->getNDupBoolKChar(self, '1'); 3523 ck_assert(r); 3524 terminateO(self); 3525 3526 END_TEST 3527 3528 3529 START_TEST(getNDupDoubleKCharSmallDictT) 3530 3531 double r; 3532 smallDictt *self = allocG(rtSmallDictt); 3533 3534 smallDictt *r2 = self->f->setDouble(self, "1", 2.2); 3535 ck_assert_ptr_ne(r2, null); 3536 r = self->f->getNDupDoubleKChar(self, '1'); 3537 ck_assert(r == 2.2); 3538 terminateO(self); 3539 3540 END_TEST 3541 3542 3543 START_TEST(getNDupIntKCharSmallDictT) 3544 3545 int64_t r; 3546 smallDictt *self = allocG(rtSmallDictt); 3547 3548 smallDictt *r2 = self->f->setInt(self, "1", 2); 3549 ck_assert_ptr_ne(r2, null); 3550 r = self->f->getNDupIntKChar(self, '1'); 3551 ck_assert_int_eq(r, 2); 3552 terminateO(self); 3553 3554 END_TEST 3555 3556 3557 START_TEST(getNDupInt32KCharSmallDictT) 3558 3559 int32_t r; 3560 smallDictt *self = allocG(rtSmallDictt); 3561 3562 smallDictt *r2 = self->f->setInt(self, "1", 2); 3563 ck_assert_ptr_ne(r2, null); 3564 r = self->f->getNDupInt32KChar(self, '1'); 3565 ck_assert_int_eq(r, 2); 3566 terminateO(self); 3567 3568 END_TEST 3569 3570 3571 START_TEST(getNDupUintKCharSmallDictT) 3572 3573 uint64_t r; 3574 smallDictt *self = allocG(rtSmallDictt); 3575 3576 smallDictt *r2 = self->f->setInt(self, "1", 2); 3577 ck_assert_ptr_ne(r2, null); 3578 r = self->f->getNDupUintKChar(self, '1'); 3579 ck_assert_int_eq(r, 2); 3580 terminateO(self); 3581 3582 END_TEST 3583 3584 3585 START_TEST(getNDupUint32KCharSmallDictT) 3586 3587 uint32_t r; 3588 smallDictt *self = allocG(rtSmallDictt); 3589 3590 smallDictt *r2 = self->f->setInt(self, "1", 2); 3591 ck_assert_ptr_ne(r2, null); 3592 r = self->f->getNDupUint32KChar(self, '1'); 3593 ck_assert_int_eq(r, 2); 3594 terminateO(self); 3595 3596 END_TEST 3597 3598 3599 START_TEST(getNDupSKCharSmallDictT) 3600 3601 char* r; 3602 smallDictt *self = allocG(rtSmallDictt); 3603 3604 smallDictt *r2 = self->f->setS(self, "1", "qwe"); 3605 ck_assert_ptr_ne(r2, null); 3606 r = self->f->getNDupSKChar(self, '1'); 3607 ck_assert_ptr_ne(r, null); 3608 ck_assert_str_eq(r, "qwe"); 3609 free(r); 3610 terminateO(self); 3611 3612 END_TEST 3613 3614 3615 START_TEST(getNDupDictKCharSmallDictT) 3616 3617 smallDictt* r; 3618 smallDictt *self = allocG(rtSmallDictt); 3619 3620 createAllocateSmallDict(d); 3621 smallDictt *r2 = self->f->setNFreeDict(self, "1", d); 3622 ck_assert_ptr_ne(r2, null); 3623 r = self->f->getNDupDictKChar(self, '1'); 3624 ck_assert_ptr_ne(r, null); 3625 char *s = toStringO(r); 3626 terminateO(r); 3627 ck_assert_str_eq(s, "{}"); 3628 free(s); 3629 terminateO(self); 3630 3631 END_TEST 3632 3633 3634 START_TEST(getNDupArrayKCharSmallDictT) 3635 3636 smallArrayt* r; 3637 smallDictt *self = allocG(rtSmallDictt); 3638 3639 createAllocateSmallArray(d); 3640 smallDictt *r2 = self->f->setNFreeArray(self, "1", d); 3641 ck_assert_ptr_ne(r2, null); 3642 r = self->f->getNDupArrayKChar(self, '1'); 3643 ck_assert_ptr_ne(r, null); 3644 char *s = toStringO(r); 3645 terminateO(r); 3646 ck_assert_str_eq(s, "[]"); 3647 free(s); 3648 terminateO(self); 3649 3650 END_TEST 3651 3652 3653 START_TEST(getNDupSmallBoolKCharSmallDictT) 3654 3655 smallBoolt* r; 3656 smallDictt *self = allocG(rtSmallDictt); 3657 3658 createAllocateSmallBool(d); 3659 smallDictt *r2 = self->f->setNFreeSmallBool(self, "1", d); 3660 ck_assert_ptr_ne(r2, null); 3661 r = self->f->getNDupSmallBoolKChar(self, '1'); 3662 ck_assert_ptr_ne(r, null); 3663 char *s = toStringO(r); 3664 terminateO(r); 3665 ck_assert_str_eq(s, "false"); 3666 free(s); 3667 terminateO(self); 3668 3669 END_TEST 3670 3671 3672 START_TEST(getNDupSmallBytesKCharSmallDictT) 3673 3674 smallBytest* r; 3675 smallDictt *self = allocG(rtSmallDictt); 3676 3677 createAllocateSmallBytes(d); 3678 smallDictt *r2 = self->f->setNFreeSmallBytes(self, "1", d); 3679 ck_assert_ptr_ne(r2, null); 3680 r = self->f->getNDupSmallBytesKChar(self, '1'); 3681 ck_assert_ptr_ne(r, null); 3682 char *s = toStringO(r); 3683 terminateO(r); 3684 ck_assert_str_eq(s, "[]"); 3685 free(s); 3686 terminateO(self); 3687 3688 END_TEST 3689 3690 3691 START_TEST(getNDupSmallDoubleKCharSmallDictT) 3692 3693 smallDoublet* r; 3694 smallDictt *self = allocG(rtSmallDictt); 3695 3696 createAllocateSmallDouble(d); 3697 smallDictt *r2 = self->f->setNFreeSmallDouble(self, "1", d); 3698 ck_assert_ptr_ne(r2, null); 3699 r = self->f->getNDupSmallDoubleKChar(self, '1'); 3700 ck_assert_ptr_ne(r, null); 3701 char *s = toStringO(r); 3702 terminateO(r); 3703 ck_assert_str_eq(s, "0.000000e+00"); 3704 free(s); 3705 terminateO(self); 3706 3707 END_TEST 3708 3709 3710 START_TEST(getNDupSmallIntKCharSmallDictT) 3711 3712 smallIntt* r; 3713 smallDictt *self = allocG(rtSmallDictt); 3714 3715 createAllocateSmallInt(d); 3716 smallDictt *r2 = self->f->setNFreeSmallInt(self, "1", d); 3717 ck_assert_ptr_ne(r2, null); 3718 r = self->f->getNDupSmallIntKChar(self, '1'); 3719 ck_assert_ptr_ne(r, null); 3720 char *s = toStringO(r); 3721 terminateO(r); 3722 ck_assert_str_eq(s, "0"); 3723 free(s); 3724 terminateO(self); 3725 3726 END_TEST 3727 3728 3729 START_TEST(getNDupSmallJsonKCharSmallDictT) 3730 3731 smallJsont* r; 3732 smallDictt *self = allocG(rtSmallDictt); 3733 3734 createAllocateSmallJson(d); 3735 smallDictt *r2 = self->f->setNFreeSmallJson(self, "1", d); 3736 ck_assert_ptr_ne(r2, null); 3737 r = self->f->getNDupSmallJsonKChar(self, '1'); 3738 ck_assert_ptr_ne(r, null); 3739 char *s = toStringO(r); 3740 terminateO(r); 3741 ck_assert_str_eq(s, "{}"); 3742 free(s); 3743 terminateO(self); 3744 3745 END_TEST 3746 3747 3748 START_TEST(getNDupSmallStringKCharSmallDictT) 3749 3750 smallStringt* r; 3751 smallDictt *self = allocG(rtSmallDictt); 3752 3753 createAllocateSmallString(d); 3754 smallDictt *r2 = self->f->setNFreeSmallString(self, "1", d); 3755 ck_assert_ptr_ne(r2, null); 3756 r = self->f->getNDupSmallStringKChar(self, '1'); 3757 ck_assert_ptr_ne(r, null); 3758 char *s = toStringO(r); 3759 terminateO(r); 3760 ck_assert_str_eq(s, ""); 3761 free(s); 3762 terminateO(self); 3763 3764 END_TEST 3765 3766 3767 START_TEST(getNDupVoidKCharSmallDictT) 3768 3769 void* r; 3770 smallDictt *self = allocG(rtSmallDictt); 3771 3772 smallContainert* d = allocSmallContainer(&r); 3773 smallDictt *r2 = self->f->setNFreeSmallContainer(self, "1", d); 3774 ck_assert_ptr_ne(r2, null); 3775 r = self->f->getNDupVoidKChar(self, '1'); 3776 // result is null because the duplicate function in the container 3777 // is not set. 3778 ck_assert_ptr_eq(r, null); 3779 terminateO(self); 3780 3781 END_TEST 3782 3783 3784 START_TEST(getNDupSmallContainerKCharSmallDictT) 3785 3786 smallContainert* r; 3787 smallDictt *self = allocG(rtSmallDictt); 3788 3789 createAllocateSmallContainer(d); 3790 smallDictt *r2 = self->f->setNFreeSmallContainer(self, "1", d); 3791 ck_assert_ptr_ne(r2, null); 3792 r = self->f->getNDupSmallContainerKChar(self, '1'); 3793 ck_assert_ptr_ne(r, null); 3794 char *s = toStringO(r); 3795 terminateO(r); 3796 ck_assert_str_eq(s, "<data smallContainer>"); 3797 free(s); 3798 terminateO(self); 3799 3800 END_TEST 3801 3802 3803 START_TEST(getNumSmallDictT) 3804 3805 double r; 3806 smallDictt *self = allocG(rtSmallDictt); 3807 smallDictt *r2; 3808 3809 r2 = self->f->setInt(self, "1", 1); 3810 ck_assert_ptr_ne(r2, null); 3811 r2 = self->f->setDouble(self, "2", 2.2); 3812 ck_assert_ptr_ne(r2, null); 3813 r2 = self->f->setS(self, "3", "2"); 3814 ck_assert_ptr_ne(r2, null); 3815 r = getNumO(self, "1"); 3816 ck_assert(r == 1); 3817 r = getNumO(self, "2"); 3818 ck_assert(r == 2.2); 3819 // not a number 3820 r = getNumO(self, "3"); 3821 ck_assert(r == 0); 3822 // null key 3823 r = getNumO(self, null); 3824 ck_assert(r == 0); 3825 // empty self 3826 freeO(self); 3827 r = getNumO(self, "1"); 3828 ck_assert(r == 0); 3829 terminateO(self); 3830 3831 END_TEST 3832 3833 3834 START_TEST(cropElemSmallDictT) 3835 3836 baset* r; 3837 smallDictt *self = allocG(rtSmallDictt); 3838 smallDictt *r2; 3839 3840 r2 = self->f->setInt(self, "1", 1); 3841 ck_assert_ptr_ne(r2, null); 3842 r2 = self->f->setDouble(self, "2", 2.2); 3843 ck_assert_ptr_ne(r2, null); 3844 r2 = self->f->setS(self, "3", "2"); 3845 ck_assert_ptr_ne(r2, null); 3846 r2 = self->f->setUndefined(self, "u"); 3847 ck_assert_ptr_ne(r2, null); 3848 createSmallContainer(c); 3849 r2 = self->f->setSmallContainer(self, "c", &c); 3850 ck_assert_ptr_ne(r2, null); 3851 createAllocateSmallInt(I); 3852 setValG(I, 11); 3853 I->type = "anothertype"; 3854 r2 = self->f->set(self, "b", (baset*)I); 3855 ck_assert_ptr_ne(r2, null); 3856 // get int 3857 r = cropElemO(self, "3"); 3858 ck_assert_ptr_ne(r, null); 3859 char *s = toStringO(r); 3860 terminateO(r); 3861 ck_assert_str_eq(s, "2"); 3862 free(s); 3863 s = toStringO(self); 3864 ck_assert_str_eq(s, "{\"1\":1,\"2\":2.200000e+00,\"u\":null,\"c\":\"<data container>\",\"b\":\"<data container>\"}"); 3865 free(s); 3866 // undefined object 3867 r = cropElemO(self, "u"); 3868 ck_assert_ptr_ne(r, null); 3869 s = toStringO(r); 3870 terminateO(r); 3871 ck_assert_str_eq(s, "null"); 3872 free(s); 3873 s = toStringO(self); 3874 ck_assert_str_eq(s, "{\"1\":1,\"2\":2.200000e+00,\"c\":\"<data container>\",\"b\":\"<data container>\"}"); 3875 free(s); 3876 // container 3877 r = cropElemO(self, "c"); 3878 ck_assert_ptr_ne(r, null); 3879 s = toStringO(r); 3880 terminateO(r); 3881 ck_assert_str_eq(s, "<data smallContainer>"); 3882 free(s); 3883 s = toStringO(self); 3884 ck_assert_str_eq(s, "{\"1\":1,\"2\":2.200000e+00,\"b\":\"<data container>\"}"); 3885 free(s); 3886 // base object in container 3887 r = cropElemO(self, "b"); 3888 ck_assert_ptr_ne(r, null); 3889 s = toStringO(r); 3890 terminateO(r); 3891 ck_assert_str_eq(s, "11"); 3892 free(s); 3893 s = toStringO(self); 3894 ck_assert_str_eq(s, "{\"1\":1,\"2\":2.200000e+00}"); 3895 free(s); 3896 // non existing key 3897 r = cropElemO(self, "qwe"); 3898 ck_assert_ptr_eq(r, null); 3899 // null key 3900 r = cropElemO(self, null); 3901 ck_assert_ptr_eq(r, null); 3902 // empty self 3903 freeO(self); 3904 r = cropElemO(self, "1"); 3905 ck_assert_ptr_eq(r, null); 3906 terminateO(self); 3907 3908 END_TEST 3909 3910 3911 START_TEST(cropElemUndefinedSmallDictT) 3912 3913 undefinedt* r; 3914 smallDictt *self = allocG(rtSmallDictt); 3915 smallDictt *r2; 3916 3917 r2 = self->f->setInt(self, "1", 1); 3918 ck_assert_ptr_ne(r2, null); 3919 r2 = self->f->setDouble(self, "2", 2.2); 3920 ck_assert_ptr_ne(r2, null); 3921 r2 = self->f->setUndefined(self, "u"); 3922 ck_assert_ptr_ne(r2, null); 3923 r = cropElemUndefinedO(self, "u"); 3924 ck_assert_ptr_ne(r, null); 3925 char *s = toStringO(r); 3926 terminateO(r); 3927 ck_assert_str_eq(s, "null"); 3928 free(s); 3929 s = toStringO(self); 3930 ck_assert_str_eq(s, "{\"1\":1,\"2\":2.200000e+00}"); 3931 free(s); 3932 // wrong object type 3933 r = cropElemUndefinedO(self, "1"); 3934 ck_assert_ptr_eq(r, null); 3935 s = toStringO(self); 3936 ck_assert_str_eq(s, "{\"1\":1,\"2\":2.200000e+00}"); 3937 free(s); 3938 // non existing key 3939 r = cropElemUndefinedO(self, "qwe"); 3940 ck_assert_ptr_eq(r, null); 3941 // null key 3942 r = cropElemUndefinedO(self, null); 3943 ck_assert_ptr_eq(r, null); 3944 // empty self 3945 freeO(self); 3946 r = cropElemUndefinedO(self, "1"); 3947 ck_assert_ptr_eq(r, null); 3948 terminateO(self); 3949 3950 END_TEST 3951 3952 3953 START_TEST(cropElemBoolSmallDictT) 3954 3955 bool r; 3956 smallDictt *self = allocG(rtSmallDictt); 3957 smallDictt *r2; 3958 3959 r2 = self->f->setInt(self, "1", 1); 3960 ck_assert_ptr_ne(r2, null); 3961 r2 = self->f->setDouble(self, "2", 2.2); 3962 ck_assert_ptr_ne(r2, null); 3963 r2 = self->f->setBool(self, "b", true); 3964 ck_assert_ptr_ne(r2, null); 3965 createAllocateSmallInt(I); 3966 setValG(I, 11); 3967 I->type = "anothertype"; 3968 r2 = self->f->set(self, "B", (baset*)I); 3969 ck_assert_ptr_ne(r2, null); 3970 r = cropElemBoolO(self, "b"); 3971 ck_assert(r); 3972 char *s = toStringO(self); 3973 ck_assert_str_eq(s, "{\"1\":1,\"2\":2.200000e+00,\"B\":\"<data container>\"}"); 3974 free(s); 3975 // wrong object type 3976 r = cropElemBoolO(self, "1"); 3977 ck_assert(!r); 3978 s = toStringO(self); 3979 ck_assert_str_eq(s, "{\"1\":1,\"2\":2.200000e+00,\"B\":\"<data container>\"}"); 3980 free(s); 3981 r = cropElemBoolO(self, "B"); 3982 ck_assert(!r); 3983 s = toStringO(self); 3984 ck_assert_str_eq(s, "{\"1\":1,\"2\":2.200000e+00,\"B\":\"<data container>\"}"); 3985 free(s); 3986 // non existing key 3987 r = cropElemBoolO(self, "qwe"); 3988 ck_assert(!r); 3989 // null key 3990 r = cropElemBoolO(self, null); 3991 ck_assert(!r); 3992 // empty self 3993 freeO(self); 3994 r = cropElemBoolO(self, "1"); 3995 ck_assert(!r); 3996 terminateO(self); 3997 3998 END_TEST 3999 4000 4001 START_TEST(cropElemDoubleSmallDictT) 4002 4003 double r; 4004 smallDictt *self = allocG(rtSmallDictt); 4005 smallDictt *r2; 4006 4007 r2 = self->f->setInt(self, "1", 1); 4008 ck_assert_ptr_ne(r2, null); 4009 r2 = self->f->setDouble(self, "2", 2.2); 4010 ck_assert_ptr_ne(r2, null); 4011 r2 = self->f->setDouble(self, "b", 3.3); 4012 ck_assert_ptr_ne(r2, null); 4013 createAllocateSmallInt(I); 4014 setValG(I, 11); 4015 I->type = "anothertype"; 4016 r2 = self->f->set(self, "B", (baset*)I); 4017 ck_assert_ptr_ne(r2, null); 4018 r = cropElemDoubleO(self, "b"); 4019 ck_assert(r == 3.3); 4020 char *s = toStringO(self); 4021 ck_assert_str_eq(s, "{\"1\":1,\"2\":2.200000e+00,\"B\":\"<data container>\"}"); 4022 free(s); 4023 // wrong object type 4024 r = cropElemDoubleO(self, "1"); 4025 ck_assert(!r); 4026 s = toStringO(self); 4027 ck_assert_str_eq(s, "{\"1\":1,\"2\":2.200000e+00,\"B\":\"<data container>\"}"); 4028 free(s); 4029 r = cropElemDoubleO(self, "B"); 4030 ck_assert(!r); 4031 s = toStringO(self); 4032 ck_assert_str_eq(s, "{\"1\":1,\"2\":2.200000e+00,\"B\":\"<data container>\"}"); 4033 free(s); 4034 // non existing key 4035 r = cropElemDoubleO(self, "qwe"); 4036 ck_assert(!r); 4037 // null key 4038 r = cropElemDoubleO(self, null); 4039 ck_assert(r == 0); 4040 // empty self 4041 freeO(self); 4042 r = cropElemDoubleO(self, "1"); 4043 ck_assert(r == 0); 4044 terminateO(self); 4045 4046 END_TEST 4047 4048 4049 START_TEST(cropElemIntSmallDictT) 4050 4051 int64_t r; 4052 smallDictt *self = allocG(rtSmallDictt); 4053 smallDictt *r2; 4054 4055 r2 = self->f->setInt(self, "1", 1); 4056 ck_assert_ptr_ne(r2, null); 4057 r2 = self->f->setDouble(self, "2", 2.2); 4058 ck_assert_ptr_ne(r2, null); 4059 r2 = self->f->setInt(self, "b", 2); 4060 ck_assert_ptr_ne(r2, null); 4061 createAllocateSmallInt(I); 4062 setValG(I, 11); 4063 I->type = "anothertype"; 4064 r2 = self->f->set(self, "B", (baset*)I); 4065 ck_assert_ptr_ne(r2, null); 4066 r = cropElemIntO(self, "b"); 4067 ck_assert_int_eq(r, 2); 4068 char *s = toStringO(self); 4069 ck_assert_str_eq(s, "{\"1\":1,\"2\":2.200000e+00,\"B\":\"<data container>\"}"); 4070 free(s); 4071 // wrong object type 4072 r = cropElemIntO(self, "2"); 4073 ck_assert(!r); 4074 s = toStringO(self); 4075 ck_assert_str_eq(s, "{\"1\":1,\"2\":2.200000e+00,\"B\":\"<data container>\"}"); 4076 free(s); 4077 r = cropElemIntO(self, "B"); 4078 ck_assert(!r); 4079 s = toStringO(self); 4080 ck_assert_str_eq(s, "{\"1\":1,\"2\":2.200000e+00,\"B\":\"<data container>\"}"); 4081 free(s); 4082 // non existing key 4083 r = cropElemIntO(self, "qwe"); 4084 ck_assert(!r); 4085 //r = cropElemIntO(self); 4086 // null key 4087 r = cropElemIntO(self, null); 4088 ck_assert_int_eq(r, 0); 4089 // empty self 4090 freeO(self); 4091 r = cropElemIntO(self, "1"); 4092 ck_assert_int_eq(r, 0); 4093 terminateO(self); 4094 4095 END_TEST 4096 4097 4098 START_TEST(cropElemInt32SmallDictT) 4099 4100 int32_t r; 4101 smallDictt *self = allocG(rtSmallDictt); 4102 smallDictt *r2; 4103 4104 r2 = self->f->setInt(self, "1", 1); 4105 ck_assert_ptr_ne(r2, null); 4106 r2 = self->f->setDouble(self, "2", 2.2); 4107 ck_assert_ptr_ne(r2, null); 4108 r2 = self->f->setInt(self, "b", 2); 4109 ck_assert_ptr_ne(r2, null); 4110 createAllocateSmallInt(I); 4111 setValG(I, 11); 4112 I->type = "anothertype"; 4113 r2 = self->f->set(self, "B", (baset*)I); 4114 ck_assert_ptr_ne(r2, null); 4115 r = cropElemInt32O(self, "b"); 4116 ck_assert_int_eq(r, 2); 4117 char *s = toStringO(self); 4118 ck_assert_str_eq(s, "{\"1\":1,\"2\":2.200000e+00,\"B\":\"<data container>\"}"); 4119 free(s); 4120 // wrong object type 4121 r = cropElemInt32O(self, "2"); 4122 ck_assert(!r); 4123 s = toStringO(self); 4124 ck_assert_str_eq(s, "{\"1\":1,\"2\":2.200000e+00,\"B\":\"<data container>\"}"); 4125 free(s); 4126 r = cropElemInt32O(self, "B"); 4127 ck_assert(!r); 4128 s = toStringO(self); 4129 ck_assert_str_eq(s, "{\"1\":1,\"2\":2.200000e+00,\"B\":\"<data container>\"}"); 4130 free(s); 4131 // non existing key 4132 r = cropElemInt32O(self, "qwe"); 4133 ck_assert(!r); 4134 // null key 4135 r = cropElemInt32O(self, null); 4136 ck_assert_int_eq(r, 0); 4137 // empty self 4138 freeO(self); 4139 r = cropElemInt32O(self, "1"); 4140 ck_assert_int_eq(r, 0); 4141 terminateO(self); 4142 4143 END_TEST 4144 4145 4146 START_TEST(cropElemUintSmallDictT) 4147 4148 uint64_t r; 4149 smallDictt *self = allocG(rtSmallDictt); 4150 smallDictt *r2; 4151 4152 r2 = self->f->setInt(self, "1", 1); 4153 ck_assert_ptr_ne(r2, null); 4154 r2 = self->f->setDouble(self, "2", 2.2); 4155 ck_assert_ptr_ne(r2, null); 4156 r2 = self->f->setInt(self, "b", 2); 4157 ck_assert_ptr_ne(r2, null); 4158 createAllocateSmallInt(I); 4159 setValG(I, 11); 4160 I->type = "anothertype"; 4161 r2 = self->f->set(self, "B", (baset*)I); 4162 ck_assert_ptr_ne(r2, null); 4163 r = cropElemUintO(self, "b"); 4164 ck_assert_int_eq(r, 2); 4165 char *s = toStringO(self); 4166 ck_assert_str_eq(s, "{\"1\":1,\"2\":2.200000e+00,\"B\":\"<data container>\"}"); 4167 free(s); 4168 // wrong object type 4169 r = cropElemUintO(self, "2"); 4170 ck_assert(!r); 4171 s = toStringO(self); 4172 ck_assert_str_eq(s, "{\"1\":1,\"2\":2.200000e+00,\"B\":\"<data container>\"}"); 4173 free(s); 4174 r = cropElemUintO(self, "B"); 4175 ck_assert(!r); 4176 s = toStringO(self); 4177 ck_assert_str_eq(s, "{\"1\":1,\"2\":2.200000e+00,\"B\":\"<data container>\"}"); 4178 free(s); 4179 // non existing key 4180 r = cropElemUintO(self, "qwe"); 4181 ck_assert(!r); 4182 // null key 4183 r = cropElemUintO(self, null); 4184 ck_assert_int_eq(r, 0); 4185 // empty self 4186 freeO(self); 4187 r = cropElemUintO(self, "1"); 4188 ck_assert_int_eq(r, 0); 4189 terminateO(self); 4190 4191 END_TEST 4192 4193 4194 START_TEST(cropElemUint32SmallDictT) 4195 4196 uint32_t r; 4197 smallDictt *self = allocG(rtSmallDictt); 4198 smallDictt *r2; 4199 4200 r2 = self->f->setInt(self, "1", 1); 4201 ck_assert_ptr_ne(r2, null); 4202 r2 = self->f->setDouble(self, "2", 2.2); 4203 ck_assert_ptr_ne(r2, null); 4204 r2 = self->f->setInt(self, "b", 2); 4205 ck_assert_ptr_ne(r2, null); 4206 createAllocateSmallInt(I); 4207 setValG(I, 11); 4208 I->type = "anothertype"; 4209 r2 = self->f->set(self, "B", (baset*)I); 4210 ck_assert_ptr_ne(r2, null); 4211 r = cropElemUint32O(self, "b"); 4212 ck_assert_int_eq(r, 2); 4213 char *s = toStringO(self); 4214 ck_assert_str_eq(s, "{\"1\":1,\"2\":2.200000e+00,\"B\":\"<data container>\"}"); 4215 free(s); 4216 // wrong object type 4217 r = cropElemUint32O(self, "2"); 4218 ck_assert(!r); 4219 s = toStringO(self); 4220 ck_assert_str_eq(s, "{\"1\":1,\"2\":2.200000e+00,\"B\":\"<data container>\"}"); 4221 free(s); 4222 r = cropElemUint32O(self, "B"); 4223 ck_assert(!r); 4224 s = toStringO(self); 4225 ck_assert_str_eq(s, "{\"1\":1,\"2\":2.200000e+00,\"B\":\"<data container>\"}"); 4226 free(s); 4227 // non existing key 4228 r = cropElemUint32O(self, "qwe"); 4229 ck_assert(!r); 4230 // null key 4231 r = cropElemUint32O(self, null); 4232 ck_assert_int_eq(r, 0); 4233 // empty self 4234 freeO(self); 4235 r = cropElemUint32O(self, "1"); 4236 ck_assert_int_eq(r, 0); 4237 terminateO(self); 4238 4239 END_TEST 4240 4241 4242 START_TEST(cropElemSSmallDictT) 4243 4244 char* r; 4245 smallDictt *self = allocG(rtSmallDictt); 4246 smallDictt *r2; 4247 4248 r2 = self->f->setInt(self, "1", 1); 4249 ck_assert_ptr_ne(r2, null); 4250 r2 = self->f->setDouble(self, "2", 2.2); 4251 ck_assert_ptr_ne(r2, null); 4252 r2 = self->f->setS(self, "b", "qwe"); 4253 ck_assert_ptr_ne(r2, null); 4254 createAllocateSmallInt(I); 4255 setValG(I, 11); 4256 I->type = "anothertype"; 4257 r2 = self->f->set(self, "B", (baset*)I); 4258 ck_assert_ptr_ne(r2, null); 4259 r = cropElemSO(self, "b"); 4260 ck_assert_str_eq(r, "qwe"); 4261 free(r); 4262 char *s = toStringO(self); 4263 ck_assert_str_eq(s, "{\"1\":1,\"2\":2.200000e+00,\"B\":\"<data container>\"}"); 4264 free(s); 4265 // wrong object type 4266 r = cropElemSO(self, "2"); 4267 ck_assert_ptr_eq(r, null); 4268 s = toStringO(self); 4269 ck_assert_str_eq(s, "{\"1\":1,\"2\":2.200000e+00,\"B\":\"<data container>\"}"); 4270 free(s); 4271 r = cropElemSO(self, "B"); 4272 ck_assert_ptr_eq(r, null); 4273 s = toStringO(self); 4274 ck_assert_str_eq(s, "{\"1\":1,\"2\":2.200000e+00,\"B\":\"<data container>\"}"); 4275 free(s); 4276 // non existing key 4277 r = cropElemSO(self, "qwe"); 4278 ck_assert_ptr_eq(r, null); 4279 // null key 4280 r = cropElemSO(self, null); 4281 ck_assert_ptr_eq(r, null); 4282 // empty self 4283 freeO(self); 4284 r = cropElemSO(self, "1"); 4285 ck_assert_ptr_eq(r, null); 4286 terminateO(self); 4287 4288 END_TEST 4289 4290 4291 START_TEST(cropElemDictSmallDictT) 4292 4293 smallDictt* r; 4294 smallDictt *self = allocG(rtSmallDictt); 4295 smallDictt *r2; 4296 4297 r2 = self->f->setInt(self, "1", 1); 4298 ck_assert_ptr_ne(r2, null); 4299 r2 = self->f->setDouble(self, "2", 2.2); 4300 ck_assert_ptr_ne(r2, null); 4301 createAllocateSmallDict(d); 4302 r2 = self->f->setNFreeDict(self, "b", d); 4303 ck_assert_ptr_ne(r2, null); 4304 createAllocateSmallInt(I); 4305 setValG(I, 11); 4306 I->type = "anothertype"; 4307 r2 = self->f->set(self, "B", (baset*)I); 4308 ck_assert_ptr_ne(r2, null); 4309 r = cropElemDictO(self, "b"); 4310 ck_assert_ptr_ne(r, null); 4311 char *s = toStringO(r); 4312 terminateO(r); 4313 ck_assert_str_eq(s, "{}"); 4314 free(s); 4315 s = toStringO(self); 4316 ck_assert_str_eq(s, "{\"1\":1,\"2\":2.200000e+00,\"B\":\"<data container>\"}"); 4317 free(s); 4318 // wrong object type 4319 r = cropElemDictO(self, "2"); 4320 ck_assert_ptr_eq(r, null); 4321 s = toStringO(self); 4322 ck_assert_str_eq(s, "{\"1\":1,\"2\":2.200000e+00,\"B\":\"<data container>\"}"); 4323 free(s); 4324 r = cropElemDictO(self, "B"); 4325 ck_assert_ptr_eq(r, null); 4326 s = toStringO(self); 4327 ck_assert_str_eq(s, "{\"1\":1,\"2\":2.200000e+00,\"B\":\"<data container>\"}"); 4328 free(s); 4329 // non existing key 4330 r = cropElemDictO(self, "qwe"); 4331 ck_assert_ptr_eq(r, null); 4332 // null key 4333 r = cropElemDictO(self, null); 4334 ck_assert_ptr_eq(r, null); 4335 // empty self 4336 freeO(self); 4337 r = cropElemDictO(self, "1"); 4338 ck_assert_ptr_eq(r, null); 4339 terminateO(self); 4340 4341 END_TEST 4342 4343 4344 START_TEST(cropElemArraySmallDictT) 4345 4346 smallArrayt* r; 4347 smallDictt *self = allocG(rtSmallDictt); 4348 smallDictt *r2; 4349 4350 r2 = self->f->setInt(self, "1", 1); 4351 ck_assert_ptr_ne(r2, null); 4352 r2 = self->f->setDouble(self, "2", 2.2); 4353 ck_assert_ptr_ne(r2, null); 4354 createAllocateSmallArray(d); 4355 r2 = self->f->setNFreeArray(self, "b", d); 4356 ck_assert_ptr_ne(r2, null); 4357 createAllocateSmallInt(I); 4358 setValG(I, 11); 4359 I->type = "anothertype"; 4360 r2 = self->f->set(self, "B", (baset*)I); 4361 ck_assert_ptr_ne(r2, null); 4362 r = cropElemArrayO(self, "b"); 4363 ck_assert_ptr_ne(r, null); 4364 char *s = toStringO(r); 4365 terminateO(r); 4366 ck_assert_str_eq(s, "[]"); 4367 free(s); 4368 s = toStringO(self); 4369 ck_assert_str_eq(s, "{\"1\":1,\"2\":2.200000e+00,\"B\":\"<data container>\"}"); 4370 free(s); 4371 // wrong object type 4372 r = cropElemArrayO(self, "2"); 4373 ck_assert_ptr_eq(r, null); 4374 s = toStringO(self); 4375 ck_assert_str_eq(s, "{\"1\":1,\"2\":2.200000e+00,\"B\":\"<data container>\"}"); 4376 free(s); 4377 r = cropElemArrayO(self, "B"); 4378 ck_assert_ptr_eq(r, null); 4379 s = toStringO(self); 4380 ck_assert_str_eq(s, "{\"1\":1,\"2\":2.200000e+00,\"B\":\"<data container>\"}"); 4381 free(s); 4382 // non existing key 4383 r = cropElemArrayO(self, "qwe"); 4384 ck_assert_ptr_eq(r, null); 4385 // null key 4386 r = cropElemArrayO(self, null); 4387 ck_assert_ptr_eq(r, null); 4388 // empty self 4389 freeO(self); 4390 r = cropElemArrayO(self, "1"); 4391 ck_assert_ptr_eq(r, null); 4392 terminateO(self); 4393 4394 END_TEST 4395 4396 4397 START_TEST(cropElemSmallBoolSmallDictT) 4398 4399 smallBoolt* r; 4400 smallDictt *self = allocG(rtSmallDictt); 4401 smallDictt *r2; 4402 4403 r2 = self->f->setInt(self, "1", 1); 4404 ck_assert_ptr_ne(r2, null); 4405 r2 = self->f->setDouble(self, "2", 2.2); 4406 ck_assert_ptr_ne(r2, null); 4407 r2 = self->f->setBool(self, "b", true); 4408 ck_assert_ptr_ne(r2, null); 4409 createAllocateSmallInt(I); 4410 setValG(I, 11); 4411 I->type = "anothertype"; 4412 r2 = self->f->set(self, "B", (baset*)I); 4413 ck_assert_ptr_ne(r2, null); 4414 r = cropElemSmallBoolO(self, "b"); 4415 ck_assert_ptr_ne(r, null); 4416 char *s = toStringO(r); 4417 terminateO(r); 4418 ck_assert_str_eq(s, "true"); 4419 free(s); 4420 s = toStringO(self); 4421 ck_assert_str_eq(s, "{\"1\":1,\"2\":2.200000e+00,\"B\":\"<data container>\"}"); 4422 free(s); 4423 // wrong object type 4424 r = cropElemSmallBoolO(self, "2"); 4425 ck_assert_ptr_eq(r, null); 4426 s = toStringO(self); 4427 ck_assert_str_eq(s, "{\"1\":1,\"2\":2.200000e+00,\"B\":\"<data container>\"}"); 4428 free(s); 4429 r = cropElemSmallBoolO(self, "B"); 4430 ck_assert_ptr_eq(r, null); 4431 s = toStringO(self); 4432 ck_assert_str_eq(s, "{\"1\":1,\"2\":2.200000e+00,\"B\":\"<data container>\"}"); 4433 free(s); 4434 // non existing key 4435 r = cropElemSmallBoolO(self, "qwe"); 4436 ck_assert_ptr_eq(r, null); 4437 // null key 4438 r = cropElemSmallBoolO(self, null); 4439 ck_assert_ptr_eq(r, null); 4440 // empty self 4441 freeO(self); 4442 r = cropElemSmallBoolO(self, "1"); 4443 ck_assert_ptr_eq(r, null); 4444 terminateO(self); 4445 4446 END_TEST 4447 4448 4449 START_TEST(cropElemSmallBytesSmallDictT) 4450 4451 smallBytest* r; 4452 smallDictt *self = allocG(rtSmallDictt); 4453 smallDictt *r2; 4454 4455 r2 = self->f->setInt(self, "1", 1); 4456 ck_assert_ptr_ne(r2, null); 4457 r2 = self->f->setDouble(self, "2", 2.2); 4458 ck_assert_ptr_ne(r2, null); 4459 createAllocateSmallBytes(d); 4460 r2 = self->f->setNFreeSmallBytes(self, "b", d); 4461 ck_assert_ptr_ne(r2, null); 4462 createAllocateSmallInt(I); 4463 setValG(I, 11); 4464 I->type = "anothertype"; 4465 r2 = self->f->set(self, "B", (baset*)I); 4466 ck_assert_ptr_ne(r2, null); 4467 r = cropElemSmallBytesO(self, "b"); 4468 ck_assert_ptr_ne(r, null); 4469 char *s = toStringO(r); 4470 terminateO(r); 4471 ck_assert_str_eq(s, "[]"); 4472 free(s); 4473 s = toStringO(self); 4474 ck_assert_str_eq(s, "{\"1\":1,\"2\":2.200000e+00,\"B\":\"<data container>\"}"); 4475 free(s); 4476 // wrong object type 4477 r = cropElemSmallBytesO(self, "2"); 4478 ck_assert_ptr_eq(r, null); 4479 s = toStringO(self); 4480 ck_assert_str_eq(s, "{\"1\":1,\"2\":2.200000e+00,\"B\":\"<data container>\"}"); 4481 free(s); 4482 r = cropElemSmallBytesO(self, "B"); 4483 ck_assert_ptr_eq(r, null); 4484 s = toStringO(self); 4485 ck_assert_str_eq(s, "{\"1\":1,\"2\":2.200000e+00,\"B\":\"<data container>\"}"); 4486 free(s); 4487 // non existing key 4488 r = cropElemSmallBytesO(self, "qwe"); 4489 ck_assert_ptr_eq(r, null); 4490 //r = cropElemSmallBytesO(self); 4491 // null key 4492 r = cropElemSmallBytesO(self, null); 4493 ck_assert_ptr_eq(r, null); 4494 // empty self 4495 freeO(self); 4496 r = cropElemSmallBytesO(self, "1"); 4497 ck_assert_ptr_eq(r, null); 4498 terminateO(self); 4499 4500 END_TEST 4501 4502 4503 START_TEST(cropElemSmallDoubleSmallDictT) 4504 4505 smallDoublet* r; 4506 smallDictt *self = allocG(rtSmallDictt); 4507 smallDictt *r2; 4508 4509 r2 = self->f->setInt(self, "1", 1); 4510 ck_assert_ptr_ne(r2, null); 4511 r2 = self->f->setDouble(self, "2", 2.2); 4512 ck_assert_ptr_ne(r2, null); 4513 r2 = self->f->setDouble(self, "b", 3.3); 4514 ck_assert_ptr_ne(r2, null); 4515 createAllocateSmallInt(I); 4516 setValG(I, 11); 4517 I->type = "anothertype"; 4518 r2 = self->f->set(self, "B", (baset*)I); 4519 ck_assert_ptr_ne(r2, null); 4520 r = cropElemSmallDoubleO(self, "b"); 4521 ck_assert_ptr_ne(r, null); 4522 char *s = toStringO(r); 4523 terminateO(r); 4524 ck_assert_str_eq(s, "3.300000e+00"); 4525 free(s); 4526 s = toStringO(self); 4527 ck_assert_str_eq(s, "{\"1\":1,\"2\":2.200000e+00,\"B\":\"<data container>\"}"); 4528 free(s); 4529 // wrong object type 4530 r = cropElemSmallDoubleO(self, "1"); 4531 ck_assert_ptr_eq(r, null); 4532 s = toStringO(self); 4533 ck_assert_str_eq(s, "{\"1\":1,\"2\":2.200000e+00,\"B\":\"<data container>\"}"); 4534 free(s); 4535 r = cropElemSmallDoubleO(self, "B"); 4536 ck_assert_ptr_eq(r, null); 4537 s = toStringO(self); 4538 ck_assert_str_eq(s, "{\"1\":1,\"2\":2.200000e+00,\"B\":\"<data container>\"}"); 4539 free(s); 4540 // non existing key 4541 r = cropElemSmallDoubleO(self, "qwe"); 4542 ck_assert_ptr_eq(r, null); 4543 // null key 4544 r = cropElemSmallDoubleO(self, null); 4545 ck_assert_ptr_eq(r, null); 4546 // empty self 4547 freeO(self); 4548 r = cropElemSmallDoubleO(self, "1"); 4549 ck_assert_ptr_eq(r, null); 4550 terminateO(self); 4551 4552 END_TEST 4553 4554 4555 START_TEST(cropElemSmallIntSmallDictT) 4556 4557 smallIntt* r; 4558 smallDictt *self = allocG(rtSmallDictt); 4559 smallDictt *r2; 4560 4561 r2 = self->f->setInt(self, "1", 1); 4562 ck_assert_ptr_ne(r2, null); 4563 r2 = self->f->setDouble(self, "2", 2.2); 4564 ck_assert_ptr_ne(r2, null); 4565 r2 = self->f->setInt(self, "b", 2); 4566 ck_assert_ptr_ne(r2, null); 4567 createAllocateSmallInt(I); 4568 setValG(I, 11); 4569 I->type = "anothertype"; 4570 r2 = self->f->set(self, "B", (baset*)I); 4571 ck_assert_ptr_ne(r2, null); 4572 r = cropElemSmallIntO(self, "b"); 4573 ck_assert_ptr_ne(r, null); 4574 char *s = toStringO(r); 4575 terminateO(r); 4576 ck_assert_str_eq(s, "2"); 4577 free(s); 4578 s = toStringO(self); 4579 ck_assert_str_eq(s, "{\"1\":1,\"2\":2.200000e+00,\"B\":\"<data container>\"}"); 4580 free(s); 4581 // wrong object type 4582 r = cropElemSmallIntO(self, "2"); 4583 ck_assert_ptr_eq(r, null); 4584 s = toStringO(self); 4585 ck_assert_str_eq(s, "{\"1\":1,\"2\":2.200000e+00,\"B\":\"<data container>\"}"); 4586 free(s); 4587 r = cropElemSmallIntO(self, "B"); 4588 ck_assert_ptr_eq(r, null); 4589 s = toStringO(self); 4590 ck_assert_str_eq(s, "{\"1\":1,\"2\":2.200000e+00,\"B\":\"<data container>\"}"); 4591 free(s); 4592 // non existing key 4593 r = cropElemSmallIntO(self, "qwe"); 4594 ck_assert_ptr_eq(r, null); 4595 // null key 4596 r = cropElemSmallIntO(self, null); 4597 ck_assert_ptr_eq(r, null); 4598 // empty self 4599 freeO(self); 4600 r = cropElemSmallIntO(self, "1"); 4601 ck_assert_ptr_eq(r, null); 4602 terminateO(self); 4603 4604 END_TEST 4605 4606 4607 START_TEST(cropElemSmallJsonSmallDictT) 4608 4609 smallJsont* r; 4610 smallDictt *self = allocG(rtSmallDictt); 4611 smallDictt *r2; 4612 4613 r2 = self->f->setInt(self, "1", 1); 4614 ck_assert_ptr_ne(r2, null); 4615 createAllocateSmallBytes(b); 4616 r2 = self->f->setNFreeSmallBytes(self, "2", b); 4617 ck_assert_ptr_ne(r2, null); 4618 createAllocateSmallJson(d); 4619 r2 = self->f->setNFreeSmallJson(self, "b", d); 4620 ck_assert_ptr_ne(r2, null); 4621 createAllocateSmallInt(I); 4622 setValG(I, 11); 4623 I->type = "anothertype"; 4624 r2 = self->f->set(self, "B", (baset*)I); 4625 ck_assert_ptr_ne(r2, null); 4626 r = cropElemSmallJsonO(self, "b"); 4627 ck_assert_ptr_ne(r, null); 4628 char *s = toStringO(r); 4629 terminateO(r); 4630 ck_assert_str_eq(s, "{}"); 4631 free(s); 4632 s = toStringO(self); 4633 ck_assert_str_eq(s, "{\"1\":1,\"2\":[],\"B\":\"<data container>\"}"); 4634 free(s); 4635 // wrong object type 4636 r = cropElemSmallJsonO(self, "2"); 4637 ck_assert_ptr_eq(r, null); 4638 s = toStringO(self); 4639 ck_assert_str_eq(s, "{\"1\":1,\"2\":[],\"B\":\"<data container>\"}"); 4640 free(s); 4641 r = cropElemSmallJsonO(self, "B"); 4642 ck_assert_ptr_eq(r, null); 4643 s = toStringO(self); 4644 ck_assert_str_eq(s, "{\"1\":1,\"2\":[],\"B\":\"<data container>\"}"); 4645 free(s); 4646 // non existing key 4647 r = cropElemSmallJsonO(self, "qwe"); 4648 ck_assert_ptr_eq(r, null); 4649 // null key 4650 r = cropElemSmallJsonO(self, null); 4651 ck_assert_ptr_eq(r, null); 4652 // empty self 4653 freeO(self); 4654 r = cropElemSmallJsonO(self, "1"); 4655 ck_assert_ptr_eq(r, null); 4656 terminateO(self); 4657 4658 END_TEST 4659 4660 4661 START_TEST(cropElemSmallStringSmallDictT) 4662 4663 smallStringt* r; 4664 smallDictt *self = allocG(rtSmallDictt); 4665 smallDictt *r2; 4666 4667 r2 = self->f->setInt(self, "1", 1); 4668 ck_assert_ptr_ne(r2, null); 4669 r2 = self->f->setDouble(self, "2", 2.2); 4670 ck_assert_ptr_ne(r2, null); 4671 r2 = self->f->setS(self, "b", "qwe"); 4672 ck_assert_ptr_ne(r2, null); 4673 createAllocateSmallInt(I); 4674 setValG(I, 11); 4675 I->type = "anothertype"; 4676 r2 = self->f->set(self, "B", (baset*)I); 4677 ck_assert_ptr_ne(r2, null); 4678 r = cropElemSmallStringO(self, "b"); 4679 ck_assert_ptr_ne(r, null); 4680 char *s = toStringO(r); 4681 terminateO(r); 4682 ck_assert_str_eq(s, "qwe"); 4683 free(s); 4684 s = toStringO(self); 4685 ck_assert_str_eq(s, "{\"1\":1,\"2\":2.200000e+00,\"B\":\"<data container>\"}"); 4686 free(s); 4687 // wrong object type 4688 r = cropElemSmallStringO(self, "2"); 4689 ck_assert_ptr_eq(r, null); 4690 s = toStringO(self); 4691 ck_assert_str_eq(s, "{\"1\":1,\"2\":2.200000e+00,\"B\":\"<data container>\"}"); 4692 free(s); 4693 r = cropElemSmallStringO(self, "B"); 4694 ck_assert_ptr_eq(r, null); 4695 s = toStringO(self); 4696 ck_assert_str_eq(s, "{\"1\":1,\"2\":2.200000e+00,\"B\":\"<data container>\"}"); 4697 free(s); 4698 // non existing key 4699 r = cropElemSmallStringO(self, "qwe"); 4700 ck_assert_ptr_eq(r, null); 4701 // null key 4702 r = cropElemSmallStringO(self, null); 4703 ck_assert_ptr_eq(r, null); 4704 // empty self 4705 freeO(self); 4706 r = cropElemSmallStringO(self, "1"); 4707 ck_assert_ptr_eq(r, null); 4708 terminateO(self); 4709 4710 END_TEST 4711 4712 4713 START_TEST(cropElemVoidSmallDictT) 4714 4715 void* r; 4716 smallDictt *self = allocG(rtSmallDictt); 4717 smallDictt *r2; 4718 4719 r2 = self->f->setInt(self, "1", 1); 4720 ck_assert_ptr_ne(r2, null); 4721 r2 = self->f->setDouble(self, "2", 2.2); 4722 ck_assert_ptr_ne(r2, null); 4723 smallContainert *c = allocSmallContainer(&r); 4724 r2 = self->f->setNFreeSmallContainer(self, "b", c); 4725 ck_assert_ptr_ne(r2, null); 4726 createAllocateSmallInt(I); 4727 setValG(I, 11); 4728 I->type = "anothertype"; 4729 r2 = self->f->set(self, "B", (baset*)I); 4730 ck_assert_ptr_ne(r2, null); 4731 r = cropElemVoidO(self, "b"); 4732 ck_assert_ptr_eq(r, &r); 4733 char *s = toStringO(self); 4734 ck_assert_str_eq(s, "{\"1\":1,\"2\":2.200000e+00,\"B\":\"<data container>\"}"); 4735 free(s); 4736 // wrong object type 4737 r = cropElemVoidO(self, "2"); 4738 ck_assert_ptr_eq(r, null); 4739 s = toStringO(self); 4740 ck_assert_str_eq(s, "{\"1\":1,\"2\":2.200000e+00,\"B\":\"<data container>\"}"); 4741 free(s); 4742 r = cropElemVoidO(self, "B"); 4743 ck_assert_ptr_eq(r, null); 4744 s = toStringO(self); 4745 ck_assert_str_eq(s, "{\"1\":1,\"2\":2.200000e+00,\"B\":\"<data container>\"}"); 4746 free(s); 4747 // non existing key 4748 r = cropElemVoidO(self, "qwe"); 4749 ck_assert_ptr_eq(r, null); 4750 // null key 4751 r = cropElemVoidO(self, null); 4752 ck_assert_ptr_eq(r, null); 4753 // empty self 4754 freeO(self); 4755 r = cropElemVoidO(self, "1"); 4756 ck_assert_ptr_eq(r, null); 4757 terminateO(self); 4758 4759 END_TEST 4760 4761 4762 START_TEST(cropElemSmallContainerSmallDictT) 4763 4764 smallContainert* r; 4765 smallDictt *self = allocG(rtSmallDictt); 4766 smallDictt *r2; 4767 4768 r2 = self->f->setInt(self, "1", 1); 4769 ck_assert_ptr_ne(r2, null); 4770 r2 = self->f->setDouble(self, "2", 2.2); 4771 ck_assert_ptr_ne(r2, null); 4772 smallContainert *c = allocSmallContainer(&r); 4773 r2 = self->f->setNFreeSmallContainer(self, "b", c); 4774 ck_assert_ptr_ne(r2, null); 4775 createAllocateSmallInt(I); 4776 setValG(I, 11); 4777 I->type = "anothertype"; 4778 r2 = self->f->set(self, "B", (baset*)I); 4779 ck_assert_ptr_ne(r2, null); 4780 r = cropElemSmallContainerO(self, "b"); 4781 ck_assert_ptr_ne(r, null); 4782 char *s = toStringO(r); 4783 terminateO(r); 4784 ck_assert_str_eq(s, "<data smallContainer>"); 4785 free(s); 4786 s = toStringO(self); 4787 ck_assert_str_eq(s, "{\"1\":1,\"2\":2.200000e+00,\"B\":\"<data container>\"}"); 4788 free(s); 4789 // wrong object type 4790 r = cropElemSmallContainerO(self, "2"); 4791 ck_assert_ptr_eq(r, null); 4792 s = toStringO(self); 4793 ck_assert_str_eq(s, "{\"1\":1,\"2\":2.200000e+00,\"B\":\"<data container>\"}"); 4794 free(s); 4795 r = cropElemSmallContainerO(self, "B"); 4796 ck_assert_ptr_eq(r, null); 4797 s = toStringO(self); 4798 ck_assert_str_eq(s, "{\"1\":1,\"2\":2.200000e+00,\"B\":\"<data container>\"}"); 4799 free(s); 4800 // non existing key 4801 r = cropElemSmallContainerO(self, "qwe"); 4802 ck_assert_ptr_eq(r, null); 4803 // null key 4804 r = cropElemSmallContainerO(self, null); 4805 ck_assert_ptr_eq(r, null); 4806 // empty self 4807 freeO(self); 4808 r = cropElemSmallContainerO(self, "1"); 4809 ck_assert_ptr_eq(r, null); 4810 terminateO(self); 4811 4812 END_TEST 4813 4814 4815 START_TEST(delKCharSmallDictT) 4816 4817 smallDictt* r; 4818 smallDictt *self = allocG(rtSmallDictt); 4819 4820 r = self->f->setInt(self, "1", 1); 4821 ck_assert_ptr_ne(r, null); 4822 r = self->f->setDouble(self, "2", 2.2); 4823 ck_assert_ptr_ne(r, null); 4824 // non existing key 4825 r = delKCharO(self, 'q'); 4826 ck_assert_ptr_ne(r, null); 4827 char *s = toStringO(r); 4828 ck_assert_str_eq(s, "{\"1\":1,\"2\":2.200000e+00}"); 4829 free(s); 4830 // delete key value 4831 r = delKCharO(self, '2'); 4832 ck_assert_ptr_ne(r, null); 4833 s = toStringO(r); 4834 ck_assert_str_eq(s, "{\"1\":1}"); 4835 free(s); 4836 terminateO(self); 4837 4838 END_TEST 4839 4840 4841 START_TEST(removeSmallDictT) 4842 4843 smallDictt* r; 4844 smallDictt *self = allocG(rtSmallDictt); 4845 4846 smallIntt *i = allocSmallInt(1); 4847 r = self->f->setSmallInt(self, "1", i); 4848 ck_assert_ptr_ne(r, null); 4849 r = self->f->remove(self, "1"); 4850 ck_assert_ptr_ne(r, null); 4851 terminateO(i); 4852 char *s = toStringO(r); 4853 ck_assert_str_eq(s, "{}"); 4854 free(s); 4855 // non existing key 4856 r = self->f->remove(self, "1"); 4857 ck_assert_ptr_ne(r, null); 4858 s = toStringO(r); 4859 ck_assert_str_eq(s, "{}"); 4860 free(s); 4861 // null key 4862 r = self->f->remove(self, null); 4863 ck_assert_ptr_eq(r, null); 4864 // empty self 4865 freeO(self); 4866 r = self->f->remove(self, "qwe"); 4867 ck_assert_ptr_eq(r, null); 4868 terminateO(self); 4869 4870 END_TEST 4871 4872 4873 START_TEST(removeKCharSmallDictT) 4874 4875 smallDictt* r; 4876 smallDictt *self = allocG(rtSmallDictt); 4877 4878 smallIntt *i = allocSmallInt(1); 4879 r = self->f->setSmallInt(self, "1", i); 4880 ck_assert_ptr_ne(r, null); 4881 r = self->f->removeKChar(self, '1'); 4882 ck_assert_ptr_ne(r, null); 4883 terminateO(i); 4884 char *s = toStringO(r); 4885 ck_assert_str_eq(s, "{}"); 4886 free(s); 4887 // non existing key 4888 r = self->f->removeKChar(self, '1'); 4889 ck_assert_ptr_ne(r, null); 4890 s = toStringO(r); 4891 ck_assert_str_eq(s, "{}"); 4892 free(s); 4893 // empty self 4894 freeO(self); 4895 r = self->f->removeKChar(self, 'q'); 4896 ck_assert_ptr_eq(r, null); 4897 terminateO(self); 4898 4899 END_TEST 4900 4901 4902 START_TEST(hasKCharSmallDictT) 4903 4904 smallDictt *self = allocG(rtSmallDictt); 4905 4906 smallDictt *r2 = self->f->setInt(self, "1", 1); 4907 ck_assert_ptr_ne(r2, null); 4908 ck_assert(self->f->hasKChar(self, '1')); 4909 terminateO(self); 4910 4911 END_TEST 4912 4913 4914 START_TEST(keyBySmallDictT) 4915 4916 char* r; 4917 smallDictt *self = allocG(rtSmallDictt); 4918 baset *value; 4919 4920 smallDictt *r2 = self->f->setInt(self, "1", 1); 4921 ck_assert_ptr_ne(r2, null); 4922 value = (baset*) allocSmallInt(1); 4923 r = keyByO(self, value); 4924 ck_assert_str_eq(r, "1"); 4925 // non existing object 4926 smallIntt *i = allocSmallInt(2); 4927 r = keyByO(self, (baset*)i); 4928 terminateO(i); 4929 ck_assert_ptr_eq(r, null); 4930 // null value 4931 r = keyByO(self, null); 4932 ck_assert_ptr_eq(r, null); 4933 // empty self 4934 freeO(self); 4935 r = keyByO(self, value); 4936 ck_assert_ptr_eq(r, null); 4937 terminateO(self); 4938 terminateO(value); 4939 4940 END_TEST 4941 4942 4943 START_TEST(keyByUndefinedSmallDictT) 4944 4945 char* r; 4946 smallDictt *self = allocG(rtSmallDictt); 4947 undefinedt *value; 4948 4949 smallDictt *r2 = self->f->setUndefined(self, "1"); 4950 ck_assert_ptr_ne(r2, null); 4951 value = allocUndefined(); 4952 r = keyByUndefinedO(self, value); 4953 ck_assert_str_eq(r, "1"); 4954 // non existing object 4955 r2 = self->f->setInt(self, "1", 1); 4956 ck_assert_ptr_ne(r2, null); 4957 r = keyByUndefinedO(self, value); 4958 ck_assert_ptr_eq(r, null); 4959 // non undefined object 4960 smallIntt *i = allocSmallInt(2); 4961 r = keyByUndefinedO(self, (undefinedt*)i); 4962 terminateO(i); 4963 ck_assert_ptr_eq(r, null); 4964 // null value 4965 r = keyByUndefinedO(self, null); 4966 ck_assert_ptr_eq(r, null); 4967 // empty self 4968 freeO(self); 4969 r = keyByUndefinedO(self, value); 4970 ck_assert_ptr_eq(r, null); 4971 terminateO(self); 4972 terminateO(value); 4973 4974 END_TEST 4975 4976 4977 START_TEST(keyByBoolSmallDictT) 4978 4979 char* r; 4980 smallDictt *self = allocG(rtSmallDictt); 4981 4982 smallDictt *r2 = self->f->setBool(self, "1", true); 4983 ck_assert_ptr_ne(r2, null); 4984 r = keyByBoolO(self, true); 4985 ck_assert_str_eq(r, "1"); 4986 // non existing object 4987 r2 = self->f->setInt(self, "1", 1); 4988 ck_assert_ptr_ne(r2, null); 4989 r = keyByBoolO(self, true); 4990 ck_assert_ptr_eq(r, null); 4991 // empty self 4992 freeO(self); 4993 r = keyByBoolO(self, true); 4994 ck_assert_ptr_eq(r, null); 4995 terminateO(self); 4996 4997 END_TEST 4998 4999 5000 START_TEST(keyByDoubleSmallDictT) 5001 5002 char* r; 5003 smallDictt *self = allocG(rtSmallDictt); 5004 5005 smallDictt *r2 = self->f->setDouble(self, "1", 2.2); 5006 ck_assert_ptr_ne(r2, null); 5007 r = keyByDoubleO(self, 2.2); 5008 ck_assert_str_eq(r, "1"); 5009 // non existing object 5010 r2 = self->f->setInt(self, "1", 1); 5011 ck_assert_ptr_ne(r2, null); 5012 r = keyByDoubleO(self, 2.2); 5013 ck_assert_ptr_eq(r, null); 5014 // empty self 5015 freeO(self); 5016 r = keyByDoubleO(self, 2.2); 5017 ck_assert_ptr_eq(r, null); 5018 terminateO(self); 5019 5020 END_TEST 5021 5022 5023 START_TEST(keyByIntSmallDictT) 5024 5025 char* r; 5026 smallDictt *self = allocG(rtSmallDictt); 5027 5028 smallDictt *r2 = self->f->setInt(self, "1", 2); 5029 ck_assert_ptr_ne(r2, null); 5030 r = keyByIntO(self, 2); 5031 ck_assert_str_eq(r, "1"); 5032 // non existing object 5033 r2 = self->f->setInt(self, "1", 1); 5034 ck_assert_ptr_ne(r2, null); 5035 r = keyByIntO(self, 2); 5036 ck_assert_ptr_eq(r, null); 5037 // empty self 5038 freeO(self); 5039 r = keyByIntO(self, 2); 5040 ck_assert_ptr_eq(r, null); 5041 terminateO(self); 5042 5043 END_TEST 5044 5045 5046 START_TEST(keyBySSmallDictT) 5047 5048 char* r; 5049 smallDictt *self = allocG(rtSmallDictt); 5050 5051 smallDictt *r2 = self->f->setS(self, "1", "qwe"); 5052 ck_assert_ptr_ne(r2, null); 5053 r = keyBySO(self, "qwe"); 5054 ck_assert_str_eq(r, "1"); 5055 // non existing object 5056 r2 = self->f->setInt(self, "1", 1); 5057 ck_assert_ptr_ne(r2, null); 5058 r = keyBySO(self, "qwe"); 5059 ck_assert_ptr_eq(r, null); 5060 // null value 5061 r = keyBySO(self, null); 5062 ck_assert_ptr_eq(r, null); 5063 // empty self 5064 freeO(self); 5065 r = keyBySO(self, "qwe"); 5066 ck_assert_ptr_eq(r, null); 5067 terminateO(self); 5068 5069 END_TEST 5070 5071 5072 START_TEST(keyByCharSmallDictT) 5073 5074 char* r; 5075 smallDictt *self = allocG(rtSmallDictt); 5076 5077 smallDictt *r2 = self->f->setS(self, "1", "q"); 5078 ck_assert_ptr_ne(r2, null); 5079 r = keyByCharO(self, 'q'); 5080 ck_assert_str_eq(r, "1"); 5081 // non existing object 5082 r2 = self->f->setInt(self, "1", 1); 5083 ck_assert_ptr_ne(r2, null); 5084 r = keyByCharO(self, 'q'); 5085 ck_assert_ptr_eq(r, null); 5086 // empty self 5087 freeO(self); 5088 r = keyByCharO(self, 'q'); 5089 ck_assert_ptr_eq(r, null); 5090 terminateO(self); 5091 5092 END_TEST 5093 5094 5095 START_TEST(keyByDictSmallDictT) 5096 5097 char* r; 5098 smallDictt *self = allocG(rtSmallDictt); 5099 smallDictt *dict = allocSmallDict(); 5100 5101 createAllocateSmallDict(d); 5102 d->f->setS(d, "another", "dict"); 5103 smallDictt *r2 = self->f->setNFreeDict(self, "d", d); 5104 ck_assert_ptr_ne(r2, null); 5105 r2 = self->f->setNFreeDict(self, "1", dict); 5106 ck_assert_ptr_ne(r2, null); 5107 dict = allocSmallDict(); 5108 r = keyByDictO(self, dict); 5109 ck_assert_str_eq(r, "1"); 5110 // non existing object 5111 r2 = self->f->setInt(self, "1", 1); 5112 ck_assert_ptr_ne(r2, null); 5113 r = keyByDictO(self, dict); 5114 ck_assert_ptr_eq(r, null); 5115 // non smallDict object 5116 smallIntt *i = allocSmallInt(2); 5117 r = keyByDictO(self, (smallDictt*)i); 5118 terminateO(i); 5119 ck_assert_ptr_eq(r, null); 5120 // null value 5121 r = keyByDictO(self, null); 5122 ck_assert_ptr_eq(r, null); 5123 // empty self 5124 freeO(self); 5125 r = keyByDictO(self, dict); 5126 ck_assert_ptr_eq(r, null); 5127 terminateO(self); 5128 terminateO(dict); 5129 5130 END_TEST 5131 5132 5133 START_TEST(keyByArraySmallDictT) 5134 5135 char* r; 5136 smallDictt *self = allocG(rtSmallDictt); 5137 smallArrayt *array = allocSmallArray(); 5138 5139 createAllocateSmallArray(d); 5140 d->f->pushS(d, "another array"); 5141 smallDictt *r2 = self->f->setNFreeArray(self, "d", d); 5142 ck_assert_ptr_ne(r2, null); 5143 r2 = self->f->setNFreeArray(self, "1", array); 5144 ck_assert_ptr_ne(r2, null); 5145 array = allocSmallArray(); 5146 r = keyByArrayO(self, array); 5147 ck_assert_str_eq(r, "1"); 5148 // non existing object 5149 r2 = self->f->setInt(self, "1", 1); 5150 ck_assert_ptr_ne(r2, null); 5151 r = keyByArrayO(self, array); 5152 ck_assert_ptr_eq(r, null); 5153 // non smallArray object 5154 smallIntt *i = allocSmallInt(2); 5155 r = keyByArrayO(self, (smallArrayt*)i); 5156 terminateO(i); 5157 ck_assert_ptr_eq(r, null); 5158 // null value 5159 r = keyByArrayO(self, null); 5160 ck_assert_ptr_eq(r, null); 5161 // empty self 5162 freeO(self); 5163 r = keyByArrayO(self, array); 5164 ck_assert_ptr_eq(r, null); 5165 terminateO(self); 5166 terminateO(array); 5167 5168 END_TEST 5169 5170 5171 START_TEST(keyByArraycSmallDictT) 5172 5173 char* r; 5174 smallDictt *self = allocG(rtSmallDictt); 5175 char **array = listCreateS("a","b"); 5176 5177 char **d = listCreateS("asd", "zxcv"); 5178 smallDictt *r2 = self->f->setNFreeArrayc(self, "d", d); 5179 ck_assert_ptr_ne(r2, null); 5180 r2 = self->f->setArrayc(self, "1", array); 5181 ck_assert_ptr_ne(r2, null); 5182 r = keyByArraycO(self, array); 5183 ck_assert_ptr_ne(r, NULL); 5184 ck_assert_str_eq(r, "1"); 5185 // non existing object 5186 r2 = self->f->setInt(self, "1", 1); 5187 ck_assert_ptr_ne(r2, null); 5188 r = keyByArraycO(self, array); 5189 ck_assert_ptr_eq(r, null); 5190 // null value 5191 r = keyByArraycO(self, null); 5192 ck_assert_ptr_eq(r, null); 5193 // empty self 5194 freeO(self); 5195 r = keyByArraycO(self, array); 5196 ck_assert_ptr_eq(r, null); 5197 terminateO(self); 5198 listFreeS(array); 5199 5200 END_TEST 5201 5202 5203 START_TEST(keyBySmallBoolSmallDictT) 5204 5205 char* r; 5206 smallDictt *self = allocG(rtSmallDictt); 5207 smallBoolt *value = allocSmallBool(true); 5208 5209 createAllocateSmallBool(d); 5210 setValO(d, false); 5211 smallDictt *r2 = self->f->setNFreeSmallBool(self, "d", d); 5212 ck_assert_ptr_ne(r2, null); 5213 r2 = self->f->setNFreeSmallBool(self, "1", value); 5214 ck_assert_ptr_ne(r2, null); 5215 value = allocSmallBool(true); 5216 r = keyBySmallBoolO(self, value); 5217 ck_assert_str_eq(r, "1"); 5218 // non existing object 5219 r2 = self->f->setInt(self, "1", 1); 5220 ck_assert_ptr_ne(r2, null); 5221 r = keyBySmallBoolO(self, value); 5222 ck_assert_ptr_eq(r, null); 5223 // non smallBool object 5224 smallIntt *i = allocSmallInt(2); 5225 r = keyBySmallBoolO(self, (smallBoolt*)i); 5226 terminateO(i); 5227 ck_assert_ptr_eq(r, null); 5228 // null value 5229 r = keyBySmallBoolO(self, null); 5230 ck_assert_ptr_eq(r, null); 5231 // empty self 5232 freeO(self); 5233 r = keyBySmallBoolO(self, value); 5234 ck_assert_ptr_eq(r, null); 5235 terminateO(self); 5236 terminateO(value); 5237 5238 END_TEST 5239 5240 5241 START_TEST(keyBySmallBytesSmallDictT) 5242 5243 char* r; 5244 smallDictt *self = allocG(rtSmallDictt); 5245 smallBytest *value = allocSmallBytes("qwe", sizeof("qwe")); 5246 5247 smallBytest *d = allocSmallBytes("asd", sizeof("asd")); 5248 smallDictt *r2 = self->f->setNFreeSmallBytes(self, "d", d); 5249 ck_assert_ptr_ne(r2, null); 5250 r2 = self->f->setNFreeSmallBytes(self, "1", value); 5251 ck_assert_ptr_ne(r2, null); 5252 value = allocSmallBytes("qwe", sizeof("qwe")); 5253 r = keyBySmallBytesO(self, value); 5254 ck_assert_str_eq(r, "1"); 5255 // non existing object 5256 r2 = self->f->setInt(self, "1", 1); 5257 ck_assert_ptr_ne(r2, null); 5258 r = keyBySmallBytesO(self, value); 5259 ck_assert_ptr_eq(r, null); 5260 // empty value 5261 freeO(value); 5262 r = keyBySmallBytesO(self, value); 5263 ck_assert_ptr_eq(r, null); 5264 // non smallBytes object 5265 smallIntt *i = allocSmallInt(2); 5266 r = keyBySmallBytesO(self, (smallBytest*)i); 5267 terminateO(i); 5268 ck_assert_ptr_eq(r, null); 5269 // null value 5270 r = keyBySmallBytesO(self, null); 5271 ck_assert_ptr_eq(r, null); 5272 // empty self 5273 freeO(self); 5274 r = keyBySmallBytesO(self, value); 5275 ck_assert_ptr_eq(r, null); 5276 terminateO(self); 5277 terminateO(value); 5278 5279 END_TEST 5280 5281 5282 START_TEST(keyBySmallDoubleSmallDictT) 5283 5284 char* r; 5285 smallDictt *self = allocG(rtSmallDictt); 5286 smallDoublet *value = allocSmallDouble(2.2); 5287 5288 createAllocateSmallDouble(d); 5289 smallDictt *r2 = self->f->setNFreeSmallDouble(self, "d", d); 5290 ck_assert_ptr_ne(r2, null); 5291 r2 = self->f->setNFreeSmallDouble(self, "1", value); 5292 ck_assert_ptr_ne(r2, null); 5293 value = allocSmallDouble(2.2); 5294 r = keyBySmallDoubleO(self, value); 5295 ck_assert_str_eq(r, "1"); 5296 // non existing object 5297 r2 = self->f->setInt(self, "1", 1); 5298 ck_assert_ptr_ne(r2, null); 5299 r = keyBySmallDoubleO(self, value); 5300 ck_assert_ptr_eq(r, null); 5301 // non smallDouble object 5302 smallIntt *i = allocSmallInt(2); 5303 r = keyBySmallDoubleO(self, (smallDoublet*)i); 5304 terminateO(i); 5305 ck_assert_ptr_eq(r, null); 5306 // null value 5307 r = keyBySmallDoubleO(self, null); 5308 ck_assert_ptr_eq(r, null); 5309 // empty self 5310 freeO(self); 5311 r = keyBySmallDoubleO(self, value); 5312 ck_assert_ptr_eq(r, null); 5313 terminateO(self); 5314 terminateO(value); 5315 5316 END_TEST 5317 5318 5319 START_TEST(keyBySmallIntSmallDictT) 5320 5321 char* r; 5322 smallDictt *self = allocG(rtSmallDictt); 5323 smallIntt *value = allocSmallInt(2); 5324 5325 createAllocateSmallInt(d); 5326 smallDictt *r2 = self->f->setNFreeSmallInt(self, "d", d); 5327 ck_assert_ptr_ne(r2, null); 5328 r2 = self->f->setNFreeSmallInt(self, "1", value); 5329 ck_assert_ptr_ne(r2, null); 5330 value = allocSmallInt(2); 5331 r = keyBySmallIntO(self, value); 5332 ck_assert_str_eq(r, "1"); 5333 // non existing object 5334 r2 = self->f->setInt(self, "1", 1); 5335 ck_assert_ptr_ne(r2, null); 5336 r = keyBySmallIntO(self, value); 5337 ck_assert_ptr_eq(r, null); 5338 // non smallInt object 5339 smallBoolt *i = allocSmallBool(false); 5340 r = keyBySmallIntO(self, (smallIntt*)i); 5341 terminateO(i); 5342 ck_assert_ptr_eq(r, null); 5343 // null value 5344 r = keyBySmallIntO(self, null); 5345 ck_assert_ptr_eq(r, null); 5346 // empty self 5347 freeO(self); 5348 r = keyBySmallIntO(self, value); 5349 ck_assert_ptr_eq(r, null); 5350 terminateO(self); 5351 terminateO(value); 5352 5353 END_TEST 5354 5355 5356 START_TEST(keyBySmallJsonSmallDictT) 5357 5358 char* r; 5359 smallDictt *self = allocG(rtSmallDictt); 5360 smallJsont *value = allocSmallJson(); 5361 5362 // undefined 5363 createUndefined(u); 5364 setTopO(value, (baset*)&u); 5365 self->f->setUndefined(self, "1"); 5366 r = self->f->keyBySmallJson(self, value); 5367 ck_assert_str_eq(r, "1"); 5368 freeO(value); 5369 // bool 5370 setTopBoolO(value, true); 5371 self->f->setBool(self, "b", true); 5372 r = self->f->keyBySmallJson(self, value); 5373 ck_assert_str_eq(r, "b"); 5374 freeO(value); 5375 // double 5376 setTopDoubleO(value, 2.2); 5377 self->f->setDouble(self, "db", 2.2); 5378 r = self->f->keyBySmallJson(self, value); 5379 ck_assert_str_eq(r, "db"); 5380 freeO(value); 5381 // int 5382 setTopIntO(value, 2); 5383 self->f->setInt(self, "i", 2); 5384 r = self->f->keyBySmallJson(self, value); 5385 ck_assert_str_eq(r, "i"); 5386 freeO(value); 5387 // string 5388 setTopSO(value, "qwe"); 5389 self->f->setS(self, "s", "qwe"); 5390 r = self->f->keyBySmallJson(self, value); 5391 ck_assert_str_eq(r, "s"); 5392 freeO(value); 5393 // dict 5394 smallDictt *D = allocSmallDict(); 5395 setTopNFreeDictO(value, D); 5396 self->f->setNFreeDict(self, "d", allocSmallDict()); 5397 r = self->f->keyBySmallJson(self, value); 5398 ck_assert_str_eq(r, "d"); 5399 freeO(value); 5400 // array 5401 smallArrayt *a = allocSmallArray(); 5402 setTopNFreeArrayO(value, a); 5403 self->f->setNFreeArray(self, "a", allocSmallArray()); 5404 r = self->f->keyBySmallJson(self, value); 5405 ck_assert_str_eq(r, "a"); 5406 freeO(value); 5407 // empty value 5408 r = self->f->keyBySmallJson(self, value); 5409 ck_assert_ptr_eq(r, null); 5410 // non smallJson object 5411 smallIntt *i = allocSmallInt(2); 5412 r = self->f->keyBySmallJson(self, (smallJsont*)i); 5413 terminateO(i); 5414 ck_assert_ptr_eq(r, null); 5415 // null value 5416 r = self->f->keyBySmallJson(self, null); 5417 ck_assert_ptr_eq(r, null); 5418 // empty self 5419 freeO(self); 5420 r = self->f->keyBySmallJson(self, value); 5421 ck_assert_ptr_eq(r, null); 5422 terminateO(self); 5423 terminateO(value); 5424 5425 END_TEST 5426 5427 5428 START_TEST(keyBySmallStringSmallDictT) 5429 5430 char* r; 5431 smallDictt *self = allocG(rtSmallDictt); 5432 smallStringt *value = allocSmallString("qwe"); 5433 5434 createAllocateSmallString(d); 5435 smallDictt *r2 = self->f->setNFreeSmallString(self, "d", d); 5436 ck_assert_ptr_ne(r2, null); 5437 r2 = self->f->setNFreeSmallString(self, "1", value); 5438 ck_assert_ptr_ne(r2, null); 5439 value = allocSmallString("qwe"); 5440 r = keyBySmallStringO(self, value); 5441 ck_assert_str_eq(r, "1"); 5442 // non existing object 5443 r2 = self->f->setInt(self, "1", 1); 5444 ck_assert_ptr_ne(r2, null); 5445 r = keyBySmallStringO(self, value); 5446 ck_assert_ptr_eq(r, null); 5447 // empty value 5448 freeO(value); 5449 r = keyBySmallStringO(self, value); 5450 ck_assert_ptr_eq(r, null); 5451 // non smallString object 5452 smallIntt *i = allocSmallInt(2); 5453 r = keyBySmallStringO(self, (smallStringt*)i); 5454 terminateO(i); 5455 ck_assert_ptr_eq(r, null); 5456 // null value 5457 r = keyBySmallStringO(self, null); 5458 ck_assert_ptr_eq(r, null); 5459 // empty self 5460 freeO(self); 5461 r = keyBySmallStringO(self, value); 5462 ck_assert_ptr_eq(r, null); 5463 terminateO(self); 5464 terminateO(value); 5465 5466 END_TEST 5467 5468 5469 START_TEST(keyBySmallContainerSmallDictT) 5470 5471 char* r; 5472 smallDictt *self = allocG(rtSmallDictt); 5473 smallContainert *value = allocSmallContainer(null); 5474 5475 createAllocateSmallString(d); 5476 smallDictt *r2 = self->f->setNFreeSmallString(self, "d", d); 5477 ck_assert_ptr_ne(r2, null); 5478 r = keyBySmallContainerO(self, value); 5479 ck_assert_ptr_eq(r, null); 5480 // non smallContainer object 5481 smallIntt *i = allocSmallInt(2); 5482 r = keyBySmallContainerO(self, (smallContainert*)i); 5483 terminateO(i); 5484 ck_assert_ptr_eq(r, null); 5485 // null value 5486 r = keyBySmallContainerO(self, null); 5487 ck_assert_ptr_eq(r, null); 5488 // empty self 5489 freeO(self); 5490 r = keyBySmallContainerO(self, value); 5491 ck_assert_ptr_eq(r, null); 5492 terminateO(self); 5493 terminateO(value); 5494 5495 END_TEST 5496 5497 5498 START_TEST(icKeyBySmallDictT) 5499 5500 char* r; 5501 smallDictt *self = allocG(rtSmallDictt); 5502 baset *value; 5503 5504 smallDictt *r2 = self->f->setS(self, "1", "QQ"); 5505 ck_assert_ptr_ne(r2, null); 5506 value = (baset*) allocSmallString("qq"); 5507 r = icKeyByO(self, value); 5508 ck_assert_str_eq(r, "1"); 5509 // non existing object 5510 smallIntt *i = allocSmallInt(2); 5511 r = icKeyByO(self, (baset*)i); 5512 terminateO(i); 5513 ck_assert_ptr_eq(r, null); 5514 // null value 5515 r = icKeyByO(self, null); 5516 ck_assert_ptr_eq(r, null); 5517 // empty self 5518 freeO(self); 5519 r = icKeyByO(self, value); 5520 ck_assert_ptr_eq(r, null); 5521 terminateO(self); 5522 terminateO(value); 5523 5524 END_TEST 5525 5526 5527 START_TEST(icKeyBySSmallDictT) 5528 5529 char* r; 5530 smallDictt *self = allocG(rtSmallDictt); 5531 5532 smallDictt *r2 = self->f->setS(self, "1", "qwe"); 5533 ck_assert_ptr_ne(r2, null); 5534 r = icKeyBySO(self, "QWE"); 5535 ck_assert_str_eq(r, "1"); 5536 // non existing object 5537 r2 = self->f->setInt(self, "1", 1); 5538 ck_assert_ptr_ne(r2, null); 5539 r = icKeyBySO(self, "qwe"); 5540 ck_assert_ptr_eq(r, null); 5541 // null value 5542 r = icKeyBySO(self, null); 5543 ck_assert_ptr_eq(r, null); 5544 // empty self 5545 freeO(self); 5546 r = icKeyBySO(self, "qwe"); 5547 ck_assert_ptr_eq(r, null); 5548 terminateO(self); 5549 5550 END_TEST 5551 5552 5553 START_TEST(icKeyByCharSmallDictT) 5554 5555 char* r; 5556 smallDictt *self = allocG(rtSmallDictt); 5557 5558 smallDictt *r2 = self->f->setS(self, "1", "q"); 5559 ck_assert_ptr_ne(r2, null); 5560 r = icKeyByCharO(self, 'Q'); 5561 ck_assert_str_eq(r, "1"); 5562 // non existing object 5563 r2 = self->f->setInt(self, "1", 1); 5564 ck_assert_ptr_ne(r2, null); 5565 r = icKeyByCharO(self, 'q'); 5566 ck_assert_ptr_eq(r, null); 5567 // empty self 5568 freeO(self); 5569 r = icKeyByCharO(self, 'q'); 5570 ck_assert_ptr_eq(r, null); 5571 terminateO(self); 5572 5573 END_TEST 5574 5575 5576 START_TEST(icKeyByDictSmallDictT) 5577 5578 char* r; 5579 smallDictt *self = allocG(rtSmallDictt); 5580 smallDictt *dict = allocSmallDict(); 5581 5582 createAllocateSmallDict(d); 5583 d->f->setS(d, "another", "dict"); 5584 smallDictt *r2 = self->f->setNFreeDict(self, "d", d); 5585 ck_assert_ptr_ne(r2, null); 5586 dict->f->setS(dict, "asd", "asd"); 5587 r2 = self->f->setNFreeDict(self, "1", dict); 5588 ck_assert_ptr_ne(r2, null); 5589 dict = allocSmallDict(); 5590 dict->f->setS(dict, "ASD", "asd"); 5591 r = icKeyByDictO(self, dict); 5592 ck_assert_str_eq(r, "1"); 5593 // non existing object 5594 r2 = self->f->setInt(self, "1", 1); 5595 ck_assert_ptr_ne(r2, null); 5596 r = icKeyByDictO(self, dict); 5597 ck_assert_ptr_eq(r, null); 5598 // non smallDict object 5599 smallIntt *i = allocSmallInt(2); 5600 r = icKeyByDictO(self, (smallDictt*)i); 5601 terminateO(i); 5602 ck_assert_ptr_eq(r, null); 5603 // null value 5604 r = icKeyByDictO(self, null); 5605 ck_assert_ptr_eq(r, null); 5606 // empty self 5607 freeO(self); 5608 r = icKeyByDictO(self, dict); 5609 ck_assert_ptr_eq(r, null); 5610 terminateO(self); 5611 terminateO(dict); 5612 5613 END_TEST 5614 5615 5616 START_TEST(icKeyByArraySmallDictT) 5617 5618 char* r; 5619 smallDictt *self = allocG(rtSmallDictt); 5620 smallArrayt *array = allocSmallArray(); 5621 5622 createAllocateSmallArray(d); 5623 d->f->pushS(d, "another array"); 5624 smallDictt *r2 = self->f->setNFreeArray(self, "d", d); 5625 ck_assert_ptr_ne(r2, null); 5626 array->f->pushS(array, "the array"); 5627 r2 = self->f->setNFreeArray(self, "1", array); 5628 ck_assert_ptr_ne(r2, null); 5629 array = allocSmallArray(); 5630 array->f->pushS(array, "The array"); 5631 r = icKeyByArrayO(self, array); 5632 ck_assert_str_eq(r, "1"); 5633 // non existing object 5634 r2 = self->f->setInt(self, "1", 1); 5635 ck_assert_ptr_ne(r2, null); 5636 r = icKeyByArrayO(self, array); 5637 ck_assert_ptr_eq(r, null); 5638 // non smallArray object 5639 smallIntt *i = allocSmallInt(2); 5640 r = icKeyByArrayO(self, (smallArrayt*)i); 5641 terminateO(i); 5642 ck_assert_ptr_eq(r, null); 5643 // null value 5644 r = icKeyByArrayO(self, null); 5645 ck_assert_ptr_eq(r, null); 5646 // empty self 5647 freeO(self); 5648 r = icKeyByArrayO(self, array); 5649 ck_assert_ptr_eq(r, null); 5650 terminateO(self); 5651 terminateO(array); 5652 5653 END_TEST 5654 5655 5656 START_TEST(icKeyByArraycSmallDictT) 5657 5658 char* r; 5659 smallDictt *self = allocG(rtSmallDictt); 5660 char **array = listCreateS("a","b"); 5661 5662 char **d = listCreateS("asd", "zxcv"); 5663 smallDictt *r2 = self->f->setNFreeArrayc(self, "d", d); 5664 ck_assert_ptr_ne(r2, null); 5665 r2 = self->f->setArrayc(self, "1", array); 5666 ck_assert_ptr_ne(r2, null); 5667 iUpperS(&array[0]); 5668 r = icKeyByArraycO(self, array); 5669 ck_assert_ptr_ne(r, NULL); 5670 ck_assert_str_eq(r, "1"); 5671 // non existing object 5672 r2 = self->f->setInt(self, "1", 1); 5673 ck_assert_ptr_ne(r2, null); 5674 r = icKeyByArraycO(self, array); 5675 ck_assert_ptr_eq(r, null); 5676 // null value 5677 r = icKeyByArraycO(self, null); 5678 ck_assert_ptr_eq(r, null); 5679 // empty self 5680 freeO(self); 5681 r = icKeyByArraycO(self, array); 5682 ck_assert_ptr_eq(r, null); 5683 terminateO(self); 5684 listFreeS(array); 5685 5686 END_TEST 5687 5688 5689 START_TEST(icKeyBySmallJsonSmallDictT) 5690 5691 char* r; 5692 smallDictt *self = allocG(rtSmallDictt); 5693 smallJsont *value = allocSmallJson(); 5694 5695 // undefined 5696 createUndefined(u); 5697 setTopO(value, (baset*)&u); 5698 self->f->setUndefined(self, "1"); 5699 r = self->f->icKeyBySmallJson(self, value); 5700 ck_assert_str_eq(r, "1"); 5701 freeO(value); 5702 // bool 5703 setTopBoolO(value, true); 5704 self->f->setBool(self, "b", true); 5705 r = self->f->icKeyBySmallJson(self, value); 5706 ck_assert_str_eq(r, "b"); 5707 freeO(value); 5708 // double 5709 setTopDoubleO(value, 2.2); 5710 self->f->setDouble(self, "db", 2.2); 5711 r = self->f->icKeyBySmallJson(self, value); 5712 ck_assert_str_eq(r, "db"); 5713 freeO(value); 5714 // int 5715 setTopIntO(value, 2); 5716 self->f->setInt(self, "i", 2); 5717 r = self->f->icKeyBySmallJson(self, value); 5718 ck_assert_str_eq(r, "i"); 5719 freeO(value); 5720 // string 5721 setTopSO(value, "qwe"); 5722 self->f->setS(self, "s", "QWE"); 5723 r = self->f->icKeyBySmallJson(self, value); 5724 ck_assert_str_eq(r, "s"); 5725 freeO(value); 5726 // dict 5727 smallDictt *D = allocSmallDict(); 5728 D->f->setS(D, "q", "wee"); 5729 setTopNFreeDictO(value, D); 5730 D = allocSmallDict(); 5731 D->f->setS(D, "Q", "wee"); 5732 self->f->setNFreeDict(self, "d", D); 5733 r = self->f->icKeyBySmallJson(self, value); 5734 ck_assert_str_eq(r, "d"); 5735 freeO(value); 5736 // array 5737 smallArrayt *a = allocSmallArray(); 5738 a->f->pushS(a, "QWE"); 5739 setTopNFreeArrayO(value, a); 5740 a = allocSmallArray(); 5741 a->f->pushS(a, "qwe"); 5742 self->f->setNFreeArray(self, "a", a); 5743 r = self->f->icKeyBySmallJson(self, value); 5744 ck_assert_str_eq(r, "a"); 5745 freeO(value); 5746 // empty value 5747 r = self->f->icKeyBySmallJson(self, value); 5748 ck_assert_ptr_eq(r, null); 5749 // non smallJson object 5750 smallIntt *i = allocSmallInt(2); 5751 r = self->f->icKeyBySmallJson(self, (smallJsont*)i); 5752 terminateO(i); 5753 ck_assert_ptr_eq(r, null); 5754 // null value 5755 r = self->f->icKeyBySmallJson(self, null); 5756 ck_assert_ptr_eq(r, null); 5757 // empty self 5758 freeO(self); 5759 r = self->f->icKeyBySmallJson(self, value); 5760 ck_assert_ptr_eq(r, null); 5761 terminateO(self); 5762 terminateO(value); 5763 5764 END_TEST 5765 5766 5767 START_TEST(icKeyBySmallStringSmallDictT) 5768 5769 char* r; 5770 smallDictt *self = allocG(rtSmallDictt); 5771 smallStringt *value = allocSmallString("qwe"); 5772 5773 createAllocateSmallString(d); 5774 smallDictt *r2 = self->f->setNFreeSmallString(self, "d", d); 5775 ck_assert_ptr_ne(r2, null); 5776 r2 = self->f->setNFreeSmallString(self, "1", value); 5777 ck_assert_ptr_ne(r2, null); 5778 value = allocSmallString("QWE"); 5779 r = icKeyBySmallStringO(self, value); 5780 ck_assert_str_eq(r, "1"); 5781 // non existing object 5782 r2 = self->f->setInt(self, "1", 1); 5783 ck_assert_ptr_ne(r2, null); 5784 r = icKeyBySmallStringO(self, value); 5785 ck_assert_ptr_eq(r, null); 5786 // empty value 5787 freeO(value); 5788 r = icKeyBySmallStringO(self, value); 5789 ck_assert_ptr_eq(r, null); 5790 // non smallString object 5791 smallIntt *i = allocSmallInt(2); 5792 r = icKeyBySmallStringO(self, (smallStringt*)i); 5793 terminateO(i); 5794 ck_assert_ptr_eq(r, null); 5795 // null value 5796 r = icKeyBySmallStringO(self, null); 5797 ck_assert_ptr_eq(r, null); 5798 // empty self 5799 freeO(self); 5800 r = icKeyBySmallStringO(self, value); 5801 ck_assert_ptr_eq(r, null); 5802 terminateO(self); 5803 terminateO(value); 5804 5805 END_TEST 5806 5807 5808 START_TEST(trimSmallDictT) 5809 5810 smallDictt* r; 5811 smallDictt *self = allocG(rtSmallDictt); 5812 5813 self->f->setS(self, "1", "2"); 5814 self->f->setS(self, "3", "4"); 5815 self->f->del(self, "3"); 5816 r = trimO(self); 5817 ck_assert_ptr_ne(r, null); 5818 ck_assert_int_eq(lenO(self), 1); 5819 char *s = toStringO(r); 5820 ck_assert_str_eq(s, "{\"1\":\"2\"}"); 5821 free(s); 5822 self->f->del(self, "1"); 5823 r = trimO(self); 5824 ck_assert_ptr_ne(r, null); 5825 ck_assert_int_eq(lenO(self), 0); 5826 s = toStringO(r); 5827 ck_assert_str_eq(s, "{}"); 5828 free(s); 5829 terminateO(self); 5830 5831 END_TEST 5832 5833 5834 START_TEST(keysSmallStringSmallDictT) 5835 5836 smallArrayt* r; 5837 smallDictt *self = allocG(rtSmallDictt); 5838 5839 self->f->setS(self, "1", "2"); 5840 self->f->setS(self, "3", "4"); 5841 r = keysSmallStringO(self); 5842 ck_assert_ptr_ne(r, null); 5843 char *s = toStringO(r); 5844 ck_assert_str_eq(s, "[\"1\",\"3\"]"); 5845 free(s); 5846 terminateO(r); 5847 // empty self 5848 freeO(self); 5849 r = keysSmallStringO(self); 5850 ck_assert_ptr_ne(r, null); 5851 s = toStringO(r); 5852 ck_assert_str_eq(s, "[]"); 5853 free(s); 5854 terminateO(r); 5855 terminateO(self); 5856 5857 END_TEST 5858 5859 5860 START_TEST(mergeSmallJsonSmallDictT) 5861 5862 smallDictt* r; 5863 smallDictt *self = allocG(rtSmallDictt); 5864 smallJsont *json = allocSmallJson(); 5865 5866 self->f->setS(self, "1", "2"); 5867 self->f->setS(self, "3", "4"); 5868 json->f->setS(json, "3", "#"); 5869 json->f->setInt(json, "4", 0); 5870 r = self->f->mergeSmallJson(self, json); 5871 ck_assert_ptr_ne(r, null); 5872 char *s = toStringO(r); 5873 ck_assert_str_eq(s, "{\"1\":\"2\",\"3\":\"#\",\"4\":0}"); 5874 free(s); 5875 // empty json dict 5876 disposeO(json); 5877 json->f->setS(json, "a", "s"); 5878 delElemO(json, "a"); 5879 trimO(json); 5880 r = self->f->mergeSmallJson(self, json); 5881 ck_assert_ptr_eq(r, self); 5882 // non json dict 5883 freeO(json); 5884 setTopSO(json, "qwe"); 5885 r = self->f->mergeSmallJson(self, json); 5886 ck_assert_ptr_eq(r, null); 5887 // non smallJson object 5888 createAllocateSmallInt(i); 5889 r = self->f->mergeSmallJson(self, (smallJsont*)i); 5890 ck_assert_ptr_eq(r, null); 5891 terminateO(i); 5892 // null 5893 r = self->f->mergeSmallJson(self, null); 5894 ck_assert_ptr_eq(r, null); 5895 terminateO(self); 5896 terminateO(json); 5897 5898 END_TEST 5899 5900 5901 START_TEST(mergeNSmashSmallDictT) 5902 5903 smallDictt* r; 5904 smallDictt *self = allocG(rtSmallDictt); 5905 smallDictt *value = allocSmallDict(); 5906 5907 self->f->setS(self, "1", "2"); 5908 self->f->setS(self, "3", "4"); 5909 value->f->setS(value, "3", "#"); 5910 value->f->setInt(value, "4", 0); 5911 r = self->f->mergeNSmash(self, value); 5912 ck_assert_ptr_ne(r, null); 5913 char *s = toStringO(r); 5914 ck_assert_str_eq(s, "{\"1\":\"2\",\"3\":\"#\",\"4\":0}"); 5915 free(s); 5916 // empty dict 5917 value = allocSmallDict(); 5918 r = self->f->mergeNSmash(self, value); 5919 ck_assert_ptr_eq(r, self); 5920 // non smallDict object 5921 createAllocateSmallInt(i); 5922 r = self->f->mergeNSmash(self, (smallDictt*)i); 5923 ck_assert_ptr_eq(r, null); 5924 terminateO(i); 5925 // null 5926 r = self->f->mergeNSmash(self, null); 5927 ck_assert_ptr_eq(r, null); 5928 terminateO(self); 5929 5930 END_TEST 5931 5932 5933 START_TEST(mergeNSmashSmallJsonSmallDictT) 5934 5935 smallDictt* r; 5936 smallDictt *self = allocG(rtSmallDictt); 5937 smallJsont *value = allocSmallJson(); 5938 5939 self->f->setS(self, "1", "2"); 5940 self->f->setS(self, "3", "4"); 5941 value->f->setS(value, "3", "#"); 5942 value->f->setInt(value, "4", 0); 5943 r = self->f->mergeNSmashSmallJson(self, value); 5944 ck_assert_ptr_ne(r, null); 5945 char *s = toStringO(r); 5946 ck_assert_str_eq(s, "{\"1\":\"2\",\"3\":\"#\",\"4\":0}"); 5947 free(s); 5948 // empty json dict 5949 value = allocSmallJson(); 5950 value->f->setS(value, "a", "s"); 5951 delElemO(value, "a"); 5952 trimO(value); 5953 r = self->f->mergeNSmashSmallJson(self, value); 5954 ck_assert_ptr_eq(r, self); 5955 // non smallDict object 5956 createAllocateSmallInt(i); 5957 r = self->f->mergeNSmashSmallJson(self, (smallJsont*)i); 5958 ck_assert_ptr_eq(r, null); 5959 terminateO(i); 5960 // null 5961 r = self->f->mergeNSmashSmallJson(self, null); 5962 ck_assert_ptr_eq(r, null); 5963 terminateO(self); 5964 5965 END_TEST 5966 5967 5968 START_TEST(appendNSmashSmallDictT) 5969 5970 smallDictt* r; 5971 smallDictt *self = allocG(rtSmallDictt); 5972 smallDictt *value = allocSmallDict(); 5973 5974 self->f->setS(self, "1", "2"); 5975 self->f->setS(self, "3", "4"); 5976 value->f->setS(value, "3", "#"); 5977 value->f->setInt(value, "4", 0); 5978 smallt *data = sDictGetTiny(value->d, "3"); 5979 r = self->f->appendNSmash(self, value); 5980 ck_assert_ptr_ne(r, null); 5981 sFree(data); 5982 char *s = toStringO(r); 5983 ck_assert_str_eq(s, "{\"1\":\"2\",\"3\":\"4\",\"4\":0}"); 5984 free(s); 5985 // empty dict 5986 value = allocSmallDict(); 5987 r = self->f->appendNSmash(self, value); 5988 ck_assert_ptr_eq(r, self); 5989 // non smallDict object 5990 createAllocateSmallInt(i); 5991 r = self->f->appendNSmash(self, (smallDictt*)i); 5992 ck_assert_ptr_eq(r, null); 5993 terminateO(i); 5994 // null 5995 r = self->f->appendNSmash(self, null); 5996 ck_assert_ptr_eq(r, null); 5997 terminateO(self); 5998 5999 END_TEST 6000 6001 6002 START_TEST(equalSmallDictBaseT) 6003 6004 bool r; 6005 smallDictt* self = allocG(rtSmallDictt); 6006 6007 createAllocateSmallDict(d); 6008 r = self->f->equalBase(self, (baset*)d); 6009 ck_assert(!r); 6010 terminateO(d); 6011 // non smallDict 6012 createAllocateSmallInt(i); 6013 r = self->f->equalBase(self, (baset*)i); 6014 terminateO(i); 6015 ck_assert(!r); 6016 // null 6017 r = self->f->equalBase(self, null); 6018 ck_assert(!r); 6019 terminateO(self); 6020 6021 END_TEST 6022 6023 6024 START_TEST(equalSmallDictSmallJsonT) 6025 6026 bool r; 6027 smallDictt* self = allocG(rtSmallDictt); 6028 smallJsont* p2 = allocSmallJson(); 6029 6030 self->f->setS(self, "3", "#"); 6031 p2->f->setS(p2, "3", "#"); 6032 r = self->f->equalSmallJson(self, p2); 6033 ck_assert(r); 6034 // non json dict 6035 freeO(self); 6036 freeO(p2); 6037 r = self->f->equalSmallJson(self, p2); 6038 ck_assert(!r); 6039 terminateO(p2); 6040 // non smallJson 6041 createAllocateSmallInt(i); 6042 r = self->f->equalSmallJson(self, (smallJsont*)i); 6043 terminateO(i); 6044 ck_assert(!r); 6045 // null 6046 r = self->f->equalSmallJson(self, null); 6047 ck_assert(!r); 6048 terminateO(self); 6049 6050 END_TEST 6051 6052 6053 START_TEST(equalSmallDictT) 6054 6055 bool r; 6056 smallDictt* self = allocG(rtSmallDictt); 6057 smallDictt* p2 = allocSmallDict(); 6058 6059 self->f->setS(self, "3", "#"); 6060 p2->f->setS(p2, "3", "#"); 6061 r = self->f->equal(self, p2); 6062 ck_assert(r); 6063 // not equal 6064 self->f->setS(self, "4", "#"); 6065 p2->f->setS(p2, "4", "$"); 6066 r = self->f->equal(self, p2); 6067 ck_assert(!r); 6068 // different keys 6069 self->f->del(self, "4"); 6070 self->f->setS(self, "$", "#"); 6071 r = self->f->equal(self, p2); 6072 ck_assert(!r); 6073 // different key count 6074 p2->f->del(p2, "4"); 6075 r = self->f->equal(self, p2); 6076 ck_assert(!r); 6077 // empty dict 6078 freeO(p2); 6079 r = self->f->equal(self, p2); 6080 ck_assert(!r); 6081 terminateO(p2); 6082 // non smallDict 6083 createAllocateSmallInt(i); 6084 r = self->f->equal(self, (smallDictt*)i); 6085 terminateO(i); 6086 ck_assert(!r); 6087 // null 6088 r = self->f->equal(self, null); 6089 ck_assert(!r); 6090 terminateO(self); 6091 6092 END_TEST 6093 6094 6095 START_TEST(icEqualSmallDictBaseT) 6096 6097 bool r; 6098 smallDictt* self = allocG(rtSmallDictt); 6099 6100 createAllocateSmallDict(d); 6101 self->f->setS(self, "q", "q"); 6102 d->f->setS(d, "q", "Q"); 6103 r = self->f->icEqualBase(self, (baset*)d); 6104 ck_assert(r); 6105 terminateO(d); 6106 // non smallDict 6107 createAllocateSmallInt(i); 6108 r = self->f->icEqualBase(self, (baset*)i); 6109 terminateO(i); 6110 ck_assert(!r); 6111 // null 6112 r = self->f->icEqualBase(self, null); 6113 ck_assert(!r); 6114 terminateO(self); 6115 6116 END_TEST 6117 6118 6119 START_TEST(icEqualSmallDictSmallJsonT) 6120 6121 bool r; 6122 smallDictt* self = allocG(rtSmallDictt); 6123 smallJsont* p2 = allocSmallJson(); 6124 6125 self->f->setS(self, "3", "W"); 6126 p2->f->setS(p2, "3", "w"); 6127 r = self->f->icEqualSmallJson(self, p2); 6128 ck_assert(r); 6129 // non json dict 6130 freeO(self); 6131 freeO(p2); 6132 r = self->f->icEqualSmallJson(self, p2); 6133 ck_assert(!r); 6134 terminateO(p2); 6135 // non smallJson 6136 createAllocateSmallInt(i); 6137 r = self->f->icEqualSmallJson(self, (smallJsont*)i); 6138 terminateO(i); 6139 ck_assert(!r); 6140 // null 6141 r = self->f->icEqualSmallJson(self, null); 6142 ck_assert(!r); 6143 terminateO(self); 6144 6145 END_TEST 6146 6147 6148 START_TEST(icEqualSmallDictT) 6149 6150 bool r; 6151 smallDictt* self = allocG(rtSmallDictt); 6152 smallDictt* p2 = allocSmallDict(); 6153 6154 self->f->setS(self, "3", "A"); 6155 p2->f->setS(p2, "3", "a"); 6156 r = self->f->icEqual(self, p2); 6157 ck_assert(r); 6158 // not equal 6159 self->f->setS(self, "4", "#"); 6160 p2->f->setS(p2, "4", "$"); 6161 r = self->f->icEqual(self, p2); 6162 ck_assert(!r); 6163 // different keys 6164 self->f->del(self, "4"); 6165 self->f->setS(self, "$", "#"); 6166 r = self->f->icEqual(self, p2); 6167 ck_assert(!r); 6168 // different key count 6169 p2->f->del(p2, "4"); 6170 r = self->f->icEqual(self, p2); 6171 ck_assert(!r); 6172 // empty dict 6173 freeO(p2); 6174 r = self->f->icEqual(self, p2); 6175 ck_assert(!r); 6176 terminateO(p2); 6177 // non smallDict 6178 createAllocateSmallInt(i); 6179 r = self->f->icEqual(self, (smallDictt*)i); 6180 terminateO(i); 6181 ck_assert(!r); 6182 // null 6183 r = self->f->icEqual(self, null); 6184 ck_assert(!r); 6185 terminateO(self); 6186 6187 END_TEST 6188 6189 6190 START_TEST(isEmptySmallDictT) 6191 6192 bool r; 6193 smallDictt *self = allocG(rtSmallDictt); 6194 6195 r = isEmptyO(self); 6196 ck_assert(r); 6197 self->f->setInt(self, "a", 1); 6198 r = isEmptyO(self); 6199 ck_assert(!r); 6200 self->f->del(self, "a"); 6201 r = isEmptyO(self); 6202 ck_assert(r); 6203 terminateO(self); 6204 6205 END_TEST 6206 6207 bool enumerateElement(void *closure, char *key UNUSED, baset *element UNUSED) { 6208 int *c = closure; 6209 (*c)++; 6210 return *c != 2 ? true : false; 6211 } 6212 6213 START_TEST(enumerateSmallDictFT) 6214 6215 smallDictt *self = allocG(rtSmallDictt); 6216 int closure = 0; 6217 6218 self->f->enumerate(self, &closure, enumerateElement); 6219 self->f->setInt(self, "a", 1); 6220 self->f->setInt(self, "b", 2); 6221 self->f->setInt(self, "c", 3); 6222 self->f->del(self, "a"); 6223 self->f->enumerate(self, &closure, enumerateElement); 6224 ck_assert_int_eq(closure, 2); 6225 // baset object in container 6226 closure = -2; 6227 smallIntt *i = allocSmallInt(2); 6228 i->type = "randomClass"; 6229 self->f->set(self, "d", (baset*)i); 6230 i = allocSmallInt(3); 6231 i->type = "randomClass"; 6232 self->f->set(self, "e", (baset*)i); 6233 self->f->enumerate(self, &closure, enumerateElement); 6234 ck_assert_int_eq(closure, 2); 6235 terminateO(self); 6236 6237 END_TEST 6238 6239 6240 START_TEST(iterStartSmallDictT) 6241 6242 baset* r; 6243 smallDictt *self = allocG(rtSmallDictt); 6244 6245 // dict with keys and values 6246 self->f->setInt(self, "a", 1); 6247 self->f->setInt(self, "b", 2); 6248 r = iterStartO(self); 6249 ck_assert_ptr_ne(r, NULL); 6250 ck_assert(isOSmallInt(r)); 6251 // dict with objects from other classes 6252 emptyO(self); 6253 smallIntt *ip = allocSmallInt(2); 6254 ip->type = "anothertype"; 6255 self->f->set(self, "d", (baset*)ip); 6256 r = iterStartO(self); 6257 ck_assert_ptr_ne(r, NULL); 6258 // dict with deleted elements 6259 self->f->setInt(self, "a", 1); 6260 self->f->del(self, "d"); 6261 r = iterStartO(self); 6262 ck_assert_ptr_ne(r, NULL); 6263 // call iterStart again to trigger if (self->iterElementDataType != SH_DT_BASET) finishO(self->iterElement); 6264 r = iterStartO(self); 6265 ck_assert_ptr_ne(r, NULL); 6266 // empty self 6267 emptyO(self); 6268 r = iterStartO(self); 6269 ck_assert_ptr_eq(r, NULL); 6270 terminateO(self); 6271 6272 END_TEST 6273 6274 6275 START_TEST(iterStartKeySmallDictT) 6276 6277 const char* r; 6278 smallDictt *self = allocG(rtSmallDictt); 6279 6280 // dict with keys and values 6281 self->f->setInt(self, "a", 1); 6282 self->f->setInt(self, "b", 2); 6283 r = iterStartKeyO(self); 6284 ck_assert_ptr_ne(r, NULL); 6285 ck_assert_str_eq(r, "a"); 6286 // dict with objects from other classes 6287 emptyO(self); 6288 smallIntt *ip = allocSmallInt(2); 6289 ip->type = "anothertype"; 6290 self->f->set(self, "d", (baset*)ip); 6291 r = iterStartKeyO(self); 6292 ck_assert_ptr_ne(r, NULL); 6293 ck_assert_str_eq(r, "d"); 6294 // dict with deleted elements 6295 self->f->setInt(self, "a", 1); 6296 self->f->del(self, "d"); 6297 r = iterStartKeyO(self); 6298 ck_assert_ptr_ne(r, NULL); 6299 ck_assert_str_eq(r, "a"); 6300 // call iterStart again to trigger if (self->iterElementDataType != SH_DT_BASET) finishO(self->iterElement); 6301 r = iterStartKeyO(self); 6302 ck_assert_ptr_ne(r, NULL); 6303 ck_assert_str_eq(r, "a"); 6304 // empty self 6305 emptyO(self); 6306 r = iterStartKeyO(self); 6307 ck_assert_ptr_eq(r, NULL); 6308 terminateO(self); 6309 6310 END_TEST 6311 6312 6313 START_TEST(iterNextSmallDictT) 6314 6315 baset* r; 6316 smallDictt *self = allocG(rtSmallDictt); 6317 6318 // dict with keys and values 6319 self->f->setInt(self, "a", 1); 6320 self->f->setInt(self, "b", 2); 6321 r = iterStartO(self); 6322 ck_assert_ptr_ne(r, NULL); 6323 ck_assert(isOSmallInt(r)); 6324 smallIntt *i = (smallIntt*)r; 6325 ck_assert_int_eq(getValO(i), 1); 6326 r = iterNextO(self); 6327 ck_assert_ptr_ne(r, NULL); 6328 ck_assert(isOSmallInt(r)); 6329 i = (smallIntt*)r; 6330 ck_assert_int_eq(getValO(i), 2); 6331 // dict with objects from other classes 6332 emptyO(self); 6333 smallIntt *ip = allocSmallInt(2); 6334 ip->type = "anothertype"; 6335 self->f->set(self, "d", (baset*)ip); 6336 self->f->setInt(self, "a", 1); 6337 ip = allocSmallInt(3); 6338 ip->type = "anothertype2"; 6339 self->f->set(self, "e", (baset*)ip); 6340 self->f->setInt(self, "b", 2); 6341 self->f->del(self, "a"); 6342 self->f->del(self, "b"); 6343 r = iterStartO(self); 6344 ck_assert_ptr_ne(r, NULL); 6345 ck_assert(isOType(r, "anothertype")); 6346 r = iterNextO(self); 6347 ck_assert_ptr_ne(r, NULL); 6348 ck_assert(isOType(r, "anothertype2")); 6349 // iteration ended 6350 r = iterNextO(self); 6351 ck_assert_ptr_eq(r, NULL); 6352 // empty self, uninitialized iterator 6353 emptyO(self); 6354 r = iterNextO(self); 6355 ck_assert_ptr_eq(r, NULL); 6356 terminateO(self); 6357 6358 END_TEST 6359 6360 6361 START_TEST(iterNextKeySmallDictT) 6362 6363 const char* r; 6364 smallDictt *self = allocG(rtSmallDictt); 6365 6366 // dict with keys and values 6367 self->f->setInt(self, "a", 1); 6368 self->f->setInt(self, "b", 2); 6369 r = iterStartKeyO(self); 6370 ck_assert_ptr_ne(r, NULL); 6371 ck_assert_str_eq(r, "a"); 6372 r = iterNextKeyO(self); 6373 ck_assert_ptr_ne(r, NULL); 6374 ck_assert_str_eq(r, "b"); 6375 // dict with objects from other classes 6376 emptyO(self); 6377 smallIntt *ip = allocSmallInt(2); 6378 ip->type = "anothertype"; 6379 self->f->set(self, "d", (baset*)ip); 6380 self->f->setInt(self, "a", 1); 6381 ip = allocSmallInt(3); 6382 ip->type = "anothertype2"; 6383 self->f->set(self, "e", (baset*)ip); 6384 self->f->setInt(self, "b", 2); 6385 self->f->del(self, "a"); 6386 self->f->del(self, "b"); 6387 r = iterStartKeyO(self); 6388 ck_assert_ptr_ne(r, NULL); 6389 ck_assert_str_eq(r, "d"); 6390 r = iterNextKeyO(self); 6391 ck_assert_ptr_ne(r, NULL); 6392 ck_assert_str_eq(r, "e"); 6393 // iteration ended 6394 r = iterNextKeyO(self); 6395 ck_assert_ptr_eq(r, NULL); 6396 // empty self 6397 emptyO(self); 6398 r = iterNextKeyO(self); 6399 ck_assert_ptr_eq(r, NULL); 6400 terminateO(self); 6401 6402 END_TEST 6403 6404 6405 START_TEST(iterElementSmallDictT) 6406 6407 baset* r; 6408 smallDictt *self = allocG(rtSmallDictt); 6409 6410 self->f->setInt(self, "a", 1); 6411 r = iterStartO(self); 6412 ck_assert_ptr_ne(r, NULL); 6413 r = iterElementO(self); 6414 ck_assert_ptr_ne(r, NULL); 6415 char *s = toStringO(r); 6416 ck_assert_str_eq(s, "1"); 6417 free(s); 6418 // empty self 6419 freeO(self); 6420 r = iterElementO(self); 6421 ck_assert_ptr_eq(r, NULL); 6422 terminateO(self); 6423 6424 END_TEST 6425 6426 6427 START_TEST(iterKeySmallDictT) 6428 6429 const char* r; 6430 smallDictt *self = allocG(rtSmallDictt); 6431 6432 self->f->setInt(self, "a", 1); 6433 baset *r2 = iterStartO(self); 6434 ck_assert_ptr_ne(r2, NULL); 6435 r = iterKeyO(self); 6436 ck_assert_ptr_ne(r, NULL); 6437 ck_assert_str_eq(r, "a"); 6438 // empty self 6439 freeO(self); 6440 r = iterKeyO(self); 6441 ck_assert_ptr_eq(r, NULL); 6442 terminateO(self); 6443 6444 END_TEST 6445 6446 6447 START_TEST(zipSmallDictT) 6448 6449 smallDictt* r; 6450 smallDictt *self = allocG(rtSmallDictt); 6451 smallArrayt *keys = allocSmallArray(); 6452 smallArrayt *values = allocSmallArray(); 6453 6454 self->f->setInt(self, "", 1); 6455 // 3 elements in keys 6456 // 2 elements in values 6457 // only 2 key/values are zipped 6458 keys->f->pushS(keys, "a"); 6459 keys->f->pushS(keys, "b"); 6460 keys->f->pushS(keys, "c"); 6461 values->f->pushInt(values, 1); 6462 values->f->pushInt(values, 2); 6463 r = zipO(self, keys, values); 6464 terminateO(keys); 6465 smashO(values); 6466 ck_assert_ptr_ne(r, NULL); 6467 char *s = toStringO(r); 6468 ck_assert_str_eq(s, "{\"\":1,\"a\":1,\"b\":2}"); 6469 free(s); 6470 // keys array with non string objects 6471 keys = allocSmallArray(); 6472 values = allocSmallArray(); 6473 keys->f->pushInt(keys, 1); 6474 values->f->pushInt(values, 1); 6475 r = zipO(self, keys, values); 6476 ck_assert_ptr_eq(r, NULL); 6477 terminateO(keys); 6478 terminateO(values); 6479 // empty values 6480 keys = allocSmallArray(); 6481 values = allocSmallArray(); 6482 keys->f->pushInt(keys, 1); 6483 r = zipO(self, keys, values); 6484 ck_assert_ptr_eq(r, self); 6485 terminateO(keys); 6486 // non smallArray object 6487 keys = (smallArrayt*) allocSmallInt(1); 6488 r = zipO(self, keys, values); 6489 ck_assert_ptr_eq(r, null); 6490 terminateO(keys); 6491 keys = allocSmallArray(); 6492 terminateO(values); 6493 values = (smallArrayt*) allocSmallInt(2); 6494 r = zipO(self, keys, values); 6495 ck_assert_ptr_eq(r, null); 6496 // null 6497 r = zipO(self, null, values); 6498 ck_assert_ptr_eq(r, null); 6499 r = zipO(self, keys, null); 6500 ck_assert_ptr_eq(r, null); 6501 terminateO(keys); 6502 terminateO(values); 6503 terminateO(self); 6504 6505 END_TEST 6506 6507 6508 START_TEST(zipSmallJsonSmallDictT) 6509 6510 smallDictt* r; 6511 smallDictt *self = allocG(rtSmallDictt); 6512 smallArrayt *keys = allocSmallArray(); 6513 smallJsont *values = allocSmallJson(); 6514 6515 self->f->setInt(self, "", 1); 6516 // 3 elements in keys 6517 // 2 elements in values 6518 // only 2 key/values are zipped 6519 keys->f->pushS(keys, "a"); 6520 keys->f->pushS(keys, "b"); 6521 keys->f->pushS(keys, "c"); 6522 values->f->pushInt(values, 1); 6523 values->f->pushInt(values, 2); 6524 r = self->f->zipSmallJson(self, keys, values); 6525 terminateO(keys); 6526 smashO(values); 6527 ck_assert_ptr_ne(r, NULL); 6528 char *s = toStringO(r); 6529 ck_assert_str_eq(s, "{\"\":1,\"a\":1,\"b\":2}"); 6530 free(s); 6531 // keys array with non string objects 6532 keys = allocSmallArray(); 6533 values = allocSmallJson(); 6534 keys->f->pushInt(keys, 1); 6535 values->f->pushInt(values, 1); 6536 r = self->f->zipSmallJson(self, keys, values); 6537 ck_assert_ptr_eq(r, NULL); 6538 terminateO(keys); 6539 terminateO(values); 6540 // empty values 6541 keys = allocSmallArray(); 6542 values = allocSmallJson(); 6543 keys->f->pushInt(keys, 1); 6544 values->f->pushInt(values, 1); 6545 delElemIndexO(values, 0); 6546 trimO(values); 6547 r = self->f->zipSmallJson(self, keys, values); 6548 ck_assert_ptr_eq(r, self); 6549 terminateO(keys); 6550 // non smallArray object 6551 keys = (smallArrayt*) allocSmallInt(1); 6552 r = self->f->zipSmallJson(self, keys, values); 6553 ck_assert_ptr_eq(r, null); 6554 terminateO(keys); 6555 keys = allocSmallArray(); 6556 terminateO(values); 6557 // non json array 6558 values = allocSmallJson(); 6559 setTopIntO(values, 1); 6560 r = self->f->zipSmallJson(self, keys, values); 6561 ck_assert_ptr_eq(r, null); 6562 terminateO(values); 6563 // non smallJson values 6564 values = (smallJsont*) allocSmallInt(2); 6565 r = self->f->zipSmallJson(self, keys, values); 6566 ck_assert_ptr_eq(r, null); 6567 // null 6568 r = self->f->zipSmallJson(self, null, values); 6569 ck_assert_ptr_eq(r, null); 6570 r = self->f->zipSmallJson(self, keys, null); 6571 ck_assert_ptr_eq(r, null); 6572 terminateO(keys); 6573 terminateO(values); 6574 terminateO(self); 6575 6576 END_TEST 6577 6578 6579 START_TEST(zipSmallJsonSmallArraySmallDictT) 6580 6581 smallDictt* r; 6582 smallDictt *self = allocG(rtSmallDictt); 6583 smallJsont *keys = allocSmallJson(); 6584 smallArrayt *values = allocSmallArray(); 6585 6586 self->f->setInt(self, "", 1); 6587 // 3 elements in keys 6588 // 2 elements in values 6589 // only 2 key/values are zipped 6590 keys->f->pushS(keys, "a"); 6591 keys->f->pushS(keys, "b"); 6592 keys->f->pushS(keys, "c"); 6593 values->f->pushInt(values, 1); 6594 values->f->pushInt(values, 2); 6595 r = self->f->zipSmallJsonSmallArray(self, keys, values); 6596 terminateO(keys); 6597 smashO(values); 6598 ck_assert_ptr_ne(r, NULL); 6599 char *s = toStringO(r); 6600 ck_assert_str_eq(s, "{\"\":1,\"a\":1,\"b\":2}"); 6601 free(s); 6602 // keys array with non string objects 6603 keys = allocSmallJson(); 6604 values = allocSmallArray(); 6605 keys->f->pushInt(keys, 1); 6606 values->f->pushInt(values, 1); 6607 r = self->f->zipSmallJsonSmallArray(self, keys, values); 6608 ck_assert_ptr_eq(r, NULL); 6609 terminateO(keys); 6610 terminateO(values); 6611 // empty values 6612 keys = allocSmallJson(); 6613 values = allocSmallArray(); 6614 keys->f->pushInt(keys, 1); 6615 r = self->f->zipSmallJsonSmallArray(self, keys, values); 6616 ck_assert_ptr_eq(r, self); 6617 terminateO(keys); 6618 // non json array keys 6619 keys = allocSmallJson(); 6620 setTopIntO(keys, 1); 6621 r = self->f->zipSmallJsonSmallArray(self, keys, values); 6622 ck_assert_ptr_eq(r, null); 6623 terminateO(keys); 6624 // non smallArray object 6625 keys = (smallJsont*) allocSmallInt(1); 6626 r = self->f->zipSmallJsonSmallArray(self, keys, values); 6627 ck_assert_ptr_eq(r, null); 6628 terminateO(keys); 6629 keys = allocSmallJson(); 6630 terminateO(values); 6631 values = (smallArrayt*) allocSmallInt(2); 6632 r = self->f->zipSmallJsonSmallArray(self, keys, values); 6633 ck_assert_ptr_eq(r, null); 6634 // null 6635 r = self->f->zipSmallJsonSmallArray(self, null, values); 6636 ck_assert_ptr_eq(r, null); 6637 r = self->f->zipSmallJsonSmallArray(self, keys, null); 6638 ck_assert_ptr_eq(r, null); 6639 terminateO(keys); 6640 terminateO(values); 6641 terminateO(self); 6642 6643 END_TEST 6644 6645 6646 START_TEST(zipSmallJsonSmallJsonSmallDictT) 6647 6648 smallDictt* r; 6649 smallDictt *self = allocG(rtSmallDictt); 6650 smallJsont *keys = allocSmallJson(); 6651 smallJsont *values = allocSmallJson(); 6652 6653 self->f->setInt(self, "", 1); 6654 // 3 elements in keys 6655 // 2 elements in values 6656 // only 2 key/values are zipped 6657 keys->f->pushS(keys, "a"); 6658 keys->f->pushS(keys, "b"); 6659 keys->f->pushS(keys, "c"); 6660 values->f->pushInt(values, 1); 6661 values->f->pushInt(values, 2); 6662 r = zipSmallJsonSmallJsonO(self, keys, values); 6663 terminateO(keys); 6664 smashO(values); 6665 ck_assert_ptr_ne(r, NULL); 6666 char *s = toStringO(r); 6667 ck_assert_str_eq(s, "{\"\":1,\"a\":1,\"b\":2}"); 6668 free(s); 6669 // keys array with non string objects 6670 keys = allocSmallJson(); 6671 values = allocSmallJson(); 6672 keys->f->pushInt(keys, 1); 6673 values->f->pushInt(values, 1); 6674 r = zipSmallJsonSmallJsonO(self, keys, values); 6675 ck_assert_ptr_eq(r, NULL); 6676 terminateO(keys); 6677 terminateO(values); 6678 // empty values 6679 keys = allocSmallJson(); 6680 values = allocSmallJson(); 6681 keys->f->pushInt(keys, 1); 6682 values->f->pushInt(values, 1); 6683 delElemIndexO(values, 0); 6684 trimO(values); 6685 r = zipSmallJsonSmallJsonO(self, keys, values); 6686 ck_assert_ptr_eq(r, self); 6687 terminateO(keys); 6688 // non json array keys 6689 keys = allocSmallJson(); 6690 setTopIntO(keys, 1); 6691 r = zipSmallJsonSmallJsonO(self, keys, values); 6692 ck_assert_ptr_eq(r, null); 6693 terminateO(keys); 6694 // non json array values 6695 keys = allocSmallJson(); 6696 keys->f->pushInt(keys, 1); 6697 freeO(values); 6698 setTopIntO(values, 1); 6699 r = zipSmallJsonSmallJsonO(self, keys, values); 6700 ck_assert_ptr_eq(r, null); 6701 terminateO(keys); 6702 terminateO(values); 6703 // non smallJson object 6704 keys = (smallJsont*) allocSmallInt(1); 6705 values = allocSmallJson(); 6706 r = zipSmallJsonSmallJsonO(self, keys, values); 6707 ck_assert_ptr_eq(r, null); 6708 terminateO(keys); 6709 keys = allocSmallJson(); 6710 terminateO(values); 6711 values = (smallJsont*) allocSmallInt(2); 6712 r = zipSmallJsonSmallJsonO(self, keys, values); 6713 ck_assert_ptr_eq(r, null); 6714 // null 6715 r = zipSmallJsonSmallJsonO(self, null, values); 6716 ck_assert_ptr_eq(r, null); 6717 r = zipSmallJsonSmallJsonO(self, keys, null); 6718 ck_assert_ptr_eq(r, null); 6719 terminateO(keys); 6720 terminateO(values); 6721 terminateO(self); 6722 6723 END_TEST 6724 6725 6726 START_TEST(zipSmallJsonVArraySmallDictT) 6727 6728 smallDictt* r; 6729 smallDictt *self = allocG(rtSmallDictt); 6730 smallJsont *keys = allocSmallJson(); 6731 char** values; 6732 6733 self->f->setInt(self, "", 1); 6734 // 3 elements in keys 6735 // 2 elements in values 6736 // only 2 key/values are zipped 6737 keys->f->pushS(keys, "a"); 6738 keys->f->pushS(keys, "b"); 6739 keys->f->pushS(keys, "c"); 6740 values = listCreateS("1", "2"); 6741 r = zipSmallJsonVArrayO(self, keys, values); 6742 terminateO(keys); 6743 listFreeS(values); 6744 ck_assert_ptr_ne(r, NULL); 6745 char *s = toStringO(r); 6746 ck_assert_str_eq(s, "{\"\":1,\"a\":\"1\",\"b\":\"2\"}"); 6747 free(s); 6748 // keys array with non string objects 6749 keys = allocSmallJson(); 6750 keys->f->pushInt(keys, 1); 6751 values = listCreateS("1"); 6752 r = zipSmallJsonVArrayO(self, keys, values); 6753 ck_assert_ptr_eq(r, NULL); 6754 terminateO(keys); 6755 listFreeS(values); 6756 // empty values 6757 keys = allocSmallJson(); 6758 keys->f->pushInt(keys, 1); 6759 listEmptyS(values); 6760 r = zipSmallJsonVArrayO(self, keys, values); 6761 ck_assert_ptr_eq(r, self); 6762 terminateO(keys); 6763 // non json array keys 6764 keys = allocSmallJson(); 6765 setTopIntO(keys, 1); 6766 r = zipSmallJsonVArrayO(self, keys, values); 6767 ck_assert_ptr_eq(r, null); 6768 terminateO(keys); 6769 // non smallArray object 6770 keys = (smallJsont*) allocSmallInt(1); 6771 r = zipSmallJsonVArrayO(self, keys, values); 6772 ck_assert_ptr_eq(r, null); 6773 terminateO(keys); 6774 keys = allocSmallJson(); 6775 // null 6776 r = zipSmallJsonVArrayO(self, null, values); 6777 ck_assert_ptr_eq(r, null); 6778 r = zipSmallJsonVArrayO(self, keys, null); 6779 ck_assert_ptr_eq(r, null); 6780 terminateO(keys); 6781 listFreeS(values); 6782 terminateO(self); 6783 6784 END_TEST 6785 6786 6787 START_TEST(zipArraySmallDictT) 6788 6789 smallDictt* r; 6790 smallDictt *self = allocG(rtSmallDictt); 6791 char** keys; 6792 smallArrayt *values = allocSmallArray(); 6793 6794 self->f->setInt(self, "", 1); 6795 // 3 elements in keys 6796 // 2 elements in values 6797 // only 2 key/values are zipped 6798 keys = listCreateS("a", "b", "c"); 6799 values->f->pushInt(values, 1); 6800 values->f->pushInt(values, 2); 6801 r = zipArrayO(self, keys, values); 6802 listFreeS(keys); 6803 smashO(values); 6804 ck_assert_ptr_ne(r, NULL); 6805 char *s = toStringO(r); 6806 ck_assert_str_eq(s, "{\"\":1,\"a\":1,\"b\":2}"); 6807 free(s); 6808 // empty values 6809 keys = listCreateS("a"); 6810 values = allocSmallArray(); 6811 r = zipArrayO(self, keys, values); 6812 ck_assert_ptr_eq(r, self); 6813 // non smallArray object 6814 terminateO(values); 6815 values = (smallArrayt*) allocSmallInt(2); 6816 r = zipArrayO(self, keys, values); 6817 ck_assert_ptr_eq(r, null); 6818 // null 6819 r = zipArrayO(self, null, values); 6820 ck_assert_ptr_eq(r, null); 6821 r = zipArrayO(self, keys, null); 6822 ck_assert_ptr_eq(r, null); 6823 listFreeS(keys); 6824 terminateO(values); 6825 terminateO(self); 6826 6827 END_TEST 6828 6829 6830 START_TEST(zipArraySmallJsonSmallDictT) 6831 6832 smallDictt* r; 6833 smallDictt *self = allocG(rtSmallDictt); 6834 char** keys; 6835 smallJsont *values = allocSmallJson(); 6836 6837 self->f->setInt(self, "", 1); 6838 // 3 elements in keys 6839 // 2 elements in values 6840 // only 2 key/values are zipped 6841 keys = listCreateS("a", "b", "c"); 6842 values->f->pushInt(values, 1); 6843 values->f->pushInt(values, 2); 6844 r = self->f->zipArraySmallJson(self, keys, values); 6845 listFreeS(keys); 6846 smashO(values); 6847 ck_assert_ptr_ne(r, NULL); 6848 char *s = toStringO(r); 6849 ck_assert_str_eq(s, "{\"\":1,\"a\":1,\"b\":2}"); 6850 free(s); 6851 // empty values 6852 keys = listCreateS("a"); 6853 values = allocSmallJson(); 6854 values->f->pushInt(values, 1); 6855 delElemIndexO(values, 0); 6856 trimO(values); 6857 r = self->f->zipArraySmallJson(self, keys, values); 6858 ck_assert_ptr_eq(r, self); 6859 terminateO(values); 6860 // non json array 6861 values = allocSmallJson(); 6862 setTopIntO(values, 1); 6863 r = self->f->zipArraySmallJson(self, keys, values); 6864 ck_assert_ptr_eq(r, null); 6865 terminateO(values); 6866 // non smallJson values 6867 values = (smallJsont*) allocSmallInt(2); 6868 r = self->f->zipArraySmallJson(self, keys, values); 6869 ck_assert_ptr_eq(r, null); 6870 // null 6871 r = self->f->zipArraySmallJson(self, null, values); 6872 ck_assert_ptr_eq(r, null); 6873 r = self->f->zipArraySmallJson(self, keys, null); 6874 ck_assert_ptr_eq(r, null); 6875 listFreeS(keys); 6876 terminateO(values); 6877 terminateO(self); 6878 6879 END_TEST 6880 6881 6882 START_TEST(zipArrayArraySmallDictT) 6883 6884 smallDictt* r; 6885 smallDictt *self = allocG(rtSmallDictt); 6886 char** keys; 6887 char** values; 6888 6889 self->f->setInt(self, "", 1); 6890 // 3 elements in keys 6891 // 2 elements in values 6892 // only 2 key/values are zipped 6893 keys = listCreateS("a", "b", "c"); 6894 values = listCreateS("1", "2"); 6895 r = zipArrayArrayO(self, keys, values); 6896 listFreeS(keys); 6897 listFreeS(values); 6898 ck_assert_ptr_ne(r, NULL); 6899 char *s = toStringO(r); 6900 ck_assert_str_eq(s, "{\"\":1,\"a\":\"1\",\"b\":\"2\"}"); 6901 free(s); 6902 // empty values 6903 keys = listCreateS("a"); 6904 listEmptyS(values); 6905 r = zipArrayArrayO(self, keys, values); 6906 ck_assert_ptr_eq(r, self); 6907 // null 6908 r = zipArrayArrayO(self, null, values); 6909 ck_assert_ptr_eq(r, null); 6910 r = zipArrayArrayO(self, keys, null); 6911 ck_assert_ptr_eq(r, null); 6912 listFreeS(keys); 6913 listFreeS(values); 6914 terminateO(self); 6915 6916 END_TEST 6917 6918 6919 START_TEST(zipVArraySmallDictT) 6920 6921 smallDictt* r; 6922 smallDictt *self = allocG(rtSmallDictt); 6923 smallArrayt *keys = allocSmallArray(); 6924 char** values; 6925 6926 self->f->setInt(self, "", 1); 6927 // 3 elements in keys 6928 // 2 elements in values 6929 // only 2 key/values are zipped 6930 keys->f->pushS(keys, "a"); 6931 keys->f->pushS(keys, "b"); 6932 keys->f->pushS(keys, "c"); 6933 values = listCreateS("1", "2"); 6934 r = zipVArrayO(self, keys, values); 6935 terminateO(keys); 6936 listFreeS(values); 6937 ck_assert_ptr_ne(r, NULL); 6938 char *s = toStringO(r); 6939 ck_assert_str_eq(s, "{\"\":1,\"a\":\"1\",\"b\":\"2\"}"); 6940 free(s); 6941 // keys array with non string objects 6942 keys = allocSmallArray(); 6943 keys->f->pushInt(keys, 1); 6944 values = listCreateS("1"); 6945 r = zipVArrayO(self, keys, values); 6946 ck_assert_ptr_eq(r, NULL); 6947 terminateO(keys); 6948 listFreeS(values); 6949 // empty values 6950 keys = allocSmallArray(); 6951 keys->f->pushInt(keys, 1); 6952 listEmptyS(values); 6953 r = zipVArrayO(self, keys, values); 6954 ck_assert_ptr_eq(r, self); 6955 terminateO(keys); 6956 // non smallArray object 6957 keys = (smallArrayt*) allocSmallInt(1); 6958 r = zipVArrayO(self, keys, values); 6959 ck_assert_ptr_eq(r, null); 6960 terminateO(keys); 6961 keys = allocSmallArray(); 6962 // null 6963 r = zipVArrayO(self, null, values); 6964 ck_assert_ptr_eq(r, null); 6965 r = zipVArrayO(self, keys, null); 6966 ck_assert_ptr_eq(r, null); 6967 terminateO(keys); 6968 listFreeS(values); 6969 terminateO(self); 6970 6971 END_TEST 6972 6973 6974 START_TEST(fromArraySmallDictT) 6975 6976 smallDictt* r; 6977 smallDictt *self = allocG(rtSmallDictt); 6978 smallArrayt *items = allocSmallArray(); 6979 6980 self->f->setInt(self, "", 1); 6981 // ignored item 6982 items->f->pushS(items, "ignored"); 6983 createAllocateSmallArray(a); 6984 a->f->pushS(a, "a"); 6985 a->f->pushInt(a, 1); 6986 items->f->pushNFreeArray(items, a); 6987 a = allocSmallArray(); 6988 items->f->pushNFreeArray(items, a); 6989 a = allocSmallArray(); 6990 a->f->pushInt(a, 1); 6991 a->f->pushInt(a, 2); 6992 items->f->pushNFreeArray(items, a); 6993 r = self->f->fromArray(self, items); 6994 ck_assert_ptr_ne(r, NULL); 6995 char *s = toStringO(r); 6996 ck_assert_str_eq(s, "{\"\":1,\"a\":1}"); 6997 free(s); 6998 terminateO(items); 6999 // non smallArray items 7000 items = (smallArrayt*) allocSmallInt(2); 7001 r = self->f->fromArray(self, items); 7002 ck_assert_ptr_eq(r, NULL); 7003 // null items 7004 r = self->f->fromArray(self, null); 7005 ck_assert_ptr_eq(r, NULL); 7006 terminateO(items); 7007 terminateO(self); 7008 7009 END_TEST 7010 7011 7012 START_TEST(toArraySmallDictT) 7013 7014 smallArrayt* r; 7015 smallDictt *self = allocG(rtSmallDictt); 7016 7017 self->f->setInt(self, "", 1); 7018 self->f->setInt(self, "b", 2); 7019 self->f->setInt(self, "c", 3); 7020 self->f->del(self, ""); 7021 r = toArrayO(self); 7022 ck_assert_ptr_ne(r, NULL); 7023 char *s = toStringO(r); 7024 ck_assert_str_eq(s, "[[\"b\",2],[\"c\",3]]"); 7025 free(s); 7026 terminateO(r); 7027 disposeO(self); 7028 // empty dict 7029 r = toArrayO(self); 7030 ck_assert_ptr_eq(r, NULL); 7031 terminateO(self); 7032 7033 END_TEST 7034 7035 7036 START_TEST(writeFileSmallDictT) 7037 7038 bool r; 7039 smallDictt *self = allocG(rtSmallDictt); 7040 7041 self->f->setInt(self, "", 1); 7042 self->f->setInt(self, "b", 2); 7043 r = writeFileO(self, "smallDictFile.json"); 7044 ck_assert(r); 7045 ck_assert(fileExists("smallDictFile.json")); 7046 char *s = readFileToS("smallDictFile.json"); 7047 ck_assert_str_eq(s, "{\"\":1,\"b\":2}"); 7048 free(s); 7049 rmAll("smallDictFile.json"); 7050 // blank file path 7051 r = writeFileO(self, " "); 7052 ck_assert(!r); 7053 // null file path 7054 r = writeFileO(self, null); 7055 ck_assert(!r); 7056 terminateO(self); 7057 7058 END_TEST 7059 7060 7061 START_TEST(writeFileSmallJsonSmallDictT) 7062 7063 bool r; 7064 smallDictt *self = allocG(rtSmallDictt); 7065 smallJsont *filePath = allocSmallJson(); 7066 7067 self->f->setInt(self, "", 1); 7068 self->f->setInt(self, "b", 2); 7069 setTopSO(filePath, "smallDictFile.json"); 7070 r = self->f->writeFileSmallJson(self, filePath); 7071 ck_assert(r); 7072 ck_assert(fileExists("smallDictFile.json")); 7073 char *s = readFileToS("smallDictFile.json"); 7074 ck_assert_str_eq(s, "{\"\":1,\"b\":2}"); 7075 free(s); 7076 rmAll("smallDictFile.json"); 7077 // blank path 7078 freeO(filePath); 7079 setTopSO(filePath, " "); 7080 r = self->f->writeFileSmallJson(self, filePath); 7081 ck_assert(!r); 7082 // non json string 7083 freeO(filePath); 7084 setTopIntO(filePath, 2); 7085 r = self->f->writeFileSmallJson(self, filePath); 7086 ck_assert(!r); 7087 // non json object 7088 terminateO(filePath); 7089 filePath = (smallJsont*) allocSmallInt(2); 7090 r = self->f->writeFileSmallJson(self, filePath); 7091 ck_assert(!r); 7092 // null path 7093 r = self->f->writeFileSmallJson(self, null); 7094 ck_assert(!r); 7095 terminateO(filePath); 7096 terminateO(self); 7097 7098 END_TEST 7099 7100 7101 START_TEST(writeFileSmallStringSmallDictT) 7102 7103 bool r; 7104 smallDictt *self = allocG(rtSmallDictt); 7105 smallStringt *filePath = allocSmallString("smallDictFile.json"); 7106 7107 self->f->setInt(self, "", 1); 7108 self->f->setInt(self, "b", 2); 7109 r = self->f->writeFileSmallString(self, filePath); 7110 ck_assert(r); 7111 ck_assert(fileExists("smallDictFile.json")); 7112 char *s = readFileToS("smallDictFile.json"); 7113 ck_assert_str_eq(s, "{\"\":1,\"b\":2}"); 7114 free(s); 7115 rmAll("smallDictFile.json"); 7116 // blank path 7117 setValO(filePath, " "); 7118 r = self->f->writeFileSmallString(self, filePath); 7119 ck_assert(!r); 7120 // non smallString object 7121 terminateO(filePath); 7122 filePath = (smallStringt*) allocSmallInt(2); 7123 r = self->f->writeFileSmallString(self, filePath); 7124 ck_assert(!r); 7125 // null path 7126 r = self->f->writeFileSmallString(self, null); 7127 ck_assert(!r); 7128 terminateO(filePath); 7129 terminateO(self); 7130 7131 END_TEST 7132 7133 7134 START_TEST(writeStreamSmallDictT) 7135 7136 bool r; 7137 smallDictt *self = allocG(rtSmallDictt); 7138 FILE *fp; 7139 7140 self->f->setInt(self, "", 1); 7141 self->f->setInt(self, "b", 2); 7142 fp = fopen("smallDictFile.json", "w"); 7143 r = writeStreamO(self, fp); 7144 ck_assert(r); 7145 fclose(fp); 7146 ck_assert(fileExists("smallDictFile.json")); 7147 char *s = readFileToS("smallDictFile.json"); 7148 ck_assert_str_eq(s, "{\"\":1,\"b\":2}"); 7149 free(s); 7150 rmAll("smallDictFile.json"); 7151 // null file pointer 7152 r = writeStreamO(self, null); 7153 ck_assert(!r); 7154 terminateO(self); 7155 7156 END_TEST 7157 7158 7159 START_TEST(appendFileSmallDictT) 7160 7161 bool r; 7162 smallDictt *self = allocG(rtSmallDictt); 7163 7164 self->f->setInt(self, "", 1); 7165 self->f->setInt(self, "b", 2); 7166 writeFileS("smallDictFile.json", "-"); 7167 r = appendFileO(self, "smallDictFile.json"); 7168 ck_assert(r); 7169 ck_assert(fileExists("smallDictFile.json")); 7170 char *s = readFileToS("smallDictFile.json"); 7171 ck_assert_str_eq(s, "-{\"\":1,\"b\":2}"); 7172 free(s); 7173 rmAll("smallDictFile.json"); 7174 // blank file path 7175 r = appendFileO(self, " "); 7176 ck_assert(!r); 7177 // null file path 7178 r = appendFileO(self, null); 7179 ck_assert(!r); 7180 terminateO(self); 7181 7182 END_TEST 7183 7184 7185 START_TEST(appendFileSmallStringSmallDictT) 7186 7187 bool r; 7188 smallDictt *self = allocG(rtSmallDictt); 7189 smallStringt *filePath = allocSmallString("smallDictFile.json"); 7190 7191 self->f->setInt(self, "", 1); 7192 self->f->setInt(self, "b", 2); 7193 writeFileS("smallDictFile.json", "-"); 7194 r = self->f->appendFileSmallString(self, filePath); 7195 ck_assert(r); 7196 ck_assert(fileExists("smallDictFile.json")); 7197 char *s = readFileToS("smallDictFile.json"); 7198 ck_assert_str_eq(s, "-{\"\":1,\"b\":2}"); 7199 free(s); 7200 rmAll("smallDictFile.json"); 7201 // blank path 7202 setValO(filePath, " "); 7203 r = self->f->appendFileSmallString(self, filePath); 7204 ck_assert(!r); 7205 // non smallString object 7206 terminateO(filePath); 7207 filePath = (smallStringt*) allocSmallInt(2); 7208 r = self->f->appendFileSmallString(self, filePath); 7209 ck_assert(!r); 7210 // null path 7211 r = self->f->appendFileSmallString(self, null); 7212 ck_assert(!r); 7213 terminateO(filePath); 7214 terminateO(self); 7215 7216 END_TEST 7217 7218 7219 START_TEST(logSmallDictT) 7220 7221 smallDictt *self = allocG(rtSmallDictt); 7222 7223 self->f->setInt(self, "", 1); 7224 self->f->setInt(self, "b", 2); 7225 logO(self); 7226 // empty self 7227 freeO(self); 7228 logO(self); 7229 terminateO(self); 7230 7231 END_TEST 7232 7233 7234 START_TEST(typeSmallStringSmallDictT) 7235 7236 smallStringt* r; 7237 smallDictt *self = allocG(rtSmallDictt); 7238 7239 self->f->setInt(self, "", 1); 7240 self->f->setInt(self, "b", 2); 7241 r = typeSmallStringO(self, ""); 7242 ck_assert_str_eq(ssGet(r), "int"); 7243 terminateO(r); 7244 // non existing key 7245 r = typeSmallStringO(self, "asd"); 7246 ck_assert_ptr_eq(r, null); 7247 terminateO(self); 7248 7249 END_TEST 7250 7251 7252 START_TEST(typeStringKCharSmallDictT) 7253 7254 const char* r; 7255 smallDictt *self = allocG(rtSmallDictt); 7256 7257 self->f->setInt(self, "", 1); 7258 self->f->setInt(self, "b", 2); 7259 r = typeStringKCharO(self, 'b'); 7260 ck_assert_str_eq(r, "int"); 7261 terminateO(self); 7262 7263 END_TEST 7264 7265 7266 START_TEST(typeSmallStringKCharSmallDictT) 7267 7268 smallStringt* r; 7269 smallDictt *self = allocG(rtSmallDictt); 7270 7271 self->f->setInt(self, "", 1); 7272 self->f->setInt(self, "b", 2); 7273 r = typeSmallStringKCharO(self, 'b'); 7274 ck_assert_str_eq(ssGet(r), "int"); 7275 terminateO(r); 7276 // non existing key 7277 r = typeSmallStringKCharO(self, 'a'); 7278 ck_assert_ptr_eq(r, null); 7279 terminateO(self); 7280 7281 END_TEST 7282 7283 7284 START_TEST(typeKCharSmallDictT) 7285 7286 char r; 7287 smallDictt *self = allocG(rtSmallDictt); 7288 7289 self->f->setInt(self, "", 1); 7290 self->f->setInt(self, "b", 2); 7291 r = typeKCharO(self, 'b'); 7292 ck_assert_int_eq(r, 7); 7293 terminateO(self); 7294 7295 END_TEST 7296 7297 7298 START_TEST(isETypeSmallDictT) 7299 7300 bool r; 7301 smallDictt *self = allocG(rtSmallDictt); 7302 7303 self->f->setInt(self, "", 1); 7304 r = isETypeO(self, "", "int"); 7305 ck_assert(r); 7306 // null type 7307 r = isETypeO(self, "", null); 7308 ck_assert(!r); 7309 // null key 7310 r = isETypeO(self, null, "int"); 7311 ck_assert(!r); 7312 // empty dict 7313 freeO(self); 7314 r = isETypeO(self, "", "int"); 7315 ck_assert(!r); 7316 terminateO(self); 7317 7318 END_TEST 7319 7320 7321 START_TEST(isEUndefinedSmallDictT) 7322 7323 bool r; 7324 smallDictt *self = allocG(rtSmallDictt); 7325 7326 self->f->setInt(self, "", 1); 7327 self->f->setUndefined(self, "b"); 7328 r = isEUndefinedO(self, "b"); 7329 ck_assert(r); 7330 r = isEUndefinedO(self, ""); 7331 ck_assert(!r); 7332 // non existing key 7333 r = isEUndefinedO(self, "qwe"); 7334 ck_assert(!r); 7335 // empty dict 7336 freeO(self); 7337 r = isEUndefinedO(self, ""); 7338 ck_assert(!r); 7339 terminateO(self); 7340 7341 END_TEST 7342 7343 7344 START_TEST(isEBoolSmallDictT) 7345 7346 bool r; 7347 smallDictt *self = allocG(rtSmallDictt); 7348 7349 self->f->setInt(self, "", 1); 7350 self->f->setBool(self, "b", true); 7351 r = isEBoolO(self, "b"); 7352 ck_assert(r); 7353 r = isEBoolO(self, ""); 7354 ck_assert(!r); 7355 // non existing key 7356 r = isEBoolO(self, "qwe"); 7357 ck_assert(!r); 7358 // empty dict 7359 freeO(self); 7360 r = isEBoolO(self, ""); 7361 ck_assert(!r); 7362 terminateO(self); 7363 7364 END_TEST 7365 7366 7367 START_TEST(isEContainerSmallDictT) 7368 7369 bool r; 7370 smallDictt *self = allocG(rtSmallDictt); 7371 7372 createSmallContainer(c); 7373 self->f->setInt(self, "", 1); 7374 self->f->setBool(self, "b", true); 7375 self->f->setSmallContainer(self, "c", &c); 7376 r = isEContainerO(self, "c"); 7377 ck_assert(r); 7378 r = isEContainerO(self, "b"); 7379 ck_assert(!r); 7380 // non existing key 7381 r = isEContainerO(self, "qwe"); 7382 ck_assert(!r); 7383 // empty dict 7384 freeO(self); 7385 r = isEContainerO(self, ""); 7386 ck_assert(!r); 7387 terminateO(self); 7388 7389 END_TEST 7390 7391 7392 START_TEST(isEDictSmallDictT) 7393 7394 bool r; 7395 smallDictt *self = allocG(rtSmallDictt); 7396 7397 self->f->setInt(self, "", 1); 7398 createSmallDict(d); 7399 self->f->setDict(self, "b", &d); 7400 r = isEDictO(self, "b"); 7401 ck_assert(r); 7402 r = isEDictO(self, ""); 7403 ck_assert(!r); 7404 // non existing key 7405 r = isEDictO(self, "qwe"); 7406 ck_assert(!r); 7407 // empty dict 7408 freeO(self); 7409 r = isEDictO(self, ""); 7410 ck_assert(!r); 7411 terminateO(self); 7412 7413 END_TEST 7414 7415 7416 START_TEST(isEDoubleSmallDictT) 7417 7418 bool r; 7419 smallDictt *self = allocG(rtSmallDictt); 7420 7421 self->f->setInt(self, "", 1); 7422 self->f->setDouble(self, "b", 2.2); 7423 r = isEDoubleO(self, "b"); 7424 ck_assert(r); 7425 r = isEDoubleO(self, ""); 7426 ck_assert(!r); 7427 // non existing key 7428 r = isEDoubleO(self, "qwe"); 7429 ck_assert(!r); 7430 // empty dict 7431 freeO(self); 7432 r = isEDoubleO(self, ""); 7433 ck_assert(!r); 7434 terminateO(self); 7435 7436 END_TEST 7437 7438 7439 START_TEST(isEIntSmallDictT) 7440 7441 bool r; 7442 smallDictt *self = allocG(rtSmallDictt); 7443 7444 self->f->setBool(self, "", true); 7445 self->f->setInt(self, "b", 2); 7446 r = isEIntO(self, "b"); 7447 ck_assert(r); 7448 r = isEIntO(self, ""); 7449 ck_assert(!r); 7450 // non existing key 7451 r = isEIntO(self, "qwe"); 7452 ck_assert(!r); 7453 // empty dict 7454 freeO(self); 7455 r = isEIntO(self, ""); 7456 ck_assert(!r); 7457 terminateO(self); 7458 7459 END_TEST 7460 7461 7462 START_TEST(isEStringSmallDictT) 7463 7464 bool r; 7465 smallDictt *self = allocG(rtSmallDictt); 7466 7467 self->f->setInt(self, "", 1); 7468 self->f->setS(self, "b", "!@#"); 7469 r = isEStringO(self, "b"); 7470 ck_assert(r); 7471 r = isEStringO(self, ""); 7472 ck_assert(!r); 7473 // non existing key 7474 r = isEStringO(self, "qwe"); 7475 ck_assert(!r); 7476 // empty dict 7477 freeO(self); 7478 r = isEStringO(self, ""); 7479 ck_assert(!r); 7480 terminateO(self); 7481 7482 END_TEST 7483 7484 7485 START_TEST(isEFaststringSmallDictT) 7486 7487 bool r; 7488 smallDictt *self = allocG(rtSmallDictt); 7489 7490 self->f->setInt(self, "", 1); 7491 r = isEFaststringO(self, ""); 7492 ck_assert(!r); 7493 // non existing key 7494 r = isEFaststringO(self, "qwe"); 7495 ck_assert(!r); 7496 // empty dict 7497 freeO(self); 7498 r = isEFaststringO(self, ""); 7499 ck_assert(!r); 7500 terminateO(self); 7501 7502 END_TEST 7503 7504 7505 START_TEST(isEArraySmallDictT) 7506 7507 bool r; 7508 smallDictt *self = allocG(rtSmallDictt); 7509 7510 createSmallArray(a); 7511 self->f->setInt(self, "", 1); 7512 self->f->setArray(self, "b", &a); 7513 r = isEArrayO(self, "b"); 7514 ck_assert(r); 7515 r = isEArrayO(self, ""); 7516 ck_assert(!r); 7517 // non existing key 7518 r = isEArrayO(self, "qwe"); 7519 ck_assert(!r); 7520 // empty dict 7521 freeO(self); 7522 r = isEArrayO(self, ""); 7523 ck_assert(!r); 7524 terminateO(self); 7525 7526 END_TEST 7527 7528 7529 START_TEST(isEBytesSmallDictT) 7530 7531 bool r; 7532 smallDictt *self = allocG(rtSmallDictt); 7533 7534 createSmallBytes(b); 7535 self->f->setInt(self, "", 1); 7536 self->f->setSmallBytes(self, "b", &b); 7537 r = isEBytesO(self, "b"); 7538 ck_assert(r); 7539 r = isEBytesO(self, ""); 7540 ck_assert(!r); 7541 // non existing key 7542 r = isEBytesO(self, "qwe"); 7543 ck_assert(!r); 7544 // empty dict 7545 freeO(self); 7546 r = isEBytesO(self, ""); 7547 ck_assert(!r); 7548 terminateO(self); 7549 7550 END_TEST 7551 7552 7553 START_TEST(areAllETypeSmallDictT) 7554 7555 bool r; 7556 smallDictt *self = allocG(rtSmallDictt); 7557 7558 self->f->setBool(self, "a", true); 7559 self->f->setBool(self, "b", true); 7560 r = areAllETypeO(self, "bool"); 7561 ck_assert(r); 7562 self->f->setInt(self, "c", 2); 7563 r = areAllETypeO(self, "bool"); 7564 ck_assert(!r); 7565 // null type 7566 r = areAllETypeO(self, null); 7567 ck_assert(!r); 7568 // empty self 7569 freeO(self); 7570 r = areAllETypeO(self, "bool"); 7571 ck_assert(!r); 7572 self->f->setS(self, "a", ""); 7573 self->f->del(self, "a"); 7574 r = areAllETypeO(self, "bool"); 7575 ck_assert(!r); 7576 terminateO(self); 7577 7578 END_TEST 7579 7580 7581 START_TEST(areAllEUndefinedSmallDictT) 7582 7583 bool r; 7584 smallDictt *self = allocG(rtSmallDictt); 7585 7586 self->f->setUndefined(self, "b"); 7587 r = areAllEUndefinedO(self); 7588 ck_assert(r); 7589 terminateO(self); 7590 7591 END_TEST 7592 7593 7594 START_TEST(areAllEBoolSmallDictT) 7595 7596 bool r; 7597 smallDictt *self = allocG(rtSmallDictt); 7598 7599 self->f->setBool(self, "a", true); 7600 r = areAllEBoolO(self); 7601 ck_assert(r); 7602 terminateO(self); 7603 7604 END_TEST 7605 7606 7607 START_TEST(areAllEContainerSmallDictT) 7608 7609 bool r; 7610 smallDictt *self = allocG(rtSmallDictt); 7611 7612 createSmallContainer(c); 7613 self->f->setSmallContainer(self, "c", &c); 7614 r = areAllEContainerO(self); 7615 ck_assert(r); 7616 terminateO(self); 7617 7618 END_TEST 7619 7620 7621 START_TEST(areAllEDictSmallDictT) 7622 7623 bool r; 7624 smallDictt *self = allocG(rtSmallDictt); 7625 7626 createSmallDict(d); 7627 self->f->setDict(self, "b", &d); 7628 r = areAllEDictO(self); 7629 ck_assert(r); 7630 terminateO(self); 7631 7632 END_TEST 7633 7634 7635 START_TEST(areAllEDoubleSmallDictT) 7636 7637 bool r; 7638 smallDictt *self = allocG(rtSmallDictt); 7639 7640 self->f->setDouble(self, "b", 2.2); 7641 r = areAllEDoubleO(self); 7642 ck_assert(r); 7643 terminateO(self); 7644 7645 END_TEST 7646 7647 7648 START_TEST(areAllEIntSmallDictT) 7649 7650 bool r; 7651 smallDictt *self = allocG(rtSmallDictt); 7652 7653 self->f->setInt(self, "b", 2); 7654 r = areAllEIntO(self); 7655 ck_assert(r); 7656 terminateO(self); 7657 7658 END_TEST 7659 7660 7661 START_TEST(areAllEStringSmallDictT) 7662 7663 bool r; 7664 smallDictt *self = allocG(rtSmallDictt); 7665 7666 self->f->setS(self, "b", "!@#"); 7667 r = areAllEStringO(self); 7668 ck_assert(r); 7669 terminateO(self); 7670 7671 END_TEST 7672 7673 7674 START_TEST(areAllEFaststringSmallDictT) 7675 7676 bool r; 7677 smallDictt *self = allocG(rtSmallDictt); 7678 7679 r = areAllEFaststringO(self); 7680 ck_assert(!r); 7681 terminateO(self); 7682 7683 END_TEST 7684 7685 7686 START_TEST(areAllEArraySmallDictT) 7687 7688 bool r; 7689 smallDictt *self = allocG(rtSmallDictt); 7690 7691 createSmallArray(a); 7692 self->f->setArray(self, "b", &a); 7693 r = areAllEArrayO(self); 7694 ck_assert(r); 7695 terminateO(self); 7696 7697 END_TEST 7698 7699 7700 START_TEST(areAllEBytesSmallDictT) 7701 7702 bool r; 7703 smallDictt *self = allocG(rtSmallDictt); 7704 7705 createSmallBytes(b); 7706 self->f->setSmallBytes(self, "b", &b); 7707 r = areAllEBytesO(self); 7708 ck_assert(r); 7709 terminateO(self); 7710 7711 END_TEST 7712 7713 7714 START_TEST(duplicateSmallDictGT) 7715 7716 smallDictt *r; 7717 smallDictt *self = allocG(rtSmallDictt); 7718 7719 r = duplicateSmallDictG(self); 7720 ck_assert_ptr_ne(r, null); 7721 terminateO(r); 7722 // with iterator 7723 self->f->setS(self, "qwe", "asd"); 7724 iterStartO(self); 7725 r = duplicateSmallDictG(self); 7726 ck_assert_ptr_ne(r, null); 7727 char *s = toStringO(r); 7728 ck_assert_str_eq(s, "{\"qwe\":\"asd\"}"); 7729 free(s); 7730 ck_assert_str_eq(r->iterKey, "qwe"); 7731 terminateO(r); 7732 terminateO(self); 7733 7734 END_TEST 7735 7736 7737 START_TEST(freeSmallDictGT) 7738 7739 smallDictt *self = allocG(rtSmallDictt); 7740 7741 self->f->setS(self, "qwe", "asd"); 7742 freeSmallDictG(self); 7743 terminateO(self); 7744 7745 END_TEST 7746 7747 7748 START_TEST(setSmallDictGT) 7749 7750 smallDictt* r; 7751 smallDictt *self = allocG(rtSmallDictt); 7752 baset *value = (baset*) allocSmallInt(2); 7753 7754 r = setSmallDictG(self, "1", value); 7755 ck_assert_ptr_ne(r, null); 7756 finishO(value); 7757 char *s = toStringO(r); 7758 ck_assert_str_eq(s, "{\"1\":2}"); 7759 free(s); 7760 terminateO(self); 7761 7762 END_TEST 7763 7764 7765 START_TEST(getSmallDictGT) 7766 7767 baset* r; 7768 smallDictt *self = allocG(rtSmallDictt); 7769 7770 self->f->setInt(self, "1", 2); 7771 r = getSmallDictG(self, null, "1"); 7772 ck_assert_ptr_ne(r, null); 7773 char *s = toStringO(r); 7774 finishO(r); 7775 ck_assert_str_eq(s, "2"); 7776 free(s); 7777 terminateO(self); 7778 7779 END_TEST 7780 7781 7782 START_TEST(getUndefinedSmallDictGT) 7783 7784 undefinedt* r; 7785 smallDictt *self = allocG(rtSmallDictt); 7786 7787 smallDictt *r2 = self->f->setUndefined(self, "1"); 7788 ck_assert_ptr_ne(r2, null); 7789 r = getUndefinedSmallDictG(self, null, "1"); 7790 ck_assert_ptr_ne(r, null); 7791 finishO(r); 7792 terminateO(self); 7793 7794 END_TEST 7795 7796 7797 START_TEST(getBoolSmallDictGT) 7798 7799 bool r; 7800 smallDictt *self = allocG(rtSmallDictt); 7801 7802 smallDictt* r2 = self->f->setBool(self, "1", true); 7803 ck_assert_ptr_ne(r2, null); 7804 r = getBoolSmallDictG(self, false, "1"); 7805 ck_assert(r); 7806 terminateO(self); 7807 7808 END_TEST 7809 7810 7811 START_TEST(getBoolPSmallDictGT) 7812 7813 bool* r; 7814 smallDictt *self = allocG(rtSmallDictt); 7815 7816 smallDictt* r2 = self->f->setBool(self, "1", true); 7817 ck_assert_ptr_ne(r2, null); 7818 r = getBoolPSmallDictG(self, null, "1"); 7819 ck_assert_ptr_ne(r, null); 7820 ck_assert(*r); 7821 terminateO(self); 7822 7823 END_TEST 7824 7825 7826 START_TEST(getDoubleSmallDictGT) 7827 7828 double r; 7829 smallDictt *self = allocG(rtSmallDictt); 7830 7831 smallDictt *r2 = self->f->setDouble(self, "1", 2.2); 7832 ck_assert_ptr_ne(r2, null); 7833 r = getDoubleSmallDictG(self, 0, "1"); 7834 ck_assert(r == 2.2); 7835 terminateO(self); 7836 7837 END_TEST 7838 7839 7840 START_TEST(getDoublePSmallDictGT) 7841 7842 double* r; 7843 smallDictt *self = allocG(rtSmallDictt); 7844 7845 smallDictt *r2 = self->f->setDouble(self, "1", 2.2); 7846 ck_assert_ptr_ne(r2, null); 7847 r = getDoublePSmallDictG(self, null, "1"); 7848 ck_assert_ptr_ne(r, null); 7849 ck_assert(*r == 2.2); 7850 terminateO(self); 7851 7852 END_TEST 7853 7854 7855 START_TEST(getIntSmallDictGT) 7856 7857 int64_t r; 7858 smallDictt *self = allocG(rtSmallDictt); 7859 7860 smallDictt *r2 = self->f->setInt(self, "1", 2); 7861 ck_assert_ptr_ne(r2, null); 7862 r = getIntSmallDictG(self, 0, "1"); 7863 ck_assert_int_eq(r, 2); 7864 terminateO(self); 7865 7866 END_TEST 7867 7868 7869 START_TEST(getIntPSmallDictGT) 7870 7871 int64_t* r; 7872 smallDictt *self = allocG(rtSmallDictt); 7873 7874 smallDictt *r2 = self->f->setInt(self, "1", 2); 7875 ck_assert_ptr_ne(r2, null); 7876 r = getIntPSmallDictG(self, null, "1"); 7877 ck_assert_ptr_ne(r, null); 7878 ck_assert_int_eq(*r, 2); 7879 terminateO(self); 7880 7881 END_TEST 7882 7883 7884 START_TEST(getInt32SmallDictGT) 7885 7886 int32_t r; 7887 smallDictt *self = allocG(rtSmallDictt); 7888 7889 smallDictt *r2 = self->f->setInt(self, "1", 2); 7890 ck_assert_ptr_ne(r2, null); 7891 r = getInt32SmallDictG(self, 0, "1"); 7892 ck_assert_int_eq(r, 2); 7893 terminateO(self); 7894 7895 END_TEST 7896 7897 7898 START_TEST(getInt32PSmallDictGT) 7899 7900 int32_t* r; 7901 smallDictt *self = allocG(rtSmallDictt); 7902 7903 smallDictt *r2 = self->f->setInt(self, "1", 2); 7904 ck_assert_ptr_ne(r2, null); 7905 r = getInt32PSmallDictG(self, null, "1"); 7906 ck_assert_ptr_ne(r, null); 7907 ck_assert_int_eq(*r, 2); 7908 terminateO(self); 7909 7910 END_TEST 7911 7912 7913 START_TEST(getUintSmallDictGT) 7914 7915 uint64_t r; 7916 smallDictt *self = allocG(rtSmallDictt); 7917 7918 smallDictt *r2 = self->f->setInt(self, "1", 2); 7919 ck_assert_ptr_ne(r2, null); 7920 r = getUintSmallDictG(self, 0, "1"); 7921 ck_assert_int_eq(r, 2); 7922 terminateO(self); 7923 7924 END_TEST 7925 7926 7927 START_TEST(getUintPSmallDictGT) 7928 7929 uint64_t* r; 7930 smallDictt *self = allocG(rtSmallDictt); 7931 7932 smallDictt *r2 = self->f->setInt(self, "1", 2); 7933 ck_assert_ptr_ne(r2, null); 7934 r = getUintPSmallDictG(self, null, "1"); 7935 ck_assert_ptr_ne(r, null); 7936 ck_assert_int_eq(*r, 2); 7937 terminateO(self); 7938 7939 END_TEST 7940 7941 7942 START_TEST(getUint32SmallDictGT) 7943 7944 uint32_t r; 7945 smallDictt *self = allocG(rtSmallDictt); 7946 7947 smallDictt *r2 = self->f->setInt(self, "1", 2); 7948 ck_assert_ptr_ne(r2, null); 7949 r = getUint32SmallDictG(self, 0, "1"); 7950 ck_assert_int_eq(r, 2); 7951 terminateO(self); 7952 7953 END_TEST 7954 7955 7956 START_TEST(getUint32PSmallDictGT) 7957 7958 uint32_t* r; 7959 smallDictt *self = allocG(rtSmallDictt); 7960 7961 smallDictt *r2 = self->f->setInt(self, "1", 2); 7962 ck_assert_ptr_ne(r2, null); 7963 r = getUint32PSmallDictG(self, null, "1"); 7964 ck_assert_ptr_ne(r, null); 7965 ck_assert_int_eq(*r, 2); 7966 terminateO(self); 7967 7968 END_TEST 7969 7970 7971 START_TEST(getSSmallDictGT) 7972 7973 char* r; 7974 smallDictt *self = allocG(rtSmallDictt); 7975 7976 smallDictt *r2 = self->f->setS(self, "1", "qwe"); 7977 ck_assert_ptr_ne(r2, null); 7978 r = getSSmallDictG(self, null, "1"); 7979 ck_assert_ptr_ne(r, null); 7980 ck_assert_str_eq(r, "qwe"); 7981 terminateO(self); 7982 7983 END_TEST 7984 7985 7986 START_TEST(getDictSmallDictGT) 7987 7988 smallDictt* r; 7989 smallDictt *self = allocG(rtSmallDictt); 7990 smallDictt *dict = allocSmallDict(); 7991 7992 r = self->f->setNFreeDict(self, "1", dict); 7993 ck_assert_ptr_ne(r, null); 7994 r = getDictSmallDictG(self, null, "1"); 7995 ck_assert_ptr_ne(r, null); 7996 char *s = toStringO(r); 7997 finishO(r); 7998 ck_assert_str_eq(s, "{}"); 7999 free(s); 8000 terminateO(self); 8001 8002 END_TEST 8003 8004 8005 START_TEST(getArraySmallDictGT) 8006 8007 smallArrayt *r; 8008 smallDictt *self = allocG(rtSmallDictt); 8009 smallArrayt *array = allocSmallArray(); 8010 8011 smallDictt *r2 = self->f->setNFreeArray(self, "1", array); 8012 ck_assert_ptr_ne(r2, null); 8013 r = getArraySmallDictG(self, null, "1"); 8014 ck_assert_ptr_ne(r, null); 8015 char *s = toStringO(r); 8016 finishO(r); 8017 ck_assert_str_eq(s, "[]"); 8018 free(s); 8019 terminateO(self); 8020 8021 END_TEST 8022 8023 8024 START_TEST(getSmallBoolSmallDictGT) 8025 8026 smallBoolt* r; 8027 smallDictt *self = allocG(rtSmallDictt); 8028 8029 smallDictt* r2 = self->f->setBool(self, "1", true); 8030 ck_assert_ptr_ne(r2, null); 8031 r = getSmallBoolSmallDictG(self, null, "1"); 8032 ck_assert_ptr_ne(r, null); 8033 char *s = toStringO(r); 8034 finishO(r); 8035 ck_assert_str_eq(s, "true"); 8036 free(s); 8037 terminateO(self); 8038 8039 END_TEST 8040 8041 8042 START_TEST(getSmallBytesSmallDictGT) 8043 8044 smallBytest* r; 8045 smallDictt *self = allocG(rtSmallDictt); 8046 smallBytest *value = allocSmallBytes("qwe", sizeof("qwe")); 8047 8048 smallDictt *r2 = self->f->setNFreeSmallBytes(self, "1", value); 8049 ck_assert_ptr_ne(r2, null); 8050 r = getSmallBytesSmallDictG(self, null, "1"); 8051 ck_assert_ptr_ne(r, null); 8052 char *s = toStringO(r); 8053 finishO(r); 8054 ck_assert_str_eq(s, "[0x71,0x77,0x65,0x00]"); 8055 free(s); 8056 terminateO(self); 8057 8058 END_TEST 8059 8060 8061 START_TEST(getSmallDoubleSmallDictGT) 8062 8063 smallDoublet* r; 8064 smallDictt *self = allocG(rtSmallDictt); 8065 8066 smallDictt *r2 = self->f->setDouble(self, "1", 2.2); 8067 ck_assert_ptr_ne(r2, null); 8068 r = getSmallDoubleSmallDictG(self, null, "1"); 8069 ck_assert_ptr_ne(r, null); 8070 char *s = toStringO(r); 8071 finishO(r); 8072 ck_assert_str_eq(s, "2.200000e+00"); 8073 free(s); 8074 terminateO(self); 8075 8076 END_TEST 8077 8078 8079 START_TEST(getSmallIntSmallDictGT) 8080 8081 smallIntt* r; 8082 smallDictt *self = allocG(rtSmallDictt); 8083 8084 smallDictt *r2 = self->f->setInt(self, "1", 2); 8085 ck_assert_ptr_ne(r2, null); 8086 r = getSmallIntSmallDictG(self, null, "1"); 8087 ck_assert_ptr_ne(r, null); 8088 char *s = toStringO(r); 8089 finishO(r); 8090 ck_assert_str_eq(s, "2"); 8091 free(s); 8092 terminateO(self); 8093 8094 END_TEST 8095 8096 8097 START_TEST(getSmallJsonSmallDictGT) 8098 8099 smallJsont* r; 8100 smallDictt *self = allocG(rtSmallDictt); 8101 smallJsont *value = allocSmallJson(); 8102 8103 setTopIntO(value, 2); 8104 smallDictt *r2 = self->f->setNFreeSmallJson(self, "1", value); 8105 ck_assert_ptr_ne(r2, null); 8106 r = getSmallJsonSmallDictG(self, null, "1"); 8107 ck_assert_ptr_ne(r, null); 8108 char *s = toStringO(r); 8109 finishO(r); 8110 ck_assert_str_eq(s, "2"); 8111 free(s); 8112 terminateO(self); 8113 8114 END_TEST 8115 8116 8117 START_TEST(getSmallStringSmallDictGT) 8118 8119 smallStringt* r; 8120 smallDictt *self = allocG(rtSmallDictt); 8121 8122 smallDictt *r2 = self->f->setS(self, "1", "qwe"); 8123 ck_assert_ptr_ne(r2, null); 8124 r = getSmallStringSmallDictG(self, null, "1"); 8125 ck_assert_ptr_ne(r, null); 8126 char *s = toStringO(r); 8127 finishO(r); 8128 ck_assert_str_eq(s, "qwe"); 8129 free(s); 8130 terminateO(self); 8131 8132 END_TEST 8133 8134 8135 START_TEST(getVoidSmallDictGT) 8136 8137 void* r; 8138 smallDictt *self = allocG(rtSmallDictt); 8139 8140 createSmallContainer(c); 8141 setValO(&c, &r); 8142 smallDictt *r2 = self->f->setSmallContainer(self, "1", &c); 8143 ck_assert_ptr_ne(r2, null); 8144 r = getVoidSmallDictG(self, null, "1"); 8145 ck_assert_ptr_eq(r, &r); 8146 terminateO(self); 8147 8148 END_TEST 8149 8150 8151 START_TEST(getSmallContainerSmallDictGT) 8152 8153 smallContainert* r; 8154 smallDictt *self = allocG(rtSmallDictt); 8155 8156 createSmallContainer(c); 8157 setValO(&c, &r); 8158 smallDictt *r2 = self->f->setSmallContainer(self, "1", &c); 8159 ck_assert_ptr_ne(r2, null); 8160 r = getSmallContainerSmallDictG(self, null, "1"); 8161 ck_assert_ptr_ne(r, null); 8162 char *s = toStringO(r); 8163 finishO(r); 8164 ck_assert_str_eq(s, "<data smallContainer>"); 8165 free(s); 8166 terminateO(self); 8167 8168 END_TEST 8169 8170 8171 START_TEST(getKCharSmallDictGT) 8172 8173 baset* r; 8174 smallDictt *self = allocG(rtSmallDictt); 8175 8176 self->f->setInt(self, "1", 2); 8177 r = getKCharSmallDictG(self, null, '1'); 8178 ck_assert_ptr_ne(r, null); 8179 char *s = toStringO(r); 8180 finishO(r); 8181 ck_assert_str_eq(s, "2"); 8182 free(s); 8183 terminateO(self); 8184 8185 END_TEST 8186 8187 8188 START_TEST(getUndefinedKCharSmallDictGT) 8189 8190 undefinedt* r; 8191 smallDictt *self = allocG(rtSmallDictt); 8192 8193 smallDictt *r2 = self->f->setUndefined(self, "1"); 8194 ck_assert_ptr_ne(r2, null); 8195 r = getUndefinedKCharSmallDictG(self, null, '1'); 8196 ck_assert_ptr_ne(r, null); 8197 finishO(r); 8198 terminateO(self); 8199 8200 END_TEST 8201 8202 8203 START_TEST(getBoolKCharSmallDictGT) 8204 8205 bool r; 8206 smallDictt *self = allocG(rtSmallDictt); 8207 8208 smallDictt* r2 = self->f->setBool(self, "1", true); 8209 ck_assert_ptr_ne(r2, null); 8210 r = getBoolKCharSmallDictG(self, false, '1'); 8211 ck_assert(r); 8212 terminateO(self); 8213 8214 END_TEST 8215 8216 8217 START_TEST(getBoolPKCharSmallDictGT) 8218 8219 bool* r; 8220 smallDictt *self = allocG(rtSmallDictt); 8221 8222 smallDictt* r2 = self->f->setBool(self, "1", true); 8223 ck_assert_ptr_ne(r2, null); 8224 r = getBoolPKCharSmallDictG(self, null, '1'); 8225 ck_assert_ptr_ne(r, null); 8226 ck_assert(*r); 8227 terminateO(self); 8228 8229 END_TEST 8230 8231 8232 START_TEST(getDoubleKCharSmallDictGT) 8233 8234 double r; 8235 smallDictt *self = allocG(rtSmallDictt); 8236 8237 smallDictt *r2 = self->f->setDouble(self, "1", 2.2); 8238 ck_assert_ptr_ne(r2, null); 8239 r = getDoubleKCharSmallDictG(self, 0, '1'); 8240 ck_assert(r == 2.2); 8241 terminateO(self); 8242 8243 END_TEST 8244 8245 8246 START_TEST(getDoublePKCharSmallDictGT) 8247 8248 double* r; 8249 smallDictt *self = allocG(rtSmallDictt); 8250 8251 smallDictt *r2 = self->f->setDouble(self, "1", 2.2); 8252 ck_assert_ptr_ne(r2, null); 8253 r = getDoublePKCharSmallDictG(self, null, '1'); 8254 ck_assert_ptr_ne(r, null); 8255 ck_assert(*r == 2.2); 8256 terminateO(self); 8257 8258 END_TEST 8259 8260 8261 START_TEST(getIntKCharSmallDictGT) 8262 8263 int64_t r; 8264 smallDictt *self = allocG(rtSmallDictt); 8265 8266 smallDictt *r2 = self->f->setInt(self, "1", 2); 8267 ck_assert_ptr_ne(r2, null); 8268 r = getIntKCharSmallDictG(self, 0, '1'); 8269 ck_assert_int_eq(r, 2); 8270 terminateO(self); 8271 8272 END_TEST 8273 8274 8275 START_TEST(getIntPKCharSmallDictGT) 8276 8277 int64_t* r; 8278 smallDictt *self = allocG(rtSmallDictt); 8279 8280 smallDictt *r2 = self->f->setInt(self, "1", 2); 8281 ck_assert_ptr_ne(r2, null); 8282 r = getIntPKCharSmallDictG(self, null, '1'); 8283 ck_assert_ptr_ne(r, null); 8284 ck_assert_int_eq(*r, 2); 8285 terminateO(self); 8286 8287 END_TEST 8288 8289 8290 START_TEST(getInt32KCharSmallDictGT) 8291 8292 int32_t r; 8293 smallDictt *self = allocG(rtSmallDictt); 8294 8295 smallDictt *r2 = self->f->setInt(self, "1", 2); 8296 ck_assert_ptr_ne(r2, null); 8297 r = getInt32KCharSmallDictG(self, 0, '1'); 8298 ck_assert_int_eq(r, 2); 8299 terminateO(self); 8300 8301 END_TEST 8302 8303 8304 START_TEST(getInt32PKCharSmallDictGT) 8305 8306 int32_t* r; 8307 smallDictt *self = allocG(rtSmallDictt); 8308 8309 smallDictt *r2 = self->f->setInt(self, "1", 2); 8310 ck_assert_ptr_ne(r2, null); 8311 r = getInt32PKCharSmallDictG(self, null, '1'); 8312 ck_assert_ptr_ne(r, null); 8313 ck_assert_int_eq(*r, 2); 8314 terminateO(self); 8315 8316 END_TEST 8317 8318 8319 START_TEST(getUintKCharSmallDictGT) 8320 8321 uint64_t r; 8322 smallDictt *self = allocG(rtSmallDictt); 8323 8324 smallDictt *r2 = self->f->setInt(self, "1", 2); 8325 ck_assert_ptr_ne(r2, null); 8326 r = getUintKCharSmallDictG(self, 0, '1'); 8327 ck_assert_int_eq(r, 2); 8328 terminateO(self); 8329 8330 END_TEST 8331 8332 8333 START_TEST(getUintPKCharSmallDictGT) 8334 8335 uint64_t* r; 8336 smallDictt *self = allocG(rtSmallDictt); 8337 8338 smallDictt *r2 = self->f->setInt(self, "1", 2); 8339 ck_assert_ptr_ne(r2, null); 8340 r = getUintPKCharSmallDictG(self, null, '1'); 8341 ck_assert_ptr_ne(r, null); 8342 ck_assert_int_eq(*r, 2); 8343 terminateO(self); 8344 8345 END_TEST 8346 8347 8348 START_TEST(getUint32KCharSmallDictGT) 8349 8350 uint32_t r; 8351 smallDictt *self = allocG(rtSmallDictt); 8352 8353 smallDictt *r2 = self->f->setInt(self, "1", 2); 8354 ck_assert_ptr_ne(r2, null); 8355 r = getUint32KCharSmallDictG(self, 0, '1'); 8356 ck_assert_int_eq(r, 2); 8357 terminateO(self); 8358 8359 END_TEST 8360 8361 8362 START_TEST(getUint32PKCharSmallDictGT) 8363 8364 uint32_t* r; 8365 smallDictt *self = allocG(rtSmallDictt); 8366 8367 smallDictt *r2 = self->f->setInt(self, "1", 2); 8368 ck_assert_ptr_ne(r2, null); 8369 r = getUint32PKCharSmallDictG(self, null, '1'); 8370 ck_assert_ptr_ne(r, null); 8371 ck_assert_int_eq(*r, 2); 8372 terminateO(self); 8373 8374 END_TEST 8375 8376 8377 START_TEST(getSKCharSmallDictGT) 8378 8379 char* r; 8380 smallDictt *self = allocG(rtSmallDictt); 8381 8382 smallDictt *r2 = self->f->setS(self, "1", "qwe"); 8383 ck_assert_ptr_ne(r2, null); 8384 r = getSKCharSmallDictG(self, null, '1'); 8385 ck_assert_ptr_ne(r, null); 8386 ck_assert_str_eq(r, "qwe"); 8387 terminateO(self); 8388 8389 END_TEST 8390 8391 8392 START_TEST(getDictKCharSmallDictGT) 8393 8394 smallDictt* r; 8395 smallDictt *self = allocG(rtSmallDictt); 8396 smallDictt *dict = allocSmallDict(); 8397 8398 r = self->f->setNFreeDict(self, "1", dict); 8399 ck_assert_ptr_ne(r, null); 8400 r = getDictKCharSmallDictG(self, null, '1'); 8401 ck_assert_ptr_ne(r, null); 8402 char *s = toStringO(r); 8403 finishO(r); 8404 ck_assert_str_eq(s, "{}"); 8405 free(s); 8406 terminateO(self); 8407 8408 END_TEST 8409 8410 8411 START_TEST(getArrayKCharSmallDictGT) 8412 8413 smallArrayt* r; 8414 smallDictt *self = allocG(rtSmallDictt); 8415 smallArrayt *array = allocSmallArray(); 8416 8417 smallDictt *r2 = self->f->setNFreeArray(self, "1", array); 8418 ck_assert_ptr_ne(r2, null); 8419 r = getArrayKCharSmallDictG(self, null, '1'); 8420 ck_assert_ptr_ne(r, null); 8421 char *s = toStringO(r); 8422 finishO(r); 8423 ck_assert_str_eq(s, "[]"); 8424 free(s); 8425 terminateO(self); 8426 8427 END_TEST 8428 8429 8430 START_TEST(getSmallBoolKCharSmallDictGT) 8431 8432 smallBoolt* r; 8433 smallDictt *self = allocG(rtSmallDictt); 8434 8435 smallDictt* r2 = self->f->setBool(self, "1", true); 8436 ck_assert_ptr_ne(r2, null); 8437 r = getSmallBoolKCharSmallDictG(self, null, '1'); 8438 ck_assert_ptr_ne(r, null); 8439 char *s = toStringO(r); 8440 finishO(r); 8441 ck_assert_str_eq(s, "true"); 8442 free(s); 8443 terminateO(self); 8444 8445 END_TEST 8446 8447 8448 START_TEST(getSmallBytesKCharSmallDictGT) 8449 8450 smallBytest* r; 8451 smallDictt *self = allocG(rtSmallDictt); 8452 smallBytest *value = allocSmallBytes("qwe", sizeof("qwe")); 8453 8454 smallDictt *r2 = self->f->setNFreeSmallBytes(self, "1", value); 8455 ck_assert_ptr_ne(r2, null); 8456 r = getSmallBytesKCharSmallDictG(self, null, '1'); 8457 ck_assert_ptr_ne(r, null); 8458 char *s = toStringO(r); 8459 finishO(r); 8460 ck_assert_str_eq(s, "[0x71,0x77,0x65,0x00]"); 8461 free(s); 8462 terminateO(self); 8463 8464 END_TEST 8465 8466 8467 START_TEST(getSmallDoubleKCharSmallDictGT) 8468 8469 smallDoublet* r; 8470 smallDictt *self = allocG(rtSmallDictt); 8471 8472 smallDictt *r2 = self->f->setDouble(self, "1", 2.2); 8473 ck_assert_ptr_ne(r2, null); 8474 r = getSmallDoubleKCharSmallDictG(self, null, '1'); 8475 ck_assert_ptr_ne(r, null); 8476 char *s = toStringO(r); 8477 finishO(r); 8478 ck_assert_str_eq(s, "2.200000e+00"); 8479 free(s); 8480 terminateO(self); 8481 8482 END_TEST 8483 8484 8485 START_TEST(getSmallIntKCharSmallDictGT) 8486 8487 smallIntt* r; 8488 smallDictt *self = allocG(rtSmallDictt); 8489 8490 smallDictt *r2 = self->f->setInt(self, "1", 2); 8491 ck_assert_ptr_ne(r2, null); 8492 r = getSmallIntKCharSmallDictG(self, null, '1'); 8493 ck_assert_ptr_ne(r, null); 8494 char *s = toStringO(r); 8495 finishO(r); 8496 ck_assert_str_eq(s, "2"); 8497 free(s); 8498 terminateO(self); 8499 8500 END_TEST 8501 8502 8503 START_TEST(getSmallJsonKCharSmallDictGT) 8504 8505 smallJsont* r; 8506 smallDictt *self = allocG(rtSmallDictt); 8507 smallJsont *value = allocSmallJson(); 8508 8509 setTopIntO(value, 2); 8510 smallDictt *r2 = self->f->setNFreeSmallJson(self, "1", value); 8511 ck_assert_ptr_ne(r2, null); 8512 r = getSmallJsonKCharSmallDictG(self, null, '1'); 8513 ck_assert_ptr_ne(r, null); 8514 char *s = toStringO(r); 8515 finishO(r); 8516 ck_assert_str_eq(s, "2"); 8517 free(s); 8518 terminateO(self); 8519 8520 END_TEST 8521 8522 8523 START_TEST(getSmallStringKCharSmallDictGT) 8524 8525 smallStringt* r; 8526 smallDictt *self = allocG(rtSmallDictt); 8527 8528 smallDictt *r2 = self->f->setS(self, "1", "qwe"); 8529 ck_assert_ptr_ne(r2, null); 8530 r = getSmallStringKCharSmallDictG(self, null, '1'); 8531 ck_assert_ptr_ne(r, null); 8532 char *s = toStringO(r); 8533 finishO(r); 8534 ck_assert_str_eq(s, "qwe"); 8535 free(s); 8536 terminateO(self); 8537 8538 END_TEST 8539 8540 8541 START_TEST(getVoidKCharSmallDictGT) 8542 8543 void* r; 8544 smallDictt *self = allocG(rtSmallDictt); 8545 8546 createSmallContainer(c); 8547 setValO(&c, &r); 8548 smallDictt *r2 = self->f->setSmallContainer(self, "1", &c); 8549 ck_assert_ptr_ne(r2, null); 8550 r = getVoidKCharSmallDictG(self, null, '1'); 8551 ck_assert_ptr_eq(r, &r); 8552 terminateO(self); 8553 8554 END_TEST 8555 8556 8557 START_TEST(getSmallContainerKCharSmallDictGT) 8558 8559 smallContainert* r; 8560 smallDictt *self = allocG(rtSmallDictt); 8561 8562 createSmallContainer(c); 8563 setValO(&c, &r); 8564 smallDictt *r2 = self->f->setSmallContainer(self, "1", &c); 8565 ck_assert_ptr_ne(r2, null); 8566 r = getSmallContainerKCharSmallDictG(self, null, '1'); 8567 ck_assert_ptr_ne(r, null); 8568 char *s = toStringO(r); 8569 finishO(r); 8570 ck_assert_str_eq(s, "<data smallContainer>"); 8571 free(s); 8572 terminateO(self); 8573 8574 END_TEST 8575 8576 8577 START_TEST(getNDupSmallDictGT) 8578 8579 baset* r; 8580 smallDictt *self = allocG(rtSmallDictt); 8581 8582 self->f->setInt(self, "1", 2); 8583 r = getNDupSmallDictG(self, null, "1"); 8584 ck_assert_ptr_ne(r, null); 8585 char *s = toStringO(r); 8586 terminateO(r); 8587 ck_assert_str_eq(s, "2"); 8588 free(s); 8589 terminateO(self); 8590 8591 END_TEST 8592 8593 8594 START_TEST(getNDupUndefinedSmallDictGT) 8595 8596 undefinedt* r; 8597 smallDictt *self = allocG(rtSmallDictt); 8598 8599 smallDictt *r2 = self->f->setUndefined(self, "1"); 8600 ck_assert_ptr_ne(r2, null); 8601 r = getNDupUndefinedSmallDictG(self, null, "1"); 8602 ck_assert_ptr_ne(r, null); 8603 terminateO(r); 8604 terminateO(self); 8605 8606 END_TEST 8607 8608 8609 START_TEST(getNDupBoolSmallDictGT) 8610 8611 bool r; 8612 smallDictt *self = allocG(rtSmallDictt); 8613 8614 smallDictt* r2 = self->f->setBool(self, "1", true); 8615 ck_assert_ptr_ne(r2, null); 8616 r = getNDupBoolSmallDictG(self, false, "1"); 8617 ck_assert(r); 8618 terminateO(self); 8619 8620 END_TEST 8621 8622 8623 START_TEST(getNDupDoubleSmallDictGT) 8624 8625 double r; 8626 smallDictt *self = allocG(rtSmallDictt); 8627 8628 smallDictt *r2 = self->f->setDouble(self, "1", 2.2); 8629 ck_assert_ptr_ne(r2, null); 8630 r = getNDupDoubleSmallDictG(self, 0, "1"); 8631 ck_assert(r == 2.2); 8632 terminateO(self); 8633 8634 END_TEST 8635 8636 8637 START_TEST(getNDupIntSmallDictGT) 8638 8639 int64_t r; 8640 smallDictt *self = allocG(rtSmallDictt); 8641 8642 smallDictt *r2 = self->f->setInt(self, "1", 2); 8643 ck_assert_ptr_ne(r2, null); 8644 r = getNDupIntSmallDictG(self, 0, "1"); 8645 ck_assert_int_eq(r, 2); 8646 terminateO(self); 8647 8648 END_TEST 8649 8650 8651 START_TEST(getNDupInt32SmallDictGT) 8652 8653 int32_t r; 8654 smallDictt *self = allocG(rtSmallDictt); 8655 8656 smallDictt *r2 = self->f->setInt(self, "1", 2); 8657 ck_assert_ptr_ne(r2, null); 8658 r = getNDupInt32SmallDictG(self, 0, "1"); 8659 ck_assert_int_eq(r, 2); 8660 terminateO(self); 8661 8662 END_TEST 8663 8664 8665 START_TEST(getNDupUintSmallDictGT) 8666 8667 uint64_t r; 8668 smallDictt *self = allocG(rtSmallDictt); 8669 8670 smallDictt *r2 = self->f->setInt(self, "1", 2); 8671 ck_assert_ptr_ne(r2, null); 8672 r = getNDupUintSmallDictG(self, 0, "1"); 8673 ck_assert_int_eq(r, 2); 8674 terminateO(self); 8675 8676 END_TEST 8677 8678 8679 START_TEST(getNDupUint32SmallDictGT) 8680 8681 uint32_t r; 8682 smallDictt *self = allocG(rtSmallDictt); 8683 8684 smallDictt *r2 = self->f->setInt(self, "1", 2); 8685 ck_assert_ptr_ne(r2, null); 8686 r = getNDupUint32SmallDictG(self, 0, "1"); 8687 ck_assert_int_eq(r, 2); 8688 terminateO(self); 8689 8690 END_TEST 8691 8692 8693 START_TEST(getNDupSSmallDictGT) 8694 8695 char* r; 8696 smallDictt *self = allocG(rtSmallDictt); 8697 8698 smallDictt *r2 = self->f->setS(self, "1", "qwe"); 8699 ck_assert_ptr_ne(r2, null); 8700 r = getNDupSSmallDictG(self, null, "1"); 8701 ck_assert_ptr_ne(r, null); 8702 ck_assert_str_eq(r, "qwe"); 8703 free(r); 8704 terminateO(self); 8705 8706 END_TEST 8707 8708 8709 START_TEST(getNDupDictSmallDictGT) 8710 8711 smallDictt* r; 8712 smallDictt *self = allocG(rtSmallDictt); 8713 smallDictt *dict = allocSmallDict(); 8714 8715 r = self->f->setNFreeDict(self, "1", dict); 8716 ck_assert_ptr_ne(r, null); 8717 r = getNDupDictSmallDictG(self, null, "1"); 8718 ck_assert_ptr_ne(r, null); 8719 char *s = toStringO(r); 8720 terminateO(r); 8721 ck_assert_str_eq(s, "{}"); 8722 free(s); 8723 terminateO(self); 8724 8725 END_TEST 8726 8727 8728 START_TEST(getNDupArraySmallDictGT) 8729 8730 smallArrayt* r; 8731 smallDictt *self = allocG(rtSmallDictt); 8732 smallArrayt *array = allocSmallArray(); 8733 8734 smallDictt *r2 = self->f->setNFreeArray(self, "1", array); 8735 ck_assert_ptr_ne(r2, null); 8736 r = getNDupArraySmallDictG(self, null, "1"); 8737 ck_assert_ptr_ne(r, null); 8738 char *s = toStringO(r); 8739 terminateO(r); 8740 ck_assert_str_eq(s, "[]"); 8741 free(s); 8742 terminateO(self); 8743 8744 END_TEST 8745 8746 8747 START_TEST(getNDupSmallBoolSmallDictGT) 8748 8749 smallBoolt* r; 8750 smallDictt *self = allocG(rtSmallDictt); 8751 8752 smallDictt* r2 = self->f->setBool(self, "1", true); 8753 ck_assert_ptr_ne(r2, null); 8754 r = getNDupSmallBoolSmallDictG(self, null, "1"); 8755 ck_assert_ptr_ne(r, null); 8756 char *s = toStringO(r); 8757 terminateO(r); 8758 ck_assert_str_eq(s, "true"); 8759 free(s); 8760 terminateO(self); 8761 8762 END_TEST 8763 8764 8765 START_TEST(getNDupSmallBytesSmallDictGT) 8766 8767 smallBytest* r; 8768 smallDictt *self = allocG(rtSmallDictt); 8769 smallBytest *value = allocSmallBytes("qwe", sizeof("qwe")); 8770 8771 smallDictt *r2 = self->f->setNFreeSmallBytes(self, "1", value); 8772 ck_assert_ptr_ne(r2, null); 8773 r = getNDupSmallBytesSmallDictG(self, null, "1"); 8774 ck_assert_ptr_ne(r, null); 8775 char *s = toStringO(r); 8776 terminateO(r); 8777 ck_assert_str_eq(s, "[0x71,0x77,0x65,0x00]"); 8778 free(s); 8779 terminateO(self); 8780 8781 END_TEST 8782 8783 8784 START_TEST(getNDupSmallDoubleSmallDictGT) 8785 8786 smallDoublet* r; 8787 smallDictt *self = allocG(rtSmallDictt); 8788 8789 smallDictt *r2 = self->f->setDouble(self, "1", 2.2); 8790 ck_assert_ptr_ne(r2, null); 8791 r = getNDupSmallDoubleSmallDictG(self, null, "1"); 8792 ck_assert_ptr_ne(r, null); 8793 char *s = toStringO(r); 8794 terminateO(r); 8795 ck_assert_str_eq(s, "2.200000e+00"); 8796 free(s); 8797 terminateO(self); 8798 8799 END_TEST 8800 8801 8802 START_TEST(getNDupSmallIntSmallDictGT) 8803 8804 smallIntt* r; 8805 smallDictt *self = allocG(rtSmallDictt); 8806 8807 smallDictt *r2 = self->f->setInt(self, "1", 2); 8808 ck_assert_ptr_ne(r2, null); 8809 r = getNDupSmallIntSmallDictG(self, null, "1"); 8810 ck_assert_ptr_ne(r, null); 8811 char *s = toStringO(r); 8812 terminateO(r); 8813 ck_assert_str_eq(s, "2"); 8814 free(s); 8815 terminateO(self); 8816 8817 END_TEST 8818 8819 8820 START_TEST(getNDupSmallJsonSmallDictGT) 8821 8822 smallJsont* r; 8823 smallDictt *self = allocG(rtSmallDictt); 8824 smallJsont *value = allocSmallJson(); 8825 8826 setTopIntO(value, 2); 8827 smallDictt *r2 = self->f->setNFreeSmallJson(self, "1", value); 8828 ck_assert_ptr_ne(r2, null); 8829 r = getNDupSmallJsonSmallDictG(self, null, "1"); 8830 ck_assert_ptr_ne(r, null); 8831 char *s = toStringO(r); 8832 terminateO(r); 8833 ck_assert_str_eq(s, "2"); 8834 free(s); 8835 terminateO(self); 8836 8837 END_TEST 8838 8839 8840 START_TEST(getNDupSmallStringSmallDictGT) 8841 8842 smallStringt* r; 8843 smallDictt *self = allocG(rtSmallDictt); 8844 8845 smallDictt *r2 = self->f->setS(self, "1", "qwe"); 8846 ck_assert_ptr_ne(r2, null); 8847 r = getNDupSmallStringSmallDictG(self, null, "1"); 8848 ck_assert_ptr_ne(r, null); 8849 char *s = toStringO(r); 8850 terminateO(r); 8851 ck_assert_str_eq(s, "qwe"); 8852 free(s); 8853 terminateO(self); 8854 8855 END_TEST 8856 8857 8858 START_TEST(getNDupVoidSmallDictGT) 8859 8860 void* r; 8861 smallDictt *self = allocG(rtSmallDictt); 8862 8863 createSmallContainer(c); 8864 setValO(&c, &r); 8865 smallDictt *r2 = self->f->setSmallContainer(self, "1", &c); 8866 ck_assert_ptr_ne(r2, null); 8867 r = getNDupVoidSmallDictG(self, null, "1"); 8868 ck_assert_ptr_eq(r, null); 8869 terminateO(self); 8870 8871 END_TEST 8872 8873 8874 START_TEST(getNDupSmallContainerSmallDictGT) 8875 8876 smallContainert* r; 8877 smallDictt *self = allocG(rtSmallDictt); 8878 8879 createSmallContainer(c); 8880 setValO(&c, &r); 8881 smallDictt *r2 = self->f->setSmallContainer(self, "1", &c); 8882 ck_assert_ptr_ne(r2, null); 8883 r = getNDupSmallContainerSmallDictG(self, null, "1"); 8884 ck_assert_ptr_ne(r, null); 8885 char *s = toStringO(r); 8886 terminateO(r); 8887 ck_assert_str_eq(s, "<data smallContainer>"); 8888 free(s); 8889 terminateO(self); 8890 8891 END_TEST 8892 8893 8894 START_TEST(getNDupKCharSmallDictGT) 8895 8896 baset* r; 8897 smallDictt *self = allocG(rtSmallDictt); 8898 8899 self->f->setInt(self, "1", 2); 8900 r = getNDupKCharSmallDictG(self, null, '1'); 8901 ck_assert_ptr_ne(r, null); 8902 char *s = toStringO(r); 8903 terminateO(r); 8904 ck_assert_str_eq(s, "2"); 8905 free(s); 8906 terminateO(self); 8907 8908 END_TEST 8909 8910 8911 START_TEST(getNDupUndefinedKCharSmallDictGT) 8912 8913 undefinedt* r; 8914 smallDictt *self = allocG(rtSmallDictt); 8915 8916 smallDictt *r2 = self->f->setUndefined(self, "1"); 8917 ck_assert_ptr_ne(r2, null); 8918 r = getNDupUndefinedKCharSmallDictG(self, null, '1'); 8919 ck_assert_ptr_ne(r, null); 8920 terminateO(r); 8921 terminateO(self); 8922 8923 END_TEST 8924 8925 8926 START_TEST(getNDupBoolKCharSmallDictGT) 8927 8928 bool r; 8929 smallDictt *self = allocG(rtSmallDictt); 8930 8931 smallDictt* r2 = self->f->setBool(self, "1", true); 8932 ck_assert_ptr_ne(r2, null); 8933 r = getNDupBoolKCharSmallDictG(self, false, '1'); 8934 ck_assert(r); 8935 terminateO(self); 8936 8937 END_TEST 8938 8939 8940 START_TEST(getNDupDoubleKCharSmallDictGT) 8941 8942 double r; 8943 smallDictt *self = allocG(rtSmallDictt); 8944 8945 smallDictt *r2 = self->f->setDouble(self, "1", 2.2); 8946 ck_assert_ptr_ne(r2, null); 8947 r = getNDupDoubleKCharSmallDictG(self, 0, '1'); 8948 ck_assert(r == 2.2); 8949 terminateO(self); 8950 8951 END_TEST 8952 8953 8954 START_TEST(getNDupIntKCharSmallDictGT) 8955 8956 int64_t r; 8957 smallDictt *self = allocG(rtSmallDictt); 8958 8959 smallDictt *r2 = self->f->setInt(self, "1", 2); 8960 ck_assert_ptr_ne(r2, null); 8961 r = getNDupIntKCharSmallDictG(self, 0, '1'); 8962 ck_assert_int_eq(r, 2); 8963 terminateO(self); 8964 8965 END_TEST 8966 8967 8968 START_TEST(getNDupInt32KCharSmallDictGT) 8969 8970 int32_t r; 8971 smallDictt *self = allocG(rtSmallDictt); 8972 8973 smallDictt *r2 = self->f->setInt(self, "1", 2); 8974 ck_assert_ptr_ne(r2, null); 8975 r = getNDupInt32KCharSmallDictG(self, 0, '1'); 8976 ck_assert_int_eq(r, 2); 8977 terminateO(self); 8978 8979 END_TEST 8980 8981 8982 START_TEST(getNDupUintKCharSmallDictGT) 8983 8984 uint64_t r; 8985 smallDictt *self = allocG(rtSmallDictt); 8986 8987 smallDictt *r2 = self->f->setInt(self, "1", 2); 8988 ck_assert_ptr_ne(r2, null); 8989 r = getNDupUintKCharSmallDictG(self, 0, '1'); 8990 ck_assert_int_eq(r, 2); 8991 terminateO(self); 8992 8993 END_TEST 8994 8995 8996 START_TEST(getNDupUint32KCharSmallDictGT) 8997 8998 uint32_t r; 8999 smallDictt *self = allocG(rtSmallDictt); 9000 9001 smallDictt *r2 = self->f->setInt(self, "1", 2); 9002 ck_assert_ptr_ne(r2, null); 9003 r = getNDupUint32KCharSmallDictG(self, 0, '1'); 9004 ck_assert_int_eq(r, 2); 9005 terminateO(self); 9006 9007 END_TEST 9008 9009 9010 START_TEST(getNDupSKCharSmallDictGT) 9011 9012 char* r; 9013 smallDictt *self = allocG(rtSmallDictt); 9014 9015 smallDictt *r2 = self->f->setS(self, "1", "qwe"); 9016 ck_assert_ptr_ne(r2, null); 9017 r = getNDupSKCharSmallDictG(self, null, '1'); 9018 ck_assert_ptr_ne(r, null); 9019 ck_assert_str_eq(r, "qwe"); 9020 free(r); 9021 terminateO(self); 9022 9023 END_TEST 9024 9025 9026 START_TEST(getNDupDictKCharSmallDictGT) 9027 9028 smallDictt* r; 9029 smallDictt *self = allocG(rtSmallDictt); 9030 smallDictt *dict = allocSmallDict(); 9031 9032 r = self->f->setNFreeDict(self, "1", dict); 9033 ck_assert_ptr_ne(r, null); 9034 r = getNDupDictKCharSmallDictG(self, null, '1'); 9035 ck_assert_ptr_ne(r, null); 9036 char *s = toStringO(r); 9037 terminateO(r); 9038 ck_assert_str_eq(s, "{}"); 9039 free(s); 9040 terminateO(self); 9041 9042 END_TEST 9043 9044 9045 START_TEST(getNDupArrayKCharSmallDictGT) 9046 9047 smallArrayt* r; 9048 smallDictt *self = allocG(rtSmallDictt); 9049 smallArrayt *array = allocSmallArray(); 9050 9051 smallDictt *r2 = self->f->setNFreeArray(self, "1", array); 9052 ck_assert_ptr_ne(r2, null); 9053 r = getNDupArrayKCharSmallDictG(self, null, '1'); 9054 ck_assert_ptr_ne(r, null); 9055 char *s = toStringO(r); 9056 terminateO(r); 9057 ck_assert_str_eq(s, "[]"); 9058 free(s); 9059 terminateO(self); 9060 9061 END_TEST 9062 9063 9064 START_TEST(getNDupSmallBoolKCharSmallDictGT) 9065 9066 smallBoolt* r; 9067 smallDictt *self = allocG(rtSmallDictt); 9068 9069 smallDictt* r2 = self->f->setBool(self, "1", true); 9070 ck_assert_ptr_ne(r2, null); 9071 r = getNDupSmallBoolKCharSmallDictG(self, null, '1'); 9072 ck_assert_ptr_ne(r, null); 9073 char *s = toStringO(r); 9074 terminateO(r); 9075 ck_assert_str_eq(s, "true"); 9076 free(s); 9077 terminateO(self); 9078 9079 END_TEST 9080 9081 9082 START_TEST(getNDupSmallBytesKCharSmallDictGT) 9083 9084 smallBytest* r; 9085 smallDictt *self = allocG(rtSmallDictt); 9086 smallBytest *value = allocSmallBytes("qwe", sizeof("qwe")); 9087 9088 smallDictt *r2 = self->f->setNFreeSmallBytes(self, "1", value); 9089 ck_assert_ptr_ne(r2, null); 9090 r = getNDupSmallBytesKCharSmallDictG(self, null, '1'); 9091 ck_assert_ptr_ne(r, null); 9092 char *s = toStringO(r); 9093 terminateO(r); 9094 ck_assert_str_eq(s, "[0x71,0x77,0x65,0x00]"); 9095 free(s); 9096 terminateO(self); 9097 9098 END_TEST 9099 9100 9101 START_TEST(getNDupSmallDoubleKCharSmallDictGT) 9102 9103 smallDoublet* r; 9104 smallDictt *self = allocG(rtSmallDictt); 9105 9106 smallDictt *r2 = self->f->setDouble(self, "1", 2.2); 9107 ck_assert_ptr_ne(r2, null); 9108 r = getNDupSmallDoubleKCharSmallDictG(self, null, '1'); 9109 ck_assert_ptr_ne(r, null); 9110 char *s = toStringO(r); 9111 terminateO(r); 9112 ck_assert_str_eq(s, "2.200000e+00"); 9113 free(s); 9114 terminateO(self); 9115 9116 END_TEST 9117 9118 9119 START_TEST(getNDupSmallIntKCharSmallDictGT) 9120 9121 smallIntt* r; 9122 smallDictt *self = allocG(rtSmallDictt); 9123 9124 smallDictt *r2 = self->f->setInt(self, "1", 2); 9125 ck_assert_ptr_ne(r2, null); 9126 r = getNDupSmallIntKCharSmallDictG(self, null, '1'); 9127 ck_assert_ptr_ne(r, null); 9128 char *s = toStringO(r); 9129 terminateO(r); 9130 ck_assert_str_eq(s, "2"); 9131 free(s); 9132 terminateO(self); 9133 9134 END_TEST 9135 9136 9137 START_TEST(getNDupSmallJsonKCharSmallDictGT) 9138 9139 smallJsont* r; 9140 smallDictt *self = allocG(rtSmallDictt); 9141 smallJsont *value = allocSmallJson(); 9142 9143 setTopIntO(value, 2); 9144 smallDictt *r2 = self->f->setNFreeSmallJson(self, "1", value); 9145 ck_assert_ptr_ne(r2, null); 9146 r = getNDupSmallJsonKCharSmallDictG(self, null, '1'); 9147 ck_assert_ptr_ne(r, null); 9148 char *s = toStringO(r); 9149 terminateO(r); 9150 ck_assert_str_eq(s, "2"); 9151 free(s); 9152 terminateO(self); 9153 9154 END_TEST 9155 9156 9157 START_TEST(getNDupSmallStringKCharSmallDictGT) 9158 9159 smallStringt* r; 9160 smallDictt *self = allocG(rtSmallDictt); 9161 9162 smallDictt *r2 = self->f->setS(self, "1", "qwe"); 9163 ck_assert_ptr_ne(r2, null); 9164 r = getNDupSmallStringKCharSmallDictG(self, null, '1'); 9165 ck_assert_ptr_ne(r, null); 9166 char *s = toStringO(r); 9167 terminateO(r); 9168 ck_assert_str_eq(s, "qwe"); 9169 free(s); 9170 terminateO(self); 9171 9172 END_TEST 9173 9174 9175 START_TEST(getNDupVoidKCharSmallDictGT) 9176 9177 void* r; 9178 smallDictt *self = allocG(rtSmallDictt); 9179 9180 createSmallContainer(c); 9181 setValO(&c, &r); 9182 smallDictt *r2 = self->f->setSmallContainer(self, "1", &c); 9183 ck_assert_ptr_ne(r2, null); 9184 r = getNDupVoidKCharSmallDictG(self, null, '1'); 9185 ck_assert_ptr_eq(r, null); 9186 terminateO(self); 9187 9188 END_TEST 9189 9190 9191 START_TEST(getNDupSmallContainerKCharSmallDictGT) 9192 9193 smallContainert* r; 9194 smallDictt *self = allocG(rtSmallDictt); 9195 9196 createSmallContainer(c); 9197 setValO(&c, &r); 9198 smallDictt *r2 = self->f->setSmallContainer(self, "1", &c); 9199 ck_assert_ptr_ne(r2, null); 9200 r = getNDupSmallContainerKCharSmallDictG(self, null, '1'); 9201 ck_assert_ptr_ne(r, null); 9202 char *s = toStringO(r); 9203 terminateO(r); 9204 ck_assert_str_eq(s, "<data smallContainer>"); 9205 free(s); 9206 terminateO(self); 9207 9208 END_TEST 9209 9210 9211 START_TEST(setUndefinedSmallDictGT) 9212 9213 smallDictt* r; 9214 smallDictt *self = allocG(rtSmallDictt); 9215 9216 r = setUndefinedSmallDictG(self, "1", null); 9217 ck_assert_ptr_ne(r, null); 9218 char *s = toStringO(r); 9219 ck_assert_str_eq(s, "{\"1\":null}"); 9220 free(s); 9221 terminateO(self); 9222 9223 END_TEST 9224 9225 9226 START_TEST(setBoolSmallDictGT) 9227 9228 smallDictt* r; 9229 smallDictt *self = allocG(rtSmallDictt); 9230 9231 r = setBoolSmallDictG(self, "1", true); 9232 ck_assert_ptr_ne(r, null); 9233 char *s = toStringO(r); 9234 ck_assert_str_eq(s, "{\"1\":true}"); 9235 free(s); 9236 terminateO(self); 9237 9238 END_TEST 9239 9240 9241 START_TEST(setDoubleSmallDictGT) 9242 9243 smallDictt* r; 9244 smallDictt *self = allocG(rtSmallDictt); 9245 9246 r = setDoubleSmallDictG(self, "1", 2.2); 9247 ck_assert_ptr_ne(r, null); 9248 char *s = toStringO(r); 9249 ck_assert_str_eq(s, "{\"1\":2.200000e+00}"); 9250 free(s); 9251 terminateO(self); 9252 9253 END_TEST 9254 9255 9256 START_TEST(setIntSmallDictGT) 9257 9258 smallDictt* r; 9259 smallDictt *self = allocG(rtSmallDictt); 9260 9261 r = setIntSmallDictG(self, "1", 2); 9262 ck_assert_ptr_ne(r, null); 9263 char *s = toStringO(r); 9264 ck_assert_str_eq(s, "{\"1\":2}"); 9265 free(s); 9266 terminateO(self); 9267 9268 END_TEST 9269 9270 9271 START_TEST(setSSmallDictGT) 9272 9273 smallDictt* r; 9274 smallDictt *self = allocG(rtSmallDictt); 9275 9276 r = setSSmallDictG(self, "1", "qwe"); 9277 ck_assert_ptr_ne(r, null); 9278 char *s = toStringO(r); 9279 ck_assert_str_eq(s, "{\"1\":\"qwe\"}"); 9280 free(s); 9281 terminateO(self); 9282 9283 END_TEST 9284 9285 9286 START_TEST(setCharSmallDictGT) 9287 9288 smallDictt* r; 9289 smallDictt *self = allocG(rtSmallDictt); 9290 9291 r = setCharSmallDictG(self, "1", 'x'); 9292 ck_assert_ptr_ne(r, null); 9293 char *s = toStringO(r); 9294 ck_assert_str_eq(s, "{\"1\":\"x\"}"); 9295 free(s); 9296 terminateO(self); 9297 9298 END_TEST 9299 9300 9301 START_TEST(setDictSmallDictGT) 9302 9303 smallDictt* r; 9304 smallDictt *self = allocG(rtSmallDictt); 9305 smallDictt *dict = allocSmallDict(); 9306 9307 r = setDictSmallDictG(self, "1", dict); 9308 ck_assert_ptr_ne(r, null); 9309 finishO(dict); 9310 char *s = toStringO(r); 9311 ck_assert_str_eq(s, "{\"1\":{}}"); 9312 free(s); 9313 terminateO(self); 9314 9315 END_TEST 9316 9317 9318 START_TEST(setArraySmallDictGT) 9319 9320 smallDictt* r; 9321 smallDictt *self = allocG(rtSmallDictt); 9322 smallArrayt *array = allocSmallArray(); 9323 9324 r = setArraySmallDictG(self, "1", array); 9325 ck_assert_ptr_ne(r, null); 9326 finishO(array); 9327 char *s = toStringO(r); 9328 ck_assert_str_eq(s, "{\"1\":[]}"); 9329 free(s); 9330 terminateO(self); 9331 9332 END_TEST 9333 9334 9335 START_TEST(setArraycSmallDictGT) 9336 9337 smallDictt* r; 9338 smallDictt *self = allocG(rtSmallDictt); 9339 char **array = listCreateS("a", "b"); 9340 9341 r = setArraycSmallDictG(self, "1", array); 9342 ck_assert_ptr_ne(r, null); 9343 listFreeS(array); 9344 char *s = toStringO(r); 9345 ck_assert_str_eq(s, "{\"1\":[\"a\",\"b\"]}"); 9346 free(s); 9347 terminateO(self); 9348 9349 END_TEST 9350 9351 9352 START_TEST(setCArraycSmallDictGT) 9353 9354 smallDictt* r; 9355 smallDictt *self = allocG(rtSmallDictt); 9356 const char *array[] = {"a", "b", null}; 9357 9358 r = setCArraycSmallDictG(self, "1", array); 9359 ck_assert_ptr_ne(r, null); 9360 char *s = toStringO(r); 9361 ck_assert_str_eq(s, "{\"1\":[\"a\",\"b\"]}"); 9362 free(s); 9363 terminateO(self); 9364 9365 END_TEST 9366 9367 9368 START_TEST(setVoidSmallDictGT) 9369 9370 smallDictt* r; 9371 smallDictt *self = allocG(rtSmallDictt); 9372 9373 r = setVoidSmallDictG(self, "1", null); 9374 ck_assert_ptr_ne(r, null); 9375 char *s = toStringO(r); 9376 ck_assert_str_eq(s, "{\"1\":null}"); 9377 free(s); 9378 r = setVoidSmallDictG(self, "1", &r); 9379 ck_assert_ptr_ne(r, null); 9380 s = toStringO(r); 9381 ck_assert_str_eq(s, "{\"1\":\"<data container>\"}"); 9382 free(s); 9383 // null key 9384 r = setVoidSmallDictG(self, null, &r); 9385 ck_assert_ptr_eq(r, null); 9386 terminateO(self); 9387 9388 END_TEST 9389 9390 9391 START_TEST(setSmallBoolSmallDictGT) 9392 9393 smallDictt* r; 9394 smallDictt *self = allocG(rtSmallDictt); 9395 smallBoolt *value = allocSmallBool(true); 9396 9397 r = setSmallBoolSmallDictG(self, "1", value); 9398 ck_assert_ptr_ne(r, null); 9399 finishO(value); 9400 char *s = toStringO(r); 9401 ck_assert_str_eq(s, "{\"1\":true}"); 9402 free(s); 9403 terminateO(self); 9404 9405 END_TEST 9406 9407 9408 START_TEST(setSmallBytesSmallDictGT) 9409 9410 smallDictt* r; 9411 smallDictt *self = allocG(rtSmallDictt); 9412 smallBytest *value = allocSmallBytes("qwe", sizeof("qwe")); 9413 9414 r = setSmallBytesSmallDictG(self, "1", value); 9415 ck_assert_ptr_ne(r, null); 9416 finishO(value); 9417 char *s = toStringO(r); 9418 ck_assert_str_eq(s, "{\"1\":[0x71,0x77,0x65,0x00]}"); 9419 free(s); 9420 terminateO(self); 9421 9422 END_TEST 9423 9424 9425 START_TEST(setSmallDoubleSmallDictGT) 9426 9427 smallDictt* r; 9428 smallDictt *self = allocG(rtSmallDictt); 9429 smallDoublet *value = allocSmallDouble(2.2); 9430 9431 r = setSmallDoubleSmallDictG(self, "1", value); 9432 ck_assert_ptr_ne(r, null); 9433 finishO(value); 9434 char *s = toStringO(r); 9435 ck_assert_str_eq(s, "{\"1\":2.200000e+00}"); 9436 free(s); 9437 terminateO(self); 9438 9439 END_TEST 9440 9441 9442 START_TEST(setSmallIntSmallDictGT) 9443 9444 smallDictt* r; 9445 smallDictt *self = allocG(rtSmallDictt); 9446 smallIntt *value = allocSmallInt(2); 9447 9448 r = setSmallIntSmallDictG(self, "1", value); 9449 ck_assert_ptr_ne(r, null); 9450 finishO(value); 9451 char *s = toStringO(r); 9452 ck_assert_str_eq(s, "{\"1\":2}"); 9453 free(s); 9454 terminateO(self); 9455 9456 END_TEST 9457 9458 9459 START_TEST(setSmallJsonSmallDictGT) 9460 9461 smallDictt* r; 9462 smallDictt *self = allocG(rtSmallDictt); 9463 smallJsont *value = allocSmallJson(); 9464 9465 setTopIntO(value, 2); 9466 r = setSmallJsonSmallDictG(self, "1", value); 9467 ck_assert_ptr_ne(r, null); 9468 finishO(value); 9469 char *s = toStringO(r); 9470 ck_assert_str_eq(s, "{\"1\":2}"); 9471 free(s); 9472 terminateO(self); 9473 9474 END_TEST 9475 9476 9477 START_TEST(setSmallStringSmallDictGT) 9478 9479 smallDictt* r; 9480 smallDictt *self = allocG(rtSmallDictt); 9481 smallStringt *string = allocSmallString("qwe"); 9482 9483 r = setSmallStringSmallDictG(self, "1", string); 9484 ck_assert_ptr_ne(r, null); 9485 finishO(string); 9486 char *s = toStringO(r); 9487 ck_assert_str_eq(s, "{\"1\":\"qwe\"}"); 9488 free(s); 9489 terminateO(self); 9490 9491 END_TEST 9492 9493 9494 START_TEST(setSmallContainerSmallDictGT) 9495 9496 smallDictt* r; 9497 smallDictt *self = allocG(rtSmallDictt); 9498 smallContainert *container = allocSmallContainer(null); 9499 9500 r = setSmallContainerSmallDictG(self, "1", container); 9501 ck_assert_ptr_ne(r, null); 9502 finishO(container); 9503 char *s = toStringO(r); 9504 ck_assert_str_eq(s, "{\"1\":\"<data container>\"}"); 9505 free(s); 9506 terminateO(self); 9507 9508 END_TEST 9509 9510 9511 START_TEST(setKCharSmallDictGT) 9512 9513 smallDictt* r; 9514 smallDictt *self = allocG(rtSmallDictt); 9515 baset *value = (baset*) allocSmallInt(2); 9516 9517 r = setKCharSmallDictG(self, '1', value); 9518 ck_assert_ptr_ne(r, null); 9519 finishO(value); 9520 char *s = toStringO(r); 9521 ck_assert_str_eq(s, "{\"1\":2}"); 9522 free(s); 9523 terminateO(self); 9524 9525 END_TEST 9526 9527 9528 START_TEST(setUndefinedKCharSmallDictGT) 9529 9530 smallDictt* r; 9531 smallDictt *self = allocG(rtSmallDictt); 9532 9533 r = setUndefinedKCharSmallDictG(self, '1', null); 9534 ck_assert_ptr_ne(r, null); 9535 char *s = toStringO(r); 9536 ck_assert_str_eq(s, "{\"1\":null}"); 9537 free(s); 9538 terminateO(self); 9539 9540 END_TEST 9541 9542 9543 START_TEST(setBoolKCharSmallDictGT) 9544 9545 smallDictt* r; 9546 smallDictt *self = allocG(rtSmallDictt); 9547 9548 r = setBoolKCharSmallDictG(self, '1', true); 9549 ck_assert_ptr_ne(r, null); 9550 char *s = toStringO(r); 9551 ck_assert_str_eq(s, "{\"1\":true}"); 9552 free(s); 9553 terminateO(self); 9554 9555 END_TEST 9556 9557 9558 START_TEST(setDoubleKCharSmallDictGT) 9559 9560 smallDictt* r; 9561 smallDictt *self = allocG(rtSmallDictt); 9562 9563 r = setDoubleKCharSmallDictG(self, '1', 2.2); 9564 ck_assert_ptr_ne(r, null); 9565 char *s = toStringO(r); 9566 ck_assert_str_eq(s, "{\"1\":2.200000e+00}"); 9567 free(s); 9568 terminateO(self); 9569 9570 END_TEST 9571 9572 9573 START_TEST(setIntKCharSmallDictGT) 9574 9575 smallDictt* r; 9576 smallDictt *self = allocG(rtSmallDictt); 9577 9578 r = setIntKCharSmallDictG(self, '1', 2); 9579 ck_assert_ptr_ne(r, null); 9580 char *s = toStringO(r); 9581 ck_assert_str_eq(s, "{\"1\":2}"); 9582 free(s); 9583 terminateO(self); 9584 9585 END_TEST 9586 9587 9588 START_TEST(setSKCharSmallDictGT) 9589 9590 smallDictt* r; 9591 smallDictt *self = allocG(rtSmallDictt); 9592 9593 r = setSKCharSmallDictG(self, '1', "qwe"); 9594 ck_assert_ptr_ne(r, null); 9595 char *s = toStringO(r); 9596 ck_assert_str_eq(s, "{\"1\":\"qwe\"}"); 9597 free(s); 9598 terminateO(self); 9599 9600 END_TEST 9601 9602 9603 START_TEST(setCharKCharSmallDictGT) 9604 9605 smallDictt* r; 9606 smallDictt *self = allocG(rtSmallDictt); 9607 9608 r = setCharKCharSmallDictG(self, '1', 'x'); 9609 ck_assert_ptr_ne(r, null); 9610 char *s = toStringO(r); 9611 ck_assert_str_eq(s, "{\"1\":\"x\"}"); 9612 free(s); 9613 terminateO(self); 9614 9615 END_TEST 9616 9617 9618 START_TEST(setDictKCharSmallDictGT) 9619 9620 smallDictt* r; 9621 smallDictt *self = allocG(rtSmallDictt); 9622 smallDictt *dict = allocSmallDict(); 9623 9624 r = setDictKCharSmallDictG(self, '1', dict); 9625 ck_assert_ptr_ne(r, null); 9626 finishO(dict); 9627 char *s = toStringO(r); 9628 ck_assert_str_eq(s, "{\"1\":{}}"); 9629 free(s); 9630 terminateO(self); 9631 9632 END_TEST 9633 9634 9635 START_TEST(setArrayKCharSmallDictGT) 9636 9637 smallDictt* r; 9638 smallDictt *self = allocG(rtSmallDictt); 9639 smallArrayt *array = allocSmallArray(); 9640 9641 r = setArrayKCharSmallDictG(self, '1', array); 9642 ck_assert_ptr_ne(r, null); 9643 finishO(array); 9644 char *s = toStringO(r); 9645 ck_assert_str_eq(s, "{\"1\":[]}"); 9646 free(s); 9647 terminateO(self); 9648 9649 END_TEST 9650 9651 9652 START_TEST(setArraycKCharSmallDictGT) 9653 9654 smallDictt* r; 9655 smallDictt *self = allocG(rtSmallDictt); 9656 char **array = listCreateS("a", "b"); 9657 9658 r = setArraycKCharSmallDictG(self, '1', array); 9659 ck_assert_ptr_ne(r, null); 9660 listFreeS(array); 9661 char *s = toStringO(r); 9662 ck_assert_str_eq(s, "{\"1\":[\"a\",\"b\"]}"); 9663 free(s); 9664 terminateO(self); 9665 9666 END_TEST 9667 9668 9669 START_TEST(setCArraycKCharSmallDictGT) 9670 9671 smallDictt* r; 9672 smallDictt *self = allocG(rtSmallDictt); 9673 const char *array[] = {"a", "b", null}; 9674 9675 r = setCArraycKCharSmallDictG(self, '1', array); 9676 ck_assert_ptr_ne(r, null); 9677 char *s = toStringO(r); 9678 ck_assert_str_eq(s, "{\"1\":[\"a\",\"b\"]}"); 9679 free(s); 9680 terminateO(self); 9681 9682 END_TEST 9683 9684 9685 START_TEST(setVoidKCharSmallDictGT) 9686 9687 smallDictt* r; 9688 smallDictt *self = allocG(rtSmallDictt); 9689 9690 r = setVoidKCharSmallDictG(self, '1', null); 9691 ck_assert_ptr_ne(r, null); 9692 char *s = toStringO(r); 9693 ck_assert_str_eq(s, "{\"1\":null}"); 9694 free(s); 9695 terminateO(self); 9696 9697 END_TEST 9698 9699 9700 START_TEST(setSmallBoolKCharSmallDictGT) 9701 9702 smallDictt* r; 9703 smallDictt *self = allocG(rtSmallDictt); 9704 smallBoolt *value = allocSmallBool(true); 9705 9706 r = setSmallBoolKCharSmallDictG(self, '1', value); 9707 ck_assert_ptr_ne(r, null); 9708 finishO(value); 9709 char *s = toStringO(r); 9710 ck_assert_str_eq(s, "{\"1\":true}"); 9711 free(s); 9712 terminateO(self); 9713 9714 END_TEST 9715 9716 9717 START_TEST(setSmallBytesKCharSmallDictGT) 9718 9719 smallDictt* r; 9720 smallDictt *self = allocG(rtSmallDictt); 9721 smallBytest *value = allocSmallBytes("qwe", sizeof("qwe")); 9722 9723 r = setSmallBytesKCharSmallDictG(self, '1', value); 9724 ck_assert_ptr_ne(r, null); 9725 finishO(value); 9726 char *s = toStringO(r); 9727 ck_assert_str_eq(s, "{\"1\":[0x71,0x77,0x65,0x00]}"); 9728 free(s); 9729 terminateO(self); 9730 9731 END_TEST 9732 9733 9734 START_TEST(setSmallDoubleKCharSmallDictGT) 9735 9736 smallDictt* r; 9737 smallDictt *self = allocG(rtSmallDictt); 9738 smallDoublet *value = allocSmallDouble(2.2); 9739 9740 r = setSmallDoubleKCharSmallDictG(self, '1', value); 9741 ck_assert_ptr_ne(r, null); 9742 finishO(value); 9743 char *s = toStringO(r); 9744 ck_assert_str_eq(s, "{\"1\":2.200000e+00}"); 9745 free(s); 9746 terminateO(self); 9747 9748 END_TEST 9749 9750 9751 START_TEST(setSmallIntKCharSmallDictGT) 9752 9753 smallDictt* r; 9754 smallDictt *self = allocG(rtSmallDictt); 9755 smallIntt *value = allocSmallInt(2); 9756 9757 r = setSmallIntKCharSmallDictG(self, '1', value); 9758 ck_assert_ptr_ne(r, null); 9759 finishO(value); 9760 char *s = toStringO(r); 9761 ck_assert_str_eq(s, "{\"1\":2}"); 9762 free(s); 9763 terminateO(self); 9764 9765 END_TEST 9766 9767 9768 START_TEST(setSmallJsonKCharSmallDictGT) 9769 9770 smallDictt* r; 9771 smallDictt *self = allocG(rtSmallDictt); 9772 smallJsont *value = allocSmallJson(); 9773 9774 setTopIntO(value, 2); 9775 r = setSmallJsonKCharSmallDictG(self, '1', value); 9776 ck_assert_ptr_ne(r, null); 9777 finishO(value); 9778 char *s = toStringO(r); 9779 ck_assert_str_eq(s, "{\"1\":2}"); 9780 free(s); 9781 terminateO(self); 9782 9783 END_TEST 9784 9785 9786 START_TEST(setSmallStringKCharSmallDictGT) 9787 9788 smallDictt* r; 9789 smallDictt *self = allocG(rtSmallDictt); 9790 smallStringt *string = allocSmallString("qwe"); 9791 9792 r = setSmallStringKCharSmallDictG(self, '1', string); 9793 ck_assert_ptr_ne(r, null); 9794 finishO(string); 9795 char *s = toStringO(r); 9796 ck_assert_str_eq(s, "{\"1\":\"qwe\"}"); 9797 free(s); 9798 terminateO(self); 9799 9800 END_TEST 9801 9802 9803 START_TEST(setSmallContainerKCharSmallDictGT) 9804 9805 smallDictt* r; 9806 smallDictt *self = allocG(rtSmallDictt); 9807 smallContainert *container = allocSmallContainer(null); 9808 9809 r = setSmallContainerKCharSmallDictG(self, '1', container); 9810 ck_assert_ptr_ne(r, null); 9811 finishO(container); 9812 char *s = toStringO(r); 9813 ck_assert_str_eq(s, "{\"1\":\"<data container>\"}"); 9814 free(s); 9815 terminateO(self); 9816 9817 END_TEST 9818 9819 9820 START_TEST(setNFreeSmallDictGT) 9821 9822 smallDictt* r; 9823 smallDictt *self = allocG(rtSmallDictt); 9824 baset *value; 9825 9826 value = (baset*)allocUndefined(); 9827 r = setNFreeSmallDictG(self, "1", value); 9828 ck_assert_ptr_ne(r, null); 9829 char *s = toStringO(r); 9830 ck_assert_str_eq(s, "{\"1\":null}"); 9831 free(s); 9832 terminateO(self); 9833 9834 END_TEST 9835 9836 9837 START_TEST(setNFreeUndefinedSmallDictGT) 9838 9839 smallDictt* r; 9840 smallDictt *self = allocG(rtSmallDictt); 9841 undefinedt *undefined = allocUndefined(); 9842 9843 r = setNFreeUndefinedSmallDictG(self, "1", undefined); 9844 ck_assert_ptr_ne(r, null); 9845 char *s = toStringO(r); 9846 ck_assert_str_eq(s, "{\"1\":null}"); 9847 free(s); 9848 terminateO(self); 9849 9850 END_TEST 9851 9852 9853 START_TEST(setNFreeSSmallDictGT) 9854 9855 smallDictt* r; 9856 smallDictt *self = allocG(rtSmallDictt); 9857 char *string = strdup("qwe"); 9858 9859 r = setNFreeSSmallDictG(self, "1", string); 9860 ck_assert_ptr_ne(r, null); 9861 char *s = toStringO(r); 9862 ck_assert_str_eq(s, "{\"1\":\"qwe\"}"); 9863 free(s); 9864 terminateO(self); 9865 9866 END_TEST 9867 9868 9869 START_TEST(setNFreeDictSmallDictGT) 9870 9871 smallDictt* r; 9872 smallDictt *self = allocG(rtSmallDictt); 9873 smallDictt *dict = allocSmallDict(); 9874 9875 r = setNFreeDictSmallDictG(self, "1", dict); 9876 ck_assert_ptr_ne(r, null); 9877 char *s = toStringO(r); 9878 ck_assert_str_eq(s, "{\"1\":{}}"); 9879 free(s); 9880 terminateO(self); 9881 9882 END_TEST 9883 9884 9885 START_TEST(setNFreeArraySmallDictGT) 9886 9887 smallDictt* r; 9888 smallDictt *self = allocG(rtSmallDictt); 9889 smallArrayt *array = allocSmallArray(); 9890 9891 r = setNFreeArraySmallDictG(self, "1", array); 9892 ck_assert_ptr_ne(r, null); 9893 char *s = toStringO(r); 9894 ck_assert_str_eq(s, "{\"1\":[]}"); 9895 free(s); 9896 terminateO(self); 9897 9898 END_TEST 9899 9900 9901 START_TEST(setNFreeArraycSmallDictGT) 9902 9903 smallDictt* r; 9904 smallDictt *self = allocG(rtSmallDictt); 9905 char **array = listCreateS("a", "b"); 9906 9907 r = setNFreeArraycSmallDictG(self, "1", array); 9908 ck_assert_ptr_ne(r, null); 9909 char *s = toStringO(r); 9910 ck_assert_str_eq(s, "{\"1\":[\"a\",\"b\"]}"); 9911 free(s); 9912 terminateO(self); 9913 9914 END_TEST 9915 9916 9917 START_TEST(setNFreeSmallBoolSmallDictGT) 9918 9919 smallDictt* r; 9920 smallDictt *self = allocG(rtSmallDictt); 9921 smallBoolt *value = allocSmallBool(true); 9922 9923 r = setNFreeSmallBoolSmallDictG(self, "1", value); 9924 ck_assert_ptr_ne(r, null); 9925 char *s = toStringO(r); 9926 ck_assert_str_eq(s, "{\"1\":true}"); 9927 free(s); 9928 terminateO(self); 9929 9930 END_TEST 9931 9932 9933 START_TEST(setNFreeSmallBytesSmallDictGT) 9934 9935 smallDictt* r; 9936 smallDictt *self = allocG(rtSmallDictt); 9937 smallBytest *value = allocSmallBytes("qwe", sizeof("qwe")); 9938 9939 r = setNFreeSmallBytesSmallDictG(self, "1", value); 9940 ck_assert_ptr_ne(r, null); 9941 char *s = toStringO(r); 9942 ck_assert_str_eq(s, "{\"1\":[0x71,0x77,0x65,0x00]}"); 9943 free(s); 9944 terminateO(self); 9945 9946 END_TEST 9947 9948 9949 START_TEST(setNFreeSmallDoubleSmallDictGT) 9950 9951 smallDictt* r; 9952 smallDictt *self = allocG(rtSmallDictt); 9953 smallDoublet *value = allocSmallDouble(2.2); 9954 9955 r = setNFreeSmallDoubleSmallDictG(self, "1", value); 9956 ck_assert_ptr_ne(r, null); 9957 char *s = toStringO(r); 9958 ck_assert_str_eq(s, "{\"1\":2.200000e+00}"); 9959 free(s); 9960 terminateO(self); 9961 9962 END_TEST 9963 9964 9965 START_TEST(setNFreeSmallIntSmallDictGT) 9966 9967 smallDictt* r; 9968 smallDictt *self = allocG(rtSmallDictt); 9969 smallIntt *value = allocSmallInt(2); 9970 9971 r = setNFreeSmallIntSmallDictG(self, "1", value); 9972 ck_assert_ptr_ne(r, null); 9973 char *s = toStringO(r); 9974 ck_assert_str_eq(s, "{\"1\":2}"); 9975 free(s); 9976 terminateO(self); 9977 9978 END_TEST 9979 9980 9981 START_TEST(setNFreeSmallJsonSmallDictGT) 9982 9983 smallDictt* r; 9984 smallDictt *self = allocG(rtSmallDictt); 9985 smallJsont *value = allocSmallJson(); 9986 9987 setTopIntO(value, 2); 9988 r = setNFreeSmallJsonSmallDictG(self, "1", value); 9989 ck_assert_ptr_ne(r, null); 9990 char *s = toStringO(r); 9991 ck_assert_str_eq(s, "{\"1\":2}"); 9992 free(s); 9993 terminateO(self); 9994 9995 END_TEST 9996 9997 9998 START_TEST(setNFreeSmallStringSmallDictGT) 9999 10000 smallDictt* r; 10001 smallDictt *self = allocG(rtSmallDictt); 10002 smallStringt *string = allocSmallString("qwe"); 10003 10004 r = setNFreeSmallStringSmallDictG(self, "1", string); 10005 ck_assert_ptr_ne(r, null); 10006 char *s = toStringO(r); 10007 ck_assert_str_eq(s, "{\"1\":\"qwe\"}"); 10008 free(s); 10009 terminateO(self); 10010 10011 END_TEST 10012 10013 10014 START_TEST(setNFreeSmallContainerSmallDictGT) 10015 10016 smallDictt* r; 10017 smallDictt *self = allocG(rtSmallDictt); 10018 smallContainert *container = allocSmallContainer(null); 10019 10020 r = setNFreeSmallContainerSmallDictG(self, "1", container); 10021 ck_assert_ptr_ne(r, null); 10022 char *s = toStringO(r); 10023 ck_assert_str_eq(s, "{\"1\":\"<data container>\"}"); 10024 free(s); 10025 terminateO(self); 10026 10027 END_TEST 10028 10029 10030 START_TEST(setNFreeKCharSmallDictGT) 10031 10032 smallDictt* r; 10033 smallDictt *self = allocG(rtSmallDictt); 10034 baset *value; 10035 10036 value = (baset*)allocUndefined(); 10037 r = setNFreeKCharSmallDictG(self, '1', value); 10038 ck_assert_ptr_ne(r, null); 10039 char *s = toStringO(r); 10040 ck_assert_str_eq(s, "{\"1\":null}"); 10041 free(s); 10042 terminateO(self); 10043 10044 END_TEST 10045 10046 10047 START_TEST(setNFreeUndefinedKCharSmallDictGT) 10048 10049 smallDictt* r; 10050 smallDictt *self = allocG(rtSmallDictt); 10051 undefinedt *undefined = allocUndefined(); 10052 10053 r = setNFreeUndefinedKCharSmallDictG(self, '1', undefined); 10054 ck_assert_ptr_ne(r, null); 10055 char *s = toStringO(r); 10056 ck_assert_str_eq(s, "{\"1\":null}"); 10057 free(s); 10058 terminateO(self); 10059 10060 END_TEST 10061 10062 10063 START_TEST(setNFreeSKCharSmallDictGT) 10064 10065 smallDictt* r; 10066 smallDictt *self = allocG(rtSmallDictt); 10067 char *string = strdup("qwe"); 10068 10069 r = setNFreeSKCharSmallDictG(self, '1', string); 10070 ck_assert_ptr_ne(r, null); 10071 char *s = toStringO(r); 10072 ck_assert_str_eq(s, "{\"1\":\"qwe\"}"); 10073 free(s); 10074 terminateO(self); 10075 10076 END_TEST 10077 10078 10079 START_TEST(setNFreeDictKCharSmallDictGT) 10080 10081 smallDictt* r; 10082 smallDictt *self = allocG(rtSmallDictt); 10083 smallDictt *dict = allocSmallDict(); 10084 10085 r = setNFreeDictKCharSmallDictG(self, '1', dict); 10086 ck_assert_ptr_ne(r, null); 10087 char *s = toStringO(r); 10088 ck_assert_str_eq(s, "{\"1\":{}}"); 10089 free(s); 10090 terminateO(self); 10091 10092 END_TEST 10093 10094 10095 START_TEST(setNFreeArrayKCharSmallDictGT) 10096 10097 smallDictt* r; 10098 smallDictt *self = allocG(rtSmallDictt); 10099 smallArrayt *array = allocSmallArray(); 10100 10101 r = setNFreeArrayKCharSmallDictG(self, '1', array); 10102 ck_assert_ptr_ne(r, null); 10103 char *s = toStringO(r); 10104 ck_assert_str_eq(s, "{\"1\":[]}"); 10105 free(s); 10106 terminateO(self); 10107 10108 END_TEST 10109 10110 10111 START_TEST(setNFreeArraycKCharSmallDictGT) 10112 10113 smallDictt* r; 10114 smallDictt *self = allocG(rtSmallDictt); 10115 char **array = listCreateS("a", "b"); 10116 10117 r = setNFreeArraycKCharSmallDictG(self, '1', array); 10118 ck_assert_ptr_ne(r, null); 10119 char *s = toStringO(r); 10120 ck_assert_str_eq(s, "{\"1\":[\"a\",\"b\"]}"); 10121 free(s); 10122 terminateO(self); 10123 10124 END_TEST 10125 10126 10127 START_TEST(setNFreeSmallBoolKCharSmallDictGT) 10128 10129 smallDictt* r; 10130 smallDictt *self = allocG(rtSmallDictt); 10131 smallBoolt *value = allocSmallBool(true); 10132 10133 r = setNFreeSmallBoolKCharSmallDictG(self, '1', value); 10134 ck_assert_ptr_ne(r, null); 10135 char *s = toStringO(r); 10136 ck_assert_str_eq(s, "{\"1\":true}"); 10137 free(s); 10138 terminateO(self); 10139 10140 END_TEST 10141 10142 10143 START_TEST(setNFreeSmallBytesKCharSmallDictGT) 10144 10145 smallDictt* r; 10146 smallDictt *self = allocG(rtSmallDictt); 10147 smallBytest *value = allocSmallBytes("qwe", sizeof("qwe")); 10148 10149 r = setNFreeSmallBytesKCharSmallDictG(self, '1', value); 10150 ck_assert_ptr_ne(r, null); 10151 char *s = toStringO(r); 10152 ck_assert_str_eq(s, "{\"1\":[0x71,0x77,0x65,0x00]}"); 10153 free(s); 10154 terminateO(self); 10155 10156 END_TEST 10157 10158 10159 START_TEST(setNFreeSmallDoubleKCharSmallDictGT) 10160 10161 smallDictt* r; 10162 smallDictt *self = allocG(rtSmallDictt); 10163 smallDoublet *value = allocSmallDouble(2.2); 10164 10165 r = setNFreeSmallDoubleKCharSmallDictG(self, '1', value); 10166 ck_assert_ptr_ne(r, null); 10167 char *s = toStringO(r); 10168 ck_assert_str_eq(s, "{\"1\":2.200000e+00}"); 10169 free(s); 10170 terminateO(self); 10171 10172 END_TEST 10173 10174 10175 START_TEST(setNFreeSmallIntKCharSmallDictGT) 10176 10177 smallDictt* r; 10178 smallDictt *self = allocG(rtSmallDictt); 10179 smallIntt *value = allocSmallInt(2); 10180 10181 r = setNFreeSmallIntKCharSmallDictG(self, '1', value); 10182 ck_assert_ptr_ne(r, null); 10183 char *s = toStringO(r); 10184 ck_assert_str_eq(s, "{\"1\":2}"); 10185 free(s); 10186 terminateO(self); 10187 10188 END_TEST 10189 10190 10191 START_TEST(setNFreeSmallJsonKCharSmallDictGT) 10192 10193 smallDictt* r; 10194 smallDictt *self = allocG(rtSmallDictt); 10195 smallJsont *value = allocSmallJson(); 10196 10197 setTopIntO(value, 2); 10198 r = setNFreeSmallJsonKCharSmallDictG(self, '1', value); 10199 ck_assert_ptr_ne(r, null); 10200 char *s = toStringO(r); 10201 ck_assert_str_eq(s, "{\"1\":2}"); 10202 free(s); 10203 terminateO(self); 10204 10205 END_TEST 10206 10207 10208 START_TEST(setNFreeSmallStringKCharSmallDictGT) 10209 10210 smallDictt* r; 10211 smallDictt *self = allocG(rtSmallDictt); 10212 smallStringt *string = allocSmallString("qwe"); 10213 10214 r = setNFreeSmallStringKCharSmallDictG(self, '1', string); 10215 ck_assert_ptr_ne(r, null); 10216 char *s = toStringO(r); 10217 ck_assert_str_eq(s, "{\"1\":\"qwe\"}"); 10218 free(s); 10219 terminateO(self); 10220 10221 END_TEST 10222 10223 10224 START_TEST(setNFreeSmallContainerKCharSmallDictGT) 10225 10226 smallDictt* r; 10227 smallDictt *self = allocG(rtSmallDictt); 10228 smallContainert *container = allocSmallContainer(null); 10229 10230 r = setNFreeSmallContainerKCharSmallDictG(self, '1', container); 10231 ck_assert_ptr_ne(r, null); 10232 char *s = toStringO(r); 10233 ck_assert_str_eq(s, "{\"1\":\"<data container>\"}"); 10234 free(s); 10235 terminateO(self); 10236 10237 END_TEST 10238 10239 10240 START_TEST(setPDictSmallDictGT) 10241 10242 smallDictt* r; 10243 smallDictt *self = allocG(rtSmallDictt); 10244 smallDictt *dict; 10245 10246 dict = allocSmallDict(); 10247 r = self->f->setDict(self, "1", dict); 10248 ck_assert_ptr_ne(r, null); 10249 dict->f->setInt(dict, "a", 1); 10250 r = setPDictSmallDictG(self, "1", dict); 10251 ck_assert_ptr_ne(r, null); 10252 char *s = toStringO(r); 10253 ck_assert_str_eq(s, "{\"1\":{\"a\":1}}"); 10254 free(s); 10255 finishO(dict); 10256 terminateO(self); 10257 10258 END_TEST 10259 10260 10261 START_TEST(setPArraySmallDictGT) 10262 10263 smallDictt* r; 10264 smallDictt *self = allocG(rtSmallDictt); 10265 smallArrayt *array; 10266 10267 array = allocSmallArray(); 10268 r = self->f->setArray(self, "1", array); 10269 ck_assert_ptr_ne(r, null); 10270 array->f->pushInt(array, 1); 10271 r = setPArraySmallDictG(self, "1", array); 10272 ck_assert_ptr_ne(r, null); 10273 char *s = toStringO(r); 10274 ck_assert_str_eq(s, "{\"1\":[1]}"); 10275 free(s); 10276 finishO(array); 10277 terminateO(self); 10278 10279 END_TEST 10280 10281 10282 START_TEST(setPSmallJsonSmallDictGT) 10283 10284 smallDictt* r; 10285 smallDictt *self = allocG(rtSmallDictt); 10286 smallJsont *json; 10287 10288 json = allocSmallJson(); 10289 r = self->f->setSmallJson(self, "1", json); 10290 ck_assert_ptr_ne(r, null); 10291 json->f->setInt(json, "a", 1); 10292 r = setPSmallJsonSmallDictG(self, "1", json); 10293 ck_assert_ptr_ne(r, null); 10294 finishO(json); 10295 char *s = toStringO(r); 10296 ck_assert_str_eq(s, "{\"1\":{\"a\":1}}"); 10297 free(s); 10298 terminateO(self); 10299 10300 END_TEST 10301 10302 10303 START_TEST(setPSmallStringSmallDictGT) 10304 10305 smallDictt* r; 10306 smallDictt *self = allocG(rtSmallDictt); 10307 smallStringt *string; 10308 10309 string = allocSmallString(""); 10310 r = self->f->setSmallString(self, "1", string); 10311 ck_assert_ptr_ne(r, null); 10312 string->f->appendS(string, "s"); 10313 r = setPSmallStringSmallDictG(self, "1", string); 10314 ck_assert_ptr_ne(r, null); 10315 finishO(string); 10316 char *s = toStringO(r); 10317 ck_assert_str_eq(s, "{\"1\":\"s\"}"); 10318 free(s); 10319 terminateO(self); 10320 10321 END_TEST 10322 10323 10324 START_TEST(setNFreePDictSmallDictGT) 10325 10326 smallDictt* r; 10327 smallDictt *self = allocG(rtSmallDictt); 10328 smallDictt *value; 10329 10330 value = allocSmallDict(); 10331 r = self->f->setDict(self, "1", value); 10332 ck_assert_ptr_ne(r, null); 10333 value->f->setInt(value, "a", 1); 10334 r = setNFreePDictSmallDictG(self, "1", value); 10335 ck_assert_ptr_ne(r, null); 10336 char *s = toStringO(r); 10337 ck_assert_str_eq(s, "{\"1\":{\"a\":1}}"); 10338 free(s); 10339 terminateO(self); 10340 10341 END_TEST 10342 10343 10344 START_TEST(setNFreePArraySmallDictGT) 10345 10346 smallDictt* r; 10347 smallDictt *self = allocG(rtSmallDictt); 10348 smallArrayt *value; 10349 10350 value = allocSmallArray(); 10351 r = self->f->setArray(self, "1", value); 10352 ck_assert_ptr_ne(r, null); 10353 value->f->pushInt(value, 2); 10354 r = setNFreePArraySmallDictG(self, "1", value); 10355 ck_assert_ptr_ne(r, null); 10356 char *s = toStringO(r); 10357 ck_assert_str_eq(s, "{\"1\":[2]}"); 10358 free(s); 10359 terminateO(self); 10360 10361 END_TEST 10362 10363 10364 START_TEST(setNFreePSmallJsonSmallDictGT) 10365 10366 smallDictt* r; 10367 smallDictt *self = allocG(rtSmallDictt); 10368 smallJsont *value; 10369 10370 value = allocSmallJson(); 10371 r = self->f->setSmallJson(self, "1", value); 10372 ck_assert_ptr_ne(r, null); 10373 value->f->setInt(value, "a", 1); 10374 r = setNFreePSmallJsonSmallDictG(self, "1", value); 10375 ck_assert_ptr_ne(r, null); 10376 char *s = toStringO(r); 10377 ck_assert_str_eq(s, "{\"1\":{\"a\":1}}"); 10378 free(s); 10379 terminateO(self); 10380 10381 END_TEST 10382 10383 10384 START_TEST(setNFreePSmallStringSmallDictGT) 10385 10386 smallDictt* r; 10387 smallDictt *self = allocG(rtSmallDictt); 10388 smallStringt *value; 10389 10390 value = allocSmallString(""); 10391 r = self->f->setSmallString(self, "1", value); 10392 ck_assert_ptr_ne(r, null); 10393 value->f->appendS(value, "2"); 10394 r = setNFreePSmallStringSmallDictG(self, "1", value); 10395 ck_assert_ptr_ne(r, null); 10396 char *s = toStringO(r); 10397 ck_assert_str_eq(s, "{\"1\":\"2\"}"); 10398 free(s); 10399 terminateO(self); 10400 10401 END_TEST 10402 10403 10404 START_TEST(setPArrayKCharSmallDictGT) 10405 10406 smallDictt* r; 10407 smallDictt *self = allocG(rtSmallDictt); 10408 smallArrayt *array; 10409 10410 array = allocSmallArray(); 10411 r = self->f->setArray(self, "1", array); 10412 ck_assert_ptr_ne(r, null); 10413 array->f->pushInt(array, 2); 10414 r = setPArrayKCharSmallDictG(self, '1', array); 10415 ck_assert_ptr_ne(r, null); 10416 char *s = toStringO(r); 10417 ck_assert_str_eq(s, "{\"1\":[2]}"); 10418 free(s); 10419 terminateO(self); 10420 finishO(array); 10421 10422 END_TEST 10423 10424 10425 START_TEST(setPDictKCharSmallDictGT) 10426 10427 smallDictt* r; 10428 smallDictt *self = allocG(rtSmallDictt); 10429 smallDictt *dict; 10430 10431 dict = allocSmallDict(); 10432 r = self->f->setDict(self, "1", dict); 10433 ck_assert_ptr_ne(r, null); 10434 dict->f->setInt(dict, "a", 1); 10435 r = setPDictKCharSmallDictG(self, '1', dict); 10436 ck_assert_ptr_ne(r, null); 10437 char *s = toStringO(r); 10438 ck_assert_str_eq(s, "{\"1\":{\"a\":1}}"); 10439 free(s); 10440 terminateO(self); 10441 finishO(dict); 10442 10443 END_TEST 10444 10445 10446 START_TEST(setPSmallJsonKCharSmallDictGT) 10447 10448 smallDictt* r; 10449 smallDictt *self = allocG(rtSmallDictt); 10450 smallJsont *json; 10451 10452 json = allocSmallJson(); 10453 r = self->f->setSmallJson(self, "1", json); 10454 ck_assert_ptr_ne(r, null); 10455 json->f->setInt(json, "a", 1); 10456 r = setPSmallJsonKCharSmallDictG(self, '1', json); 10457 ck_assert_ptr_ne(r, null); 10458 finishO(json); 10459 char *s = toStringO(r); 10460 ck_assert_str_eq(s, "{\"1\":{\"a\":1}}"); 10461 free(s); 10462 terminateO(self); 10463 10464 END_TEST 10465 10466 10467 START_TEST(setPSmallStringKCharSmallDictGT) 10468 10469 smallDictt* r; 10470 smallDictt *self = allocG(rtSmallDictt); 10471 smallStringt *string; 10472 10473 string = allocSmallString(""); 10474 r = self->f->setSmallString(self, "1", string); 10475 ck_assert_ptr_ne(r, null); 10476 string->f->appendS(string, "s"); 10477 r = setPSmallStringKCharSmallDictG(self, '1', string); 10478 ck_assert_ptr_ne(r, null); 10479 finishO(string); 10480 char *s = toStringO(r); 10481 ck_assert_str_eq(s, "{\"1\":\"s\"}"); 10482 free(s); 10483 terminateO(self); 10484 10485 END_TEST 10486 10487 10488 START_TEST(setNFreePArrayKCharSmallDictGT) 10489 10490 smallDictt* r; 10491 smallDictt *self = allocG(rtSmallDictt); 10492 smallArrayt *value; 10493 10494 value = allocSmallArray(); 10495 r = self->f->setArray(self, "1", value); 10496 ck_assert_ptr_ne(r, null); 10497 value->f->pushInt(value, 2); 10498 r = setNFreePArrayKCharSmallDictG(self, '1', value); 10499 ck_assert_ptr_ne(r, null); 10500 char *s = toStringO(r); 10501 ck_assert_str_eq(s, "{\"1\":[2]}"); 10502 free(s); 10503 terminateO(self); 10504 10505 END_TEST 10506 10507 10508 START_TEST(setNFreePDictKCharSmallDictGT) 10509 10510 smallDictt* r; 10511 smallDictt *self = allocG(rtSmallDictt); 10512 smallDictt *value; 10513 10514 value = allocSmallDict(); 10515 r = self->f->setDict(self, "1", value); 10516 ck_assert_ptr_ne(r, null); 10517 value->f->setInt(value, "a", 1); 10518 r = setNFreePDictKCharSmallDictG(self, '1', value); 10519 ck_assert_ptr_ne(r, null); 10520 char *s = toStringO(r); 10521 ck_assert_str_eq(s, "{\"1\":{\"a\":1}}"); 10522 free(s); 10523 terminateO(self); 10524 10525 END_TEST 10526 10527 10528 START_TEST(setNFreePSmallJsonKCharSmallDictGT) 10529 10530 smallDictt* r; 10531 smallDictt *self = allocG(rtSmallDictt); 10532 smallJsont *value; 10533 10534 value = allocSmallJson(); 10535 r = self->f->setSmallJson(self, "1", value); 10536 ck_assert_ptr_ne(r, null); 10537 value->f->setInt(value, "a", 1); 10538 r = setNFreePSmallJsonKCharSmallDictG(self, '1', value); 10539 ck_assert_ptr_ne(r, null); 10540 char *s = toStringO(r); 10541 ck_assert_str_eq(s, "{\"1\":{\"a\":1}}"); 10542 free(s); 10543 terminateO(self); 10544 10545 END_TEST 10546 10547 10548 START_TEST(setNFreePSmallStringKCharSmallDictGT) 10549 10550 smallDictt* r; 10551 smallDictt *self = allocG(rtSmallDictt); 10552 smallStringt *value; 10553 10554 value = allocSmallString(""); 10555 r = self->f->setSmallString(self, "1", value); 10556 ck_assert_ptr_ne(r, null); 10557 value->f->appendS(value, "2"); 10558 r = setNFreePSmallStringKCharSmallDictG(self, '1', value); 10559 ck_assert_ptr_ne(r, null); 10560 char *s = toStringO(r); 10561 ck_assert_str_eq(s, "{\"1\":\"2\"}"); 10562 free(s); 10563 terminateO(self); 10564 10565 END_TEST 10566 10567 10568 START_TEST(mergeSmallDictGT) 10569 10570 smallDictt* r; 10571 smallDictt *self = allocG(rtSmallDictt); 10572 smallDictt *value = allocSmallDict(); 10573 10574 self->f->setS(self, "1", "2"); 10575 self->f->setS(self, "3", "4"); 10576 value->f->setS(value, "3", "#"); 10577 value->f->setInt(value, "4", 0); 10578 r = mergeSmallDictG(self, value); 10579 ck_assert_ptr_ne(r, null); 10580 char *s = toStringO(r); 10581 ck_assert_str_eq(s, "{\"1\":\"2\",\"3\":\"#\",\"4\":0}"); 10582 free(s); 10583 smashO(value); 10584 terminateO(self); 10585 10586 END_TEST 10587 10588 10589 START_TEST(mergeSmallJsonSmallDictGT) 10590 10591 smallDictt* r; 10592 smallDictt *self = allocG(rtSmallDictt); 10593 smallJsont *json = allocSmallJson(); 10594 10595 self->f->setS(self, "1", "2"); 10596 self->f->setS(self, "3", "4"); 10597 json->f->setS(json, "3", "#"); 10598 json->f->setInt(json, "4", 0); 10599 r = mergeSmallJsonSmallDictG(self, json); 10600 ck_assert_ptr_ne(r, null); 10601 char *s = toStringO(r); 10602 ck_assert_str_eq(s, "{\"1\":\"2\",\"3\":\"#\",\"4\":0}"); 10603 free(s); 10604 smashO(json); 10605 terminateO(self); 10606 10607 END_TEST 10608 10609 10610 START_TEST(mergeNSmashSmallDictGT) 10611 10612 smallDictt* r; 10613 smallDictt *self = allocG(rtSmallDictt); 10614 smallDictt *value = allocSmallDict(); 10615 10616 self->f->setS(self, "1", "2"); 10617 self->f->setS(self, "3", "4"); 10618 value->f->setS(value, "3", "#"); 10619 value->f->setInt(value, "4", 0); 10620 r = mergeNSmashSmallDictG(self, value); 10621 ck_assert_ptr_ne(r, null); 10622 char *s = toStringO(r); 10623 ck_assert_str_eq(s, "{\"1\":\"2\",\"3\":\"#\",\"4\":0}"); 10624 free(s); 10625 terminateO(self); 10626 10627 END_TEST 10628 10629 10630 START_TEST(mergeNSmashSmallJsonSmallDictGT) 10631 10632 smallDictt* r; 10633 smallDictt *self = allocG(rtSmallDictt); 10634 smallJsont *json = allocSmallJson(); 10635 10636 self->f->setS(self, "1", "2"); 10637 self->f->setS(self, "3", "4"); 10638 json->f->setS(json, "3", "#"); 10639 json->f->setInt(json, "4", 0); 10640 r = mergeNSmashSmallJsonSmallDictG(self, json); 10641 ck_assert_ptr_ne(r, null); 10642 char *s = toStringO(r); 10643 ck_assert_str_eq(s, "{\"1\":\"2\",\"3\":\"#\",\"4\":0}"); 10644 free(s); 10645 terminateO(self); 10646 10647 END_TEST 10648 10649 10650 START_TEST(equalSmallDictBaseGT) 10651 10652 bool r; 10653 smallDictt* self = allocG(rtSmallDictt); 10654 10655 createAllocateSmallDict(d); 10656 r = equalSmallDictBaseG(self, (baset*)d); 10657 ck_assert(!r); 10658 terminateO(d); 10659 terminateO(self); 10660 10661 END_TEST 10662 10663 10664 START_TEST(equalSmallDictSmallJsonGT) 10665 10666 bool r; 10667 smallDictt* self = allocG(rtSmallDictt); 10668 smallJsont* p2 = allocSmallJson(); 10669 10670 self->f->setS(self, "3", "#"); 10671 p2->f->setS(p2, "3", "#"); 10672 r = equalSmallDictSmallJsonG(self, p2); 10673 ck_assert(r); 10674 terminateO(p2); 10675 terminateO(self); 10676 10677 END_TEST 10678 10679 10680 START_TEST(equalSmallDictGT) 10681 10682 bool r; 10683 smallDictt* self = allocG(rtSmallDictt); 10684 smallDictt* p2 = allocSmallDict(); 10685 10686 self->f->setS(self, "3", "#"); 10687 p2->f->setS(p2, "3", "#"); 10688 r = equalSmallDictG(self, p2); 10689 ck_assert(r); 10690 terminateO(p2); 10691 terminateO(self); 10692 10693 END_TEST 10694 10695 10696 START_TEST(icEqualSmallDictBaseGT) 10697 10698 bool r; 10699 smallDictt* self = allocG(rtSmallDictt); 10700 10701 createAllocateSmallDict(d); 10702 self->f->setS(self, "q", "q"); 10703 d->f->setS(d, "q", "Q"); 10704 r = icEqualSmallDictBaseG(self, (baset*)d); 10705 ck_assert(r); 10706 terminateO(d); 10707 terminateO(self); 10708 10709 END_TEST 10710 10711 10712 START_TEST(icEqualSmallDictSmallJsonGT) 10713 10714 bool r; 10715 smallDictt* self = allocG(rtSmallDictt); 10716 smallJsont* p2 = allocSmallJson(); 10717 10718 self->f->setS(self, "3", "W"); 10719 p2->f->setS(p2, "3", "w"); 10720 r = icEqualSmallDictSmallJsonG(self, p2); 10721 ck_assert(r); 10722 terminateO(p2); 10723 terminateO(self); 10724 10725 END_TEST 10726 10727 10728 START_TEST(icEqualSmallDictGT) 10729 10730 bool r; 10731 smallDictt* self = allocG(rtSmallDictt); 10732 smallDictt* p2 = allocSmallDict(); 10733 10734 self->f->setS(self, "3", "A"); 10735 p2->f->setS(p2, "3", "a"); 10736 r = icEqualSmallDictG(self, p2); 10737 ck_assert(r); 10738 terminateO(p2); 10739 terminateO(self); 10740 10741 END_TEST 10742 10743 10744 START_TEST(getNumSmallDictGT) 10745 10746 double r; 10747 smallDictt *self = allocG(rtSmallDictt); 10748 smallDictt *r2; 10749 10750 r2 = self->f->setInt(self, "1", 1); 10751 ck_assert_ptr_ne(r2, null); 10752 r2 = self->f->setDouble(self, "2", 2.2); 10753 ck_assert_ptr_ne(r2, null); 10754 r2 = self->f->setS(self, "3", "2"); 10755 ck_assert_ptr_ne(r2, null); 10756 r = getNumSmallDictG(self, "1"); 10757 ck_assert(r == 1); 10758 r = getNumSmallDictG(self, "2"); 10759 ck_assert(r == 2.2); 10760 terminateO(self); 10761 10762 END_TEST 10763 10764 10765 START_TEST(cropElemSmallDictGT) 10766 10767 baset* r; 10768 smallDictt *self = allocG(rtSmallDictt); 10769 smallDictt *r2; 10770 10771 r2 = self->f->setInt(self, "1", 1); 10772 ck_assert_ptr_ne(r2, null); 10773 r2 = self->f->setDouble(self, "2", 2.2); 10774 ck_assert_ptr_ne(r2, null); 10775 r2 = self->f->setS(self, "3", "2"); 10776 ck_assert_ptr_ne(r2, null); 10777 r2 = self->f->setUndefined(self, "u"); 10778 ck_assert_ptr_ne(r2, null); 10779 createSmallContainer(c); 10780 r2 = self->f->setSmallContainer(self, "c", &c); 10781 ck_assert_ptr_ne(r2, null); 10782 createAllocateSmallInt(I); 10783 setValG(I, 11); 10784 I->type = "anothertype"; 10785 r2 = self->f->set(self, "b", (baset*)I); 10786 ck_assert_ptr_ne(r2, null); 10787 // crop string 10788 r = cropElemSmallDictG(self, "3"); 10789 ck_assert_ptr_ne(r, null); 10790 char *s = toStringO(r); 10791 terminateO(r); 10792 ck_assert_str_eq(s, "2"); 10793 free(s); 10794 s = toStringO(self); 10795 ck_assert_str_eq(s, "{\"1\":1,\"2\":2.200000e+00,\"u\":null,\"c\":\"<data container>\",\"b\":\"<data container>\"}"); 10796 free(s); 10797 terminateO(self); 10798 10799 END_TEST 10800 10801 10802 START_TEST(cropElemUndefinedSmallDictGT) 10803 10804 undefinedt* r; 10805 smallDictt *self = allocG(rtSmallDictt); 10806 smallDictt *r2; 10807 10808 r2 = self->f->setInt(self, "1", 1); 10809 ck_assert_ptr_ne(r2, null); 10810 r2 = self->f->setDouble(self, "2", 2.2); 10811 ck_assert_ptr_ne(r2, null); 10812 r2 = self->f->setUndefined(self, "u"); 10813 ck_assert_ptr_ne(r2, null); 10814 r = cropElemUndefinedSmallDictG(self, "u"); 10815 ck_assert_ptr_ne(r, null); 10816 char *s = toStringO(r); 10817 terminateO(r); 10818 ck_assert_str_eq(s, "null"); 10819 free(s); 10820 s = toStringO(self); 10821 ck_assert_str_eq(s, "{\"1\":1,\"2\":2.200000e+00}"); 10822 free(s); 10823 terminateO(self); 10824 10825 END_TEST 10826 10827 10828 START_TEST(cropElemBoolSmallDictGT) 10829 10830 bool r; 10831 smallDictt *self = allocG(rtSmallDictt); 10832 smallDictt *r2; 10833 10834 r2 = self->f->setInt(self, "1", 1); 10835 ck_assert_ptr_ne(r2, null); 10836 r2 = self->f->setDouble(self, "2", 2.2); 10837 ck_assert_ptr_ne(r2, null); 10838 r2 = self->f->setBool(self, "b", true); 10839 ck_assert_ptr_ne(r2, null); 10840 createAllocateSmallInt(I); 10841 setValG(I, 11); 10842 I->type = "anothertype"; 10843 r2 = self->f->set(self, "B", (baset*)I); 10844 ck_assert_ptr_ne(r2, null); 10845 r = cropElemBoolSmallDictG(self, "b"); 10846 ck_assert(r); 10847 char *s = toStringO(self); 10848 ck_assert_str_eq(s, "{\"1\":1,\"2\":2.200000e+00,\"B\":\"<data container>\"}"); 10849 free(s); 10850 terminateO(self); 10851 10852 END_TEST 10853 10854 10855 START_TEST(cropElemDoubleSmallDictGT) 10856 10857 double r; 10858 smallDictt *self = allocG(rtSmallDictt); 10859 smallDictt *r2; 10860 10861 r2 = self->f->setInt(self, "1", 1); 10862 ck_assert_ptr_ne(r2, null); 10863 r2 = self->f->setDouble(self, "2", 2.2); 10864 ck_assert_ptr_ne(r2, null); 10865 r2 = self->f->setDouble(self, "b", 3.3); 10866 ck_assert_ptr_ne(r2, null); 10867 createAllocateSmallInt(I); 10868 setValG(I, 11); 10869 I->type = "anothertype"; 10870 r2 = self->f->set(self, "B", (baset*)I); 10871 ck_assert_ptr_ne(r2, null); 10872 r = cropElemDoubleSmallDictG(self, "b"); 10873 ck_assert(r == 3.3); 10874 char *s = toStringO(self); 10875 ck_assert_str_eq(s, "{\"1\":1,\"2\":2.200000e+00,\"B\":\"<data container>\"}"); 10876 free(s); 10877 terminateO(self); 10878 10879 END_TEST 10880 10881 10882 START_TEST(cropElemIntSmallDictGT) 10883 10884 int64_t r; 10885 smallDictt *self = allocG(rtSmallDictt); 10886 smallDictt *r2; 10887 10888 r2 = self->f->setInt(self, "1", 1); 10889 ck_assert_ptr_ne(r2, null); 10890 r2 = self->f->setDouble(self, "2", 2.2); 10891 ck_assert_ptr_ne(r2, null); 10892 r2 = self->f->setInt(self, "b", 2); 10893 ck_assert_ptr_ne(r2, null); 10894 createAllocateSmallInt(I); 10895 setValG(I, 11); 10896 I->type = "anothertype"; 10897 r2 = self->f->set(self, "B", (baset*)I); 10898 ck_assert_ptr_ne(r2, null); 10899 r = cropElemIntSmallDictG(self, "b"); 10900 ck_assert_int_eq(r, 2); 10901 char *s = toStringO(self); 10902 ck_assert_str_eq(s, "{\"1\":1,\"2\":2.200000e+00,\"B\":\"<data container>\"}"); 10903 free(s); 10904 terminateO(self); 10905 10906 END_TEST 10907 10908 10909 START_TEST(cropElemInt32SmallDictGT) 10910 10911 int32_t r; 10912 smallDictt *self = allocG(rtSmallDictt); 10913 smallDictt *r2; 10914 10915 r2 = self->f->setInt(self, "1", 1); 10916 ck_assert_ptr_ne(r2, null); 10917 r2 = self->f->setDouble(self, "2", 2.2); 10918 ck_assert_ptr_ne(r2, null); 10919 r2 = self->f->setInt(self, "b", 2); 10920 ck_assert_ptr_ne(r2, null); 10921 createAllocateSmallInt(I); 10922 setValG(I, 11); 10923 I->type = "anothertype"; 10924 r2 = self->f->set(self, "B", (baset*)I); 10925 ck_assert_ptr_ne(r2, null); 10926 r = cropElemInt32SmallDictG(self, "b"); 10927 ck_assert_int_eq(r, 2); 10928 char *s = toStringO(self); 10929 ck_assert_str_eq(s, "{\"1\":1,\"2\":2.200000e+00,\"B\":\"<data container>\"}"); 10930 free(s); 10931 terminateO(self); 10932 10933 END_TEST 10934 10935 10936 START_TEST(cropElemUintSmallDictGT) 10937 10938 uint64_t r; 10939 smallDictt *self = allocG(rtSmallDictt); 10940 smallDictt *r2; 10941 10942 r2 = self->f->setInt(self, "1", 1); 10943 ck_assert_ptr_ne(r2, null); 10944 r2 = self->f->setDouble(self, "2", 2.2); 10945 ck_assert_ptr_ne(r2, null); 10946 r2 = self->f->setInt(self, "b", 2); 10947 ck_assert_ptr_ne(r2, null); 10948 createAllocateSmallInt(I); 10949 setValG(I, 11); 10950 I->type = "anothertype"; 10951 r2 = self->f->set(self, "B", (baset*)I); 10952 ck_assert_ptr_ne(r2, null); 10953 r = cropElemUintSmallDictG(self, "b"); 10954 ck_assert_int_eq(r, 2); 10955 char *s = toStringO(self); 10956 ck_assert_str_eq(s, "{\"1\":1,\"2\":2.200000e+00,\"B\":\"<data container>\"}"); 10957 free(s); 10958 terminateO(self); 10959 10960 END_TEST 10961 10962 10963 START_TEST(cropElemUint32SmallDictGT) 10964 10965 uint32_t r; 10966 smallDictt *self = allocG(rtSmallDictt); 10967 smallDictt *r2; 10968 10969 r2 = self->f->setInt(self, "1", 1); 10970 ck_assert_ptr_ne(r2, null); 10971 r2 = self->f->setDouble(self, "2", 2.2); 10972 ck_assert_ptr_ne(r2, null); 10973 r2 = self->f->setInt(self, "b", 2); 10974 ck_assert_ptr_ne(r2, null); 10975 createAllocateSmallInt(I); 10976 setValG(I, 11); 10977 I->type = "anothertype"; 10978 r2 = self->f->set(self, "B", (baset*)I); 10979 ck_assert_ptr_ne(r2, null); 10980 r = cropElemUint32SmallDictG(self, "b"); 10981 ck_assert_int_eq(r, 2); 10982 char *s = toStringO(self); 10983 ck_assert_str_eq(s, "{\"1\":1,\"2\":2.200000e+00,\"B\":\"<data container>\"}"); 10984 free(s); 10985 terminateO(self); 10986 10987 END_TEST 10988 10989 10990 START_TEST(cropElemSSmallDictGT) 10991 10992 char* r; 10993 smallDictt *self = allocG(rtSmallDictt); 10994 smallDictt *r2; 10995 10996 r2 = self->f->setInt(self, "1", 1); 10997 ck_assert_ptr_ne(r2, null); 10998 r2 = self->f->setDouble(self, "2", 2.2); 10999 ck_assert_ptr_ne(r2, null); 11000 r2 = self->f->setS(self, "b", "qwe"); 11001 ck_assert_ptr_ne(r2, null); 11002 createAllocateSmallInt(I); 11003 setValG(I, 11); 11004 I->type = "anothertype"; 11005 r2 = self->f->set(self, "B", (baset*)I); 11006 ck_assert_ptr_ne(r2, null); 11007 r = cropElemSSmallDictG(self, "b"); 11008 ck_assert_str_eq(r, "qwe"); 11009 free(r); 11010 char *s = toStringO(self); 11011 ck_assert_str_eq(s, "{\"1\":1,\"2\":2.200000e+00,\"B\":\"<data container>\"}"); 11012 free(s); 11013 terminateO(self); 11014 11015 END_TEST 11016 11017 11018 START_TEST(cropElemDictSmallDictGT) 11019 11020 smallDictt* r; 11021 smallDictt *self = allocG(rtSmallDictt); 11022 smallDictt *r2; 11023 11024 r2 = self->f->setInt(self, "1", 1); 11025 ck_assert_ptr_ne(r2, null); 11026 r2 = self->f->setDouble(self, "2", 2.2); 11027 ck_assert_ptr_ne(r2, null); 11028 createAllocateSmallDict(d); 11029 r2 = self->f->setNFreeDict(self, "b", d); 11030 ck_assert_ptr_ne(r2, null); 11031 createAllocateSmallInt(I); 11032 setValG(I, 11); 11033 I->type = "anothertype"; 11034 r2 = self->f->set(self, "B", (baset*)I); 11035 ck_assert_ptr_ne(r2, null); 11036 r = cropElemDictSmallDictG(self, "b"); 11037 ck_assert_ptr_ne(r, null); 11038 char *s = toStringO(r); 11039 terminateO(r); 11040 ck_assert_str_eq(s, "{}"); 11041 free(s); 11042 s = toStringO(self); 11043 ck_assert_str_eq(s, "{\"1\":1,\"2\":2.200000e+00,\"B\":\"<data container>\"}"); 11044 free(s); 11045 terminateO(self); 11046 11047 END_TEST 11048 11049 11050 START_TEST(cropElemArraySmallDictGT) 11051 11052 smallArrayt* r; 11053 smallDictt *self = allocG(rtSmallDictt); 11054 smallDictt *r2; 11055 11056 r2 = self->f->setInt(self, "1", 1); 11057 ck_assert_ptr_ne(r2, null); 11058 r2 = self->f->setDouble(self, "2", 2.2); 11059 ck_assert_ptr_ne(r2, null); 11060 createAllocateSmallArray(d); 11061 r2 = self->f->setNFreeArray(self, "b", d); 11062 ck_assert_ptr_ne(r2, null); 11063 createAllocateSmallInt(I); 11064 setValG(I, 11); 11065 I->type = "anothertype"; 11066 r2 = self->f->set(self, "B", (baset*)I); 11067 ck_assert_ptr_ne(r2, null); 11068 r = cropElemArraySmallDictG(self, "b"); 11069 ck_assert_ptr_ne(r, null); 11070 char *s = toStringO(r); 11071 terminateO(r); 11072 ck_assert_str_eq(s, "[]"); 11073 free(s); 11074 s = toStringO(self); 11075 ck_assert_str_eq(s, "{\"1\":1,\"2\":2.200000e+00,\"B\":\"<data container>\"}"); 11076 free(s); 11077 terminateO(self); 11078 11079 END_TEST 11080 11081 11082 START_TEST(cropElemSmallBoolSmallDictGT) 11083 11084 smallBoolt* r; 11085 smallDictt *self = allocG(rtSmallDictt); 11086 smallDictt *r2; 11087 11088 r2 = self->f->setInt(self, "1", 1); 11089 ck_assert_ptr_ne(r2, null); 11090 r2 = self->f->setDouble(self, "2", 2.2); 11091 ck_assert_ptr_ne(r2, null); 11092 r2 = self->f->setBool(self, "b", true); 11093 ck_assert_ptr_ne(r2, null); 11094 createAllocateSmallInt(I); 11095 setValG(I, 11); 11096 I->type = "anothertype"; 11097 r2 = self->f->set(self, "B", (baset*)I); 11098 ck_assert_ptr_ne(r2, null); 11099 r = cropElemSmallBoolSmallDictG(self, "b"); 11100 ck_assert_ptr_ne(r, null); 11101 char *s = toStringO(r); 11102 terminateO(r); 11103 ck_assert_str_eq(s, "true"); 11104 free(s); 11105 s = toStringO(self); 11106 ck_assert_str_eq(s, "{\"1\":1,\"2\":2.200000e+00,\"B\":\"<data container>\"}"); 11107 free(s); 11108 terminateO(self); 11109 11110 END_TEST 11111 11112 11113 START_TEST(cropElemSmallBytesSmallDictGT) 11114 11115 smallBytest* r; 11116 smallDictt *self = allocG(rtSmallDictt); 11117 smallDictt *r2; 11118 11119 r2 = self->f->setInt(self, "1", 1); 11120 ck_assert_ptr_ne(r2, null); 11121 r2 = self->f->setDouble(self, "2", 2.2); 11122 ck_assert_ptr_ne(r2, null); 11123 createAllocateSmallBytes(d); 11124 r2 = self->f->setNFreeSmallBytes(self, "b", d); 11125 ck_assert_ptr_ne(r2, null); 11126 createAllocateSmallInt(I); 11127 setValG(I, 11); 11128 I->type = "anothertype"; 11129 r2 = self->f->set(self, "B", (baset*)I); 11130 ck_assert_ptr_ne(r2, null); 11131 r = cropElemSmallBytesSmallDictG(self, "b"); 11132 ck_assert_ptr_ne(r, null); 11133 char *s = toStringO(r); 11134 terminateO(r); 11135 ck_assert_str_eq(s, "[]"); 11136 free(s); 11137 s = toStringO(self); 11138 ck_assert_str_eq(s, "{\"1\":1,\"2\":2.200000e+00,\"B\":\"<data container>\"}"); 11139 free(s); 11140 terminateO(self); 11141 11142 END_TEST 11143 11144 11145 START_TEST(cropElemSmallDoubleSmallDictGT) 11146 11147 smallDoublet* r; 11148 smallDictt *self = allocG(rtSmallDictt); 11149 smallDictt *r2; 11150 11151 r2 = self->f->setInt(self, "1", 1); 11152 ck_assert_ptr_ne(r2, null); 11153 r2 = self->f->setDouble(self, "2", 2.2); 11154 ck_assert_ptr_ne(r2, null); 11155 r2 = self->f->setDouble(self, "b", 3.3); 11156 ck_assert_ptr_ne(r2, null); 11157 createAllocateSmallInt(I); 11158 setValG(I, 11); 11159 I->type = "anothertype"; 11160 r2 = self->f->set(self, "B", (baset*)I); 11161 ck_assert_ptr_ne(r2, null); 11162 r = cropElemSmallDoubleSmallDictG(self, "b"); 11163 ck_assert_ptr_ne(r, null); 11164 char *s = toStringO(r); 11165 terminateO(r); 11166 ck_assert_str_eq(s, "3.300000e+00"); 11167 free(s); 11168 s = toStringO(self); 11169 ck_assert_str_eq(s, "{\"1\":1,\"2\":2.200000e+00,\"B\":\"<data container>\"}"); 11170 free(s); 11171 terminateO(self); 11172 11173 END_TEST 11174 11175 11176 START_TEST(cropElemSmallIntSmallDictGT) 11177 11178 smallIntt* r; 11179 smallDictt *self = allocG(rtSmallDictt); 11180 smallDictt *r2; 11181 11182 r2 = self->f->setInt(self, "1", 1); 11183 ck_assert_ptr_ne(r2, null); 11184 r2 = self->f->setDouble(self, "2", 2.2); 11185 ck_assert_ptr_ne(r2, null); 11186 r2 = self->f->setInt(self, "b", 2); 11187 ck_assert_ptr_ne(r2, null); 11188 createAllocateSmallInt(I); 11189 setValG(I, 11); 11190 I->type = "anothertype"; 11191 r2 = self->f->set(self, "B", (baset*)I); 11192 ck_assert_ptr_ne(r2, null); 11193 r = cropElemSmallIntSmallDictG(self, "b"); 11194 ck_assert_ptr_ne(r, null); 11195 char *s = toStringO(r); 11196 terminateO(r); 11197 ck_assert_str_eq(s, "2"); 11198 free(s); 11199 s = toStringO(self); 11200 ck_assert_str_eq(s, "{\"1\":1,\"2\":2.200000e+00,\"B\":\"<data container>\"}"); 11201 free(s); 11202 terminateO(self); 11203 11204 END_TEST 11205 11206 11207 START_TEST(cropElemSmallJsonSmallDictGT) 11208 11209 smallJsont* r; 11210 smallDictt *self = allocG(rtSmallDictt); 11211 smallDictt *r2; 11212 11213 r2 = self->f->setInt(self, "1", 1); 11214 ck_assert_ptr_ne(r2, null); 11215 createAllocateSmallBytes(b); 11216 r2 = self->f->setNFreeSmallBytes(self, "2", b); 11217 ck_assert_ptr_ne(r2, null); 11218 createAllocateSmallJson(d); 11219 r2 = self->f->setNFreeSmallJson(self, "b", d); 11220 ck_assert_ptr_ne(r2, null); 11221 createAllocateSmallInt(I); 11222 setValG(I, 11); 11223 I->type = "anothertype"; 11224 r2 = self->f->set(self, "B", (baset*)I); 11225 ck_assert_ptr_ne(r2, null); 11226 r = cropElemSmallJsonSmallDictG(self, "b"); 11227 ck_assert_ptr_ne(r, null); 11228 char *s = toStringO(r); 11229 terminateO(r); 11230 ck_assert_str_eq(s, "{}"); 11231 free(s); 11232 s = toStringO(self); 11233 ck_assert_str_eq(s, "{\"1\":1,\"2\":[],\"B\":\"<data container>\"}"); 11234 free(s); 11235 terminateO(self); 11236 11237 END_TEST 11238 11239 11240 START_TEST(cropElemSmallStringSmallDictGT) 11241 11242 smallStringt* r; 11243 smallDictt *self = allocG(rtSmallDictt); 11244 smallDictt *r2; 11245 11246 r2 = self->f->setInt(self, "1", 1); 11247 ck_assert_ptr_ne(r2, null); 11248 r2 = self->f->setDouble(self, "2", 2.2); 11249 ck_assert_ptr_ne(r2, null); 11250 r2 = self->f->setS(self, "b", "qwe"); 11251 ck_assert_ptr_ne(r2, null); 11252 createAllocateSmallInt(I); 11253 setValG(I, 11); 11254 I->type = "anothertype"; 11255 r2 = self->f->set(self, "B", (baset*)I); 11256 ck_assert_ptr_ne(r2, null); 11257 r = cropElemSmallStringSmallDictG(self, "b"); 11258 ck_assert_ptr_ne(r, null); 11259 char *s = toStringO(r); 11260 terminateO(r); 11261 ck_assert_str_eq(s, "qwe"); 11262 free(s); 11263 s = toStringO(self); 11264 ck_assert_str_eq(s, "{\"1\":1,\"2\":2.200000e+00,\"B\":\"<data container>\"}"); 11265 free(s); 11266 terminateO(self); 11267 11268 END_TEST 11269 11270 11271 START_TEST(cropElemVoidSmallDictGT) 11272 11273 void* r; 11274 smallDictt *self = allocG(rtSmallDictt); 11275 smallDictt *r2; 11276 11277 r2 = self->f->setInt(self, "1", 1); 11278 ck_assert_ptr_ne(r2, null); 11279 r2 = self->f->setDouble(self, "2", 2.2); 11280 ck_assert_ptr_ne(r2, null); 11281 smallContainert *c = allocSmallContainer(&r); 11282 r2 = self->f->setNFreeSmallContainer(self, "b", c); 11283 ck_assert_ptr_ne(r2, null); 11284 createAllocateSmallInt(I); 11285 setValG(I, 11); 11286 I->type = "anothertype"; 11287 r2 = self->f->set(self, "B", (baset*)I); 11288 ck_assert_ptr_ne(r2, null); 11289 r = cropElemVoidSmallDictG(self, "b"); 11290 ck_assert_ptr_eq(r, &r); 11291 char *s = toStringO(self); 11292 ck_assert_str_eq(s, "{\"1\":1,\"2\":2.200000e+00,\"B\":\"<data container>\"}"); 11293 free(s); 11294 terminateO(self); 11295 11296 END_TEST 11297 11298 11299 START_TEST(cropElemSmallContainerSmallDictGT) 11300 11301 smallContainert* r; 11302 smallDictt *self = allocG(rtSmallDictt); 11303 smallDictt *r2; 11304 11305 r2 = self->f->setInt(self, "1", 1); 11306 ck_assert_ptr_ne(r2, null); 11307 r2 = self->f->setDouble(self, "2", 2.2); 11308 ck_assert_ptr_ne(r2, null); 11309 smallContainert *c = allocSmallContainer(&r); 11310 r2 = self->f->setNFreeSmallContainer(self, "b", c); 11311 ck_assert_ptr_ne(r2, null); 11312 createAllocateSmallInt(I); 11313 setValG(I, 11); 11314 I->type = "anothertype"; 11315 r2 = self->f->set(self, "B", (baset*)I); 11316 ck_assert_ptr_ne(r2, null); 11317 r = cropElemSmallContainerSmallDictG(self, "b"); 11318 ck_assert_ptr_ne(r, null); 11319 char *s = toStringO(r); 11320 terminateO(r); 11321 ck_assert_str_eq(s, "<data smallContainer>"); 11322 free(s); 11323 s = toStringO(self); 11324 ck_assert_str_eq(s, "{\"1\":1,\"2\":2.200000e+00,\"B\":\"<data container>\"}"); 11325 free(s); 11326 terminateO(self); 11327 11328 END_TEST 11329 11330 11331 START_TEST(delSmallDictGT) 11332 11333 smallDictt* r; 11334 smallDictt *self = allocG(rtSmallDictt); 11335 11336 r = self->f->setInt(self, "1", 1); 11337 ck_assert_ptr_ne(r, null); 11338 r = self->f->setDouble(self, "2", 2.2); 11339 ck_assert_ptr_ne(r, null); 11340 r = delSmallDictG(self, "2", 0); 11341 ck_assert_ptr_ne(r, null); 11342 char *s = toStringO(r); 11343 ck_assert_str_eq(s, "{\"1\":1}"); 11344 free(s); 11345 terminateO(self); 11346 11347 END_TEST 11348 11349 11350 START_TEST(delKCharSmallDictGT) 11351 11352 smallDictt* r; 11353 smallDictt *self = allocG(rtSmallDictt); 11354 11355 r = self->f->setInt(self, "1", 1); 11356 ck_assert_ptr_ne(r, null); 11357 r = self->f->setDouble(self, "2", 2.2); 11358 ck_assert_ptr_ne(r, null); 11359 r = delKCharSmallDictG(self, '2', 0); 11360 ck_assert_ptr_ne(r, null); 11361 char *s = toStringO(r); 11362 ck_assert_str_eq(s, "{\"1\":1}"); 11363 free(s); 11364 terminateO(self); 11365 11366 END_TEST 11367 11368 11369 START_TEST(delElemSmallDictGT) 11370 11371 smallDictt* r; 11372 smallDictt *self = allocG(rtSmallDictt); 11373 11374 r = self->f->setInt(self, "1", 1); 11375 ck_assert_ptr_ne(r, null); 11376 r = self->f->setDouble(self, "2", 2.2); 11377 ck_assert_ptr_ne(r, null); 11378 r = delElemSmallDictG(self, "2"); 11379 ck_assert_ptr_ne(r, null); 11380 char *s = toStringO(r); 11381 ck_assert_str_eq(s, "{\"1\":1}"); 11382 free(s); 11383 terminateO(self); 11384 11385 END_TEST 11386 11387 11388 START_TEST(delElemKCharSmallDictGT) 11389 11390 smallDictt* r; 11391 smallDictt *self = allocG(rtSmallDictt); 11392 11393 r = self->f->setInt(self, "1", 1); 11394 ck_assert_ptr_ne(r, null); 11395 r = self->f->setDouble(self, "2", 2.2); 11396 ck_assert_ptr_ne(r, null); 11397 r = delElemKCharSmallDictG(self, '2'); 11398 ck_assert_ptr_ne(r, null); 11399 char *s = toStringO(r); 11400 ck_assert_str_eq(s, "{\"1\":1}"); 11401 free(s); 11402 terminateO(self); 11403 11404 END_TEST 11405 11406 11407 START_TEST(removeSmallDictGT) 11408 11409 smallDictt* r; 11410 smallDictt *self = allocG(rtSmallDictt); 11411 11412 smallIntt *i = allocSmallInt(1); 11413 r = self->f->setSmallInt(self, "1", i); 11414 ck_assert_ptr_ne(r, null); 11415 r = removeSmallDictG(self, "1", 0); 11416 ck_assert_ptr_ne(r, null); 11417 terminateO(i); 11418 char *s = toStringO(r); 11419 ck_assert_str_eq(s, "{}"); 11420 free(s); 11421 terminateO(self); 11422 11423 END_TEST 11424 11425 11426 START_TEST(removeKCharSmallDictGT) 11427 11428 smallDictt* r; 11429 smallDictt *self = allocG(rtSmallDictt); 11430 11431 smallIntt *i = allocSmallInt(1); 11432 r = self->f->setSmallInt(self, "1", i); 11433 ck_assert_ptr_ne(r, null); 11434 r = removeKCharSmallDictG(self, '1', 0); 11435 ck_assert_ptr_ne(r, null); 11436 terminateO(i); 11437 char *s = toStringO(r); 11438 ck_assert_str_eq(s, "{}"); 11439 free(s); 11440 terminateO(self); 11441 11442 END_TEST 11443 11444 11445 START_TEST(removeElemSmallDictGT) 11446 11447 smallDictt* r; 11448 smallDictt *self = allocG(rtSmallDictt); 11449 11450 smallIntt *i = allocSmallInt(1); 11451 r = self->f->setSmallInt(self, "1", i); 11452 ck_assert_ptr_ne(r, null); 11453 r = removeElemSmallDictG(self, "1"); 11454 ck_assert_ptr_ne(r, null); 11455 terminateO(i); 11456 char *s = toStringO(r); 11457 ck_assert_str_eq(s, "{}"); 11458 free(s); 11459 terminateO(self); 11460 11461 END_TEST 11462 11463 11464 START_TEST(removeElemKCharSmallDictGT) 11465 11466 smallDictt* r; 11467 smallDictt *self = allocG(rtSmallDictt); 11468 11469 smallIntt *i = allocSmallInt(1); 11470 r = self->f->setSmallInt(self, "1", i); 11471 ck_assert_ptr_ne(r, null); 11472 r = removeElemKCharSmallDictG(self, '1'); 11473 ck_assert_ptr_ne(r, null); 11474 terminateO(i); 11475 char *s = toStringO(r); 11476 ck_assert_str_eq(s, "{}"); 11477 free(s); 11478 terminateO(self); 11479 11480 END_TEST 11481 11482 11483 START_TEST(hasSmallDictGT) 11484 11485 smallDictt *self = allocG(rtSmallDictt); 11486 11487 smallDictt *r2 = self->f->setInt(self, "1", 1); 11488 ck_assert_ptr_ne(r2, null); 11489 ck_assert(hasSmallDictG(self, "1")); 11490 terminateO(self); 11491 11492 END_TEST 11493 11494 11495 START_TEST(hasKCharSmallDictGT) 11496 11497 smallDictt *self = allocG(rtSmallDictt); 11498 11499 smallDictt *r2 = self->f->setInt(self, "1", 1); 11500 ck_assert_ptr_ne(r2, null); 11501 ck_assert(hasKCharSmallDictG(self, '1')); 11502 terminateO(self); 11503 11504 END_TEST 11505 11506 11507 START_TEST(keyBySmallDictGT) 11508 11509 char* r; 11510 smallDictt *self = allocG(rtSmallDictt); 11511 baset *value; 11512 11513 smallDictt *r2 = self->f->setInt(self, "1", 1); 11514 ck_assert_ptr_ne(r2, null); 11515 value = (baset*) allocSmallInt(1); 11516 r = keyBySmallDictG(self, value); 11517 ck_assert_str_eq(r, "1"); 11518 terminateO(value); 11519 terminateO(self); 11520 11521 END_TEST 11522 11523 11524 START_TEST(keyByUndefinedSmallDictGT) 11525 11526 char* r; 11527 smallDictt *self = allocG(rtSmallDictt); 11528 undefinedt *value; 11529 11530 smallDictt *r2 = self->f->setUndefined(self, "1"); 11531 ck_assert_ptr_ne(r2, null); 11532 value = allocUndefined(); 11533 r = keyByUndefinedSmallDictG(self, value); 11534 ck_assert_str_eq(r, "1"); 11535 terminateO(value); 11536 terminateO(self); 11537 11538 END_TEST 11539 11540 11541 START_TEST(keyByBoolSmallDictGT) 11542 11543 char* r; 11544 smallDictt *self = allocG(rtSmallDictt); 11545 11546 smallDictt *r2 = self->f->setBool(self, "1", true); 11547 ck_assert_ptr_ne(r2, null); 11548 r = keyByBoolSmallDictG(self, true); 11549 ck_assert_str_eq(r, "1"); 11550 terminateO(self); 11551 11552 END_TEST 11553 11554 11555 START_TEST(keyByDoubleSmallDictGT) 11556 11557 char* r; 11558 smallDictt *self = allocG(rtSmallDictt); 11559 11560 smallDictt *r2 = self->f->setDouble(self, "1", 2.2); 11561 ck_assert_ptr_ne(r2, null); 11562 r = keyByDoubleSmallDictG(self, 2.2); 11563 ck_assert_str_eq(r, "1"); 11564 terminateO(self); 11565 11566 END_TEST 11567 11568 11569 START_TEST(keyByIntSmallDictGT) 11570 11571 char* r; 11572 smallDictt *self = allocG(rtSmallDictt); 11573 11574 smallDictt *r2 = self->f->setInt(self, "1", 2); 11575 ck_assert_ptr_ne(r2, null); 11576 r = keyByIntSmallDictG(self, 2); 11577 ck_assert_str_eq(r, "1"); 11578 terminateO(self); 11579 11580 END_TEST 11581 11582 11583 START_TEST(keyBySSmallDictGT) 11584 11585 char* r; 11586 smallDictt *self = allocG(rtSmallDictt); 11587 11588 smallDictt *r2 = self->f->setS(self, "1", "qwe"); 11589 ck_assert_ptr_ne(r2, null); 11590 r = keyBySSmallDictG(self, "qwe"); 11591 ck_assert_str_eq(r, "1"); 11592 terminateO(self); 11593 11594 END_TEST 11595 11596 11597 START_TEST(keyByCharSmallDictGT) 11598 11599 char* r; 11600 smallDictt *self = allocG(rtSmallDictt); 11601 11602 smallDictt *r2 = self->f->setS(self, "1", "q"); 11603 ck_assert_ptr_ne(r2, null); 11604 r = keyByCharSmallDictG(self, 'q'); 11605 ck_assert_str_eq(r, "1"); 11606 terminateO(self); 11607 11608 END_TEST 11609 11610 11611 START_TEST(keyByDictSmallDictGT) 11612 11613 char* r; 11614 smallDictt *self = allocG(rtSmallDictt); 11615 smallDictt *dict = allocSmallDict(); 11616 11617 createAllocateSmallDict(d); 11618 d->f->setS(d, "another", "dict"); 11619 smallDictt *r2 = self->f->setNFreeDict(self, "d", d); 11620 ck_assert_ptr_ne(r2, null); 11621 r2 = self->f->setNFreeDict(self, "1", dict); 11622 ck_assert_ptr_ne(r2, null); 11623 dict = allocSmallDict(); 11624 r = keyByDictSmallDictG(self, dict); 11625 ck_assert_str_eq(r, "1"); 11626 terminateO(dict); 11627 terminateO(self); 11628 11629 END_TEST 11630 11631 11632 START_TEST(keyByArraySmallDictGT) 11633 11634 char* r; 11635 smallDictt *self = allocG(rtSmallDictt); 11636 smallArrayt *array = allocSmallArray(); 11637 11638 createAllocateSmallArray(d); 11639 d->f->pushS(d, "another array"); 11640 smallDictt *r2 = self->f->setNFreeArray(self, "d", d); 11641 ck_assert_ptr_ne(r2, null); 11642 r2 = self->f->setNFreeArray(self, "1", array); 11643 ck_assert_ptr_ne(r2, null); 11644 array = allocSmallArray(); 11645 r = keyByArraySmallDictG(self, array); 11646 ck_assert_str_eq(r, "1"); 11647 terminateO(array); 11648 terminateO(self); 11649 11650 END_TEST 11651 11652 11653 START_TEST(keyByArraycSmallDictGT) 11654 11655 char* r; 11656 smallDictt *self = allocG(rtSmallDictt); 11657 char **array = listCreateS("a","b"); 11658 11659 char **d = listCreateS("asd", "zxcv"); 11660 smallDictt *r2 = self->f->setNFreeArrayc(self, "d", d); 11661 ck_assert_ptr_ne(r2, null); 11662 r2 = self->f->setArrayc(self, "1", array); 11663 ck_assert_ptr_ne(r2, null); 11664 r = keyByArraycSmallDictG(self, array); 11665 ck_assert_ptr_ne(r, NULL); 11666 ck_assert_str_eq(r, "1"); 11667 listFreeS(array); 11668 terminateO(self); 11669 11670 END_TEST 11671 11672 11673 START_TEST(keyByCArraycSmallDictGT) 11674 11675 char* r; 11676 smallDictt *self = allocG(rtSmallDictt); 11677 char **array = listCreateS("a","b"); 11678 const char *a[] = {"a", "b", null}; 11679 11680 char **d = listCreateS("asd", "zxcv"); 11681 smallDictt *r2 = self->f->setNFreeArrayc(self, "d", d); 11682 ck_assert_ptr_ne(r2, null); 11683 r2 = self->f->setArrayc(self, "1", array); 11684 ck_assert_ptr_ne(r2, null); 11685 r = keyByCArraycSmallDictG(self, a); 11686 ck_assert_ptr_ne(r, NULL); 11687 ck_assert_str_eq(r, "1"); 11688 listFreeS(array); 11689 terminateO(self); 11690 11691 END_TEST 11692 11693 11694 START_TEST(keyBySmallBoolSmallDictGT) 11695 11696 char* r; 11697 smallDictt *self = allocG(rtSmallDictt); 11698 smallBoolt *value = allocSmallBool(true); 11699 11700 createAllocateSmallBool(d); 11701 setValO(d, false); 11702 smallDictt *r2 = self->f->setNFreeSmallBool(self, "d", d); 11703 ck_assert_ptr_ne(r2, null); 11704 r2 = self->f->setNFreeSmallBool(self, "1", value); 11705 ck_assert_ptr_ne(r2, null); 11706 value = allocSmallBool(true); 11707 r = keyBySmallBoolSmallDictG(self, value); 11708 ck_assert_str_eq(r, "1"); 11709 terminateO(value); 11710 terminateO(self); 11711 11712 END_TEST 11713 11714 11715 START_TEST(keyBySmallBytesSmallDictGT) 11716 11717 char* r; 11718 smallDictt *self = allocG(rtSmallDictt); 11719 smallBytest *value = allocSmallBytes("qwe", sizeof("qwe")); 11720 11721 smallBytest *d = allocSmallBytes("asd", sizeof("asd")); 11722 smallDictt *r2 = self->f->setNFreeSmallBytes(self, "d", d); 11723 ck_assert_ptr_ne(r2, null); 11724 r2 = self->f->setNFreeSmallBytes(self, "1", value); 11725 ck_assert_ptr_ne(r2, null); 11726 value = allocSmallBytes("qwe", sizeof("qwe")); 11727 r = keyBySmallBytesSmallDictG(self, value); 11728 ck_assert_str_eq(r, "1"); 11729 terminateO(value); 11730 terminateO(self); 11731 11732 END_TEST 11733 11734 11735 START_TEST(keyBySmallDoubleSmallDictGT) 11736 11737 char* r; 11738 smallDictt *self = allocG(rtSmallDictt); 11739 smallDoublet *value = allocSmallDouble(2.2); 11740 11741 createAllocateSmallDouble(d); 11742 smallDictt *r2 = self->f->setNFreeSmallDouble(self, "d", d); 11743 ck_assert_ptr_ne(r2, null); 11744 r2 = self->f->setNFreeSmallDouble(self, "1", value); 11745 ck_assert_ptr_ne(r2, null); 11746 value = allocSmallDouble(2.2); 11747 r = keyBySmallDoubleSmallDictG(self, value); 11748 ck_assert_str_eq(r, "1"); 11749 terminateO(value); 11750 terminateO(self); 11751 11752 END_TEST 11753 11754 11755 START_TEST(keyBySmallIntSmallDictGT) 11756 11757 char* r; 11758 smallDictt *self = allocG(rtSmallDictt); 11759 smallIntt *value = allocSmallInt(2); 11760 11761 createAllocateSmallInt(d); 11762 smallDictt *r2 = self->f->setNFreeSmallInt(self, "d", d); 11763 ck_assert_ptr_ne(r2, null); 11764 r2 = self->f->setNFreeSmallInt(self, "1", value); 11765 ck_assert_ptr_ne(r2, null); 11766 value = allocSmallInt(2); 11767 r = keyBySmallIntSmallDictG(self, value); 11768 ck_assert_str_eq(r, "1"); 11769 terminateO(value); 11770 terminateO(self); 11771 11772 END_TEST 11773 11774 11775 START_TEST(keyBySmallJsonSmallDictGT) 11776 11777 char* r; 11778 smallDictt *self = allocG(rtSmallDictt); 11779 smallJsont *value = allocSmallJson(); 11780 11781 createUndefined(u); 11782 setTopO(value, (baset*)&u); 11783 self->f->setUndefined(self, "1"); 11784 r = keyBySmallJsonSmallDictG(self, value); 11785 ck_assert_str_eq(r, "1"); 11786 terminateO(value); 11787 terminateO(self); 11788 11789 END_TEST 11790 11791 11792 START_TEST(keyBySmallStringSmallDictGT) 11793 11794 char* r; 11795 smallDictt *self = allocG(rtSmallDictt); 11796 smallStringt *value = allocSmallString("qwe"); 11797 11798 createAllocateSmallString(d); 11799 smallDictt *r2 = self->f->setNFreeSmallString(self, "d", d); 11800 ck_assert_ptr_ne(r2, null); 11801 r2 = self->f->setNFreeSmallString(self, "1", value); 11802 ck_assert_ptr_ne(r2, null); 11803 value = allocSmallString("qwe"); 11804 r = keyBySmallStringSmallDictG(self, value); 11805 ck_assert_str_eq(r, "1"); 11806 terminateO(value); 11807 terminateO(self); 11808 11809 END_TEST 11810 11811 11812 START_TEST(keyBySmallContainerSmallDictGT) 11813 11814 char* r; 11815 smallDictt *self = allocG(rtSmallDictt); 11816 smallContainert *value = allocSmallContainer(null); 11817 11818 createAllocateSmallString(d); 11819 smallDictt *r2 = self->f->setNFreeSmallString(self, "d", d); 11820 ck_assert_ptr_ne(r2, null); 11821 r = keyBySmallContainerSmallDictG(self, value); 11822 ck_assert_ptr_eq(r, null); 11823 terminateO(value); 11824 terminateO(self); 11825 11826 END_TEST 11827 11828 11829 START_TEST(icKeyBySmallDictGT) 11830 11831 char* r; 11832 smallDictt *self = allocG(rtSmallDictt); 11833 baset *value; 11834 11835 smallDictt *r2 = self->f->setS(self, "1", "QQ"); 11836 ck_assert_ptr_ne(r2, null); 11837 value = (baset*) allocSmallString("qq"); 11838 r = icKeyBySmallDictG(self, value); 11839 ck_assert_str_eq(r, "1"); 11840 terminateO(value); 11841 terminateO(self); 11842 11843 END_TEST 11844 11845 11846 START_TEST(icKeyBySSmallDictGT) 11847 11848 char* r; 11849 smallDictt *self = allocG(rtSmallDictt); 11850 11851 smallDictt *r2 = self->f->setS(self, "1", "qwe"); 11852 ck_assert_ptr_ne(r2, null); 11853 r = icKeyBySSmallDictG(self, "QWE"); 11854 ck_assert_str_eq(r, "1"); 11855 terminateO(self); 11856 11857 END_TEST 11858 11859 11860 START_TEST(icKeyByCharSmallDictGT) 11861 11862 char* r; 11863 smallDictt *self = allocG(rtSmallDictt); 11864 11865 smallDictt *r2 = self->f->setS(self, "1", "q"); 11866 ck_assert_ptr_ne(r2, null); 11867 r = icKeyByCharSmallDictG(self, 'Q'); 11868 ck_assert_str_eq(r, "1"); 11869 terminateO(self); 11870 11871 END_TEST 11872 11873 11874 START_TEST(icKeyByDictSmallDictGT) 11875 11876 char* r; 11877 smallDictt *self = allocG(rtSmallDictt); 11878 smallDictt *dict = allocSmallDict(); 11879 11880 createAllocateSmallDict(d); 11881 d->f->setS(d, "another", "dict"); 11882 smallDictt *r2 = self->f->setNFreeDict(self, "d", d); 11883 ck_assert_ptr_ne(r2, null); 11884 dict->f->setS(dict, "asd", "asd"); 11885 r2 = self->f->setNFreeDict(self, "1", dict); 11886 ck_assert_ptr_ne(r2, null); 11887 dict = allocSmallDict(); 11888 dict->f->setS(dict, "ASD", "asd"); 11889 r = icKeyByDictSmallDictG(self, dict); 11890 ck_assert_str_eq(r, "1"); 11891 terminateO(dict); 11892 terminateO(self); 11893 11894 END_TEST 11895 11896 11897 START_TEST(icKeyByArraySmallDictGT) 11898 11899 char* r; 11900 smallDictt *self = allocG(rtSmallDictt); 11901 smallArrayt *array = allocSmallArray(); 11902 11903 createAllocateSmallArray(d); 11904 d->f->pushS(d, "another array"); 11905 smallDictt *r2 = self->f->setNFreeArray(self, "d", d); 11906 ck_assert_ptr_ne(r2, null); 11907 array->f->pushS(array, "the array"); 11908 r2 = self->f->setNFreeArray(self, "1", array); 11909 ck_assert_ptr_ne(r2, null); 11910 array = allocSmallArray(); 11911 array->f->pushS(array, "The array"); 11912 r = icKeyByArraySmallDictG(self, array); 11913 ck_assert_str_eq(r, "1"); 11914 terminateO(array); 11915 terminateO(self); 11916 11917 END_TEST 11918 11919 11920 START_TEST(icKeyByArraycSmallDictGT) 11921 11922 char* r; 11923 smallDictt *self = allocG(rtSmallDictt); 11924 char **array = listCreateS("a","b"); 11925 11926 char **d = listCreateS("asd", "zxcv"); 11927 smallDictt *r2 = self->f->setNFreeArrayc(self, "d", d); 11928 ck_assert_ptr_ne(r2, null); 11929 r2 = self->f->setArrayc(self, "1", array); 11930 ck_assert_ptr_ne(r2, null); 11931 iUpperS(&array[0]); 11932 r = icKeyByArraycSmallDictG(self, array); 11933 ck_assert_ptr_ne(r, NULL); 11934 ck_assert_str_eq(r, "1"); 11935 listFreeS(array); 11936 terminateO(self); 11937 11938 END_TEST 11939 11940 11941 START_TEST(icKeyByCArraycSmallDictGT) 11942 11943 char* r; 11944 smallDictt *self = allocG(rtSmallDictt); 11945 const char *a2[] = {"a","b",null}; 11946 char **array = listCreateS("a","b"); 11947 11948 char **d = listCreateS("asd", "zxcv"); 11949 smallDictt *r2 = self->f->setNFreeArrayc(self, "d", d); 11950 ck_assert_ptr_ne(r2, null); 11951 r2 = self->f->setArrayc(self, "1", array); 11952 ck_assert_ptr_ne(r2, null); 11953 iUpperS(&array[0]); 11954 r = icKeyByCArraycSmallDictG(self, a2); 11955 ck_assert_ptr_ne(r, NULL); 11956 ck_assert_str_eq(r, "1"); 11957 listFreeS(array); 11958 terminateO(self); 11959 11960 END_TEST 11961 11962 11963 START_TEST(icKeyBySmallJsonSmallDictGT) 11964 11965 char* r; 11966 smallDictt *self = allocG(rtSmallDictt); 11967 smallJsont *value = allocSmallJson(); 11968 11969 //r = icKeyBySmallJsonSmallDictG(self); 11970 createUndefined(u); 11971 setTopO(value, (baset*)&u); 11972 self->f->setUndefined(self, "1"); 11973 r = icKeyBySmallJsonSmallDictG(self, value); 11974 ck_assert_str_eq(r, "1"); 11975 terminateO(value); 11976 terminateO(self); 11977 11978 END_TEST 11979 11980 11981 START_TEST(icKeyBySmallStringSmallDictGT) 11982 11983 char* r; 11984 smallDictt *self = allocG(rtSmallDictt); 11985 smallStringt *value = allocSmallString("qwe"); 11986 11987 createAllocateSmallString(d); 11988 smallDictt *r2 = self->f->setNFreeSmallString(self, "d", d); 11989 ck_assert_ptr_ne(r2, null); 11990 r2 = self->f->setNFreeSmallString(self, "1", value); 11991 ck_assert_ptr_ne(r2, null); 11992 value = allocSmallString("QWE"); 11993 r = icKeyBySmallStringSmallDictG(self, value); 11994 ck_assert_str_eq(r, "1"); 11995 terminateO(value); 11996 terminateO(self); 11997 11998 END_TEST 11999 12000 12001 START_TEST(trimSmallDictGT) 12002 12003 smallDictt* r; 12004 smallDictt *self = allocG(rtSmallDictt); 12005 12006 self->f->setS(self, "1", "2"); 12007 self->f->setS(self, "3", "4"); 12008 self->f->del(self, "3"); 12009 r = trimSmallDictG(self); 12010 ck_assert_ptr_ne(r, null); 12011 ck_assert_int_eq(lenO(self), 1); 12012 char *s = toStringO(r); 12013 ck_assert_str_eq(s, "{\"1\":\"2\"}"); 12014 free(s); 12015 terminateO(self); 12016 12017 END_TEST 12018 12019 12020 START_TEST(keysSmallStringSmallDictGT) 12021 12022 smallArrayt* r; 12023 smallDictt *self = allocG(rtSmallDictt); 12024 12025 self->f->setS(self, "1", "2"); 12026 self->f->setS(self, "3", "4"); 12027 r = keysSmallStringSmallDictG(self); 12028 ck_assert_ptr_ne(r, null); 12029 char *s = toStringO(r); 12030 ck_assert_str_eq(s, "[\"1\",\"3\"]"); 12031 free(s); 12032 terminateO(r); 12033 terminateO(self); 12034 12035 END_TEST 12036 12037 12038 START_TEST(lenSmallDictGT) 12039 12040 size_t r; 12041 smallDictt *self = allocG(rtSmallDictt); 12042 12043 self->f->setS(self, "1", "2"); 12044 self->f->setS(self, "3", "4"); 12045 r = lenSmallDictG(self); 12046 ck_assert_int_eq(r, 2); 12047 terminateO(self); 12048 12049 END_TEST 12050 12051 12052 START_TEST(emptySmallDictGT) 12053 12054 smallDictt* r; 12055 smallDictt *self = allocG(rtSmallDictt); 12056 12057 self->f->setS(self, "1", "2"); 12058 self->f->setS(self, "3", "4"); 12059 r = emptySmallDictG(self); 12060 ck_assert_ptr_ne(r, null); 12061 ck_assert_int_eq(lenO(self), 0); 12062 terminateO(self); 12063 12064 END_TEST 12065 12066 12067 START_TEST(isEmptySmallDictGT) 12068 12069 bool r; 12070 smallDictt *self = allocG(rtSmallDictt); 12071 12072 r = isEmptySmallDictG(self); 12073 ck_assert(r); 12074 terminateO(self); 12075 12076 END_TEST 12077 12078 12079 START_TEST(zipSmallDictGT) 12080 12081 smallDictt* r; 12082 smallDictt *self = allocG(rtSmallDictt); 12083 smallArrayt *keys = allocSmallArray(); 12084 smallArrayt *values = allocSmallArray(); 12085 12086 self->f->setInt(self, "", 1); 12087 // 3 elements in keys 12088 // 2 elements in values 12089 // only 2 key/values are zipped 12090 keys->f->pushS(keys, "a"); 12091 keys->f->pushS(keys, "b"); 12092 keys->f->pushS(keys, "c"); 12093 values->f->pushInt(values, 1); 12094 values->f->pushInt(values, 2); 12095 r = zipSmallDictG(self, keys, values); 12096 terminateO(keys); 12097 smashO(values); 12098 ck_assert_ptr_ne(r, NULL); 12099 char *s = toStringO(r); 12100 ck_assert_str_eq(s, "{\"\":1,\"a\":1,\"b\":2}"); 12101 free(s); 12102 terminateO(self); 12103 12104 END_TEST 12105 12106 12107 START_TEST(zipSmallJsonSmallDictGT) 12108 12109 smallDictt* r; 12110 smallDictt *self = allocG(rtSmallDictt); 12111 smallArrayt *keys = allocSmallArray(); 12112 smallJsont *values = allocSmallJson(); 12113 12114 self->f->setInt(self, "", 1); 12115 // 3 elements in keys 12116 // 2 elements in values 12117 // only 2 key/values are zipped 12118 keys->f->pushS(keys, "a"); 12119 keys->f->pushS(keys, "b"); 12120 keys->f->pushS(keys, "c"); 12121 values->f->pushInt(values, 1); 12122 values->f->pushInt(values, 2); 12123 r = zipSmallJsonSmallDictG(self, keys, values); 12124 terminateO(keys); 12125 smashO(values); 12126 ck_assert_ptr_ne(r, NULL); 12127 char *s = toStringO(r); 12128 ck_assert_str_eq(s, "{\"\":1,\"a\":1,\"b\":2}"); 12129 free(s); 12130 terminateO(self); 12131 12132 END_TEST 12133 12134 12135 START_TEST(zipSmallJsonSmallArraySmallDictGT) 12136 12137 smallDictt* r; 12138 smallDictt *self = allocG(rtSmallDictt); 12139 smallJsont *keys = allocSmallJson(); 12140 smallArrayt *values = allocSmallArray(); 12141 12142 self->f->setInt(self, "", 1); 12143 // 3 elements in keys 12144 // 2 elements in values 12145 // only 2 key/values are zipped 12146 keys->f->pushS(keys, "a"); 12147 keys->f->pushS(keys, "b"); 12148 keys->f->pushS(keys, "c"); 12149 values->f->pushInt(values, 1); 12150 values->f->pushInt(values, 2); 12151 r = zipSmallJsonSmallArraySmallDictG(self, keys, values); 12152 terminateO(keys); 12153 smashO(values); 12154 ck_assert_ptr_ne(r, NULL); 12155 char *s = toStringO(r); 12156 ck_assert_str_eq(s, "{\"\":1,\"a\":1,\"b\":2}"); 12157 free(s); 12158 terminateO(self); 12159 12160 END_TEST 12161 12162 12163 START_TEST(zipSmallJsonSmallJsonSmallDictGT) 12164 12165 smallDictt* r; 12166 smallDictt *self = allocG(rtSmallDictt); 12167 smallJsont *keys = allocSmallJson(); 12168 smallJsont *values = allocSmallJson(); 12169 12170 self->f->setInt(self, "", 1); 12171 // 3 elements in keys 12172 // 2 elements in values 12173 // only 2 key/values are zipped 12174 keys->f->pushS(keys, "a"); 12175 keys->f->pushS(keys, "b"); 12176 keys->f->pushS(keys, "c"); 12177 values->f->pushInt(values, 1); 12178 values->f->pushInt(values, 2); 12179 r = zipSmallJsonSmallJsonSmallDictG(self, keys, values); 12180 terminateO(keys); 12181 smashO(values); 12182 ck_assert_ptr_ne(r, NULL); 12183 char *s = toStringO(r); 12184 ck_assert_str_eq(s, "{\"\":1,\"a\":1,\"b\":2}"); 12185 free(s); 12186 terminateO(self); 12187 12188 END_TEST 12189 12190 12191 START_TEST(zipSmallJsonVArraySmallDictGT) 12192 12193 smallDictt* r; 12194 smallDictt *self = allocG(rtSmallDictt); 12195 smallJsont *keys = allocSmallJson(); 12196 char **values; 12197 12198 self->f->setInt(self, "", 1); 12199 // 3 elements in keys 12200 // 2 elements in values 12201 // only 2 key/values are zipped 12202 keys->f->pushS(keys, "a"); 12203 keys->f->pushS(keys, "b"); 12204 keys->f->pushS(keys, "c"); 12205 values = listCreateS("1", "2"); 12206 r = zipSmallJsonVArraySmallDictG(self, keys, values); 12207 terminateO(keys); 12208 listFreeS(values); 12209 ck_assert_ptr_ne(r, NULL); 12210 char *s = toStringO(r); 12211 ck_assert_str_eq(s, "{\"\":1,\"a\":\"1\",\"b\":\"2\"}"); 12212 free(s); 12213 terminateO(self); 12214 12215 END_TEST 12216 12217 12218 START_TEST(zipSmallJsonVCArraySmallDictGT) 12219 12220 smallDictt* r; 12221 smallDictt *self = allocG(rtSmallDictt); 12222 smallJsont *keys = allocSmallJson(); 12223 const char *values[] = {"1","2",null}; 12224 12225 self->f->setInt(self, "", 1); 12226 // 3 elements in keys 12227 // 2 elements in values 12228 // only 2 key/values are zipped 12229 keys->f->pushS(keys, "a"); 12230 keys->f->pushS(keys, "b"); 12231 keys->f->pushS(keys, "c"); 12232 r = zipSmallJsonVCArraySmallDictG(self, keys, values); 12233 terminateO(keys); 12234 ck_assert_ptr_ne(r, NULL); 12235 char *s = toStringO(r); 12236 ck_assert_str_eq(s, "{\"\":1,\"a\":\"1\",\"b\":\"2\"}"); 12237 free(s); 12238 terminateO(self); 12239 12240 END_TEST 12241 12242 12243 START_TEST(zipArraySmallDictGT) 12244 12245 smallDictt* r; 12246 smallDictt *self = allocG(rtSmallDictt); 12247 char** keys; 12248 smallArrayt *values = allocSmallArray(); 12249 12250 self->f->setInt(self, "", 1); 12251 // 3 elements in keys 12252 // 2 elements in values 12253 // only 2 key/values are zipped 12254 keys = listCreateS("a", "b", "c"); 12255 values->f->pushInt(values, 1); 12256 values->f->pushInt(values, 2); 12257 r = zipArraySmallDictG(self, keys, values); 12258 listFreeS(keys); 12259 smashO(values); 12260 ck_assert_ptr_ne(r, NULL); 12261 char *s = toStringO(r); 12262 ck_assert_str_eq(s, "{\"\":1,\"a\":1,\"b\":2}"); 12263 free(s); 12264 terminateO(self); 12265 12266 END_TEST 12267 12268 12269 START_TEST(zipArraySmallJsonSmallDictGT) 12270 12271 smallDictt* r; 12272 smallDictt *self = allocG(rtSmallDictt); 12273 char** keys; 12274 smallJsont *values = allocSmallJson(); 12275 12276 self->f->setInt(self, "", 1); 12277 // 3 elements in keys 12278 // 2 elements in values 12279 // only 2 key/values are zipped 12280 keys = listCreateS("a", "b", "c"); 12281 values->f->pushInt(values, 1); 12282 values->f->pushInt(values, 2); 12283 r = zipArraySmallJsonSmallDictG(self, keys, values); 12284 listFreeS(keys); 12285 smashO(values); 12286 ck_assert_ptr_ne(r, NULL); 12287 char *s = toStringO(r); 12288 ck_assert_str_eq(s, "{\"\":1,\"a\":1,\"b\":2}"); 12289 free(s); 12290 terminateO(self); 12291 12292 END_TEST 12293 12294 12295 START_TEST(zipCArraySmallDictGT) 12296 12297 smallDictt* r; 12298 smallDictt *self = allocG(rtSmallDictt); 12299 const char* keys[] = {"a","b","c",null}; 12300 smallArrayt *values = allocSmallArray(); 12301 12302 self->f->setInt(self, "", 1); 12303 // 3 elements in keys 12304 // 2 elements in values 12305 // only 2 key/values are zipped 12306 values->f->pushInt(values, 1); 12307 values->f->pushInt(values, 2); 12308 r = zipCArraySmallDictG(self, keys, values); 12309 smashO(values); 12310 ck_assert_ptr_ne(r, NULL); 12311 char *s = toStringO(r); 12312 ck_assert_str_eq(s, "{\"\":1,\"a\":1,\"b\":2}"); 12313 free(s); 12314 terminateO(self); 12315 12316 END_TEST 12317 12318 12319 START_TEST(zipCArraySmallJsonSmallDictGT) 12320 12321 smallDictt* r; 12322 smallDictt *self = allocG(rtSmallDictt); 12323 const char* keys[] = {"a","b","c",null}; 12324 smallJsont *values = allocSmallJson(); 12325 12326 self->f->setInt(self, "", 1); 12327 // 3 elements in keys 12328 // 2 elements in values 12329 // only 2 key/values are zipped 12330 values->f->pushInt(values, 1); 12331 values->f->pushInt(values, 2); 12332 r = zipCArraySmallJsonSmallDictG(self, keys, values); 12333 smashO(values); 12334 ck_assert_ptr_ne(r, NULL); 12335 char *s = toStringO(r); 12336 ck_assert_str_eq(s, "{\"\":1,\"a\":1,\"b\":2}"); 12337 free(s); 12338 terminateO(self); 12339 12340 END_TEST 12341 12342 12343 START_TEST(zipArrayArraySmallDictGT) 12344 12345 smallDictt* r; 12346 smallDictt *self = allocG(rtSmallDictt); 12347 char** keys; 12348 char** values; 12349 12350 self->f->setInt(self, "", 1); 12351 // 3 elements in keys 12352 // 2 elements in values 12353 // only 2 key/values are zipped 12354 keys = listCreateS("a", "b", "c"); 12355 values = listCreateS("1", "2"); 12356 r = zipArrayArraySmallDictG(self, keys, values); 12357 listFreeS(keys); 12358 listFreeS(values); 12359 ck_assert_ptr_ne(r, NULL); 12360 char *s = toStringO(r); 12361 ck_assert_str_eq(s, "{\"\":1,\"a\":\"1\",\"b\":\"2\"}"); 12362 free(s); 12363 terminateO(self); 12364 12365 END_TEST 12366 12367 12368 START_TEST(zipCArrayArraySmallDictGT) 12369 12370 smallDictt* r; 12371 smallDictt *self = allocG(rtSmallDictt); 12372 const char* keys[] = {"a","b","c",null}; 12373 char** values; 12374 12375 //r = zipCArrayArraySmallDictG(self); 12376 self->f->setInt(self, "", 1); 12377 // 3 elements in keys 12378 // 2 elements in values 12379 // only 2 key/values are zipped 12380 values = listCreateS("1", "2"); 12381 r = zipCArrayArraySmallDictG(self, keys, values); 12382 listFreeS(values); 12383 ck_assert_ptr_ne(r, NULL); 12384 char *s = toStringO(r); 12385 ck_assert_str_eq(s, "{\"\":1,\"a\":\"1\",\"b\":\"2\"}"); 12386 free(s); 12387 terminateO(self); 12388 12389 END_TEST 12390 12391 12392 START_TEST(zipArrayCArraySmallDictGT) 12393 12394 smallDictt* r; 12395 smallDictt *self = allocG(rtSmallDictt); 12396 char** keys; 12397 const char* values[] = {"1","2",null}; 12398 12399 self->f->setInt(self, "", 1); 12400 // 3 elements in keys 12401 // 2 elements in values 12402 // only 2 key/values are zipped 12403 keys = listCreateS("a", "b", "c"); 12404 r = zipArrayCArraySmallDictG(self, keys, values); 12405 listFreeS(keys); 12406 ck_assert_ptr_ne(r, NULL); 12407 char *s = toStringO(r); 12408 ck_assert_str_eq(s, "{\"\":1,\"a\":\"1\",\"b\":\"2\"}"); 12409 free(s); 12410 terminateO(self); 12411 12412 END_TEST 12413 12414 12415 START_TEST(zipCArrayCArraySmallDictGT) 12416 12417 smallDictt* r; 12418 smallDictt *self = allocG(rtSmallDictt); 12419 const char* keys[] = {"a","b","c",null}; 12420 const char* values[] = {"1","2",null}; 12421 12422 self->f->setInt(self, "", 1); 12423 // 3 elements in keys 12424 // 2 elements in values 12425 // only 2 key/values are zipped 12426 r = zipCArrayCArraySmallDictG(self, keys, values); 12427 ck_assert_ptr_ne(r, NULL); 12428 char *s = toStringO(r); 12429 ck_assert_str_eq(s, "{\"\":1,\"a\":\"1\",\"b\":\"2\"}"); 12430 free(s); 12431 terminateO(self); 12432 12433 END_TEST 12434 12435 12436 START_TEST(zipVArraySmallDictGT) 12437 12438 smallDictt* r; 12439 smallDictt *self = allocG(rtSmallDictt); 12440 smallArrayt *keys = allocSmallArray(); 12441 char** values; 12442 12443 self->f->setInt(self, "", 1); 12444 // 3 elements in keys 12445 // 2 elements in values 12446 // only 2 key/values are zipped 12447 keys->f->pushS(keys, "a"); 12448 keys->f->pushS(keys, "b"); 12449 keys->f->pushS(keys, "c"); 12450 values = listCreateS("1", "2"); 12451 r = zipVArraySmallDictG(self, keys, values); 12452 terminateO(keys); 12453 listFreeS(values); 12454 ck_assert_ptr_ne(r, NULL); 12455 char *s = toStringO(r); 12456 ck_assert_str_eq(s, "{\"\":1,\"a\":\"1\",\"b\":\"2\"}"); 12457 free(s); 12458 terminateO(self); 12459 12460 END_TEST 12461 12462 12463 START_TEST(zipVCArraySmallDictGT) 12464 12465 smallDictt* r; 12466 smallDictt *self = allocG(rtSmallDictt); 12467 smallArrayt *keys = allocSmallArray(); 12468 const char* values[] = {"1","2",null}; 12469 12470 self->f->setInt(self, "", 1); 12471 // 3 elements in keys 12472 // 2 elements in values 12473 // only 2 key/values are zipped 12474 keys->f->pushS(keys, "a"); 12475 keys->f->pushS(keys, "b"); 12476 keys->f->pushS(keys, "c"); 12477 r = zipVCArraySmallDictG(self, keys, values); 12478 terminateO(keys); 12479 ck_assert_ptr_ne(r, NULL); 12480 char *s = toStringO(r); 12481 ck_assert_str_eq(s, "{\"\":1,\"a\":\"1\",\"b\":\"2\"}"); 12482 free(s); 12483 terminateO(self); 12484 12485 END_TEST 12486 12487 12488 START_TEST(fromArraySmallDictGT) 12489 12490 smallDictt* r; 12491 smallDictt *self = allocG(rtSmallDictt); 12492 smallArrayt *items = allocSmallArray(); 12493 12494 self->f->setInt(self, "", 1); 12495 // ignored item 12496 items->f->pushS(items, "ignored"); 12497 createAllocateSmallArray(a); 12498 a->f->pushS(a, "a"); 12499 a->f->pushInt(a, 1); 12500 items->f->pushNFreeArray(items, a); 12501 a = allocSmallArray(); 12502 items->f->pushNFreeArray(items, a); 12503 a = allocSmallArray(); 12504 a->f->pushInt(a, 1); 12505 a->f->pushInt(a, 2); 12506 items->f->pushNFreeArray(items, a); 12507 r = fromArraySmallDictG(self, items); 12508 ck_assert_ptr_ne(r, NULL); 12509 char *s = toStringO(r); 12510 ck_assert_str_eq(s, "{\"\":1,\"a\":1}"); 12511 free(s); 12512 terminateO(items); 12513 terminateO(self); 12514 12515 END_TEST 12516 12517 12518 START_TEST(toArraySmallDictGT) 12519 12520 smallArrayt* r; 12521 smallDictt *self = allocG(rtSmallDictt); 12522 12523 self->f->setInt(self, "", 1); 12524 self->f->setInt(self, "b", 2); 12525 self->f->setInt(self, "c", 3); 12526 self->f->del(self, ""); 12527 r = toArraySmallDictG(self); 12528 ck_assert_ptr_ne(r, NULL); 12529 char *s = toStringO(r); 12530 ck_assert_str_eq(s, "[[\"b\",2],[\"c\",3]]"); 12531 free(s); 12532 terminateO(r); 12533 smashO(self); 12534 12535 END_TEST 12536 12537 12538 START_TEST(writeFileSmallDictGT) 12539 12540 bool r; 12541 smallDictt *self = allocG(rtSmallDictt); 12542 12543 self->f->setInt(self, "", 1); 12544 self->f->setInt(self, "b", 2); 12545 r = writeFileSmallDictG(self, "smallDictFile.json"); 12546 ck_assert(r); 12547 ck_assert(fileExists("smallDictFile.json")); 12548 char *s = readFileToS("smallDictFile.json"); 12549 ck_assert_str_eq(s, "{\"\":1,\"b\":2}"); 12550 free(s); 12551 rmAll("smallDictFile.json"); 12552 terminateO(self); 12553 12554 END_TEST 12555 12556 12557 START_TEST(writeFileSmallJsonSmallDictGT) 12558 12559 bool r; 12560 smallDictt *self = allocG(rtSmallDictt); 12561 smallJsont *filePath = allocSmallJson(); 12562 12563 self->f->setInt(self, "", 1); 12564 self->f->setInt(self, "b", 2); 12565 setTopSO(filePath, "smallDictFile.json"); 12566 r = writeFileSmallJsonSmallDictG(self, filePath); 12567 ck_assert(r); 12568 ck_assert(fileExists("smallDictFile.json")); 12569 char *s = readFileToS("smallDictFile.json"); 12570 ck_assert_str_eq(s, "{\"\":1,\"b\":2}"); 12571 free(s); 12572 rmAll("smallDictFile.json"); 12573 terminateO(filePath); 12574 terminateO(self); 12575 12576 END_TEST 12577 12578 12579 START_TEST(writeFileSmallStringSmallDictGT) 12580 12581 bool r; 12582 smallDictt *self = allocG(rtSmallDictt); 12583 smallStringt *filePath = allocSmallString("smallDictFile.json"); 12584 12585 self->f->setInt(self, "", 1); 12586 self->f->setInt(self, "b", 2); 12587 r = writeFileSmallStringSmallDictG(self, filePath); 12588 ck_assert(r); 12589 ck_assert(fileExists("smallDictFile.json")); 12590 char *s = readFileToS("smallDictFile.json"); 12591 ck_assert_str_eq(s, "{\"\":1,\"b\":2}"); 12592 free(s); 12593 rmAll("smallDictFile.json"); 12594 terminateO(filePath); 12595 terminateO(self); 12596 12597 END_TEST 12598 12599 12600 START_TEST(writeStreamSmallDictGT) 12601 12602 bool r; 12603 smallDictt *self = allocG(rtSmallDictt); 12604 FILE *fp; 12605 12606 self->f->setInt(self, "", 1); 12607 self->f->setInt(self, "b", 2); 12608 fp = fopen("smallDictFile.json", "w"); 12609 r = writeStreamSmallDictG(self, fp); 12610 ck_assert(r); 12611 fclose(fp); 12612 ck_assert(fileExists("smallDictFile.json")); 12613 char *s = readFileToS("smallDictFile.json"); 12614 ck_assert_str_eq(s, "{\"\":1,\"b\":2}"); 12615 free(s); 12616 rmAll("smallDictFile.json"); 12617 terminateO(self); 12618 12619 END_TEST 12620 12621 12622 START_TEST(appendFileSmallDictGT) 12623 12624 bool r; 12625 smallDictt *self = allocG(rtSmallDictt); 12626 12627 self->f->setInt(self, "", 1); 12628 self->f->setInt(self, "b", 2); 12629 writeFileS("smallDictFile.json", "-"); 12630 r = appendFileSmallDictG(self, "smallDictFile.json"); 12631 ck_assert(r); 12632 ck_assert(fileExists("smallDictFile.json")); 12633 char *s = readFileToS("smallDictFile.json"); 12634 ck_assert_str_eq(s, "-{\"\":1,\"b\":2}"); 12635 free(s); 12636 rmAll("smallDictFile.json"); 12637 terminateO(self); 12638 12639 END_TEST 12640 12641 12642 START_TEST(appendFileSmallStringSmallDictGT) 12643 12644 bool r; 12645 smallDictt *self = allocG(rtSmallDictt); 12646 smallStringt *filePath = allocSmallString("smallDictFile.json"); 12647 12648 self->f->setInt(self, "", 1); 12649 self->f->setInt(self, "b", 2); 12650 writeFileS("smallDictFile.json", "-"); 12651 r = appendFileSmallStringSmallDictG(self, filePath); 12652 ck_assert(r); 12653 ck_assert(fileExists("smallDictFile.json")); 12654 char *s = readFileToS("smallDictFile.json"); 12655 ck_assert_str_eq(s, "-{\"\":1,\"b\":2}"); 12656 free(s); 12657 rmAll("smallDictFile.json"); 12658 terminateO(filePath); 12659 terminateO(self); 12660 12661 END_TEST 12662 12663 12664 START_TEST(logSmallDictGT) 12665 12666 smallDictt *self = allocG(rtSmallDictt); 12667 12668 self->f->setInt(self, "", 1); 12669 self->f->setInt(self, "b", 2); 12670 logSmallDictG(self); 12671 terminateO(self); 12672 12673 END_TEST 12674 12675 12676 START_TEST(typeSmallStringSmallDictGT) 12677 12678 smallStringt* r; 12679 smallDictt *self = allocG(rtSmallDictt); 12680 12681 self->f->setInt(self, "", 1); 12682 self->f->setInt(self, "b", 2); 12683 r = typeSmallStringSmallDictG(self, ""); 12684 ck_assert_str_eq(ssGet(r), "int"); 12685 terminateO(r); 12686 terminateO(self); 12687 12688 END_TEST 12689 12690 12691 START_TEST(typeStringKCharSmallDictGT) 12692 12693 const char* r; 12694 smallDictt *self = allocG(rtSmallDictt); 12695 12696 self->f->setInt(self, "", 1); 12697 self->f->setInt(self, "b", 2); 12698 r = typeStringKCharSmallDictG(self, 'b'); 12699 ck_assert_str_eq(r, "int"); 12700 terminateO(self); 12701 12702 END_TEST 12703 12704 12705 START_TEST(typeSmallStringKCharSmallDictGT) 12706 12707 smallStringt* r; 12708 smallDictt *self = allocG(rtSmallDictt); 12709 12710 self->f->setInt(self, "", 1); 12711 self->f->setInt(self, "b", 2); 12712 r = typeSmallStringKCharSmallDictG(self, 'b'); 12713 ck_assert_str_eq(ssGet(r), "int"); 12714 terminateO(r); 12715 terminateO(self); 12716 12717 END_TEST 12718 12719 12720 START_TEST(cSmallDictT) 12721 12722 // local object 12723 createSmallDict(obj); 12724 ck_assert_str_eq(obj.type, "smallDict"); 12725 // object 12726 createAllocateSmallDict(obj2); 12727 ck_assert_str_eq(obj2->type, "smallDict"); 12728 // toString 12729 char *s = obj2->f->toString(obj2); 12730 ck_assert_str_eq(s, "{}"); 12731 free(s); 12732 // duplicate 12733 smallDictt *o; 12734 createAllocateSmallBool(oBool2); 12735 oBool2->f->set(oBool2, true); 12736 obj2->f->set(obj2, "lib", (baset *)oBool2); 12737 finishO(oBool2); 12738 o = obj2->f->duplicate(obj2); 12739 smallBoolt *oBool3; 12740 oBool3 = (smallBoolt *)o->f->get(o, "lib"); 12741 ck_assert_ptr_ne(oBool3, NULL); 12742 ck_assert(oBool3->value->value == true); 12743 finishO(oBool3); 12744 terminateO(o); 12745 // toString 12746 createAllocateUndefined(oU); 12747 obj2->f->set(obj2, "u", (baset *)oU); 12748 finishO(oU); 12749 createAllocateSmallString(oStr); 12750 oStr->f->set(oStr, "sheepy"); 12751 obj2->f->set(obj2, "str", (baset *)oStr); 12752 finishO(oStr); 12753 s = obj2->f->toString(obj2); 12754 ck_assert_str_eq(s, "{\"lib\":true,\"u\":null,\"str\":\"sheepy\"}"); 12755 free(s); 12756 // dispose 12757 o = obj2->f->duplicate(obj2); 12758 undefinedt *u = (undefinedt *) o->f->get(o, "u"); 12759 smallStringt *st = (smallStringt *) o->f->get(o, "str"); 12760 oBool2 = (smallBoolt *) o->f->get(o, "lib"); 12761 smallt *data = sDictGetTiny(o->d, "u"); 12762 sFree(data); 12763 data = sDictGetTiny(o->d, "str"); 12764 sFree(data); 12765 data = sDictGetTiny(o->d, "lib"); 12766 sFree(data); 12767 o->f->dispose(o); 12768 ck_assert_uint_eq(o->f->len(o), 0); 12769 terminateO(u); 12770 smashO(st); 12771 smashO(oBool2); 12772 terminateO(o); 12773 // smash 12774 o = obj2->f->duplicate(obj2); 12775 u = (undefinedt *) o->f->get(o, "u"); 12776 st = (smallStringt *) o->f->get(o, "str"); 12777 oBool2 = (smallBoolt *) o->f->get(o, "lib"); 12778 data = sDictGetTiny(o->d, "u"); 12779 sFree(data); 12780 data = sDictGetTiny(o->d, "str"); 12781 sFree(data); 12782 data = sDictGetTiny(o->d, "lib"); 12783 sFree(data); 12784 o->f->smash(&o); 12785 terminateO(u); 12786 smashO(st); 12787 smashO(oBool2); 12788 ck_assert_ptr_eq(o, NULL); 12789 // set NULL (not possible) 12790 obj2->f->set(obj2, NULL, NULL); 12791 obj2->f->set(obj2, "no", NULL); 12792 ck_assert_uint_eq(obj2->f->len(obj2), 3); 12793 // get non existing element 12794 oBool3 = (smallBoolt *)obj2->f->get(obj2, "non existing"); 12795 ck_assert_ptr_eq(oBool3, NULL); 12796 ck_assert_ptr_eq(obj2->f->get(obj2, NULL), NULL); 12797 // delete element 12798 smallDictt *r = obj2->f->del(obj2, "lib"); 12799 ck_assert_ptr_ne(r, null); 12800 oBool3 = (smallBoolt *)obj2->f->get(obj2, "lib"); 12801 ck_assert_ptr_eq(oBool3, NULL); 12802 // delete non existing element 12803 r = obj2->f->del(obj2, NULL); 12804 ck_assert_ptr_eq(r, null); 12805 r = obj2->f->del(obj2, "non existing"); 12806 ck_assert_ptr_ne(r, null); 12807 // has 12808 ck_assert(!obj2->f->has(obj2, "qwe")); 12809 ck_assert(!obj2->f->has(obj2, NULL)); 12810 ck_assert(obj2->f->has(obj2, "u")); 12811 // empty dict 12812 createAllocateSmallDict(D); 12813 freeO(D); 12814 ck_assert(!D->f->has(D, "d")); 12815 terminateO(D); 12816 // keys 12817 char **keys = obj2->f->keys(obj2); 12818 ck_assert_uint_eq(listLengthS(keys), 2); 12819 ck_assert_str_eq(keys[0], "u"); 12820 ck_assert_str_eq(keys[1], "str"); 12821 listFreeS(keys); 12822 // empty dict 12823 initiateAllocateSmallDict(&o); 12824 keys = o->f->keys(o); 12825 ck_assert_ptr_eq(keys, NULL); 12826 terminateO(o); 12827 // values 12828 smallArrayt *values = obj2->f->values(obj2); 12829 s = toStringO(values); 12830 ck_assert_str_eq(s, "[null,\"sheepy\"]"); 12831 free(s); 12832 values->f->smash(&values); 12833 // empty dict 12834 initiateAllocateSmallDict(&o); 12835 values = o->f->values(o); 12836 ck_assert_ptr_eq(values, NULL); 12837 terminateO(o); 12838 // merge 12839 smallDictt *oM; 12840 o = obj2->f->duplicate(obj2); 12841 initiateAllocateSmallDict(&oM); 12842 initiateAllocateSmallString(&st); 12843 st->f->set(st, "SHEEPY MERGED"); 12844 oM->f->set(oM, "str", (baset *) st); 12845 finishO(st); 12846 s = toStringO(o); 12847 ck_assert_str_eq(s, "{\"u\":null,\"str\":\"sheepy\"}"); 12848 free(s); 12849 o->f->merge(o, oM); 12850 s = toStringO(o); 12851 ck_assert_str_eq(s, "{\"u\":null,\"str\":\"SHEEPY MERGED\"}"); 12852 free(s); 12853 oM->f->smash(&oM); 12854 terminateO(o); 12855 // empty dict 12856 o = obj2->f->duplicate(obj2); 12857 initiateAllocateSmallDict(&oM); 12858 s = toStringO(o); 12859 ck_assert_str_eq(s, "{\"u\":null,\"str\":\"sheepy\"}"); 12860 free(s); 12861 o->f->merge(o, oM); 12862 s = toStringO(o); 12863 ck_assert_str_eq(s, "{\"u\":null,\"str\":\"sheepy\"}"); 12864 free(s); 12865 oM->f->smash(&oM); 12866 // non smallDict object 12867 createAllocateSmallInt(z); 12868 r = o->f->merge(o, (smallDictt*)z); 12869 ck_assert_ptr_eq(r, null); 12870 terminateO(z); 12871 terminateO(o); 12872 // NULL dict 12873 o = obj2->f->duplicate(obj2); 12874 s = toStringO(o); 12875 ck_assert_str_eq(s, "{\"u\":null,\"str\":\"sheepy\"}"); 12876 free(s); 12877 o->f->merge(o, NULL); 12878 s = toStringO(o); 12879 ck_assert_str_eq(s, "{\"u\":null,\"str\":\"sheepy\"}"); 12880 free(s); 12881 terminateO(o); 12882 // append 12883 o = obj2->f->duplicate(obj2); 12884 initiateAllocateSmallDict(&oM); 12885 initiateAllocateSmallString(&st); 12886 initiateAllocateUndefined(&oU); 12887 st->f->set(st, "SHEEPY MERGED"); 12888 oM->f->set(oM, "str", (baset *) st); 12889 finishO(st); 12890 oM->f->set(oM, "u2", (baset *) oU); 12891 finishO(oU); 12892 s = toStringO(o); 12893 ck_assert_str_eq(s, "{\"u\":null,\"str\":\"sheepy\"}"); 12894 free(s); 12895 o->f->append(o, oM); 12896 s = toStringO(o); 12897 ck_assert_str_eq(s, "{\"u\":null,\"str\":\"sheepy\",\"u2\":null}"); 12898 free(s); 12899 data = sDictGetTiny(oM->d, "str"); 12900 sFree(data); 12901 oM->f->smash(&oM); 12902 terminateO(o); 12903 // empty dict 12904 o = obj2->f->duplicate(obj2); 12905 initiateAllocateSmallDict(&oM); 12906 s = toStringO(o); 12907 ck_assert_str_eq(s, "{\"u\":null,\"str\":\"sheepy\"}"); 12908 free(s); 12909 o->f->append(o, oM); 12910 s = toStringO(o); 12911 ck_assert_str_eq(s, "{\"u\":null,\"str\":\"sheepy\"}"); 12912 free(s); 12913 oM->f->smash(&oM); 12914 // non smallDict object 12915 z = allocSmallInt(0); 12916 r = o->f->append(o, (smallDictt*)z); 12917 ck_assert_ptr_eq(r, null); 12918 terminateO(z); 12919 terminateO(o); 12920 // NULL dict 12921 o = obj2->f->duplicate(obj2); 12922 s = toStringO(o); 12923 ck_assert_str_eq(s, "{\"u\":null,\"str\":\"sheepy\"}"); 12924 free(s); 12925 o->f->append(o, NULL); 12926 s = toStringO(o); 12927 ck_assert_str_eq(s, "{\"u\":null,\"str\":\"sheepy\"}"); 12928 free(s); 12929 terminateO(o); 12930 // len 12931 ck_assert_uint_eq(obj2->f->len(obj2), 2); 12932 // empty dict 12933 initiateAllocateSmallDict(&o); 12934 ck_assert_uint_eq(o->f->len(o), 0); 12935 terminateO(o); 12936 // empty 12937 o = obj2->f->duplicate(obj2); 12938 o->f->empty(o); 12939 ck_assert_uint_eq(o->f->len(o), 0); 12940 terminateO(o); 12941 // typeString type typeStrings 12942 initiateAllocateSmallDict(&oM); 12943 o = allocSmallDict(); 12944 oU = allocUndefined(); 12945 o->f->set(o, "u", (baset *)oU); 12946 finishO(oU); 12947 st = allocSmallString("sheepy"); 12948 o->f->set(o, "str", (baset *) st); 12949 finishO(st); 12950 oBool2 = allocSmallBool(true); 12951 o->f->set(o, "b", (baset *)oBool2); 12952 finishO(oBool2); 12953 oBool2 = allocSmallBool(true); 12954 o->f->set(o, "B", (baset *)oBool2); 12955 finishO(oBool2); 12956 o->f->del(o, "B"); 12957 // typeString 12958 s = (char *)o->f->typeString(o, "b"); 12959 ck_assert_str_eq(s, "bool"); 12960 // non existing key 12961 ck_assert_ptr_eq(o->f->typeString(o, "B"), NULL); 12962 // empty object 12963 ck_assert_ptr_eq(oM->f->typeString(oM, "B"), NULL); 12964 // type 12965 char c; 12966 c = o->f->type(o, "str"); 12967 ck_assert_uint_eq(c, STRING); 12968 // non existing key 12969 ck_assert(!o->f->type(o, "B")); 12970 // empty object 12971 ck_assert(!oM->f->type(oM, "B")); 12972 // typeStrings 12973 smallDictt *oT = o->f->typeStrings(o); 12974 s = toStringO(oT); 12975 ck_assert_str_eq(s, "{\"u\":\"undefined\",\"str\":\"string\",\"b\":\"bool\"}"); 12976 free(s); 12977 terminateO(oT); 12978 // empty object 12979 oT = oM->f->typeStrings(oM); 12980 ck_assert_ptr_eq(oT, NULL); 12981 terminateO(o); 12982 terminateO(oM); 12983 // free local object 12984 obj.f->free(&obj); 12985 ck_assert_str_eq(obj.type, "smallDict"); 12986 // free object 12987 obj2->f->terminate(&obj2); 12988 ck_assert_ptr_eq(obj2, NULL); 12989 12990 END_TEST 12991 12992 12993 12994 Suite * libsheepySuite(void) { 12995 Suite *s; 12996 TCase *tc_core; 12997 12998 s = suite_create("libsheepy"); 12999 13000 /* Core test case */ 13001 tc_core = tcase_create("Object"); 13002 13003 setLogMode(LOG_VERBOSE); 13004 13005 // disable btrace to make the test run faster 13006 btraceDisable(); 13007 13008 tcase_add_test(tc_core, getsoSmallDictT); 13009 tcase_add_test(tc_core, setsoSmallDictT); 13010 tcase_add_test(tc_core, mirrorSmallDictT); 13011 tcase_add_test(tc_core, setUndefinedSmallDictT); 13012 tcase_add_test(tc_core, setBoolSmallDictT); 13013 tcase_add_test(tc_core, setDoubleSmallDictT); 13014 tcase_add_test(tc_core, setIntSmallDictT); 13015 tcase_add_test(tc_core, setSSmallDictT); 13016 tcase_add_test(tc_core, setCharSmallDictT); 13017 tcase_add_test(tc_core, setDictSmallDictT); 13018 tcase_add_test(tc_core, setArraySmallDictT); 13019 tcase_add_test(tc_core, setArraycSmallDictT); 13020 tcase_add_test(tc_core, setSmallBoolSmallDictT); 13021 tcase_add_test(tc_core, setSmallBytesSmallDictT); 13022 tcase_add_test(tc_core, setSmallDoubleSmallDictT); 13023 tcase_add_test(tc_core, setSmallIntSmallDictT); 13024 tcase_add_test(tc_core, setSmallJsonSmallDictT); 13025 tcase_add_test(tc_core, setSmallStringSmallDictT); 13026 tcase_add_test(tc_core, setSmallContainerSmallDictT); 13027 tcase_add_test(tc_core, setKCharSmallDictT); 13028 tcase_add_test(tc_core, setUndefinedKCharSmallDictT); 13029 tcase_add_test(tc_core, setBoolKCharSmallDictT); 13030 tcase_add_test(tc_core, setDoubleKCharSmallDictT); 13031 tcase_add_test(tc_core, setIntKCharSmallDictT); 13032 tcase_add_test(tc_core, setSKCharSmallDictT); 13033 tcase_add_test(tc_core, setCharKCharSmallDictT); 13034 tcase_add_test(tc_core, setDictKCharSmallDictT); 13035 tcase_add_test(tc_core, setArrayKCharSmallDictT); 13036 tcase_add_test(tc_core, setArraycKCharSmallDictT); 13037 tcase_add_test(tc_core, setSmallBoolKCharSmallDictT); 13038 tcase_add_test(tc_core, setSmallBytesKCharSmallDictT); 13039 tcase_add_test(tc_core, setSmallDoubleKCharSmallDictT); 13040 tcase_add_test(tc_core, setSmallIntKCharSmallDictT); 13041 tcase_add_test(tc_core, setSmallJsonKCharSmallDictT); 13042 tcase_add_test(tc_core, setSmallStringKCharSmallDictT); 13043 tcase_add_test(tc_core, setSmallContainerKCharSmallDictT); 13044 tcase_add_test(tc_core, setNFreeSmallDictT); 13045 tcase_add_test(tc_core, setNFreeUndefinedSmallDictT); 13046 tcase_add_test(tc_core, setNFreeSSmallDictT); 13047 tcase_add_test(tc_core, setNFreeDictSmallDictT); 13048 tcase_add_test(tc_core, setNFreeArraySmallDictT); 13049 tcase_add_test(tc_core, setNFreeArraycSmallDictT); 13050 tcase_add_test(tc_core, setNFreeSmallBoolSmallDictT); 13051 tcase_add_test(tc_core, setNFreeSmallBytesSmallDictT); 13052 tcase_add_test(tc_core, setNFreeSmallDoubleSmallDictT); 13053 tcase_add_test(tc_core, setNFreeSmallIntSmallDictT); 13054 tcase_add_test(tc_core, setNFreeSmallJsonSmallDictT); 13055 tcase_add_test(tc_core, setNFreeSmallStringSmallDictT); 13056 tcase_add_test(tc_core, setNFreeSmallContainerSmallDictT); 13057 tcase_add_test(tc_core, setNFreeKCharSmallDictT); 13058 tcase_add_test(tc_core, setNFreeUndefinedKCharSmallDictT); 13059 tcase_add_test(tc_core, setNFreeSKCharSmallDictT); 13060 tcase_add_test(tc_core, setNFreeDictKCharSmallDictT); 13061 tcase_add_test(tc_core, setNFreeArrayKCharSmallDictT); 13062 tcase_add_test(tc_core, setNFreeArraycKCharSmallDictT); 13063 tcase_add_test(tc_core, setNFreeSmallBoolKCharSmallDictT); 13064 tcase_add_test(tc_core, setNFreeSmallBytesKCharSmallDictT); 13065 tcase_add_test(tc_core, setNFreeSmallDoubleKCharSmallDictT); 13066 tcase_add_test(tc_core, setNFreeSmallIntKCharSmallDictT); 13067 tcase_add_test(tc_core, setNFreeSmallJsonKCharSmallDictT); 13068 tcase_add_test(tc_core, setNFreeSmallStringKCharSmallDictT); 13069 tcase_add_test(tc_core, setNFreeSmallContainerKCharSmallDictT); 13070 tcase_add_test(tc_core, setPDictSmallDictT); 13071 tcase_add_test(tc_core, setPArraySmallDictT); 13072 tcase_add_test(tc_core, setPSmallJsonSmallDictT); 13073 tcase_add_test(tc_core, setPSmallStringSmallDictT); 13074 tcase_add_test(tc_core, setNFreePDictSmallDictT); 13075 tcase_add_test(tc_core, setNFreePArraySmallDictT); 13076 tcase_add_test(tc_core, setNFreePSmallJsonSmallDictT); 13077 tcase_add_test(tc_core, setNFreePSmallStringSmallDictT); 13078 tcase_add_test(tc_core, setPArrayKCharSmallDictT); 13079 tcase_add_test(tc_core, setPDictKCharSmallDictT); 13080 tcase_add_test(tc_core, setPSmallJsonKCharSmallDictT); 13081 tcase_add_test(tc_core, setPSmallStringKCharSmallDictT); 13082 tcase_add_test(tc_core, setNFreePArrayKCharSmallDictT); 13083 tcase_add_test(tc_core, setNFreePDictKCharSmallDictT); 13084 tcase_add_test(tc_core, setNFreePSmallJsonKCharSmallDictT); 13085 tcase_add_test(tc_core, setNFreePSmallStringKCharSmallDictT); 13086 tcase_add_test(tc_core, getUndefinedSmallDictT); 13087 tcase_add_test(tc_core, getBoolSmallDictT); 13088 tcase_add_test(tc_core, getBoolPSmallDictT); 13089 tcase_add_test(tc_core, getDoubleSmallDictT); 13090 tcase_add_test(tc_core, getDoublePSmallDictT); 13091 tcase_add_test(tc_core, getIntSmallDictT); 13092 tcase_add_test(tc_core, getIntPSmallDictT); 13093 tcase_add_test(tc_core, getInt32SmallDictT); 13094 tcase_add_test(tc_core, getInt32PSmallDictT); 13095 tcase_add_test(tc_core, getUintSmallDictT); 13096 tcase_add_test(tc_core, getUintPSmallDictT); 13097 tcase_add_test(tc_core, getUint32SmallDictT); 13098 tcase_add_test(tc_core, getUint32PSmallDictT); 13099 tcase_add_test(tc_core, getSSmallDictT); 13100 tcase_add_test(tc_core, getDictSmallDictT); 13101 tcase_add_test(tc_core, getArraySmallDictT); 13102 tcase_add_test(tc_core, getSmallBoolSmallDictT); 13103 tcase_add_test(tc_core, getSmallBytesSmallDictT); 13104 tcase_add_test(tc_core, getSmallDoubleSmallDictT); 13105 tcase_add_test(tc_core, getSmallIntSmallDictT); 13106 tcase_add_test(tc_core, getSmallJsonSmallDictT); 13107 tcase_add_test(tc_core, getSmallStringSmallDictT); 13108 tcase_add_test(tc_core, getVoidSmallDictT); 13109 tcase_add_test(tc_core, getSmallContainerSmallDictT); 13110 tcase_add_test(tc_core, getKCharSmallDictT); 13111 tcase_add_test(tc_core, getUndefinedKCharSmallDictT); 13112 tcase_add_test(tc_core, getBoolKCharSmallDictT); 13113 tcase_add_test(tc_core, getBoolPKCharSmallDictT); 13114 tcase_add_test(tc_core, getDoubleKCharSmallDictT); 13115 tcase_add_test(tc_core, getDoublePKCharSmallDictT); 13116 tcase_add_test(tc_core, getIntKCharSmallDictT); 13117 tcase_add_test(tc_core, getIntPKCharSmallDictT); 13118 tcase_add_test(tc_core, getInt32KCharSmallDictT); 13119 tcase_add_test(tc_core, getInt32PKCharSmallDictT); 13120 tcase_add_test(tc_core, getUintKCharSmallDictT); 13121 tcase_add_test(tc_core, getUintPKCharSmallDictT); 13122 tcase_add_test(tc_core, getUint32KCharSmallDictT); 13123 tcase_add_test(tc_core, getUint32PKCharSmallDictT); 13124 tcase_add_test(tc_core, getSKCharSmallDictT); 13125 tcase_add_test(tc_core, getDictKCharSmallDictT); 13126 tcase_add_test(tc_core, getArrayKCharSmallDictT); 13127 tcase_add_test(tc_core, getSmallBoolKCharSmallDictT); 13128 tcase_add_test(tc_core, getSmallBytesKCharSmallDictT); 13129 tcase_add_test(tc_core, getSmallDoubleKCharSmallDictT); 13130 tcase_add_test(tc_core, getSmallIntKCharSmallDictT); 13131 tcase_add_test(tc_core, getSmallJsonKCharSmallDictT); 13132 tcase_add_test(tc_core, getSmallStringKCharSmallDictT); 13133 tcase_add_test(tc_core, getVoidKCharSmallDictT); 13134 tcase_add_test(tc_core, getSmallContainerKCharSmallDictT); 13135 tcase_add_test(tc_core, getNDupSmallDictT); 13136 tcase_add_test(tc_core, getNDupUndefinedSmallDictT); 13137 tcase_add_test(tc_core, getNDupBoolSmallDictT); 13138 tcase_add_test(tc_core, getNDupDoubleSmallDictT); 13139 tcase_add_test(tc_core, getNDupIntSmallDictT); 13140 tcase_add_test(tc_core, getNDupInt32SmallDictT); 13141 tcase_add_test(tc_core, getNDupUintSmallDictT); 13142 tcase_add_test(tc_core, getNDupUint32SmallDictT); 13143 tcase_add_test(tc_core, getNDupSSmallDictT); 13144 tcase_add_test(tc_core, getNDupDictSmallDictT); 13145 tcase_add_test(tc_core, getNDupArraySmallDictT); 13146 tcase_add_test(tc_core, getNDupSmallBoolSmallDictT); 13147 tcase_add_test(tc_core, getNDupSmallBytesSmallDictT); 13148 tcase_add_test(tc_core, getNDupSmallDoubleSmallDictT); 13149 tcase_add_test(tc_core, getNDupSmallIntSmallDictT); 13150 tcase_add_test(tc_core, getNDupSmallJsonSmallDictT); 13151 tcase_add_test(tc_core, getNDupSmallStringSmallDictT); 13152 tcase_add_test(tc_core, getNDupVoidSmallDictT); 13153 tcase_add_test(tc_core, getNDupSmallContainerSmallDictT); 13154 tcase_add_test(tc_core, getNDupKCharSmallDictT); 13155 tcase_add_test(tc_core, getNDupUndefinedKCharSmallDictT); 13156 tcase_add_test(tc_core, getNDupBoolKCharSmallDictT); 13157 tcase_add_test(tc_core, getNDupDoubleKCharSmallDictT); 13158 tcase_add_test(tc_core, getNDupIntKCharSmallDictT); 13159 tcase_add_test(tc_core, getNDupInt32KCharSmallDictT); 13160 tcase_add_test(tc_core, getNDupUintKCharSmallDictT); 13161 tcase_add_test(tc_core, getNDupUint32KCharSmallDictT); 13162 tcase_add_test(tc_core, getNDupSKCharSmallDictT); 13163 tcase_add_test(tc_core, getNDupDictKCharSmallDictT); 13164 tcase_add_test(tc_core, getNDupArrayKCharSmallDictT); 13165 tcase_add_test(tc_core, getNDupSmallBoolKCharSmallDictT); 13166 tcase_add_test(tc_core, getNDupSmallBytesKCharSmallDictT); 13167 tcase_add_test(tc_core, getNDupSmallDoubleKCharSmallDictT); 13168 tcase_add_test(tc_core, getNDupSmallIntKCharSmallDictT); 13169 tcase_add_test(tc_core, getNDupSmallJsonKCharSmallDictT); 13170 tcase_add_test(tc_core, getNDupSmallStringKCharSmallDictT); 13171 tcase_add_test(tc_core, getNDupVoidKCharSmallDictT); 13172 tcase_add_test(tc_core, getNDupSmallContainerKCharSmallDictT); 13173 tcase_add_test(tc_core, getNumSmallDictT); 13174 tcase_add_test(tc_core, cropElemSmallDictT); 13175 tcase_add_test(tc_core, cropElemUndefinedSmallDictT); 13176 tcase_add_test(tc_core, cropElemBoolSmallDictT); 13177 tcase_add_test(tc_core, cropElemDoubleSmallDictT); 13178 tcase_add_test(tc_core, cropElemIntSmallDictT); 13179 tcase_add_test(tc_core, cropElemInt32SmallDictT); 13180 tcase_add_test(tc_core, cropElemUintSmallDictT); 13181 tcase_add_test(tc_core, cropElemUint32SmallDictT); 13182 tcase_add_test(tc_core, cropElemSSmallDictT); 13183 tcase_add_test(tc_core, cropElemDictSmallDictT); 13184 tcase_add_test(tc_core, cropElemArraySmallDictT); 13185 tcase_add_test(tc_core, cropElemSmallBoolSmallDictT); 13186 tcase_add_test(tc_core, cropElemSmallBytesSmallDictT); 13187 tcase_add_test(tc_core, cropElemSmallDoubleSmallDictT); 13188 tcase_add_test(tc_core, cropElemSmallIntSmallDictT); 13189 tcase_add_test(tc_core, cropElemSmallJsonSmallDictT); 13190 tcase_add_test(tc_core, cropElemSmallStringSmallDictT); 13191 tcase_add_test(tc_core, cropElemVoidSmallDictT); 13192 tcase_add_test(tc_core, cropElemSmallContainerSmallDictT); 13193 tcase_add_test(tc_core, delKCharSmallDictT); 13194 tcase_add_test(tc_core, removeSmallDictT); 13195 tcase_add_test(tc_core, removeKCharSmallDictT); 13196 tcase_add_test(tc_core, hasKCharSmallDictT); 13197 tcase_add_test(tc_core, keyBySmallDictT); 13198 tcase_add_test(tc_core, keyByUndefinedSmallDictT); 13199 tcase_add_test(tc_core, keyByBoolSmallDictT); 13200 tcase_add_test(tc_core, keyByDoubleSmallDictT); 13201 tcase_add_test(tc_core, keyByIntSmallDictT); 13202 tcase_add_test(tc_core, keyBySSmallDictT); 13203 tcase_add_test(tc_core, keyByCharSmallDictT); 13204 tcase_add_test(tc_core, keyByDictSmallDictT); 13205 tcase_add_test(tc_core, keyByArraySmallDictT); 13206 tcase_add_test(tc_core, keyByArraycSmallDictT); 13207 tcase_add_test(tc_core, keyBySmallBoolSmallDictT); 13208 tcase_add_test(tc_core, keyBySmallBytesSmallDictT); 13209 tcase_add_test(tc_core, keyBySmallDoubleSmallDictT); 13210 tcase_add_test(tc_core, keyBySmallIntSmallDictT); 13211 tcase_add_test(tc_core, keyBySmallJsonSmallDictT); 13212 tcase_add_test(tc_core, keyBySmallStringSmallDictT); 13213 tcase_add_test(tc_core, keyBySmallContainerSmallDictT); 13214 tcase_add_test(tc_core, icKeyBySmallDictT); 13215 tcase_add_test(tc_core, icKeyBySSmallDictT); 13216 tcase_add_test(tc_core, icKeyByCharSmallDictT); 13217 tcase_add_test(tc_core, icKeyByDictSmallDictT); 13218 tcase_add_test(tc_core, icKeyByArraySmallDictT); 13219 tcase_add_test(tc_core, icKeyByArraycSmallDictT); 13220 tcase_add_test(tc_core, icKeyBySmallJsonSmallDictT); 13221 tcase_add_test(tc_core, icKeyBySmallStringSmallDictT); 13222 tcase_add_test(tc_core, trimSmallDictT); 13223 tcase_add_test(tc_core, keysSmallStringSmallDictT); 13224 tcase_add_test(tc_core, mergeSmallJsonSmallDictT); 13225 tcase_add_test(tc_core, mergeNSmashSmallDictT); 13226 tcase_add_test(tc_core, mergeNSmashSmallJsonSmallDictT); 13227 tcase_add_test(tc_core, appendNSmashSmallDictT); 13228 tcase_add_test(tc_core, equalSmallDictBaseT); 13229 tcase_add_test(tc_core, equalSmallDictSmallJsonT); 13230 tcase_add_test(tc_core, equalSmallDictT); 13231 tcase_add_test(tc_core, icEqualSmallDictBaseT); 13232 tcase_add_test(tc_core, icEqualSmallDictSmallJsonT); 13233 tcase_add_test(tc_core, icEqualSmallDictT); 13234 tcase_add_test(tc_core, isEmptySmallDictT); 13235 tcase_add_test(tc_core, enumerateSmallDictFT); 13236 tcase_add_test(tc_core, iterStartSmallDictT); 13237 tcase_add_test(tc_core, iterStartKeySmallDictT); 13238 tcase_add_test(tc_core, iterNextSmallDictT); 13239 tcase_add_test(tc_core, iterNextKeySmallDictT); 13240 tcase_add_test(tc_core, iterElementSmallDictT); 13241 tcase_add_test(tc_core, iterKeySmallDictT); 13242 tcase_add_test(tc_core, zipSmallDictT); 13243 tcase_add_test(tc_core, zipSmallJsonSmallDictT); 13244 tcase_add_test(tc_core, zipSmallJsonSmallArraySmallDictT); 13245 tcase_add_test(tc_core, zipSmallJsonSmallJsonSmallDictT); 13246 tcase_add_test(tc_core, zipSmallJsonVArraySmallDictT); 13247 tcase_add_test(tc_core, zipArraySmallDictT); 13248 tcase_add_test(tc_core, zipArraySmallJsonSmallDictT); 13249 tcase_add_test(tc_core, zipArrayArraySmallDictT); 13250 tcase_add_test(tc_core, zipVArraySmallDictT); 13251 tcase_add_test(tc_core, fromArraySmallDictT); 13252 tcase_add_test(tc_core, toArraySmallDictT); 13253 tcase_add_test(tc_core, writeFileSmallDictT); 13254 tcase_add_test(tc_core, writeFileSmallJsonSmallDictT); 13255 tcase_add_test(tc_core, writeFileSmallStringSmallDictT); 13256 tcase_add_test(tc_core, writeStreamSmallDictT); 13257 tcase_add_test(tc_core, appendFileSmallDictT); 13258 tcase_add_test(tc_core, appendFileSmallStringSmallDictT); 13259 tcase_add_test(tc_core, logSmallDictT); 13260 tcase_add_test(tc_core, typeSmallStringSmallDictT); 13261 tcase_add_test(tc_core, typeStringKCharSmallDictT); 13262 tcase_add_test(tc_core, typeSmallStringKCharSmallDictT); 13263 tcase_add_test(tc_core, typeKCharSmallDictT); 13264 tcase_add_test(tc_core, isETypeSmallDictT); 13265 tcase_add_test(tc_core, isEUndefinedSmallDictT); 13266 tcase_add_test(tc_core, isEBoolSmallDictT); 13267 tcase_add_test(tc_core, isEContainerSmallDictT); 13268 tcase_add_test(tc_core, isEDictSmallDictT); 13269 tcase_add_test(tc_core, isEDoubleSmallDictT); 13270 tcase_add_test(tc_core, isEIntSmallDictT); 13271 tcase_add_test(tc_core, isEStringSmallDictT); 13272 tcase_add_test(tc_core, isEFaststringSmallDictT); 13273 tcase_add_test(tc_core, isEArraySmallDictT); 13274 tcase_add_test(tc_core, isEBytesSmallDictT); 13275 tcase_add_test(tc_core, areAllETypeSmallDictT); 13276 tcase_add_test(tc_core, areAllEUndefinedSmallDictT); 13277 tcase_add_test(tc_core, areAllEBoolSmallDictT); 13278 tcase_add_test(tc_core, areAllEContainerSmallDictT); 13279 tcase_add_test(tc_core, areAllEDictSmallDictT); 13280 tcase_add_test(tc_core, areAllEDoubleSmallDictT); 13281 tcase_add_test(tc_core, areAllEIntSmallDictT); 13282 tcase_add_test(tc_core, areAllEStringSmallDictT); 13283 tcase_add_test(tc_core, areAllEFaststringSmallDictT); 13284 tcase_add_test(tc_core, areAllEArraySmallDictT); 13285 tcase_add_test(tc_core, areAllEBytesSmallDictT); 13286 tcase_add_test(tc_core, duplicateSmallDictGT); 13287 tcase_add_test(tc_core, freeSmallDictGT); 13288 tcase_add_test(tc_core, setSmallDictGT); 13289 tcase_add_test(tc_core, getSmallDictGT); 13290 tcase_add_test(tc_core, getUndefinedSmallDictGT); 13291 tcase_add_test(tc_core, getBoolSmallDictGT); 13292 tcase_add_test(tc_core, getBoolPSmallDictGT); 13293 tcase_add_test(tc_core, getDoubleSmallDictGT); 13294 tcase_add_test(tc_core, getDoublePSmallDictGT); 13295 tcase_add_test(tc_core, getIntSmallDictGT); 13296 tcase_add_test(tc_core, getIntPSmallDictGT); 13297 tcase_add_test(tc_core, getInt32SmallDictGT); 13298 tcase_add_test(tc_core, getInt32PSmallDictGT); 13299 tcase_add_test(tc_core, getUintSmallDictGT); 13300 tcase_add_test(tc_core, getUintPSmallDictGT); 13301 tcase_add_test(tc_core, getUint32SmallDictGT); 13302 tcase_add_test(tc_core, getUint32PSmallDictGT); 13303 tcase_add_test(tc_core, getSSmallDictGT); 13304 tcase_add_test(tc_core, getDictSmallDictGT); 13305 tcase_add_test(tc_core, getArraySmallDictGT); 13306 tcase_add_test(tc_core, getSmallBoolSmallDictGT); 13307 tcase_add_test(tc_core, getSmallBytesSmallDictGT); 13308 tcase_add_test(tc_core, getSmallDoubleSmallDictGT); 13309 tcase_add_test(tc_core, getSmallIntSmallDictGT); 13310 tcase_add_test(tc_core, getSmallJsonSmallDictGT); 13311 tcase_add_test(tc_core, getSmallStringSmallDictGT); 13312 tcase_add_test(tc_core, getVoidSmallDictGT); 13313 tcase_add_test(tc_core, getSmallContainerSmallDictGT); 13314 tcase_add_test(tc_core, getKCharSmallDictGT); 13315 tcase_add_test(tc_core, getUndefinedKCharSmallDictGT); 13316 tcase_add_test(tc_core, getBoolKCharSmallDictGT); 13317 tcase_add_test(tc_core, getBoolPKCharSmallDictGT); 13318 tcase_add_test(tc_core, getDoubleKCharSmallDictGT); 13319 tcase_add_test(tc_core, getDoublePKCharSmallDictGT); 13320 tcase_add_test(tc_core, getIntKCharSmallDictGT); 13321 tcase_add_test(tc_core, getIntPKCharSmallDictGT); 13322 tcase_add_test(tc_core, getInt32KCharSmallDictGT); 13323 tcase_add_test(tc_core, getInt32PKCharSmallDictGT); 13324 tcase_add_test(tc_core, getUintKCharSmallDictGT); 13325 tcase_add_test(tc_core, getUintPKCharSmallDictGT); 13326 tcase_add_test(tc_core, getUint32KCharSmallDictGT); 13327 tcase_add_test(tc_core, getUint32PKCharSmallDictGT); 13328 tcase_add_test(tc_core, getSKCharSmallDictGT); 13329 tcase_add_test(tc_core, getDictKCharSmallDictGT); 13330 tcase_add_test(tc_core, getArrayKCharSmallDictGT); 13331 tcase_add_test(tc_core, getSmallBoolKCharSmallDictGT); 13332 tcase_add_test(tc_core, getSmallBytesKCharSmallDictGT); 13333 tcase_add_test(tc_core, getSmallDoubleKCharSmallDictGT); 13334 tcase_add_test(tc_core, getSmallIntKCharSmallDictGT); 13335 tcase_add_test(tc_core, getSmallJsonKCharSmallDictGT); 13336 tcase_add_test(tc_core, getSmallStringKCharSmallDictGT); 13337 tcase_add_test(tc_core, getVoidKCharSmallDictGT); 13338 tcase_add_test(tc_core, getSmallContainerKCharSmallDictGT); 13339 tcase_add_test(tc_core, getNDupSmallDictGT); 13340 tcase_add_test(tc_core, getNDupUndefinedSmallDictGT); 13341 tcase_add_test(tc_core, getNDupBoolSmallDictGT); 13342 tcase_add_test(tc_core, getNDupDoubleSmallDictGT); 13343 tcase_add_test(tc_core, getNDupIntSmallDictGT); 13344 tcase_add_test(tc_core, getNDupInt32SmallDictGT); 13345 tcase_add_test(tc_core, getNDupUintSmallDictGT); 13346 tcase_add_test(tc_core, getNDupUint32SmallDictGT); 13347 tcase_add_test(tc_core, getNDupSSmallDictGT); 13348 tcase_add_test(tc_core, getNDupDictSmallDictGT); 13349 tcase_add_test(tc_core, getNDupArraySmallDictGT); 13350 tcase_add_test(tc_core, getNDupSmallBoolSmallDictGT); 13351 tcase_add_test(tc_core, getNDupSmallBytesSmallDictGT); 13352 tcase_add_test(tc_core, getNDupSmallDoubleSmallDictGT); 13353 tcase_add_test(tc_core, getNDupSmallIntSmallDictGT); 13354 tcase_add_test(tc_core, getNDupSmallJsonSmallDictGT); 13355 tcase_add_test(tc_core, getNDupSmallStringSmallDictGT); 13356 tcase_add_test(tc_core, getNDupVoidSmallDictGT); 13357 tcase_add_test(tc_core, getNDupSmallContainerSmallDictGT); 13358 tcase_add_test(tc_core, getNDupKCharSmallDictGT); 13359 tcase_add_test(tc_core, getNDupUndefinedKCharSmallDictGT); 13360 tcase_add_test(tc_core, getNDupBoolKCharSmallDictGT); 13361 tcase_add_test(tc_core, getNDupDoubleKCharSmallDictGT); 13362 tcase_add_test(tc_core, getNDupIntKCharSmallDictGT); 13363 tcase_add_test(tc_core, getNDupInt32KCharSmallDictGT); 13364 tcase_add_test(tc_core, getNDupUintKCharSmallDictGT); 13365 tcase_add_test(tc_core, getNDupUint32KCharSmallDictGT); 13366 tcase_add_test(tc_core, getNDupSKCharSmallDictGT); 13367 tcase_add_test(tc_core, getNDupDictKCharSmallDictGT); 13368 tcase_add_test(tc_core, getNDupArrayKCharSmallDictGT); 13369 tcase_add_test(tc_core, getNDupSmallBoolKCharSmallDictGT); 13370 tcase_add_test(tc_core, getNDupSmallBytesKCharSmallDictGT); 13371 tcase_add_test(tc_core, getNDupSmallDoubleKCharSmallDictGT); 13372 tcase_add_test(tc_core, getNDupSmallIntKCharSmallDictGT); 13373 tcase_add_test(tc_core, getNDupSmallJsonKCharSmallDictGT); 13374 tcase_add_test(tc_core, getNDupSmallStringKCharSmallDictGT); 13375 tcase_add_test(tc_core, getNDupVoidKCharSmallDictGT); 13376 tcase_add_test(tc_core, getNDupSmallContainerKCharSmallDictGT); 13377 tcase_add_test(tc_core, setUndefinedSmallDictGT); 13378 tcase_add_test(tc_core, setBoolSmallDictGT); 13379 tcase_add_test(tc_core, setDoubleSmallDictGT); 13380 tcase_add_test(tc_core, setIntSmallDictGT); 13381 tcase_add_test(tc_core, setSSmallDictGT); 13382 tcase_add_test(tc_core, setCharSmallDictGT); 13383 tcase_add_test(tc_core, setDictSmallDictGT); 13384 tcase_add_test(tc_core, setArraySmallDictGT); 13385 tcase_add_test(tc_core, setArraycSmallDictGT); 13386 tcase_add_test(tc_core, setCArraycSmallDictGT); 13387 tcase_add_test(tc_core, setVoidSmallDictGT); 13388 tcase_add_test(tc_core, setSmallBoolSmallDictGT); 13389 tcase_add_test(tc_core, setSmallBytesSmallDictGT); 13390 tcase_add_test(tc_core, setSmallDoubleSmallDictGT); 13391 tcase_add_test(tc_core, setSmallIntSmallDictGT); 13392 tcase_add_test(tc_core, setSmallJsonSmallDictGT); 13393 tcase_add_test(tc_core, setSmallStringSmallDictGT); 13394 tcase_add_test(tc_core, setSmallContainerSmallDictGT); 13395 tcase_add_test(tc_core, setKCharSmallDictGT); 13396 tcase_add_test(tc_core, setUndefinedKCharSmallDictGT); 13397 tcase_add_test(tc_core, setBoolKCharSmallDictGT); 13398 tcase_add_test(tc_core, setDoubleKCharSmallDictGT); 13399 tcase_add_test(tc_core, setIntKCharSmallDictGT); 13400 tcase_add_test(tc_core, setSKCharSmallDictGT); 13401 tcase_add_test(tc_core, setCharKCharSmallDictGT); 13402 tcase_add_test(tc_core, setDictKCharSmallDictGT); 13403 tcase_add_test(tc_core, setArrayKCharSmallDictGT); 13404 tcase_add_test(tc_core, setArraycKCharSmallDictGT); 13405 tcase_add_test(tc_core, setCArraycKCharSmallDictGT); 13406 tcase_add_test(tc_core, setVoidKCharSmallDictGT); 13407 tcase_add_test(tc_core, setSmallBoolKCharSmallDictGT); 13408 tcase_add_test(tc_core, setSmallBytesKCharSmallDictGT); 13409 tcase_add_test(tc_core, setSmallDoubleKCharSmallDictGT); 13410 tcase_add_test(tc_core, setSmallIntKCharSmallDictGT); 13411 tcase_add_test(tc_core, setSmallJsonKCharSmallDictGT); 13412 tcase_add_test(tc_core, setSmallStringKCharSmallDictGT); 13413 tcase_add_test(tc_core, setSmallContainerKCharSmallDictGT); 13414 tcase_add_test(tc_core, setNFreeSmallDictGT); 13415 tcase_add_test(tc_core, setNFreeUndefinedSmallDictGT); 13416 tcase_add_test(tc_core, setNFreeSSmallDictGT); 13417 tcase_add_test(tc_core, setNFreeDictSmallDictGT); 13418 tcase_add_test(tc_core, setNFreeArraySmallDictGT); 13419 tcase_add_test(tc_core, setNFreeArraycSmallDictGT); 13420 tcase_add_test(tc_core, setNFreeSmallBoolSmallDictGT); 13421 tcase_add_test(tc_core, setNFreeSmallBytesSmallDictGT); 13422 tcase_add_test(tc_core, setNFreeSmallDoubleSmallDictGT); 13423 tcase_add_test(tc_core, setNFreeSmallIntSmallDictGT); 13424 tcase_add_test(tc_core, setNFreeSmallJsonSmallDictGT); 13425 tcase_add_test(tc_core, setNFreeSmallStringSmallDictGT); 13426 tcase_add_test(tc_core, setNFreeSmallContainerSmallDictGT); 13427 tcase_add_test(tc_core, setNFreeKCharSmallDictGT); 13428 tcase_add_test(tc_core, setNFreeUndefinedKCharSmallDictGT); 13429 tcase_add_test(tc_core, setNFreeSKCharSmallDictGT); 13430 tcase_add_test(tc_core, setNFreeDictKCharSmallDictGT); 13431 tcase_add_test(tc_core, setNFreeArrayKCharSmallDictGT); 13432 tcase_add_test(tc_core, setNFreeArraycKCharSmallDictGT); 13433 tcase_add_test(tc_core, setNFreeSmallBoolKCharSmallDictGT); 13434 tcase_add_test(tc_core, setNFreeSmallBytesKCharSmallDictGT); 13435 tcase_add_test(tc_core, setNFreeSmallDoubleKCharSmallDictGT); 13436 tcase_add_test(tc_core, setNFreeSmallIntKCharSmallDictGT); 13437 tcase_add_test(tc_core, setNFreeSmallJsonKCharSmallDictGT); 13438 tcase_add_test(tc_core, setNFreeSmallStringKCharSmallDictGT); 13439 tcase_add_test(tc_core, setNFreeSmallContainerKCharSmallDictGT); 13440 tcase_add_test(tc_core, setPDictSmallDictGT); 13441 tcase_add_test(tc_core, setPArraySmallDictGT); 13442 tcase_add_test(tc_core, setPSmallJsonSmallDictGT); 13443 tcase_add_test(tc_core, setPSmallStringSmallDictGT); 13444 tcase_add_test(tc_core, setNFreePDictSmallDictGT); 13445 tcase_add_test(tc_core, setNFreePArraySmallDictGT); 13446 tcase_add_test(tc_core, setNFreePSmallJsonSmallDictGT); 13447 tcase_add_test(tc_core, setNFreePSmallStringSmallDictGT); 13448 tcase_add_test(tc_core, setPArrayKCharSmallDictGT); 13449 tcase_add_test(tc_core, setPDictKCharSmallDictGT); 13450 tcase_add_test(tc_core, setPSmallJsonKCharSmallDictGT); 13451 tcase_add_test(tc_core, setPSmallStringKCharSmallDictGT); 13452 tcase_add_test(tc_core, setNFreePArrayKCharSmallDictGT); 13453 tcase_add_test(tc_core, setNFreePDictKCharSmallDictGT); 13454 tcase_add_test(tc_core, setNFreePSmallJsonKCharSmallDictGT); 13455 tcase_add_test(tc_core, setNFreePSmallStringKCharSmallDictGT); 13456 tcase_add_test(tc_core, mergeSmallDictGT); 13457 tcase_add_test(tc_core, mergeSmallJsonSmallDictGT); 13458 tcase_add_test(tc_core, mergeNSmashSmallDictGT); 13459 tcase_add_test(tc_core, mergeNSmashSmallJsonSmallDictGT); 13460 tcase_add_test(tc_core, equalSmallDictBaseGT); 13461 tcase_add_test(tc_core, equalSmallDictSmallJsonGT); 13462 tcase_add_test(tc_core, equalSmallDictGT); 13463 tcase_add_test(tc_core, icEqualSmallDictBaseGT); 13464 tcase_add_test(tc_core, icEqualSmallDictSmallJsonGT); 13465 tcase_add_test(tc_core, icEqualSmallDictGT); 13466 tcase_add_test(tc_core, getNumSmallDictGT); 13467 tcase_add_test(tc_core, cropElemSmallDictGT); 13468 tcase_add_test(tc_core, cropElemUndefinedSmallDictGT); 13469 tcase_add_test(tc_core, cropElemBoolSmallDictGT); 13470 tcase_add_test(tc_core, cropElemDoubleSmallDictGT); 13471 tcase_add_test(tc_core, cropElemIntSmallDictGT); 13472 tcase_add_test(tc_core, cropElemInt32SmallDictGT); 13473 tcase_add_test(tc_core, cropElemUintSmallDictGT); 13474 tcase_add_test(tc_core, cropElemUint32SmallDictGT); 13475 tcase_add_test(tc_core, cropElemSSmallDictGT); 13476 tcase_add_test(tc_core, cropElemDictSmallDictGT); 13477 tcase_add_test(tc_core, cropElemArraySmallDictGT); 13478 tcase_add_test(tc_core, cropElemSmallBoolSmallDictGT); 13479 tcase_add_test(tc_core, cropElemSmallBytesSmallDictGT); 13480 tcase_add_test(tc_core, cropElemSmallDoubleSmallDictGT); 13481 tcase_add_test(tc_core, cropElemSmallIntSmallDictGT); 13482 tcase_add_test(tc_core, cropElemSmallJsonSmallDictGT); 13483 tcase_add_test(tc_core, cropElemSmallStringSmallDictGT); 13484 tcase_add_test(tc_core, cropElemVoidSmallDictGT); 13485 tcase_add_test(tc_core, cropElemSmallContainerSmallDictGT); 13486 tcase_add_test(tc_core, delSmallDictGT); 13487 tcase_add_test(tc_core, delKCharSmallDictGT); 13488 tcase_add_test(tc_core, delElemSmallDictGT); 13489 tcase_add_test(tc_core, delElemKCharSmallDictGT); 13490 tcase_add_test(tc_core, removeSmallDictGT); 13491 tcase_add_test(tc_core, removeKCharSmallDictGT); 13492 tcase_add_test(tc_core, removeElemSmallDictGT); 13493 tcase_add_test(tc_core, removeElemKCharSmallDictGT); 13494 tcase_add_test(tc_core, hasSmallDictGT); 13495 tcase_add_test(tc_core, hasKCharSmallDictGT); 13496 tcase_add_test(tc_core, keyBySmallDictGT); 13497 tcase_add_test(tc_core, keyByUndefinedSmallDictGT); 13498 tcase_add_test(tc_core, keyByBoolSmallDictGT); 13499 tcase_add_test(tc_core, keyByDoubleSmallDictGT); 13500 tcase_add_test(tc_core, keyByIntSmallDictGT); 13501 tcase_add_test(tc_core, keyBySSmallDictGT); 13502 tcase_add_test(tc_core, keyByCharSmallDictGT); 13503 tcase_add_test(tc_core, keyByDictSmallDictGT); 13504 tcase_add_test(tc_core, keyByArraySmallDictGT); 13505 tcase_add_test(tc_core, keyByArraycSmallDictGT); 13506 tcase_add_test(tc_core, keyByCArraycSmallDictGT); 13507 tcase_add_test(tc_core, keyBySmallBoolSmallDictGT); 13508 tcase_add_test(tc_core, keyBySmallBytesSmallDictGT); 13509 tcase_add_test(tc_core, keyBySmallDoubleSmallDictGT); 13510 tcase_add_test(tc_core, keyBySmallIntSmallDictGT); 13511 tcase_add_test(tc_core, keyBySmallJsonSmallDictGT); 13512 tcase_add_test(tc_core, keyBySmallStringSmallDictGT); 13513 tcase_add_test(tc_core, keyBySmallContainerSmallDictGT); 13514 tcase_add_test(tc_core, icKeyBySmallDictGT); 13515 tcase_add_test(tc_core, icKeyBySSmallDictGT); 13516 tcase_add_test(tc_core, icKeyByCharSmallDictGT); 13517 tcase_add_test(tc_core, icKeyByDictSmallDictGT); 13518 tcase_add_test(tc_core, icKeyByArraySmallDictGT); 13519 tcase_add_test(tc_core, icKeyByArraycSmallDictGT); 13520 tcase_add_test(tc_core, icKeyByCArraycSmallDictGT); 13521 tcase_add_test(tc_core, icKeyBySmallJsonSmallDictGT); 13522 tcase_add_test(tc_core, icKeyBySmallStringSmallDictGT); 13523 tcase_add_test(tc_core, trimSmallDictGT); 13524 tcase_add_test(tc_core, keysSmallStringSmallDictGT); 13525 tcase_add_test(tc_core, lenSmallDictGT); 13526 tcase_add_test(tc_core, emptySmallDictGT); 13527 tcase_add_test(tc_core, isEmptySmallDictGT); 13528 tcase_add_test(tc_core, zipSmallDictGT); 13529 tcase_add_test(tc_core, zipSmallJsonSmallDictGT); 13530 tcase_add_test(tc_core, zipSmallJsonSmallArraySmallDictGT); 13531 tcase_add_test(tc_core, zipSmallJsonSmallJsonSmallDictGT); 13532 tcase_add_test(tc_core, zipSmallJsonVArraySmallDictGT); 13533 tcase_add_test(tc_core, zipSmallJsonVCArraySmallDictGT); 13534 tcase_add_test(tc_core, zipArraySmallDictGT); 13535 tcase_add_test(tc_core, zipArraySmallJsonSmallDictGT); 13536 tcase_add_test(tc_core, zipCArraySmallDictGT); 13537 tcase_add_test(tc_core, zipCArraySmallJsonSmallDictGT); 13538 tcase_add_test(tc_core, zipArrayArraySmallDictGT); 13539 tcase_add_test(tc_core, zipCArrayArraySmallDictGT); 13540 tcase_add_test(tc_core, zipArrayCArraySmallDictGT); 13541 tcase_add_test(tc_core, zipCArrayCArraySmallDictGT); 13542 tcase_add_test(tc_core, zipVArraySmallDictGT); 13543 tcase_add_test(tc_core, zipVCArraySmallDictGT); 13544 tcase_add_test(tc_core, fromArraySmallDictGT); 13545 tcase_add_test(tc_core, toArraySmallDictGT); 13546 tcase_add_test(tc_core, writeFileSmallDictGT); 13547 tcase_add_test(tc_core, writeFileSmallJsonSmallDictGT); 13548 tcase_add_test(tc_core, writeFileSmallStringSmallDictGT); 13549 tcase_add_test(tc_core, writeStreamSmallDictGT); 13550 tcase_add_test(tc_core, appendFileSmallDictGT); 13551 tcase_add_test(tc_core, appendFileSmallStringSmallDictGT); 13552 tcase_add_test(tc_core, logSmallDictGT); 13553 tcase_add_test(tc_core, typeSmallStringSmallDictGT); 13554 tcase_add_test(tc_core, typeStringKCharSmallDictGT); 13555 tcase_add_test(tc_core, typeSmallStringKCharSmallDictGT); 13556 tcase_add_test(tc_core, cSmallDictT); 13557 13558 suite_add_tcase(s, tc_core); 13559 13560 return s; 13561 } 13562 13563 int main(int ARGC UNUSED, char** ARGV UNUSED) { 13564 int number_failed; 13565 Suite *s; 13566 SRunner *sr; 13567 13568 s = libsheepySuite(); 13569 sr = srunner_create(s); 13570 13571 srunner_run_all(sr, CK_NORMAL); 13572 number_failed = srunner_ntests_failed(sr); 13573 srunner_free(sr); 13574 13575 exit((number_failed == 0) ? EXIT_SUCCESS : EXIT_FAILURE); 13576 } 13577 // vim: set expandtab ts=2 sw=2: