libsheepyCSmallDictTestMem.c (315256B)
1 #include <stdlib.h> 2 #include <stdio.h> 3 #include <string.h> 4 5 #define ck_assert_str_eq(a,b) a;b; 6 #define ck_assert_str_ne(a,b) a;b; 7 #define ck_assert_ptr_eq(a,b) a;b; 8 #define ck_assert_ptr_ne(a,b) a;b; 9 #define ck_assert_uint_eq(a,b) a;b; 10 #define ck_assert_uint_ne(a,b) a;b; 11 #define ck_assert_int_eq(a,b) a;b; 12 #define ck_assert_int_ne(a,b) a;b; 13 #define ck_assert(a) a; 14 15 16 #include "../libsheepy.h" 17 #include "../libsheepyObject.h" 18 19 #ifdef __GNUC__ 20 #define UNUSED __attribute__ ((unused)) 21 #else 22 #define UNUSED 23 #endif 24 25 // TODO redirect stderr 26 27 28 void getsoSmallDictT(void) { 29 30 sDictt* r; 31 smallDictt *self = allocG(rtSmallDictt); 32 33 self->f->setS(self, "qwe", "asd"); 34 r = getsoO(self); 35 ck_assert_ptr_eq(r, self->d); 36 terminateO(self); 37 38 } 39 40 41 void setsoSmallDictT(void) { 42 43 smallDictt *self = allocG(rtSmallDictt); 44 sDictt *so; 45 46 createSmallDict(d); 47 (&d)->f->setS(&d, "1", "1"); 48 (&d)->f->setS(&d, "2", "2"); 49 char *as = null; 50 // reset test: free iterElement in d 51 iter(&d, E) { 52 as = toStringO(E); 53 break; 54 } 55 ck_assert_ptr_ne(as, null); 56 ck_assert_str_eq(as, "1"); 57 free(as); 58 so = getsoO(&d); 59 resetO(&d); 60 setsoO(self, so); 61 ck_assert_ptr_eq(so, self->d); 62 terminateO(self); 63 64 } 65 66 67 void mirrorSmallDictT(void) { 68 69 smallDictt* r; 70 smallDictt *self = allocG(rtSmallDictt); 71 72 // empty self 73 r = mirrorO(self); 74 ck_assert_ptr_eq(r->d, null); 75 finishO(r); 76 // non empty with iterator 77 self->f->setS(self, "1", "1"); 78 self->f->setS(self, "2", "2"); 79 char *as = null; 80 iter(self, E) { 81 as = toStringO(E); 82 break; 83 } 84 ck_assert_str_eq(as, "1"); 85 free(as); 86 r = mirrorO(self); 87 ck_assert_ptr_eq(r->d, self->d); 88 finishO(r); 89 terminateO(self); 90 91 } 92 93 94 void setUndefinedSmallDictT(void) { 95 96 smallDictt* r; 97 smallDictt *self = allocG(rtSmallDictt); 98 99 r = self->f->setUndefined(self, "1"); 100 ck_assert_ptr_ne(r, null); 101 char *s = toStringO(r); 102 ck_assert_str_eq(s, "{\"1\":null}"); 103 free(s); 104 // null key 105 r = self->f->setUndefined(self, null); 106 ck_assert_ptr_eq(r, null); 107 terminateO(self); 108 109 } 110 111 112 void setBoolSmallDictT(void) { 113 114 smallDictt* r; 115 smallDictt *self = allocG(rtSmallDictt); 116 117 r = self->f->setBool(self, "1", true); 118 ck_assert_ptr_ne(r, null); 119 char *s = toStringO(r); 120 ck_assert_str_eq(s, "{\"1\":true}"); 121 free(s); 122 // null key 123 r = self->f->setBool(self, null, false); 124 ck_assert_ptr_eq(r, null); 125 terminateO(self); 126 127 } 128 129 130 void setDoubleSmallDictT(void) { 131 132 smallDictt* r; 133 smallDictt *self = allocG(rtSmallDictt); 134 135 r = self->f->setDouble(self, "1", 2.2); 136 ck_assert_ptr_ne(r, null); 137 char *s = toStringO(r); 138 ck_assert_str_eq(s, "{\"1\":2.200000e+00}"); 139 free(s); 140 // null key 141 r = self->f->setDouble(self, null, 1); 142 ck_assert_ptr_eq(r, null); 143 terminateO(self); 144 145 } 146 147 148 void setIntSmallDictT(void) { 149 150 smallDictt* r; 151 smallDictt *self = allocG(rtSmallDictt); 152 153 r = self->f->setInt(self, "1", 2); 154 ck_assert_ptr_ne(r, null); 155 char *s = toStringO(r); 156 ck_assert_str_eq(s, "{\"1\":2}"); 157 free(s); 158 // null key 159 r = self->f->setInt(self, null, 1); 160 ck_assert_ptr_eq(r, null); 161 terminateO(self); 162 163 } 164 165 166 void setSSmallDictT(void) { 167 168 smallDictt* r; 169 smallDictt *self = allocG(rtSmallDictt); 170 171 r = self->f->setS(self, "1", "qwe"); 172 ck_assert_ptr_ne(r, null); 173 char *s = toStringO(r); 174 ck_assert_str_eq(s, "{\"1\":\"qwe\"}"); 175 free(s); 176 // null value 177 r = self->f->setS(self, "1", null); 178 ck_assert_ptr_eq(r, null); 179 // null key 180 r = self->f->setS(self, null, ""); 181 ck_assert_ptr_eq(r, null); 182 terminateO(self); 183 184 } 185 186 187 void setCharSmallDictT(void) { 188 189 smallDictt* r; 190 smallDictt *self = allocG(rtSmallDictt); 191 192 r = self->f->setChar(self, "1", 'x'); 193 ck_assert_ptr_ne(r, null); 194 char *s = toStringO(r); 195 ck_assert_str_eq(s, "{\"1\":\"x\"}"); 196 free(s); 197 // null key 198 r = self->f->setChar(self, null, '1'); 199 ck_assert_ptr_eq(r, null); 200 terminateO(self); 201 202 } 203 204 205 void setDictSmallDictT(void) { 206 207 smallDictt* r; 208 smallDictt *self = allocG(rtSmallDictt); 209 smallDictt *dict = allocSmallDict(); 210 211 // empty dict 212 r = self->f->setDict(self, "1", dict); 213 ck_assert_ptr_ne(r, null); 214 finishO(dict); 215 char *s = toStringO(r); 216 ck_assert_str_eq(s, "{\"1\":{}}"); 217 free(s); 218 // set dict 219 dict = allocSmallDict(); 220 dict->f->setS(dict, "a", "zxc"); 221 r = self->f->setDict(self, "1", dict); 222 ck_assert_ptr_ne(r, null); 223 finishO(dict); 224 s = toStringO(r); 225 ck_assert_str_eq(s, "{\"1\":{\"a\":\"zxc\"}}"); 226 free(s); 227 // non smallDict object 228 dict = (smallDictt*) allocSmallInt(2); 229 r = self->f->setDict(self, "1", dict); 230 ck_assert_ptr_eq(r, null); 231 terminateO(dict); 232 // null value 233 r = self->f->setDict(self, "1", null); 234 ck_assert_ptr_eq(r, null); 235 // null key 236 r = self->f->setDict(self, null, dict); 237 ck_assert_ptr_eq(r, null); 238 terminateO(self); 239 240 } 241 242 243 void setArraySmallDictT(void) { 244 245 smallDictt* r; 246 smallDictt *self = allocG(rtSmallDictt); 247 smallArrayt *array = allocSmallArray(); 248 249 // empty array 250 r = self->f->setArray(self, "1", array); 251 ck_assert_ptr_ne(r, null); 252 finishO(array); 253 char *s = toStringO(r); 254 ck_assert_str_eq(s, "{\"1\":[]}"); 255 free(s); 256 // set array 257 array = allocSmallArray(); 258 array->f->pushS(array, "zxc"); 259 r = self->f->setArray(self, "1", array); 260 ck_assert_ptr_ne(r, null); 261 finishO(array); 262 s = toStringO(r); 263 ck_assert_str_eq(s, "{\"1\":[\"zxc\"]}"); 264 free(s); 265 // non smallArray object 266 array = (smallArrayt*) allocSmallInt(2); 267 r = self->f->setArray(self, "1", array); 268 ck_assert_ptr_eq(r, null); 269 terminateO(array); 270 // null value 271 r = self->f->setArray(self, "1", null); 272 ck_assert_ptr_eq(r, null); 273 // null key 274 r = self->f->setArray(self, null, array); 275 ck_assert_ptr_eq(r, null); 276 terminateO(self); 277 278 } 279 280 281 void setArraycSmallDictT(void) { 282 283 smallDictt* r; 284 smallDictt *self = allocG(rtSmallDictt); 285 char **array = listCreateS("a", "b"); 286 287 r = self->f->setArrayc(self, "1", array); 288 ck_assert_ptr_ne(r, null); 289 char *s = toStringO(r); 290 ck_assert_str_eq(s, "{\"1\":[\"a\",\"b\"]}"); 291 free(s); 292 // zero element list 293 char *e0 = array[0]; 294 array[0] = null; 295 r = self->f->setArrayc(self, "1", array); 296 ck_assert_ptr_ne(r, null); 297 array[0] = e0; 298 listFreeS(array); 299 s = toStringO(r); 300 ck_assert_str_eq(s, "{\"1\":[]}"); 301 free(s); 302 // null value 303 r = self->f->setArrayc(self, "1", null); 304 ck_assert_ptr_eq(r, null); 305 // null key 306 r = self->f->setArrayc(self, null, array); 307 ck_assert_ptr_eq(r, null); 308 terminateO(self); 309 310 } 311 312 313 void setSmallBoolSmallDictT(void) { 314 315 smallDictt* r; 316 smallDictt *self = allocG(rtSmallDictt); 317 smallBoolt *value = allocSmallBool(true); 318 319 r = self->f->setSmallBool(self, "1", value); 320 ck_assert_ptr_ne(r, null); 321 char *s = toStringO(r); 322 ck_assert_str_eq(s, "{\"1\":true}"); 323 free(s); 324 // empty smallBool 325 value->value = null; 326 r = self->f->setSmallBool(self, "1", value); 327 ck_assert_ptr_ne(r, null); 328 finishO(value); 329 s = toStringO(r); 330 ck_assert_str_eq(s, "{\"1\":false}"); 331 free(s); 332 // non smallBool object 333 value = (smallBoolt*) allocSmallInt(2); 334 r = self->f->setSmallBool(self, "1", value); 335 ck_assert_ptr_eq(r, null); 336 terminateO(value); 337 // null value 338 r = self->f->setSmallBool(self, "1", null); 339 ck_assert_ptr_eq(r, null); 340 // null key 341 r = self->f->setSmallBool(self, null, value); 342 ck_assert_ptr_eq(r, null); 343 terminateO(self); 344 345 } 346 347 348 void setSmallBytesSmallDictT(void) { 349 350 smallDictt* r; 351 smallDictt *self = allocG(rtSmallDictt); 352 smallBytest *value = allocSmallBytes("qwe", sizeof("qwe")); 353 354 r = self->f->setSmallBytes(self, "1", value); 355 ck_assert_ptr_ne(r, null); 356 char *s = toStringO(r); 357 ck_assert_str_eq(s, "{\"1\":[0x71,0x77,0x65,0x00]}"); 358 free(s); 359 // empty smallBytes 360 value->B = null; 361 r = self->f->setSmallBytes(self, "1", value); 362 ck_assert_ptr_ne(r, null); 363 finishO(value); 364 s = toStringO(r); 365 ck_assert_str_eq(s, "{\"1\":[]}"); 366 free(s); 367 // non smallByes object 368 value = (smallBytest*) allocSmallInt(2); 369 r = self->f->setSmallBytes(self, "1", value); 370 ck_assert_ptr_eq(r, null); 371 terminateO(value); 372 // null value 373 r = self->f->setSmallBytes(self, "1", null); 374 ck_assert_ptr_eq(r, null); 375 // null key 376 r = self->f->setSmallBytes(self, null, value); 377 ck_assert_ptr_eq(r, null); 378 terminateO(self); 379 380 } 381 382 383 void setSmallDoubleSmallDictT(void) { 384 385 smallDictt* r; 386 smallDictt *self = allocG(rtSmallDictt); 387 smallDoublet *value = allocSmallDouble(2.2); 388 389 r = self->f->setSmallDouble(self, "1", value); 390 ck_assert_ptr_ne(r, null); 391 char *s = toStringO(r); 392 ck_assert_str_eq(s, "{\"1\":2.200000e+00}"); 393 free(s); 394 // empty smallDouble 395 value->value = null; 396 r = self->f->setSmallDouble(self, "1", value); 397 ck_assert_ptr_ne(r, null); 398 finishO(value); 399 s = toStringO(r); 400 ck_assert_str_eq(s, "{\"1\":0.000000e+00}"); 401 free(s); 402 // non smallDouble object 403 value = (smallDoublet*) allocSmallInt(2); 404 r = self->f->setSmallDouble(self, "1", value); 405 ck_assert_ptr_eq(r, null); 406 terminateO(value); 407 // null value 408 r = self->f->setSmallDouble(self, "1", null); 409 ck_assert_ptr_eq(r, null); 410 // null key 411 r = self->f->setSmallDouble(self, null, value); 412 ck_assert_ptr_eq(r, null); 413 terminateO(self); 414 415 } 416 417 418 void setSmallIntSmallDictT(void) { 419 420 smallDictt* r; 421 smallDictt *self = allocG(rtSmallDictt); 422 smallIntt *value = allocSmallInt(2); 423 424 r = self->f->setSmallInt(self, "1", value); 425 ck_assert_ptr_ne(r, null); 426 char *s = toStringO(r); 427 ck_assert_str_eq(s, "{\"1\":2}"); 428 free(s); 429 // empty smallInt 430 value->value = null; 431 r = self->f->setSmallInt(self, "1", value); 432 ck_assert_ptr_ne(r, null); 433 finishO(value); 434 s = toStringO(r); 435 ck_assert_str_eq(s, "{\"1\":0}"); 436 free(s); 437 // non smallInt object 438 value = (smallIntt*) allocSmallBool(true); 439 r = self->f->setSmallInt(self, "1", value); 440 ck_assert_ptr_eq(r, null); 441 terminateO(value); 442 // null value 443 r = self->f->setSmallInt(self, "1", null); 444 ck_assert_ptr_eq(r, null); 445 // null key 446 r = self->f->setSmallInt(self, null, value); 447 ck_assert_ptr_eq(r, null); 448 terminateO(self); 449 450 } 451 452 453 void setSmallJsonSmallDictT(void) { 454 455 smallDictt* r; 456 smallDictt *self = allocG(rtSmallDictt); 457 smallJsont *value = allocSmallJson(); 458 459 setTopIntO(value, 2); 460 r = self->f->setSmallJson(self, "1", value); 461 ck_assert_ptr_ne(r, null); 462 char *s = toStringO(r); 463 ck_assert_str_eq(s, "{\"1\":2}"); 464 free(s); 465 // empty smallJson 466 resetO(value); 467 r = self->f->setSmallJson(self, "1", value); 468 ck_assert_ptr_ne(r, null); 469 finishO(value); 470 s = toStringO(r); 471 ck_assert_str_eq(s, "{\"1\":{}}"); 472 free(s); 473 // non smallJson object 474 value = (smallJsont*) allocSmallInt(2); 475 r = self->f->setSmallJson(self, "1", value); 476 ck_assert_ptr_eq(r, null); 477 terminateO(value); 478 // null value 479 r = self->f->setSmallJson(self, "1", null); 480 ck_assert_ptr_eq(r, null); 481 // null key 482 r = self->f->setSmallJson(self, null, value); 483 ck_assert_ptr_eq(r, null); 484 terminateO(self); 485 486 } 487 488 489 void setSmallStringSmallDictT(void) { 490 491 smallDictt* r; 492 smallDictt *self = allocG(rtSmallDictt); 493 smallStringt *string = allocSmallString("qwe"); 494 495 r = self->f->setSmallString(self, "1", string); 496 ck_assert_ptr_ne(r, null); 497 char *s = toStringO(r); 498 ck_assert_str_eq(s, "{\"1\":\"qwe\"}"); 499 free(s); 500 // empty smallString 501 string->data = null; 502 r = self->f->setSmallString(self, "1", string); 503 ck_assert_ptr_ne(r, null); 504 finishO(string); 505 s = toStringO(r); 506 ck_assert_str_eq(s, "{\"1\":\"\"}"); 507 free(s); 508 // non smallString object 509 string = (smallStringt*) allocSmallInt(2); 510 r = self->f->setSmallString(self, "1", string); 511 ck_assert_ptr_eq(r, null); 512 terminateO(string); 513 // null value 514 r = self->f->setSmallString(self, "1", null); 515 ck_assert_ptr_eq(r, null); 516 // null key 517 r = self->f->setSmallString(self, null, string); 518 ck_assert_ptr_eq(r, null); 519 terminateO(self); 520 521 } 522 523 524 void setSmallContainerSmallDictT(void) { 525 526 smallDictt* r; 527 smallDictt *self = allocG(rtSmallDictt); 528 smallContainert *container = allocSmallContainer(null); 529 530 r = self->f->setSmallContainer(self, "1", container); 531 ck_assert_ptr_ne(r, null); 532 char *s = toStringO(r); 533 ck_assert_str_eq(s, "{\"1\":\"<data container>\"}"); 534 free(s); 535 // empty smallContainer 536 container->data = null; 537 r = self->f->setSmallContainer(self, "1", container); 538 ck_assert_ptr_ne(r, null); 539 finishO(container); 540 s = toStringO(r); 541 ck_assert_str_eq(s, "{\"1\":\"<data container>\"}"); 542 free(s); 543 // non smallContainer object 544 container = (smallContainert*) allocSmallInt(2); 545 r = self->f->setSmallContainer(self, "1", container); 546 ck_assert_ptr_eq(r, null); 547 terminateO(container); 548 // null value 549 r = self->f->setSmallContainer(self, "1", null); 550 ck_assert_ptr_eq(r, null); 551 // null key 552 r = self->f->setSmallContainer(self, null, container); 553 ck_assert_ptr_eq(r, null); 554 terminateO(self); 555 556 } 557 558 559 void setKCharSmallDictT(void) { 560 561 smallDictt* r; 562 smallDictt *self = allocG(rtSmallDictt); 563 baset *value = (baset*) allocSmallInt(2); 564 565 r = setKCharO(self, '1', value); 566 char *s = toStringO(r); 567 ck_assert_str_eq(s, "{\"1\":2}"); 568 free(s); 569 finishO(value); 570 terminateO(self); 571 572 } 573 574 575 void setUndefinedKCharSmallDictT(void) { 576 577 smallDictt* r; 578 smallDictt *self = allocG(rtSmallDictt); 579 580 r = setUndefinedKCharO(self, '1'); 581 char *s = toStringO(r); 582 ck_assert_str_eq(s, "{\"1\":null}"); 583 free(s); 584 terminateO(self); 585 586 } 587 588 589 void setBoolKCharSmallDictT(void) { 590 591 smallDictt* r; 592 smallDictt *self = allocG(rtSmallDictt); 593 594 r = setBoolKCharO(self, '1', true); 595 char *s = toStringO(r); 596 ck_assert_str_eq(s, "{\"1\":true}"); 597 free(s); 598 terminateO(self); 599 600 } 601 602 603 void setDoubleKCharSmallDictT(void) { 604 605 smallDictt* r; 606 smallDictt *self = allocG(rtSmallDictt); 607 608 r = setDoubleKCharO(self, '1', 2.2); 609 char *s = toStringO(r); 610 ck_assert_str_eq(s, "{\"1\":2.200000e+00}"); 611 free(s); 612 terminateO(self); 613 614 } 615 616 617 void setIntKCharSmallDictT(void) { 618 619 smallDictt* r; 620 smallDictt *self = allocG(rtSmallDictt); 621 622 r = setIntKCharO(self, '1', 2); 623 char *s = toStringO(r); 624 ck_assert_str_eq(s, "{\"1\":2}"); 625 free(s); 626 terminateO(self); 627 628 } 629 630 631 void setSKCharSmallDictT(void) { 632 633 smallDictt* r; 634 smallDictt *self = allocG(rtSmallDictt); 635 636 r = setSKCharO(self, '1', "qwe"); 637 char *s = toStringO(r); 638 ck_assert_str_eq(s, "{\"1\":\"qwe\"}"); 639 free(s); 640 terminateO(self); 641 642 } 643 644 645 void setCharKCharSmallDictT(void) { 646 647 smallDictt* r; 648 smallDictt *self = allocG(rtSmallDictt); 649 650 r = setCharKCharO(self, '1', 'c'); 651 char *s = toStringO(r); 652 ck_assert_str_eq(s, "{\"1\":\"c\"}"); 653 free(s); 654 terminateO(self); 655 656 } 657 658 659 void setDictKCharSmallDictT(void) { 660 661 smallDictt* r; 662 smallDictt *self = allocG(rtSmallDictt); 663 smallDictt *dict = allocSmallDict(); 664 665 r = setDictKCharO(self, '1', dict); 666 char *s = toStringO(r); 667 ck_assert_str_eq(s, "{\"1\":{}}"); 668 free(s); 669 finishO(dict); 670 terminateO(self); 671 672 } 673 674 675 void setArrayKCharSmallDictT(void) { 676 677 smallDictt* r; 678 smallDictt *self = allocG(rtSmallDictt); 679 smallArrayt *array = allocSmallArray(); 680 681 r = setArrayKCharO(self, '1', array); 682 char *s = toStringO(r); 683 ck_assert_str_eq(s, "{\"1\":[]}"); 684 free(s); 685 finishO(array); 686 terminateO(self); 687 688 } 689 690 691 void setArraycKCharSmallDictT(void) { 692 693 smallDictt* r; 694 smallDictt *self = allocG(rtSmallDictt); 695 char **array = listCreateS("a", "bb"); 696 697 r = setArraycKCharO(self, '1', array); 698 char *s = toStringO(r); 699 ck_assert_str_eq(s, "{\"1\":[\"a\",\"bb\"]}"); 700 free(s); 701 listFreeS(array); 702 terminateO(self); 703 704 } 705 706 707 void setSmallBoolKCharSmallDictT(void) { 708 709 smallDictt* r; 710 smallDictt *self = allocG(rtSmallDictt); 711 smallBoolt *value = allocSmallBool(true); 712 713 r = setSmallBoolKCharO(self, '1', value); 714 char *s = toStringO(r); 715 ck_assert_str_eq(s, "{\"1\":true}"); 716 free(s); 717 finishO(value); 718 terminateO(self); 719 720 } 721 722 723 void setSmallBytesKCharSmallDictT(void) { 724 725 smallDictt* r; 726 smallDictt *self = allocG(rtSmallDictt); 727 smallBytest *value = allocSmallBytes("qwe", sizeof("qwe")); 728 729 r = setSmallBytesKCharO(self, '1', value); 730 char *s = toStringO(r); 731 ck_assert_str_eq(s, "{\"1\":[0x71,0x77,0x65,0x00]}"); 732 free(s); 733 finishO(value); 734 terminateO(self); 735 736 } 737 738 739 void setSmallDoubleKCharSmallDictT(void) { 740 741 smallDictt* r; 742 smallDictt *self = allocG(rtSmallDictt); 743 smallDoublet *value = allocSmallDouble(2.2); 744 745 r = setSmallDoubleKCharO(self, '1', value); 746 char *s = toStringO(r); 747 ck_assert_str_eq(s, "{\"1\":2.200000e+00}"); 748 free(s); 749 finishO(value); 750 terminateO(self); 751 752 } 753 754 755 void setSmallIntKCharSmallDictT(void) { 756 757 smallDictt* r; 758 smallDictt *self = allocG(rtSmallDictt); 759 smallIntt *value = allocSmallInt(2); 760 761 r = setSmallIntKCharO(self, '1', value); 762 char *s = toStringO(r); 763 ck_assert_str_eq(s, "{\"1\":2}"); 764 free(s); 765 finishO(value); 766 terminateO(self); 767 768 } 769 770 771 void setSmallJsonKCharSmallDictT(void) { 772 773 smallDictt* r; 774 smallDictt *self = allocG(rtSmallDictt); 775 smallJsont *value = allocSmallJson(); 776 777 r = setSmallJsonKCharO(self, '1', value); 778 char *s = toStringO(r); 779 ck_assert_str_eq(s, "{\"1\":{}}"); 780 free(s); 781 finishO(value); 782 terminateO(self); 783 784 } 785 786 787 void setSmallStringKCharSmallDictT(void) { 788 789 smallDictt* r; 790 smallDictt *self = allocG(rtSmallDictt); 791 smallStringt *string = allocSmallString("qwe"); 792 793 r = setSmallStringKCharO(self, '1', string); 794 char *s = toStringO(r); 795 ck_assert_str_eq(s, "{\"1\":\"qwe\"}"); 796 free(s); 797 finishO(string); 798 terminateO(self); 799 800 } 801 802 803 void setSmallContainerKCharSmallDictT(void) { 804 805 smallDictt* r; 806 smallDictt *self = allocG(rtSmallDictt); 807 smallContainert *container = allocSmallContainer(null); 808 809 r = setSmallContainerKCharO(self, '1', container); 810 char *s = toStringO(r); 811 ck_assert_str_eq(s, "{\"1\":\"<data container>\"}"); 812 free(s); 813 finishO(container); 814 terminateO(self); 815 816 } 817 818 819 void setNFreeSmallDictT(void) { 820 821 smallDictt* r; 822 smallDictt *self = allocG(rtSmallDictt); 823 baset *value; 824 825 // undefined object 826 value = (baset*)allocUndefined(); 827 r = self->f->setNFree(self, "1", value); 828 ck_assert_ptr_ne(r, null); 829 char *s = toStringO(r); 830 ck_assert_str_eq(s, "{\"1\":null}"); 831 free(s); 832 // container 833 createAllocateSmallContainer(c); 834 r = self->f->setNFree(self, "1", (baset*)c); 835 ck_assert_ptr_ne(r, null); 836 s = toStringO(r); 837 ck_assert_str_eq(s, "{\"1\":\"<data container>\"}"); 838 free(s); 839 // base object in container 840 createAllocateSmallInt(I); 841 setValG(I, 11); 842 I->type = "anothertype"; 843 r = self->f->setNFree(self, "1", (baset*)I); 844 ck_assert_ptr_ne(r, null); 845 s = toStringO(r); 846 ck_assert_str_eq(s, "{\"1\":\"<data container>\"}"); 847 free(s); 848 // null value 849 r = self->f->setNFree(self, "1", null); 850 ck_assert_ptr_eq(r, null); 851 // null key 852 r = self->f->setNFree(self, null, value); 853 ck_assert_ptr_eq(r, null); 854 terminateO(self); 855 856 } 857 858 859 void setNFreeUndefinedSmallDictT(void) { 860 861 smallDictt* r; 862 smallDictt *self = allocG(rtSmallDictt); 863 undefinedt *undefined = allocUndefined(); 864 865 r = self->f->setNFreeUndefined(self, "1", undefined); 866 ck_assert_ptr_ne(r, null); 867 char *s = toStringO(r); 868 ck_assert_str_eq(s, "{\"1\":null}"); 869 free(s); 870 // null value 871 r = self->f->setNFreeUndefined(self, "1", null); 872 ck_assert_ptr_eq(r, null); 873 // null key 874 undefined = allocUndefined(); 875 r = self->f->setNFreeUndefined(self, null, undefined); 876 ck_assert_ptr_eq(r, null); 877 terminateO(self); 878 terminateO(undefined); 879 880 } 881 882 883 void setNFreeSSmallDictT(void) { 884 885 smallDictt* r; 886 smallDictt *self = allocG(rtSmallDictt); 887 char *string = strdup("qwe"); 888 889 r = self->f->setNFreeS(self, "1", string); 890 ck_assert_ptr_ne(r, null); 891 char *s = toStringO(r); 892 ck_assert_str_eq(s, "{\"1\":\"qwe\"}"); 893 free(s); 894 // null value 895 r = self->f->setNFreeS(self, "1", null); 896 ck_assert_ptr_eq(r, null); 897 // null key 898 string = strdup("qwe"); 899 r = self->f->setNFreeS(self, null, string); 900 ck_assert_ptr_eq(r, null); 901 terminateO(self); 902 free(string); 903 904 } 905 906 907 void setNFreeDictSmallDictT(void) { 908 909 smallDictt* r; 910 smallDictt *self = allocG(rtSmallDictt); 911 smallDictt *dict = allocSmallDict(); 912 913 r = self->f->setNFreeDict(self, "1", dict); 914 ck_assert_ptr_ne(r, null); 915 char *s = toStringO(r); 916 ck_assert_str_eq(s, "{\"1\":{}}"); 917 free(s); 918 // null value 919 r = self->f->setNFreeDict(self, "1", null); 920 ck_assert_ptr_eq(r, null); 921 // null key 922 dict = allocSmallDict(); 923 r = self->f->setNFreeDict(self, null, dict); 924 ck_assert_ptr_eq(r, null); 925 terminateO(self); 926 terminateO(dict); 927 928 } 929 930 931 void setNFreeArraySmallDictT(void) { 932 933 smallDictt* r; 934 smallDictt *self = allocG(rtSmallDictt); 935 smallArrayt *array = allocSmallArray(); 936 937 // empty array 938 r = self->f->setNFreeArray(self, "1", array); 939 ck_assert_ptr_ne(r, null); 940 char *s = toStringO(r); 941 ck_assert_str_eq(s, "{\"1\":[]}"); 942 free(s); 943 // null value 944 r = self->f->setNFreeArray(self, "1", null); 945 ck_assert_ptr_eq(r, null); 946 // null key 947 r = self->f->setNFreeArray(self, null, array); 948 ck_assert_ptr_eq(r, null); 949 terminateO(self); 950 951 } 952 953 954 void setNFreeArraycSmallDictT(void) { 955 956 smallDictt* r; 957 smallDictt *self = allocG(rtSmallDictt); 958 char **array = listCreateS("a", "b"); 959 960 r = self->f->setNFreeArrayc(self, "1", array); 961 ck_assert_ptr_ne(r, null); 962 char *s = toStringO(r); 963 ck_assert_str_eq(s, "{\"1\":[\"a\",\"b\"]}"); 964 free(s); 965 // null value 966 r = self->f->setNFreeArrayc(self, "1", null); 967 ck_assert_ptr_eq(r, null); 968 // null key 969 r = self->f->setNFreeArrayc(self, null, array); 970 ck_assert_ptr_eq(r, null); 971 terminateO(self); 972 973 } 974 975 976 void setNFreeSmallBoolSmallDictT(void) { 977 978 smallDictt* r; 979 smallDictt *self = allocG(rtSmallDictt); 980 smallBoolt *value = allocSmallBool(true); 981 982 r = self->f->setNFreeSmallBool(self, "1", value); 983 ck_assert_ptr_ne(r, null); 984 char *s = toStringO(r); 985 ck_assert_str_eq(s, "{\"1\":true}"); 986 free(s); 987 // null value 988 r = self->f->setNFreeSmallBool(self, "1", null); 989 ck_assert_ptr_eq(r, null); 990 // null key 991 r = self->f->setNFreeSmallBool(self, null, value); 992 ck_assert_ptr_eq(r, null); 993 terminateO(self); 994 995 } 996 997 998 void setNFreeSmallBytesSmallDictT(void) { 999 1000 smallDictt* r; 1001 smallDictt *self = allocG(rtSmallDictt); 1002 smallBytest *value = allocSmallBytes("qwe", sizeof("qwe")); 1003 1004 r = self->f->setNFreeSmallBytes(self, "1", value); 1005 ck_assert_ptr_ne(r, null); 1006 char *s = toStringO(r); 1007 ck_assert_str_eq(s, "{\"1\":[0x71,0x77,0x65,0x00]}"); 1008 free(s); 1009 // null value 1010 r = self->f->setNFreeSmallBytes(self, "1", null); 1011 ck_assert_ptr_eq(r, null); 1012 // null key 1013 r = self->f->setNFreeSmallBytes(self, null, value); 1014 ck_assert_ptr_eq(r, null); 1015 terminateO(self); 1016 1017 } 1018 1019 1020 void setNFreeSmallDoubleSmallDictT(void) { 1021 1022 smallDictt* r; 1023 smallDictt *self = allocG(rtSmallDictt); 1024 smallDoublet *value = allocSmallDouble(2.2); 1025 1026 r = self->f->setNFreeSmallDouble(self, "1", value); 1027 ck_assert_ptr_ne(r, null); 1028 char *s = toStringO(r); 1029 ck_assert_str_eq(s, "{\"1\":2.200000e+00}"); 1030 free(s); 1031 // null value 1032 r = self->f->setNFreeSmallDouble(self, "1", null); 1033 ck_assert_ptr_eq(r, null); 1034 // null key 1035 r = self->f->setNFreeSmallDouble(self, null, value); 1036 ck_assert_ptr_eq(r, null); 1037 terminateO(self); 1038 1039 } 1040 1041 1042 void setNFreeSmallIntSmallDictT(void) { 1043 1044 smallDictt* r; 1045 smallDictt *self = allocG(rtSmallDictt); 1046 smallIntt *value = allocSmallInt(2); 1047 1048 r = self->f->setNFreeSmallInt(self, "1", value); 1049 ck_assert_ptr_ne(r, null); 1050 char *s = toStringO(r); 1051 ck_assert_str_eq(s, "{\"1\":2}"); 1052 free(s); 1053 // null value 1054 r = self->f->setNFreeSmallInt(self, "1", null); 1055 ck_assert_ptr_eq(r, null); 1056 // null key 1057 r = self->f->setNFreeSmallInt(self, null, value); 1058 ck_assert_ptr_eq(r, null); 1059 terminateO(self); 1060 1061 } 1062 1063 1064 void setNFreeSmallJsonSmallDictT(void) { 1065 1066 smallDictt* r; 1067 smallDictt *self = allocG(rtSmallDictt); 1068 smallJsont *value = allocSmallJson(); 1069 1070 setTopIntO(value, 2); 1071 r = self->f->setNFreeSmallJson(self, "1", value); 1072 ck_assert_ptr_ne(r, null); 1073 char *s = toStringO(r); 1074 ck_assert_str_eq(s, "{\"1\":2}"); 1075 free(s); 1076 // null value 1077 r = self->f->setNFreeSmallJson(self, "1", null); 1078 ck_assert_ptr_eq(r, null); 1079 // null key 1080 r = self->f->setNFreeSmallJson(self, null, value); 1081 ck_assert_ptr_eq(r, null); 1082 terminateO(self); 1083 1084 } 1085 1086 1087 void setNFreeSmallStringSmallDictT(void) { 1088 1089 smallDictt* r; 1090 smallDictt *self = allocG(rtSmallDictt); 1091 smallStringt *string = allocSmallString("qwe"); 1092 1093 r = self->f->setNFreeSmallString(self, "1", string); 1094 ck_assert_ptr_ne(r, null); 1095 char *s = toStringO(r); 1096 ck_assert_str_eq(s, "{\"1\":\"qwe\"}"); 1097 free(s); 1098 // null value 1099 r = self->f->setNFreeSmallString(self, "1", null); 1100 ck_assert_ptr_eq(r, null); 1101 // null key 1102 r = self->f->setNFreeSmallString(self, null, string); 1103 ck_assert_ptr_eq(r, null); 1104 terminateO(self); 1105 1106 } 1107 1108 1109 void setNFreeSmallContainerSmallDictT(void) { 1110 1111 smallDictt* r; 1112 smallDictt *self = allocG(rtSmallDictt); 1113 smallContainert *container = allocSmallContainer(null); 1114 1115 r = self->f->setNFreeSmallContainer(self, "1", container); 1116 ck_assert_ptr_ne(r, null); 1117 char *s = toStringO(r); 1118 ck_assert_str_eq(s, "{\"1\":\"<data container>\"}"); 1119 free(s); 1120 // null value 1121 r = self->f->setNFreeSmallContainer(self, "1", null); 1122 ck_assert_ptr_eq(r, null); 1123 // null key 1124 r = self->f->setNFreeSmallContainer(self, null, container); 1125 ck_assert_ptr_eq(r, null); 1126 terminateO(self); 1127 1128 } 1129 1130 1131 void setNFreeKCharSmallDictT(void) { 1132 1133 smallDictt* r; 1134 smallDictt *self = allocG(rtSmallDictt); 1135 baset *value; 1136 1137 value = (baset*)allocUndefined(); 1138 r = self->f->setNFreeKChar(self, '1', value); 1139 ck_assert_ptr_ne(r, null); 1140 char *s = toStringO(r); 1141 ck_assert_str_eq(s, "{\"1\":null}"); 1142 free(s); 1143 terminateO(self); 1144 1145 } 1146 1147 1148 void setNFreeUndefinedKCharSmallDictT(void) { 1149 1150 smallDictt* r; 1151 smallDictt *self = allocG(rtSmallDictt); 1152 undefinedt *undefined = allocUndefined(); 1153 1154 r = self->f->setNFreeUndefinedKChar(self, '1', undefined); 1155 ck_assert_ptr_ne(r, null); 1156 char *s = toStringO(r); 1157 ck_assert_str_eq(s, "{\"1\":null}"); 1158 free(s); 1159 terminateO(self); 1160 1161 } 1162 1163 1164 void setNFreeSKCharSmallDictT(void) { 1165 1166 smallDictt* r; 1167 smallDictt *self = allocG(rtSmallDictt); 1168 char *string = strdup("qwe"); 1169 1170 r = self->f->setNFreeSKChar(self, '1', string); 1171 ck_assert_ptr_ne(r, null); 1172 char *s = toStringO(r); 1173 ck_assert_str_eq(s, "{\"1\":\"qwe\"}"); 1174 free(s); 1175 terminateO(self); 1176 1177 } 1178 1179 1180 void setNFreeDictKCharSmallDictT(void) { 1181 1182 smallDictt* r; 1183 smallDictt *self = allocG(rtSmallDictt); 1184 smallDictt *dict = allocSmallDict(); 1185 1186 r = self->f->setNFreeDictKChar(self, '1', dict); 1187 ck_assert_ptr_ne(r, null); 1188 char *s = toStringO(r); 1189 ck_assert_str_eq(s, "{\"1\":{}}"); 1190 free(s); 1191 terminateO(self); 1192 1193 } 1194 1195 1196 void setNFreeArrayKCharSmallDictT(void) { 1197 1198 smallDictt* r; 1199 smallDictt *self = allocG(rtSmallDictt); 1200 smallArrayt *array = allocSmallArray(); 1201 1202 r = self->f->setNFreeArrayKChar(self, '1', array); 1203 ck_assert_ptr_ne(r, null); 1204 char *s = toStringO(r); 1205 ck_assert_str_eq(s, "{\"1\":[]}"); 1206 free(s); 1207 terminateO(self); 1208 1209 } 1210 1211 1212 void setNFreeArraycKCharSmallDictT(void) { 1213 1214 smallDictt* r; 1215 smallDictt *self = allocG(rtSmallDictt); 1216 char **array = listCreateS("a", "b"); 1217 1218 r = self->f->setNFreeArraycKChar(self, '1', array); 1219 ck_assert_ptr_ne(r, null); 1220 char *s = toStringO(r); 1221 ck_assert_str_eq(s, "{\"1\":[\"a\",\"b\"]}"); 1222 free(s); 1223 terminateO(self); 1224 1225 } 1226 1227 1228 void setNFreeSmallBoolKCharSmallDictT(void) { 1229 1230 smallDictt* r; 1231 smallDictt *self = allocG(rtSmallDictt); 1232 smallBoolt *value = allocSmallBool(true); 1233 1234 r = self->f->setNFreeSmallBoolKChar(self, '1', value); 1235 ck_assert_ptr_ne(r, null); 1236 char *s = toStringO(r); 1237 ck_assert_str_eq(s, "{\"1\":true}"); 1238 free(s); 1239 terminateO(self); 1240 1241 } 1242 1243 1244 void setNFreeSmallBytesKCharSmallDictT(void) { 1245 1246 smallDictt* r; 1247 smallDictt *self = allocG(rtSmallDictt); 1248 smallBytest *value = allocSmallBytes("qwe", sizeof("qwe")); 1249 1250 r = self->f->setNFreeSmallBytesKChar(self, '1', value); 1251 ck_assert_ptr_ne(r, null); 1252 char *s = toStringO(r); 1253 ck_assert_str_eq(s, "{\"1\":[0x71,0x77,0x65,0x00]}"); 1254 free(s); 1255 terminateO(self); 1256 1257 } 1258 1259 1260 void setNFreeSmallDoubleKCharSmallDictT(void) { 1261 1262 smallDictt* r; 1263 smallDictt *self = allocG(rtSmallDictt); 1264 smallDoublet *value = allocSmallDouble(2.2); 1265 1266 r = self->f->setNFreeSmallDoubleKChar(self, '1', value); 1267 ck_assert_ptr_ne(r, null); 1268 char *s = toStringO(r); 1269 ck_assert_str_eq(s, "{\"1\":2.200000e+00}"); 1270 free(s); 1271 terminateO(self); 1272 1273 } 1274 1275 1276 void setNFreeSmallIntKCharSmallDictT(void) { 1277 1278 smallDictt* r; 1279 smallDictt *self = allocG(rtSmallDictt); 1280 smallIntt *value = allocSmallInt(2); 1281 1282 r = self->f->setNFreeSmallIntKChar(self, '1', value); 1283 ck_assert_ptr_ne(r, null); 1284 char *s = toStringO(r); 1285 ck_assert_str_eq(s, "{\"1\":2}"); 1286 free(s); 1287 terminateO(self); 1288 1289 } 1290 1291 1292 void setNFreeSmallJsonKCharSmallDictT(void) { 1293 1294 smallDictt* r; 1295 smallDictt *self = allocG(rtSmallDictt); 1296 smallJsont *value = allocSmallJson(); 1297 1298 setTopIntO(value, 2); 1299 r = self->f->setNFreeSmallJsonKChar(self, '1', value); 1300 ck_assert_ptr_ne(r, null); 1301 char *s = toStringO(r); 1302 ck_assert_str_eq(s, "{\"1\":2}"); 1303 free(s); 1304 terminateO(self); 1305 1306 } 1307 1308 1309 void setNFreeSmallStringKCharSmallDictT(void) { 1310 1311 smallDictt* r; 1312 smallDictt *self = allocG(rtSmallDictt); 1313 smallStringt *string = allocSmallString("qwe"); 1314 1315 r = self->f->setNFreeSmallStringKChar(self, '1', string); 1316 ck_assert_ptr_ne(r, null); 1317 char *s = toStringO(r); 1318 ck_assert_str_eq(s, "{\"1\":\"qwe\"}"); 1319 free(s); 1320 terminateO(self); 1321 1322 } 1323 1324 1325 void setNFreeSmallContainerKCharSmallDictT(void) { 1326 1327 smallDictt* r; 1328 smallDictt *self = allocG(rtSmallDictt); 1329 smallContainert *container = allocSmallContainer(null); 1330 1331 r = self->f->setNFreeSmallContainerKChar(self, '1', container); 1332 ck_assert_ptr_ne(r, null); 1333 char *s = toStringO(r); 1334 ck_assert_str_eq(s, "{\"1\":\"<data container>\"}"); 1335 free(s); 1336 terminateO(self); 1337 1338 } 1339 1340 1341 void setPDictSmallDictT(void) { 1342 1343 smallDictt* r; 1344 smallDictt *self = allocG(rtSmallDictt); 1345 smallDictt *dict; 1346 1347 dict = allocSmallDict(); 1348 r = self->f->setDict(self, "1", dict); 1349 ck_assert_ptr_ne(r, null); 1350 dict->f->setInt(dict, "a", 1); 1351 r = self->f->setPDict(self, "1", dict); 1352 ck_assert_ptr_ne(r, null); 1353 char *s = toStringO(r); 1354 ck_assert_str_eq(s, "{\"1\":{\"a\":1}}"); 1355 free(s); 1356 // empty dict 1357 finishO(dict); 1358 dict = allocSmallDict(); 1359 r = self->f->setPDict(self, "1", dict); 1360 ck_assert_ptr_eq(r, null); 1361 finishO(dict); 1362 s = toStringO(self); 1363 ck_assert_str_eq(s, "{\"1\":{\"a\":1}}"); 1364 free(s); 1365 // non smallDict object 1366 dict = (smallDictt*) allocSmallInt(2); 1367 r = self->f->setPDict(self, "1", dict); 1368 ck_assert_ptr_eq(r, null); 1369 terminateO(dict); 1370 // null value 1371 r = self->f->setPDict(self, "1", null); 1372 ck_assert_ptr_eq(r, null); 1373 // null key 1374 r = self->f->setPDict(self, null, dict); 1375 ck_assert_ptr_eq(r, null); 1376 terminateO(self); 1377 1378 } 1379 1380 1381 void setPArraySmallDictT(void) { 1382 1383 smallDictt* r; 1384 smallDictt *self = allocG(rtSmallDictt); 1385 smallArrayt *array; 1386 1387 array = allocSmallArray(); 1388 r = self->f->setArray(self, "1", array); 1389 ck_assert_ptr_ne(r, null); 1390 array->f->pushInt(array, 1); 1391 r = self->f->setPArray(self, "1", array); 1392 ck_assert_ptr_ne(r, null); 1393 char *s = toStringO(r); 1394 ck_assert_str_eq(s, "{\"1\":[1]}"); 1395 free(s); 1396 // empty array 1397 finishO(array); 1398 array = allocSmallArray(); 1399 r = self->f->setPArray(self, "1", array); 1400 ck_assert_ptr_eq(r, null); 1401 finishO(array); 1402 s = toStringO(self); 1403 ck_assert_str_eq(s, "{\"1\":[1]}"); 1404 free(s); 1405 // non smallDict object 1406 array = (smallArrayt*) allocSmallInt(2); 1407 r = self->f->setPArray(self, "1", array); 1408 ck_assert_ptr_eq(r, null); 1409 terminateO(array); 1410 // null value 1411 r = self->f->setPArray(self, "1", null); 1412 ck_assert_ptr_eq(r, null); 1413 // null key 1414 r = self->f->setPArray(self, null, array); 1415 ck_assert_ptr_eq(r, null); 1416 terminateO(self); 1417 1418 } 1419 1420 1421 void setPSmallJsonSmallDictT(void) { 1422 1423 smallDictt* r; 1424 smallDictt *self = allocG(rtSmallDictt); 1425 smallJsont *json; 1426 1427 json = allocSmallJson(); 1428 r = self->f->setSmallJson(self, "1", json); 1429 ck_assert_ptr_ne(r, null); 1430 json->f->setInt(json, "a", 1); 1431 r = self->f->setPSmallJson(self, "1", json); 1432 ck_assert_ptr_ne(r, null); 1433 finishO(json); 1434 char *s = toStringO(r); 1435 ck_assert_str_eq(s, "{\"1\":{\"a\":1}}"); 1436 free(s); 1437 // empty smallJson 1438 json = allocSmallJson(); 1439 r = self->f->setPSmallJson(self, "1", json); 1440 ck_assert_ptr_eq(r, null); 1441 terminateO(json); 1442 // non smallJson object 1443 json = (smallJsont*) allocSmallInt(2); 1444 r = self->f->setPSmallJson(self, "1", json); 1445 ck_assert_ptr_eq(r, null); 1446 // null value 1447 r = self->f->setPSmallJson(self, "1", null); 1448 ck_assert_ptr_eq(r, null); 1449 // null key 1450 r = self->f->setPSmallJson(self, null, json); 1451 ck_assert_ptr_eq(r, null); 1452 terminateO(self); 1453 terminateO(json); 1454 1455 } 1456 1457 1458 void setPSmallStringSmallDictT(void) { 1459 1460 smallDictt* r; 1461 smallDictt *self = allocG(rtSmallDictt); 1462 smallStringt *string; 1463 1464 string = allocSmallString(""); 1465 r = self->f->setSmallString(self, "1", string); 1466 ck_assert_ptr_ne(r, null); 1467 string->f->appendS(string, "s"); 1468 r = self->f->setPSmallString(self, "1", string); 1469 ck_assert_ptr_ne(r, null); 1470 finishO(string); 1471 char *s = toStringO(r); 1472 ck_assert_str_eq(s, "{\"1\":\"s\"}"); 1473 free(s); 1474 // empty SmallString 1475 string = allocSmallString(""); 1476 freeO(string); 1477 r = self->f->setPSmallString(self, "1", string); 1478 ck_assert_ptr_eq(r, null); 1479 terminateO(string); 1480 // non smallString object 1481 string = (smallStringt*) allocSmallInt(2); 1482 r = self->f->setPSmallString(self, "1", string); 1483 ck_assert_ptr_eq(r, null); 1484 terminateO(string); 1485 // null value 1486 r = self->f->setPSmallString(self, "1", null); 1487 ck_assert_ptr_eq(r, null); 1488 // null key 1489 string = allocSmallString(""); 1490 r = self->f->setPSmallString(self, null, string); 1491 ck_assert_ptr_eq(r, null); 1492 terminateO(self); 1493 terminateO(string); 1494 1495 } 1496 1497 1498 void setNFreePDictSmallDictT(void) { 1499 1500 smallDictt* r; 1501 smallDictt *self = allocG(rtSmallDictt); 1502 smallDictt *value; 1503 1504 value = allocSmallDict(); 1505 r = self->f->setDict(self, "1", value); 1506 ck_assert_ptr_ne(r, null); 1507 value->f->setInt(value, "a", 1); 1508 r = self->f->setNFreePDict(self, "1", value); 1509 ck_assert_ptr_ne(r, null); 1510 char *s = toStringO(r); 1511 ck_assert_str_eq(s, "{\"1\":{\"a\":1}}"); 1512 free(s); 1513 // empty smallDict 1514 value = allocSmallDict(); 1515 r = self->f->setNFreePDict(self, "1", value); 1516 ck_assert_ptr_eq(r, null); 1517 terminateO(value); 1518 // non smallDict object 1519 value = (smallDictt*) allocSmallInt(2); 1520 r = self->f->setNFreePDict(self, "1", value); 1521 ck_assert_ptr_eq(r, null); 1522 terminateO(value); 1523 // null value 1524 value = allocSmallDict(); 1525 r = self->f->setNFreePDict(self, "1", null); 1526 ck_assert_ptr_eq(r, null); 1527 // null key 1528 r = self->f->setNFreePDict(self, null, value); 1529 ck_assert_ptr_eq(r, null); 1530 terminateO(self); 1531 terminateO(value); 1532 1533 } 1534 1535 1536 void setNFreePArraySmallDictT(void) { 1537 1538 smallDictt* r; 1539 smallDictt *self = allocG(rtSmallDictt); 1540 smallArrayt *value; 1541 1542 value = allocSmallArray(); 1543 r = self->f->setArray(self, "1", value); 1544 ck_assert_ptr_ne(r, null); 1545 value->f->pushInt(value, 2); 1546 r = self->f->setNFreePArray(self, "1", value); 1547 ck_assert_ptr_ne(r, null); 1548 char *s = toStringO(r); 1549 ck_assert_str_eq(s, "{\"1\":[2]}"); 1550 free(s); 1551 // empty smallArray 1552 value = allocSmallArray(); 1553 r = self->f->setNFreePArray(self, "1", value); 1554 ck_assert_ptr_eq(r, null); 1555 terminateO(value); 1556 // non smallArray object 1557 value = (smallArrayt*) allocSmallInt(2); 1558 r = self->f->setNFreePArray(self, "1", value); 1559 ck_assert_ptr_eq(r, null); 1560 terminateO(value); 1561 // null value 1562 value = allocSmallArray(); 1563 r = self->f->setNFreePArray(self, "1", null); 1564 ck_assert_ptr_eq(r, null); 1565 // null key 1566 r = self->f->setNFreePArray(self, null, value); 1567 ck_assert_ptr_eq(r, null); 1568 terminateO(self); 1569 terminateO(value); 1570 1571 } 1572 1573 1574 void setNFreePSmallJsonSmallDictT(void) { 1575 1576 smallDictt* r; 1577 smallDictt *self = allocG(rtSmallDictt); 1578 smallJsont *value; 1579 1580 value = allocSmallJson(); 1581 r = self->f->setSmallJson(self, "1", value); 1582 ck_assert_ptr_ne(r, null); 1583 value->f->setInt(value, "a", 1); 1584 r = self->f->setNFreePSmallJson(self, "1", value); 1585 ck_assert_ptr_ne(r, null); 1586 char *s = toStringO(r); 1587 ck_assert_str_eq(s, "{\"1\":{\"a\":1}}"); 1588 free(s); 1589 // empty smallJson 1590 value = allocSmallJson(); 1591 r = self->f->setNFreePSmallJson(self, "1", value); 1592 ck_assert_ptr_eq(r, null); 1593 terminateO(value); 1594 // non smallJson object 1595 value = (smallJsont*) allocSmallInt(2); 1596 r = self->f->setNFreePSmallJson(self, "1", value); 1597 ck_assert_ptr_eq(r, null); 1598 terminateO(value); 1599 // null value 1600 value = allocSmallJson(); 1601 r = self->f->setNFreePSmallJson(self, "1", null); 1602 ck_assert_ptr_eq(r, null); 1603 // null key 1604 r = self->f->setNFreePSmallJson(self, null, value); 1605 ck_assert_ptr_eq(r, null); 1606 terminateO(self); 1607 terminateO(value); 1608 1609 } 1610 1611 1612 void setNFreePSmallStringSmallDictT(void) { 1613 1614 smallDictt* r; 1615 smallDictt *self = allocG(rtSmallDictt); 1616 smallStringt *value; 1617 1618 value = allocSmallString(""); 1619 r = self->f->setSmallString(self, "1", value); 1620 ck_assert_ptr_ne(r, null); 1621 value->f->appendS(value, "2"); 1622 r = self->f->setNFreePSmallString(self, "1", value); 1623 ck_assert_ptr_ne(r, null); 1624 char *s = toStringO(r); 1625 ck_assert_str_eq(s, "{\"1\":\"2\"}"); 1626 free(s); 1627 // empty SmallString 1628 value = allocSmallString(""); 1629 freeO(value); 1630 r = self->f->setNFreePSmallString(self, "1", value); 1631 ck_assert_ptr_eq(r, null); 1632 terminateO(value); 1633 // non smallString object 1634 value = (smallStringt*) allocSmallInt(2); 1635 r = self->f->setNFreePSmallString(self, "1", value); 1636 ck_assert_ptr_eq(r, null); 1637 terminateO(value); 1638 // null value 1639 value = allocSmallString(""); 1640 r = self->f->setNFreePSmallString(self, "1", null); 1641 ck_assert_ptr_eq(r, null); 1642 // null key 1643 r = self->f->setNFreePSmallString(self, null, value); 1644 ck_assert_ptr_eq(r, null); 1645 terminateO(self); 1646 terminateO(value); 1647 1648 } 1649 1650 1651 void setPArrayKCharSmallDictT(void) { 1652 1653 smallDictt* r; 1654 smallDictt *self = allocG(rtSmallDictt); 1655 smallArrayt *array; 1656 1657 array = allocSmallArray(); 1658 r = self->f->setArray(self, "1", array); 1659 ck_assert_ptr_ne(r, null); 1660 array->f->pushInt(array, 2); 1661 r = self->f->setPArrayKChar(self, '1', array); 1662 ck_assert_ptr_ne(r, null); 1663 char *s = toStringO(r); 1664 ck_assert_str_eq(s, "{\"1\":[2]}"); 1665 free(s); 1666 terminateO(self); 1667 finishO(array); 1668 1669 } 1670 1671 1672 void setPDictKCharSmallDictT(void) { 1673 1674 smallDictt* r; 1675 smallDictt *self = allocG(rtSmallDictt); 1676 smallDictt *dict; 1677 1678 dict = allocSmallDict(); 1679 r = self->f->setDict(self, "1", dict); 1680 ck_assert_ptr_ne(r, null); 1681 dict->f->setInt(dict, "a", 1); 1682 r = self->f->setPDictKChar(self, '1', dict); 1683 ck_assert_ptr_ne(r, null); 1684 char *s = toStringO(r); 1685 ck_assert_str_eq(s, "{\"1\":{\"a\":1}}"); 1686 free(s); 1687 terminateO(self); 1688 finishO(dict); 1689 1690 } 1691 1692 1693 void setPSmallJsonKCharSmallDictT(void) { 1694 1695 smallDictt* r; 1696 smallDictt *self = allocG(rtSmallDictt); 1697 smallJsont *json; 1698 1699 json = allocSmallJson(); 1700 r = self->f->setSmallJson(self, "1", json); 1701 ck_assert_ptr_ne(r, null); 1702 json->f->setInt(json, "a", 1); 1703 r = self->f->setPSmallJsonKChar(self, '1', json); 1704 ck_assert_ptr_ne(r, null); 1705 finishO(json); 1706 char *s = toStringO(r); 1707 ck_assert_str_eq(s, "{\"1\":{\"a\":1}}"); 1708 free(s); 1709 terminateO(self); 1710 1711 } 1712 1713 1714 void setPSmallStringKCharSmallDictT(void) { 1715 1716 smallDictt* r; 1717 smallDictt *self = allocG(rtSmallDictt); 1718 smallStringt *string; 1719 1720 string = allocSmallString(""); 1721 r = self->f->setSmallString(self, "1", string); 1722 ck_assert_ptr_ne(r, null); 1723 string->f->appendS(string, "s"); 1724 r = self->f->setPSmallStringKChar(self, '1', string); 1725 ck_assert_ptr_ne(r, null); 1726 finishO(string); 1727 char *s = toStringO(r); 1728 ck_assert_str_eq(s, "{\"1\":\"s\"}"); 1729 free(s); 1730 terminateO(self); 1731 1732 } 1733 1734 1735 void setNFreePArrayKCharSmallDictT(void) { 1736 1737 smallDictt* r; 1738 smallDictt *self = allocG(rtSmallDictt); 1739 smallArrayt *value; 1740 1741 value = allocSmallArray(); 1742 r = self->f->setArray(self, "1", value); 1743 ck_assert_ptr_ne(r, null); 1744 value->f->pushInt(value, 2); 1745 r = self->f->setNFreePArrayKChar(self, '1', value); 1746 ck_assert_ptr_ne(r, null); 1747 char *s = toStringO(r); 1748 ck_assert_str_eq(s, "{\"1\":[2]}"); 1749 free(s); 1750 terminateO(self); 1751 1752 } 1753 1754 1755 void setNFreePDictKCharSmallDictT(void) { 1756 1757 smallDictt* r; 1758 smallDictt *self = allocG(rtSmallDictt); 1759 smallDictt *value; 1760 1761 value = allocSmallDict(); 1762 r = self->f->setDict(self, "1", value); 1763 ck_assert_ptr_ne(r, null); 1764 value->f->setInt(value, "a", 1); 1765 r = self->f->setNFreePDictKChar(self, '1', value); 1766 ck_assert_ptr_ne(r, null); 1767 char *s = toStringO(r); 1768 ck_assert_str_eq(s, "{\"1\":{\"a\":1}}"); 1769 free(s); 1770 terminateO(self); 1771 1772 } 1773 1774 1775 void setNFreePSmallJsonKCharSmallDictT(void) { 1776 1777 smallDictt* r; 1778 smallDictt *self = allocG(rtSmallDictt); 1779 smallJsont *value; 1780 1781 value = allocSmallJson(); 1782 r = self->f->setSmallJson(self, "1", value); 1783 ck_assert_ptr_ne(r, null); 1784 value->f->setInt(value, "a", 1); 1785 r = self->f->setNFreePSmallJsonKChar(self, '1', value); 1786 ck_assert_ptr_ne(r, null); 1787 char *s = toStringO(r); 1788 ck_assert_str_eq(s, "{\"1\":{\"a\":1}}"); 1789 free(s); 1790 terminateO(self); 1791 1792 } 1793 1794 1795 void setNFreePSmallStringKCharSmallDictT(void) { 1796 1797 smallDictt* r; 1798 smallDictt *self = allocG(rtSmallDictt); 1799 smallStringt *value; 1800 1801 value = allocSmallString(""); 1802 r = self->f->setSmallString(self, "1", value); 1803 ck_assert_ptr_ne(r, null); 1804 value->f->appendS(value, "2"); 1805 r = self->f->setNFreePSmallStringKChar(self, '1', value); 1806 ck_assert_ptr_ne(r, null); 1807 char *s = toStringO(r); 1808 ck_assert_str_eq(s, "{\"1\":\"2\"}"); 1809 free(s); 1810 terminateO(self); 1811 1812 } 1813 1814 1815 void getUndefinedSmallDictT(void) { 1816 1817 undefinedt* r; 1818 smallDictt *self = allocG(rtSmallDictt); 1819 1820 smallDictt *r2 = self->f->setUndefined(self, "1"); 1821 ck_assert_ptr_ne(r2, null); 1822 r = self->f->getUndefined(self, "1"); 1823 ck_assert_ptr_ne(r, null); 1824 terminateO(r); 1825 // non undefined object 1826 r2 = self->f->setInt(self, "1", 2); 1827 ck_assert_ptr_ne(r2, null); 1828 r = self->f->getUndefined(self, "1"); 1829 ck_assert_ptr_eq(r, null); 1830 // null key 1831 r = self->f->getUndefined(self, null); 1832 ck_assert_ptr_eq(r, null); 1833 // empty self 1834 freeO(self); 1835 r = self->f->getUndefined(self, "1"); 1836 ck_assert_ptr_eq(r, null); 1837 terminateO(self); 1838 1839 } 1840 1841 1842 void getBoolSmallDictT(void) { 1843 1844 bool r; 1845 smallDictt *self = allocG(rtSmallDictt); 1846 1847 smallDictt *r2 = self->f->setBool(self, "1", true); 1848 ck_assert_ptr_ne(r2, null); 1849 r = self->f->getBool(self, "1"); 1850 ck_assert(r); 1851 // non bool object 1852 r2 = self->f->setInt(self, "1", 2); 1853 ck_assert_ptr_ne(r2, null); 1854 r = self->f->getBool(self, "1"); 1855 ck_assert(!r); 1856 // null key 1857 r = self->f->getBool(self, null); 1858 ck_assert(!r); 1859 // empty self 1860 freeO(self); 1861 r = self->f->getBool(self, "1"); 1862 ck_assert(!r); 1863 terminateO(self); 1864 1865 } 1866 1867 1868 void getBoolPSmallDictT(void) { 1869 1870 bool* r; 1871 smallDictt *self = allocG(rtSmallDictt); 1872 1873 smallDictt *r2 = self->f->setBool(self, "1", true); 1874 ck_assert_ptr_ne(r2, null); 1875 r = self->f->getBoolP(self, "1"); 1876 ck_assert_ptr_ne(r, null); 1877 ck_assert(*r); 1878 // non bool object 1879 r2 = self->f->setInt(self, "1", 2); 1880 ck_assert_ptr_ne(r2, null); 1881 r = self->f->getBoolP(self, "1"); 1882 ck_assert_ptr_eq(r, null); 1883 // null key 1884 r = self->f->getBoolP(self, null); 1885 ck_assert_ptr_eq(r, null); 1886 // empty self 1887 freeO(self); 1888 r = self->f->getBoolP(self, "1"); 1889 ck_assert_ptr_eq(r, null); 1890 terminateO(self); 1891 1892 } 1893 1894 1895 void getDoubleSmallDictT(void) { 1896 1897 double r; 1898 smallDictt *self = allocG(rtSmallDictt); 1899 1900 smallDictt *r2 = self->f->setDouble(self, "1", 2.2); 1901 ck_assert_ptr_ne(r2, null); 1902 r = self->f->getDouble(self, "1"); 1903 ck_assert(r == 2.2); 1904 // non double object 1905 r2 = self->f->setInt(self, "1", 2); 1906 ck_assert_ptr_ne(r2, null); 1907 r = self->f->getDouble(self, "1"); 1908 ck_assert(r == 0); 1909 // null key 1910 r = self->f->getDouble(self, null); 1911 ck_assert(!r); 1912 // empty self 1913 freeO(self); 1914 r = self->f->getDouble(self, "1"); 1915 ck_assert(!r); 1916 terminateO(self); 1917 1918 } 1919 1920 1921 void getDoublePSmallDictT(void) { 1922 1923 double* r; 1924 smallDictt *self = allocG(rtSmallDictt); 1925 1926 smallDictt *r2 = self->f->setDouble(self, "1", 2.2); 1927 ck_assert_ptr_ne(r2, null); 1928 r = self->f->getDoubleP(self, "1"); 1929 ck_assert_ptr_ne(r, null); 1930 ck_assert(*r == 2.2); 1931 // non double object 1932 r2 = self->f->setInt(self, "1", 2); 1933 ck_assert_ptr_ne(r2, null); 1934 r = self->f->getDoubleP(self, "1"); 1935 ck_assert_ptr_eq(r, null); 1936 // null key 1937 r = self->f->getDoubleP(self, null); 1938 ck_assert_ptr_eq(r, null); 1939 // empty self 1940 freeO(self); 1941 r = self->f->getDoubleP(self, "1"); 1942 ck_assert_ptr_eq(r, null); 1943 terminateO(self); 1944 1945 } 1946 1947 1948 void getIntSmallDictT(void) { 1949 1950 int64_t r; 1951 smallDictt *self = allocG(rtSmallDictt); 1952 1953 smallDictt *r2 = self->f->setInt(self, "1", 2); 1954 ck_assert_ptr_ne(r2, null); 1955 r = self->f->getInt(self, "1"); 1956 ck_assert_int_eq(r, 2); 1957 // non int object 1958 r2 = self->f->setBool(self, "1", true); 1959 ck_assert_ptr_ne(r2, null); 1960 r = self->f->getInt(self, "1"); 1961 ck_assert(!r); 1962 // null key 1963 r = self->f->getInt(self, null); 1964 ck_assert(!r); 1965 // empty self 1966 freeO(self); 1967 r = self->f->getInt(self, "1"); 1968 ck_assert(!r); 1969 terminateO(self); 1970 1971 } 1972 1973 1974 void getIntPSmallDictT(void) { 1975 1976 int64_t* r; 1977 smallDictt *self = allocG(rtSmallDictt); 1978 1979 smallDictt *r2 = self->f->setInt(self, "1", 2); 1980 ck_assert_ptr_ne(r2, null); 1981 r = self->f->getIntP(self, "1"); 1982 ck_assert_ptr_ne(r, null); 1983 ck_assert_int_eq(*r, 2); 1984 // non int object 1985 r2 = self->f->setBool(self, "1", true); 1986 ck_assert_ptr_ne(r2, null); 1987 r = self->f->getIntP(self, "1"); 1988 ck_assert_ptr_eq(r, null); 1989 // null key 1990 r = self->f->getIntP(self, null); 1991 ck_assert_ptr_eq(r, null); 1992 // empty self 1993 freeO(self); 1994 r = self->f->getIntP(self, "1"); 1995 ck_assert_ptr_eq(r, null); 1996 terminateO(self); 1997 1998 } 1999 2000 2001 void getInt32SmallDictT(void) { 2002 2003 int32_t r; 2004 smallDictt *self = allocG(rtSmallDictt); 2005 2006 smallDictt *r2 = self->f->setInt(self, "1", 2); 2007 ck_assert_ptr_ne(r2, null); 2008 r = self->f->getInt32(self, "1"); 2009 ck_assert_int_eq(r, 2); 2010 // non int object 2011 r2 = self->f->setBool(self, "1", true); 2012 ck_assert_ptr_ne(r2, null); 2013 r = self->f->getInt32(self, "1"); 2014 ck_assert(!r); 2015 // null key 2016 r = self->f->getInt32(self, null); 2017 ck_assert(!r); 2018 // empty self 2019 freeO(self); 2020 r = self->f->getInt32(self, "1"); 2021 ck_assert(!r); 2022 terminateO(self); 2023 2024 } 2025 2026 2027 void getInt32PSmallDictT(void) { 2028 2029 int32_t* r; 2030 smallDictt *self = allocG(rtSmallDictt); 2031 2032 smallDictt *r2 = self->f->setInt(self, "1", 2); 2033 ck_assert_ptr_ne(r2, null); 2034 r = self->f->getInt32P(self, "1"); 2035 ck_assert_ptr_ne(r, null); 2036 ck_assert_int_eq(*r, 2); 2037 // non int object 2038 r2 = self->f->setBool(self, "1", true); 2039 ck_assert_ptr_ne(r2, null); 2040 r = self->f->getInt32P(self, "1"); 2041 ck_assert_ptr_eq(r, null); 2042 // null key 2043 r = self->f->getInt32P(self, null); 2044 ck_assert_ptr_eq(r, null); 2045 // empty self 2046 freeO(self); 2047 r = self->f->getInt32P(self, "1"); 2048 ck_assert_ptr_eq(r, null); 2049 terminateO(self); 2050 2051 } 2052 2053 2054 void getUintSmallDictT(void) { 2055 2056 uint64_t r; 2057 smallDictt *self = allocG(rtSmallDictt); 2058 2059 smallDictt *r2 = self->f->setInt(self, "1", 2); 2060 ck_assert_ptr_ne(r2, null); 2061 r = self->f->getUint(self, "1"); 2062 ck_assert_int_eq(r, 2); 2063 // non int object 2064 r2 = self->f->setBool(self, "1", true); 2065 ck_assert_ptr_ne(r2, null); 2066 r = self->f->getUint(self, "1"); 2067 ck_assert(!r); 2068 // null key 2069 r = self->f->getUint(self, null); 2070 ck_assert(!r); 2071 // empty self 2072 freeO(self); 2073 r = self->f->getUint(self, "1"); 2074 ck_assert(!r); 2075 terminateO(self); 2076 2077 } 2078 2079 2080 void getUintPSmallDictT(void) { 2081 2082 uint64_t* r; 2083 smallDictt *self = allocG(rtSmallDictt); 2084 2085 smallDictt *r2 = self->f->setInt(self, "1", 2); 2086 ck_assert_ptr_ne(r2, null); 2087 r = self->f->getUintP(self, "1"); 2088 ck_assert_ptr_ne(r, null); 2089 ck_assert_int_eq(*r, 2); 2090 // non int object 2091 r2 = self->f->setBool(self, "1", true); 2092 ck_assert_ptr_ne(r2, null); 2093 r = self->f->getUintP(self, "1"); 2094 ck_assert_ptr_eq(r, null); 2095 // null key 2096 r = self->f->getUintP(self, null); 2097 ck_assert_ptr_eq(r, null); 2098 // empty self 2099 freeO(self); 2100 r = self->f->getUintP(self, "1"); 2101 ck_assert_ptr_eq(r, null); 2102 terminateO(self); 2103 2104 } 2105 2106 2107 void getUint32SmallDictT(void) { 2108 2109 uint32_t r; 2110 smallDictt *self = allocG(rtSmallDictt); 2111 2112 smallDictt *r2 = self->f->setInt(self, "1", 2); 2113 ck_assert_ptr_ne(r2, null); 2114 r = self->f->getUint32(self, "1"); 2115 ck_assert_int_eq(r, 2); 2116 // non int object 2117 r2 = self->f->setBool(self, "1", true); 2118 ck_assert_ptr_ne(r2, null); 2119 r = self->f->getUint32(self, "1"); 2120 ck_assert(!r); 2121 // null key 2122 r = self->f->getUint32(self, null); 2123 ck_assert(!r); 2124 // empty self 2125 freeO(self); 2126 r = self->f->getUint32(self, "1"); 2127 ck_assert(!r); 2128 terminateO(self); 2129 2130 } 2131 2132 2133 void getUint32PSmallDictT(void) { 2134 2135 uint32_t* r; 2136 smallDictt *self = allocG(rtSmallDictt); 2137 2138 smallDictt *r2 = self->f->setInt(self, "1", 2); 2139 ck_assert_ptr_ne(r2, null); 2140 r = self->f->getUint32P(self, "1"); 2141 ck_assert_ptr_ne(r, null); 2142 ck_assert_int_eq(*r, 2); 2143 // non int object 2144 r2 = self->f->setBool(self, "1", true); 2145 ck_assert_ptr_ne(r2, null); 2146 r = self->f->getUint32P(self, "1"); 2147 ck_assert_ptr_eq(r, null); 2148 // null key 2149 r = self->f->getUint32P(self, null); 2150 ck_assert_ptr_eq(r, null); 2151 // empty self 2152 freeO(self); 2153 r = self->f->getUint32P(self, "1"); 2154 ck_assert_ptr_eq(r, null); 2155 terminateO(self); 2156 2157 } 2158 2159 2160 void getSSmallDictT(void) { 2161 2162 char* r; 2163 smallDictt *self = allocG(rtSmallDictt); 2164 2165 smallDictt *r2 = self->f->setS(self, "1", "qwe"); 2166 ck_assert_ptr_ne(r2, null); 2167 r = self->f->getS(self, "1"); 2168 ck_assert_ptr_ne(r, null); 2169 ck_assert_str_eq(r, "qwe"); 2170 // non string object 2171 r2 = self->f->setBool(self, "1", true); 2172 ck_assert_ptr_ne(r2, null); 2173 r = self->f->getS(self, "1"); 2174 ck_assert_ptr_eq(r, null); 2175 // null key 2176 r = self->f->getS(self, null); 2177 ck_assert_ptr_eq(r, null); 2178 // empty self 2179 freeO(self); 2180 r = self->f->getS(self, "1"); 2181 ck_assert_ptr_eq(r, null); 2182 terminateO(self); 2183 2184 } 2185 2186 2187 void getDictSmallDictT(void) { 2188 2189 smallDictt* r; 2190 smallDictt *self = allocG(rtSmallDictt); 2191 2192 createAllocateSmallDict(d); 2193 smallDictt *r2 = self->f->setNFreeDict(self, "1", d); 2194 ck_assert_ptr_ne(r2, null); 2195 r = self->f->getDict(self, "1"); 2196 ck_assert_ptr_ne(r, null); 2197 char *s = toStringO(r); 2198 finishO(r); 2199 ck_assert_str_eq(s, "{}"); 2200 free(s); 2201 // non dict object 2202 r2 = self->f->setBool(self, "1", true); 2203 ck_assert_ptr_ne(r2, null); 2204 r = self->f->getDict(self, "1"); 2205 ck_assert_ptr_eq(r, null); 2206 // null key 2207 r = self->f->getDict(self, null); 2208 ck_assert_ptr_eq(r, null); 2209 // empty self 2210 freeO(self); 2211 r = self->f->getDict(self, "1"); 2212 ck_assert_ptr_eq(r, null); 2213 terminateO(self); 2214 2215 } 2216 2217 2218 void getArraySmallDictT(void) { 2219 2220 smallArrayt* r; 2221 smallDictt *self = allocG(rtSmallDictt); 2222 2223 createAllocateSmallArray(d); 2224 smallDictt *r2 = self->f->setNFreeArray(self, "1", d); 2225 ck_assert_ptr_ne(r2, null); 2226 r = self->f->getArray(self, "1"); 2227 ck_assert_ptr_ne(r, null); 2228 char *s = toStringO(r); 2229 finishO(r); 2230 ck_assert_str_eq(s, "[]"); 2231 free(s); 2232 // non Array object 2233 r2 = self->f->setBool(self, "1", true); 2234 ck_assert_ptr_ne(r2, null); 2235 r = self->f->getArray(self, "1"); 2236 ck_assert_ptr_eq(r, null); 2237 // null key 2238 r = self->f->getArray(self, null); 2239 ck_assert_ptr_eq(r, null); 2240 // empty self 2241 freeO(self); 2242 r = self->f->getArray(self, "1"); 2243 ck_assert_ptr_eq(r, null); 2244 terminateO(self); 2245 2246 } 2247 2248 2249 void getSmallBoolSmallDictT(void) { 2250 2251 smallBoolt* r; 2252 smallDictt *self = allocG(rtSmallDictt); 2253 2254 createAllocateSmallBool(d); 2255 smallDictt *r2 = self->f->setNFreeSmallBool(self, "1", d); 2256 ck_assert_ptr_ne(r2, null); 2257 r = self->f->getSmallBool(self, "1"); 2258 ck_assert_ptr_ne(r, null); 2259 char *s = toStringO(r); 2260 finishO(r); 2261 ck_assert_str_eq(s, "false"); 2262 free(s); 2263 // non SmallBool object 2264 r2 = self->f->setInt(self, "1", 0); 2265 ck_assert_ptr_ne(r2, null); 2266 r = self->f->getSmallBool(self, "1"); 2267 ck_assert_ptr_eq(r, null); 2268 // null key 2269 r = self->f->getSmallBool(self, null); 2270 ck_assert_ptr_eq(r, null); 2271 // empty self 2272 freeO(self); 2273 r = self->f->getSmallBool(self, "1"); 2274 ck_assert_ptr_eq(r, null); 2275 terminateO(self); 2276 2277 } 2278 2279 2280 void getSmallBytesSmallDictT(void) { 2281 2282 smallBytest* r; 2283 smallDictt *self = allocG(rtSmallDictt); 2284 2285 createAllocateSmallBytes(d); 2286 smallDictt *r2 = self->f->setNFreeSmallBytes(self, "1", d); 2287 ck_assert_ptr_ne(r2, null); 2288 r = self->f->getSmallBytes(self, "1"); 2289 ck_assert_ptr_ne(r, null); 2290 char *s = toStringO(r); 2291 finishO(r); 2292 ck_assert_str_eq(s, "[]"); 2293 free(s); 2294 // non SmallBytes object 2295 r2 = self->f->setBool(self, "1", true); 2296 ck_assert_ptr_ne(r2, null); 2297 r = self->f->getSmallBytes(self, "1"); 2298 ck_assert_ptr_eq(r, null); 2299 // null key 2300 r = self->f->getSmallBytes(self, null); 2301 ck_assert_ptr_eq(r, null); 2302 // empty self 2303 freeO(self); 2304 r = self->f->getSmallBytes(self, "1"); 2305 ck_assert_ptr_eq(r, null); 2306 terminateO(self); 2307 2308 } 2309 2310 2311 void getSmallDoubleSmallDictT(void) { 2312 2313 smallDoublet* r; 2314 smallDictt *self = allocG(rtSmallDictt); 2315 2316 createAllocateSmallDouble(d); 2317 smallDictt *r2 = self->f->setNFreeSmallDouble(self, "1", d); 2318 ck_assert_ptr_ne(r2, null); 2319 r = self->f->getSmallDouble(self, "1"); 2320 ck_assert_ptr_ne(r, null); 2321 char *s = toStringO(r); 2322 finishO(r); 2323 ck_assert_str_eq(s, "0.000000e+00"); 2324 free(s); 2325 // non SmallDouble object 2326 r2 = self->f->setBool(self, "1", true); 2327 ck_assert_ptr_ne(r2, null); 2328 r = self->f->getSmallDouble(self, "1"); 2329 ck_assert_ptr_eq(r, null); 2330 // null key 2331 r = self->f->getSmallDouble(self, null); 2332 ck_assert_ptr_eq(r, null); 2333 // empty self 2334 freeO(self); 2335 r = self->f->getSmallDouble(self, "1"); 2336 ck_assert_ptr_eq(r, null); 2337 terminateO(self); 2338 2339 } 2340 2341 2342 void getSmallIntSmallDictT(void) { 2343 2344 smallIntt* r; 2345 smallDictt *self = allocG(rtSmallDictt); 2346 2347 createAllocateSmallInt(d); 2348 smallDictt *r2 = self->f->setNFreeSmallInt(self, "1", d); 2349 ck_assert_ptr_ne(r2, null); 2350 r = self->f->getSmallInt(self, "1"); 2351 ck_assert_ptr_ne(r, null); 2352 char *s = toStringO(r); 2353 finishO(r); 2354 ck_assert_str_eq(s, "0"); 2355 free(s); 2356 // non SmallInt object 2357 r2 = self->f->setBool(self, "1", true); 2358 ck_assert_ptr_ne(r2, null); 2359 r = self->f->getSmallInt(self, "1"); 2360 ck_assert_ptr_eq(r, null); 2361 // null key 2362 r = self->f->getSmallInt(self, null); 2363 ck_assert_ptr_eq(r, null); 2364 // empty self 2365 freeO(self); 2366 r = self->f->getSmallInt(self, "1"); 2367 ck_assert_ptr_eq(r, null); 2368 terminateO(self); 2369 2370 } 2371 2372 2373 void getSmallJsonSmallDictT(void) { 2374 2375 smallJsont* r; 2376 smallDictt *self = allocG(rtSmallDictt); 2377 2378 createAllocateSmallJson(d); 2379 smallDictt *r2 = self->f->setNFreeSmallJson(self, "1", d); 2380 ck_assert_ptr_ne(r2, null); 2381 r = self->f->getSmallJson(self, "1"); 2382 ck_assert_ptr_ne(r, null); 2383 char *s = toStringO(r); 2384 finishO(r); 2385 ck_assert_str_eq(s, "{}"); 2386 free(s); 2387 r2 = self->f->setBool(self, "1", true); 2388 ck_assert_ptr_ne(r2, null); 2389 r = self->f->getSmallJson(self, "1"); 2390 ck_assert_ptr_ne(r, null); 2391 s = toStringO(r); 2392 finishO(r); 2393 ck_assert_str_eq(s, "true"); 2394 free(s); 2395 // non SmallJson object 2396 smallContainert *c = allocSmallContainer(NULL); 2397 r2 = self->f->setNFreeSmallContainer(self, "1", c); 2398 ck_assert_ptr_ne(r2, null); 2399 r = self->f->getSmallJson(self, "1"); 2400 ck_assert_ptr_eq(r, null); 2401 // null key 2402 r = self->f->getSmallJson(self, null); 2403 ck_assert_ptr_eq(r, null); 2404 // empty self 2405 freeO(self); 2406 r = self->f->getSmallJson(self, "1"); 2407 ck_assert_ptr_eq(r, null); 2408 terminateO(self); 2409 2410 } 2411 2412 2413 void getSmallStringSmallDictT(void) { 2414 2415 smallStringt* r; 2416 smallDictt *self = allocG(rtSmallDictt); 2417 2418 createAllocateSmallString(d); 2419 smallDictt *r2 = self->f->setNFreeSmallString(self, "1", d); 2420 ck_assert_ptr_ne(r2, null); 2421 r = self->f->getSmallString(self, "1"); 2422 ck_assert_ptr_ne(r, null); 2423 char *s = toStringO(r); 2424 finishO(r); 2425 ck_assert_str_eq(s, ""); 2426 free(s); 2427 // non SmallString object 2428 r2 = self->f->setBool(self, "1", true); 2429 ck_assert_ptr_ne(r2, null); 2430 r = self->f->getSmallString(self, "1"); 2431 ck_assert_ptr_eq(r, null); 2432 // null key 2433 r = self->f->getSmallString(self, null); 2434 ck_assert_ptr_eq(r, null); 2435 // empty self 2436 freeO(self); 2437 r = self->f->getSmallString(self, "1"); 2438 ck_assert_ptr_eq(r, null); 2439 terminateO(self); 2440 2441 } 2442 2443 2444 void getVoidSmallDictT(void) { 2445 2446 void* r; 2447 smallDictt *self = allocG(rtSmallDictt); 2448 2449 smallContainert* d = allocSmallContainer(&r); 2450 smallDictt *r2 = self->f->setNFreeSmallContainer(self, "1", d); 2451 ck_assert_ptr_ne(r2, null); 2452 r = self->f->getVoid(self, "1"); 2453 ck_assert_ptr_eq(r, &r); 2454 // non container object 2455 r2 = self->f->setBool(self, "1", true); 2456 ck_assert_ptr_ne(r2, null); 2457 r = self->f->getVoid(self, "1"); 2458 ck_assert_ptr_eq(r, null); 2459 // null key 2460 r = self->f->getVoid(self, null); 2461 ck_assert_ptr_eq(r, null); 2462 // empty self 2463 freeO(self); 2464 r = self->f->getVoid(self, "1"); 2465 ck_assert_ptr_eq(r, null); 2466 terminateO(self); 2467 2468 } 2469 2470 2471 void getSmallContainerSmallDictT(void) { 2472 2473 smallContainert* r; 2474 smallDictt *self = allocG(rtSmallDictt); 2475 2476 createAllocateSmallContainer(d); 2477 smallDictt *r2 = self->f->setNFreeSmallContainer(self, "1", d); 2478 ck_assert_ptr_ne(r2, null); 2479 r = self->f->getSmallContainer(self, "1"); 2480 ck_assert_ptr_ne(r, null); 2481 char *s = toStringO(r); 2482 finishO(r); 2483 ck_assert_str_eq(s, "<data smallContainer>"); 2484 free(s); 2485 // other base class 2486 smallIntt *t = allocSmallInt(2); 2487 t->type = "randomClass"; 2488 r2 = self->f->setNFree(self, "1", (baset*)t); 2489 ck_assert_ptr_ne(r2, null); 2490 r = self->f->getSmallContainer(self, "1"); 2491 ck_assert_ptr_eq(r, null); 2492 // non SmallContainer object 2493 r2 = self->f->setBool(self, "1", true); 2494 ck_assert_ptr_ne(r2, null); 2495 r = self->f->getSmallContainer(self, "1"); 2496 ck_assert_ptr_eq(r, null); 2497 // null key 2498 r = self->f->getSmallContainer(self, null); 2499 ck_assert_ptr_eq(r, null); 2500 // empty self 2501 freeO(self); 2502 r = self->f->getSmallContainer(self, "1"); 2503 ck_assert_ptr_eq(r, null); 2504 terminateO(self); 2505 2506 } 2507 2508 2509 void getKCharSmallDictT(void) { 2510 2511 baset* r; 2512 smallDictt *self = allocG(rtSmallDictt); 2513 2514 smallIntt *c = allocSmallInt(2); 2515 smallDictt *r2 = self->f->setNFreeKChar(self, '1', (baset*) c); 2516 ck_assert_ptr_ne(r2, null); 2517 r = self->f->getKChar(self, '1'); 2518 ck_assert_ptr_ne(r, null); 2519 char *s = toStringO(r); 2520 finishO(r); 2521 ck_assert_str_eq(s, "2"); 2522 free(s); 2523 terminateO(self); 2524 2525 } 2526 2527 2528 void getUndefinedKCharSmallDictT(void) { 2529 2530 undefinedt* r; 2531 smallDictt *self = allocG(rtSmallDictt); 2532 2533 smallDictt *r2 = self->f->setUndefined(self, "1"); 2534 ck_assert_ptr_ne(r2, null); 2535 r = self->f->getUndefinedKChar(self, '1'); 2536 ck_assert_ptr_ne(r, null); 2537 terminateO(r); 2538 terminateO(self); 2539 2540 } 2541 2542 2543 void getBoolKCharSmallDictT(void) { 2544 2545 bool r; 2546 smallDictt *self = allocG(rtSmallDictt); 2547 2548 smallDictt *r2 = self->f->setBool(self, "1", true); 2549 ck_assert_ptr_ne(r2, null); 2550 r = self->f->getBoolKChar(self, '1'); 2551 ck_assert(r); 2552 terminateO(self); 2553 2554 } 2555 2556 2557 void getBoolPKCharSmallDictT(void) { 2558 2559 bool* r; 2560 smallDictt *self = allocG(rtSmallDictt); 2561 2562 smallDictt *r2 = self->f->setBool(self, "1", true); 2563 ck_assert_ptr_ne(r2, null); 2564 r = self->f->getBoolPKChar(self, '1'); 2565 ck_assert_ptr_ne(r, null); 2566 ck_assert(*r); 2567 terminateO(self); 2568 2569 } 2570 2571 2572 void getDoubleKCharSmallDictT(void) { 2573 2574 double r; 2575 smallDictt *self = allocG(rtSmallDictt); 2576 2577 smallDictt *r2 = self->f->setDouble(self, "1", 2.2); 2578 ck_assert_ptr_ne(r2, null); 2579 r = self->f->getDoubleKChar(self, '1'); 2580 ck_assert(r == 2.2); 2581 terminateO(self); 2582 2583 } 2584 2585 2586 void getDoublePKCharSmallDictT(void) { 2587 2588 double* r; 2589 smallDictt *self = allocG(rtSmallDictt); 2590 2591 smallDictt *r2 = self->f->setDouble(self, "1", 2.2); 2592 ck_assert_ptr_ne(r2, null); 2593 r = self->f->getDoublePKChar(self, '1'); 2594 ck_assert_ptr_ne(r, null); 2595 ck_assert(*r == 2.2); 2596 terminateO(self); 2597 2598 } 2599 2600 2601 void getIntKCharSmallDictT(void) { 2602 2603 int64_t r; 2604 smallDictt *self = allocG(rtSmallDictt); 2605 2606 smallDictt *r2 = self->f->setInt(self, "1", 2); 2607 ck_assert_ptr_ne(r2, null); 2608 r = self->f->getIntKChar(self, '1'); 2609 ck_assert_int_eq(r, 2); 2610 terminateO(self); 2611 2612 } 2613 2614 2615 void getIntPKCharSmallDictT(void) { 2616 2617 int64_t* r; 2618 smallDictt *self = allocG(rtSmallDictt); 2619 2620 smallDictt *r2 = self->f->setInt(self, "1", 2); 2621 ck_assert_ptr_ne(r2, null); 2622 r = self->f->getIntPKChar(self, '1'); 2623 ck_assert_ptr_ne(r, null); 2624 ck_assert_int_eq(*r, 2); 2625 terminateO(self); 2626 2627 } 2628 2629 2630 void getInt32KCharSmallDictT(void) { 2631 2632 int32_t r; 2633 smallDictt *self = allocG(rtSmallDictt); 2634 2635 smallDictt *r2 = self->f->setInt(self, "1", 2); 2636 ck_assert_ptr_ne(r2, null); 2637 r = self->f->getInt32KChar(self, '1'); 2638 ck_assert_int_eq(r, 2); 2639 terminateO(self); 2640 2641 } 2642 2643 2644 void getInt32PKCharSmallDictT(void) { 2645 2646 int32_t* r; 2647 smallDictt *self = allocG(rtSmallDictt); 2648 2649 smallDictt *r2 = self->f->setInt(self, "1", 2); 2650 ck_assert_ptr_ne(r2, null); 2651 r = self->f->getInt32PKChar(self, '1'); 2652 ck_assert_ptr_ne(r, null); 2653 ck_assert_int_eq(*r, 2); 2654 terminateO(self); 2655 2656 } 2657 2658 2659 void getUintKCharSmallDictT(void) { 2660 2661 uint64_t r; 2662 smallDictt *self = allocG(rtSmallDictt); 2663 2664 smallDictt *r2 = self->f->setInt(self, "1", 2); 2665 ck_assert_ptr_ne(r2, null); 2666 r = self->f->getUintKChar(self, '1'); 2667 ck_assert_int_eq(r, 2); 2668 terminateO(self); 2669 2670 } 2671 2672 2673 void getUintPKCharSmallDictT(void) { 2674 2675 uint64_t* r; 2676 smallDictt *self = allocG(rtSmallDictt); 2677 2678 smallDictt *r2 = self->f->setInt(self, "1", 2); 2679 ck_assert_ptr_ne(r2, null); 2680 r = self->f->getUintPKChar(self, '1'); 2681 ck_assert_ptr_ne(r, null); 2682 ck_assert_int_eq(*r, 2); 2683 terminateO(self); 2684 2685 } 2686 2687 2688 void getUint32KCharSmallDictT(void) { 2689 2690 uint32_t r; 2691 smallDictt *self = allocG(rtSmallDictt); 2692 2693 smallDictt *r2 = self->f->setInt(self, "1", 2); 2694 ck_assert_ptr_ne(r2, null); 2695 r = self->f->getUint32KChar(self, '1'); 2696 ck_assert_int_eq(r, 2); 2697 terminateO(self); 2698 2699 } 2700 2701 2702 void getUint32PKCharSmallDictT(void) { 2703 2704 uint32_t* r; 2705 smallDictt *self = allocG(rtSmallDictt); 2706 2707 smallDictt *r2 = self->f->setInt(self, "1", 2); 2708 ck_assert_ptr_ne(r2, null); 2709 r = self->f->getUint32PKChar(self, '1'); 2710 ck_assert_ptr_ne(r, null); 2711 ck_assert_int_eq(*r, 2); 2712 terminateO(self); 2713 2714 } 2715 2716 2717 void getSKCharSmallDictT(void) { 2718 2719 char* r; 2720 smallDictt *self = allocG(rtSmallDictt); 2721 2722 smallDictt *r2 = self->f->setS(self, "1", "qwe"); 2723 ck_assert_ptr_ne(r2, null); 2724 r = self->f->getSKChar(self, '1'); 2725 ck_assert_ptr_ne(r, null); 2726 ck_assert_str_eq(r, "qwe"); 2727 terminateO(self); 2728 2729 } 2730 2731 2732 void getDictKCharSmallDictT(void) { 2733 2734 smallDictt* r; 2735 smallDictt *self = allocG(rtSmallDictt); 2736 2737 createAllocateSmallDict(d); 2738 smallDictt *r2 = self->f->setNFreeDict(self, "1", d); 2739 ck_assert_ptr_ne(r2, null); 2740 r = self->f->getDictKChar(self, '1'); 2741 ck_assert_ptr_ne(r, null); 2742 char *s = toStringO(r); 2743 finishO(r); 2744 ck_assert_str_eq(s, "{}"); 2745 free(s); 2746 terminateO(self); 2747 2748 } 2749 2750 2751 void getArrayKCharSmallDictT(void) { 2752 2753 smallArrayt* r; 2754 smallDictt *self = allocG(rtSmallDictt); 2755 2756 createAllocateSmallArray(d); 2757 smallDictt *r2 = self->f->setNFreeArray(self, "1", d); 2758 ck_assert_ptr_ne(r2, null); 2759 r = self->f->getArrayKChar(self, '1'); 2760 ck_assert_ptr_ne(r, null); 2761 char *s = toStringO(r); 2762 finishO(r); 2763 ck_assert_str_eq(s, "[]"); 2764 free(s); 2765 terminateO(self); 2766 2767 } 2768 2769 2770 void getSmallBoolKCharSmallDictT(void) { 2771 2772 smallBoolt* r; 2773 smallDictt *self = allocG(rtSmallDictt); 2774 2775 createAllocateSmallBool(d); 2776 smallDictt *r2 = self->f->setNFreeSmallBool(self, "1", d); 2777 ck_assert_ptr_ne(r2, null); 2778 r = self->f->getSmallBoolKChar(self, '1'); 2779 ck_assert_ptr_ne(r, null); 2780 char *s = toStringO(r); 2781 finishO(r); 2782 ck_assert_str_eq(s, "false"); 2783 free(s); 2784 terminateO(self); 2785 2786 } 2787 2788 2789 void getSmallBytesKCharSmallDictT(void) { 2790 2791 smallBytest* r; 2792 smallDictt *self = allocG(rtSmallDictt); 2793 2794 createAllocateSmallBytes(d); 2795 smallDictt *r2 = self->f->setNFreeSmallBytes(self, "1", d); 2796 ck_assert_ptr_ne(r2, null); 2797 r = self->f->getSmallBytesKChar(self, '1'); 2798 ck_assert_ptr_ne(r, null); 2799 char *s = toStringO(r); 2800 finishO(r); 2801 ck_assert_str_eq(s, "[]"); 2802 free(s); 2803 terminateO(self); 2804 2805 } 2806 2807 2808 void getSmallDoubleKCharSmallDictT(void) { 2809 2810 smallDoublet* r; 2811 smallDictt *self = allocG(rtSmallDictt); 2812 2813 createAllocateSmallDouble(d); 2814 smallDictt *r2 = self->f->setNFreeSmallDouble(self, "1", d); 2815 ck_assert_ptr_ne(r2, null); 2816 r = self->f->getSmallDoubleKChar(self, '1'); 2817 ck_assert_ptr_ne(r, null); 2818 char *s = toStringO(r); 2819 finishO(r); 2820 ck_assert_str_eq(s, "0.000000e+00"); 2821 free(s); 2822 terminateO(self); 2823 2824 } 2825 2826 2827 void getSmallIntKCharSmallDictT(void) { 2828 2829 smallIntt* r; 2830 smallDictt *self = allocG(rtSmallDictt); 2831 2832 createAllocateSmallInt(d); 2833 smallDictt *r2 = self->f->setNFreeSmallInt(self, "1", d); 2834 ck_assert_ptr_ne(r2, null); 2835 r = self->f->getSmallIntKChar(self, '1'); 2836 ck_assert_ptr_ne(r, null); 2837 char *s = toStringO(r); 2838 finishO(r); 2839 ck_assert_str_eq(s, "0"); 2840 free(s); 2841 terminateO(self); 2842 2843 } 2844 2845 2846 void getSmallJsonKCharSmallDictT(void) { 2847 2848 smallJsont* r; 2849 smallDictt *self = allocG(rtSmallDictt); 2850 2851 createAllocateSmallJson(d); 2852 smallDictt *r2 = self->f->setNFreeSmallJson(self, "1", d); 2853 ck_assert_ptr_ne(r2, null); 2854 r = self->f->getSmallJsonKChar(self, '1'); 2855 ck_assert_ptr_ne(r, null); 2856 char *s = toStringO(r); 2857 finishO(r); 2858 ck_assert_str_eq(s, "{}"); 2859 free(s); 2860 terminateO(self); 2861 2862 } 2863 2864 2865 void getSmallStringKCharSmallDictT(void) { 2866 2867 smallStringt* r; 2868 smallDictt *self = allocG(rtSmallDictt); 2869 2870 createAllocateSmallString(d); 2871 smallDictt *r2 = self->f->setNFreeSmallString(self, "1", d); 2872 ck_assert_ptr_ne(r2, null); 2873 r = self->f->getSmallStringKChar(self, '1'); 2874 ck_assert_ptr_ne(r, null); 2875 char *s = toStringO(r); 2876 finishO(r); 2877 ck_assert_str_eq(s, ""); 2878 free(s); 2879 terminateO(self); 2880 2881 } 2882 2883 2884 void getVoidKCharSmallDictT(void) { 2885 2886 void* r; 2887 smallDictt *self = allocG(rtSmallDictt); 2888 2889 smallContainert* d = allocSmallContainer(&r); 2890 smallDictt *r2 = self->f->setNFreeSmallContainer(self, "1", d); 2891 ck_assert_ptr_ne(r2, null); 2892 r = self->f->getVoidKChar(self, '1'); 2893 ck_assert_ptr_eq(r, &r); 2894 terminateO(self); 2895 2896 } 2897 2898 2899 void getSmallContainerKCharSmallDictT(void) { 2900 2901 smallContainert* r; 2902 smallDictt *self = allocG(rtSmallDictt); 2903 2904 createAllocateSmallContainer(d); 2905 smallDictt *r2 = self->f->setNFreeSmallContainer(self, "1", d); 2906 ck_assert_ptr_ne(r2, null); 2907 r = self->f->getSmallContainerKChar(self, '1'); 2908 ck_assert_ptr_ne(r, null); 2909 char *s = toStringO(r); 2910 finishO(r); 2911 ck_assert_str_eq(s, "<data smallContainer>"); 2912 free(s); 2913 terminateO(self); 2914 2915 } 2916 2917 2918 void getNDupSmallDictT(void) { 2919 2920 baset* r; 2921 smallDictt *self = allocG(rtSmallDictt); 2922 2923 smallIntt *c = allocSmallInt(2); 2924 smallDictt *r2 = self->f->setNFreeKChar(self, '1', (baset*) c); 2925 ck_assert_ptr_ne(r2, null); 2926 r = self->f->getNDup(self, "1"); 2927 ck_assert_ptr_ne(r, null); 2928 char *s = toStringO(r); 2929 terminateO(r); 2930 ck_assert_str_eq(s, "2"); 2931 free(s); 2932 // other base class 2933 smallIntt *t = allocSmallInt(3); 2934 t->type = "randomClass"; 2935 r2 = self->f->setNFree(self, "1", (baset*)t); 2936 ck_assert_ptr_ne(r2, null); 2937 r = self->f->getNDup(self, "1"); 2938 ck_assert_ptr_ne(r, null); 2939 s = toStringO(r); 2940 terminateO(r); 2941 ck_assert_str_eq(s, "3"); 2942 free(s); 2943 // null key 2944 r = self->f->getNDup(self, null); 2945 ck_assert_ptr_eq(r, null); 2946 // empty self 2947 freeO(self); 2948 r = self->f->getNDup(self, "1"); 2949 ck_assert_ptr_eq(r, null); 2950 terminateO(self); 2951 2952 } 2953 2954 2955 void getNDupUndefinedSmallDictT(void) { 2956 2957 undefinedt* r; 2958 smallDictt *self = allocG(rtSmallDictt); 2959 2960 smallDictt *r2 = self->f->setUndefined(self, "1"); 2961 ck_assert_ptr_ne(r2, null); 2962 r = self->f->getNDupUndefined(self, "1"); 2963 ck_assert_ptr_ne(r, null); 2964 terminateO(r); 2965 // non undefined object 2966 r2 = self->f->setInt(self, "1", 2); 2967 ck_assert_ptr_ne(r2, null); 2968 r = self->f->getNDupUndefined(self, "1"); 2969 ck_assert_ptr_eq(r, null); 2970 // null key 2971 r = self->f->getNDupUndefined(self, null); 2972 ck_assert_ptr_eq(r, null); 2973 // empty self 2974 freeO(self); 2975 r = self->f->getNDupUndefined(self, "1"); 2976 ck_assert_ptr_eq(r, null); 2977 terminateO(self); 2978 2979 } 2980 2981 2982 void getNDupBoolSmallDictT(void) { 2983 2984 bool r; 2985 smallDictt *self = allocG(rtSmallDictt); 2986 2987 smallDictt *r2 = self->f->setBool(self, "1", true); 2988 ck_assert_ptr_ne(r2, null); 2989 r = self->f->getNDupBool(self, "1"); 2990 ck_assert(r); 2991 // non bool object 2992 r2 = self->f->setInt(self, "1", 2); 2993 ck_assert_ptr_ne(r2, null); 2994 r = self->f->getNDupBool(self, "1"); 2995 ck_assert(!r); 2996 // null key 2997 r = self->f->getNDupBool(self, null); 2998 ck_assert(!r); 2999 // empty self 3000 freeO(self); 3001 r = self->f->getNDupBool(self, "1"); 3002 ck_assert(!r); 3003 terminateO(self); 3004 3005 } 3006 3007 3008 void getNDupDoubleSmallDictT(void) { 3009 3010 double r; 3011 smallDictt *self = allocG(rtSmallDictt); 3012 3013 smallDictt *r2 = self->f->setDouble(self, "1", 2.2); 3014 ck_assert_ptr_ne(r2, null); 3015 r = self->f->getNDupDouble(self, "1"); 3016 ck_assert(r == 2.2); 3017 // non double object 3018 r2 = self->f->setInt(self, "1", 2); 3019 ck_assert_ptr_ne(r2, null); 3020 r = self->f->getNDupDouble(self, "1"); 3021 ck_assert(r == 0); 3022 // null key 3023 r = self->f->getNDupDouble(self, null); 3024 ck_assert(r == 0); 3025 // empty self 3026 freeO(self); 3027 r = self->f->getNDupDouble(self, "1"); 3028 ck_assert(!r); 3029 terminateO(self); 3030 3031 } 3032 3033 3034 void getNDupIntSmallDictT(void) { 3035 3036 int64_t r; 3037 smallDictt *self = allocG(rtSmallDictt); 3038 3039 smallDictt *r2 = self->f->setInt(self, "1", 2); 3040 ck_assert_ptr_ne(r2, null); 3041 r = self->f->getNDupInt(self, "1"); 3042 ck_assert_int_eq(r, 2); 3043 // non int object 3044 r2 = self->f->setBool(self, "1", true); 3045 ck_assert_ptr_ne(r2, null); 3046 r = self->f->getNDupInt(self, "1"); 3047 ck_assert(!r); 3048 // null key 3049 r = self->f->getNDupInt(self, null); 3050 ck_assert_int_eq(r, 0); 3051 // empty self 3052 freeO(self); 3053 r = self->f->getNDupInt(self, "1"); 3054 ck_assert(!r); 3055 terminateO(self); 3056 3057 } 3058 3059 3060 void getNDupInt32SmallDictT(void) { 3061 3062 int32_t r; 3063 smallDictt *self = allocG(rtSmallDictt); 3064 3065 smallDictt *r2 = self->f->setInt(self, "1", 2); 3066 ck_assert_ptr_ne(r2, null); 3067 r = self->f->getNDupInt32(self, "1"); 3068 ck_assert_int_eq(r, 2); 3069 // non int object 3070 r2 = self->f->setBool(self, "1", true); 3071 ck_assert_ptr_ne(r2, null); 3072 r = self->f->getNDupInt32(self, "1"); 3073 ck_assert(!r); 3074 // null key 3075 r = self->f->getNDupInt32(self, null); 3076 ck_assert_int_eq(r, 0); 3077 // empty self 3078 freeO(self); 3079 r = self->f->getNDupInt32(self, "1"); 3080 ck_assert(!r); 3081 terminateO(self); 3082 3083 } 3084 3085 3086 void getNDupUintSmallDictT(void) { 3087 3088 uint64_t r; 3089 smallDictt *self = allocG(rtSmallDictt); 3090 3091 smallDictt *r2 = self->f->setInt(self, "1", 2); 3092 ck_assert_ptr_ne(r2, null); 3093 r = self->f->getNDupUint(self, "1"); 3094 ck_assert_int_eq(r, 2); 3095 // non int object 3096 r2 = self->f->setBool(self, "1", true); 3097 ck_assert_ptr_ne(r2, null); 3098 r = self->f->getNDupUint(self, "1"); 3099 ck_assert(!r); 3100 // null key 3101 r = self->f->getNDupUint(self, null); 3102 ck_assert_int_eq(r, 0); 3103 // empty self 3104 freeO(self); 3105 r = self->f->getNDupUint(self, "1"); 3106 ck_assert(!r); 3107 terminateO(self); 3108 3109 } 3110 3111 3112 void getNDupUint32SmallDictT(void) { 3113 3114 uint32_t r; 3115 smallDictt *self = allocG(rtSmallDictt); 3116 3117 smallDictt *r2 = self->f->setInt(self, "1", 2); 3118 ck_assert_ptr_ne(r2, null); 3119 r = self->f->getNDupUint32(self, "1"); 3120 ck_assert_int_eq(r, 2); 3121 // non int object 3122 r2 = self->f->setBool(self, "1", true); 3123 ck_assert_ptr_ne(r2, null); 3124 r = self->f->getNDupUint32(self, "1"); 3125 ck_assert(!r); 3126 // null key 3127 r = self->f->getNDupUint32(self, null); 3128 ck_assert_int_eq(r, 0); 3129 // empty self 3130 freeO(self); 3131 r = self->f->getNDupUint32(self, "1"); 3132 ck_assert(!r); 3133 terminateO(self); 3134 3135 } 3136 3137 3138 void getNDupSSmallDictT(void) { 3139 3140 char* r; 3141 smallDictt *self = allocG(rtSmallDictt); 3142 3143 smallDictt *r2 = self->f->setS(self, "1", "qwe"); 3144 ck_assert_ptr_ne(r2, null); 3145 r = self->f->getNDupS(self, "1"); 3146 ck_assert_ptr_ne(r, null); 3147 ck_assert_str_eq(r, "qwe"); 3148 free(r); 3149 // non string object 3150 r2 = self->f->setBool(self, "1", true); 3151 ck_assert_ptr_ne(r2, null); 3152 r = self->f->getNDupS(self, "1"); 3153 ck_assert_ptr_eq(r, null); 3154 // null key 3155 r = self->f->getNDupS(self, null); 3156 ck_assert_ptr_eq(r, null); 3157 // empty self 3158 freeO(self); 3159 r = self->f->getNDupS(self, "1"); 3160 ck_assert_ptr_eq(r, null); 3161 terminateO(self); 3162 3163 } 3164 3165 3166 void getNDupDictSmallDictT(void) { 3167 3168 smallDictt* r; 3169 smallDictt *self = allocG(rtSmallDictt); 3170 3171 createAllocateSmallDict(d); 3172 smallDictt *r2 = self->f->setNFreeDict(self, "1", d); 3173 ck_assert_ptr_ne(r2, null); 3174 r = self->f->getNDupDict(self, "1"); 3175 ck_assert_ptr_ne(r, null); 3176 char *s = toStringO(r); 3177 terminateO(r); 3178 ck_assert_str_eq(s, "{}"); 3179 free(s); 3180 // non dict object 3181 r2 = self->f->setBool(self, "1", true); 3182 ck_assert_ptr_ne(r2, null); 3183 r = self->f->getNDupDict(self, "1"); 3184 ck_assert_ptr_eq(r, null); 3185 // null key 3186 r = self->f->getNDupDict(self, null); 3187 ck_assert_ptr_eq(r, null); 3188 // empty self 3189 freeO(self); 3190 r = self->f->getNDupDict(self, "1"); 3191 ck_assert_ptr_eq(r, null); 3192 terminateO(self); 3193 3194 } 3195 3196 3197 void getNDupArraySmallDictT(void) { 3198 3199 smallArrayt* r; 3200 smallDictt *self = allocG(rtSmallDictt); 3201 3202 createAllocateSmallArray(d); 3203 smallDictt *r2 = self->f->setNFreeArray(self, "1", d); 3204 ck_assert_ptr_ne(r2, null); 3205 r = self->f->getNDupArray(self, "1"); 3206 ck_assert_ptr_ne(r, null); 3207 char *s = toStringO(r); 3208 terminateO(r); 3209 ck_assert_str_eq(s, "[]"); 3210 free(s); 3211 // non Array object 3212 r2 = self->f->setBool(self, "1", true); 3213 ck_assert_ptr_ne(r2, null); 3214 r = self->f->getNDupArray(self, "1"); 3215 ck_assert_ptr_eq(r, null); 3216 // null key 3217 r = self->f->getNDupArray(self, null); 3218 ck_assert_ptr_eq(r, null); 3219 // empty self 3220 freeO(self); 3221 r = self->f->getNDupArray(self, "1"); 3222 ck_assert_ptr_eq(r, null); 3223 terminateO(self); 3224 3225 } 3226 3227 3228 void getNDupSmallBoolSmallDictT(void) { 3229 3230 smallBoolt* r; 3231 smallDictt *self = allocG(rtSmallDictt); 3232 3233 createAllocateSmallBool(d); 3234 smallDictt *r2 = self->f->setNFreeSmallBool(self, "1", d); 3235 ck_assert_ptr_ne(r2, null); 3236 r = self->f->getNDupSmallBool(self, "1"); 3237 ck_assert_ptr_ne(r, null); 3238 char *s = toStringO(r); 3239 terminateO(r); 3240 ck_assert_str_eq(s, "false"); 3241 free(s); 3242 // non SmallBool object 3243 r2 = self->f->setInt(self, "1", 0); 3244 ck_assert_ptr_ne(r2, null); 3245 r = self->f->getNDupSmallBool(self, "1"); 3246 ck_assert_ptr_eq(r, null); 3247 // null key 3248 r = self->f->getNDupSmallBool(self, null); 3249 ck_assert_ptr_eq(r, null); 3250 // empty self 3251 freeO(self); 3252 r = self->f->getNDupSmallBool(self, "1"); 3253 ck_assert_ptr_eq(r, null); 3254 terminateO(self); 3255 3256 } 3257 3258 3259 void getNDupSmallBytesSmallDictT(void) { 3260 3261 smallBytest* r; 3262 smallDictt *self = allocG(rtSmallDictt); 3263 3264 createAllocateSmallBytes(d); 3265 smallDictt *r2 = self->f->setNFreeSmallBytes(self, "1", d); 3266 ck_assert_ptr_ne(r2, null); 3267 r = self->f->getNDupSmallBytes(self, "1"); 3268 ck_assert_ptr_ne(r, null); 3269 char *s = toStringO(r); 3270 terminateO(r); 3271 ck_assert_str_eq(s, "[]"); 3272 free(s); 3273 // non SmallBytes object 3274 r2 = self->f->setBool(self, "1", true); 3275 ck_assert_ptr_ne(r2, null); 3276 r = self->f->getNDupSmallBytes(self, "1"); 3277 ck_assert_ptr_eq(r, null); 3278 // null key 3279 r = self->f->getNDupSmallBytes(self, null); 3280 ck_assert_ptr_eq(r, null); 3281 // empty self 3282 freeO(self); 3283 r = self->f->getNDupSmallBytes(self, "1"); 3284 ck_assert_ptr_eq(r, null); 3285 terminateO(self); 3286 3287 } 3288 3289 3290 void getNDupSmallDoubleSmallDictT(void) { 3291 3292 smallDoublet* r; 3293 smallDictt *self = allocG(rtSmallDictt); 3294 3295 createAllocateSmallDouble(d); 3296 smallDictt *r2 = self->f->setNFreeSmallDouble(self, "1", d); 3297 ck_assert_ptr_ne(r2, null); 3298 r = self->f->getNDupSmallDouble(self, "1"); 3299 ck_assert_ptr_ne(r, null); 3300 char *s = toStringO(r); 3301 terminateO(r); 3302 ck_assert_str_eq(s, "0.000000e+00"); 3303 free(s); 3304 // non SmallDouble object 3305 r2 = self->f->setBool(self, "1", true); 3306 ck_assert_ptr_ne(r2, null); 3307 r = self->f->getNDupSmallDouble(self, "1"); 3308 ck_assert_ptr_eq(r, null); 3309 // null key 3310 r = self->f->getNDupSmallDouble(self, null); 3311 ck_assert_ptr_eq(r, null); 3312 // empty self 3313 freeO(self); 3314 r = self->f->getNDupSmallDouble(self, "1"); 3315 ck_assert_ptr_eq(r, null); 3316 terminateO(self); 3317 3318 } 3319 3320 3321 void getNDupSmallIntSmallDictT(void) { 3322 3323 smallIntt* r; 3324 smallDictt *self = allocG(rtSmallDictt); 3325 3326 createAllocateSmallInt(d); 3327 smallDictt *r2 = self->f->setNFreeSmallInt(self, "1", d); 3328 ck_assert_ptr_ne(r2, null); 3329 r = self->f->getNDupSmallInt(self, "1"); 3330 ck_assert_ptr_ne(r, null); 3331 char *s = toStringO(r); 3332 terminateO(r); 3333 ck_assert_str_eq(s, "0"); 3334 free(s); 3335 // non SmallInt object 3336 r2 = self->f->setBool(self, "1", true); 3337 ck_assert_ptr_ne(r2, null); 3338 r = self->f->getNDupSmallInt(self, "1"); 3339 ck_assert_ptr_eq(r, null); 3340 // null key 3341 r = self->f->getNDupSmallInt(self, null); 3342 ck_assert_ptr_eq(r, null); 3343 // empty self 3344 freeO(self); 3345 r = self->f->getNDupSmallInt(self, "1"); 3346 ck_assert_ptr_eq(r, null); 3347 terminateO(self); 3348 3349 } 3350 3351 3352 void getNDupSmallJsonSmallDictT(void) { 3353 3354 smallJsont* r; 3355 smallDictt *self = allocG(rtSmallDictt); 3356 3357 createAllocateSmallJson(d); 3358 smallDictt *r2 = self->f->setNFreeSmallJson(self, "1", d); 3359 ck_assert_ptr_ne(r2, null); 3360 r = self->f->getNDupSmallJson(self, "1"); 3361 ck_assert_ptr_ne(r, null); 3362 char *s = toStringO(r); 3363 terminateO(r); 3364 ck_assert_str_eq(s, "{}"); 3365 free(s); 3366 r2 = self->f->setBool(self, "1", true); 3367 ck_assert_ptr_ne(r2, null); 3368 r = self->f->getNDupSmallJson(self, "1"); 3369 ck_assert_ptr_ne(r, null); 3370 s = toStringO(r); 3371 terminateO(r); 3372 ck_assert_str_eq(s, "true"); 3373 free(s); 3374 // non SmallJson object 3375 smallContainert *c = allocSmallContainer(NULL); 3376 r2 = self->f->setNFreeSmallContainer(self, "1", c); 3377 ck_assert_ptr_ne(r2, null); 3378 r = self->f->getNDupSmallJson(self, "1"); 3379 ck_assert_ptr_eq(r, null); 3380 // null key 3381 r = self->f->getNDupSmallJson(self, null); 3382 ck_assert_ptr_eq(r, null); 3383 // empty self 3384 freeO(self); 3385 r = self->f->getNDupSmallJson(self, "1"); 3386 ck_assert_ptr_eq(r, null); 3387 terminateO(self); 3388 3389 } 3390 3391 3392 void getNDupSmallStringSmallDictT(void) { 3393 3394 smallStringt* r; 3395 smallDictt *self = allocG(rtSmallDictt); 3396 3397 createAllocateSmallString(d); 3398 smallDictt *r2 = self->f->setNFreeSmallString(self, "1", d); 3399 ck_assert_ptr_ne(r2, null); 3400 r = self->f->getNDupSmallString(self, "1"); 3401 ck_assert_ptr_ne(r, null); 3402 char *s = toStringO(r); 3403 terminateO(r); 3404 ck_assert_str_eq(s, ""); 3405 free(s); 3406 // non SmallString object 3407 r2 = self->f->setBool(self, "1", true); 3408 ck_assert_ptr_ne(r2, null); 3409 r = self->f->getNDupSmallString(self, "1"); 3410 ck_assert_ptr_eq(r, null); 3411 // null key 3412 r = self->f->getNDupSmallString(self, null); 3413 ck_assert_ptr_eq(r, null); 3414 // empty self 3415 freeO(self); 3416 r = self->f->getNDupSmallString(self, "1"); 3417 ck_assert_ptr_eq(r, null); 3418 terminateO(self); 3419 3420 } 3421 3422 3423 void getNDupVoidSmallDictT(void) { 3424 3425 void* r; 3426 smallDictt *self = allocG(rtSmallDictt); 3427 3428 smallContainert* d = allocSmallContainer(&r); 3429 smallDictt *r2 = self->f->setNFreeSmallContainer(self, "1", d); 3430 ck_assert_ptr_ne(r2, null); 3431 r = self->f->getNDupVoid(self, "1"); 3432 // result is null because the duplicate function in the container 3433 // is not set. 3434 ck_assert_ptr_eq(r, null); 3435 // non container object 3436 r2 = self->f->setBool(self, "1", true); 3437 ck_assert_ptr_ne(r2, null); 3438 r = self->f->getNDupVoid(self, "1"); 3439 ck_assert_ptr_eq(r, null); 3440 // null key 3441 r = self->f->getNDupVoid(self, null); 3442 ck_assert_ptr_eq(r, null); 3443 // empty self 3444 freeO(self); 3445 r = self->f->getNDupVoid(self, "1"); 3446 ck_assert_ptr_eq(r, null); 3447 terminateO(self); 3448 3449 } 3450 3451 3452 void getNDupSmallContainerSmallDictT(void) { 3453 3454 smallContainert* r; 3455 smallDictt *self = allocG(rtSmallDictt); 3456 3457 createAllocateSmallContainer(d); 3458 smallDictt *r2 = self->f->setNFreeSmallContainer(self, "1", d); 3459 ck_assert_ptr_ne(r2, null); 3460 r = self->f->getNDupSmallContainer(self, "1"); 3461 ck_assert_ptr_ne(r, null); 3462 char *s = toStringO(r); 3463 terminateO(r); 3464 ck_assert_str_eq(s, "<data smallContainer>"); 3465 free(s); 3466 // other base class 3467 smallIntt *t = allocSmallInt(2); 3468 t->type = "randomClass"; 3469 r2 = self->f->setNFree(self, "1", (baset*)t); 3470 ck_assert_ptr_ne(r2, null); 3471 r = self->f->getNDupSmallContainer(self, "1"); 3472 ck_assert_ptr_eq(r, null); 3473 // non SmallContainer object 3474 r2 = self->f->setBool(self, "1", true); 3475 ck_assert_ptr_ne(r2, null); 3476 r = self->f->getNDupSmallContainer(self, "1"); 3477 ck_assert_ptr_eq(r, null); 3478 // null key 3479 r = self->f->getNDupSmallContainer(self, null); 3480 ck_assert_ptr_eq(r, null); 3481 // empty self 3482 freeO(self); 3483 r = self->f->getNDupSmallContainer(self, "1"); 3484 ck_assert_ptr_eq(r, null); 3485 terminateO(self); 3486 3487 } 3488 3489 3490 void getNDupKCharSmallDictT(void) { 3491 3492 baset* r; 3493 smallDictt *self = allocG(rtSmallDictt); 3494 3495 smallIntt *c = allocSmallInt(2); 3496 smallDictt *r2 = self->f->setNFreeKChar(self, '1', (baset*) c); 3497 ck_assert_ptr_ne(r2, null); 3498 r = self->f->getNDupKChar(self, '1'); 3499 ck_assert_ptr_ne(r, null); 3500 char *s = toStringO(r); 3501 terminateO(r); 3502 ck_assert_str_eq(s, "2"); 3503 free(s); 3504 terminateO(self); 3505 3506 } 3507 3508 3509 void getNDupUndefinedKCharSmallDictT(void) { 3510 3511 undefinedt* r; 3512 smallDictt *self = allocG(rtSmallDictt); 3513 3514 smallDictt *r2 = self->f->setUndefined(self, "1"); 3515 ck_assert_ptr_ne(r2, null); 3516 r = self->f->getNDupUndefinedKChar(self, '1'); 3517 ck_assert_ptr_ne(r, null); 3518 terminateO(r); 3519 terminateO(self); 3520 3521 } 3522 3523 3524 void getNDupBoolKCharSmallDictT(void) { 3525 3526 bool r; 3527 smallDictt *self = allocG(rtSmallDictt); 3528 3529 smallDictt *r2 = self->f->setBool(self, "1", true); 3530 ck_assert_ptr_ne(r2, null); 3531 r = self->f->getNDupBoolKChar(self, '1'); 3532 ck_assert(r); 3533 terminateO(self); 3534 3535 } 3536 3537 3538 void getNDupDoubleKCharSmallDictT(void) { 3539 3540 double r; 3541 smallDictt *self = allocG(rtSmallDictt); 3542 3543 smallDictt *r2 = self->f->setDouble(self, "1", 2.2); 3544 ck_assert_ptr_ne(r2, null); 3545 r = self->f->getNDupDoubleKChar(self, '1'); 3546 ck_assert(r == 2.2); 3547 terminateO(self); 3548 3549 } 3550 3551 3552 void getNDupIntKCharSmallDictT(void) { 3553 3554 int64_t r; 3555 smallDictt *self = allocG(rtSmallDictt); 3556 3557 smallDictt *r2 = self->f->setInt(self, "1", 2); 3558 ck_assert_ptr_ne(r2, null); 3559 r = self->f->getNDupIntKChar(self, '1'); 3560 ck_assert_int_eq(r, 2); 3561 terminateO(self); 3562 3563 } 3564 3565 3566 void getNDupInt32KCharSmallDictT(void) { 3567 3568 int32_t r; 3569 smallDictt *self = allocG(rtSmallDictt); 3570 3571 smallDictt *r2 = self->f->setInt(self, "1", 2); 3572 ck_assert_ptr_ne(r2, null); 3573 r = self->f->getNDupInt32KChar(self, '1'); 3574 ck_assert_int_eq(r, 2); 3575 terminateO(self); 3576 3577 } 3578 3579 3580 void getNDupUintKCharSmallDictT(void) { 3581 3582 uint64_t r; 3583 smallDictt *self = allocG(rtSmallDictt); 3584 3585 smallDictt *r2 = self->f->setInt(self, "1", 2); 3586 ck_assert_ptr_ne(r2, null); 3587 r = self->f->getNDupUintKChar(self, '1'); 3588 ck_assert_int_eq(r, 2); 3589 terminateO(self); 3590 3591 } 3592 3593 3594 void getNDupUint32KCharSmallDictT(void) { 3595 3596 uint32_t r; 3597 smallDictt *self = allocG(rtSmallDictt); 3598 3599 smallDictt *r2 = self->f->setInt(self, "1", 2); 3600 ck_assert_ptr_ne(r2, null); 3601 r = self->f->getNDupUint32KChar(self, '1'); 3602 ck_assert_int_eq(r, 2); 3603 terminateO(self); 3604 3605 } 3606 3607 3608 void getNDupSKCharSmallDictT(void) { 3609 3610 char* r; 3611 smallDictt *self = allocG(rtSmallDictt); 3612 3613 smallDictt *r2 = self->f->setS(self, "1", "qwe"); 3614 ck_assert_ptr_ne(r2, null); 3615 r = self->f->getNDupSKChar(self, '1'); 3616 ck_assert_ptr_ne(r, null); 3617 ck_assert_str_eq(r, "qwe"); 3618 free(r); 3619 terminateO(self); 3620 3621 } 3622 3623 3624 void getNDupDictKCharSmallDictT(void) { 3625 3626 smallDictt* r; 3627 smallDictt *self = allocG(rtSmallDictt); 3628 3629 createAllocateSmallDict(d); 3630 smallDictt *r2 = self->f->setNFreeDict(self, "1", d); 3631 ck_assert_ptr_ne(r2, null); 3632 r = self->f->getNDupDictKChar(self, '1'); 3633 ck_assert_ptr_ne(r, null); 3634 char *s = toStringO(r); 3635 terminateO(r); 3636 ck_assert_str_eq(s, "{}"); 3637 free(s); 3638 terminateO(self); 3639 3640 } 3641 3642 3643 void getNDupArrayKCharSmallDictT(void) { 3644 3645 smallArrayt* r; 3646 smallDictt *self = allocG(rtSmallDictt); 3647 3648 createAllocateSmallArray(d); 3649 smallDictt *r2 = self->f->setNFreeArray(self, "1", d); 3650 ck_assert_ptr_ne(r2, null); 3651 r = self->f->getNDupArrayKChar(self, '1'); 3652 ck_assert_ptr_ne(r, null); 3653 char *s = toStringO(r); 3654 terminateO(r); 3655 ck_assert_str_eq(s, "[]"); 3656 free(s); 3657 terminateO(self); 3658 3659 } 3660 3661 3662 void getNDupSmallBoolKCharSmallDictT(void) { 3663 3664 smallBoolt* r; 3665 smallDictt *self = allocG(rtSmallDictt); 3666 3667 createAllocateSmallBool(d); 3668 smallDictt *r2 = self->f->setNFreeSmallBool(self, "1", d); 3669 ck_assert_ptr_ne(r2, null); 3670 r = self->f->getNDupSmallBoolKChar(self, '1'); 3671 ck_assert_ptr_ne(r, null); 3672 char *s = toStringO(r); 3673 terminateO(r); 3674 ck_assert_str_eq(s, "false"); 3675 free(s); 3676 terminateO(self); 3677 3678 } 3679 3680 3681 void getNDupSmallBytesKCharSmallDictT(void) { 3682 3683 smallBytest* r; 3684 smallDictt *self = allocG(rtSmallDictt); 3685 3686 createAllocateSmallBytes(d); 3687 smallDictt *r2 = self->f->setNFreeSmallBytes(self, "1", d); 3688 ck_assert_ptr_ne(r2, null); 3689 r = self->f->getNDupSmallBytesKChar(self, '1'); 3690 ck_assert_ptr_ne(r, null); 3691 char *s = toStringO(r); 3692 terminateO(r); 3693 ck_assert_str_eq(s, "[]"); 3694 free(s); 3695 terminateO(self); 3696 3697 } 3698 3699 3700 void getNDupSmallDoubleKCharSmallDictT(void) { 3701 3702 smallDoublet* r; 3703 smallDictt *self = allocG(rtSmallDictt); 3704 3705 createAllocateSmallDouble(d); 3706 smallDictt *r2 = self->f->setNFreeSmallDouble(self, "1", d); 3707 ck_assert_ptr_ne(r2, null); 3708 r = self->f->getNDupSmallDoubleKChar(self, '1'); 3709 ck_assert_ptr_ne(r, null); 3710 char *s = toStringO(r); 3711 terminateO(r); 3712 ck_assert_str_eq(s, "0.000000e+00"); 3713 free(s); 3714 terminateO(self); 3715 3716 } 3717 3718 3719 void getNDupSmallIntKCharSmallDictT(void) { 3720 3721 smallIntt* r; 3722 smallDictt *self = allocG(rtSmallDictt); 3723 3724 createAllocateSmallInt(d); 3725 smallDictt *r2 = self->f->setNFreeSmallInt(self, "1", d); 3726 ck_assert_ptr_ne(r2, null); 3727 r = self->f->getNDupSmallIntKChar(self, '1'); 3728 ck_assert_ptr_ne(r, null); 3729 char *s = toStringO(r); 3730 terminateO(r); 3731 ck_assert_str_eq(s, "0"); 3732 free(s); 3733 terminateO(self); 3734 3735 } 3736 3737 3738 void getNDupSmallJsonKCharSmallDictT(void) { 3739 3740 smallJsont* r; 3741 smallDictt *self = allocG(rtSmallDictt); 3742 3743 createAllocateSmallJson(d); 3744 smallDictt *r2 = self->f->setNFreeSmallJson(self, "1", d); 3745 ck_assert_ptr_ne(r2, null); 3746 r = self->f->getNDupSmallJsonKChar(self, '1'); 3747 ck_assert_ptr_ne(r, null); 3748 char *s = toStringO(r); 3749 terminateO(r); 3750 ck_assert_str_eq(s, "{}"); 3751 free(s); 3752 terminateO(self); 3753 3754 } 3755 3756 3757 void getNDupSmallStringKCharSmallDictT(void) { 3758 3759 smallStringt* r; 3760 smallDictt *self = allocG(rtSmallDictt); 3761 3762 createAllocateSmallString(d); 3763 smallDictt *r2 = self->f->setNFreeSmallString(self, "1", d); 3764 ck_assert_ptr_ne(r2, null); 3765 r = self->f->getNDupSmallStringKChar(self, '1'); 3766 ck_assert_ptr_ne(r, null); 3767 char *s = toStringO(r); 3768 terminateO(r); 3769 ck_assert_str_eq(s, ""); 3770 free(s); 3771 terminateO(self); 3772 3773 } 3774 3775 3776 void getNDupVoidKCharSmallDictT(void) { 3777 3778 void* r; 3779 smallDictt *self = allocG(rtSmallDictt); 3780 3781 smallContainert* d = allocSmallContainer(&r); 3782 smallDictt *r2 = self->f->setNFreeSmallContainer(self, "1", d); 3783 ck_assert_ptr_ne(r2, null); 3784 r = self->f->getNDupVoidKChar(self, '1'); 3785 // result is null because the duplicate function in the container 3786 // is not set. 3787 ck_assert_ptr_eq(r, null); 3788 terminateO(self); 3789 3790 } 3791 3792 3793 void getNDupSmallContainerKCharSmallDictT(void) { 3794 3795 smallContainert* r; 3796 smallDictt *self = allocG(rtSmallDictt); 3797 3798 createAllocateSmallContainer(d); 3799 smallDictt *r2 = self->f->setNFreeSmallContainer(self, "1", d); 3800 ck_assert_ptr_ne(r2, null); 3801 r = self->f->getNDupSmallContainerKChar(self, '1'); 3802 ck_assert_ptr_ne(r, null); 3803 char *s = toStringO(r); 3804 terminateO(r); 3805 ck_assert_str_eq(s, "<data smallContainer>"); 3806 free(s); 3807 terminateO(self); 3808 3809 } 3810 3811 3812 void getNumSmallDictT(void) { 3813 3814 double r; 3815 smallDictt *self = allocG(rtSmallDictt); 3816 smallDictt *r2; 3817 3818 r2 = self->f->setInt(self, "1", 1); 3819 ck_assert_ptr_ne(r2, null); 3820 r2 = self->f->setDouble(self, "2", 2.2); 3821 ck_assert_ptr_ne(r2, null); 3822 r2 = self->f->setS(self, "3", "2"); 3823 ck_assert_ptr_ne(r2, null); 3824 r = getNumO(self, "1"); 3825 ck_assert(r == 1); 3826 r = getNumO(self, "2"); 3827 ck_assert(r == 2.2); 3828 // not a number 3829 r = getNumO(self, "3"); 3830 ck_assert(r == 0); 3831 // null key 3832 r = getNumO(self, null); 3833 ck_assert(r == 0); 3834 // empty self 3835 freeO(self); 3836 r = getNumO(self, "1"); 3837 ck_assert(r == 0); 3838 terminateO(self); 3839 3840 } 3841 3842 3843 void cropElemSmallDictT(void) { 3844 3845 baset* r; 3846 smallDictt *self = allocG(rtSmallDictt); 3847 smallDictt *r2; 3848 3849 r2 = self->f->setInt(self, "1", 1); 3850 ck_assert_ptr_ne(r2, null); 3851 r2 = self->f->setDouble(self, "2", 2.2); 3852 ck_assert_ptr_ne(r2, null); 3853 r2 = self->f->setS(self, "3", "2"); 3854 ck_assert_ptr_ne(r2, null); 3855 r2 = self->f->setUndefined(self, "u"); 3856 ck_assert_ptr_ne(r2, null); 3857 createSmallContainer(c); 3858 r2 = self->f->setSmallContainer(self, "c", &c); 3859 ck_assert_ptr_ne(r2, null); 3860 createAllocateSmallInt(I); 3861 setValG(I, 11); 3862 I->type = "anothertype"; 3863 r2 = self->f->set(self, "b", (baset*)I); 3864 ck_assert_ptr_ne(r2, null); 3865 // get int 3866 r = cropElemO(self, "3"); 3867 ck_assert_ptr_ne(r, null); 3868 char *s = toStringO(r); 3869 terminateO(r); 3870 ck_assert_str_eq(s, "2"); 3871 free(s); 3872 s = toStringO(self); 3873 ck_assert_str_eq(s, "{\"1\":1,\"2\":2.200000e+00,\"u\":null,\"c\":\"<data container>\",\"b\":\"<data container>\"}"); 3874 free(s); 3875 // undefined object 3876 r = cropElemO(self, "u"); 3877 ck_assert_ptr_ne(r, null); 3878 s = toStringO(r); 3879 terminateO(r); 3880 ck_assert_str_eq(s, "null"); 3881 free(s); 3882 s = toStringO(self); 3883 ck_assert_str_eq(s, "{\"1\":1,\"2\":2.200000e+00,\"c\":\"<data container>\",\"b\":\"<data container>\"}"); 3884 free(s); 3885 // container 3886 r = cropElemO(self, "c"); 3887 ck_assert_ptr_ne(r, null); 3888 s = toStringO(r); 3889 terminateO(r); 3890 ck_assert_str_eq(s, "<data smallContainer>"); 3891 free(s); 3892 s = toStringO(self); 3893 ck_assert_str_eq(s, "{\"1\":1,\"2\":2.200000e+00,\"b\":\"<data container>\"}"); 3894 free(s); 3895 // base object in container 3896 r = cropElemO(self, "b"); 3897 ck_assert_ptr_ne(r, null); 3898 s = toStringO(r); 3899 terminateO(r); 3900 ck_assert_str_eq(s, "11"); 3901 free(s); 3902 s = toStringO(self); 3903 ck_assert_str_eq(s, "{\"1\":1,\"2\":2.200000e+00}"); 3904 free(s); 3905 // non existing key 3906 r = cropElemO(self, "qwe"); 3907 ck_assert_ptr_eq(r, null); 3908 // null key 3909 r = cropElemO(self, null); 3910 ck_assert_ptr_eq(r, null); 3911 // empty self 3912 freeO(self); 3913 r = cropElemO(self, "1"); 3914 ck_assert_ptr_eq(r, null); 3915 terminateO(self); 3916 3917 } 3918 3919 3920 void cropElemUndefinedSmallDictT(void) { 3921 3922 undefinedt* r; 3923 smallDictt *self = allocG(rtSmallDictt); 3924 smallDictt *r2; 3925 3926 r2 = self->f->setInt(self, "1", 1); 3927 ck_assert_ptr_ne(r2, null); 3928 r2 = self->f->setDouble(self, "2", 2.2); 3929 ck_assert_ptr_ne(r2, null); 3930 r2 = self->f->setUndefined(self, "u"); 3931 ck_assert_ptr_ne(r2, null); 3932 r = cropElemUndefinedO(self, "u"); 3933 ck_assert_ptr_ne(r, null); 3934 char *s = toStringO(r); 3935 terminateO(r); 3936 ck_assert_str_eq(s, "null"); 3937 free(s); 3938 s = toStringO(self); 3939 ck_assert_str_eq(s, "{\"1\":1,\"2\":2.200000e+00}"); 3940 free(s); 3941 // wrong object type 3942 r = cropElemUndefinedO(self, "1"); 3943 ck_assert_ptr_eq(r, null); 3944 s = toStringO(self); 3945 ck_assert_str_eq(s, "{\"1\":1,\"2\":2.200000e+00}"); 3946 free(s); 3947 // non existing key 3948 r = cropElemUndefinedO(self, "qwe"); 3949 ck_assert_ptr_eq(r, null); 3950 // null key 3951 r = cropElemUndefinedO(self, null); 3952 ck_assert_ptr_eq(r, null); 3953 // empty self 3954 freeO(self); 3955 r = cropElemUndefinedO(self, "1"); 3956 ck_assert_ptr_eq(r, null); 3957 terminateO(self); 3958 3959 } 3960 3961 3962 void cropElemBoolSmallDictT(void) { 3963 3964 bool r; 3965 smallDictt *self = allocG(rtSmallDictt); 3966 smallDictt *r2; 3967 3968 r2 = self->f->setInt(self, "1", 1); 3969 ck_assert_ptr_ne(r2, null); 3970 r2 = self->f->setDouble(self, "2", 2.2); 3971 ck_assert_ptr_ne(r2, null); 3972 r2 = self->f->setBool(self, "b", true); 3973 ck_assert_ptr_ne(r2, null); 3974 createAllocateSmallInt(I); 3975 setValG(I, 11); 3976 I->type = "anothertype"; 3977 r2 = self->f->set(self, "B", (baset*)I); 3978 ck_assert_ptr_ne(r2, null); 3979 r = cropElemBoolO(self, "b"); 3980 ck_assert(r); 3981 char *s = toStringO(self); 3982 ck_assert_str_eq(s, "{\"1\":1,\"2\":2.200000e+00,\"B\":\"<data container>\"}"); 3983 free(s); 3984 // wrong object type 3985 r = cropElemBoolO(self, "1"); 3986 ck_assert(!r); 3987 s = toStringO(self); 3988 ck_assert_str_eq(s, "{\"1\":1,\"2\":2.200000e+00,\"B\":\"<data container>\"}"); 3989 free(s); 3990 r = cropElemBoolO(self, "B"); 3991 ck_assert(!r); 3992 s = toStringO(self); 3993 ck_assert_str_eq(s, "{\"1\":1,\"2\":2.200000e+00,\"B\":\"<data container>\"}"); 3994 free(s); 3995 // non existing key 3996 r = cropElemBoolO(self, "qwe"); 3997 ck_assert(!r); 3998 // null key 3999 r = cropElemBoolO(self, null); 4000 ck_assert(!r); 4001 // empty self 4002 freeO(self); 4003 r = cropElemBoolO(self, "1"); 4004 ck_assert(!r); 4005 terminateO(self); 4006 4007 } 4008 4009 4010 void cropElemDoubleSmallDictT(void) { 4011 4012 double r; 4013 smallDictt *self = allocG(rtSmallDictt); 4014 smallDictt *r2; 4015 4016 r2 = self->f->setInt(self, "1", 1); 4017 ck_assert_ptr_ne(r2, null); 4018 r2 = self->f->setDouble(self, "2", 2.2); 4019 ck_assert_ptr_ne(r2, null); 4020 r2 = self->f->setDouble(self, "b", 3.3); 4021 ck_assert_ptr_ne(r2, null); 4022 createAllocateSmallInt(I); 4023 setValG(I, 11); 4024 I->type = "anothertype"; 4025 r2 = self->f->set(self, "B", (baset*)I); 4026 ck_assert_ptr_ne(r2, null); 4027 r = cropElemDoubleO(self, "b"); 4028 ck_assert(r == 3.3); 4029 char *s = toStringO(self); 4030 ck_assert_str_eq(s, "{\"1\":1,\"2\":2.200000e+00,\"B\":\"<data container>\"}"); 4031 free(s); 4032 // wrong object type 4033 r = cropElemDoubleO(self, "1"); 4034 ck_assert(!r); 4035 s = toStringO(self); 4036 ck_assert_str_eq(s, "{\"1\":1,\"2\":2.200000e+00,\"B\":\"<data container>\"}"); 4037 free(s); 4038 r = cropElemDoubleO(self, "B"); 4039 ck_assert(!r); 4040 s = toStringO(self); 4041 ck_assert_str_eq(s, "{\"1\":1,\"2\":2.200000e+00,\"B\":\"<data container>\"}"); 4042 free(s); 4043 // non existing key 4044 r = cropElemDoubleO(self, "qwe"); 4045 ck_assert(!r); 4046 // null key 4047 r = cropElemDoubleO(self, null); 4048 ck_assert(r == 0); 4049 // empty self 4050 freeO(self); 4051 r = cropElemDoubleO(self, "1"); 4052 ck_assert(r == 0); 4053 terminateO(self); 4054 4055 } 4056 4057 4058 void cropElemIntSmallDictT(void) { 4059 4060 int64_t r; 4061 smallDictt *self = allocG(rtSmallDictt); 4062 smallDictt *r2; 4063 4064 r2 = self->f->setInt(self, "1", 1); 4065 ck_assert_ptr_ne(r2, null); 4066 r2 = self->f->setDouble(self, "2", 2.2); 4067 ck_assert_ptr_ne(r2, null); 4068 r2 = self->f->setInt(self, "b", 2); 4069 ck_assert_ptr_ne(r2, null); 4070 createAllocateSmallInt(I); 4071 setValG(I, 11); 4072 I->type = "anothertype"; 4073 r2 = self->f->set(self, "B", (baset*)I); 4074 ck_assert_ptr_ne(r2, null); 4075 r = cropElemIntO(self, "b"); 4076 ck_assert_int_eq(r, 2); 4077 char *s = toStringO(self); 4078 ck_assert_str_eq(s, "{\"1\":1,\"2\":2.200000e+00,\"B\":\"<data container>\"}"); 4079 free(s); 4080 // wrong object type 4081 r = cropElemIntO(self, "2"); 4082 ck_assert(!r); 4083 s = toStringO(self); 4084 ck_assert_str_eq(s, "{\"1\":1,\"2\":2.200000e+00,\"B\":\"<data container>\"}"); 4085 free(s); 4086 r = cropElemIntO(self, "B"); 4087 ck_assert(!r); 4088 s = toStringO(self); 4089 ck_assert_str_eq(s, "{\"1\":1,\"2\":2.200000e+00,\"B\":\"<data container>\"}"); 4090 free(s); 4091 // non existing key 4092 r = cropElemIntO(self, "qwe"); 4093 ck_assert(!r); 4094 //r = cropElemIntO(self); 4095 // null key 4096 r = cropElemIntO(self, null); 4097 ck_assert_int_eq(r, 0); 4098 // empty self 4099 freeO(self); 4100 r = cropElemIntO(self, "1"); 4101 ck_assert_int_eq(r, 0); 4102 terminateO(self); 4103 4104 } 4105 4106 4107 void cropElemInt32SmallDictT(void) { 4108 4109 int32_t r; 4110 smallDictt *self = allocG(rtSmallDictt); 4111 smallDictt *r2; 4112 4113 r2 = self->f->setInt(self, "1", 1); 4114 ck_assert_ptr_ne(r2, null); 4115 r2 = self->f->setDouble(self, "2", 2.2); 4116 ck_assert_ptr_ne(r2, null); 4117 r2 = self->f->setInt(self, "b", 2); 4118 ck_assert_ptr_ne(r2, null); 4119 createAllocateSmallInt(I); 4120 setValG(I, 11); 4121 I->type = "anothertype"; 4122 r2 = self->f->set(self, "B", (baset*)I); 4123 ck_assert_ptr_ne(r2, null); 4124 r = cropElemInt32O(self, "b"); 4125 ck_assert_int_eq(r, 2); 4126 char *s = toStringO(self); 4127 ck_assert_str_eq(s, "{\"1\":1,\"2\":2.200000e+00,\"B\":\"<data container>\"}"); 4128 free(s); 4129 // wrong object type 4130 r = cropElemInt32O(self, "2"); 4131 ck_assert(!r); 4132 s = toStringO(self); 4133 ck_assert_str_eq(s, "{\"1\":1,\"2\":2.200000e+00,\"B\":\"<data container>\"}"); 4134 free(s); 4135 r = cropElemInt32O(self, "B"); 4136 ck_assert(!r); 4137 s = toStringO(self); 4138 ck_assert_str_eq(s, "{\"1\":1,\"2\":2.200000e+00,\"B\":\"<data container>\"}"); 4139 free(s); 4140 // non existing key 4141 r = cropElemInt32O(self, "qwe"); 4142 ck_assert(!r); 4143 // null key 4144 r = cropElemInt32O(self, null); 4145 ck_assert_int_eq(r, 0); 4146 // empty self 4147 freeO(self); 4148 r = cropElemInt32O(self, "1"); 4149 ck_assert_int_eq(r, 0); 4150 terminateO(self); 4151 4152 } 4153 4154 4155 void cropElemUintSmallDictT(void) { 4156 4157 uint64_t r; 4158 smallDictt *self = allocG(rtSmallDictt); 4159 smallDictt *r2; 4160 4161 r2 = self->f->setInt(self, "1", 1); 4162 ck_assert_ptr_ne(r2, null); 4163 r2 = self->f->setDouble(self, "2", 2.2); 4164 ck_assert_ptr_ne(r2, null); 4165 r2 = self->f->setInt(self, "b", 2); 4166 ck_assert_ptr_ne(r2, null); 4167 createAllocateSmallInt(I); 4168 setValG(I, 11); 4169 I->type = "anothertype"; 4170 r2 = self->f->set(self, "B", (baset*)I); 4171 ck_assert_ptr_ne(r2, null); 4172 r = cropElemUintO(self, "b"); 4173 ck_assert_int_eq(r, 2); 4174 char *s = toStringO(self); 4175 ck_assert_str_eq(s, "{\"1\":1,\"2\":2.200000e+00,\"B\":\"<data container>\"}"); 4176 free(s); 4177 // wrong object type 4178 r = cropElemUintO(self, "2"); 4179 ck_assert(!r); 4180 s = toStringO(self); 4181 ck_assert_str_eq(s, "{\"1\":1,\"2\":2.200000e+00,\"B\":\"<data container>\"}"); 4182 free(s); 4183 r = cropElemUintO(self, "B"); 4184 ck_assert(!r); 4185 s = toStringO(self); 4186 ck_assert_str_eq(s, "{\"1\":1,\"2\":2.200000e+00,\"B\":\"<data container>\"}"); 4187 free(s); 4188 // non existing key 4189 r = cropElemUintO(self, "qwe"); 4190 ck_assert(!r); 4191 // null key 4192 r = cropElemUintO(self, null); 4193 ck_assert_int_eq(r, 0); 4194 // empty self 4195 freeO(self); 4196 r = cropElemUintO(self, "1"); 4197 ck_assert_int_eq(r, 0); 4198 terminateO(self); 4199 4200 } 4201 4202 4203 void cropElemUint32SmallDictT(void) { 4204 4205 uint32_t r; 4206 smallDictt *self = allocG(rtSmallDictt); 4207 smallDictt *r2; 4208 4209 r2 = self->f->setInt(self, "1", 1); 4210 ck_assert_ptr_ne(r2, null); 4211 r2 = self->f->setDouble(self, "2", 2.2); 4212 ck_assert_ptr_ne(r2, null); 4213 r2 = self->f->setInt(self, "b", 2); 4214 ck_assert_ptr_ne(r2, null); 4215 createAllocateSmallInt(I); 4216 setValG(I, 11); 4217 I->type = "anothertype"; 4218 r2 = self->f->set(self, "B", (baset*)I); 4219 ck_assert_ptr_ne(r2, null); 4220 r = cropElemUint32O(self, "b"); 4221 ck_assert_int_eq(r, 2); 4222 char *s = toStringO(self); 4223 ck_assert_str_eq(s, "{\"1\":1,\"2\":2.200000e+00,\"B\":\"<data container>\"}"); 4224 free(s); 4225 // wrong object type 4226 r = cropElemUint32O(self, "2"); 4227 ck_assert(!r); 4228 s = toStringO(self); 4229 ck_assert_str_eq(s, "{\"1\":1,\"2\":2.200000e+00,\"B\":\"<data container>\"}"); 4230 free(s); 4231 r = cropElemUint32O(self, "B"); 4232 ck_assert(!r); 4233 s = toStringO(self); 4234 ck_assert_str_eq(s, "{\"1\":1,\"2\":2.200000e+00,\"B\":\"<data container>\"}"); 4235 free(s); 4236 // non existing key 4237 r = cropElemUint32O(self, "qwe"); 4238 ck_assert(!r); 4239 // null key 4240 r = cropElemUint32O(self, null); 4241 ck_assert_int_eq(r, 0); 4242 // empty self 4243 freeO(self); 4244 r = cropElemUint32O(self, "1"); 4245 ck_assert_int_eq(r, 0); 4246 terminateO(self); 4247 4248 } 4249 4250 4251 void cropElemSSmallDictT(void) { 4252 4253 char* r; 4254 smallDictt *self = allocG(rtSmallDictt); 4255 smallDictt *r2; 4256 4257 r2 = self->f->setInt(self, "1", 1); 4258 ck_assert_ptr_ne(r2, null); 4259 r2 = self->f->setDouble(self, "2", 2.2); 4260 ck_assert_ptr_ne(r2, null); 4261 r2 = self->f->setS(self, "b", "qwe"); 4262 ck_assert_ptr_ne(r2, null); 4263 createAllocateSmallInt(I); 4264 setValG(I, 11); 4265 I->type = "anothertype"; 4266 r2 = self->f->set(self, "B", (baset*)I); 4267 ck_assert_ptr_ne(r2, null); 4268 r = cropElemSO(self, "b"); 4269 ck_assert_str_eq(r, "qwe"); 4270 free(r); 4271 char *s = toStringO(self); 4272 ck_assert_str_eq(s, "{\"1\":1,\"2\":2.200000e+00,\"B\":\"<data container>\"}"); 4273 free(s); 4274 // wrong object type 4275 r = cropElemSO(self, "2"); 4276 ck_assert_ptr_eq(r, null); 4277 s = toStringO(self); 4278 ck_assert_str_eq(s, "{\"1\":1,\"2\":2.200000e+00,\"B\":\"<data container>\"}"); 4279 free(s); 4280 r = cropElemSO(self, "B"); 4281 ck_assert_ptr_eq(r, null); 4282 s = toStringO(self); 4283 ck_assert_str_eq(s, "{\"1\":1,\"2\":2.200000e+00,\"B\":\"<data container>\"}"); 4284 free(s); 4285 // non existing key 4286 r = cropElemSO(self, "qwe"); 4287 ck_assert_ptr_eq(r, null); 4288 // null key 4289 r = cropElemSO(self, null); 4290 ck_assert_ptr_eq(r, null); 4291 // empty self 4292 freeO(self); 4293 r = cropElemSO(self, "1"); 4294 ck_assert_ptr_eq(r, null); 4295 terminateO(self); 4296 4297 } 4298 4299 4300 void cropElemDictSmallDictT(void) { 4301 4302 smallDictt* r; 4303 smallDictt *self = allocG(rtSmallDictt); 4304 smallDictt *r2; 4305 4306 r2 = self->f->setInt(self, "1", 1); 4307 ck_assert_ptr_ne(r2, null); 4308 r2 = self->f->setDouble(self, "2", 2.2); 4309 ck_assert_ptr_ne(r2, null); 4310 createAllocateSmallDict(d); 4311 r2 = self->f->setNFreeDict(self, "b", d); 4312 ck_assert_ptr_ne(r2, null); 4313 createAllocateSmallInt(I); 4314 setValG(I, 11); 4315 I->type = "anothertype"; 4316 r2 = self->f->set(self, "B", (baset*)I); 4317 ck_assert_ptr_ne(r2, null); 4318 r = cropElemDictO(self, "b"); 4319 ck_assert_ptr_ne(r, null); 4320 char *s = toStringO(r); 4321 terminateO(r); 4322 ck_assert_str_eq(s, "{}"); 4323 free(s); 4324 s = toStringO(self); 4325 ck_assert_str_eq(s, "{\"1\":1,\"2\":2.200000e+00,\"B\":\"<data container>\"}"); 4326 free(s); 4327 // wrong object type 4328 r = cropElemDictO(self, "2"); 4329 ck_assert_ptr_eq(r, null); 4330 s = toStringO(self); 4331 ck_assert_str_eq(s, "{\"1\":1,\"2\":2.200000e+00,\"B\":\"<data container>\"}"); 4332 free(s); 4333 r = cropElemDictO(self, "B"); 4334 ck_assert_ptr_eq(r, null); 4335 s = toStringO(self); 4336 ck_assert_str_eq(s, "{\"1\":1,\"2\":2.200000e+00,\"B\":\"<data container>\"}"); 4337 free(s); 4338 // non existing key 4339 r = cropElemDictO(self, "qwe"); 4340 ck_assert_ptr_eq(r, null); 4341 // null key 4342 r = cropElemDictO(self, null); 4343 ck_assert_ptr_eq(r, null); 4344 // empty self 4345 freeO(self); 4346 r = cropElemDictO(self, "1"); 4347 ck_assert_ptr_eq(r, null); 4348 terminateO(self); 4349 4350 } 4351 4352 4353 void cropElemArraySmallDictT(void) { 4354 4355 smallArrayt* r; 4356 smallDictt *self = allocG(rtSmallDictt); 4357 smallDictt *r2; 4358 4359 r2 = self->f->setInt(self, "1", 1); 4360 ck_assert_ptr_ne(r2, null); 4361 r2 = self->f->setDouble(self, "2", 2.2); 4362 ck_assert_ptr_ne(r2, null); 4363 createAllocateSmallArray(d); 4364 r2 = self->f->setNFreeArray(self, "b", d); 4365 ck_assert_ptr_ne(r2, null); 4366 createAllocateSmallInt(I); 4367 setValG(I, 11); 4368 I->type = "anothertype"; 4369 r2 = self->f->set(self, "B", (baset*)I); 4370 ck_assert_ptr_ne(r2, null); 4371 r = cropElemArrayO(self, "b"); 4372 ck_assert_ptr_ne(r, null); 4373 char *s = toStringO(r); 4374 terminateO(r); 4375 ck_assert_str_eq(s, "[]"); 4376 free(s); 4377 s = toStringO(self); 4378 ck_assert_str_eq(s, "{\"1\":1,\"2\":2.200000e+00,\"B\":\"<data container>\"}"); 4379 free(s); 4380 // wrong object type 4381 r = cropElemArrayO(self, "2"); 4382 ck_assert_ptr_eq(r, null); 4383 s = toStringO(self); 4384 ck_assert_str_eq(s, "{\"1\":1,\"2\":2.200000e+00,\"B\":\"<data container>\"}"); 4385 free(s); 4386 r = cropElemArrayO(self, "B"); 4387 ck_assert_ptr_eq(r, null); 4388 s = toStringO(self); 4389 ck_assert_str_eq(s, "{\"1\":1,\"2\":2.200000e+00,\"B\":\"<data container>\"}"); 4390 free(s); 4391 // non existing key 4392 r = cropElemArrayO(self, "qwe"); 4393 ck_assert_ptr_eq(r, null); 4394 // null key 4395 r = cropElemArrayO(self, null); 4396 ck_assert_ptr_eq(r, null); 4397 // empty self 4398 freeO(self); 4399 r = cropElemArrayO(self, "1"); 4400 ck_assert_ptr_eq(r, null); 4401 terminateO(self); 4402 4403 } 4404 4405 4406 void cropElemSmallBoolSmallDictT(void) { 4407 4408 smallBoolt* r; 4409 smallDictt *self = allocG(rtSmallDictt); 4410 smallDictt *r2; 4411 4412 r2 = self->f->setInt(self, "1", 1); 4413 ck_assert_ptr_ne(r2, null); 4414 r2 = self->f->setDouble(self, "2", 2.2); 4415 ck_assert_ptr_ne(r2, null); 4416 r2 = self->f->setBool(self, "b", true); 4417 ck_assert_ptr_ne(r2, null); 4418 createAllocateSmallInt(I); 4419 setValG(I, 11); 4420 I->type = "anothertype"; 4421 r2 = self->f->set(self, "B", (baset*)I); 4422 ck_assert_ptr_ne(r2, null); 4423 r = cropElemSmallBoolO(self, "b"); 4424 ck_assert_ptr_ne(r, null); 4425 char *s = toStringO(r); 4426 terminateO(r); 4427 ck_assert_str_eq(s, "true"); 4428 free(s); 4429 s = toStringO(self); 4430 ck_assert_str_eq(s, "{\"1\":1,\"2\":2.200000e+00,\"B\":\"<data container>\"}"); 4431 free(s); 4432 // wrong object type 4433 r = cropElemSmallBoolO(self, "2"); 4434 ck_assert_ptr_eq(r, null); 4435 s = toStringO(self); 4436 ck_assert_str_eq(s, "{\"1\":1,\"2\":2.200000e+00,\"B\":\"<data container>\"}"); 4437 free(s); 4438 r = cropElemSmallBoolO(self, "B"); 4439 ck_assert_ptr_eq(r, null); 4440 s = toStringO(self); 4441 ck_assert_str_eq(s, "{\"1\":1,\"2\":2.200000e+00,\"B\":\"<data container>\"}"); 4442 free(s); 4443 // non existing key 4444 r = cropElemSmallBoolO(self, "qwe"); 4445 ck_assert_ptr_eq(r, null); 4446 // null key 4447 r = cropElemSmallBoolO(self, null); 4448 ck_assert_ptr_eq(r, null); 4449 // empty self 4450 freeO(self); 4451 r = cropElemSmallBoolO(self, "1"); 4452 ck_assert_ptr_eq(r, null); 4453 terminateO(self); 4454 4455 } 4456 4457 4458 void cropElemSmallBytesSmallDictT(void) { 4459 4460 smallBytest* r; 4461 smallDictt *self = allocG(rtSmallDictt); 4462 smallDictt *r2; 4463 4464 r2 = self->f->setInt(self, "1", 1); 4465 ck_assert_ptr_ne(r2, null); 4466 r2 = self->f->setDouble(self, "2", 2.2); 4467 ck_assert_ptr_ne(r2, null); 4468 createAllocateSmallBytes(d); 4469 r2 = self->f->setNFreeSmallBytes(self, "b", d); 4470 ck_assert_ptr_ne(r2, null); 4471 createAllocateSmallInt(I); 4472 setValG(I, 11); 4473 I->type = "anothertype"; 4474 r2 = self->f->set(self, "B", (baset*)I); 4475 ck_assert_ptr_ne(r2, null); 4476 r = cropElemSmallBytesO(self, "b"); 4477 ck_assert_ptr_ne(r, null); 4478 char *s = toStringO(r); 4479 terminateO(r); 4480 ck_assert_str_eq(s, "[]"); 4481 free(s); 4482 s = toStringO(self); 4483 ck_assert_str_eq(s, "{\"1\":1,\"2\":2.200000e+00,\"B\":\"<data container>\"}"); 4484 free(s); 4485 // wrong object type 4486 r = cropElemSmallBytesO(self, "2"); 4487 ck_assert_ptr_eq(r, null); 4488 s = toStringO(self); 4489 ck_assert_str_eq(s, "{\"1\":1,\"2\":2.200000e+00,\"B\":\"<data container>\"}"); 4490 free(s); 4491 r = cropElemSmallBytesO(self, "B"); 4492 ck_assert_ptr_eq(r, null); 4493 s = toStringO(self); 4494 ck_assert_str_eq(s, "{\"1\":1,\"2\":2.200000e+00,\"B\":\"<data container>\"}"); 4495 free(s); 4496 // non existing key 4497 r = cropElemSmallBytesO(self, "qwe"); 4498 ck_assert_ptr_eq(r, null); 4499 //r = cropElemSmallBytesO(self); 4500 // null key 4501 r = cropElemSmallBytesO(self, null); 4502 ck_assert_ptr_eq(r, null); 4503 // empty self 4504 freeO(self); 4505 r = cropElemSmallBytesO(self, "1"); 4506 ck_assert_ptr_eq(r, null); 4507 terminateO(self); 4508 4509 } 4510 4511 4512 void cropElemSmallDoubleSmallDictT(void) { 4513 4514 smallDoublet* r; 4515 smallDictt *self = allocG(rtSmallDictt); 4516 smallDictt *r2; 4517 4518 r2 = self->f->setInt(self, "1", 1); 4519 ck_assert_ptr_ne(r2, null); 4520 r2 = self->f->setDouble(self, "2", 2.2); 4521 ck_assert_ptr_ne(r2, null); 4522 r2 = self->f->setDouble(self, "b", 3.3); 4523 ck_assert_ptr_ne(r2, null); 4524 createAllocateSmallInt(I); 4525 setValG(I, 11); 4526 I->type = "anothertype"; 4527 r2 = self->f->set(self, "B", (baset*)I); 4528 ck_assert_ptr_ne(r2, null); 4529 r = cropElemSmallDoubleO(self, "b"); 4530 ck_assert_ptr_ne(r, null); 4531 char *s = toStringO(r); 4532 terminateO(r); 4533 ck_assert_str_eq(s, "3.300000e+00"); 4534 free(s); 4535 s = toStringO(self); 4536 ck_assert_str_eq(s, "{\"1\":1,\"2\":2.200000e+00,\"B\":\"<data container>\"}"); 4537 free(s); 4538 // wrong object type 4539 r = cropElemSmallDoubleO(self, "1"); 4540 ck_assert_ptr_eq(r, null); 4541 s = toStringO(self); 4542 ck_assert_str_eq(s, "{\"1\":1,\"2\":2.200000e+00,\"B\":\"<data container>\"}"); 4543 free(s); 4544 r = cropElemSmallDoubleO(self, "B"); 4545 ck_assert_ptr_eq(r, null); 4546 s = toStringO(self); 4547 ck_assert_str_eq(s, "{\"1\":1,\"2\":2.200000e+00,\"B\":\"<data container>\"}"); 4548 free(s); 4549 // non existing key 4550 r = cropElemSmallDoubleO(self, "qwe"); 4551 ck_assert_ptr_eq(r, null); 4552 // null key 4553 r = cropElemSmallDoubleO(self, null); 4554 ck_assert_ptr_eq(r, null); 4555 // empty self 4556 freeO(self); 4557 r = cropElemSmallDoubleO(self, "1"); 4558 ck_assert_ptr_eq(r, null); 4559 terminateO(self); 4560 4561 } 4562 4563 4564 void cropElemSmallIntSmallDictT(void) { 4565 4566 smallIntt* r; 4567 smallDictt *self = allocG(rtSmallDictt); 4568 smallDictt *r2; 4569 4570 r2 = self->f->setInt(self, "1", 1); 4571 ck_assert_ptr_ne(r2, null); 4572 r2 = self->f->setDouble(self, "2", 2.2); 4573 ck_assert_ptr_ne(r2, null); 4574 r2 = self->f->setInt(self, "b", 2); 4575 ck_assert_ptr_ne(r2, null); 4576 createAllocateSmallInt(I); 4577 setValG(I, 11); 4578 I->type = "anothertype"; 4579 r2 = self->f->set(self, "B", (baset*)I); 4580 ck_assert_ptr_ne(r2, null); 4581 r = cropElemSmallIntO(self, "b"); 4582 ck_assert_ptr_ne(r, null); 4583 char *s = toStringO(r); 4584 terminateO(r); 4585 ck_assert_str_eq(s, "2"); 4586 free(s); 4587 s = toStringO(self); 4588 ck_assert_str_eq(s, "{\"1\":1,\"2\":2.200000e+00,\"B\":\"<data container>\"}"); 4589 free(s); 4590 // wrong object type 4591 r = cropElemSmallIntO(self, "2"); 4592 ck_assert_ptr_eq(r, null); 4593 s = toStringO(self); 4594 ck_assert_str_eq(s, "{\"1\":1,\"2\":2.200000e+00,\"B\":\"<data container>\"}"); 4595 free(s); 4596 r = cropElemSmallIntO(self, "B"); 4597 ck_assert_ptr_eq(r, null); 4598 s = toStringO(self); 4599 ck_assert_str_eq(s, "{\"1\":1,\"2\":2.200000e+00,\"B\":\"<data container>\"}"); 4600 free(s); 4601 // non existing key 4602 r = cropElemSmallIntO(self, "qwe"); 4603 ck_assert_ptr_eq(r, null); 4604 // null key 4605 r = cropElemSmallIntO(self, null); 4606 ck_assert_ptr_eq(r, null); 4607 // empty self 4608 freeO(self); 4609 r = cropElemSmallIntO(self, "1"); 4610 ck_assert_ptr_eq(r, null); 4611 terminateO(self); 4612 4613 } 4614 4615 4616 void cropElemSmallJsonSmallDictT(void) { 4617 4618 smallJsont* r; 4619 smallDictt *self = allocG(rtSmallDictt); 4620 smallDictt *r2; 4621 4622 r2 = self->f->setInt(self, "1", 1); 4623 ck_assert_ptr_ne(r2, null); 4624 createAllocateSmallBytes(b); 4625 r2 = self->f->setNFreeSmallBytes(self, "2", b); 4626 ck_assert_ptr_ne(r2, null); 4627 createAllocateSmallJson(d); 4628 r2 = self->f->setNFreeSmallJson(self, "b", d); 4629 ck_assert_ptr_ne(r2, null); 4630 createAllocateSmallInt(I); 4631 setValG(I, 11); 4632 I->type = "anothertype"; 4633 r2 = self->f->set(self, "B", (baset*)I); 4634 ck_assert_ptr_ne(r2, null); 4635 r = cropElemSmallJsonO(self, "b"); 4636 ck_assert_ptr_ne(r, null); 4637 char *s = toStringO(r); 4638 terminateO(r); 4639 ck_assert_str_eq(s, "{}"); 4640 free(s); 4641 s = toStringO(self); 4642 ck_assert_str_eq(s, "{\"1\":1,\"2\":[],\"B\":\"<data container>\"}"); 4643 free(s); 4644 // wrong object type 4645 r = cropElemSmallJsonO(self, "2"); 4646 ck_assert_ptr_eq(r, null); 4647 s = toStringO(self); 4648 ck_assert_str_eq(s, "{\"1\":1,\"2\":[],\"B\":\"<data container>\"}"); 4649 free(s); 4650 r = cropElemSmallJsonO(self, "B"); 4651 ck_assert_ptr_eq(r, null); 4652 s = toStringO(self); 4653 ck_assert_str_eq(s, "{\"1\":1,\"2\":[],\"B\":\"<data container>\"}"); 4654 free(s); 4655 // non existing key 4656 r = cropElemSmallJsonO(self, "qwe"); 4657 ck_assert_ptr_eq(r, null); 4658 // null key 4659 r = cropElemSmallJsonO(self, null); 4660 ck_assert_ptr_eq(r, null); 4661 // empty self 4662 freeO(self); 4663 r = cropElemSmallJsonO(self, "1"); 4664 ck_assert_ptr_eq(r, null); 4665 terminateO(self); 4666 4667 } 4668 4669 4670 void cropElemSmallStringSmallDictT(void) { 4671 4672 smallStringt* r; 4673 smallDictt *self = allocG(rtSmallDictt); 4674 smallDictt *r2; 4675 4676 r2 = self->f->setInt(self, "1", 1); 4677 ck_assert_ptr_ne(r2, null); 4678 r2 = self->f->setDouble(self, "2", 2.2); 4679 ck_assert_ptr_ne(r2, null); 4680 r2 = self->f->setS(self, "b", "qwe"); 4681 ck_assert_ptr_ne(r2, null); 4682 createAllocateSmallInt(I); 4683 setValG(I, 11); 4684 I->type = "anothertype"; 4685 r2 = self->f->set(self, "B", (baset*)I); 4686 ck_assert_ptr_ne(r2, null); 4687 r = cropElemSmallStringO(self, "b"); 4688 ck_assert_ptr_ne(r, null); 4689 char *s = toStringO(r); 4690 terminateO(r); 4691 ck_assert_str_eq(s, "qwe"); 4692 free(s); 4693 s = toStringO(self); 4694 ck_assert_str_eq(s, "{\"1\":1,\"2\":2.200000e+00,\"B\":\"<data container>\"}"); 4695 free(s); 4696 // wrong object type 4697 r = cropElemSmallStringO(self, "2"); 4698 ck_assert_ptr_eq(r, null); 4699 s = toStringO(self); 4700 ck_assert_str_eq(s, "{\"1\":1,\"2\":2.200000e+00,\"B\":\"<data container>\"}"); 4701 free(s); 4702 r = cropElemSmallStringO(self, "B"); 4703 ck_assert_ptr_eq(r, null); 4704 s = toStringO(self); 4705 ck_assert_str_eq(s, "{\"1\":1,\"2\":2.200000e+00,\"B\":\"<data container>\"}"); 4706 free(s); 4707 // non existing key 4708 r = cropElemSmallStringO(self, "qwe"); 4709 ck_assert_ptr_eq(r, null); 4710 // null key 4711 r = cropElemSmallStringO(self, null); 4712 ck_assert_ptr_eq(r, null); 4713 // empty self 4714 freeO(self); 4715 r = cropElemSmallStringO(self, "1"); 4716 ck_assert_ptr_eq(r, null); 4717 terminateO(self); 4718 4719 } 4720 4721 4722 void cropElemVoidSmallDictT(void) { 4723 4724 void* r; 4725 smallDictt *self = allocG(rtSmallDictt); 4726 smallDictt *r2; 4727 4728 r2 = self->f->setInt(self, "1", 1); 4729 ck_assert_ptr_ne(r2, null); 4730 r2 = self->f->setDouble(self, "2", 2.2); 4731 ck_assert_ptr_ne(r2, null); 4732 smallContainert *c = allocSmallContainer(&r); 4733 r2 = self->f->setNFreeSmallContainer(self, "b", c); 4734 ck_assert_ptr_ne(r2, null); 4735 createAllocateSmallInt(I); 4736 setValG(I, 11); 4737 I->type = "anothertype"; 4738 r2 = self->f->set(self, "B", (baset*)I); 4739 ck_assert_ptr_ne(r2, null); 4740 r = cropElemVoidO(self, "b"); 4741 ck_assert_ptr_eq(r, &r); 4742 char *s = toStringO(self); 4743 ck_assert_str_eq(s, "{\"1\":1,\"2\":2.200000e+00,\"B\":\"<data container>\"}"); 4744 free(s); 4745 // wrong object type 4746 r = cropElemVoidO(self, "2"); 4747 ck_assert_ptr_eq(r, null); 4748 s = toStringO(self); 4749 ck_assert_str_eq(s, "{\"1\":1,\"2\":2.200000e+00,\"B\":\"<data container>\"}"); 4750 free(s); 4751 r = cropElemVoidO(self, "B"); 4752 ck_assert_ptr_eq(r, null); 4753 s = toStringO(self); 4754 ck_assert_str_eq(s, "{\"1\":1,\"2\":2.200000e+00,\"B\":\"<data container>\"}"); 4755 free(s); 4756 // non existing key 4757 r = cropElemVoidO(self, "qwe"); 4758 ck_assert_ptr_eq(r, null); 4759 // null key 4760 r = cropElemVoidO(self, null); 4761 ck_assert_ptr_eq(r, null); 4762 // empty self 4763 freeO(self); 4764 r = cropElemVoidO(self, "1"); 4765 ck_assert_ptr_eq(r, null); 4766 terminateO(self); 4767 4768 } 4769 4770 4771 void cropElemSmallContainerSmallDictT(void) { 4772 4773 smallContainert* r; 4774 smallDictt *self = allocG(rtSmallDictt); 4775 smallDictt *r2; 4776 4777 r2 = self->f->setInt(self, "1", 1); 4778 ck_assert_ptr_ne(r2, null); 4779 r2 = self->f->setDouble(self, "2", 2.2); 4780 ck_assert_ptr_ne(r2, null); 4781 smallContainert *c = allocSmallContainer(&r); 4782 r2 = self->f->setNFreeSmallContainer(self, "b", c); 4783 ck_assert_ptr_ne(r2, null); 4784 createAllocateSmallInt(I); 4785 setValG(I, 11); 4786 I->type = "anothertype"; 4787 r2 = self->f->set(self, "B", (baset*)I); 4788 ck_assert_ptr_ne(r2, null); 4789 r = cropElemSmallContainerO(self, "b"); 4790 ck_assert_ptr_ne(r, null); 4791 char *s = toStringO(r); 4792 terminateO(r); 4793 ck_assert_str_eq(s, "<data smallContainer>"); 4794 free(s); 4795 s = toStringO(self); 4796 ck_assert_str_eq(s, "{\"1\":1,\"2\":2.200000e+00,\"B\":\"<data container>\"}"); 4797 free(s); 4798 // wrong object type 4799 r = cropElemSmallContainerO(self, "2"); 4800 ck_assert_ptr_eq(r, null); 4801 s = toStringO(self); 4802 ck_assert_str_eq(s, "{\"1\":1,\"2\":2.200000e+00,\"B\":\"<data container>\"}"); 4803 free(s); 4804 r = cropElemSmallContainerO(self, "B"); 4805 ck_assert_ptr_eq(r, null); 4806 s = toStringO(self); 4807 ck_assert_str_eq(s, "{\"1\":1,\"2\":2.200000e+00,\"B\":\"<data container>\"}"); 4808 free(s); 4809 // non existing key 4810 r = cropElemSmallContainerO(self, "qwe"); 4811 ck_assert_ptr_eq(r, null); 4812 // null key 4813 r = cropElemSmallContainerO(self, null); 4814 ck_assert_ptr_eq(r, null); 4815 // empty self 4816 freeO(self); 4817 r = cropElemSmallContainerO(self, "1"); 4818 ck_assert_ptr_eq(r, null); 4819 terminateO(self); 4820 4821 } 4822 4823 4824 void delKCharSmallDictT(void) { 4825 4826 smallDictt* r; 4827 smallDictt *self = allocG(rtSmallDictt); 4828 4829 r = self->f->setInt(self, "1", 1); 4830 ck_assert_ptr_ne(r, null); 4831 r = self->f->setDouble(self, "2", 2.2); 4832 ck_assert_ptr_ne(r, null); 4833 // non existing key 4834 r = delKCharO(self, 'q'); 4835 ck_assert_ptr_ne(r, null); 4836 char *s = toStringO(r); 4837 ck_assert_str_eq(s, "{\"1\":1,\"2\":2.200000e+00}"); 4838 free(s); 4839 // delete key value 4840 r = delKCharO(self, '2'); 4841 ck_assert_ptr_ne(r, null); 4842 s = toStringO(r); 4843 ck_assert_str_eq(s, "{\"1\":1}"); 4844 free(s); 4845 terminateO(self); 4846 4847 } 4848 4849 4850 void removeSmallDictT(void) { 4851 4852 smallDictt* r; 4853 smallDictt *self = allocG(rtSmallDictt); 4854 4855 smallIntt *i = allocSmallInt(1); 4856 r = self->f->setSmallInt(self, "1", i); 4857 ck_assert_ptr_ne(r, null); 4858 r = self->f->remove(self, "1"); 4859 ck_assert_ptr_ne(r, null); 4860 terminateO(i); 4861 char *s = toStringO(r); 4862 ck_assert_str_eq(s, "{}"); 4863 free(s); 4864 // non existing key 4865 r = self->f->remove(self, "1"); 4866 ck_assert_ptr_ne(r, null); 4867 s = toStringO(r); 4868 ck_assert_str_eq(s, "{}"); 4869 free(s); 4870 // null key 4871 r = self->f->remove(self, null); 4872 ck_assert_ptr_eq(r, null); 4873 // empty self 4874 freeO(self); 4875 r = self->f->remove(self, "qwe"); 4876 ck_assert_ptr_eq(r, null); 4877 terminateO(self); 4878 4879 } 4880 4881 4882 void removeKCharSmallDictT(void) { 4883 4884 smallDictt* r; 4885 smallDictt *self = allocG(rtSmallDictt); 4886 4887 smallIntt *i = allocSmallInt(1); 4888 r = self->f->setSmallInt(self, "1", i); 4889 ck_assert_ptr_ne(r, null); 4890 r = self->f->removeKChar(self, '1'); 4891 ck_assert_ptr_ne(r, null); 4892 terminateO(i); 4893 char *s = toStringO(r); 4894 ck_assert_str_eq(s, "{}"); 4895 free(s); 4896 // non existing key 4897 r = self->f->removeKChar(self, '1'); 4898 ck_assert_ptr_ne(r, null); 4899 s = toStringO(r); 4900 ck_assert_str_eq(s, "{}"); 4901 free(s); 4902 // empty self 4903 freeO(self); 4904 r = self->f->removeKChar(self, 'q'); 4905 ck_assert_ptr_eq(r, null); 4906 terminateO(self); 4907 4908 } 4909 4910 4911 void hasKCharSmallDictT(void) { 4912 4913 smallDictt *self = allocG(rtSmallDictt); 4914 4915 smallDictt *r2 = self->f->setInt(self, "1", 1); 4916 ck_assert_ptr_ne(r2, null); 4917 ck_assert(self->f->hasKChar(self, '1')); 4918 terminateO(self); 4919 4920 } 4921 4922 4923 void keyBySmallDictT(void) { 4924 4925 char* r; 4926 smallDictt *self = allocG(rtSmallDictt); 4927 baset *value; 4928 4929 smallDictt *r2 = self->f->setInt(self, "1", 1); 4930 ck_assert_ptr_ne(r2, null); 4931 value = (baset*) allocSmallInt(1); 4932 r = keyByO(self, value); 4933 ck_assert_str_eq(r, "1"); 4934 // non existing object 4935 smallIntt *i = allocSmallInt(2); 4936 r = keyByO(self, (baset*)i); 4937 terminateO(i); 4938 ck_assert_ptr_eq(r, null); 4939 // null value 4940 r = keyByO(self, null); 4941 ck_assert_ptr_eq(r, null); 4942 // empty self 4943 freeO(self); 4944 r = keyByO(self, value); 4945 ck_assert_ptr_eq(r, null); 4946 terminateO(self); 4947 terminateO(value); 4948 4949 } 4950 4951 4952 void keyByUndefinedSmallDictT(void) { 4953 4954 char* r; 4955 smallDictt *self = allocG(rtSmallDictt); 4956 undefinedt *value; 4957 4958 smallDictt *r2 = self->f->setUndefined(self, "1"); 4959 ck_assert_ptr_ne(r2, null); 4960 value = allocUndefined(); 4961 r = keyByUndefinedO(self, value); 4962 ck_assert_str_eq(r, "1"); 4963 // non existing object 4964 r2 = self->f->setInt(self, "1", 1); 4965 ck_assert_ptr_ne(r2, null); 4966 r = keyByUndefinedO(self, value); 4967 ck_assert_ptr_eq(r, null); 4968 // non undefined object 4969 smallIntt *i = allocSmallInt(2); 4970 r = keyByUndefinedO(self, (undefinedt*)i); 4971 terminateO(i); 4972 ck_assert_ptr_eq(r, null); 4973 // null value 4974 r = keyByUndefinedO(self, null); 4975 ck_assert_ptr_eq(r, null); 4976 // empty self 4977 freeO(self); 4978 r = keyByUndefinedO(self, value); 4979 ck_assert_ptr_eq(r, null); 4980 terminateO(self); 4981 terminateO(value); 4982 4983 } 4984 4985 4986 void keyByBoolSmallDictT(void) { 4987 4988 char* r; 4989 smallDictt *self = allocG(rtSmallDictt); 4990 4991 smallDictt *r2 = self->f->setBool(self, "1", true); 4992 ck_assert_ptr_ne(r2, null); 4993 r = keyByBoolO(self, true); 4994 ck_assert_str_eq(r, "1"); 4995 // non existing object 4996 r2 = self->f->setInt(self, "1", 1); 4997 ck_assert_ptr_ne(r2, null); 4998 r = keyByBoolO(self, true); 4999 ck_assert_ptr_eq(r, null); 5000 // empty self 5001 freeO(self); 5002 r = keyByBoolO(self, true); 5003 ck_assert_ptr_eq(r, null); 5004 terminateO(self); 5005 5006 } 5007 5008 5009 void keyByDoubleSmallDictT(void) { 5010 5011 char* r; 5012 smallDictt *self = allocG(rtSmallDictt); 5013 5014 smallDictt *r2 = self->f->setDouble(self, "1", 2.2); 5015 ck_assert_ptr_ne(r2, null); 5016 r = keyByDoubleO(self, 2.2); 5017 ck_assert_str_eq(r, "1"); 5018 // non existing object 5019 r2 = self->f->setInt(self, "1", 1); 5020 ck_assert_ptr_ne(r2, null); 5021 r = keyByDoubleO(self, 2.2); 5022 ck_assert_ptr_eq(r, null); 5023 // empty self 5024 freeO(self); 5025 r = keyByDoubleO(self, 2.2); 5026 ck_assert_ptr_eq(r, null); 5027 terminateO(self); 5028 5029 } 5030 5031 5032 void keyByIntSmallDictT(void) { 5033 5034 char* r; 5035 smallDictt *self = allocG(rtSmallDictt); 5036 5037 smallDictt *r2 = self->f->setInt(self, "1", 2); 5038 ck_assert_ptr_ne(r2, null); 5039 r = keyByIntO(self, 2); 5040 ck_assert_str_eq(r, "1"); 5041 // non existing object 5042 r2 = self->f->setInt(self, "1", 1); 5043 ck_assert_ptr_ne(r2, null); 5044 r = keyByIntO(self, 2); 5045 ck_assert_ptr_eq(r, null); 5046 // empty self 5047 freeO(self); 5048 r = keyByIntO(self, 2); 5049 ck_assert_ptr_eq(r, null); 5050 terminateO(self); 5051 5052 } 5053 5054 5055 void keyBySSmallDictT(void) { 5056 5057 char* r; 5058 smallDictt *self = allocG(rtSmallDictt); 5059 5060 smallDictt *r2 = self->f->setS(self, "1", "qwe"); 5061 ck_assert_ptr_ne(r2, null); 5062 r = keyBySO(self, "qwe"); 5063 ck_assert_str_eq(r, "1"); 5064 // non existing object 5065 r2 = self->f->setInt(self, "1", 1); 5066 ck_assert_ptr_ne(r2, null); 5067 r = keyBySO(self, "qwe"); 5068 ck_assert_ptr_eq(r, null); 5069 // null value 5070 r = keyBySO(self, null); 5071 ck_assert_ptr_eq(r, null); 5072 // empty self 5073 freeO(self); 5074 r = keyBySO(self, "qwe"); 5075 ck_assert_ptr_eq(r, null); 5076 terminateO(self); 5077 5078 } 5079 5080 5081 void keyByCharSmallDictT(void) { 5082 5083 char* r; 5084 smallDictt *self = allocG(rtSmallDictt); 5085 5086 smallDictt *r2 = self->f->setS(self, "1", "q"); 5087 ck_assert_ptr_ne(r2, null); 5088 r = keyByCharO(self, 'q'); 5089 ck_assert_str_eq(r, "1"); 5090 // non existing object 5091 r2 = self->f->setInt(self, "1", 1); 5092 ck_assert_ptr_ne(r2, null); 5093 r = keyByCharO(self, 'q'); 5094 ck_assert_ptr_eq(r, null); 5095 // empty self 5096 freeO(self); 5097 r = keyByCharO(self, 'q'); 5098 ck_assert_ptr_eq(r, null); 5099 terminateO(self); 5100 5101 } 5102 5103 5104 void keyByDictSmallDictT(void) { 5105 5106 char* r; 5107 smallDictt *self = allocG(rtSmallDictt); 5108 smallDictt *dict = allocSmallDict(); 5109 5110 createAllocateSmallDict(d); 5111 d->f->setS(d, "another", "dict"); 5112 smallDictt *r2 = self->f->setNFreeDict(self, "d", d); 5113 ck_assert_ptr_ne(r2, null); 5114 r2 = self->f->setNFreeDict(self, "1", dict); 5115 ck_assert_ptr_ne(r2, null); 5116 dict = allocSmallDict(); 5117 r = keyByDictO(self, dict); 5118 ck_assert_str_eq(r, "1"); 5119 // non existing object 5120 r2 = self->f->setInt(self, "1", 1); 5121 ck_assert_ptr_ne(r2, null); 5122 r = keyByDictO(self, dict); 5123 ck_assert_ptr_eq(r, null); 5124 // non smallDict object 5125 smallIntt *i = allocSmallInt(2); 5126 r = keyByDictO(self, (smallDictt*)i); 5127 terminateO(i); 5128 ck_assert_ptr_eq(r, null); 5129 // null value 5130 r = keyByDictO(self, null); 5131 ck_assert_ptr_eq(r, null); 5132 // empty self 5133 freeO(self); 5134 r = keyByDictO(self, dict); 5135 ck_assert_ptr_eq(r, null); 5136 terminateO(self); 5137 terminateO(dict); 5138 5139 } 5140 5141 5142 void keyByArraySmallDictT(void) { 5143 5144 char* r; 5145 smallDictt *self = allocG(rtSmallDictt); 5146 smallArrayt *array = allocSmallArray(); 5147 5148 createAllocateSmallArray(d); 5149 d->f->pushS(d, "another array"); 5150 smallDictt *r2 = self->f->setNFreeArray(self, "d", d); 5151 ck_assert_ptr_ne(r2, null); 5152 r2 = self->f->setNFreeArray(self, "1", array); 5153 ck_assert_ptr_ne(r2, null); 5154 array = allocSmallArray(); 5155 r = keyByArrayO(self, array); 5156 ck_assert_str_eq(r, "1"); 5157 // non existing object 5158 r2 = self->f->setInt(self, "1", 1); 5159 ck_assert_ptr_ne(r2, null); 5160 r = keyByArrayO(self, array); 5161 ck_assert_ptr_eq(r, null); 5162 // non smallArray object 5163 smallIntt *i = allocSmallInt(2); 5164 r = keyByArrayO(self, (smallArrayt*)i); 5165 terminateO(i); 5166 ck_assert_ptr_eq(r, null); 5167 // null value 5168 r = keyByArrayO(self, null); 5169 ck_assert_ptr_eq(r, null); 5170 // empty self 5171 freeO(self); 5172 r = keyByArrayO(self, array); 5173 ck_assert_ptr_eq(r, null); 5174 terminateO(self); 5175 terminateO(array); 5176 5177 } 5178 5179 5180 void keyByArraycSmallDictT(void) { 5181 5182 char* r; 5183 smallDictt *self = allocG(rtSmallDictt); 5184 char **array = listCreateS("a","b"); 5185 5186 char **d = listCreateS("asd", "zxcv"); 5187 smallDictt *r2 = self->f->setNFreeArrayc(self, "d", d); 5188 ck_assert_ptr_ne(r2, null); 5189 r2 = self->f->setArrayc(self, "1", array); 5190 ck_assert_ptr_ne(r2, null); 5191 r = keyByArraycO(self, array); 5192 ck_assert_ptr_ne(r, NULL); 5193 ck_assert_str_eq(r, "1"); 5194 // non existing object 5195 r2 = self->f->setInt(self, "1", 1); 5196 ck_assert_ptr_ne(r2, null); 5197 r = keyByArraycO(self, array); 5198 ck_assert_ptr_eq(r, null); 5199 // null value 5200 r = keyByArraycO(self, null); 5201 ck_assert_ptr_eq(r, null); 5202 // empty self 5203 freeO(self); 5204 r = keyByArraycO(self, array); 5205 ck_assert_ptr_eq(r, null); 5206 terminateO(self); 5207 listFreeS(array); 5208 5209 } 5210 5211 5212 void keyBySmallBoolSmallDictT(void) { 5213 5214 char* r; 5215 smallDictt *self = allocG(rtSmallDictt); 5216 smallBoolt *value = allocSmallBool(true); 5217 5218 createAllocateSmallBool(d); 5219 setValO(d, false); 5220 smallDictt *r2 = self->f->setNFreeSmallBool(self, "d", d); 5221 ck_assert_ptr_ne(r2, null); 5222 r2 = self->f->setNFreeSmallBool(self, "1", value); 5223 ck_assert_ptr_ne(r2, null); 5224 value = allocSmallBool(true); 5225 r = keyBySmallBoolO(self, value); 5226 ck_assert_str_eq(r, "1"); 5227 // non existing object 5228 r2 = self->f->setInt(self, "1", 1); 5229 ck_assert_ptr_ne(r2, null); 5230 r = keyBySmallBoolO(self, value); 5231 ck_assert_ptr_eq(r, null); 5232 // non smallBool object 5233 smallIntt *i = allocSmallInt(2); 5234 r = keyBySmallBoolO(self, (smallBoolt*)i); 5235 terminateO(i); 5236 ck_assert_ptr_eq(r, null); 5237 // null value 5238 r = keyBySmallBoolO(self, null); 5239 ck_assert_ptr_eq(r, null); 5240 // empty self 5241 freeO(self); 5242 r = keyBySmallBoolO(self, value); 5243 ck_assert_ptr_eq(r, null); 5244 terminateO(self); 5245 terminateO(value); 5246 5247 } 5248 5249 5250 void keyBySmallBytesSmallDictT(void) { 5251 5252 char* r; 5253 smallDictt *self = allocG(rtSmallDictt); 5254 smallBytest *value = allocSmallBytes("qwe", sizeof("qwe")); 5255 5256 smallBytest *d = allocSmallBytes("asd", sizeof("asd")); 5257 smallDictt *r2 = self->f->setNFreeSmallBytes(self, "d", d); 5258 ck_assert_ptr_ne(r2, null); 5259 r2 = self->f->setNFreeSmallBytes(self, "1", value); 5260 ck_assert_ptr_ne(r2, null); 5261 value = allocSmallBytes("qwe", sizeof("qwe")); 5262 r = keyBySmallBytesO(self, value); 5263 ck_assert_str_eq(r, "1"); 5264 // non existing object 5265 r2 = self->f->setInt(self, "1", 1); 5266 ck_assert_ptr_ne(r2, null); 5267 r = keyBySmallBytesO(self, value); 5268 ck_assert_ptr_eq(r, null); 5269 // empty value 5270 freeO(value); 5271 r = keyBySmallBytesO(self, value); 5272 ck_assert_ptr_eq(r, null); 5273 // non smallBytes object 5274 smallIntt *i = allocSmallInt(2); 5275 r = keyBySmallBytesO(self, (smallBytest*)i); 5276 terminateO(i); 5277 ck_assert_ptr_eq(r, null); 5278 // null value 5279 r = keyBySmallBytesO(self, null); 5280 ck_assert_ptr_eq(r, null); 5281 // empty self 5282 freeO(self); 5283 r = keyBySmallBytesO(self, value); 5284 ck_assert_ptr_eq(r, null); 5285 terminateO(self); 5286 terminateO(value); 5287 5288 } 5289 5290 5291 void keyBySmallDoubleSmallDictT(void) { 5292 5293 char* r; 5294 smallDictt *self = allocG(rtSmallDictt); 5295 smallDoublet *value = allocSmallDouble(2.2); 5296 5297 createAllocateSmallDouble(d); 5298 smallDictt *r2 = self->f->setNFreeSmallDouble(self, "d", d); 5299 ck_assert_ptr_ne(r2, null); 5300 r2 = self->f->setNFreeSmallDouble(self, "1", value); 5301 ck_assert_ptr_ne(r2, null); 5302 value = allocSmallDouble(2.2); 5303 r = keyBySmallDoubleO(self, value); 5304 ck_assert_str_eq(r, "1"); 5305 // non existing object 5306 r2 = self->f->setInt(self, "1", 1); 5307 ck_assert_ptr_ne(r2, null); 5308 r = keyBySmallDoubleO(self, value); 5309 ck_assert_ptr_eq(r, null); 5310 // non smallDouble object 5311 smallIntt *i = allocSmallInt(2); 5312 r = keyBySmallDoubleO(self, (smallDoublet*)i); 5313 terminateO(i); 5314 ck_assert_ptr_eq(r, null); 5315 // null value 5316 r = keyBySmallDoubleO(self, null); 5317 ck_assert_ptr_eq(r, null); 5318 // empty self 5319 freeO(self); 5320 r = keyBySmallDoubleO(self, value); 5321 ck_assert_ptr_eq(r, null); 5322 terminateO(self); 5323 terminateO(value); 5324 5325 } 5326 5327 5328 void keyBySmallIntSmallDictT(void) { 5329 5330 char* r; 5331 smallDictt *self = allocG(rtSmallDictt); 5332 smallIntt *value = allocSmallInt(2); 5333 5334 createAllocateSmallInt(d); 5335 smallDictt *r2 = self->f->setNFreeSmallInt(self, "d", d); 5336 ck_assert_ptr_ne(r2, null); 5337 r2 = self->f->setNFreeSmallInt(self, "1", value); 5338 ck_assert_ptr_ne(r2, null); 5339 value = allocSmallInt(2); 5340 r = keyBySmallIntO(self, value); 5341 ck_assert_str_eq(r, "1"); 5342 // non existing object 5343 r2 = self->f->setInt(self, "1", 1); 5344 ck_assert_ptr_ne(r2, null); 5345 r = keyBySmallIntO(self, value); 5346 ck_assert_ptr_eq(r, null); 5347 // non smallInt object 5348 smallBoolt *i = allocSmallBool(false); 5349 r = keyBySmallIntO(self, (smallIntt*)i); 5350 terminateO(i); 5351 ck_assert_ptr_eq(r, null); 5352 // null value 5353 r = keyBySmallIntO(self, null); 5354 ck_assert_ptr_eq(r, null); 5355 // empty self 5356 freeO(self); 5357 r = keyBySmallIntO(self, value); 5358 ck_assert_ptr_eq(r, null); 5359 terminateO(self); 5360 terminateO(value); 5361 5362 } 5363 5364 5365 void keyBySmallJsonSmallDictT(void) { 5366 5367 char* r; 5368 smallDictt *self = allocG(rtSmallDictt); 5369 smallJsont *value = allocSmallJson(); 5370 5371 // undefined 5372 createUndefined(u); 5373 setTopO(value, (baset*)&u); 5374 self->f->setUndefined(self, "1"); 5375 r = self->f->keyBySmallJson(self, value); 5376 ck_assert_str_eq(r, "1"); 5377 freeO(value); 5378 // bool 5379 setTopBoolO(value, true); 5380 self->f->setBool(self, "b", true); 5381 r = self->f->keyBySmallJson(self, value); 5382 ck_assert_str_eq(r, "b"); 5383 freeO(value); 5384 // double 5385 setTopDoubleO(value, 2.2); 5386 self->f->setDouble(self, "db", 2.2); 5387 r = self->f->keyBySmallJson(self, value); 5388 ck_assert_str_eq(r, "db"); 5389 freeO(value); 5390 // int 5391 setTopIntO(value, 2); 5392 self->f->setInt(self, "i", 2); 5393 r = self->f->keyBySmallJson(self, value); 5394 ck_assert_str_eq(r, "i"); 5395 freeO(value); 5396 // string 5397 setTopSO(value, "qwe"); 5398 self->f->setS(self, "s", "qwe"); 5399 r = self->f->keyBySmallJson(self, value); 5400 ck_assert_str_eq(r, "s"); 5401 freeO(value); 5402 // dict 5403 smallDictt *D = allocSmallDict(); 5404 setTopNFreeDictO(value, D); 5405 self->f->setNFreeDict(self, "d", allocSmallDict()); 5406 r = self->f->keyBySmallJson(self, value); 5407 ck_assert_str_eq(r, "d"); 5408 freeO(value); 5409 // array 5410 smallArrayt *a = allocSmallArray(); 5411 setTopNFreeArrayO(value, a); 5412 self->f->setNFreeArray(self, "a", allocSmallArray()); 5413 r = self->f->keyBySmallJson(self, value); 5414 ck_assert_str_eq(r, "a"); 5415 freeO(value); 5416 // empty value 5417 r = self->f->keyBySmallJson(self, value); 5418 ck_assert_ptr_eq(r, null); 5419 // non smallJson object 5420 smallIntt *i = allocSmallInt(2); 5421 r = self->f->keyBySmallJson(self, (smallJsont*)i); 5422 terminateO(i); 5423 ck_assert_ptr_eq(r, null); 5424 // null value 5425 r = self->f->keyBySmallJson(self, null); 5426 ck_assert_ptr_eq(r, null); 5427 // empty self 5428 freeO(self); 5429 r = self->f->keyBySmallJson(self, value); 5430 ck_assert_ptr_eq(r, null); 5431 terminateO(self); 5432 terminateO(value); 5433 5434 } 5435 5436 5437 void keyBySmallStringSmallDictT(void) { 5438 5439 char* r; 5440 smallDictt *self = allocG(rtSmallDictt); 5441 smallStringt *value = allocSmallString("qwe"); 5442 5443 createAllocateSmallString(d); 5444 smallDictt *r2 = self->f->setNFreeSmallString(self, "d", d); 5445 ck_assert_ptr_ne(r2, null); 5446 r2 = self->f->setNFreeSmallString(self, "1", value); 5447 ck_assert_ptr_ne(r2, null); 5448 value = allocSmallString("qwe"); 5449 r = keyBySmallStringO(self, value); 5450 ck_assert_str_eq(r, "1"); 5451 // non existing object 5452 r2 = self->f->setInt(self, "1", 1); 5453 ck_assert_ptr_ne(r2, null); 5454 r = keyBySmallStringO(self, value); 5455 ck_assert_ptr_eq(r, null); 5456 // empty value 5457 freeO(value); 5458 r = keyBySmallStringO(self, value); 5459 ck_assert_ptr_eq(r, null); 5460 // non smallString object 5461 smallIntt *i = allocSmallInt(2); 5462 r = keyBySmallStringO(self, (smallStringt*)i); 5463 terminateO(i); 5464 ck_assert_ptr_eq(r, null); 5465 // null value 5466 r = keyBySmallStringO(self, null); 5467 ck_assert_ptr_eq(r, null); 5468 // empty self 5469 freeO(self); 5470 r = keyBySmallStringO(self, value); 5471 ck_assert_ptr_eq(r, null); 5472 terminateO(self); 5473 terminateO(value); 5474 5475 } 5476 5477 5478 void keyBySmallContainerSmallDictT(void) { 5479 5480 char* r; 5481 smallDictt *self = allocG(rtSmallDictt); 5482 smallContainert *value = allocSmallContainer(null); 5483 5484 createAllocateSmallString(d); 5485 smallDictt *r2 = self->f->setNFreeSmallString(self, "d", d); 5486 ck_assert_ptr_ne(r2, null); 5487 r = keyBySmallContainerO(self, value); 5488 ck_assert_ptr_eq(r, null); 5489 // non smallContainer object 5490 smallIntt *i = allocSmallInt(2); 5491 r = keyBySmallContainerO(self, (smallContainert*)i); 5492 terminateO(i); 5493 ck_assert_ptr_eq(r, null); 5494 // null value 5495 r = keyBySmallContainerO(self, null); 5496 ck_assert_ptr_eq(r, null); 5497 // empty self 5498 freeO(self); 5499 r = keyBySmallContainerO(self, value); 5500 ck_assert_ptr_eq(r, null); 5501 terminateO(self); 5502 terminateO(value); 5503 5504 } 5505 5506 5507 void icKeyBySmallDictT(void) { 5508 5509 char* r; 5510 smallDictt *self = allocG(rtSmallDictt); 5511 baset *value; 5512 5513 smallDictt *r2 = self->f->setS(self, "1", "QQ"); 5514 ck_assert_ptr_ne(r2, null); 5515 value = (baset*) allocSmallString("qq"); 5516 r = icKeyByO(self, value); 5517 ck_assert_str_eq(r, "1"); 5518 // non existing object 5519 smallIntt *i = allocSmallInt(2); 5520 r = icKeyByO(self, (baset*)i); 5521 terminateO(i); 5522 ck_assert_ptr_eq(r, null); 5523 // null value 5524 r = icKeyByO(self, null); 5525 ck_assert_ptr_eq(r, null); 5526 // empty self 5527 freeO(self); 5528 r = icKeyByO(self, value); 5529 ck_assert_ptr_eq(r, null); 5530 terminateO(self); 5531 terminateO(value); 5532 5533 } 5534 5535 5536 void icKeyBySSmallDictT(void) { 5537 5538 char* r; 5539 smallDictt *self = allocG(rtSmallDictt); 5540 5541 smallDictt *r2 = self->f->setS(self, "1", "qwe"); 5542 ck_assert_ptr_ne(r2, null); 5543 r = icKeyBySO(self, "QWE"); 5544 ck_assert_str_eq(r, "1"); 5545 // non existing object 5546 r2 = self->f->setInt(self, "1", 1); 5547 ck_assert_ptr_ne(r2, null); 5548 r = icKeyBySO(self, "qwe"); 5549 ck_assert_ptr_eq(r, null); 5550 // null value 5551 r = icKeyBySO(self, null); 5552 ck_assert_ptr_eq(r, null); 5553 // empty self 5554 freeO(self); 5555 r = icKeyBySO(self, "qwe"); 5556 ck_assert_ptr_eq(r, null); 5557 terminateO(self); 5558 5559 } 5560 5561 5562 void icKeyByCharSmallDictT(void) { 5563 5564 char* r; 5565 smallDictt *self = allocG(rtSmallDictt); 5566 5567 smallDictt *r2 = self->f->setS(self, "1", "q"); 5568 ck_assert_ptr_ne(r2, null); 5569 r = icKeyByCharO(self, 'Q'); 5570 ck_assert_str_eq(r, "1"); 5571 // non existing object 5572 r2 = self->f->setInt(self, "1", 1); 5573 ck_assert_ptr_ne(r2, null); 5574 r = icKeyByCharO(self, 'q'); 5575 ck_assert_ptr_eq(r, null); 5576 // empty self 5577 freeO(self); 5578 r = icKeyByCharO(self, 'q'); 5579 ck_assert_ptr_eq(r, null); 5580 terminateO(self); 5581 5582 } 5583 5584 5585 void icKeyByDictSmallDictT(void) { 5586 5587 char* r; 5588 smallDictt *self = allocG(rtSmallDictt); 5589 smallDictt *dict = allocSmallDict(); 5590 5591 createAllocateSmallDict(d); 5592 d->f->setS(d, "another", "dict"); 5593 smallDictt *r2 = self->f->setNFreeDict(self, "d", d); 5594 ck_assert_ptr_ne(r2, null); 5595 dict->f->setS(dict, "asd", "asd"); 5596 r2 = self->f->setNFreeDict(self, "1", dict); 5597 ck_assert_ptr_ne(r2, null); 5598 dict = allocSmallDict(); 5599 dict->f->setS(dict, "ASD", "asd"); 5600 r = icKeyByDictO(self, dict); 5601 ck_assert_str_eq(r, "1"); 5602 // non existing object 5603 r2 = self->f->setInt(self, "1", 1); 5604 ck_assert_ptr_ne(r2, null); 5605 r = icKeyByDictO(self, dict); 5606 ck_assert_ptr_eq(r, null); 5607 // non smallDict object 5608 smallIntt *i = allocSmallInt(2); 5609 r = icKeyByDictO(self, (smallDictt*)i); 5610 terminateO(i); 5611 ck_assert_ptr_eq(r, null); 5612 // null value 5613 r = icKeyByDictO(self, null); 5614 ck_assert_ptr_eq(r, null); 5615 // empty self 5616 freeO(self); 5617 r = icKeyByDictO(self, dict); 5618 ck_assert_ptr_eq(r, null); 5619 terminateO(self); 5620 terminateO(dict); 5621 5622 } 5623 5624 5625 void icKeyByArraySmallDictT(void) { 5626 5627 char* r; 5628 smallDictt *self = allocG(rtSmallDictt); 5629 smallArrayt *array = allocSmallArray(); 5630 5631 createAllocateSmallArray(d); 5632 d->f->pushS(d, "another array"); 5633 smallDictt *r2 = self->f->setNFreeArray(self, "d", d); 5634 ck_assert_ptr_ne(r2, null); 5635 array->f->pushS(array, "the array"); 5636 r2 = self->f->setNFreeArray(self, "1", array); 5637 ck_assert_ptr_ne(r2, null); 5638 array = allocSmallArray(); 5639 array->f->pushS(array, "The array"); 5640 r = icKeyByArrayO(self, array); 5641 ck_assert_str_eq(r, "1"); 5642 // non existing object 5643 r2 = self->f->setInt(self, "1", 1); 5644 ck_assert_ptr_ne(r2, null); 5645 r = icKeyByArrayO(self, array); 5646 ck_assert_ptr_eq(r, null); 5647 // non smallArray object 5648 smallIntt *i = allocSmallInt(2); 5649 r = icKeyByArrayO(self, (smallArrayt*)i); 5650 terminateO(i); 5651 ck_assert_ptr_eq(r, null); 5652 // null value 5653 r = icKeyByArrayO(self, null); 5654 ck_assert_ptr_eq(r, null); 5655 // empty self 5656 freeO(self); 5657 r = icKeyByArrayO(self, array); 5658 ck_assert_ptr_eq(r, null); 5659 terminateO(self); 5660 terminateO(array); 5661 5662 } 5663 5664 5665 void icKeyByArraycSmallDictT(void) { 5666 5667 char* r; 5668 smallDictt *self = allocG(rtSmallDictt); 5669 char **array = listCreateS("a","b"); 5670 5671 char **d = listCreateS("asd", "zxcv"); 5672 smallDictt *r2 = self->f->setNFreeArrayc(self, "d", d); 5673 ck_assert_ptr_ne(r2, null); 5674 r2 = self->f->setArrayc(self, "1", array); 5675 ck_assert_ptr_ne(r2, null); 5676 iUpperS(&array[0]); 5677 r = icKeyByArraycO(self, array); 5678 ck_assert_ptr_ne(r, NULL); 5679 ck_assert_str_eq(r, "1"); 5680 // non existing object 5681 r2 = self->f->setInt(self, "1", 1); 5682 ck_assert_ptr_ne(r2, null); 5683 r = icKeyByArraycO(self, array); 5684 ck_assert_ptr_eq(r, null); 5685 // null value 5686 r = icKeyByArraycO(self, null); 5687 ck_assert_ptr_eq(r, null); 5688 // empty self 5689 freeO(self); 5690 r = icKeyByArraycO(self, array); 5691 ck_assert_ptr_eq(r, null); 5692 terminateO(self); 5693 listFreeS(array); 5694 5695 } 5696 5697 5698 void icKeyBySmallJsonSmallDictT(void) { 5699 5700 char* r; 5701 smallDictt *self = allocG(rtSmallDictt); 5702 smallJsont *value = allocSmallJson(); 5703 5704 // undefined 5705 createUndefined(u); 5706 setTopO(value, (baset*)&u); 5707 self->f->setUndefined(self, "1"); 5708 r = self->f->icKeyBySmallJson(self, value); 5709 ck_assert_str_eq(r, "1"); 5710 freeO(value); 5711 // bool 5712 setTopBoolO(value, true); 5713 self->f->setBool(self, "b", true); 5714 r = self->f->icKeyBySmallJson(self, value); 5715 ck_assert_str_eq(r, "b"); 5716 freeO(value); 5717 // double 5718 setTopDoubleO(value, 2.2); 5719 self->f->setDouble(self, "db", 2.2); 5720 r = self->f->icKeyBySmallJson(self, value); 5721 ck_assert_str_eq(r, "db"); 5722 freeO(value); 5723 // int 5724 setTopIntO(value, 2); 5725 self->f->setInt(self, "i", 2); 5726 r = self->f->icKeyBySmallJson(self, value); 5727 ck_assert_str_eq(r, "i"); 5728 freeO(value); 5729 // string 5730 setTopSO(value, "qwe"); 5731 self->f->setS(self, "s", "QWE"); 5732 r = self->f->icKeyBySmallJson(self, value); 5733 ck_assert_str_eq(r, "s"); 5734 freeO(value); 5735 // dict 5736 smallDictt *D = allocSmallDict(); 5737 D->f->setS(D, "q", "wee"); 5738 setTopNFreeDictO(value, D); 5739 D = allocSmallDict(); 5740 D->f->setS(D, "Q", "wee"); 5741 self->f->setNFreeDict(self, "d", D); 5742 r = self->f->icKeyBySmallJson(self, value); 5743 ck_assert_str_eq(r, "d"); 5744 freeO(value); 5745 // array 5746 smallArrayt *a = allocSmallArray(); 5747 a->f->pushS(a, "QWE"); 5748 setTopNFreeArrayO(value, a); 5749 a = allocSmallArray(); 5750 a->f->pushS(a, "qwe"); 5751 self->f->setNFreeArray(self, "a", a); 5752 r = self->f->icKeyBySmallJson(self, value); 5753 ck_assert_str_eq(r, "a"); 5754 freeO(value); 5755 // empty value 5756 r = self->f->icKeyBySmallJson(self, value); 5757 ck_assert_ptr_eq(r, null); 5758 // non smallJson object 5759 smallIntt *i = allocSmallInt(2); 5760 r = self->f->icKeyBySmallJson(self, (smallJsont*)i); 5761 terminateO(i); 5762 ck_assert_ptr_eq(r, null); 5763 // null value 5764 r = self->f->icKeyBySmallJson(self, null); 5765 ck_assert_ptr_eq(r, null); 5766 // empty self 5767 freeO(self); 5768 r = self->f->icKeyBySmallJson(self, value); 5769 ck_assert_ptr_eq(r, null); 5770 terminateO(self); 5771 terminateO(value); 5772 5773 } 5774 5775 5776 void icKeyBySmallStringSmallDictT(void) { 5777 5778 char* r; 5779 smallDictt *self = allocG(rtSmallDictt); 5780 smallStringt *value = allocSmallString("qwe"); 5781 5782 createAllocateSmallString(d); 5783 smallDictt *r2 = self->f->setNFreeSmallString(self, "d", d); 5784 ck_assert_ptr_ne(r2, null); 5785 r2 = self->f->setNFreeSmallString(self, "1", value); 5786 ck_assert_ptr_ne(r2, null); 5787 value = allocSmallString("QWE"); 5788 r = icKeyBySmallStringO(self, value); 5789 ck_assert_str_eq(r, "1"); 5790 // non existing object 5791 r2 = self->f->setInt(self, "1", 1); 5792 ck_assert_ptr_ne(r2, null); 5793 r = icKeyBySmallStringO(self, value); 5794 ck_assert_ptr_eq(r, null); 5795 // empty value 5796 freeO(value); 5797 r = icKeyBySmallStringO(self, value); 5798 ck_assert_ptr_eq(r, null); 5799 // non smallString object 5800 smallIntt *i = allocSmallInt(2); 5801 r = icKeyBySmallStringO(self, (smallStringt*)i); 5802 terminateO(i); 5803 ck_assert_ptr_eq(r, null); 5804 // null value 5805 r = icKeyBySmallStringO(self, null); 5806 ck_assert_ptr_eq(r, null); 5807 // empty self 5808 freeO(self); 5809 r = icKeyBySmallStringO(self, value); 5810 ck_assert_ptr_eq(r, null); 5811 terminateO(self); 5812 terminateO(value); 5813 5814 } 5815 5816 5817 void trimSmallDictT(void) { 5818 5819 smallDictt* r; 5820 smallDictt *self = allocG(rtSmallDictt); 5821 5822 self->f->setS(self, "1", "2"); 5823 self->f->setS(self, "3", "4"); 5824 self->f->del(self, "3"); 5825 r = trimO(self); 5826 ck_assert_ptr_ne(r, null); 5827 ck_assert_int_eq(lenO(self), 1); 5828 char *s = toStringO(r); 5829 ck_assert_str_eq(s, "{\"1\":\"2\"}"); 5830 free(s); 5831 self->f->del(self, "1"); 5832 r = trimO(self); 5833 ck_assert_ptr_ne(r, null); 5834 ck_assert_int_eq(lenO(self), 0); 5835 s = toStringO(r); 5836 ck_assert_str_eq(s, "{}"); 5837 free(s); 5838 terminateO(self); 5839 5840 } 5841 5842 5843 void keysSmallStringSmallDictT(void) { 5844 5845 smallArrayt* r; 5846 smallDictt *self = allocG(rtSmallDictt); 5847 5848 self->f->setS(self, "1", "2"); 5849 self->f->setS(self, "3", "4"); 5850 r = keysSmallStringO(self); 5851 ck_assert_ptr_ne(r, null); 5852 char *s = toStringO(r); 5853 ck_assert_str_eq(s, "[\"1\",\"3\"]"); 5854 free(s); 5855 terminateO(r); 5856 // empty self 5857 freeO(self); 5858 r = keysSmallStringO(self); 5859 ck_assert_ptr_ne(r, null); 5860 s = toStringO(r); 5861 ck_assert_str_eq(s, "[]"); 5862 free(s); 5863 terminateO(r); 5864 terminateO(self); 5865 5866 } 5867 5868 5869 void mergeSmallJsonSmallDictT(void) { 5870 5871 smallDictt* r; 5872 smallDictt *self = allocG(rtSmallDictt); 5873 smallJsont *json = allocSmallJson(); 5874 5875 self->f->setS(self, "1", "2"); 5876 self->f->setS(self, "3", "4"); 5877 json->f->setS(json, "3", "#"); 5878 json->f->setInt(json, "4", 0); 5879 r = self->f->mergeSmallJson(self, json); 5880 ck_assert_ptr_ne(r, null); 5881 char *s = toStringO(r); 5882 ck_assert_str_eq(s, "{\"1\":\"2\",\"3\":\"#\",\"4\":0}"); 5883 free(s); 5884 // empty json dict 5885 disposeO(json); 5886 json->f->setS(json, "a", "s"); 5887 delElemO(json, "a"); 5888 trimO(json); 5889 r = self->f->mergeSmallJson(self, json); 5890 ck_assert_ptr_eq(r, self); 5891 // non json dict 5892 freeO(json); 5893 setTopSO(json, "qwe"); 5894 r = self->f->mergeSmallJson(self, json); 5895 ck_assert_ptr_eq(r, null); 5896 // non smallJson object 5897 createAllocateSmallInt(i); 5898 r = self->f->mergeSmallJson(self, (smallJsont*)i); 5899 ck_assert_ptr_eq(r, null); 5900 terminateO(i); 5901 // null 5902 r = self->f->mergeSmallJson(self, null); 5903 ck_assert_ptr_eq(r, null); 5904 terminateO(self); 5905 terminateO(json); 5906 5907 } 5908 5909 5910 void mergeNSmashSmallDictT(void) { 5911 5912 smallDictt* r; 5913 smallDictt *self = allocG(rtSmallDictt); 5914 smallDictt *value = allocSmallDict(); 5915 5916 self->f->setS(self, "1", "2"); 5917 self->f->setS(self, "3", "4"); 5918 value->f->setS(value, "3", "#"); 5919 value->f->setInt(value, "4", 0); 5920 r = self->f->mergeNSmash(self, value); 5921 ck_assert_ptr_ne(r, null); 5922 char *s = toStringO(r); 5923 ck_assert_str_eq(s, "{\"1\":\"2\",\"3\":\"#\",\"4\":0}"); 5924 free(s); 5925 // empty dict 5926 value = allocSmallDict(); 5927 r = self->f->mergeNSmash(self, value); 5928 ck_assert_ptr_eq(r, self); 5929 // non smallDict object 5930 createAllocateSmallInt(i); 5931 r = self->f->mergeNSmash(self, (smallDictt*)i); 5932 ck_assert_ptr_eq(r, null); 5933 terminateO(i); 5934 // null 5935 r = self->f->mergeNSmash(self, null); 5936 ck_assert_ptr_eq(r, null); 5937 terminateO(self); 5938 5939 } 5940 5941 5942 void mergeNSmashSmallJsonSmallDictT(void) { 5943 5944 smallDictt* r; 5945 smallDictt *self = allocG(rtSmallDictt); 5946 smallJsont *value = allocSmallJson(); 5947 5948 self->f->setS(self, "1", "2"); 5949 self->f->setS(self, "3", "4"); 5950 value->f->setS(value, "3", "#"); 5951 value->f->setInt(value, "4", 0); 5952 r = self->f->mergeNSmashSmallJson(self, value); 5953 ck_assert_ptr_ne(r, null); 5954 char *s = toStringO(r); 5955 ck_assert_str_eq(s, "{\"1\":\"2\",\"3\":\"#\",\"4\":0}"); 5956 free(s); 5957 // empty json dict 5958 value = allocSmallJson(); 5959 value->f->setS(value, "a", "s"); 5960 delElemO(value, "a"); 5961 trimO(value); 5962 r = self->f->mergeNSmashSmallJson(self, value); 5963 ck_assert_ptr_eq(r, self); 5964 // non smallDict object 5965 createAllocateSmallInt(i); 5966 r = self->f->mergeNSmashSmallJson(self, (smallJsont*)i); 5967 ck_assert_ptr_eq(r, null); 5968 terminateO(i); 5969 // null 5970 r = self->f->mergeNSmashSmallJson(self, null); 5971 ck_assert_ptr_eq(r, null); 5972 terminateO(self); 5973 5974 } 5975 5976 5977 void appendNSmashSmallDictT(void) { 5978 5979 smallDictt* r; 5980 smallDictt *self = allocG(rtSmallDictt); 5981 smallDictt *value = allocSmallDict(); 5982 5983 self->f->setS(self, "1", "2"); 5984 self->f->setS(self, "3", "4"); 5985 value->f->setS(value, "3", "#"); 5986 value->f->setInt(value, "4", 0); 5987 smallt *data = sDictGetTiny(value->d, "3"); 5988 r = self->f->appendNSmash(self, value); 5989 ck_assert_ptr_ne(r, null); 5990 sFree(data); 5991 char *s = toStringO(r); 5992 ck_assert_str_eq(s, "{\"1\":\"2\",\"3\":\"4\",\"4\":0}"); 5993 free(s); 5994 // empty dict 5995 value = allocSmallDict(); 5996 r = self->f->appendNSmash(self, value); 5997 ck_assert_ptr_eq(r, self); 5998 // non smallDict object 5999 createAllocateSmallInt(i); 6000 r = self->f->appendNSmash(self, (smallDictt*)i); 6001 ck_assert_ptr_eq(r, null); 6002 terminateO(i); 6003 // null 6004 r = self->f->appendNSmash(self, null); 6005 ck_assert_ptr_eq(r, null); 6006 terminateO(self); 6007 6008 } 6009 6010 6011 void equalSmallDictBaseT(void) { 6012 6013 bool r; 6014 smallDictt* self = allocG(rtSmallDictt); 6015 6016 createAllocateSmallDict(d); 6017 r = self->f->equalBase(self, (baset*)d); 6018 ck_assert(!r); 6019 terminateO(d); 6020 // non smallDict 6021 createAllocateSmallInt(i); 6022 r = self->f->equalBase(self, (baset*)i); 6023 terminateO(i); 6024 ck_assert(!r); 6025 // null 6026 r = self->f->equalBase(self, null); 6027 ck_assert(!r); 6028 terminateO(self); 6029 6030 } 6031 6032 6033 void equalSmallDictSmallJsonT(void) { 6034 6035 bool r; 6036 smallDictt* self = allocG(rtSmallDictt); 6037 smallJsont* p2 = allocSmallJson(); 6038 6039 self->f->setS(self, "3", "#"); 6040 p2->f->setS(p2, "3", "#"); 6041 r = self->f->equalSmallJson(self, p2); 6042 ck_assert(r); 6043 // non json dict 6044 freeO(self); 6045 freeO(p2); 6046 r = self->f->equalSmallJson(self, p2); 6047 ck_assert(!r); 6048 terminateO(p2); 6049 // non smallJson 6050 createAllocateSmallInt(i); 6051 r = self->f->equalSmallJson(self, (smallJsont*)i); 6052 terminateO(i); 6053 ck_assert(!r); 6054 // null 6055 r = self->f->equalSmallJson(self, null); 6056 ck_assert(!r); 6057 terminateO(self); 6058 6059 } 6060 6061 6062 void equalSmallDictT(void) { 6063 6064 bool r; 6065 smallDictt* self = allocG(rtSmallDictt); 6066 smallDictt* p2 = allocSmallDict(); 6067 6068 self->f->setS(self, "3", "#"); 6069 p2->f->setS(p2, "3", "#"); 6070 r = self->f->equal(self, p2); 6071 ck_assert(r); 6072 // not equal 6073 self->f->setS(self, "4", "#"); 6074 p2->f->setS(p2, "4", "$"); 6075 r = self->f->equal(self, p2); 6076 ck_assert(!r); 6077 // different keys 6078 self->f->del(self, "4"); 6079 self->f->setS(self, "$", "#"); 6080 r = self->f->equal(self, p2); 6081 ck_assert(!r); 6082 // different key count 6083 p2->f->del(p2, "4"); 6084 r = self->f->equal(self, p2); 6085 ck_assert(!r); 6086 // empty dict 6087 freeO(p2); 6088 r = self->f->equal(self, p2); 6089 ck_assert(!r); 6090 terminateO(p2); 6091 // non smallDict 6092 createAllocateSmallInt(i); 6093 r = self->f->equal(self, (smallDictt*)i); 6094 terminateO(i); 6095 ck_assert(!r); 6096 // null 6097 r = self->f->equal(self, null); 6098 ck_assert(!r); 6099 terminateO(self); 6100 6101 } 6102 6103 6104 void icEqualSmallDictBaseT(void) { 6105 6106 bool r; 6107 smallDictt* self = allocG(rtSmallDictt); 6108 6109 createAllocateSmallDict(d); 6110 self->f->setS(self, "q", "q"); 6111 d->f->setS(d, "q", "Q"); 6112 r = self->f->icEqualBase(self, (baset*)d); 6113 ck_assert(r); 6114 terminateO(d); 6115 // non smallDict 6116 createAllocateSmallInt(i); 6117 r = self->f->icEqualBase(self, (baset*)i); 6118 terminateO(i); 6119 ck_assert(!r); 6120 // null 6121 r = self->f->icEqualBase(self, null); 6122 ck_assert(!r); 6123 terminateO(self); 6124 6125 } 6126 6127 6128 void icEqualSmallDictSmallJsonT(void) { 6129 6130 bool r; 6131 smallDictt* self = allocG(rtSmallDictt); 6132 smallJsont* p2 = allocSmallJson(); 6133 6134 self->f->setS(self, "3", "W"); 6135 p2->f->setS(p2, "3", "w"); 6136 r = self->f->icEqualSmallJson(self, p2); 6137 ck_assert(r); 6138 // non json dict 6139 freeO(self); 6140 freeO(p2); 6141 r = self->f->icEqualSmallJson(self, p2); 6142 ck_assert(!r); 6143 terminateO(p2); 6144 // non smallJson 6145 createAllocateSmallInt(i); 6146 r = self->f->icEqualSmallJson(self, (smallJsont*)i); 6147 terminateO(i); 6148 ck_assert(!r); 6149 // null 6150 r = self->f->icEqualSmallJson(self, null); 6151 ck_assert(!r); 6152 terminateO(self); 6153 6154 } 6155 6156 6157 void icEqualSmallDictT(void) { 6158 6159 bool r; 6160 smallDictt* self = allocG(rtSmallDictt); 6161 smallDictt* p2 = allocSmallDict(); 6162 6163 self->f->setS(self, "3", "A"); 6164 p2->f->setS(p2, "3", "a"); 6165 r = self->f->icEqual(self, p2); 6166 ck_assert(r); 6167 // not equal 6168 self->f->setS(self, "4", "#"); 6169 p2->f->setS(p2, "4", "$"); 6170 r = self->f->icEqual(self, p2); 6171 ck_assert(!r); 6172 // different keys 6173 self->f->del(self, "4"); 6174 self->f->setS(self, "$", "#"); 6175 r = self->f->icEqual(self, p2); 6176 ck_assert(!r); 6177 // different key count 6178 p2->f->del(p2, "4"); 6179 r = self->f->icEqual(self, p2); 6180 ck_assert(!r); 6181 // empty dict 6182 freeO(p2); 6183 r = self->f->icEqual(self, p2); 6184 ck_assert(!r); 6185 terminateO(p2); 6186 // non smallDict 6187 createAllocateSmallInt(i); 6188 r = self->f->icEqual(self, (smallDictt*)i); 6189 terminateO(i); 6190 ck_assert(!r); 6191 // null 6192 r = self->f->icEqual(self, null); 6193 ck_assert(!r); 6194 terminateO(self); 6195 6196 } 6197 6198 6199 void isEmptySmallDictT(void) { 6200 6201 bool r; 6202 smallDictt *self = allocG(rtSmallDictt); 6203 6204 r = isEmptyO(self); 6205 ck_assert(r); 6206 self->f->setInt(self, "a", 1); 6207 r = isEmptyO(self); 6208 ck_assert(!r); 6209 self->f->del(self, "a"); 6210 r = isEmptyO(self); 6211 ck_assert(r); 6212 terminateO(self); 6213 6214 } 6215 6216 bool enumerateElement(void *closure, char *key UNUSED, baset *element UNUSED) { 6217 int *c = closure; 6218 (*c)++; 6219 return *c != 2 ? true : false; 6220 } 6221 6222 void enumerateSmallDictFT(void) { 6223 6224 smallDictt *self = allocG(rtSmallDictt); 6225 int closure = 0; 6226 6227 self->f->enumerate(self, &closure, enumerateElement); 6228 self->f->setInt(self, "a", 1); 6229 self->f->setInt(self, "b", 2); 6230 self->f->setInt(self, "c", 3); 6231 self->f->del(self, "a"); 6232 self->f->enumerate(self, &closure, enumerateElement); 6233 ck_assert_int_eq(closure, 2); 6234 // baset object in container 6235 closure = -2; 6236 smallIntt *i = allocSmallInt(2); 6237 i->type = "randomClass"; 6238 self->f->set(self, "d", (baset*)i); 6239 i = allocSmallInt(3); 6240 i->type = "randomClass"; 6241 self->f->set(self, "e", (baset*)i); 6242 self->f->enumerate(self, &closure, enumerateElement); 6243 ck_assert_int_eq(closure, 2); 6244 terminateO(self); 6245 6246 } 6247 6248 6249 void iterStartSmallDictT(void) { 6250 6251 baset* r; 6252 smallDictt *self = allocG(rtSmallDictt); 6253 6254 // dict with keys and values 6255 self->f->setInt(self, "a", 1); 6256 self->f->setInt(self, "b", 2); 6257 r = iterStartO(self); 6258 ck_assert_ptr_ne(r, NULL); 6259 ck_assert(isOSmallInt(r)); 6260 // dict with objects from other classes 6261 emptyO(self); 6262 smallIntt *ip = allocSmallInt(2); 6263 ip->type = "anothertype"; 6264 self->f->set(self, "d", (baset*)ip); 6265 r = iterStartO(self); 6266 ck_assert_ptr_ne(r, NULL); 6267 // dict with deleted elements 6268 self->f->setInt(self, "a", 1); 6269 self->f->del(self, "d"); 6270 r = iterStartO(self); 6271 ck_assert_ptr_ne(r, NULL); 6272 // call iterStart again to trigger if (self->iterElementDataType != SH_DT_BASET) finishO(self->iterElement); 6273 r = iterStartO(self); 6274 ck_assert_ptr_ne(r, NULL); 6275 // empty self 6276 emptyO(self); 6277 r = iterStartO(self); 6278 ck_assert_ptr_eq(r, NULL); 6279 terminateO(self); 6280 6281 } 6282 6283 6284 void iterStartKeySmallDictT(void) { 6285 6286 const char* r; 6287 smallDictt *self = allocG(rtSmallDictt); 6288 6289 // dict with keys and values 6290 self->f->setInt(self, "a", 1); 6291 self->f->setInt(self, "b", 2); 6292 r = iterStartKeyO(self); 6293 ck_assert_ptr_ne(r, NULL); 6294 ck_assert_str_eq(r, "a"); 6295 // dict with objects from other classes 6296 emptyO(self); 6297 smallIntt *ip = allocSmallInt(2); 6298 ip->type = "anothertype"; 6299 self->f->set(self, "d", (baset*)ip); 6300 r = iterStartKeyO(self); 6301 ck_assert_ptr_ne(r, NULL); 6302 ck_assert_str_eq(r, "d"); 6303 // dict with deleted elements 6304 self->f->setInt(self, "a", 1); 6305 self->f->del(self, "d"); 6306 r = iterStartKeyO(self); 6307 ck_assert_ptr_ne(r, NULL); 6308 ck_assert_str_eq(r, "a"); 6309 // call iterStart again to trigger if (self->iterElementDataType != SH_DT_BASET) finishO(self->iterElement); 6310 r = iterStartKeyO(self); 6311 ck_assert_ptr_ne(r, NULL); 6312 ck_assert_str_eq(r, "a"); 6313 // empty self 6314 emptyO(self); 6315 r = iterStartKeyO(self); 6316 ck_assert_ptr_eq(r, NULL); 6317 terminateO(self); 6318 6319 } 6320 6321 6322 void iterNextSmallDictT(void) { 6323 6324 baset* r; 6325 smallDictt *self = allocG(rtSmallDictt); 6326 6327 // dict with keys and values 6328 self->f->setInt(self, "a", 1); 6329 self->f->setInt(self, "b", 2); 6330 r = iterStartO(self); 6331 ck_assert_ptr_ne(r, NULL); 6332 ck_assert(isOSmallInt(r)); 6333 smallIntt *i = (smallIntt*)r; 6334 ck_assert_int_eq(getValO(i), 1); 6335 r = iterNextO(self); 6336 ck_assert_ptr_ne(r, NULL); 6337 ck_assert(isOSmallInt(r)); 6338 i = (smallIntt*)r; 6339 ck_assert_int_eq(getValO(i), 2); 6340 // dict with objects from other classes 6341 emptyO(self); 6342 smallIntt *ip = allocSmallInt(2); 6343 ip->type = "anothertype"; 6344 self->f->set(self, "d", (baset*)ip); 6345 self->f->setInt(self, "a", 1); 6346 ip = allocSmallInt(3); 6347 ip->type = "anothertype2"; 6348 self->f->set(self, "e", (baset*)ip); 6349 self->f->setInt(self, "b", 2); 6350 self->f->del(self, "a"); 6351 self->f->del(self, "b"); 6352 r = iterStartO(self); 6353 ck_assert_ptr_ne(r, NULL); 6354 ck_assert(isOType(r, "anothertype")); 6355 r = iterNextO(self); 6356 ck_assert_ptr_ne(r, NULL); 6357 ck_assert(isOType(r, "anothertype2")); 6358 // iteration ended 6359 r = iterNextO(self); 6360 ck_assert_ptr_eq(r, NULL); 6361 // empty self, uninitialized iterator 6362 emptyO(self); 6363 r = iterNextO(self); 6364 ck_assert_ptr_eq(r, NULL); 6365 terminateO(self); 6366 6367 } 6368 6369 6370 void iterNextKeySmallDictT(void) { 6371 6372 const char* r; 6373 smallDictt *self = allocG(rtSmallDictt); 6374 6375 // dict with keys and values 6376 self->f->setInt(self, "a", 1); 6377 self->f->setInt(self, "b", 2); 6378 r = iterStartKeyO(self); 6379 ck_assert_ptr_ne(r, NULL); 6380 ck_assert_str_eq(r, "a"); 6381 r = iterNextKeyO(self); 6382 ck_assert_ptr_ne(r, NULL); 6383 ck_assert_str_eq(r, "b"); 6384 // dict with objects from other classes 6385 emptyO(self); 6386 smallIntt *ip = allocSmallInt(2); 6387 ip->type = "anothertype"; 6388 self->f->set(self, "d", (baset*)ip); 6389 self->f->setInt(self, "a", 1); 6390 ip = allocSmallInt(3); 6391 ip->type = "anothertype2"; 6392 self->f->set(self, "e", (baset*)ip); 6393 self->f->setInt(self, "b", 2); 6394 self->f->del(self, "a"); 6395 self->f->del(self, "b"); 6396 r = iterStartKeyO(self); 6397 ck_assert_ptr_ne(r, NULL); 6398 ck_assert_str_eq(r, "d"); 6399 r = iterNextKeyO(self); 6400 ck_assert_ptr_ne(r, NULL); 6401 ck_assert_str_eq(r, "e"); 6402 // iteration ended 6403 r = iterNextKeyO(self); 6404 ck_assert_ptr_eq(r, NULL); 6405 // empty self 6406 emptyO(self); 6407 r = iterNextKeyO(self); 6408 ck_assert_ptr_eq(r, NULL); 6409 terminateO(self); 6410 6411 } 6412 6413 6414 void iterElementSmallDictT(void) { 6415 6416 baset* r; 6417 smallDictt *self = allocG(rtSmallDictt); 6418 6419 self->f->setInt(self, "a", 1); 6420 r = iterStartO(self); 6421 ck_assert_ptr_ne(r, NULL); 6422 r = iterElementO(self); 6423 ck_assert_ptr_ne(r, NULL); 6424 char *s = toStringO(r); 6425 ck_assert_str_eq(s, "1"); 6426 free(s); 6427 // empty self 6428 freeO(self); 6429 r = iterElementO(self); 6430 ck_assert_ptr_eq(r, NULL); 6431 terminateO(self); 6432 6433 } 6434 6435 6436 void iterKeySmallDictT(void) { 6437 6438 const char* r; 6439 smallDictt *self = allocG(rtSmallDictt); 6440 6441 self->f->setInt(self, "a", 1); 6442 baset *r2 = iterStartO(self); 6443 ck_assert_ptr_ne(r2, NULL); 6444 r = iterKeyO(self); 6445 ck_assert_ptr_ne(r, NULL); 6446 ck_assert_str_eq(r, "a"); 6447 // empty self 6448 freeO(self); 6449 r = iterKeyO(self); 6450 ck_assert_ptr_eq(r, NULL); 6451 terminateO(self); 6452 6453 } 6454 6455 6456 void zipSmallDictT(void) { 6457 6458 smallDictt* r; 6459 smallDictt *self = allocG(rtSmallDictt); 6460 smallArrayt *keys = allocSmallArray(); 6461 smallArrayt *values = allocSmallArray(); 6462 6463 self->f->setInt(self, "", 1); 6464 // 3 elements in keys 6465 // 2 elements in values 6466 // only 2 key/values are zipped 6467 keys->f->pushS(keys, "a"); 6468 keys->f->pushS(keys, "b"); 6469 keys->f->pushS(keys, "c"); 6470 values->f->pushInt(values, 1); 6471 values->f->pushInt(values, 2); 6472 r = zipO(self, keys, values); 6473 terminateO(keys); 6474 smashO(values); 6475 ck_assert_ptr_ne(r, NULL); 6476 char *s = toStringO(r); 6477 ck_assert_str_eq(s, "{\"\":1,\"a\":1,\"b\":2}"); 6478 free(s); 6479 // keys array with non string objects 6480 keys = allocSmallArray(); 6481 values = allocSmallArray(); 6482 keys->f->pushInt(keys, 1); 6483 values->f->pushInt(values, 1); 6484 r = zipO(self, keys, values); 6485 ck_assert_ptr_eq(r, NULL); 6486 terminateO(keys); 6487 terminateO(values); 6488 // empty values 6489 keys = allocSmallArray(); 6490 values = allocSmallArray(); 6491 keys->f->pushInt(keys, 1); 6492 r = zipO(self, keys, values); 6493 ck_assert_ptr_eq(r, self); 6494 terminateO(keys); 6495 // non smallArray object 6496 keys = (smallArrayt*) allocSmallInt(1); 6497 r = zipO(self, keys, values); 6498 ck_assert_ptr_eq(r, null); 6499 terminateO(keys); 6500 keys = allocSmallArray(); 6501 terminateO(values); 6502 values = (smallArrayt*) allocSmallInt(2); 6503 r = zipO(self, keys, values); 6504 ck_assert_ptr_eq(r, null); 6505 // null 6506 r = zipO(self, null, values); 6507 ck_assert_ptr_eq(r, null); 6508 r = zipO(self, keys, null); 6509 ck_assert_ptr_eq(r, null); 6510 terminateO(keys); 6511 terminateO(values); 6512 terminateO(self); 6513 6514 } 6515 6516 6517 void zipSmallJsonSmallDictT(void) { 6518 6519 smallDictt* r; 6520 smallDictt *self = allocG(rtSmallDictt); 6521 smallArrayt *keys = allocSmallArray(); 6522 smallJsont *values = allocSmallJson(); 6523 6524 self->f->setInt(self, "", 1); 6525 // 3 elements in keys 6526 // 2 elements in values 6527 // only 2 key/values are zipped 6528 keys->f->pushS(keys, "a"); 6529 keys->f->pushS(keys, "b"); 6530 keys->f->pushS(keys, "c"); 6531 values->f->pushInt(values, 1); 6532 values->f->pushInt(values, 2); 6533 r = self->f->zipSmallJson(self, keys, values); 6534 terminateO(keys); 6535 smashO(values); 6536 ck_assert_ptr_ne(r, NULL); 6537 char *s = toStringO(r); 6538 ck_assert_str_eq(s, "{\"\":1,\"a\":1,\"b\":2}"); 6539 free(s); 6540 // keys array with non string objects 6541 keys = allocSmallArray(); 6542 values = allocSmallJson(); 6543 keys->f->pushInt(keys, 1); 6544 values->f->pushInt(values, 1); 6545 r = self->f->zipSmallJson(self, keys, values); 6546 ck_assert_ptr_eq(r, NULL); 6547 terminateO(keys); 6548 terminateO(values); 6549 // empty values 6550 keys = allocSmallArray(); 6551 values = allocSmallJson(); 6552 keys->f->pushInt(keys, 1); 6553 values->f->pushInt(values, 1); 6554 delElemIndexO(values, 0); 6555 trimO(values); 6556 r = self->f->zipSmallJson(self, keys, values); 6557 ck_assert_ptr_eq(r, self); 6558 terminateO(keys); 6559 // non smallArray object 6560 keys = (smallArrayt*) allocSmallInt(1); 6561 r = self->f->zipSmallJson(self, keys, values); 6562 ck_assert_ptr_eq(r, null); 6563 terminateO(keys); 6564 keys = allocSmallArray(); 6565 terminateO(values); 6566 // non json array 6567 values = allocSmallJson(); 6568 setTopIntO(values, 1); 6569 r = self->f->zipSmallJson(self, keys, values); 6570 ck_assert_ptr_eq(r, null); 6571 terminateO(values); 6572 // non smallJson values 6573 values = (smallJsont*) allocSmallInt(2); 6574 r = self->f->zipSmallJson(self, keys, values); 6575 ck_assert_ptr_eq(r, null); 6576 // null 6577 r = self->f->zipSmallJson(self, null, values); 6578 ck_assert_ptr_eq(r, null); 6579 r = self->f->zipSmallJson(self, keys, null); 6580 ck_assert_ptr_eq(r, null); 6581 terminateO(keys); 6582 terminateO(values); 6583 terminateO(self); 6584 6585 } 6586 6587 6588 void zipSmallJsonSmallArraySmallDictT(void) { 6589 6590 smallDictt* r; 6591 smallDictt *self = allocG(rtSmallDictt); 6592 smallJsont *keys = allocSmallJson(); 6593 smallArrayt *values = allocSmallArray(); 6594 6595 self->f->setInt(self, "", 1); 6596 // 3 elements in keys 6597 // 2 elements in values 6598 // only 2 key/values are zipped 6599 keys->f->pushS(keys, "a"); 6600 keys->f->pushS(keys, "b"); 6601 keys->f->pushS(keys, "c"); 6602 values->f->pushInt(values, 1); 6603 values->f->pushInt(values, 2); 6604 r = self->f->zipSmallJsonSmallArray(self, keys, values); 6605 terminateO(keys); 6606 smashO(values); 6607 ck_assert_ptr_ne(r, NULL); 6608 char *s = toStringO(r); 6609 ck_assert_str_eq(s, "{\"\":1,\"a\":1,\"b\":2}"); 6610 free(s); 6611 // keys array with non string objects 6612 keys = allocSmallJson(); 6613 values = allocSmallArray(); 6614 keys->f->pushInt(keys, 1); 6615 values->f->pushInt(values, 1); 6616 r = self->f->zipSmallJsonSmallArray(self, keys, values); 6617 ck_assert_ptr_eq(r, NULL); 6618 terminateO(keys); 6619 terminateO(values); 6620 // empty values 6621 keys = allocSmallJson(); 6622 values = allocSmallArray(); 6623 keys->f->pushInt(keys, 1); 6624 r = self->f->zipSmallJsonSmallArray(self, keys, values); 6625 ck_assert_ptr_eq(r, self); 6626 terminateO(keys); 6627 // non json array keys 6628 keys = allocSmallJson(); 6629 setTopIntO(keys, 1); 6630 r = self->f->zipSmallJsonSmallArray(self, keys, values); 6631 ck_assert_ptr_eq(r, null); 6632 terminateO(keys); 6633 // non smallArray object 6634 keys = (smallJsont*) allocSmallInt(1); 6635 r = self->f->zipSmallJsonSmallArray(self, keys, values); 6636 ck_assert_ptr_eq(r, null); 6637 terminateO(keys); 6638 keys = allocSmallJson(); 6639 terminateO(values); 6640 values = (smallArrayt*) allocSmallInt(2); 6641 r = self->f->zipSmallJsonSmallArray(self, keys, values); 6642 ck_assert_ptr_eq(r, null); 6643 // null 6644 r = self->f->zipSmallJsonSmallArray(self, null, values); 6645 ck_assert_ptr_eq(r, null); 6646 r = self->f->zipSmallJsonSmallArray(self, keys, null); 6647 ck_assert_ptr_eq(r, null); 6648 terminateO(keys); 6649 terminateO(values); 6650 terminateO(self); 6651 6652 } 6653 6654 6655 void zipSmallJsonSmallJsonSmallDictT(void) { 6656 6657 smallDictt* r; 6658 smallDictt *self = allocG(rtSmallDictt); 6659 smallJsont *keys = allocSmallJson(); 6660 smallJsont *values = allocSmallJson(); 6661 6662 self->f->setInt(self, "", 1); 6663 // 3 elements in keys 6664 // 2 elements in values 6665 // only 2 key/values are zipped 6666 keys->f->pushS(keys, "a"); 6667 keys->f->pushS(keys, "b"); 6668 keys->f->pushS(keys, "c"); 6669 values->f->pushInt(values, 1); 6670 values->f->pushInt(values, 2); 6671 r = zipSmallJsonSmallJsonO(self, keys, values); 6672 terminateO(keys); 6673 smashO(values); 6674 ck_assert_ptr_ne(r, NULL); 6675 char *s = toStringO(r); 6676 ck_assert_str_eq(s, "{\"\":1,\"a\":1,\"b\":2}"); 6677 free(s); 6678 // keys array with non string objects 6679 keys = allocSmallJson(); 6680 values = allocSmallJson(); 6681 keys->f->pushInt(keys, 1); 6682 values->f->pushInt(values, 1); 6683 r = zipSmallJsonSmallJsonO(self, keys, values); 6684 ck_assert_ptr_eq(r, NULL); 6685 terminateO(keys); 6686 terminateO(values); 6687 // empty values 6688 keys = allocSmallJson(); 6689 values = allocSmallJson(); 6690 keys->f->pushInt(keys, 1); 6691 values->f->pushInt(values, 1); 6692 delElemIndexO(values, 0); 6693 trimO(values); 6694 r = zipSmallJsonSmallJsonO(self, keys, values); 6695 ck_assert_ptr_eq(r, self); 6696 terminateO(keys); 6697 // non json array keys 6698 keys = allocSmallJson(); 6699 setTopIntO(keys, 1); 6700 r = zipSmallJsonSmallJsonO(self, keys, values); 6701 ck_assert_ptr_eq(r, null); 6702 terminateO(keys); 6703 // non json array values 6704 keys = allocSmallJson(); 6705 keys->f->pushInt(keys, 1); 6706 freeO(values); 6707 setTopIntO(values, 1); 6708 r = zipSmallJsonSmallJsonO(self, keys, values); 6709 ck_assert_ptr_eq(r, null); 6710 terminateO(keys); 6711 terminateO(values); 6712 // non smallJson object 6713 keys = (smallJsont*) allocSmallInt(1); 6714 values = allocSmallJson(); 6715 r = zipSmallJsonSmallJsonO(self, keys, values); 6716 ck_assert_ptr_eq(r, null); 6717 terminateO(keys); 6718 keys = allocSmallJson(); 6719 terminateO(values); 6720 values = (smallJsont*) allocSmallInt(2); 6721 r = zipSmallJsonSmallJsonO(self, keys, values); 6722 ck_assert_ptr_eq(r, null); 6723 // null 6724 r = zipSmallJsonSmallJsonO(self, null, values); 6725 ck_assert_ptr_eq(r, null); 6726 r = zipSmallJsonSmallJsonO(self, keys, null); 6727 ck_assert_ptr_eq(r, null); 6728 terminateO(keys); 6729 terminateO(values); 6730 terminateO(self); 6731 6732 } 6733 6734 6735 void zipSmallJsonVArraySmallDictT(void) { 6736 6737 smallDictt* r; 6738 smallDictt *self = allocG(rtSmallDictt); 6739 smallJsont *keys = allocSmallJson(); 6740 char** values; 6741 6742 self->f->setInt(self, "", 1); 6743 // 3 elements in keys 6744 // 2 elements in values 6745 // only 2 key/values are zipped 6746 keys->f->pushS(keys, "a"); 6747 keys->f->pushS(keys, "b"); 6748 keys->f->pushS(keys, "c"); 6749 values = listCreateS("1", "2"); 6750 r = zipSmallJsonVArrayO(self, keys, values); 6751 terminateO(keys); 6752 listFreeS(values); 6753 ck_assert_ptr_ne(r, NULL); 6754 char *s = toStringO(r); 6755 ck_assert_str_eq(s, "{\"\":1,\"a\":\"1\",\"b\":\"2\"}"); 6756 free(s); 6757 // keys array with non string objects 6758 keys = allocSmallJson(); 6759 keys->f->pushInt(keys, 1); 6760 values = listCreateS("1"); 6761 r = zipSmallJsonVArrayO(self, keys, values); 6762 ck_assert_ptr_eq(r, NULL); 6763 terminateO(keys); 6764 listFreeS(values); 6765 // empty values 6766 keys = allocSmallJson(); 6767 keys->f->pushInt(keys, 1); 6768 listEmptyS(values); 6769 r = zipSmallJsonVArrayO(self, keys, values); 6770 ck_assert_ptr_eq(r, self); 6771 terminateO(keys); 6772 // non json array keys 6773 keys = allocSmallJson(); 6774 setTopIntO(keys, 1); 6775 r = zipSmallJsonVArrayO(self, keys, values); 6776 ck_assert_ptr_eq(r, null); 6777 terminateO(keys); 6778 // non smallArray object 6779 keys = (smallJsont*) allocSmallInt(1); 6780 r = zipSmallJsonVArrayO(self, keys, values); 6781 ck_assert_ptr_eq(r, null); 6782 terminateO(keys); 6783 keys = allocSmallJson(); 6784 // null 6785 r = zipSmallJsonVArrayO(self, null, values); 6786 ck_assert_ptr_eq(r, null); 6787 r = zipSmallJsonVArrayO(self, keys, null); 6788 ck_assert_ptr_eq(r, null); 6789 terminateO(keys); 6790 listFreeS(values); 6791 terminateO(self); 6792 6793 } 6794 6795 6796 void zipArraySmallDictT(void) { 6797 6798 smallDictt* r; 6799 smallDictt *self = allocG(rtSmallDictt); 6800 char** keys; 6801 smallArrayt *values = allocSmallArray(); 6802 6803 self->f->setInt(self, "", 1); 6804 // 3 elements in keys 6805 // 2 elements in values 6806 // only 2 key/values are zipped 6807 keys = listCreateS("a", "b", "c"); 6808 values->f->pushInt(values, 1); 6809 values->f->pushInt(values, 2); 6810 r = zipArrayO(self, keys, values); 6811 listFreeS(keys); 6812 smashO(values); 6813 ck_assert_ptr_ne(r, NULL); 6814 char *s = toStringO(r); 6815 ck_assert_str_eq(s, "{\"\":1,\"a\":1,\"b\":2}"); 6816 free(s); 6817 // empty values 6818 keys = listCreateS("a"); 6819 values = allocSmallArray(); 6820 r = zipArrayO(self, keys, values); 6821 ck_assert_ptr_eq(r, self); 6822 // non smallArray object 6823 terminateO(values); 6824 values = (smallArrayt*) allocSmallInt(2); 6825 r = zipArrayO(self, keys, values); 6826 ck_assert_ptr_eq(r, null); 6827 // null 6828 r = zipArrayO(self, null, values); 6829 ck_assert_ptr_eq(r, null); 6830 r = zipArrayO(self, keys, null); 6831 ck_assert_ptr_eq(r, null); 6832 listFreeS(keys); 6833 terminateO(values); 6834 terminateO(self); 6835 6836 } 6837 6838 6839 void zipArraySmallJsonSmallDictT(void) { 6840 6841 smallDictt* r; 6842 smallDictt *self = allocG(rtSmallDictt); 6843 char** keys; 6844 smallJsont *values = allocSmallJson(); 6845 6846 self->f->setInt(self, "", 1); 6847 // 3 elements in keys 6848 // 2 elements in values 6849 // only 2 key/values are zipped 6850 keys = listCreateS("a", "b", "c"); 6851 values->f->pushInt(values, 1); 6852 values->f->pushInt(values, 2); 6853 r = self->f->zipArraySmallJson(self, keys, values); 6854 listFreeS(keys); 6855 smashO(values); 6856 ck_assert_ptr_ne(r, NULL); 6857 char *s = toStringO(r); 6858 ck_assert_str_eq(s, "{\"\":1,\"a\":1,\"b\":2}"); 6859 free(s); 6860 // empty values 6861 keys = listCreateS("a"); 6862 values = allocSmallJson(); 6863 values->f->pushInt(values, 1); 6864 delElemIndexO(values, 0); 6865 trimO(values); 6866 r = self->f->zipArraySmallJson(self, keys, values); 6867 ck_assert_ptr_eq(r, self); 6868 terminateO(values); 6869 // non json array 6870 values = allocSmallJson(); 6871 setTopIntO(values, 1); 6872 r = self->f->zipArraySmallJson(self, keys, values); 6873 ck_assert_ptr_eq(r, null); 6874 terminateO(values); 6875 // non smallJson values 6876 values = (smallJsont*) allocSmallInt(2); 6877 r = self->f->zipArraySmallJson(self, keys, values); 6878 ck_assert_ptr_eq(r, null); 6879 // null 6880 r = self->f->zipArraySmallJson(self, null, values); 6881 ck_assert_ptr_eq(r, null); 6882 r = self->f->zipArraySmallJson(self, keys, null); 6883 ck_assert_ptr_eq(r, null); 6884 listFreeS(keys); 6885 terminateO(values); 6886 terminateO(self); 6887 6888 } 6889 6890 6891 void zipArrayArraySmallDictT(void) { 6892 6893 smallDictt* r; 6894 smallDictt *self = allocG(rtSmallDictt); 6895 char** keys; 6896 char** values; 6897 6898 self->f->setInt(self, "", 1); 6899 // 3 elements in keys 6900 // 2 elements in values 6901 // only 2 key/values are zipped 6902 keys = listCreateS("a", "b", "c"); 6903 values = listCreateS("1", "2"); 6904 r = zipArrayArrayO(self, keys, values); 6905 listFreeS(keys); 6906 listFreeS(values); 6907 ck_assert_ptr_ne(r, NULL); 6908 char *s = toStringO(r); 6909 ck_assert_str_eq(s, "{\"\":1,\"a\":\"1\",\"b\":\"2\"}"); 6910 free(s); 6911 // empty values 6912 keys = listCreateS("a"); 6913 listEmptyS(values); 6914 r = zipArrayArrayO(self, keys, values); 6915 ck_assert_ptr_eq(r, self); 6916 // null 6917 r = zipArrayArrayO(self, null, values); 6918 ck_assert_ptr_eq(r, null); 6919 r = zipArrayArrayO(self, keys, null); 6920 ck_assert_ptr_eq(r, null); 6921 listFreeS(keys); 6922 listFreeS(values); 6923 terminateO(self); 6924 6925 } 6926 6927 6928 void zipVArraySmallDictT(void) { 6929 6930 smallDictt* r; 6931 smallDictt *self = allocG(rtSmallDictt); 6932 smallArrayt *keys = allocSmallArray(); 6933 char** values; 6934 6935 self->f->setInt(self, "", 1); 6936 // 3 elements in keys 6937 // 2 elements in values 6938 // only 2 key/values are zipped 6939 keys->f->pushS(keys, "a"); 6940 keys->f->pushS(keys, "b"); 6941 keys->f->pushS(keys, "c"); 6942 values = listCreateS("1", "2"); 6943 r = zipVArrayO(self, keys, values); 6944 terminateO(keys); 6945 listFreeS(values); 6946 ck_assert_ptr_ne(r, NULL); 6947 char *s = toStringO(r); 6948 ck_assert_str_eq(s, "{\"\":1,\"a\":\"1\",\"b\":\"2\"}"); 6949 free(s); 6950 // keys array with non string objects 6951 keys = allocSmallArray(); 6952 keys->f->pushInt(keys, 1); 6953 values = listCreateS("1"); 6954 r = zipVArrayO(self, keys, values); 6955 ck_assert_ptr_eq(r, NULL); 6956 terminateO(keys); 6957 listFreeS(values); 6958 // empty values 6959 keys = allocSmallArray(); 6960 keys->f->pushInt(keys, 1); 6961 listEmptyS(values); 6962 r = zipVArrayO(self, keys, values); 6963 ck_assert_ptr_eq(r, self); 6964 terminateO(keys); 6965 // non smallArray object 6966 keys = (smallArrayt*) allocSmallInt(1); 6967 r = zipVArrayO(self, keys, values); 6968 ck_assert_ptr_eq(r, null); 6969 terminateO(keys); 6970 keys = allocSmallArray(); 6971 // null 6972 r = zipVArrayO(self, null, values); 6973 ck_assert_ptr_eq(r, null); 6974 r = zipVArrayO(self, keys, null); 6975 ck_assert_ptr_eq(r, null); 6976 terminateO(keys); 6977 listFreeS(values); 6978 terminateO(self); 6979 6980 } 6981 6982 6983 void fromArraySmallDictT(void) { 6984 6985 smallDictt* r; 6986 smallDictt *self = allocG(rtSmallDictt); 6987 smallArrayt *items = allocSmallArray(); 6988 6989 self->f->setInt(self, "", 1); 6990 // ignored item 6991 items->f->pushS(items, "ignored"); 6992 createAllocateSmallArray(a); 6993 a->f->pushS(a, "a"); 6994 a->f->pushInt(a, 1); 6995 items->f->pushNFreeArray(items, a); 6996 a = allocSmallArray(); 6997 items->f->pushNFreeArray(items, a); 6998 a = allocSmallArray(); 6999 a->f->pushInt(a, 1); 7000 a->f->pushInt(a, 2); 7001 items->f->pushNFreeArray(items, a); 7002 r = self->f->fromArray(self, items); 7003 ck_assert_ptr_ne(r, NULL); 7004 char *s = toStringO(r); 7005 ck_assert_str_eq(s, "{\"\":1,\"a\":1}"); 7006 free(s); 7007 terminateO(items); 7008 // non smallArray items 7009 items = (smallArrayt*) allocSmallInt(2); 7010 r = self->f->fromArray(self, items); 7011 ck_assert_ptr_eq(r, NULL); 7012 // null items 7013 r = self->f->fromArray(self, null); 7014 ck_assert_ptr_eq(r, NULL); 7015 terminateO(items); 7016 terminateO(self); 7017 7018 } 7019 7020 7021 void toArraySmallDictT(void) { 7022 7023 smallArrayt* r; 7024 smallDictt *self = allocG(rtSmallDictt); 7025 7026 self->f->setInt(self, "", 1); 7027 self->f->setInt(self, "b", 2); 7028 self->f->setInt(self, "c", 3); 7029 self->f->del(self, ""); 7030 r = toArrayO(self); 7031 ck_assert_ptr_ne(r, NULL); 7032 char *s = toStringO(r); 7033 ck_assert_str_eq(s, "[[\"b\",2],[\"c\",3]]"); 7034 free(s); 7035 terminateO(r); 7036 disposeO(self); 7037 // empty dict 7038 r = toArrayO(self); 7039 ck_assert_ptr_eq(r, NULL); 7040 terminateO(self); 7041 7042 } 7043 7044 7045 void writeFileSmallDictT(void) { 7046 7047 bool r; 7048 smallDictt *self = allocG(rtSmallDictt); 7049 7050 self->f->setInt(self, "", 1); 7051 self->f->setInt(self, "b", 2); 7052 r = writeFileO(self, "smallDictFile.json"); 7053 ck_assert(r); 7054 ck_assert(fileExists("smallDictFile.json")); 7055 char *s = readFileToS("smallDictFile.json"); 7056 ck_assert_str_eq(s, "{\"\":1,\"b\":2}"); 7057 free(s); 7058 rmAll("smallDictFile.json"); 7059 // blank file path 7060 r = writeFileO(self, " "); 7061 ck_assert(!r); 7062 // null file path 7063 r = writeFileO(self, null); 7064 ck_assert(!r); 7065 terminateO(self); 7066 7067 } 7068 7069 7070 void writeFileSmallJsonSmallDictT(void) { 7071 7072 bool r; 7073 smallDictt *self = allocG(rtSmallDictt); 7074 smallJsont *filePath = allocSmallJson(); 7075 7076 self->f->setInt(self, "", 1); 7077 self->f->setInt(self, "b", 2); 7078 setTopSO(filePath, "smallDictFile.json"); 7079 r = self->f->writeFileSmallJson(self, filePath); 7080 ck_assert(r); 7081 ck_assert(fileExists("smallDictFile.json")); 7082 char *s = readFileToS("smallDictFile.json"); 7083 ck_assert_str_eq(s, "{\"\":1,\"b\":2}"); 7084 free(s); 7085 rmAll("smallDictFile.json"); 7086 // blank path 7087 freeO(filePath); 7088 setTopSO(filePath, " "); 7089 r = self->f->writeFileSmallJson(self, filePath); 7090 ck_assert(!r); 7091 // non json string 7092 freeO(filePath); 7093 setTopIntO(filePath, 2); 7094 r = self->f->writeFileSmallJson(self, filePath); 7095 ck_assert(!r); 7096 // non json object 7097 terminateO(filePath); 7098 filePath = (smallJsont*) allocSmallInt(2); 7099 r = self->f->writeFileSmallJson(self, filePath); 7100 ck_assert(!r); 7101 // null path 7102 r = self->f->writeFileSmallJson(self, null); 7103 ck_assert(!r); 7104 terminateO(filePath); 7105 terminateO(self); 7106 7107 } 7108 7109 7110 void writeFileSmallStringSmallDictT(void) { 7111 7112 bool r; 7113 smallDictt *self = allocG(rtSmallDictt); 7114 smallStringt *filePath = allocSmallString("smallDictFile.json"); 7115 7116 self->f->setInt(self, "", 1); 7117 self->f->setInt(self, "b", 2); 7118 r = self->f->writeFileSmallString(self, filePath); 7119 ck_assert(r); 7120 ck_assert(fileExists("smallDictFile.json")); 7121 char *s = readFileToS("smallDictFile.json"); 7122 ck_assert_str_eq(s, "{\"\":1,\"b\":2}"); 7123 free(s); 7124 rmAll("smallDictFile.json"); 7125 // blank path 7126 setValO(filePath, " "); 7127 r = self->f->writeFileSmallString(self, filePath); 7128 ck_assert(!r); 7129 // non smallString object 7130 terminateO(filePath); 7131 filePath = (smallStringt*) allocSmallInt(2); 7132 r = self->f->writeFileSmallString(self, filePath); 7133 ck_assert(!r); 7134 // null path 7135 r = self->f->writeFileSmallString(self, null); 7136 ck_assert(!r); 7137 terminateO(filePath); 7138 terminateO(self); 7139 7140 } 7141 7142 7143 void writeStreamSmallDictT(void) { 7144 7145 bool r; 7146 smallDictt *self = allocG(rtSmallDictt); 7147 FILE *fp; 7148 7149 self->f->setInt(self, "", 1); 7150 self->f->setInt(self, "b", 2); 7151 fp = fopen("smallDictFile.json", "w"); 7152 r = writeStreamO(self, fp); 7153 ck_assert(r); 7154 fclose(fp); 7155 ck_assert(fileExists("smallDictFile.json")); 7156 char *s = readFileToS("smallDictFile.json"); 7157 ck_assert_str_eq(s, "{\"\":1,\"b\":2}"); 7158 free(s); 7159 rmAll("smallDictFile.json"); 7160 // null file pointer 7161 r = writeStreamO(self, null); 7162 ck_assert(!r); 7163 terminateO(self); 7164 7165 } 7166 7167 7168 void appendFileSmallDictT(void) { 7169 7170 bool r; 7171 smallDictt *self = allocG(rtSmallDictt); 7172 7173 self->f->setInt(self, "", 1); 7174 self->f->setInt(self, "b", 2); 7175 writeFileS("smallDictFile.json", "-"); 7176 r = appendFileO(self, "smallDictFile.json"); 7177 ck_assert(r); 7178 ck_assert(fileExists("smallDictFile.json")); 7179 char *s = readFileToS("smallDictFile.json"); 7180 ck_assert_str_eq(s, "-{\"\":1,\"b\":2}"); 7181 free(s); 7182 rmAll("smallDictFile.json"); 7183 // blank file path 7184 r = appendFileO(self, " "); 7185 ck_assert(!r); 7186 // null file path 7187 r = appendFileO(self, null); 7188 ck_assert(!r); 7189 terminateO(self); 7190 7191 } 7192 7193 7194 void appendFileSmallStringSmallDictT(void) { 7195 7196 bool r; 7197 smallDictt *self = allocG(rtSmallDictt); 7198 smallStringt *filePath = allocSmallString("smallDictFile.json"); 7199 7200 self->f->setInt(self, "", 1); 7201 self->f->setInt(self, "b", 2); 7202 writeFileS("smallDictFile.json", "-"); 7203 r = self->f->appendFileSmallString(self, filePath); 7204 ck_assert(r); 7205 ck_assert(fileExists("smallDictFile.json")); 7206 char *s = readFileToS("smallDictFile.json"); 7207 ck_assert_str_eq(s, "-{\"\":1,\"b\":2}"); 7208 free(s); 7209 rmAll("smallDictFile.json"); 7210 // blank path 7211 setValO(filePath, " "); 7212 r = self->f->appendFileSmallString(self, filePath); 7213 ck_assert(!r); 7214 // non smallString object 7215 terminateO(filePath); 7216 filePath = (smallStringt*) allocSmallInt(2); 7217 r = self->f->appendFileSmallString(self, filePath); 7218 ck_assert(!r); 7219 // null path 7220 r = self->f->appendFileSmallString(self, null); 7221 ck_assert(!r); 7222 terminateO(filePath); 7223 terminateO(self); 7224 7225 } 7226 7227 7228 void logSmallDictT(void) { 7229 7230 smallDictt *self = allocG(rtSmallDictt); 7231 7232 self->f->setInt(self, "", 1); 7233 self->f->setInt(self, "b", 2); 7234 logO(self); 7235 // empty self 7236 freeO(self); 7237 logO(self); 7238 terminateO(self); 7239 7240 } 7241 7242 7243 void typeSmallStringSmallDictT(void) { 7244 7245 smallStringt* r; 7246 smallDictt *self = allocG(rtSmallDictt); 7247 7248 self->f->setInt(self, "", 1); 7249 self->f->setInt(self, "b", 2); 7250 r = typeSmallStringO(self, ""); 7251 ck_assert_str_eq(ssGet(r), "int"); 7252 terminateO(r); 7253 // non existing key 7254 r = typeSmallStringO(self, "asd"); 7255 ck_assert_ptr_eq(r, null); 7256 terminateO(self); 7257 7258 } 7259 7260 7261 void typeStringKCharSmallDictT(void) { 7262 7263 const char* r; 7264 smallDictt *self = allocG(rtSmallDictt); 7265 7266 self->f->setInt(self, "", 1); 7267 self->f->setInt(self, "b", 2); 7268 r = typeStringKCharO(self, 'b'); 7269 ck_assert_str_eq(r, "int"); 7270 terminateO(self); 7271 7272 } 7273 7274 7275 void typeSmallStringKCharSmallDictT(void) { 7276 7277 smallStringt* r; 7278 smallDictt *self = allocG(rtSmallDictt); 7279 7280 self->f->setInt(self, "", 1); 7281 self->f->setInt(self, "b", 2); 7282 r = typeSmallStringKCharO(self, 'b'); 7283 ck_assert_str_eq(ssGet(r), "int"); 7284 terminateO(r); 7285 // non existing key 7286 r = typeSmallStringKCharO(self, 'a'); 7287 ck_assert_ptr_eq(r, null); 7288 terminateO(self); 7289 7290 } 7291 7292 7293 void typeKCharSmallDictT(void) { 7294 7295 char r; 7296 smallDictt *self = allocG(rtSmallDictt); 7297 7298 self->f->setInt(self, "", 1); 7299 self->f->setInt(self, "b", 2); 7300 r = typeKCharO(self, 'b'); 7301 ck_assert_int_eq(r, 7); 7302 terminateO(self); 7303 7304 } 7305 7306 7307 void isETypeSmallDictT(void) { 7308 7309 bool r; 7310 smallDictt *self = allocG(rtSmallDictt); 7311 7312 self->f->setInt(self, "", 1); 7313 r = isETypeO(self, "", "int"); 7314 ck_assert(r); 7315 // null type 7316 r = isETypeO(self, "", null); 7317 ck_assert(!r); 7318 // null key 7319 r = isETypeO(self, null, "int"); 7320 ck_assert(!r); 7321 // empty dict 7322 freeO(self); 7323 r = isETypeO(self, "", "int"); 7324 ck_assert(!r); 7325 terminateO(self); 7326 7327 } 7328 7329 7330 void isEUndefinedSmallDictT(void) { 7331 7332 bool r; 7333 smallDictt *self = allocG(rtSmallDictt); 7334 7335 self->f->setInt(self, "", 1); 7336 self->f->setUndefined(self, "b"); 7337 r = isEUndefinedO(self, "b"); 7338 ck_assert(r); 7339 r = isEUndefinedO(self, ""); 7340 ck_assert(!r); 7341 // non existing key 7342 r = isEUndefinedO(self, "qwe"); 7343 ck_assert(!r); 7344 // empty dict 7345 freeO(self); 7346 r = isEUndefinedO(self, ""); 7347 ck_assert(!r); 7348 terminateO(self); 7349 7350 } 7351 7352 7353 void isEBoolSmallDictT(void) { 7354 7355 bool r; 7356 smallDictt *self = allocG(rtSmallDictt); 7357 7358 self->f->setInt(self, "", 1); 7359 self->f->setBool(self, "b", true); 7360 r = isEBoolO(self, "b"); 7361 ck_assert(r); 7362 r = isEBoolO(self, ""); 7363 ck_assert(!r); 7364 // non existing key 7365 r = isEBoolO(self, "qwe"); 7366 ck_assert(!r); 7367 // empty dict 7368 freeO(self); 7369 r = isEBoolO(self, ""); 7370 ck_assert(!r); 7371 terminateO(self); 7372 7373 } 7374 7375 7376 void isEContainerSmallDictT(void) { 7377 7378 bool r; 7379 smallDictt *self = allocG(rtSmallDictt); 7380 7381 createSmallContainer(c); 7382 self->f->setInt(self, "", 1); 7383 self->f->setBool(self, "b", true); 7384 self->f->setSmallContainer(self, "c", &c); 7385 r = isEContainerO(self, "c"); 7386 ck_assert(r); 7387 r = isEContainerO(self, "b"); 7388 ck_assert(!r); 7389 // non existing key 7390 r = isEContainerO(self, "qwe"); 7391 ck_assert(!r); 7392 // empty dict 7393 freeO(self); 7394 r = isEContainerO(self, ""); 7395 ck_assert(!r); 7396 terminateO(self); 7397 7398 } 7399 7400 7401 void isEDictSmallDictT(void) { 7402 7403 bool r; 7404 smallDictt *self = allocG(rtSmallDictt); 7405 7406 self->f->setInt(self, "", 1); 7407 createSmallDict(d); 7408 self->f->setDict(self, "b", &d); 7409 r = isEDictO(self, "b"); 7410 ck_assert(r); 7411 r = isEDictO(self, ""); 7412 ck_assert(!r); 7413 // non existing key 7414 r = isEDictO(self, "qwe"); 7415 ck_assert(!r); 7416 // empty dict 7417 freeO(self); 7418 r = isEDictO(self, ""); 7419 ck_assert(!r); 7420 terminateO(self); 7421 7422 } 7423 7424 7425 void isEDoubleSmallDictT(void) { 7426 7427 bool r; 7428 smallDictt *self = allocG(rtSmallDictt); 7429 7430 self->f->setInt(self, "", 1); 7431 self->f->setDouble(self, "b", 2.2); 7432 r = isEDoubleO(self, "b"); 7433 ck_assert(r); 7434 r = isEDoubleO(self, ""); 7435 ck_assert(!r); 7436 // non existing key 7437 r = isEDoubleO(self, "qwe"); 7438 ck_assert(!r); 7439 // empty dict 7440 freeO(self); 7441 r = isEDoubleO(self, ""); 7442 ck_assert(!r); 7443 terminateO(self); 7444 7445 } 7446 7447 7448 void isEIntSmallDictT(void) { 7449 7450 bool r; 7451 smallDictt *self = allocG(rtSmallDictt); 7452 7453 self->f->setBool(self, "", true); 7454 self->f->setInt(self, "b", 2); 7455 r = isEIntO(self, "b"); 7456 ck_assert(r); 7457 r = isEIntO(self, ""); 7458 ck_assert(!r); 7459 // non existing key 7460 r = isEIntO(self, "qwe"); 7461 ck_assert(!r); 7462 // empty dict 7463 freeO(self); 7464 r = isEIntO(self, ""); 7465 ck_assert(!r); 7466 terminateO(self); 7467 7468 } 7469 7470 7471 void isEStringSmallDictT(void) { 7472 7473 bool r; 7474 smallDictt *self = allocG(rtSmallDictt); 7475 7476 self->f->setInt(self, "", 1); 7477 self->f->setS(self, "b", "!@#"); 7478 r = isEStringO(self, "b"); 7479 ck_assert(r); 7480 r = isEStringO(self, ""); 7481 ck_assert(!r); 7482 // non existing key 7483 r = isEStringO(self, "qwe"); 7484 ck_assert(!r); 7485 // empty dict 7486 freeO(self); 7487 r = isEStringO(self, ""); 7488 ck_assert(!r); 7489 terminateO(self); 7490 7491 } 7492 7493 7494 void isEFaststringSmallDictT(void) { 7495 7496 bool r; 7497 smallDictt *self = allocG(rtSmallDictt); 7498 7499 self->f->setInt(self, "", 1); 7500 r = isEFaststringO(self, ""); 7501 ck_assert(!r); 7502 // non existing key 7503 r = isEFaststringO(self, "qwe"); 7504 ck_assert(!r); 7505 // empty dict 7506 freeO(self); 7507 r = isEFaststringO(self, ""); 7508 ck_assert(!r); 7509 terminateO(self); 7510 7511 } 7512 7513 7514 void isEArraySmallDictT(void) { 7515 7516 bool r; 7517 smallDictt *self = allocG(rtSmallDictt); 7518 7519 createSmallArray(a); 7520 self->f->setInt(self, "", 1); 7521 self->f->setArray(self, "b", &a); 7522 r = isEArrayO(self, "b"); 7523 ck_assert(r); 7524 r = isEArrayO(self, ""); 7525 ck_assert(!r); 7526 // non existing key 7527 r = isEArrayO(self, "qwe"); 7528 ck_assert(!r); 7529 // empty dict 7530 freeO(self); 7531 r = isEArrayO(self, ""); 7532 ck_assert(!r); 7533 terminateO(self); 7534 7535 } 7536 7537 7538 void isEBytesSmallDictT(void) { 7539 7540 bool r; 7541 smallDictt *self = allocG(rtSmallDictt); 7542 7543 createSmallBytes(b); 7544 self->f->setInt(self, "", 1); 7545 self->f->setSmallBytes(self, "b", &b); 7546 r = isEBytesO(self, "b"); 7547 ck_assert(r); 7548 r = isEBytesO(self, ""); 7549 ck_assert(!r); 7550 // non existing key 7551 r = isEBytesO(self, "qwe"); 7552 ck_assert(!r); 7553 // empty dict 7554 freeO(self); 7555 r = isEBytesO(self, ""); 7556 ck_assert(!r); 7557 terminateO(self); 7558 7559 } 7560 7561 7562 void areAllETypeSmallDictT(void) { 7563 7564 bool r; 7565 smallDictt *self = allocG(rtSmallDictt); 7566 7567 self->f->setBool(self, "a", true); 7568 self->f->setBool(self, "b", true); 7569 r = areAllETypeO(self, "bool"); 7570 ck_assert(r); 7571 self->f->setInt(self, "c", 2); 7572 r = areAllETypeO(self, "bool"); 7573 ck_assert(!r); 7574 // null type 7575 r = areAllETypeO(self, null); 7576 ck_assert(!r); 7577 // empty self 7578 freeO(self); 7579 r = areAllETypeO(self, "bool"); 7580 ck_assert(!r); 7581 self->f->setS(self, "a", ""); 7582 self->f->del(self, "a"); 7583 r = areAllETypeO(self, "bool"); 7584 ck_assert(!r); 7585 terminateO(self); 7586 7587 } 7588 7589 7590 void areAllEUndefinedSmallDictT(void) { 7591 7592 bool r; 7593 smallDictt *self = allocG(rtSmallDictt); 7594 7595 self->f->setUndefined(self, "b"); 7596 r = areAllEUndefinedO(self); 7597 ck_assert(r); 7598 terminateO(self); 7599 7600 } 7601 7602 7603 void areAllEBoolSmallDictT(void) { 7604 7605 bool r; 7606 smallDictt *self = allocG(rtSmallDictt); 7607 7608 self->f->setBool(self, "a", true); 7609 r = areAllEBoolO(self); 7610 ck_assert(r); 7611 terminateO(self); 7612 7613 } 7614 7615 7616 void areAllEContainerSmallDictT(void) { 7617 7618 bool r; 7619 smallDictt *self = allocG(rtSmallDictt); 7620 7621 createSmallContainer(c); 7622 self->f->setSmallContainer(self, "c", &c); 7623 r = areAllEContainerO(self); 7624 ck_assert(r); 7625 terminateO(self); 7626 7627 } 7628 7629 7630 void areAllEDictSmallDictT(void) { 7631 7632 bool r; 7633 smallDictt *self = allocG(rtSmallDictt); 7634 7635 createSmallDict(d); 7636 self->f->setDict(self, "b", &d); 7637 r = areAllEDictO(self); 7638 ck_assert(r); 7639 terminateO(self); 7640 7641 } 7642 7643 7644 void areAllEDoubleSmallDictT(void) { 7645 7646 bool r; 7647 smallDictt *self = allocG(rtSmallDictt); 7648 7649 self->f->setDouble(self, "b", 2.2); 7650 r = areAllEDoubleO(self); 7651 ck_assert(r); 7652 terminateO(self); 7653 7654 } 7655 7656 7657 void areAllEIntSmallDictT(void) { 7658 7659 bool r; 7660 smallDictt *self = allocG(rtSmallDictt); 7661 7662 self->f->setInt(self, "b", 2); 7663 r = areAllEIntO(self); 7664 ck_assert(r); 7665 terminateO(self); 7666 7667 } 7668 7669 7670 void areAllEStringSmallDictT(void) { 7671 7672 bool r; 7673 smallDictt *self = allocG(rtSmallDictt); 7674 7675 self->f->setS(self, "b", "!@#"); 7676 r = areAllEStringO(self); 7677 ck_assert(r); 7678 terminateO(self); 7679 7680 } 7681 7682 7683 void areAllEFaststringSmallDictT(void) { 7684 7685 bool r; 7686 smallDictt *self = allocG(rtSmallDictt); 7687 7688 r = areAllEFaststringO(self); 7689 ck_assert(!r); 7690 terminateO(self); 7691 7692 } 7693 7694 7695 void areAllEArraySmallDictT(void) { 7696 7697 bool r; 7698 smallDictt *self = allocG(rtSmallDictt); 7699 7700 createSmallArray(a); 7701 self->f->setArray(self, "b", &a); 7702 r = areAllEArrayO(self); 7703 ck_assert(r); 7704 terminateO(self); 7705 7706 } 7707 7708 7709 void areAllEBytesSmallDictT(void) { 7710 7711 bool r; 7712 smallDictt *self = allocG(rtSmallDictt); 7713 7714 createSmallBytes(b); 7715 self->f->setSmallBytes(self, "b", &b); 7716 r = areAllEBytesO(self); 7717 ck_assert(r); 7718 terminateO(self); 7719 7720 } 7721 7722 7723 void duplicateSmallDictGT(void) { 7724 7725 smallDictt *r; 7726 smallDictt *self = allocG(rtSmallDictt); 7727 7728 r = duplicateSmallDictG(self); 7729 ck_assert_ptr_ne(r, null); 7730 terminateO(r); 7731 // with iterator 7732 self->f->setS(self, "qwe", "asd"); 7733 iterStartO(self); 7734 r = duplicateSmallDictG(self); 7735 ck_assert_ptr_ne(r, null); 7736 char *s = toStringO(r); 7737 ck_assert_str_eq(s, "{\"qwe\":\"asd\"}"); 7738 free(s); 7739 ck_assert_str_eq(r->iterKey, "qwe"); 7740 terminateO(r); 7741 terminateO(self); 7742 7743 } 7744 7745 7746 void freeSmallDictGT(void) { 7747 7748 smallDictt *self = allocG(rtSmallDictt); 7749 7750 self->f->setS(self, "qwe", "asd"); 7751 freeSmallDictG(self); 7752 terminateO(self); 7753 7754 } 7755 7756 7757 void setSmallDictGT(void) { 7758 7759 smallDictt* r; 7760 smallDictt *self = allocG(rtSmallDictt); 7761 baset *value = (baset*) allocSmallInt(2); 7762 7763 r = setSmallDictG(self, "1", value); 7764 ck_assert_ptr_ne(r, null); 7765 finishO(value); 7766 char *s = toStringO(r); 7767 ck_assert_str_eq(s, "{\"1\":2}"); 7768 free(s); 7769 terminateO(self); 7770 7771 } 7772 7773 7774 void getSmallDictGT(void) { 7775 7776 baset* r; 7777 smallDictt *self = allocG(rtSmallDictt); 7778 7779 self->f->setInt(self, "1", 2); 7780 r = getSmallDictG(self, null, "1"); 7781 ck_assert_ptr_ne(r, null); 7782 char *s = toStringO(r); 7783 finishO(r); 7784 ck_assert_str_eq(s, "2"); 7785 free(s); 7786 terminateO(self); 7787 7788 } 7789 7790 7791 void getUndefinedSmallDictGT(void) { 7792 7793 undefinedt* r; 7794 smallDictt *self = allocG(rtSmallDictt); 7795 7796 smallDictt *r2 = self->f->setUndefined(self, "1"); 7797 ck_assert_ptr_ne(r2, null); 7798 r = getUndefinedSmallDictG(self, null, "1"); 7799 ck_assert_ptr_ne(r, null); 7800 finishO(r); 7801 terminateO(self); 7802 7803 } 7804 7805 7806 void getBoolSmallDictGT(void) { 7807 7808 bool r; 7809 smallDictt *self = allocG(rtSmallDictt); 7810 7811 smallDictt* r2 = self->f->setBool(self, "1", true); 7812 ck_assert_ptr_ne(r2, null); 7813 r = getBoolSmallDictG(self, false, "1"); 7814 ck_assert(r); 7815 terminateO(self); 7816 7817 } 7818 7819 7820 void getBoolPSmallDictGT(void) { 7821 7822 bool* r; 7823 smallDictt *self = allocG(rtSmallDictt); 7824 7825 smallDictt* r2 = self->f->setBool(self, "1", true); 7826 ck_assert_ptr_ne(r2, null); 7827 r = getBoolPSmallDictG(self, null, "1"); 7828 ck_assert_ptr_ne(r, null); 7829 ck_assert(*r); 7830 terminateO(self); 7831 7832 } 7833 7834 7835 void getDoubleSmallDictGT(void) { 7836 7837 double r; 7838 smallDictt *self = allocG(rtSmallDictt); 7839 7840 smallDictt *r2 = self->f->setDouble(self, "1", 2.2); 7841 ck_assert_ptr_ne(r2, null); 7842 r = getDoubleSmallDictG(self, 0, "1"); 7843 ck_assert(r == 2.2); 7844 terminateO(self); 7845 7846 } 7847 7848 7849 void getDoublePSmallDictGT(void) { 7850 7851 double* r; 7852 smallDictt *self = allocG(rtSmallDictt); 7853 7854 smallDictt *r2 = self->f->setDouble(self, "1", 2.2); 7855 ck_assert_ptr_ne(r2, null); 7856 r = getDoublePSmallDictG(self, null, "1"); 7857 ck_assert_ptr_ne(r, null); 7858 ck_assert(*r == 2.2); 7859 terminateO(self); 7860 7861 } 7862 7863 7864 void getIntSmallDictGT(void) { 7865 7866 int64_t r; 7867 smallDictt *self = allocG(rtSmallDictt); 7868 7869 smallDictt *r2 = self->f->setInt(self, "1", 2); 7870 ck_assert_ptr_ne(r2, null); 7871 r = getIntSmallDictG(self, 0, "1"); 7872 ck_assert_int_eq(r, 2); 7873 terminateO(self); 7874 7875 } 7876 7877 7878 void getIntPSmallDictGT(void) { 7879 7880 int64_t* r; 7881 smallDictt *self = allocG(rtSmallDictt); 7882 7883 smallDictt *r2 = self->f->setInt(self, "1", 2); 7884 ck_assert_ptr_ne(r2, null); 7885 r = getIntPSmallDictG(self, null, "1"); 7886 ck_assert_ptr_ne(r, null); 7887 ck_assert_int_eq(*r, 2); 7888 terminateO(self); 7889 7890 } 7891 7892 7893 void getInt32SmallDictGT(void) { 7894 7895 int32_t r; 7896 smallDictt *self = allocG(rtSmallDictt); 7897 7898 smallDictt *r2 = self->f->setInt(self, "1", 2); 7899 ck_assert_ptr_ne(r2, null); 7900 r = getInt32SmallDictG(self, 0, "1"); 7901 ck_assert_int_eq(r, 2); 7902 terminateO(self); 7903 7904 } 7905 7906 7907 void getInt32PSmallDictGT(void) { 7908 7909 int32_t* r; 7910 smallDictt *self = allocG(rtSmallDictt); 7911 7912 smallDictt *r2 = self->f->setInt(self, "1", 2); 7913 ck_assert_ptr_ne(r2, null); 7914 r = getInt32PSmallDictG(self, null, "1"); 7915 ck_assert_ptr_ne(r, null); 7916 ck_assert_int_eq(*r, 2); 7917 terminateO(self); 7918 7919 } 7920 7921 7922 void getUintSmallDictGT(void) { 7923 7924 uint64_t r; 7925 smallDictt *self = allocG(rtSmallDictt); 7926 7927 smallDictt *r2 = self->f->setInt(self, "1", 2); 7928 ck_assert_ptr_ne(r2, null); 7929 r = getUintSmallDictG(self, 0, "1"); 7930 ck_assert_int_eq(r, 2); 7931 terminateO(self); 7932 7933 } 7934 7935 7936 void getUintPSmallDictGT(void) { 7937 7938 uint64_t* r; 7939 smallDictt *self = allocG(rtSmallDictt); 7940 7941 smallDictt *r2 = self->f->setInt(self, "1", 2); 7942 ck_assert_ptr_ne(r2, null); 7943 r = getUintPSmallDictG(self, null, "1"); 7944 ck_assert_ptr_ne(r, null); 7945 ck_assert_int_eq(*r, 2); 7946 terminateO(self); 7947 7948 } 7949 7950 7951 void getUint32SmallDictGT(void) { 7952 7953 uint32_t r; 7954 smallDictt *self = allocG(rtSmallDictt); 7955 7956 smallDictt *r2 = self->f->setInt(self, "1", 2); 7957 ck_assert_ptr_ne(r2, null); 7958 r = getUint32SmallDictG(self, 0, "1"); 7959 ck_assert_int_eq(r, 2); 7960 terminateO(self); 7961 7962 } 7963 7964 7965 void getUint32PSmallDictGT(void) { 7966 7967 uint32_t* r; 7968 smallDictt *self = allocG(rtSmallDictt); 7969 7970 smallDictt *r2 = self->f->setInt(self, "1", 2); 7971 ck_assert_ptr_ne(r2, null); 7972 r = getUint32PSmallDictG(self, null, "1"); 7973 ck_assert_ptr_ne(r, null); 7974 ck_assert_int_eq(*r, 2); 7975 terminateO(self); 7976 7977 } 7978 7979 7980 void getSSmallDictGT(void) { 7981 7982 char* r; 7983 smallDictt *self = allocG(rtSmallDictt); 7984 7985 smallDictt *r2 = self->f->setS(self, "1", "qwe"); 7986 ck_assert_ptr_ne(r2, null); 7987 r = getSSmallDictG(self, null, "1"); 7988 ck_assert_ptr_ne(r, null); 7989 ck_assert_str_eq(r, "qwe"); 7990 terminateO(self); 7991 7992 } 7993 7994 7995 void getDictSmallDictGT(void) { 7996 7997 smallDictt* r; 7998 smallDictt *self = allocG(rtSmallDictt); 7999 smallDictt *dict = allocSmallDict(); 8000 8001 r = self->f->setNFreeDict(self, "1", dict); 8002 ck_assert_ptr_ne(r, null); 8003 r = getDictSmallDictG(self, null, "1"); 8004 ck_assert_ptr_ne(r, null); 8005 char *s = toStringO(r); 8006 finishO(r); 8007 ck_assert_str_eq(s, "{}"); 8008 free(s); 8009 terminateO(self); 8010 8011 } 8012 8013 8014 void getArraySmallDictGT(void) { 8015 8016 smallArrayt *r; 8017 smallDictt *self = allocG(rtSmallDictt); 8018 smallArrayt *array = allocSmallArray(); 8019 8020 smallDictt *r2 = self->f->setNFreeArray(self, "1", array); 8021 ck_assert_ptr_ne(r2, null); 8022 r = getArraySmallDictG(self, null, "1"); 8023 ck_assert_ptr_ne(r, null); 8024 char *s = toStringO(r); 8025 finishO(r); 8026 ck_assert_str_eq(s, "[]"); 8027 free(s); 8028 terminateO(self); 8029 8030 } 8031 8032 8033 void getSmallBoolSmallDictGT(void) { 8034 8035 smallBoolt* r; 8036 smallDictt *self = allocG(rtSmallDictt); 8037 8038 smallDictt* r2 = self->f->setBool(self, "1", true); 8039 ck_assert_ptr_ne(r2, null); 8040 r = getSmallBoolSmallDictG(self, null, "1"); 8041 ck_assert_ptr_ne(r, null); 8042 char *s = toStringO(r); 8043 finishO(r); 8044 ck_assert_str_eq(s, "true"); 8045 free(s); 8046 terminateO(self); 8047 8048 } 8049 8050 8051 void getSmallBytesSmallDictGT(void) { 8052 8053 smallBytest* r; 8054 smallDictt *self = allocG(rtSmallDictt); 8055 smallBytest *value = allocSmallBytes("qwe", sizeof("qwe")); 8056 8057 smallDictt *r2 = self->f->setNFreeSmallBytes(self, "1", value); 8058 ck_assert_ptr_ne(r2, null); 8059 r = getSmallBytesSmallDictG(self, null, "1"); 8060 ck_assert_ptr_ne(r, null); 8061 char *s = toStringO(r); 8062 finishO(r); 8063 ck_assert_str_eq(s, "[0x71,0x77,0x65,0x00]"); 8064 free(s); 8065 terminateO(self); 8066 8067 } 8068 8069 8070 void getSmallDoubleSmallDictGT(void) { 8071 8072 smallDoublet* r; 8073 smallDictt *self = allocG(rtSmallDictt); 8074 8075 smallDictt *r2 = self->f->setDouble(self, "1", 2.2); 8076 ck_assert_ptr_ne(r2, null); 8077 r = getSmallDoubleSmallDictG(self, null, "1"); 8078 ck_assert_ptr_ne(r, null); 8079 char *s = toStringO(r); 8080 finishO(r); 8081 ck_assert_str_eq(s, "2.200000e+00"); 8082 free(s); 8083 terminateO(self); 8084 8085 } 8086 8087 8088 void getSmallIntSmallDictGT(void) { 8089 8090 smallIntt* r; 8091 smallDictt *self = allocG(rtSmallDictt); 8092 8093 smallDictt *r2 = self->f->setInt(self, "1", 2); 8094 ck_assert_ptr_ne(r2, null); 8095 r = getSmallIntSmallDictG(self, null, "1"); 8096 ck_assert_ptr_ne(r, null); 8097 char *s = toStringO(r); 8098 finishO(r); 8099 ck_assert_str_eq(s, "2"); 8100 free(s); 8101 terminateO(self); 8102 8103 } 8104 8105 8106 void getSmallJsonSmallDictGT(void) { 8107 8108 smallJsont* r; 8109 smallDictt *self = allocG(rtSmallDictt); 8110 smallJsont *value = allocSmallJson(); 8111 8112 setTopIntO(value, 2); 8113 smallDictt *r2 = self->f->setNFreeSmallJson(self, "1", value); 8114 ck_assert_ptr_ne(r2, null); 8115 r = getSmallJsonSmallDictG(self, null, "1"); 8116 ck_assert_ptr_ne(r, null); 8117 char *s = toStringO(r); 8118 finishO(r); 8119 ck_assert_str_eq(s, "2"); 8120 free(s); 8121 terminateO(self); 8122 8123 } 8124 8125 8126 void getSmallStringSmallDictGT(void) { 8127 8128 smallStringt* r; 8129 smallDictt *self = allocG(rtSmallDictt); 8130 8131 smallDictt *r2 = self->f->setS(self, "1", "qwe"); 8132 ck_assert_ptr_ne(r2, null); 8133 r = getSmallStringSmallDictG(self, null, "1"); 8134 ck_assert_ptr_ne(r, null); 8135 char *s = toStringO(r); 8136 finishO(r); 8137 ck_assert_str_eq(s, "qwe"); 8138 free(s); 8139 terminateO(self); 8140 8141 } 8142 8143 8144 void getVoidSmallDictGT(void) { 8145 8146 void* r; 8147 smallDictt *self = allocG(rtSmallDictt); 8148 8149 createSmallContainer(c); 8150 setValO(&c, &r); 8151 smallDictt *r2 = self->f->setSmallContainer(self, "1", &c); 8152 ck_assert_ptr_ne(r2, null); 8153 r = getVoidSmallDictG(self, null, "1"); 8154 ck_assert_ptr_eq(r, &r); 8155 terminateO(self); 8156 8157 } 8158 8159 8160 void getSmallContainerSmallDictGT(void) { 8161 8162 smallContainert* r; 8163 smallDictt *self = allocG(rtSmallDictt); 8164 8165 createSmallContainer(c); 8166 setValO(&c, &r); 8167 smallDictt *r2 = self->f->setSmallContainer(self, "1", &c); 8168 ck_assert_ptr_ne(r2, null); 8169 r = getSmallContainerSmallDictG(self, null, "1"); 8170 ck_assert_ptr_ne(r, null); 8171 char *s = toStringO(r); 8172 finishO(r); 8173 ck_assert_str_eq(s, "<data smallContainer>"); 8174 free(s); 8175 terminateO(self); 8176 8177 } 8178 8179 8180 void getKCharSmallDictGT(void) { 8181 8182 baset* r; 8183 smallDictt *self = allocG(rtSmallDictt); 8184 8185 self->f->setInt(self, "1", 2); 8186 r = getKCharSmallDictG(self, null, '1'); 8187 ck_assert_ptr_ne(r, null); 8188 char *s = toStringO(r); 8189 finishO(r); 8190 ck_assert_str_eq(s, "2"); 8191 free(s); 8192 terminateO(self); 8193 8194 } 8195 8196 8197 void getUndefinedKCharSmallDictGT(void) { 8198 8199 undefinedt* r; 8200 smallDictt *self = allocG(rtSmallDictt); 8201 8202 smallDictt *r2 = self->f->setUndefined(self, "1"); 8203 ck_assert_ptr_ne(r2, null); 8204 r = getUndefinedKCharSmallDictG(self, null, '1'); 8205 ck_assert_ptr_ne(r, null); 8206 finishO(r); 8207 terminateO(self); 8208 8209 } 8210 8211 8212 void getBoolKCharSmallDictGT(void) { 8213 8214 bool r; 8215 smallDictt *self = allocG(rtSmallDictt); 8216 8217 smallDictt* r2 = self->f->setBool(self, "1", true); 8218 ck_assert_ptr_ne(r2, null); 8219 r = getBoolKCharSmallDictG(self, false, '1'); 8220 ck_assert(r); 8221 terminateO(self); 8222 8223 } 8224 8225 8226 void getBoolPKCharSmallDictGT(void) { 8227 8228 bool* r; 8229 smallDictt *self = allocG(rtSmallDictt); 8230 8231 smallDictt* r2 = self->f->setBool(self, "1", true); 8232 ck_assert_ptr_ne(r2, null); 8233 r = getBoolPKCharSmallDictG(self, null, '1'); 8234 ck_assert_ptr_ne(r, null); 8235 ck_assert(*r); 8236 terminateO(self); 8237 8238 } 8239 8240 8241 void getDoubleKCharSmallDictGT(void) { 8242 8243 double r; 8244 smallDictt *self = allocG(rtSmallDictt); 8245 8246 smallDictt *r2 = self->f->setDouble(self, "1", 2.2); 8247 ck_assert_ptr_ne(r2, null); 8248 r = getDoubleKCharSmallDictG(self, 0, '1'); 8249 ck_assert(r == 2.2); 8250 terminateO(self); 8251 8252 } 8253 8254 8255 void getDoublePKCharSmallDictGT(void) { 8256 8257 double* r; 8258 smallDictt *self = allocG(rtSmallDictt); 8259 8260 smallDictt *r2 = self->f->setDouble(self, "1", 2.2); 8261 ck_assert_ptr_ne(r2, null); 8262 r = getDoublePKCharSmallDictG(self, null, '1'); 8263 ck_assert_ptr_ne(r, null); 8264 ck_assert(*r == 2.2); 8265 terminateO(self); 8266 8267 } 8268 8269 8270 void getIntKCharSmallDictGT(void) { 8271 8272 int64_t r; 8273 smallDictt *self = allocG(rtSmallDictt); 8274 8275 smallDictt *r2 = self->f->setInt(self, "1", 2); 8276 ck_assert_ptr_ne(r2, null); 8277 r = getIntKCharSmallDictG(self, 0, '1'); 8278 ck_assert_int_eq(r, 2); 8279 terminateO(self); 8280 8281 } 8282 8283 8284 void getIntPKCharSmallDictGT(void) { 8285 8286 int64_t* r; 8287 smallDictt *self = allocG(rtSmallDictt); 8288 8289 smallDictt *r2 = self->f->setInt(self, "1", 2); 8290 ck_assert_ptr_ne(r2, null); 8291 r = getIntPKCharSmallDictG(self, null, '1'); 8292 ck_assert_ptr_ne(r, null); 8293 ck_assert_int_eq(*r, 2); 8294 terminateO(self); 8295 8296 } 8297 8298 8299 void getInt32KCharSmallDictGT(void) { 8300 8301 int32_t r; 8302 smallDictt *self = allocG(rtSmallDictt); 8303 8304 smallDictt *r2 = self->f->setInt(self, "1", 2); 8305 ck_assert_ptr_ne(r2, null); 8306 r = getInt32KCharSmallDictG(self, 0, '1'); 8307 ck_assert_int_eq(r, 2); 8308 terminateO(self); 8309 8310 } 8311 8312 8313 void getInt32PKCharSmallDictGT(void) { 8314 8315 int32_t* r; 8316 smallDictt *self = allocG(rtSmallDictt); 8317 8318 smallDictt *r2 = self->f->setInt(self, "1", 2); 8319 ck_assert_ptr_ne(r2, null); 8320 r = getInt32PKCharSmallDictG(self, null, '1'); 8321 ck_assert_ptr_ne(r, null); 8322 ck_assert_int_eq(*r, 2); 8323 terminateO(self); 8324 8325 } 8326 8327 8328 void getUintKCharSmallDictGT(void) { 8329 8330 uint64_t r; 8331 smallDictt *self = allocG(rtSmallDictt); 8332 8333 smallDictt *r2 = self->f->setInt(self, "1", 2); 8334 ck_assert_ptr_ne(r2, null); 8335 r = getUintKCharSmallDictG(self, 0, '1'); 8336 ck_assert_int_eq(r, 2); 8337 terminateO(self); 8338 8339 } 8340 8341 8342 void getUintPKCharSmallDictGT(void) { 8343 8344 uint64_t* r; 8345 smallDictt *self = allocG(rtSmallDictt); 8346 8347 smallDictt *r2 = self->f->setInt(self, "1", 2); 8348 ck_assert_ptr_ne(r2, null); 8349 r = getUintPKCharSmallDictG(self, null, '1'); 8350 ck_assert_ptr_ne(r, null); 8351 ck_assert_int_eq(*r, 2); 8352 terminateO(self); 8353 8354 } 8355 8356 8357 void getUint32KCharSmallDictGT(void) { 8358 8359 uint32_t r; 8360 smallDictt *self = allocG(rtSmallDictt); 8361 8362 smallDictt *r2 = self->f->setInt(self, "1", 2); 8363 ck_assert_ptr_ne(r2, null); 8364 r = getUint32KCharSmallDictG(self, 0, '1'); 8365 ck_assert_int_eq(r, 2); 8366 terminateO(self); 8367 8368 } 8369 8370 8371 void getUint32PKCharSmallDictGT(void) { 8372 8373 uint32_t* r; 8374 smallDictt *self = allocG(rtSmallDictt); 8375 8376 smallDictt *r2 = self->f->setInt(self, "1", 2); 8377 ck_assert_ptr_ne(r2, null); 8378 r = getUint32PKCharSmallDictG(self, null, '1'); 8379 ck_assert_ptr_ne(r, null); 8380 ck_assert_int_eq(*r, 2); 8381 terminateO(self); 8382 8383 } 8384 8385 8386 void getSKCharSmallDictGT(void) { 8387 8388 char* r; 8389 smallDictt *self = allocG(rtSmallDictt); 8390 8391 smallDictt *r2 = self->f->setS(self, "1", "qwe"); 8392 ck_assert_ptr_ne(r2, null); 8393 r = getSKCharSmallDictG(self, null, '1'); 8394 ck_assert_ptr_ne(r, null); 8395 ck_assert_str_eq(r, "qwe"); 8396 terminateO(self); 8397 8398 } 8399 8400 8401 void getDictKCharSmallDictGT(void) { 8402 8403 smallDictt* r; 8404 smallDictt *self = allocG(rtSmallDictt); 8405 smallDictt *dict = allocSmallDict(); 8406 8407 r = self->f->setNFreeDict(self, "1", dict); 8408 ck_assert_ptr_ne(r, null); 8409 r = getDictKCharSmallDictG(self, null, '1'); 8410 ck_assert_ptr_ne(r, null); 8411 char *s = toStringO(r); 8412 finishO(r); 8413 ck_assert_str_eq(s, "{}"); 8414 free(s); 8415 terminateO(self); 8416 8417 } 8418 8419 8420 void getArrayKCharSmallDictGT(void) { 8421 8422 smallArrayt* r; 8423 smallDictt *self = allocG(rtSmallDictt); 8424 smallArrayt *array = allocSmallArray(); 8425 8426 smallDictt *r2 = self->f->setNFreeArray(self, "1", array); 8427 ck_assert_ptr_ne(r2, null); 8428 r = getArrayKCharSmallDictG(self, null, '1'); 8429 ck_assert_ptr_ne(r, null); 8430 char *s = toStringO(r); 8431 finishO(r); 8432 ck_assert_str_eq(s, "[]"); 8433 free(s); 8434 terminateO(self); 8435 8436 } 8437 8438 8439 void getSmallBoolKCharSmallDictGT(void) { 8440 8441 smallBoolt* r; 8442 smallDictt *self = allocG(rtSmallDictt); 8443 8444 smallDictt* r2 = self->f->setBool(self, "1", true); 8445 ck_assert_ptr_ne(r2, null); 8446 r = getSmallBoolKCharSmallDictG(self, null, '1'); 8447 ck_assert_ptr_ne(r, null); 8448 char *s = toStringO(r); 8449 finishO(r); 8450 ck_assert_str_eq(s, "true"); 8451 free(s); 8452 terminateO(self); 8453 8454 } 8455 8456 8457 void getSmallBytesKCharSmallDictGT(void) { 8458 8459 smallBytest* r; 8460 smallDictt *self = allocG(rtSmallDictt); 8461 smallBytest *value = allocSmallBytes("qwe", sizeof("qwe")); 8462 8463 smallDictt *r2 = self->f->setNFreeSmallBytes(self, "1", value); 8464 ck_assert_ptr_ne(r2, null); 8465 r = getSmallBytesKCharSmallDictG(self, null, '1'); 8466 ck_assert_ptr_ne(r, null); 8467 char *s = toStringO(r); 8468 finishO(r); 8469 ck_assert_str_eq(s, "[0x71,0x77,0x65,0x00]"); 8470 free(s); 8471 terminateO(self); 8472 8473 } 8474 8475 8476 void getSmallDoubleKCharSmallDictGT(void) { 8477 8478 smallDoublet* r; 8479 smallDictt *self = allocG(rtSmallDictt); 8480 8481 smallDictt *r2 = self->f->setDouble(self, "1", 2.2); 8482 ck_assert_ptr_ne(r2, null); 8483 r = getSmallDoubleKCharSmallDictG(self, null, '1'); 8484 ck_assert_ptr_ne(r, null); 8485 char *s = toStringO(r); 8486 finishO(r); 8487 ck_assert_str_eq(s, "2.200000e+00"); 8488 free(s); 8489 terminateO(self); 8490 8491 } 8492 8493 8494 void getSmallIntKCharSmallDictGT(void) { 8495 8496 smallIntt* r; 8497 smallDictt *self = allocG(rtSmallDictt); 8498 8499 smallDictt *r2 = self->f->setInt(self, "1", 2); 8500 ck_assert_ptr_ne(r2, null); 8501 r = getSmallIntKCharSmallDictG(self, null, '1'); 8502 ck_assert_ptr_ne(r, null); 8503 char *s = toStringO(r); 8504 finishO(r); 8505 ck_assert_str_eq(s, "2"); 8506 free(s); 8507 terminateO(self); 8508 8509 } 8510 8511 8512 void getSmallJsonKCharSmallDictGT(void) { 8513 8514 smallJsont* r; 8515 smallDictt *self = allocG(rtSmallDictt); 8516 smallJsont *value = allocSmallJson(); 8517 8518 setTopIntO(value, 2); 8519 smallDictt *r2 = self->f->setNFreeSmallJson(self, "1", value); 8520 ck_assert_ptr_ne(r2, null); 8521 r = getSmallJsonKCharSmallDictG(self, null, '1'); 8522 ck_assert_ptr_ne(r, null); 8523 char *s = toStringO(r); 8524 finishO(r); 8525 ck_assert_str_eq(s, "2"); 8526 free(s); 8527 terminateO(self); 8528 8529 } 8530 8531 8532 void getSmallStringKCharSmallDictGT(void) { 8533 8534 smallStringt* r; 8535 smallDictt *self = allocG(rtSmallDictt); 8536 8537 smallDictt *r2 = self->f->setS(self, "1", "qwe"); 8538 ck_assert_ptr_ne(r2, null); 8539 r = getSmallStringKCharSmallDictG(self, null, '1'); 8540 ck_assert_ptr_ne(r, null); 8541 char *s = toStringO(r); 8542 finishO(r); 8543 ck_assert_str_eq(s, "qwe"); 8544 free(s); 8545 terminateO(self); 8546 8547 } 8548 8549 8550 void getVoidKCharSmallDictGT(void) { 8551 8552 void* r; 8553 smallDictt *self = allocG(rtSmallDictt); 8554 8555 createSmallContainer(c); 8556 setValO(&c, &r); 8557 smallDictt *r2 = self->f->setSmallContainer(self, "1", &c); 8558 ck_assert_ptr_ne(r2, null); 8559 r = getVoidKCharSmallDictG(self, null, '1'); 8560 ck_assert_ptr_eq(r, &r); 8561 terminateO(self); 8562 8563 } 8564 8565 8566 void getSmallContainerKCharSmallDictGT(void) { 8567 8568 smallContainert* r; 8569 smallDictt *self = allocG(rtSmallDictt); 8570 8571 createSmallContainer(c); 8572 setValO(&c, &r); 8573 smallDictt *r2 = self->f->setSmallContainer(self, "1", &c); 8574 ck_assert_ptr_ne(r2, null); 8575 r = getSmallContainerKCharSmallDictG(self, null, '1'); 8576 ck_assert_ptr_ne(r, null); 8577 char *s = toStringO(r); 8578 finishO(r); 8579 ck_assert_str_eq(s, "<data smallContainer>"); 8580 free(s); 8581 terminateO(self); 8582 8583 } 8584 8585 8586 void getNDupSmallDictGT(void) { 8587 8588 baset* r; 8589 smallDictt *self = allocG(rtSmallDictt); 8590 8591 self->f->setInt(self, "1", 2); 8592 r = getNDupSmallDictG(self, null, "1"); 8593 ck_assert_ptr_ne(r, null); 8594 char *s = toStringO(r); 8595 terminateO(r); 8596 ck_assert_str_eq(s, "2"); 8597 free(s); 8598 terminateO(self); 8599 8600 } 8601 8602 8603 void getNDupUndefinedSmallDictGT(void) { 8604 8605 undefinedt* r; 8606 smallDictt *self = allocG(rtSmallDictt); 8607 8608 smallDictt *r2 = self->f->setUndefined(self, "1"); 8609 ck_assert_ptr_ne(r2, null); 8610 r = getNDupUndefinedSmallDictG(self, null, "1"); 8611 ck_assert_ptr_ne(r, null); 8612 terminateO(r); 8613 terminateO(self); 8614 8615 } 8616 8617 8618 void getNDupBoolSmallDictGT(void) { 8619 8620 bool r; 8621 smallDictt *self = allocG(rtSmallDictt); 8622 8623 smallDictt* r2 = self->f->setBool(self, "1", true); 8624 ck_assert_ptr_ne(r2, null); 8625 r = getNDupBoolSmallDictG(self, false, "1"); 8626 ck_assert(r); 8627 terminateO(self); 8628 8629 } 8630 8631 8632 void getNDupDoubleSmallDictGT(void) { 8633 8634 double r; 8635 smallDictt *self = allocG(rtSmallDictt); 8636 8637 smallDictt *r2 = self->f->setDouble(self, "1", 2.2); 8638 ck_assert_ptr_ne(r2, null); 8639 r = getNDupDoubleSmallDictG(self, 0, "1"); 8640 ck_assert(r == 2.2); 8641 terminateO(self); 8642 8643 } 8644 8645 8646 void getNDupIntSmallDictGT(void) { 8647 8648 int64_t r; 8649 smallDictt *self = allocG(rtSmallDictt); 8650 8651 smallDictt *r2 = self->f->setInt(self, "1", 2); 8652 ck_assert_ptr_ne(r2, null); 8653 r = getNDupIntSmallDictG(self, 0, "1"); 8654 ck_assert_int_eq(r, 2); 8655 terminateO(self); 8656 8657 } 8658 8659 8660 void getNDupInt32SmallDictGT(void) { 8661 8662 int32_t r; 8663 smallDictt *self = allocG(rtSmallDictt); 8664 8665 smallDictt *r2 = self->f->setInt(self, "1", 2); 8666 ck_assert_ptr_ne(r2, null); 8667 r = getNDupInt32SmallDictG(self, 0, "1"); 8668 ck_assert_int_eq(r, 2); 8669 terminateO(self); 8670 8671 } 8672 8673 8674 void getNDupUintSmallDictGT(void) { 8675 8676 uint64_t r; 8677 smallDictt *self = allocG(rtSmallDictt); 8678 8679 smallDictt *r2 = self->f->setInt(self, "1", 2); 8680 ck_assert_ptr_ne(r2, null); 8681 r = getNDupUintSmallDictG(self, 0, "1"); 8682 ck_assert_int_eq(r, 2); 8683 terminateO(self); 8684 8685 } 8686 8687 8688 void getNDupUint32SmallDictGT(void) { 8689 8690 uint32_t r; 8691 smallDictt *self = allocG(rtSmallDictt); 8692 8693 smallDictt *r2 = self->f->setInt(self, "1", 2); 8694 ck_assert_ptr_ne(r2, null); 8695 r = getNDupUint32SmallDictG(self, 0, "1"); 8696 ck_assert_int_eq(r, 2); 8697 terminateO(self); 8698 8699 } 8700 8701 8702 void getNDupSSmallDictGT(void) { 8703 8704 char* r; 8705 smallDictt *self = allocG(rtSmallDictt); 8706 8707 smallDictt *r2 = self->f->setS(self, "1", "qwe"); 8708 ck_assert_ptr_ne(r2, null); 8709 r = getNDupSSmallDictG(self, null, "1"); 8710 ck_assert_ptr_ne(r, null); 8711 ck_assert_str_eq(r, "qwe"); 8712 free(r); 8713 terminateO(self); 8714 8715 } 8716 8717 8718 void getNDupDictSmallDictGT(void) { 8719 8720 smallDictt* r; 8721 smallDictt *self = allocG(rtSmallDictt); 8722 smallDictt *dict = allocSmallDict(); 8723 8724 r = self->f->setNFreeDict(self, "1", dict); 8725 ck_assert_ptr_ne(r, null); 8726 r = getNDupDictSmallDictG(self, null, "1"); 8727 ck_assert_ptr_ne(r, null); 8728 char *s = toStringO(r); 8729 terminateO(r); 8730 ck_assert_str_eq(s, "{}"); 8731 free(s); 8732 terminateO(self); 8733 8734 } 8735 8736 8737 void getNDupArraySmallDictGT(void) { 8738 8739 smallArrayt* r; 8740 smallDictt *self = allocG(rtSmallDictt); 8741 smallArrayt *array = allocSmallArray(); 8742 8743 smallDictt *r2 = self->f->setNFreeArray(self, "1", array); 8744 ck_assert_ptr_ne(r2, null); 8745 r = getNDupArraySmallDictG(self, null, "1"); 8746 ck_assert_ptr_ne(r, null); 8747 char *s = toStringO(r); 8748 terminateO(r); 8749 ck_assert_str_eq(s, "[]"); 8750 free(s); 8751 terminateO(self); 8752 8753 } 8754 8755 8756 void getNDupSmallBoolSmallDictGT(void) { 8757 8758 smallBoolt* r; 8759 smallDictt *self = allocG(rtSmallDictt); 8760 8761 smallDictt* r2 = self->f->setBool(self, "1", true); 8762 ck_assert_ptr_ne(r2, null); 8763 r = getNDupSmallBoolSmallDictG(self, null, "1"); 8764 ck_assert_ptr_ne(r, null); 8765 char *s = toStringO(r); 8766 terminateO(r); 8767 ck_assert_str_eq(s, "true"); 8768 free(s); 8769 terminateO(self); 8770 8771 } 8772 8773 8774 void getNDupSmallBytesSmallDictGT(void) { 8775 8776 smallBytest* r; 8777 smallDictt *self = allocG(rtSmallDictt); 8778 smallBytest *value = allocSmallBytes("qwe", sizeof("qwe")); 8779 8780 smallDictt *r2 = self->f->setNFreeSmallBytes(self, "1", value); 8781 ck_assert_ptr_ne(r2, null); 8782 r = getNDupSmallBytesSmallDictG(self, null, "1"); 8783 ck_assert_ptr_ne(r, null); 8784 char *s = toStringO(r); 8785 terminateO(r); 8786 ck_assert_str_eq(s, "[0x71,0x77,0x65,0x00]"); 8787 free(s); 8788 terminateO(self); 8789 8790 } 8791 8792 8793 void getNDupSmallDoubleSmallDictGT(void) { 8794 8795 smallDoublet* r; 8796 smallDictt *self = allocG(rtSmallDictt); 8797 8798 smallDictt *r2 = self->f->setDouble(self, "1", 2.2); 8799 ck_assert_ptr_ne(r2, null); 8800 r = getNDupSmallDoubleSmallDictG(self, null, "1"); 8801 ck_assert_ptr_ne(r, null); 8802 char *s = toStringO(r); 8803 terminateO(r); 8804 ck_assert_str_eq(s, "2.200000e+00"); 8805 free(s); 8806 terminateO(self); 8807 8808 } 8809 8810 8811 void getNDupSmallIntSmallDictGT(void) { 8812 8813 smallIntt* r; 8814 smallDictt *self = allocG(rtSmallDictt); 8815 8816 smallDictt *r2 = self->f->setInt(self, "1", 2); 8817 ck_assert_ptr_ne(r2, null); 8818 r = getNDupSmallIntSmallDictG(self, null, "1"); 8819 ck_assert_ptr_ne(r, null); 8820 char *s = toStringO(r); 8821 terminateO(r); 8822 ck_assert_str_eq(s, "2"); 8823 free(s); 8824 terminateO(self); 8825 8826 } 8827 8828 8829 void getNDupSmallJsonSmallDictGT(void) { 8830 8831 smallJsont* r; 8832 smallDictt *self = allocG(rtSmallDictt); 8833 smallJsont *value = allocSmallJson(); 8834 8835 setTopIntO(value, 2); 8836 smallDictt *r2 = self->f->setNFreeSmallJson(self, "1", value); 8837 ck_assert_ptr_ne(r2, null); 8838 r = getNDupSmallJsonSmallDictG(self, null, "1"); 8839 ck_assert_ptr_ne(r, null); 8840 char *s = toStringO(r); 8841 terminateO(r); 8842 ck_assert_str_eq(s, "2"); 8843 free(s); 8844 terminateO(self); 8845 8846 } 8847 8848 8849 void getNDupSmallStringSmallDictGT(void) { 8850 8851 smallStringt* r; 8852 smallDictt *self = allocG(rtSmallDictt); 8853 8854 smallDictt *r2 = self->f->setS(self, "1", "qwe"); 8855 ck_assert_ptr_ne(r2, null); 8856 r = getNDupSmallStringSmallDictG(self, null, "1"); 8857 ck_assert_ptr_ne(r, null); 8858 char *s = toStringO(r); 8859 terminateO(r); 8860 ck_assert_str_eq(s, "qwe"); 8861 free(s); 8862 terminateO(self); 8863 8864 } 8865 8866 8867 void getNDupVoidSmallDictGT(void) { 8868 8869 void* r; 8870 smallDictt *self = allocG(rtSmallDictt); 8871 8872 createSmallContainer(c); 8873 setValO(&c, &r); 8874 smallDictt *r2 = self->f->setSmallContainer(self, "1", &c); 8875 ck_assert_ptr_ne(r2, null); 8876 r = getNDupVoidSmallDictG(self, null, "1"); 8877 ck_assert_ptr_eq(r, null); 8878 terminateO(self); 8879 8880 } 8881 8882 8883 void getNDupSmallContainerSmallDictGT(void) { 8884 8885 smallContainert* r; 8886 smallDictt *self = allocG(rtSmallDictt); 8887 8888 createSmallContainer(c); 8889 setValO(&c, &r); 8890 smallDictt *r2 = self->f->setSmallContainer(self, "1", &c); 8891 ck_assert_ptr_ne(r2, null); 8892 r = getNDupSmallContainerSmallDictG(self, null, "1"); 8893 ck_assert_ptr_ne(r, null); 8894 char *s = toStringO(r); 8895 terminateO(r); 8896 ck_assert_str_eq(s, "<data smallContainer>"); 8897 free(s); 8898 terminateO(self); 8899 8900 } 8901 8902 8903 void getNDupKCharSmallDictGT(void) { 8904 8905 baset* r; 8906 smallDictt *self = allocG(rtSmallDictt); 8907 8908 self->f->setInt(self, "1", 2); 8909 r = getNDupKCharSmallDictG(self, null, '1'); 8910 ck_assert_ptr_ne(r, null); 8911 char *s = toStringO(r); 8912 terminateO(r); 8913 ck_assert_str_eq(s, "2"); 8914 free(s); 8915 terminateO(self); 8916 8917 } 8918 8919 8920 void getNDupUndefinedKCharSmallDictGT(void) { 8921 8922 undefinedt* r; 8923 smallDictt *self = allocG(rtSmallDictt); 8924 8925 smallDictt *r2 = self->f->setUndefined(self, "1"); 8926 ck_assert_ptr_ne(r2, null); 8927 r = getNDupUndefinedKCharSmallDictG(self, null, '1'); 8928 ck_assert_ptr_ne(r, null); 8929 terminateO(r); 8930 terminateO(self); 8931 8932 } 8933 8934 8935 void getNDupBoolKCharSmallDictGT(void) { 8936 8937 bool r; 8938 smallDictt *self = allocG(rtSmallDictt); 8939 8940 smallDictt* r2 = self->f->setBool(self, "1", true); 8941 ck_assert_ptr_ne(r2, null); 8942 r = getNDupBoolKCharSmallDictG(self, false, '1'); 8943 ck_assert(r); 8944 terminateO(self); 8945 8946 } 8947 8948 8949 void getNDupDoubleKCharSmallDictGT(void) { 8950 8951 double r; 8952 smallDictt *self = allocG(rtSmallDictt); 8953 8954 smallDictt *r2 = self->f->setDouble(self, "1", 2.2); 8955 ck_assert_ptr_ne(r2, null); 8956 r = getNDupDoubleKCharSmallDictG(self, 0, '1'); 8957 ck_assert(r == 2.2); 8958 terminateO(self); 8959 8960 } 8961 8962 8963 void getNDupIntKCharSmallDictGT(void) { 8964 8965 int64_t r; 8966 smallDictt *self = allocG(rtSmallDictt); 8967 8968 smallDictt *r2 = self->f->setInt(self, "1", 2); 8969 ck_assert_ptr_ne(r2, null); 8970 r = getNDupIntKCharSmallDictG(self, 0, '1'); 8971 ck_assert_int_eq(r, 2); 8972 terminateO(self); 8973 8974 } 8975 8976 8977 void getNDupInt32KCharSmallDictGT(void) { 8978 8979 int32_t r; 8980 smallDictt *self = allocG(rtSmallDictt); 8981 8982 smallDictt *r2 = self->f->setInt(self, "1", 2); 8983 ck_assert_ptr_ne(r2, null); 8984 r = getNDupInt32KCharSmallDictG(self, 0, '1'); 8985 ck_assert_int_eq(r, 2); 8986 terminateO(self); 8987 8988 } 8989 8990 8991 void getNDupUintKCharSmallDictGT(void) { 8992 8993 uint64_t r; 8994 smallDictt *self = allocG(rtSmallDictt); 8995 8996 smallDictt *r2 = self->f->setInt(self, "1", 2); 8997 ck_assert_ptr_ne(r2, null); 8998 r = getNDupUintKCharSmallDictG(self, 0, '1'); 8999 ck_assert_int_eq(r, 2); 9000 terminateO(self); 9001 9002 } 9003 9004 9005 void getNDupUint32KCharSmallDictGT(void) { 9006 9007 uint32_t r; 9008 smallDictt *self = allocG(rtSmallDictt); 9009 9010 smallDictt *r2 = self->f->setInt(self, "1", 2); 9011 ck_assert_ptr_ne(r2, null); 9012 r = getNDupUint32KCharSmallDictG(self, 0, '1'); 9013 ck_assert_int_eq(r, 2); 9014 terminateO(self); 9015 9016 } 9017 9018 9019 void getNDupSKCharSmallDictGT(void) { 9020 9021 char* r; 9022 smallDictt *self = allocG(rtSmallDictt); 9023 9024 smallDictt *r2 = self->f->setS(self, "1", "qwe"); 9025 ck_assert_ptr_ne(r2, null); 9026 r = getNDupSKCharSmallDictG(self, null, '1'); 9027 ck_assert_ptr_ne(r, null); 9028 ck_assert_str_eq(r, "qwe"); 9029 free(r); 9030 terminateO(self); 9031 9032 } 9033 9034 9035 void getNDupDictKCharSmallDictGT(void) { 9036 9037 smallDictt* r; 9038 smallDictt *self = allocG(rtSmallDictt); 9039 smallDictt *dict = allocSmallDict(); 9040 9041 r = self->f->setNFreeDict(self, "1", dict); 9042 ck_assert_ptr_ne(r, null); 9043 r = getNDupDictKCharSmallDictG(self, null, '1'); 9044 ck_assert_ptr_ne(r, null); 9045 char *s = toStringO(r); 9046 terminateO(r); 9047 ck_assert_str_eq(s, "{}"); 9048 free(s); 9049 terminateO(self); 9050 9051 } 9052 9053 9054 void getNDupArrayKCharSmallDictGT(void) { 9055 9056 smallArrayt* r; 9057 smallDictt *self = allocG(rtSmallDictt); 9058 smallArrayt *array = allocSmallArray(); 9059 9060 smallDictt *r2 = self->f->setNFreeArray(self, "1", array); 9061 ck_assert_ptr_ne(r2, null); 9062 r = getNDupArrayKCharSmallDictG(self, null, '1'); 9063 ck_assert_ptr_ne(r, null); 9064 char *s = toStringO(r); 9065 terminateO(r); 9066 ck_assert_str_eq(s, "[]"); 9067 free(s); 9068 terminateO(self); 9069 9070 } 9071 9072 9073 void getNDupSmallBoolKCharSmallDictGT(void) { 9074 9075 smallBoolt* r; 9076 smallDictt *self = allocG(rtSmallDictt); 9077 9078 smallDictt* r2 = self->f->setBool(self, "1", true); 9079 ck_assert_ptr_ne(r2, null); 9080 r = getNDupSmallBoolKCharSmallDictG(self, null, '1'); 9081 ck_assert_ptr_ne(r, null); 9082 char *s = toStringO(r); 9083 terminateO(r); 9084 ck_assert_str_eq(s, "true"); 9085 free(s); 9086 terminateO(self); 9087 9088 } 9089 9090 9091 void getNDupSmallBytesKCharSmallDictGT(void) { 9092 9093 smallBytest* r; 9094 smallDictt *self = allocG(rtSmallDictt); 9095 smallBytest *value = allocSmallBytes("qwe", sizeof("qwe")); 9096 9097 smallDictt *r2 = self->f->setNFreeSmallBytes(self, "1", value); 9098 ck_assert_ptr_ne(r2, null); 9099 r = getNDupSmallBytesKCharSmallDictG(self, null, '1'); 9100 ck_assert_ptr_ne(r, null); 9101 char *s = toStringO(r); 9102 terminateO(r); 9103 ck_assert_str_eq(s, "[0x71,0x77,0x65,0x00]"); 9104 free(s); 9105 terminateO(self); 9106 9107 } 9108 9109 9110 void getNDupSmallDoubleKCharSmallDictGT(void) { 9111 9112 smallDoublet* r; 9113 smallDictt *self = allocG(rtSmallDictt); 9114 9115 smallDictt *r2 = self->f->setDouble(self, "1", 2.2); 9116 ck_assert_ptr_ne(r2, null); 9117 r = getNDupSmallDoubleKCharSmallDictG(self, null, '1'); 9118 ck_assert_ptr_ne(r, null); 9119 char *s = toStringO(r); 9120 terminateO(r); 9121 ck_assert_str_eq(s, "2.200000e+00"); 9122 free(s); 9123 terminateO(self); 9124 9125 } 9126 9127 9128 void getNDupSmallIntKCharSmallDictGT(void) { 9129 9130 smallIntt* r; 9131 smallDictt *self = allocG(rtSmallDictt); 9132 9133 smallDictt *r2 = self->f->setInt(self, "1", 2); 9134 ck_assert_ptr_ne(r2, null); 9135 r = getNDupSmallIntKCharSmallDictG(self, null, '1'); 9136 ck_assert_ptr_ne(r, null); 9137 char *s = toStringO(r); 9138 terminateO(r); 9139 ck_assert_str_eq(s, "2"); 9140 free(s); 9141 terminateO(self); 9142 9143 } 9144 9145 9146 void getNDupSmallJsonKCharSmallDictGT(void) { 9147 9148 smallJsont* r; 9149 smallDictt *self = allocG(rtSmallDictt); 9150 smallJsont *value = allocSmallJson(); 9151 9152 setTopIntO(value, 2); 9153 smallDictt *r2 = self->f->setNFreeSmallJson(self, "1", value); 9154 ck_assert_ptr_ne(r2, null); 9155 r = getNDupSmallJsonKCharSmallDictG(self, null, '1'); 9156 ck_assert_ptr_ne(r, null); 9157 char *s = toStringO(r); 9158 terminateO(r); 9159 ck_assert_str_eq(s, "2"); 9160 free(s); 9161 terminateO(self); 9162 9163 } 9164 9165 9166 void getNDupSmallStringKCharSmallDictGT(void) { 9167 9168 smallStringt* r; 9169 smallDictt *self = allocG(rtSmallDictt); 9170 9171 smallDictt *r2 = self->f->setS(self, "1", "qwe"); 9172 ck_assert_ptr_ne(r2, null); 9173 r = getNDupSmallStringKCharSmallDictG(self, null, '1'); 9174 ck_assert_ptr_ne(r, null); 9175 char *s = toStringO(r); 9176 terminateO(r); 9177 ck_assert_str_eq(s, "qwe"); 9178 free(s); 9179 terminateO(self); 9180 9181 } 9182 9183 9184 void getNDupVoidKCharSmallDictGT(void) { 9185 9186 void* r; 9187 smallDictt *self = allocG(rtSmallDictt); 9188 9189 createSmallContainer(c); 9190 setValO(&c, &r); 9191 smallDictt *r2 = self->f->setSmallContainer(self, "1", &c); 9192 ck_assert_ptr_ne(r2, null); 9193 r = getNDupVoidKCharSmallDictG(self, null, '1'); 9194 ck_assert_ptr_eq(r, null); 9195 terminateO(self); 9196 9197 } 9198 9199 9200 void getNDupSmallContainerKCharSmallDictGT(void) { 9201 9202 smallContainert* r; 9203 smallDictt *self = allocG(rtSmallDictt); 9204 9205 createSmallContainer(c); 9206 setValO(&c, &r); 9207 smallDictt *r2 = self->f->setSmallContainer(self, "1", &c); 9208 ck_assert_ptr_ne(r2, null); 9209 r = getNDupSmallContainerKCharSmallDictG(self, null, '1'); 9210 ck_assert_ptr_ne(r, null); 9211 char *s = toStringO(r); 9212 terminateO(r); 9213 ck_assert_str_eq(s, "<data smallContainer>"); 9214 free(s); 9215 terminateO(self); 9216 9217 } 9218 9219 9220 void setUndefinedSmallDictGT(void) { 9221 9222 smallDictt* r; 9223 smallDictt *self = allocG(rtSmallDictt); 9224 9225 r = setUndefinedSmallDictG(self, "1", null); 9226 ck_assert_ptr_ne(r, null); 9227 char *s = toStringO(r); 9228 ck_assert_str_eq(s, "{\"1\":null}"); 9229 free(s); 9230 terminateO(self); 9231 9232 } 9233 9234 9235 void setBoolSmallDictGT(void) { 9236 9237 smallDictt* r; 9238 smallDictt *self = allocG(rtSmallDictt); 9239 9240 r = setBoolSmallDictG(self, "1", true); 9241 ck_assert_ptr_ne(r, null); 9242 char *s = toStringO(r); 9243 ck_assert_str_eq(s, "{\"1\":true}"); 9244 free(s); 9245 terminateO(self); 9246 9247 } 9248 9249 9250 void setDoubleSmallDictGT(void) { 9251 9252 smallDictt* r; 9253 smallDictt *self = allocG(rtSmallDictt); 9254 9255 r = setDoubleSmallDictG(self, "1", 2.2); 9256 ck_assert_ptr_ne(r, null); 9257 char *s = toStringO(r); 9258 ck_assert_str_eq(s, "{\"1\":2.200000e+00}"); 9259 free(s); 9260 terminateO(self); 9261 9262 } 9263 9264 9265 void setIntSmallDictGT(void) { 9266 9267 smallDictt* r; 9268 smallDictt *self = allocG(rtSmallDictt); 9269 9270 r = setIntSmallDictG(self, "1", 2); 9271 ck_assert_ptr_ne(r, null); 9272 char *s = toStringO(r); 9273 ck_assert_str_eq(s, "{\"1\":2}"); 9274 free(s); 9275 terminateO(self); 9276 9277 } 9278 9279 9280 void setSSmallDictGT(void) { 9281 9282 smallDictt* r; 9283 smallDictt *self = allocG(rtSmallDictt); 9284 9285 r = setSSmallDictG(self, "1", "qwe"); 9286 ck_assert_ptr_ne(r, null); 9287 char *s = toStringO(r); 9288 ck_assert_str_eq(s, "{\"1\":\"qwe\"}"); 9289 free(s); 9290 terminateO(self); 9291 9292 } 9293 9294 9295 void setCharSmallDictGT(void) { 9296 9297 smallDictt* r; 9298 smallDictt *self = allocG(rtSmallDictt); 9299 9300 r = setCharSmallDictG(self, "1", 'x'); 9301 ck_assert_ptr_ne(r, null); 9302 char *s = toStringO(r); 9303 ck_assert_str_eq(s, "{\"1\":\"x\"}"); 9304 free(s); 9305 terminateO(self); 9306 9307 } 9308 9309 9310 void setDictSmallDictGT(void) { 9311 9312 smallDictt* r; 9313 smallDictt *self = allocG(rtSmallDictt); 9314 smallDictt *dict = allocSmallDict(); 9315 9316 r = setDictSmallDictG(self, "1", dict); 9317 ck_assert_ptr_ne(r, null); 9318 finishO(dict); 9319 char *s = toStringO(r); 9320 ck_assert_str_eq(s, "{\"1\":{}}"); 9321 free(s); 9322 terminateO(self); 9323 9324 } 9325 9326 9327 void setArraySmallDictGT(void) { 9328 9329 smallDictt* r; 9330 smallDictt *self = allocG(rtSmallDictt); 9331 smallArrayt *array = allocSmallArray(); 9332 9333 r = setArraySmallDictG(self, "1", array); 9334 ck_assert_ptr_ne(r, null); 9335 finishO(array); 9336 char *s = toStringO(r); 9337 ck_assert_str_eq(s, "{\"1\":[]}"); 9338 free(s); 9339 terminateO(self); 9340 9341 } 9342 9343 9344 void setArraycSmallDictGT(void) { 9345 9346 smallDictt* r; 9347 smallDictt *self = allocG(rtSmallDictt); 9348 char **array = listCreateS("a", "b"); 9349 9350 r = setArraycSmallDictG(self, "1", array); 9351 ck_assert_ptr_ne(r, null); 9352 listFreeS(array); 9353 char *s = toStringO(r); 9354 ck_assert_str_eq(s, "{\"1\":[\"a\",\"b\"]}"); 9355 free(s); 9356 terminateO(self); 9357 9358 } 9359 9360 9361 void setCArraycSmallDictGT(void) { 9362 9363 smallDictt* r; 9364 smallDictt *self = allocG(rtSmallDictt); 9365 const char *array[] = {"a", "b", null}; 9366 9367 r = setCArraycSmallDictG(self, "1", array); 9368 ck_assert_ptr_ne(r, null); 9369 char *s = toStringO(r); 9370 ck_assert_str_eq(s, "{\"1\":[\"a\",\"b\"]}"); 9371 free(s); 9372 terminateO(self); 9373 9374 } 9375 9376 9377 void setVoidSmallDictGT(void) { 9378 9379 smallDictt* r; 9380 smallDictt *self = allocG(rtSmallDictt); 9381 9382 r = setVoidSmallDictG(self, "1", null); 9383 ck_assert_ptr_ne(r, null); 9384 char *s = toStringO(r); 9385 ck_assert_str_eq(s, "{\"1\":null}"); 9386 free(s); 9387 r = setVoidSmallDictG(self, "1", &r); 9388 ck_assert_ptr_ne(r, null); 9389 s = toStringO(r); 9390 ck_assert_str_eq(s, "{\"1\":\"<data container>\"}"); 9391 free(s); 9392 // null key 9393 r = setVoidSmallDictG(self, null, &r); 9394 ck_assert_ptr_eq(r, null); 9395 terminateO(self); 9396 9397 } 9398 9399 9400 void setSmallBoolSmallDictGT(void) { 9401 9402 smallDictt* r; 9403 smallDictt *self = allocG(rtSmallDictt); 9404 smallBoolt *value = allocSmallBool(true); 9405 9406 r = setSmallBoolSmallDictG(self, "1", value); 9407 ck_assert_ptr_ne(r, null); 9408 finishO(value); 9409 char *s = toStringO(r); 9410 ck_assert_str_eq(s, "{\"1\":true}"); 9411 free(s); 9412 terminateO(self); 9413 9414 } 9415 9416 9417 void setSmallBytesSmallDictGT(void) { 9418 9419 smallDictt* r; 9420 smallDictt *self = allocG(rtSmallDictt); 9421 smallBytest *value = allocSmallBytes("qwe", sizeof("qwe")); 9422 9423 r = setSmallBytesSmallDictG(self, "1", value); 9424 ck_assert_ptr_ne(r, null); 9425 finishO(value); 9426 char *s = toStringO(r); 9427 ck_assert_str_eq(s, "{\"1\":[0x71,0x77,0x65,0x00]}"); 9428 free(s); 9429 terminateO(self); 9430 9431 } 9432 9433 9434 void setSmallDoubleSmallDictGT(void) { 9435 9436 smallDictt* r; 9437 smallDictt *self = allocG(rtSmallDictt); 9438 smallDoublet *value = allocSmallDouble(2.2); 9439 9440 r = setSmallDoubleSmallDictG(self, "1", value); 9441 ck_assert_ptr_ne(r, null); 9442 finishO(value); 9443 char *s = toStringO(r); 9444 ck_assert_str_eq(s, "{\"1\":2.200000e+00}"); 9445 free(s); 9446 terminateO(self); 9447 9448 } 9449 9450 9451 void setSmallIntSmallDictGT(void) { 9452 9453 smallDictt* r; 9454 smallDictt *self = allocG(rtSmallDictt); 9455 smallIntt *value = allocSmallInt(2); 9456 9457 r = setSmallIntSmallDictG(self, "1", value); 9458 ck_assert_ptr_ne(r, null); 9459 finishO(value); 9460 char *s = toStringO(r); 9461 ck_assert_str_eq(s, "{\"1\":2}"); 9462 free(s); 9463 terminateO(self); 9464 9465 } 9466 9467 9468 void setSmallJsonSmallDictGT(void) { 9469 9470 smallDictt* r; 9471 smallDictt *self = allocG(rtSmallDictt); 9472 smallJsont *value = allocSmallJson(); 9473 9474 setTopIntO(value, 2); 9475 r = setSmallJsonSmallDictG(self, "1", value); 9476 ck_assert_ptr_ne(r, null); 9477 finishO(value); 9478 char *s = toStringO(r); 9479 ck_assert_str_eq(s, "{\"1\":2}"); 9480 free(s); 9481 terminateO(self); 9482 9483 } 9484 9485 9486 void setSmallStringSmallDictGT(void) { 9487 9488 smallDictt* r; 9489 smallDictt *self = allocG(rtSmallDictt); 9490 smallStringt *string = allocSmallString("qwe"); 9491 9492 r = setSmallStringSmallDictG(self, "1", string); 9493 ck_assert_ptr_ne(r, null); 9494 finishO(string); 9495 char *s = toStringO(r); 9496 ck_assert_str_eq(s, "{\"1\":\"qwe\"}"); 9497 free(s); 9498 terminateO(self); 9499 9500 } 9501 9502 9503 void setSmallContainerSmallDictGT(void) { 9504 9505 smallDictt* r; 9506 smallDictt *self = allocG(rtSmallDictt); 9507 smallContainert *container = allocSmallContainer(null); 9508 9509 r = setSmallContainerSmallDictG(self, "1", container); 9510 ck_assert_ptr_ne(r, null); 9511 finishO(container); 9512 char *s = toStringO(r); 9513 ck_assert_str_eq(s, "{\"1\":\"<data container>\"}"); 9514 free(s); 9515 terminateO(self); 9516 9517 } 9518 9519 9520 void setKCharSmallDictGT(void) { 9521 9522 smallDictt* r; 9523 smallDictt *self = allocG(rtSmallDictt); 9524 baset *value = (baset*) allocSmallInt(2); 9525 9526 r = setKCharSmallDictG(self, '1', value); 9527 ck_assert_ptr_ne(r, null); 9528 finishO(value); 9529 char *s = toStringO(r); 9530 ck_assert_str_eq(s, "{\"1\":2}"); 9531 free(s); 9532 terminateO(self); 9533 9534 } 9535 9536 9537 void setUndefinedKCharSmallDictGT(void) { 9538 9539 smallDictt* r; 9540 smallDictt *self = allocG(rtSmallDictt); 9541 9542 r = setUndefinedKCharSmallDictG(self, '1', null); 9543 ck_assert_ptr_ne(r, null); 9544 char *s = toStringO(r); 9545 ck_assert_str_eq(s, "{\"1\":null}"); 9546 free(s); 9547 terminateO(self); 9548 9549 } 9550 9551 9552 void setBoolKCharSmallDictGT(void) { 9553 9554 smallDictt* r; 9555 smallDictt *self = allocG(rtSmallDictt); 9556 9557 r = setBoolKCharSmallDictG(self, '1', true); 9558 ck_assert_ptr_ne(r, null); 9559 char *s = toStringO(r); 9560 ck_assert_str_eq(s, "{\"1\":true}"); 9561 free(s); 9562 terminateO(self); 9563 9564 } 9565 9566 9567 void setDoubleKCharSmallDictGT(void) { 9568 9569 smallDictt* r; 9570 smallDictt *self = allocG(rtSmallDictt); 9571 9572 r = setDoubleKCharSmallDictG(self, '1', 2.2); 9573 ck_assert_ptr_ne(r, null); 9574 char *s = toStringO(r); 9575 ck_assert_str_eq(s, "{\"1\":2.200000e+00}"); 9576 free(s); 9577 terminateO(self); 9578 9579 } 9580 9581 9582 void setIntKCharSmallDictGT(void) { 9583 9584 smallDictt* r; 9585 smallDictt *self = allocG(rtSmallDictt); 9586 9587 r = setIntKCharSmallDictG(self, '1', 2); 9588 ck_assert_ptr_ne(r, null); 9589 char *s = toStringO(r); 9590 ck_assert_str_eq(s, "{\"1\":2}"); 9591 free(s); 9592 terminateO(self); 9593 9594 } 9595 9596 9597 void setSKCharSmallDictGT(void) { 9598 9599 smallDictt* r; 9600 smallDictt *self = allocG(rtSmallDictt); 9601 9602 r = setSKCharSmallDictG(self, '1', "qwe"); 9603 ck_assert_ptr_ne(r, null); 9604 char *s = toStringO(r); 9605 ck_assert_str_eq(s, "{\"1\":\"qwe\"}"); 9606 free(s); 9607 terminateO(self); 9608 9609 } 9610 9611 9612 void setCharKCharSmallDictGT(void) { 9613 9614 smallDictt* r; 9615 smallDictt *self = allocG(rtSmallDictt); 9616 9617 r = setCharKCharSmallDictG(self, '1', 'x'); 9618 ck_assert_ptr_ne(r, null); 9619 char *s = toStringO(r); 9620 ck_assert_str_eq(s, "{\"1\":\"x\"}"); 9621 free(s); 9622 terminateO(self); 9623 9624 } 9625 9626 9627 void setDictKCharSmallDictGT(void) { 9628 9629 smallDictt* r; 9630 smallDictt *self = allocG(rtSmallDictt); 9631 smallDictt *dict = allocSmallDict(); 9632 9633 r = setDictKCharSmallDictG(self, '1', dict); 9634 ck_assert_ptr_ne(r, null); 9635 finishO(dict); 9636 char *s = toStringO(r); 9637 ck_assert_str_eq(s, "{\"1\":{}}"); 9638 free(s); 9639 terminateO(self); 9640 9641 } 9642 9643 9644 void setArrayKCharSmallDictGT(void) { 9645 9646 smallDictt* r; 9647 smallDictt *self = allocG(rtSmallDictt); 9648 smallArrayt *array = allocSmallArray(); 9649 9650 r = setArrayKCharSmallDictG(self, '1', array); 9651 ck_assert_ptr_ne(r, null); 9652 finishO(array); 9653 char *s = toStringO(r); 9654 ck_assert_str_eq(s, "{\"1\":[]}"); 9655 free(s); 9656 terminateO(self); 9657 9658 } 9659 9660 9661 void setArraycKCharSmallDictGT(void) { 9662 9663 smallDictt* r; 9664 smallDictt *self = allocG(rtSmallDictt); 9665 char **array = listCreateS("a", "b"); 9666 9667 r = setArraycKCharSmallDictG(self, '1', array); 9668 ck_assert_ptr_ne(r, null); 9669 listFreeS(array); 9670 char *s = toStringO(r); 9671 ck_assert_str_eq(s, "{\"1\":[\"a\",\"b\"]}"); 9672 free(s); 9673 terminateO(self); 9674 9675 } 9676 9677 9678 void setCArraycKCharSmallDictGT(void) { 9679 9680 smallDictt* r; 9681 smallDictt *self = allocG(rtSmallDictt); 9682 const char *array[] = {"a", "b", null}; 9683 9684 r = setCArraycKCharSmallDictG(self, '1', array); 9685 ck_assert_ptr_ne(r, null); 9686 char *s = toStringO(r); 9687 ck_assert_str_eq(s, "{\"1\":[\"a\",\"b\"]}"); 9688 free(s); 9689 terminateO(self); 9690 9691 } 9692 9693 9694 void setVoidKCharSmallDictGT(void) { 9695 9696 smallDictt* r; 9697 smallDictt *self = allocG(rtSmallDictt); 9698 9699 r = setVoidKCharSmallDictG(self, '1', null); 9700 ck_assert_ptr_ne(r, null); 9701 char *s = toStringO(r); 9702 ck_assert_str_eq(s, "{\"1\":null}"); 9703 free(s); 9704 terminateO(self); 9705 9706 } 9707 9708 9709 void setSmallBoolKCharSmallDictGT(void) { 9710 9711 smallDictt* r; 9712 smallDictt *self = allocG(rtSmallDictt); 9713 smallBoolt *value = allocSmallBool(true); 9714 9715 r = setSmallBoolKCharSmallDictG(self, '1', value); 9716 ck_assert_ptr_ne(r, null); 9717 finishO(value); 9718 char *s = toStringO(r); 9719 ck_assert_str_eq(s, "{\"1\":true}"); 9720 free(s); 9721 terminateO(self); 9722 9723 } 9724 9725 9726 void setSmallBytesKCharSmallDictGT(void) { 9727 9728 smallDictt* r; 9729 smallDictt *self = allocG(rtSmallDictt); 9730 smallBytest *value = allocSmallBytes("qwe", sizeof("qwe")); 9731 9732 r = setSmallBytesKCharSmallDictG(self, '1', value); 9733 ck_assert_ptr_ne(r, null); 9734 finishO(value); 9735 char *s = toStringO(r); 9736 ck_assert_str_eq(s, "{\"1\":[0x71,0x77,0x65,0x00]}"); 9737 free(s); 9738 terminateO(self); 9739 9740 } 9741 9742 9743 void setSmallDoubleKCharSmallDictGT(void) { 9744 9745 smallDictt* r; 9746 smallDictt *self = allocG(rtSmallDictt); 9747 smallDoublet *value = allocSmallDouble(2.2); 9748 9749 r = setSmallDoubleKCharSmallDictG(self, '1', value); 9750 ck_assert_ptr_ne(r, null); 9751 finishO(value); 9752 char *s = toStringO(r); 9753 ck_assert_str_eq(s, "{\"1\":2.200000e+00}"); 9754 free(s); 9755 terminateO(self); 9756 9757 } 9758 9759 9760 void setSmallIntKCharSmallDictGT(void) { 9761 9762 smallDictt* r; 9763 smallDictt *self = allocG(rtSmallDictt); 9764 smallIntt *value = allocSmallInt(2); 9765 9766 r = setSmallIntKCharSmallDictG(self, '1', value); 9767 ck_assert_ptr_ne(r, null); 9768 finishO(value); 9769 char *s = toStringO(r); 9770 ck_assert_str_eq(s, "{\"1\":2}"); 9771 free(s); 9772 terminateO(self); 9773 9774 } 9775 9776 9777 void setSmallJsonKCharSmallDictGT(void) { 9778 9779 smallDictt* r; 9780 smallDictt *self = allocG(rtSmallDictt); 9781 smallJsont *value = allocSmallJson(); 9782 9783 setTopIntO(value, 2); 9784 r = setSmallJsonKCharSmallDictG(self, '1', value); 9785 ck_assert_ptr_ne(r, null); 9786 finishO(value); 9787 char *s = toStringO(r); 9788 ck_assert_str_eq(s, "{\"1\":2}"); 9789 free(s); 9790 terminateO(self); 9791 9792 } 9793 9794 9795 void setSmallStringKCharSmallDictGT(void) { 9796 9797 smallDictt* r; 9798 smallDictt *self = allocG(rtSmallDictt); 9799 smallStringt *string = allocSmallString("qwe"); 9800 9801 r = setSmallStringKCharSmallDictG(self, '1', string); 9802 ck_assert_ptr_ne(r, null); 9803 finishO(string); 9804 char *s = toStringO(r); 9805 ck_assert_str_eq(s, "{\"1\":\"qwe\"}"); 9806 free(s); 9807 terminateO(self); 9808 9809 } 9810 9811 9812 void setSmallContainerKCharSmallDictGT(void) { 9813 9814 smallDictt* r; 9815 smallDictt *self = allocG(rtSmallDictt); 9816 smallContainert *container = allocSmallContainer(null); 9817 9818 r = setSmallContainerKCharSmallDictG(self, '1', container); 9819 ck_assert_ptr_ne(r, null); 9820 finishO(container); 9821 char *s = toStringO(r); 9822 ck_assert_str_eq(s, "{\"1\":\"<data container>\"}"); 9823 free(s); 9824 terminateO(self); 9825 9826 } 9827 9828 9829 void setNFreeSmallDictGT(void) { 9830 9831 smallDictt* r; 9832 smallDictt *self = allocG(rtSmallDictt); 9833 baset *value; 9834 9835 value = (baset*)allocUndefined(); 9836 r = setNFreeSmallDictG(self, "1", value); 9837 ck_assert_ptr_ne(r, null); 9838 char *s = toStringO(r); 9839 ck_assert_str_eq(s, "{\"1\":null}"); 9840 free(s); 9841 terminateO(self); 9842 9843 } 9844 9845 9846 void setNFreeUndefinedSmallDictGT(void) { 9847 9848 smallDictt* r; 9849 smallDictt *self = allocG(rtSmallDictt); 9850 undefinedt *undefined = allocUndefined(); 9851 9852 r = setNFreeUndefinedSmallDictG(self, "1", undefined); 9853 ck_assert_ptr_ne(r, null); 9854 char *s = toStringO(r); 9855 ck_assert_str_eq(s, "{\"1\":null}"); 9856 free(s); 9857 terminateO(self); 9858 9859 } 9860 9861 9862 void setNFreeSSmallDictGT(void) { 9863 9864 smallDictt* r; 9865 smallDictt *self = allocG(rtSmallDictt); 9866 char *string = strdup("qwe"); 9867 9868 r = setNFreeSSmallDictG(self, "1", string); 9869 ck_assert_ptr_ne(r, null); 9870 char *s = toStringO(r); 9871 ck_assert_str_eq(s, "{\"1\":\"qwe\"}"); 9872 free(s); 9873 terminateO(self); 9874 9875 } 9876 9877 9878 void setNFreeDictSmallDictGT(void) { 9879 9880 smallDictt* r; 9881 smallDictt *self = allocG(rtSmallDictt); 9882 smallDictt *dict = allocSmallDict(); 9883 9884 r = setNFreeDictSmallDictG(self, "1", dict); 9885 ck_assert_ptr_ne(r, null); 9886 char *s = toStringO(r); 9887 ck_assert_str_eq(s, "{\"1\":{}}"); 9888 free(s); 9889 terminateO(self); 9890 9891 } 9892 9893 9894 void setNFreeArraySmallDictGT(void) { 9895 9896 smallDictt* r; 9897 smallDictt *self = allocG(rtSmallDictt); 9898 smallArrayt *array = allocSmallArray(); 9899 9900 r = setNFreeArraySmallDictG(self, "1", array); 9901 ck_assert_ptr_ne(r, null); 9902 char *s = toStringO(r); 9903 ck_assert_str_eq(s, "{\"1\":[]}"); 9904 free(s); 9905 terminateO(self); 9906 9907 } 9908 9909 9910 void setNFreeArraycSmallDictGT(void) { 9911 9912 smallDictt* r; 9913 smallDictt *self = allocG(rtSmallDictt); 9914 char **array = listCreateS("a", "b"); 9915 9916 r = setNFreeArraycSmallDictG(self, "1", array); 9917 ck_assert_ptr_ne(r, null); 9918 char *s = toStringO(r); 9919 ck_assert_str_eq(s, "{\"1\":[\"a\",\"b\"]}"); 9920 free(s); 9921 terminateO(self); 9922 9923 } 9924 9925 9926 void setNFreeSmallBoolSmallDictGT(void) { 9927 9928 smallDictt* r; 9929 smallDictt *self = allocG(rtSmallDictt); 9930 smallBoolt *value = allocSmallBool(true); 9931 9932 r = setNFreeSmallBoolSmallDictG(self, "1", value); 9933 ck_assert_ptr_ne(r, null); 9934 char *s = toStringO(r); 9935 ck_assert_str_eq(s, "{\"1\":true}"); 9936 free(s); 9937 terminateO(self); 9938 9939 } 9940 9941 9942 void setNFreeSmallBytesSmallDictGT(void) { 9943 9944 smallDictt* r; 9945 smallDictt *self = allocG(rtSmallDictt); 9946 smallBytest *value = allocSmallBytes("qwe", sizeof("qwe")); 9947 9948 r = setNFreeSmallBytesSmallDictG(self, "1", value); 9949 ck_assert_ptr_ne(r, null); 9950 char *s = toStringO(r); 9951 ck_assert_str_eq(s, "{\"1\":[0x71,0x77,0x65,0x00]}"); 9952 free(s); 9953 terminateO(self); 9954 9955 } 9956 9957 9958 void setNFreeSmallDoubleSmallDictGT(void) { 9959 9960 smallDictt* r; 9961 smallDictt *self = allocG(rtSmallDictt); 9962 smallDoublet *value = allocSmallDouble(2.2); 9963 9964 r = setNFreeSmallDoubleSmallDictG(self, "1", value); 9965 ck_assert_ptr_ne(r, null); 9966 char *s = toStringO(r); 9967 ck_assert_str_eq(s, "{\"1\":2.200000e+00}"); 9968 free(s); 9969 terminateO(self); 9970 9971 } 9972 9973 9974 void setNFreeSmallIntSmallDictGT(void) { 9975 9976 smallDictt* r; 9977 smallDictt *self = allocG(rtSmallDictt); 9978 smallIntt *value = allocSmallInt(2); 9979 9980 r = setNFreeSmallIntSmallDictG(self, "1", value); 9981 ck_assert_ptr_ne(r, null); 9982 char *s = toStringO(r); 9983 ck_assert_str_eq(s, "{\"1\":2}"); 9984 free(s); 9985 terminateO(self); 9986 9987 } 9988 9989 9990 void setNFreeSmallJsonSmallDictGT(void) { 9991 9992 smallDictt* r; 9993 smallDictt *self = allocG(rtSmallDictt); 9994 smallJsont *value = allocSmallJson(); 9995 9996 setTopIntO(value, 2); 9997 r = setNFreeSmallJsonSmallDictG(self, "1", value); 9998 ck_assert_ptr_ne(r, null); 9999 char *s = toStringO(r); 10000 ck_assert_str_eq(s, "{\"1\":2}"); 10001 free(s); 10002 terminateO(self); 10003 10004 } 10005 10006 10007 void setNFreeSmallStringSmallDictGT(void) { 10008 10009 smallDictt* r; 10010 smallDictt *self = allocG(rtSmallDictt); 10011 smallStringt *string = allocSmallString("qwe"); 10012 10013 r = setNFreeSmallStringSmallDictG(self, "1", string); 10014 ck_assert_ptr_ne(r, null); 10015 char *s = toStringO(r); 10016 ck_assert_str_eq(s, "{\"1\":\"qwe\"}"); 10017 free(s); 10018 terminateO(self); 10019 10020 } 10021 10022 10023 void setNFreeSmallContainerSmallDictGT(void) { 10024 10025 smallDictt* r; 10026 smallDictt *self = allocG(rtSmallDictt); 10027 smallContainert *container = allocSmallContainer(null); 10028 10029 r = setNFreeSmallContainerSmallDictG(self, "1", container); 10030 ck_assert_ptr_ne(r, null); 10031 char *s = toStringO(r); 10032 ck_assert_str_eq(s, "{\"1\":\"<data container>\"}"); 10033 free(s); 10034 terminateO(self); 10035 10036 } 10037 10038 10039 void setNFreeKCharSmallDictGT(void) { 10040 10041 smallDictt* r; 10042 smallDictt *self = allocG(rtSmallDictt); 10043 baset *value; 10044 10045 value = (baset*)allocUndefined(); 10046 r = setNFreeKCharSmallDictG(self, '1', value); 10047 ck_assert_ptr_ne(r, null); 10048 char *s = toStringO(r); 10049 ck_assert_str_eq(s, "{\"1\":null}"); 10050 free(s); 10051 terminateO(self); 10052 10053 } 10054 10055 10056 void setNFreeUndefinedKCharSmallDictGT(void) { 10057 10058 smallDictt* r; 10059 smallDictt *self = allocG(rtSmallDictt); 10060 undefinedt *undefined = allocUndefined(); 10061 10062 r = setNFreeUndefinedKCharSmallDictG(self, '1', undefined); 10063 ck_assert_ptr_ne(r, null); 10064 char *s = toStringO(r); 10065 ck_assert_str_eq(s, "{\"1\":null}"); 10066 free(s); 10067 terminateO(self); 10068 10069 } 10070 10071 10072 void setNFreeSKCharSmallDictGT(void) { 10073 10074 smallDictt* r; 10075 smallDictt *self = allocG(rtSmallDictt); 10076 char *string = strdup("qwe"); 10077 10078 r = setNFreeSKCharSmallDictG(self, '1', string); 10079 ck_assert_ptr_ne(r, null); 10080 char *s = toStringO(r); 10081 ck_assert_str_eq(s, "{\"1\":\"qwe\"}"); 10082 free(s); 10083 terminateO(self); 10084 10085 } 10086 10087 10088 void setNFreeDictKCharSmallDictGT(void) { 10089 10090 smallDictt* r; 10091 smallDictt *self = allocG(rtSmallDictt); 10092 smallDictt *dict = allocSmallDict(); 10093 10094 r = setNFreeDictKCharSmallDictG(self, '1', dict); 10095 ck_assert_ptr_ne(r, null); 10096 char *s = toStringO(r); 10097 ck_assert_str_eq(s, "{\"1\":{}}"); 10098 free(s); 10099 terminateO(self); 10100 10101 } 10102 10103 10104 void setNFreeArrayKCharSmallDictGT(void) { 10105 10106 smallDictt* r; 10107 smallDictt *self = allocG(rtSmallDictt); 10108 smallArrayt *array = allocSmallArray(); 10109 10110 r = setNFreeArrayKCharSmallDictG(self, '1', array); 10111 ck_assert_ptr_ne(r, null); 10112 char *s = toStringO(r); 10113 ck_assert_str_eq(s, "{\"1\":[]}"); 10114 free(s); 10115 terminateO(self); 10116 10117 } 10118 10119 10120 void setNFreeArraycKCharSmallDictGT(void) { 10121 10122 smallDictt* r; 10123 smallDictt *self = allocG(rtSmallDictt); 10124 char **array = listCreateS("a", "b"); 10125 10126 r = setNFreeArraycKCharSmallDictG(self, '1', array); 10127 ck_assert_ptr_ne(r, null); 10128 char *s = toStringO(r); 10129 ck_assert_str_eq(s, "{\"1\":[\"a\",\"b\"]}"); 10130 free(s); 10131 terminateO(self); 10132 10133 } 10134 10135 10136 void setNFreeSmallBoolKCharSmallDictGT(void) { 10137 10138 smallDictt* r; 10139 smallDictt *self = allocG(rtSmallDictt); 10140 smallBoolt *value = allocSmallBool(true); 10141 10142 r = setNFreeSmallBoolKCharSmallDictG(self, '1', value); 10143 ck_assert_ptr_ne(r, null); 10144 char *s = toStringO(r); 10145 ck_assert_str_eq(s, "{\"1\":true}"); 10146 free(s); 10147 terminateO(self); 10148 10149 } 10150 10151 10152 void setNFreeSmallBytesKCharSmallDictGT(void) { 10153 10154 smallDictt* r; 10155 smallDictt *self = allocG(rtSmallDictt); 10156 smallBytest *value = allocSmallBytes("qwe", sizeof("qwe")); 10157 10158 r = setNFreeSmallBytesKCharSmallDictG(self, '1', value); 10159 ck_assert_ptr_ne(r, null); 10160 char *s = toStringO(r); 10161 ck_assert_str_eq(s, "{\"1\":[0x71,0x77,0x65,0x00]}"); 10162 free(s); 10163 terminateO(self); 10164 10165 } 10166 10167 10168 void setNFreeSmallDoubleKCharSmallDictGT(void) { 10169 10170 smallDictt* r; 10171 smallDictt *self = allocG(rtSmallDictt); 10172 smallDoublet *value = allocSmallDouble(2.2); 10173 10174 r = setNFreeSmallDoubleKCharSmallDictG(self, '1', value); 10175 ck_assert_ptr_ne(r, null); 10176 char *s = toStringO(r); 10177 ck_assert_str_eq(s, "{\"1\":2.200000e+00}"); 10178 free(s); 10179 terminateO(self); 10180 10181 } 10182 10183 10184 void setNFreeSmallIntKCharSmallDictGT(void) { 10185 10186 smallDictt* r; 10187 smallDictt *self = allocG(rtSmallDictt); 10188 smallIntt *value = allocSmallInt(2); 10189 10190 r = setNFreeSmallIntKCharSmallDictG(self, '1', value); 10191 ck_assert_ptr_ne(r, null); 10192 char *s = toStringO(r); 10193 ck_assert_str_eq(s, "{\"1\":2}"); 10194 free(s); 10195 terminateO(self); 10196 10197 } 10198 10199 10200 void setNFreeSmallJsonKCharSmallDictGT(void) { 10201 10202 smallDictt* r; 10203 smallDictt *self = allocG(rtSmallDictt); 10204 smallJsont *value = allocSmallJson(); 10205 10206 setTopIntO(value, 2); 10207 r = setNFreeSmallJsonKCharSmallDictG(self, '1', value); 10208 ck_assert_ptr_ne(r, null); 10209 char *s = toStringO(r); 10210 ck_assert_str_eq(s, "{\"1\":2}"); 10211 free(s); 10212 terminateO(self); 10213 10214 } 10215 10216 10217 void setNFreeSmallStringKCharSmallDictGT(void) { 10218 10219 smallDictt* r; 10220 smallDictt *self = allocG(rtSmallDictt); 10221 smallStringt *string = allocSmallString("qwe"); 10222 10223 r = setNFreeSmallStringKCharSmallDictG(self, '1', string); 10224 ck_assert_ptr_ne(r, null); 10225 char *s = toStringO(r); 10226 ck_assert_str_eq(s, "{\"1\":\"qwe\"}"); 10227 free(s); 10228 terminateO(self); 10229 10230 } 10231 10232 10233 void setNFreeSmallContainerKCharSmallDictGT(void) { 10234 10235 smallDictt* r; 10236 smallDictt *self = allocG(rtSmallDictt); 10237 smallContainert *container = allocSmallContainer(null); 10238 10239 r = setNFreeSmallContainerKCharSmallDictG(self, '1', container); 10240 ck_assert_ptr_ne(r, null); 10241 char *s = toStringO(r); 10242 ck_assert_str_eq(s, "{\"1\":\"<data container>\"}"); 10243 free(s); 10244 terminateO(self); 10245 10246 } 10247 10248 10249 void setPDictSmallDictGT(void) { 10250 10251 smallDictt* r; 10252 smallDictt *self = allocG(rtSmallDictt); 10253 smallDictt *dict; 10254 10255 dict = allocSmallDict(); 10256 r = self->f->setDict(self, "1", dict); 10257 ck_assert_ptr_ne(r, null); 10258 dict->f->setInt(dict, "a", 1); 10259 r = setPDictSmallDictG(self, "1", dict); 10260 ck_assert_ptr_ne(r, null); 10261 char *s = toStringO(r); 10262 ck_assert_str_eq(s, "{\"1\":{\"a\":1}}"); 10263 free(s); 10264 finishO(dict); 10265 terminateO(self); 10266 10267 } 10268 10269 10270 void setPArraySmallDictGT(void) { 10271 10272 smallDictt* r; 10273 smallDictt *self = allocG(rtSmallDictt); 10274 smallArrayt *array; 10275 10276 array = allocSmallArray(); 10277 r = self->f->setArray(self, "1", array); 10278 ck_assert_ptr_ne(r, null); 10279 array->f->pushInt(array, 1); 10280 r = setPArraySmallDictG(self, "1", array); 10281 ck_assert_ptr_ne(r, null); 10282 char *s = toStringO(r); 10283 ck_assert_str_eq(s, "{\"1\":[1]}"); 10284 free(s); 10285 finishO(array); 10286 terminateO(self); 10287 10288 } 10289 10290 10291 void setPSmallJsonSmallDictGT(void) { 10292 10293 smallDictt* r; 10294 smallDictt *self = allocG(rtSmallDictt); 10295 smallJsont *json; 10296 10297 json = allocSmallJson(); 10298 r = self->f->setSmallJson(self, "1", json); 10299 ck_assert_ptr_ne(r, null); 10300 json->f->setInt(json, "a", 1); 10301 r = setPSmallJsonSmallDictG(self, "1", json); 10302 ck_assert_ptr_ne(r, null); 10303 finishO(json); 10304 char *s = toStringO(r); 10305 ck_assert_str_eq(s, "{\"1\":{\"a\":1}}"); 10306 free(s); 10307 terminateO(self); 10308 10309 } 10310 10311 10312 void setPSmallStringSmallDictGT(void) { 10313 10314 smallDictt* r; 10315 smallDictt *self = allocG(rtSmallDictt); 10316 smallStringt *string; 10317 10318 string = allocSmallString(""); 10319 r = self->f->setSmallString(self, "1", string); 10320 ck_assert_ptr_ne(r, null); 10321 string->f->appendS(string, "s"); 10322 r = setPSmallStringSmallDictG(self, "1", string); 10323 ck_assert_ptr_ne(r, null); 10324 finishO(string); 10325 char *s = toStringO(r); 10326 ck_assert_str_eq(s, "{\"1\":\"s\"}"); 10327 free(s); 10328 terminateO(self); 10329 10330 } 10331 10332 10333 void setNFreePDictSmallDictGT(void) { 10334 10335 smallDictt* r; 10336 smallDictt *self = allocG(rtSmallDictt); 10337 smallDictt *value; 10338 10339 value = allocSmallDict(); 10340 r = self->f->setDict(self, "1", value); 10341 ck_assert_ptr_ne(r, null); 10342 value->f->setInt(value, "a", 1); 10343 r = setNFreePDictSmallDictG(self, "1", value); 10344 ck_assert_ptr_ne(r, null); 10345 char *s = toStringO(r); 10346 ck_assert_str_eq(s, "{\"1\":{\"a\":1}}"); 10347 free(s); 10348 terminateO(self); 10349 10350 } 10351 10352 10353 void setNFreePArraySmallDictGT(void) { 10354 10355 smallDictt* r; 10356 smallDictt *self = allocG(rtSmallDictt); 10357 smallArrayt *value; 10358 10359 value = allocSmallArray(); 10360 r = self->f->setArray(self, "1", value); 10361 ck_assert_ptr_ne(r, null); 10362 value->f->pushInt(value, 2); 10363 r = setNFreePArraySmallDictG(self, "1", value); 10364 ck_assert_ptr_ne(r, null); 10365 char *s = toStringO(r); 10366 ck_assert_str_eq(s, "{\"1\":[2]}"); 10367 free(s); 10368 terminateO(self); 10369 10370 } 10371 10372 10373 void setNFreePSmallJsonSmallDictGT(void) { 10374 10375 smallDictt* r; 10376 smallDictt *self = allocG(rtSmallDictt); 10377 smallJsont *value; 10378 10379 value = allocSmallJson(); 10380 r = self->f->setSmallJson(self, "1", value); 10381 ck_assert_ptr_ne(r, null); 10382 value->f->setInt(value, "a", 1); 10383 r = setNFreePSmallJsonSmallDictG(self, "1", value); 10384 ck_assert_ptr_ne(r, null); 10385 char *s = toStringO(r); 10386 ck_assert_str_eq(s, "{\"1\":{\"a\":1}}"); 10387 free(s); 10388 terminateO(self); 10389 10390 } 10391 10392 10393 void setNFreePSmallStringSmallDictGT(void) { 10394 10395 smallDictt* r; 10396 smallDictt *self = allocG(rtSmallDictt); 10397 smallStringt *value; 10398 10399 value = allocSmallString(""); 10400 r = self->f->setSmallString(self, "1", value); 10401 ck_assert_ptr_ne(r, null); 10402 value->f->appendS(value, "2"); 10403 r = setNFreePSmallStringSmallDictG(self, "1", value); 10404 ck_assert_ptr_ne(r, null); 10405 char *s = toStringO(r); 10406 ck_assert_str_eq(s, "{\"1\":\"2\"}"); 10407 free(s); 10408 terminateO(self); 10409 10410 } 10411 10412 10413 void setPArrayKCharSmallDictGT(void) { 10414 10415 smallDictt* r; 10416 smallDictt *self = allocG(rtSmallDictt); 10417 smallArrayt *array; 10418 10419 array = allocSmallArray(); 10420 r = self->f->setArray(self, "1", array); 10421 ck_assert_ptr_ne(r, null); 10422 array->f->pushInt(array, 2); 10423 r = setPArrayKCharSmallDictG(self, '1', array); 10424 ck_assert_ptr_ne(r, null); 10425 char *s = toStringO(r); 10426 ck_assert_str_eq(s, "{\"1\":[2]}"); 10427 free(s); 10428 terminateO(self); 10429 finishO(array); 10430 10431 } 10432 10433 10434 void setPDictKCharSmallDictGT(void) { 10435 10436 smallDictt* r; 10437 smallDictt *self = allocG(rtSmallDictt); 10438 smallDictt *dict; 10439 10440 dict = allocSmallDict(); 10441 r = self->f->setDict(self, "1", dict); 10442 ck_assert_ptr_ne(r, null); 10443 dict->f->setInt(dict, "a", 1); 10444 r = setPDictKCharSmallDictG(self, '1', dict); 10445 ck_assert_ptr_ne(r, null); 10446 char *s = toStringO(r); 10447 ck_assert_str_eq(s, "{\"1\":{\"a\":1}}"); 10448 free(s); 10449 terminateO(self); 10450 finishO(dict); 10451 10452 } 10453 10454 10455 void setPSmallJsonKCharSmallDictGT(void) { 10456 10457 smallDictt* r; 10458 smallDictt *self = allocG(rtSmallDictt); 10459 smallJsont *json; 10460 10461 json = allocSmallJson(); 10462 r = self->f->setSmallJson(self, "1", json); 10463 ck_assert_ptr_ne(r, null); 10464 json->f->setInt(json, "a", 1); 10465 r = setPSmallJsonKCharSmallDictG(self, '1', json); 10466 ck_assert_ptr_ne(r, null); 10467 finishO(json); 10468 char *s = toStringO(r); 10469 ck_assert_str_eq(s, "{\"1\":{\"a\":1}}"); 10470 free(s); 10471 terminateO(self); 10472 10473 } 10474 10475 10476 void setPSmallStringKCharSmallDictGT(void) { 10477 10478 smallDictt* r; 10479 smallDictt *self = allocG(rtSmallDictt); 10480 smallStringt *string; 10481 10482 string = allocSmallString(""); 10483 r = self->f->setSmallString(self, "1", string); 10484 ck_assert_ptr_ne(r, null); 10485 string->f->appendS(string, "s"); 10486 r = setPSmallStringKCharSmallDictG(self, '1', string); 10487 ck_assert_ptr_ne(r, null); 10488 finishO(string); 10489 char *s = toStringO(r); 10490 ck_assert_str_eq(s, "{\"1\":\"s\"}"); 10491 free(s); 10492 terminateO(self); 10493 10494 } 10495 10496 10497 void setNFreePArrayKCharSmallDictGT(void) { 10498 10499 smallDictt* r; 10500 smallDictt *self = allocG(rtSmallDictt); 10501 smallArrayt *value; 10502 10503 value = allocSmallArray(); 10504 r = self->f->setArray(self, "1", value); 10505 ck_assert_ptr_ne(r, null); 10506 value->f->pushInt(value, 2); 10507 r = setNFreePArrayKCharSmallDictG(self, '1', value); 10508 ck_assert_ptr_ne(r, null); 10509 char *s = toStringO(r); 10510 ck_assert_str_eq(s, "{\"1\":[2]}"); 10511 free(s); 10512 terminateO(self); 10513 10514 } 10515 10516 10517 void setNFreePDictKCharSmallDictGT(void) { 10518 10519 smallDictt* r; 10520 smallDictt *self = allocG(rtSmallDictt); 10521 smallDictt *value; 10522 10523 value = allocSmallDict(); 10524 r = self->f->setDict(self, "1", value); 10525 ck_assert_ptr_ne(r, null); 10526 value->f->setInt(value, "a", 1); 10527 r = setNFreePDictKCharSmallDictG(self, '1', value); 10528 ck_assert_ptr_ne(r, null); 10529 char *s = toStringO(r); 10530 ck_assert_str_eq(s, "{\"1\":{\"a\":1}}"); 10531 free(s); 10532 terminateO(self); 10533 10534 } 10535 10536 10537 void setNFreePSmallJsonKCharSmallDictGT(void) { 10538 10539 smallDictt* r; 10540 smallDictt *self = allocG(rtSmallDictt); 10541 smallJsont *value; 10542 10543 value = allocSmallJson(); 10544 r = self->f->setSmallJson(self, "1", value); 10545 ck_assert_ptr_ne(r, null); 10546 value->f->setInt(value, "a", 1); 10547 r = setNFreePSmallJsonKCharSmallDictG(self, '1', value); 10548 ck_assert_ptr_ne(r, null); 10549 char *s = toStringO(r); 10550 ck_assert_str_eq(s, "{\"1\":{\"a\":1}}"); 10551 free(s); 10552 terminateO(self); 10553 10554 } 10555 10556 10557 void setNFreePSmallStringKCharSmallDictGT(void) { 10558 10559 smallDictt* r; 10560 smallDictt *self = allocG(rtSmallDictt); 10561 smallStringt *value; 10562 10563 value = allocSmallString(""); 10564 r = self->f->setSmallString(self, "1", value); 10565 ck_assert_ptr_ne(r, null); 10566 value->f->appendS(value, "2"); 10567 r = setNFreePSmallStringKCharSmallDictG(self, '1', value); 10568 ck_assert_ptr_ne(r, null); 10569 char *s = toStringO(r); 10570 ck_assert_str_eq(s, "{\"1\":\"2\"}"); 10571 free(s); 10572 terminateO(self); 10573 10574 } 10575 10576 10577 void mergeSmallDictGT(void) { 10578 10579 smallDictt* r; 10580 smallDictt *self = allocG(rtSmallDictt); 10581 smallDictt *value = allocSmallDict(); 10582 10583 self->f->setS(self, "1", "2"); 10584 self->f->setS(self, "3", "4"); 10585 value->f->setS(value, "3", "#"); 10586 value->f->setInt(value, "4", 0); 10587 r = mergeSmallDictG(self, value); 10588 ck_assert_ptr_ne(r, null); 10589 char *s = toStringO(r); 10590 ck_assert_str_eq(s, "{\"1\":\"2\",\"3\":\"#\",\"4\":0}"); 10591 free(s); 10592 smashO(value); 10593 terminateO(self); 10594 10595 } 10596 10597 10598 void mergeSmallJsonSmallDictGT(void) { 10599 10600 smallDictt* r; 10601 smallDictt *self = allocG(rtSmallDictt); 10602 smallJsont *json = allocSmallJson(); 10603 10604 self->f->setS(self, "1", "2"); 10605 self->f->setS(self, "3", "4"); 10606 json->f->setS(json, "3", "#"); 10607 json->f->setInt(json, "4", 0); 10608 r = mergeSmallJsonSmallDictG(self, json); 10609 ck_assert_ptr_ne(r, null); 10610 char *s = toStringO(r); 10611 ck_assert_str_eq(s, "{\"1\":\"2\",\"3\":\"#\",\"4\":0}"); 10612 free(s); 10613 smashO(json); 10614 terminateO(self); 10615 10616 } 10617 10618 10619 void mergeNSmashSmallDictGT(void) { 10620 10621 smallDictt* r; 10622 smallDictt *self = allocG(rtSmallDictt); 10623 smallDictt *value = allocSmallDict(); 10624 10625 self->f->setS(self, "1", "2"); 10626 self->f->setS(self, "3", "4"); 10627 value->f->setS(value, "3", "#"); 10628 value->f->setInt(value, "4", 0); 10629 r = mergeNSmashSmallDictG(self, value); 10630 ck_assert_ptr_ne(r, null); 10631 char *s = toStringO(r); 10632 ck_assert_str_eq(s, "{\"1\":\"2\",\"3\":\"#\",\"4\":0}"); 10633 free(s); 10634 terminateO(self); 10635 10636 } 10637 10638 10639 void mergeNSmashSmallJsonSmallDictGT(void) { 10640 10641 smallDictt* r; 10642 smallDictt *self = allocG(rtSmallDictt); 10643 smallJsont *json = allocSmallJson(); 10644 10645 self->f->setS(self, "1", "2"); 10646 self->f->setS(self, "3", "4"); 10647 json->f->setS(json, "3", "#"); 10648 json->f->setInt(json, "4", 0); 10649 r = mergeNSmashSmallJsonSmallDictG(self, json); 10650 ck_assert_ptr_ne(r, null); 10651 char *s = toStringO(r); 10652 ck_assert_str_eq(s, "{\"1\":\"2\",\"3\":\"#\",\"4\":0}"); 10653 free(s); 10654 terminateO(self); 10655 10656 } 10657 10658 10659 void equalSmallDictBaseGT(void) { 10660 10661 bool r; 10662 smallDictt* self = allocG(rtSmallDictt); 10663 10664 createAllocateSmallDict(d); 10665 r = equalSmallDictBaseG(self, (baset*)d); 10666 ck_assert(!r); 10667 terminateO(d); 10668 terminateO(self); 10669 10670 } 10671 10672 10673 void equalSmallDictSmallJsonGT(void) { 10674 10675 bool r; 10676 smallDictt* self = allocG(rtSmallDictt); 10677 smallJsont* p2 = allocSmallJson(); 10678 10679 self->f->setS(self, "3", "#"); 10680 p2->f->setS(p2, "3", "#"); 10681 r = equalSmallDictSmallJsonG(self, p2); 10682 ck_assert(r); 10683 terminateO(p2); 10684 terminateO(self); 10685 10686 } 10687 10688 10689 void equalSmallDictGT(void) { 10690 10691 bool r; 10692 smallDictt* self = allocG(rtSmallDictt); 10693 smallDictt* p2 = allocSmallDict(); 10694 10695 self->f->setS(self, "3", "#"); 10696 p2->f->setS(p2, "3", "#"); 10697 r = equalSmallDictG(self, p2); 10698 ck_assert(r); 10699 terminateO(p2); 10700 terminateO(self); 10701 10702 } 10703 10704 10705 void icEqualSmallDictBaseGT(void) { 10706 10707 bool r; 10708 smallDictt* self = allocG(rtSmallDictt); 10709 10710 createAllocateSmallDict(d); 10711 self->f->setS(self, "q", "q"); 10712 d->f->setS(d, "q", "Q"); 10713 r = icEqualSmallDictBaseG(self, (baset*)d); 10714 ck_assert(r); 10715 terminateO(d); 10716 terminateO(self); 10717 10718 } 10719 10720 10721 void icEqualSmallDictSmallJsonGT(void) { 10722 10723 bool r; 10724 smallDictt* self = allocG(rtSmallDictt); 10725 smallJsont* p2 = allocSmallJson(); 10726 10727 self->f->setS(self, "3", "W"); 10728 p2->f->setS(p2, "3", "w"); 10729 r = icEqualSmallDictSmallJsonG(self, p2); 10730 ck_assert(r); 10731 terminateO(p2); 10732 terminateO(self); 10733 10734 } 10735 10736 10737 void icEqualSmallDictGT(void) { 10738 10739 bool r; 10740 smallDictt* self = allocG(rtSmallDictt); 10741 smallDictt* p2 = allocSmallDict(); 10742 10743 self->f->setS(self, "3", "A"); 10744 p2->f->setS(p2, "3", "a"); 10745 r = icEqualSmallDictG(self, p2); 10746 ck_assert(r); 10747 terminateO(p2); 10748 terminateO(self); 10749 10750 } 10751 10752 10753 void getNumSmallDictGT(void) { 10754 10755 double r; 10756 smallDictt *self = allocG(rtSmallDictt); 10757 smallDictt *r2; 10758 10759 r2 = self->f->setInt(self, "1", 1); 10760 ck_assert_ptr_ne(r2, null); 10761 r2 = self->f->setDouble(self, "2", 2.2); 10762 ck_assert_ptr_ne(r2, null); 10763 r2 = self->f->setS(self, "3", "2"); 10764 ck_assert_ptr_ne(r2, null); 10765 r = getNumSmallDictG(self, "1"); 10766 ck_assert(r == 1); 10767 r = getNumSmallDictG(self, "2"); 10768 ck_assert(r == 2.2); 10769 terminateO(self); 10770 10771 } 10772 10773 10774 void cropElemSmallDictGT(void) { 10775 10776 baset* r; 10777 smallDictt *self = allocG(rtSmallDictt); 10778 smallDictt *r2; 10779 10780 r2 = self->f->setInt(self, "1", 1); 10781 ck_assert_ptr_ne(r2, null); 10782 r2 = self->f->setDouble(self, "2", 2.2); 10783 ck_assert_ptr_ne(r2, null); 10784 r2 = self->f->setS(self, "3", "2"); 10785 ck_assert_ptr_ne(r2, null); 10786 r2 = self->f->setUndefined(self, "u"); 10787 ck_assert_ptr_ne(r2, null); 10788 createSmallContainer(c); 10789 r2 = self->f->setSmallContainer(self, "c", &c); 10790 ck_assert_ptr_ne(r2, null); 10791 createAllocateSmallInt(I); 10792 setValG(I, 11); 10793 I->type = "anothertype"; 10794 r2 = self->f->set(self, "b", (baset*)I); 10795 ck_assert_ptr_ne(r2, null); 10796 // crop string 10797 r = cropElemSmallDictG(self, "3"); 10798 ck_assert_ptr_ne(r, null); 10799 char *s = toStringO(r); 10800 terminateO(r); 10801 ck_assert_str_eq(s, "2"); 10802 free(s); 10803 s = toStringO(self); 10804 ck_assert_str_eq(s, "{\"1\":1,\"2\":2.200000e+00,\"u\":null,\"c\":\"<data container>\",\"b\":\"<data container>\"}"); 10805 free(s); 10806 terminateO(self); 10807 10808 } 10809 10810 10811 void cropElemUndefinedSmallDictGT(void) { 10812 10813 undefinedt* r; 10814 smallDictt *self = allocG(rtSmallDictt); 10815 smallDictt *r2; 10816 10817 r2 = self->f->setInt(self, "1", 1); 10818 ck_assert_ptr_ne(r2, null); 10819 r2 = self->f->setDouble(self, "2", 2.2); 10820 ck_assert_ptr_ne(r2, null); 10821 r2 = self->f->setUndefined(self, "u"); 10822 ck_assert_ptr_ne(r2, null); 10823 r = cropElemUndefinedSmallDictG(self, "u"); 10824 ck_assert_ptr_ne(r, null); 10825 char *s = toStringO(r); 10826 terminateO(r); 10827 ck_assert_str_eq(s, "null"); 10828 free(s); 10829 s = toStringO(self); 10830 ck_assert_str_eq(s, "{\"1\":1,\"2\":2.200000e+00}"); 10831 free(s); 10832 terminateO(self); 10833 10834 } 10835 10836 10837 void cropElemBoolSmallDictGT(void) { 10838 10839 bool r; 10840 smallDictt *self = allocG(rtSmallDictt); 10841 smallDictt *r2; 10842 10843 r2 = self->f->setInt(self, "1", 1); 10844 ck_assert_ptr_ne(r2, null); 10845 r2 = self->f->setDouble(self, "2", 2.2); 10846 ck_assert_ptr_ne(r2, null); 10847 r2 = self->f->setBool(self, "b", true); 10848 ck_assert_ptr_ne(r2, null); 10849 createAllocateSmallInt(I); 10850 setValG(I, 11); 10851 I->type = "anothertype"; 10852 r2 = self->f->set(self, "B", (baset*)I); 10853 ck_assert_ptr_ne(r2, null); 10854 r = cropElemBoolSmallDictG(self, "b"); 10855 ck_assert(r); 10856 char *s = toStringO(self); 10857 ck_assert_str_eq(s, "{\"1\":1,\"2\":2.200000e+00,\"B\":\"<data container>\"}"); 10858 free(s); 10859 terminateO(self); 10860 10861 } 10862 10863 10864 void cropElemDoubleSmallDictGT(void) { 10865 10866 double r; 10867 smallDictt *self = allocG(rtSmallDictt); 10868 smallDictt *r2; 10869 10870 r2 = self->f->setInt(self, "1", 1); 10871 ck_assert_ptr_ne(r2, null); 10872 r2 = self->f->setDouble(self, "2", 2.2); 10873 ck_assert_ptr_ne(r2, null); 10874 r2 = self->f->setDouble(self, "b", 3.3); 10875 ck_assert_ptr_ne(r2, null); 10876 createAllocateSmallInt(I); 10877 setValG(I, 11); 10878 I->type = "anothertype"; 10879 r2 = self->f->set(self, "B", (baset*)I); 10880 ck_assert_ptr_ne(r2, null); 10881 r = cropElemDoubleSmallDictG(self, "b"); 10882 ck_assert(r == 3.3); 10883 char *s = toStringO(self); 10884 ck_assert_str_eq(s, "{\"1\":1,\"2\":2.200000e+00,\"B\":\"<data container>\"}"); 10885 free(s); 10886 terminateO(self); 10887 10888 } 10889 10890 10891 void cropElemIntSmallDictGT(void) { 10892 10893 int64_t r; 10894 smallDictt *self = allocG(rtSmallDictt); 10895 smallDictt *r2; 10896 10897 r2 = self->f->setInt(self, "1", 1); 10898 ck_assert_ptr_ne(r2, null); 10899 r2 = self->f->setDouble(self, "2", 2.2); 10900 ck_assert_ptr_ne(r2, null); 10901 r2 = self->f->setInt(self, "b", 2); 10902 ck_assert_ptr_ne(r2, null); 10903 createAllocateSmallInt(I); 10904 setValG(I, 11); 10905 I->type = "anothertype"; 10906 r2 = self->f->set(self, "B", (baset*)I); 10907 ck_assert_ptr_ne(r2, null); 10908 r = cropElemIntSmallDictG(self, "b"); 10909 ck_assert_int_eq(r, 2); 10910 char *s = toStringO(self); 10911 ck_assert_str_eq(s, "{\"1\":1,\"2\":2.200000e+00,\"B\":\"<data container>\"}"); 10912 free(s); 10913 terminateO(self); 10914 10915 } 10916 10917 10918 void cropElemInt32SmallDictGT(void) { 10919 10920 int32_t r; 10921 smallDictt *self = allocG(rtSmallDictt); 10922 smallDictt *r2; 10923 10924 r2 = self->f->setInt(self, "1", 1); 10925 ck_assert_ptr_ne(r2, null); 10926 r2 = self->f->setDouble(self, "2", 2.2); 10927 ck_assert_ptr_ne(r2, null); 10928 r2 = self->f->setInt(self, "b", 2); 10929 ck_assert_ptr_ne(r2, null); 10930 createAllocateSmallInt(I); 10931 setValG(I, 11); 10932 I->type = "anothertype"; 10933 r2 = self->f->set(self, "B", (baset*)I); 10934 ck_assert_ptr_ne(r2, null); 10935 r = cropElemInt32SmallDictG(self, "b"); 10936 ck_assert_int_eq(r, 2); 10937 char *s = toStringO(self); 10938 ck_assert_str_eq(s, "{\"1\":1,\"2\":2.200000e+00,\"B\":\"<data container>\"}"); 10939 free(s); 10940 terminateO(self); 10941 10942 } 10943 10944 10945 void cropElemUintSmallDictGT(void) { 10946 10947 uint64_t r; 10948 smallDictt *self = allocG(rtSmallDictt); 10949 smallDictt *r2; 10950 10951 r2 = self->f->setInt(self, "1", 1); 10952 ck_assert_ptr_ne(r2, null); 10953 r2 = self->f->setDouble(self, "2", 2.2); 10954 ck_assert_ptr_ne(r2, null); 10955 r2 = self->f->setInt(self, "b", 2); 10956 ck_assert_ptr_ne(r2, null); 10957 createAllocateSmallInt(I); 10958 setValG(I, 11); 10959 I->type = "anothertype"; 10960 r2 = self->f->set(self, "B", (baset*)I); 10961 ck_assert_ptr_ne(r2, null); 10962 r = cropElemUintSmallDictG(self, "b"); 10963 ck_assert_int_eq(r, 2); 10964 char *s = toStringO(self); 10965 ck_assert_str_eq(s, "{\"1\":1,\"2\":2.200000e+00,\"B\":\"<data container>\"}"); 10966 free(s); 10967 terminateO(self); 10968 10969 } 10970 10971 10972 void cropElemUint32SmallDictGT(void) { 10973 10974 uint32_t r; 10975 smallDictt *self = allocG(rtSmallDictt); 10976 smallDictt *r2; 10977 10978 r2 = self->f->setInt(self, "1", 1); 10979 ck_assert_ptr_ne(r2, null); 10980 r2 = self->f->setDouble(self, "2", 2.2); 10981 ck_assert_ptr_ne(r2, null); 10982 r2 = self->f->setInt(self, "b", 2); 10983 ck_assert_ptr_ne(r2, null); 10984 createAllocateSmallInt(I); 10985 setValG(I, 11); 10986 I->type = "anothertype"; 10987 r2 = self->f->set(self, "B", (baset*)I); 10988 ck_assert_ptr_ne(r2, null); 10989 r = cropElemUint32SmallDictG(self, "b"); 10990 ck_assert_int_eq(r, 2); 10991 char *s = toStringO(self); 10992 ck_assert_str_eq(s, "{\"1\":1,\"2\":2.200000e+00,\"B\":\"<data container>\"}"); 10993 free(s); 10994 terminateO(self); 10995 10996 } 10997 10998 10999 void cropElemSSmallDictGT(void) { 11000 11001 char* r; 11002 smallDictt *self = allocG(rtSmallDictt); 11003 smallDictt *r2; 11004 11005 r2 = self->f->setInt(self, "1", 1); 11006 ck_assert_ptr_ne(r2, null); 11007 r2 = self->f->setDouble(self, "2", 2.2); 11008 ck_assert_ptr_ne(r2, null); 11009 r2 = self->f->setS(self, "b", "qwe"); 11010 ck_assert_ptr_ne(r2, null); 11011 createAllocateSmallInt(I); 11012 setValG(I, 11); 11013 I->type = "anothertype"; 11014 r2 = self->f->set(self, "B", (baset*)I); 11015 ck_assert_ptr_ne(r2, null); 11016 r = cropElemSSmallDictG(self, "b"); 11017 ck_assert_str_eq(r, "qwe"); 11018 free(r); 11019 char *s = toStringO(self); 11020 ck_assert_str_eq(s, "{\"1\":1,\"2\":2.200000e+00,\"B\":\"<data container>\"}"); 11021 free(s); 11022 terminateO(self); 11023 11024 } 11025 11026 11027 void cropElemDictSmallDictGT(void) { 11028 11029 smallDictt* r; 11030 smallDictt *self = allocG(rtSmallDictt); 11031 smallDictt *r2; 11032 11033 r2 = self->f->setInt(self, "1", 1); 11034 ck_assert_ptr_ne(r2, null); 11035 r2 = self->f->setDouble(self, "2", 2.2); 11036 ck_assert_ptr_ne(r2, null); 11037 createAllocateSmallDict(d); 11038 r2 = self->f->setNFreeDict(self, "b", d); 11039 ck_assert_ptr_ne(r2, null); 11040 createAllocateSmallInt(I); 11041 setValG(I, 11); 11042 I->type = "anothertype"; 11043 r2 = self->f->set(self, "B", (baset*)I); 11044 ck_assert_ptr_ne(r2, null); 11045 r = cropElemDictSmallDictG(self, "b"); 11046 ck_assert_ptr_ne(r, null); 11047 char *s = toStringO(r); 11048 terminateO(r); 11049 ck_assert_str_eq(s, "{}"); 11050 free(s); 11051 s = toStringO(self); 11052 ck_assert_str_eq(s, "{\"1\":1,\"2\":2.200000e+00,\"B\":\"<data container>\"}"); 11053 free(s); 11054 terminateO(self); 11055 11056 } 11057 11058 11059 void cropElemArraySmallDictGT(void) { 11060 11061 smallArrayt* r; 11062 smallDictt *self = allocG(rtSmallDictt); 11063 smallDictt *r2; 11064 11065 r2 = self->f->setInt(self, "1", 1); 11066 ck_assert_ptr_ne(r2, null); 11067 r2 = self->f->setDouble(self, "2", 2.2); 11068 ck_assert_ptr_ne(r2, null); 11069 createAllocateSmallArray(d); 11070 r2 = self->f->setNFreeArray(self, "b", d); 11071 ck_assert_ptr_ne(r2, null); 11072 createAllocateSmallInt(I); 11073 setValG(I, 11); 11074 I->type = "anothertype"; 11075 r2 = self->f->set(self, "B", (baset*)I); 11076 ck_assert_ptr_ne(r2, null); 11077 r = cropElemArraySmallDictG(self, "b"); 11078 ck_assert_ptr_ne(r, null); 11079 char *s = toStringO(r); 11080 terminateO(r); 11081 ck_assert_str_eq(s, "[]"); 11082 free(s); 11083 s = toStringO(self); 11084 ck_assert_str_eq(s, "{\"1\":1,\"2\":2.200000e+00,\"B\":\"<data container>\"}"); 11085 free(s); 11086 terminateO(self); 11087 11088 } 11089 11090 11091 void cropElemSmallBoolSmallDictGT(void) { 11092 11093 smallBoolt* r; 11094 smallDictt *self = allocG(rtSmallDictt); 11095 smallDictt *r2; 11096 11097 r2 = self->f->setInt(self, "1", 1); 11098 ck_assert_ptr_ne(r2, null); 11099 r2 = self->f->setDouble(self, "2", 2.2); 11100 ck_assert_ptr_ne(r2, null); 11101 r2 = self->f->setBool(self, "b", true); 11102 ck_assert_ptr_ne(r2, null); 11103 createAllocateSmallInt(I); 11104 setValG(I, 11); 11105 I->type = "anothertype"; 11106 r2 = self->f->set(self, "B", (baset*)I); 11107 ck_assert_ptr_ne(r2, null); 11108 r = cropElemSmallBoolSmallDictG(self, "b"); 11109 ck_assert_ptr_ne(r, null); 11110 char *s = toStringO(r); 11111 terminateO(r); 11112 ck_assert_str_eq(s, "true"); 11113 free(s); 11114 s = toStringO(self); 11115 ck_assert_str_eq(s, "{\"1\":1,\"2\":2.200000e+00,\"B\":\"<data container>\"}"); 11116 free(s); 11117 terminateO(self); 11118 11119 } 11120 11121 11122 void cropElemSmallBytesSmallDictGT(void) { 11123 11124 smallBytest* r; 11125 smallDictt *self = allocG(rtSmallDictt); 11126 smallDictt *r2; 11127 11128 r2 = self->f->setInt(self, "1", 1); 11129 ck_assert_ptr_ne(r2, null); 11130 r2 = self->f->setDouble(self, "2", 2.2); 11131 ck_assert_ptr_ne(r2, null); 11132 createAllocateSmallBytes(d); 11133 r2 = self->f->setNFreeSmallBytes(self, "b", d); 11134 ck_assert_ptr_ne(r2, null); 11135 createAllocateSmallInt(I); 11136 setValG(I, 11); 11137 I->type = "anothertype"; 11138 r2 = self->f->set(self, "B", (baset*)I); 11139 ck_assert_ptr_ne(r2, null); 11140 r = cropElemSmallBytesSmallDictG(self, "b"); 11141 ck_assert_ptr_ne(r, null); 11142 char *s = toStringO(r); 11143 terminateO(r); 11144 ck_assert_str_eq(s, "[]"); 11145 free(s); 11146 s = toStringO(self); 11147 ck_assert_str_eq(s, "{\"1\":1,\"2\":2.200000e+00,\"B\":\"<data container>\"}"); 11148 free(s); 11149 terminateO(self); 11150 11151 } 11152 11153 11154 void cropElemSmallDoubleSmallDictGT(void) { 11155 11156 smallDoublet* r; 11157 smallDictt *self = allocG(rtSmallDictt); 11158 smallDictt *r2; 11159 11160 r2 = self->f->setInt(self, "1", 1); 11161 ck_assert_ptr_ne(r2, null); 11162 r2 = self->f->setDouble(self, "2", 2.2); 11163 ck_assert_ptr_ne(r2, null); 11164 r2 = self->f->setDouble(self, "b", 3.3); 11165 ck_assert_ptr_ne(r2, null); 11166 createAllocateSmallInt(I); 11167 setValG(I, 11); 11168 I->type = "anothertype"; 11169 r2 = self->f->set(self, "B", (baset*)I); 11170 ck_assert_ptr_ne(r2, null); 11171 r = cropElemSmallDoubleSmallDictG(self, "b"); 11172 ck_assert_ptr_ne(r, null); 11173 char *s = toStringO(r); 11174 terminateO(r); 11175 ck_assert_str_eq(s, "3.300000e+00"); 11176 free(s); 11177 s = toStringO(self); 11178 ck_assert_str_eq(s, "{\"1\":1,\"2\":2.200000e+00,\"B\":\"<data container>\"}"); 11179 free(s); 11180 terminateO(self); 11181 11182 } 11183 11184 11185 void cropElemSmallIntSmallDictGT(void) { 11186 11187 smallIntt* r; 11188 smallDictt *self = allocG(rtSmallDictt); 11189 smallDictt *r2; 11190 11191 r2 = self->f->setInt(self, "1", 1); 11192 ck_assert_ptr_ne(r2, null); 11193 r2 = self->f->setDouble(self, "2", 2.2); 11194 ck_assert_ptr_ne(r2, null); 11195 r2 = self->f->setInt(self, "b", 2); 11196 ck_assert_ptr_ne(r2, null); 11197 createAllocateSmallInt(I); 11198 setValG(I, 11); 11199 I->type = "anothertype"; 11200 r2 = self->f->set(self, "B", (baset*)I); 11201 ck_assert_ptr_ne(r2, null); 11202 r = cropElemSmallIntSmallDictG(self, "b"); 11203 ck_assert_ptr_ne(r, null); 11204 char *s = toStringO(r); 11205 terminateO(r); 11206 ck_assert_str_eq(s, "2"); 11207 free(s); 11208 s = toStringO(self); 11209 ck_assert_str_eq(s, "{\"1\":1,\"2\":2.200000e+00,\"B\":\"<data container>\"}"); 11210 free(s); 11211 terminateO(self); 11212 11213 } 11214 11215 11216 void cropElemSmallJsonSmallDictGT(void) { 11217 11218 smallJsont* r; 11219 smallDictt *self = allocG(rtSmallDictt); 11220 smallDictt *r2; 11221 11222 r2 = self->f->setInt(self, "1", 1); 11223 ck_assert_ptr_ne(r2, null); 11224 createAllocateSmallBytes(b); 11225 r2 = self->f->setNFreeSmallBytes(self, "2", b); 11226 ck_assert_ptr_ne(r2, null); 11227 createAllocateSmallJson(d); 11228 r2 = self->f->setNFreeSmallJson(self, "b", d); 11229 ck_assert_ptr_ne(r2, null); 11230 createAllocateSmallInt(I); 11231 setValG(I, 11); 11232 I->type = "anothertype"; 11233 r2 = self->f->set(self, "B", (baset*)I); 11234 ck_assert_ptr_ne(r2, null); 11235 r = cropElemSmallJsonSmallDictG(self, "b"); 11236 ck_assert_ptr_ne(r, null); 11237 char *s = toStringO(r); 11238 terminateO(r); 11239 ck_assert_str_eq(s, "{}"); 11240 free(s); 11241 s = toStringO(self); 11242 ck_assert_str_eq(s, "{\"1\":1,\"2\":[],\"B\":\"<data container>\"}"); 11243 free(s); 11244 terminateO(self); 11245 11246 } 11247 11248 11249 void cropElemSmallStringSmallDictGT(void) { 11250 11251 smallStringt* r; 11252 smallDictt *self = allocG(rtSmallDictt); 11253 smallDictt *r2; 11254 11255 r2 = self->f->setInt(self, "1", 1); 11256 ck_assert_ptr_ne(r2, null); 11257 r2 = self->f->setDouble(self, "2", 2.2); 11258 ck_assert_ptr_ne(r2, null); 11259 r2 = self->f->setS(self, "b", "qwe"); 11260 ck_assert_ptr_ne(r2, null); 11261 createAllocateSmallInt(I); 11262 setValG(I, 11); 11263 I->type = "anothertype"; 11264 r2 = self->f->set(self, "B", (baset*)I); 11265 ck_assert_ptr_ne(r2, null); 11266 r = cropElemSmallStringSmallDictG(self, "b"); 11267 ck_assert_ptr_ne(r, null); 11268 char *s = toStringO(r); 11269 terminateO(r); 11270 ck_assert_str_eq(s, "qwe"); 11271 free(s); 11272 s = toStringO(self); 11273 ck_assert_str_eq(s, "{\"1\":1,\"2\":2.200000e+00,\"B\":\"<data container>\"}"); 11274 free(s); 11275 terminateO(self); 11276 11277 } 11278 11279 11280 void cropElemVoidSmallDictGT(void) { 11281 11282 void* r; 11283 smallDictt *self = allocG(rtSmallDictt); 11284 smallDictt *r2; 11285 11286 r2 = self->f->setInt(self, "1", 1); 11287 ck_assert_ptr_ne(r2, null); 11288 r2 = self->f->setDouble(self, "2", 2.2); 11289 ck_assert_ptr_ne(r2, null); 11290 smallContainert *c = allocSmallContainer(&r); 11291 r2 = self->f->setNFreeSmallContainer(self, "b", c); 11292 ck_assert_ptr_ne(r2, null); 11293 createAllocateSmallInt(I); 11294 setValG(I, 11); 11295 I->type = "anothertype"; 11296 r2 = self->f->set(self, "B", (baset*)I); 11297 ck_assert_ptr_ne(r2, null); 11298 r = cropElemVoidSmallDictG(self, "b"); 11299 ck_assert_ptr_eq(r, &r); 11300 char *s = toStringO(self); 11301 ck_assert_str_eq(s, "{\"1\":1,\"2\":2.200000e+00,\"B\":\"<data container>\"}"); 11302 free(s); 11303 terminateO(self); 11304 11305 } 11306 11307 11308 void cropElemSmallContainerSmallDictGT(void) { 11309 11310 smallContainert* r; 11311 smallDictt *self = allocG(rtSmallDictt); 11312 smallDictt *r2; 11313 11314 r2 = self->f->setInt(self, "1", 1); 11315 ck_assert_ptr_ne(r2, null); 11316 r2 = self->f->setDouble(self, "2", 2.2); 11317 ck_assert_ptr_ne(r2, null); 11318 smallContainert *c = allocSmallContainer(&r); 11319 r2 = self->f->setNFreeSmallContainer(self, "b", c); 11320 ck_assert_ptr_ne(r2, null); 11321 createAllocateSmallInt(I); 11322 setValG(I, 11); 11323 I->type = "anothertype"; 11324 r2 = self->f->set(self, "B", (baset*)I); 11325 ck_assert_ptr_ne(r2, null); 11326 r = cropElemSmallContainerSmallDictG(self, "b"); 11327 ck_assert_ptr_ne(r, null); 11328 char *s = toStringO(r); 11329 terminateO(r); 11330 ck_assert_str_eq(s, "<data smallContainer>"); 11331 free(s); 11332 s = toStringO(self); 11333 ck_assert_str_eq(s, "{\"1\":1,\"2\":2.200000e+00,\"B\":\"<data container>\"}"); 11334 free(s); 11335 terminateO(self); 11336 11337 } 11338 11339 11340 void delSmallDictGT(void) { 11341 11342 smallDictt* r; 11343 smallDictt *self = allocG(rtSmallDictt); 11344 11345 r = self->f->setInt(self, "1", 1); 11346 ck_assert_ptr_ne(r, null); 11347 r = self->f->setDouble(self, "2", 2.2); 11348 ck_assert_ptr_ne(r, null); 11349 r = delSmallDictG(self, "2", 0); 11350 ck_assert_ptr_ne(r, null); 11351 char *s = toStringO(r); 11352 ck_assert_str_eq(s, "{\"1\":1}"); 11353 free(s); 11354 terminateO(self); 11355 11356 } 11357 11358 11359 void delKCharSmallDictGT(void) { 11360 11361 smallDictt* r; 11362 smallDictt *self = allocG(rtSmallDictt); 11363 11364 r = self->f->setInt(self, "1", 1); 11365 ck_assert_ptr_ne(r, null); 11366 r = self->f->setDouble(self, "2", 2.2); 11367 ck_assert_ptr_ne(r, null); 11368 r = delKCharSmallDictG(self, '2', 0); 11369 ck_assert_ptr_ne(r, null); 11370 char *s = toStringO(r); 11371 ck_assert_str_eq(s, "{\"1\":1}"); 11372 free(s); 11373 terminateO(self); 11374 11375 } 11376 11377 11378 void delElemSmallDictGT(void) { 11379 11380 smallDictt* r; 11381 smallDictt *self = allocG(rtSmallDictt); 11382 11383 r = self->f->setInt(self, "1", 1); 11384 ck_assert_ptr_ne(r, null); 11385 r = self->f->setDouble(self, "2", 2.2); 11386 ck_assert_ptr_ne(r, null); 11387 r = delElemSmallDictG(self, "2"); 11388 ck_assert_ptr_ne(r, null); 11389 char *s = toStringO(r); 11390 ck_assert_str_eq(s, "{\"1\":1}"); 11391 free(s); 11392 terminateO(self); 11393 11394 } 11395 11396 11397 void delElemKCharSmallDictGT(void) { 11398 11399 smallDictt* r; 11400 smallDictt *self = allocG(rtSmallDictt); 11401 11402 r = self->f->setInt(self, "1", 1); 11403 ck_assert_ptr_ne(r, null); 11404 r = self->f->setDouble(self, "2", 2.2); 11405 ck_assert_ptr_ne(r, null); 11406 r = delElemKCharSmallDictG(self, '2'); 11407 ck_assert_ptr_ne(r, null); 11408 char *s = toStringO(r); 11409 ck_assert_str_eq(s, "{\"1\":1}"); 11410 free(s); 11411 terminateO(self); 11412 11413 } 11414 11415 11416 void removeSmallDictGT(void) { 11417 11418 smallDictt* r; 11419 smallDictt *self = allocG(rtSmallDictt); 11420 11421 smallIntt *i = allocSmallInt(1); 11422 r = self->f->setSmallInt(self, "1", i); 11423 ck_assert_ptr_ne(r, null); 11424 r = removeSmallDictG(self, "1", 0); 11425 ck_assert_ptr_ne(r, null); 11426 terminateO(i); 11427 char *s = toStringO(r); 11428 ck_assert_str_eq(s, "{}"); 11429 free(s); 11430 terminateO(self); 11431 11432 } 11433 11434 11435 void removeKCharSmallDictGT(void) { 11436 11437 smallDictt* r; 11438 smallDictt *self = allocG(rtSmallDictt); 11439 11440 smallIntt *i = allocSmallInt(1); 11441 r = self->f->setSmallInt(self, "1", i); 11442 ck_assert_ptr_ne(r, null); 11443 r = removeKCharSmallDictG(self, '1', 0); 11444 ck_assert_ptr_ne(r, null); 11445 terminateO(i); 11446 char *s = toStringO(r); 11447 ck_assert_str_eq(s, "{}"); 11448 free(s); 11449 terminateO(self); 11450 11451 } 11452 11453 11454 void removeElemSmallDictGT(void) { 11455 11456 smallDictt* r; 11457 smallDictt *self = allocG(rtSmallDictt); 11458 11459 smallIntt *i = allocSmallInt(1); 11460 r = self->f->setSmallInt(self, "1", i); 11461 ck_assert_ptr_ne(r, null); 11462 r = removeElemSmallDictG(self, "1"); 11463 ck_assert_ptr_ne(r, null); 11464 terminateO(i); 11465 char *s = toStringO(r); 11466 ck_assert_str_eq(s, "{}"); 11467 free(s); 11468 terminateO(self); 11469 11470 } 11471 11472 11473 void removeElemKCharSmallDictGT(void) { 11474 11475 smallDictt* r; 11476 smallDictt *self = allocG(rtSmallDictt); 11477 11478 smallIntt *i = allocSmallInt(1); 11479 r = self->f->setSmallInt(self, "1", i); 11480 ck_assert_ptr_ne(r, null); 11481 r = removeElemKCharSmallDictG(self, '1'); 11482 ck_assert_ptr_ne(r, null); 11483 terminateO(i); 11484 char *s = toStringO(r); 11485 ck_assert_str_eq(s, "{}"); 11486 free(s); 11487 terminateO(self); 11488 11489 } 11490 11491 11492 void hasSmallDictGT(void) { 11493 11494 smallDictt *self = allocG(rtSmallDictt); 11495 11496 smallDictt *r2 = self->f->setInt(self, "1", 1); 11497 ck_assert_ptr_ne(r2, null); 11498 ck_assert(hasSmallDictG(self, "1")); 11499 terminateO(self); 11500 11501 } 11502 11503 11504 void hasKCharSmallDictGT(void) { 11505 11506 smallDictt *self = allocG(rtSmallDictt); 11507 11508 smallDictt *r2 = self->f->setInt(self, "1", 1); 11509 ck_assert_ptr_ne(r2, null); 11510 ck_assert(hasKCharSmallDictG(self, '1')); 11511 terminateO(self); 11512 11513 } 11514 11515 11516 void keyBySmallDictGT(void) { 11517 11518 char* r; 11519 smallDictt *self = allocG(rtSmallDictt); 11520 baset *value; 11521 11522 smallDictt *r2 = self->f->setInt(self, "1", 1); 11523 ck_assert_ptr_ne(r2, null); 11524 value = (baset*) allocSmallInt(1); 11525 r = keyBySmallDictG(self, value); 11526 ck_assert_str_eq(r, "1"); 11527 terminateO(value); 11528 terminateO(self); 11529 11530 } 11531 11532 11533 void keyByUndefinedSmallDictGT(void) { 11534 11535 char* r; 11536 smallDictt *self = allocG(rtSmallDictt); 11537 undefinedt *value; 11538 11539 smallDictt *r2 = self->f->setUndefined(self, "1"); 11540 ck_assert_ptr_ne(r2, null); 11541 value = allocUndefined(); 11542 r = keyByUndefinedSmallDictG(self, value); 11543 ck_assert_str_eq(r, "1"); 11544 terminateO(value); 11545 terminateO(self); 11546 11547 } 11548 11549 11550 void keyByBoolSmallDictGT(void) { 11551 11552 char* r; 11553 smallDictt *self = allocG(rtSmallDictt); 11554 11555 smallDictt *r2 = self->f->setBool(self, "1", true); 11556 ck_assert_ptr_ne(r2, null); 11557 r = keyByBoolSmallDictG(self, true); 11558 ck_assert_str_eq(r, "1"); 11559 terminateO(self); 11560 11561 } 11562 11563 11564 void keyByDoubleSmallDictGT(void) { 11565 11566 char* r; 11567 smallDictt *self = allocG(rtSmallDictt); 11568 11569 smallDictt *r2 = self->f->setDouble(self, "1", 2.2); 11570 ck_assert_ptr_ne(r2, null); 11571 r = keyByDoubleSmallDictG(self, 2.2); 11572 ck_assert_str_eq(r, "1"); 11573 terminateO(self); 11574 11575 } 11576 11577 11578 void keyByIntSmallDictGT(void) { 11579 11580 char* r; 11581 smallDictt *self = allocG(rtSmallDictt); 11582 11583 smallDictt *r2 = self->f->setInt(self, "1", 2); 11584 ck_assert_ptr_ne(r2, null); 11585 r = keyByIntSmallDictG(self, 2); 11586 ck_assert_str_eq(r, "1"); 11587 terminateO(self); 11588 11589 } 11590 11591 11592 void keyBySSmallDictGT(void) { 11593 11594 char* r; 11595 smallDictt *self = allocG(rtSmallDictt); 11596 11597 smallDictt *r2 = self->f->setS(self, "1", "qwe"); 11598 ck_assert_ptr_ne(r2, null); 11599 r = keyBySSmallDictG(self, "qwe"); 11600 ck_assert_str_eq(r, "1"); 11601 terminateO(self); 11602 11603 } 11604 11605 11606 void keyByCharSmallDictGT(void) { 11607 11608 char* r; 11609 smallDictt *self = allocG(rtSmallDictt); 11610 11611 smallDictt *r2 = self->f->setS(self, "1", "q"); 11612 ck_assert_ptr_ne(r2, null); 11613 r = keyByCharSmallDictG(self, 'q'); 11614 ck_assert_str_eq(r, "1"); 11615 terminateO(self); 11616 11617 } 11618 11619 11620 void keyByDictSmallDictGT(void) { 11621 11622 char* r; 11623 smallDictt *self = allocG(rtSmallDictt); 11624 smallDictt *dict = allocSmallDict(); 11625 11626 createAllocateSmallDict(d); 11627 d->f->setS(d, "another", "dict"); 11628 smallDictt *r2 = self->f->setNFreeDict(self, "d", d); 11629 ck_assert_ptr_ne(r2, null); 11630 r2 = self->f->setNFreeDict(self, "1", dict); 11631 ck_assert_ptr_ne(r2, null); 11632 dict = allocSmallDict(); 11633 r = keyByDictSmallDictG(self, dict); 11634 ck_assert_str_eq(r, "1"); 11635 terminateO(dict); 11636 terminateO(self); 11637 11638 } 11639 11640 11641 void keyByArraySmallDictGT(void) { 11642 11643 char* r; 11644 smallDictt *self = allocG(rtSmallDictt); 11645 smallArrayt *array = allocSmallArray(); 11646 11647 createAllocateSmallArray(d); 11648 d->f->pushS(d, "another array"); 11649 smallDictt *r2 = self->f->setNFreeArray(self, "d", d); 11650 ck_assert_ptr_ne(r2, null); 11651 r2 = self->f->setNFreeArray(self, "1", array); 11652 ck_assert_ptr_ne(r2, null); 11653 array = allocSmallArray(); 11654 r = keyByArraySmallDictG(self, array); 11655 ck_assert_str_eq(r, "1"); 11656 terminateO(array); 11657 terminateO(self); 11658 11659 } 11660 11661 11662 void keyByArraycSmallDictGT(void) { 11663 11664 char* r; 11665 smallDictt *self = allocG(rtSmallDictt); 11666 char **array = listCreateS("a","b"); 11667 11668 char **d = listCreateS("asd", "zxcv"); 11669 smallDictt *r2 = self->f->setNFreeArrayc(self, "d", d); 11670 ck_assert_ptr_ne(r2, null); 11671 r2 = self->f->setArrayc(self, "1", array); 11672 ck_assert_ptr_ne(r2, null); 11673 r = keyByArraycSmallDictG(self, array); 11674 ck_assert_ptr_ne(r, NULL); 11675 ck_assert_str_eq(r, "1"); 11676 listFreeS(array); 11677 terminateO(self); 11678 11679 } 11680 11681 11682 void keyByCArraycSmallDictGT(void) { 11683 11684 char* r; 11685 smallDictt *self = allocG(rtSmallDictt); 11686 char **array = listCreateS("a","b"); 11687 const char *a[] = {"a", "b", null}; 11688 11689 char **d = listCreateS("asd", "zxcv"); 11690 smallDictt *r2 = self->f->setNFreeArrayc(self, "d", d); 11691 ck_assert_ptr_ne(r2, null); 11692 r2 = self->f->setArrayc(self, "1", array); 11693 ck_assert_ptr_ne(r2, null); 11694 r = keyByCArraycSmallDictG(self, a); 11695 ck_assert_ptr_ne(r, NULL); 11696 ck_assert_str_eq(r, "1"); 11697 listFreeS(array); 11698 terminateO(self); 11699 11700 } 11701 11702 11703 void keyBySmallBoolSmallDictGT(void) { 11704 11705 char* r; 11706 smallDictt *self = allocG(rtSmallDictt); 11707 smallBoolt *value = allocSmallBool(true); 11708 11709 createAllocateSmallBool(d); 11710 setValO(d, false); 11711 smallDictt *r2 = self->f->setNFreeSmallBool(self, "d", d); 11712 ck_assert_ptr_ne(r2, null); 11713 r2 = self->f->setNFreeSmallBool(self, "1", value); 11714 ck_assert_ptr_ne(r2, null); 11715 value = allocSmallBool(true); 11716 r = keyBySmallBoolSmallDictG(self, value); 11717 ck_assert_str_eq(r, "1"); 11718 terminateO(value); 11719 terminateO(self); 11720 11721 } 11722 11723 11724 void keyBySmallBytesSmallDictGT(void) { 11725 11726 char* r; 11727 smallDictt *self = allocG(rtSmallDictt); 11728 smallBytest *value = allocSmallBytes("qwe", sizeof("qwe")); 11729 11730 smallBytest *d = allocSmallBytes("asd", sizeof("asd")); 11731 smallDictt *r2 = self->f->setNFreeSmallBytes(self, "d", d); 11732 ck_assert_ptr_ne(r2, null); 11733 r2 = self->f->setNFreeSmallBytes(self, "1", value); 11734 ck_assert_ptr_ne(r2, null); 11735 value = allocSmallBytes("qwe", sizeof("qwe")); 11736 r = keyBySmallBytesSmallDictG(self, value); 11737 ck_assert_str_eq(r, "1"); 11738 terminateO(value); 11739 terminateO(self); 11740 11741 } 11742 11743 11744 void keyBySmallDoubleSmallDictGT(void) { 11745 11746 char* r; 11747 smallDictt *self = allocG(rtSmallDictt); 11748 smallDoublet *value = allocSmallDouble(2.2); 11749 11750 createAllocateSmallDouble(d); 11751 smallDictt *r2 = self->f->setNFreeSmallDouble(self, "d", d); 11752 ck_assert_ptr_ne(r2, null); 11753 r2 = self->f->setNFreeSmallDouble(self, "1", value); 11754 ck_assert_ptr_ne(r2, null); 11755 value = allocSmallDouble(2.2); 11756 r = keyBySmallDoubleSmallDictG(self, value); 11757 ck_assert_str_eq(r, "1"); 11758 terminateO(value); 11759 terminateO(self); 11760 11761 } 11762 11763 11764 void keyBySmallIntSmallDictGT(void) { 11765 11766 char* r; 11767 smallDictt *self = allocG(rtSmallDictt); 11768 smallIntt *value = allocSmallInt(2); 11769 11770 createAllocateSmallInt(d); 11771 smallDictt *r2 = self->f->setNFreeSmallInt(self, "d", d); 11772 ck_assert_ptr_ne(r2, null); 11773 r2 = self->f->setNFreeSmallInt(self, "1", value); 11774 ck_assert_ptr_ne(r2, null); 11775 value = allocSmallInt(2); 11776 r = keyBySmallIntSmallDictG(self, value); 11777 ck_assert_str_eq(r, "1"); 11778 terminateO(value); 11779 terminateO(self); 11780 11781 } 11782 11783 11784 void keyBySmallJsonSmallDictGT(void) { 11785 11786 char* r; 11787 smallDictt *self = allocG(rtSmallDictt); 11788 smallJsont *value = allocSmallJson(); 11789 11790 createUndefined(u); 11791 setTopO(value, (baset*)&u); 11792 self->f->setUndefined(self, "1"); 11793 r = keyBySmallJsonSmallDictG(self, value); 11794 ck_assert_str_eq(r, "1"); 11795 terminateO(value); 11796 terminateO(self); 11797 11798 } 11799 11800 11801 void keyBySmallStringSmallDictGT(void) { 11802 11803 char* r; 11804 smallDictt *self = allocG(rtSmallDictt); 11805 smallStringt *value = allocSmallString("qwe"); 11806 11807 createAllocateSmallString(d); 11808 smallDictt *r2 = self->f->setNFreeSmallString(self, "d", d); 11809 ck_assert_ptr_ne(r2, null); 11810 r2 = self->f->setNFreeSmallString(self, "1", value); 11811 ck_assert_ptr_ne(r2, null); 11812 value = allocSmallString("qwe"); 11813 r = keyBySmallStringSmallDictG(self, value); 11814 ck_assert_str_eq(r, "1"); 11815 terminateO(value); 11816 terminateO(self); 11817 11818 } 11819 11820 11821 void keyBySmallContainerSmallDictGT(void) { 11822 11823 char* r; 11824 smallDictt *self = allocG(rtSmallDictt); 11825 smallContainert *value = allocSmallContainer(null); 11826 11827 createAllocateSmallString(d); 11828 smallDictt *r2 = self->f->setNFreeSmallString(self, "d", d); 11829 ck_assert_ptr_ne(r2, null); 11830 r = keyBySmallContainerSmallDictG(self, value); 11831 ck_assert_ptr_eq(r, null); 11832 terminateO(value); 11833 terminateO(self); 11834 11835 } 11836 11837 11838 void icKeyBySmallDictGT(void) { 11839 11840 char* r; 11841 smallDictt *self = allocG(rtSmallDictt); 11842 baset *value; 11843 11844 smallDictt *r2 = self->f->setS(self, "1", "QQ"); 11845 ck_assert_ptr_ne(r2, null); 11846 value = (baset*) allocSmallString("qq"); 11847 r = icKeyBySmallDictG(self, value); 11848 ck_assert_str_eq(r, "1"); 11849 terminateO(value); 11850 terminateO(self); 11851 11852 } 11853 11854 11855 void icKeyBySSmallDictGT(void) { 11856 11857 char* r; 11858 smallDictt *self = allocG(rtSmallDictt); 11859 11860 smallDictt *r2 = self->f->setS(self, "1", "qwe"); 11861 ck_assert_ptr_ne(r2, null); 11862 r = icKeyBySSmallDictG(self, "QWE"); 11863 ck_assert_str_eq(r, "1"); 11864 terminateO(self); 11865 11866 } 11867 11868 11869 void icKeyByCharSmallDictGT(void) { 11870 11871 char* r; 11872 smallDictt *self = allocG(rtSmallDictt); 11873 11874 smallDictt *r2 = self->f->setS(self, "1", "q"); 11875 ck_assert_ptr_ne(r2, null); 11876 r = icKeyByCharSmallDictG(self, 'Q'); 11877 ck_assert_str_eq(r, "1"); 11878 terminateO(self); 11879 11880 } 11881 11882 11883 void icKeyByDictSmallDictGT(void) { 11884 11885 char* r; 11886 smallDictt *self = allocG(rtSmallDictt); 11887 smallDictt *dict = allocSmallDict(); 11888 11889 createAllocateSmallDict(d); 11890 d->f->setS(d, "another", "dict"); 11891 smallDictt *r2 = self->f->setNFreeDict(self, "d", d); 11892 ck_assert_ptr_ne(r2, null); 11893 dict->f->setS(dict, "asd", "asd"); 11894 r2 = self->f->setNFreeDict(self, "1", dict); 11895 ck_assert_ptr_ne(r2, null); 11896 dict = allocSmallDict(); 11897 dict->f->setS(dict, "ASD", "asd"); 11898 r = icKeyByDictSmallDictG(self, dict); 11899 ck_assert_str_eq(r, "1"); 11900 terminateO(dict); 11901 terminateO(self); 11902 11903 } 11904 11905 11906 void icKeyByArraySmallDictGT(void) { 11907 11908 char* r; 11909 smallDictt *self = allocG(rtSmallDictt); 11910 smallArrayt *array = allocSmallArray(); 11911 11912 createAllocateSmallArray(d); 11913 d->f->pushS(d, "another array"); 11914 smallDictt *r2 = self->f->setNFreeArray(self, "d", d); 11915 ck_assert_ptr_ne(r2, null); 11916 array->f->pushS(array, "the array"); 11917 r2 = self->f->setNFreeArray(self, "1", array); 11918 ck_assert_ptr_ne(r2, null); 11919 array = allocSmallArray(); 11920 array->f->pushS(array, "The array"); 11921 r = icKeyByArraySmallDictG(self, array); 11922 ck_assert_str_eq(r, "1"); 11923 terminateO(array); 11924 terminateO(self); 11925 11926 } 11927 11928 11929 void icKeyByArraycSmallDictGT(void) { 11930 11931 char* r; 11932 smallDictt *self = allocG(rtSmallDictt); 11933 char **array = listCreateS("a","b"); 11934 11935 char **d = listCreateS("asd", "zxcv"); 11936 smallDictt *r2 = self->f->setNFreeArrayc(self, "d", d); 11937 ck_assert_ptr_ne(r2, null); 11938 r2 = self->f->setArrayc(self, "1", array); 11939 ck_assert_ptr_ne(r2, null); 11940 iUpperS(&array[0]); 11941 r = icKeyByArraycSmallDictG(self, array); 11942 ck_assert_ptr_ne(r, NULL); 11943 ck_assert_str_eq(r, "1"); 11944 listFreeS(array); 11945 terminateO(self); 11946 11947 } 11948 11949 11950 void icKeyByCArraycSmallDictGT(void) { 11951 11952 char* r; 11953 smallDictt *self = allocG(rtSmallDictt); 11954 const char *a2[] = {"a","b",null}; 11955 char **array = listCreateS("a","b"); 11956 11957 char **d = listCreateS("asd", "zxcv"); 11958 smallDictt *r2 = self->f->setNFreeArrayc(self, "d", d); 11959 ck_assert_ptr_ne(r2, null); 11960 r2 = self->f->setArrayc(self, "1", array); 11961 ck_assert_ptr_ne(r2, null); 11962 iUpperS(&array[0]); 11963 r = icKeyByCArraycSmallDictG(self, a2); 11964 ck_assert_ptr_ne(r, NULL); 11965 ck_assert_str_eq(r, "1"); 11966 listFreeS(array); 11967 terminateO(self); 11968 11969 } 11970 11971 11972 void icKeyBySmallJsonSmallDictGT(void) { 11973 11974 char* r; 11975 smallDictt *self = allocG(rtSmallDictt); 11976 smallJsont *value = allocSmallJson(); 11977 11978 //r = icKeyBySmallJsonSmallDictG(self); 11979 createUndefined(u); 11980 setTopO(value, (baset*)&u); 11981 self->f->setUndefined(self, "1"); 11982 r = icKeyBySmallJsonSmallDictG(self, value); 11983 ck_assert_str_eq(r, "1"); 11984 terminateO(value); 11985 terminateO(self); 11986 11987 } 11988 11989 11990 void icKeyBySmallStringSmallDictGT(void) { 11991 11992 char* r; 11993 smallDictt *self = allocG(rtSmallDictt); 11994 smallStringt *value = allocSmallString("qwe"); 11995 11996 createAllocateSmallString(d); 11997 smallDictt *r2 = self->f->setNFreeSmallString(self, "d", d); 11998 ck_assert_ptr_ne(r2, null); 11999 r2 = self->f->setNFreeSmallString(self, "1", value); 12000 ck_assert_ptr_ne(r2, null); 12001 value = allocSmallString("QWE"); 12002 r = icKeyBySmallStringSmallDictG(self, value); 12003 ck_assert_str_eq(r, "1"); 12004 terminateO(value); 12005 terminateO(self); 12006 12007 } 12008 12009 12010 void trimSmallDictGT(void) { 12011 12012 smallDictt* r; 12013 smallDictt *self = allocG(rtSmallDictt); 12014 12015 self->f->setS(self, "1", "2"); 12016 self->f->setS(self, "3", "4"); 12017 self->f->del(self, "3"); 12018 r = trimSmallDictG(self); 12019 ck_assert_ptr_ne(r, null); 12020 ck_assert_int_eq(lenO(self), 1); 12021 char *s = toStringO(r); 12022 ck_assert_str_eq(s, "{\"1\":\"2\"}"); 12023 free(s); 12024 terminateO(self); 12025 12026 } 12027 12028 12029 void keysSmallStringSmallDictGT(void) { 12030 12031 smallArrayt* r; 12032 smallDictt *self = allocG(rtSmallDictt); 12033 12034 self->f->setS(self, "1", "2"); 12035 self->f->setS(self, "3", "4"); 12036 r = keysSmallStringSmallDictG(self); 12037 ck_assert_ptr_ne(r, null); 12038 char *s = toStringO(r); 12039 ck_assert_str_eq(s, "[\"1\",\"3\"]"); 12040 free(s); 12041 terminateO(r); 12042 terminateO(self); 12043 12044 } 12045 12046 12047 void lenSmallDictGT(void) { 12048 12049 size_t r; 12050 smallDictt *self = allocG(rtSmallDictt); 12051 12052 self->f->setS(self, "1", "2"); 12053 self->f->setS(self, "3", "4"); 12054 r = lenSmallDictG(self); 12055 ck_assert_int_eq(r, 2); 12056 terminateO(self); 12057 12058 } 12059 12060 12061 void emptySmallDictGT(void) { 12062 12063 smallDictt* r; 12064 smallDictt *self = allocG(rtSmallDictt); 12065 12066 self->f->setS(self, "1", "2"); 12067 self->f->setS(self, "3", "4"); 12068 r = emptySmallDictG(self); 12069 ck_assert_ptr_ne(r, null); 12070 ck_assert_int_eq(lenO(self), 0); 12071 terminateO(self); 12072 12073 } 12074 12075 12076 void isEmptySmallDictGT(void) { 12077 12078 bool r; 12079 smallDictt *self = allocG(rtSmallDictt); 12080 12081 r = isEmptySmallDictG(self); 12082 ck_assert(r); 12083 terminateO(self); 12084 12085 } 12086 12087 12088 void zipSmallDictGT(void) { 12089 12090 smallDictt* r; 12091 smallDictt *self = allocG(rtSmallDictt); 12092 smallArrayt *keys = allocSmallArray(); 12093 smallArrayt *values = allocSmallArray(); 12094 12095 self->f->setInt(self, "", 1); 12096 // 3 elements in keys 12097 // 2 elements in values 12098 // only 2 key/values are zipped 12099 keys->f->pushS(keys, "a"); 12100 keys->f->pushS(keys, "b"); 12101 keys->f->pushS(keys, "c"); 12102 values->f->pushInt(values, 1); 12103 values->f->pushInt(values, 2); 12104 r = zipSmallDictG(self, keys, values); 12105 terminateO(keys); 12106 smashO(values); 12107 ck_assert_ptr_ne(r, NULL); 12108 char *s = toStringO(r); 12109 ck_assert_str_eq(s, "{\"\":1,\"a\":1,\"b\":2}"); 12110 free(s); 12111 terminateO(self); 12112 12113 } 12114 12115 12116 void zipSmallJsonSmallDictGT(void) { 12117 12118 smallDictt* r; 12119 smallDictt *self = allocG(rtSmallDictt); 12120 smallArrayt *keys = allocSmallArray(); 12121 smallJsont *values = allocSmallJson(); 12122 12123 self->f->setInt(self, "", 1); 12124 // 3 elements in keys 12125 // 2 elements in values 12126 // only 2 key/values are zipped 12127 keys->f->pushS(keys, "a"); 12128 keys->f->pushS(keys, "b"); 12129 keys->f->pushS(keys, "c"); 12130 values->f->pushInt(values, 1); 12131 values->f->pushInt(values, 2); 12132 r = zipSmallJsonSmallDictG(self, keys, values); 12133 terminateO(keys); 12134 smashO(values); 12135 ck_assert_ptr_ne(r, NULL); 12136 char *s = toStringO(r); 12137 ck_assert_str_eq(s, "{\"\":1,\"a\":1,\"b\":2}"); 12138 free(s); 12139 terminateO(self); 12140 12141 } 12142 12143 12144 void zipSmallJsonSmallArraySmallDictGT(void) { 12145 12146 smallDictt* r; 12147 smallDictt *self = allocG(rtSmallDictt); 12148 smallJsont *keys = allocSmallJson(); 12149 smallArrayt *values = allocSmallArray(); 12150 12151 self->f->setInt(self, "", 1); 12152 // 3 elements in keys 12153 // 2 elements in values 12154 // only 2 key/values are zipped 12155 keys->f->pushS(keys, "a"); 12156 keys->f->pushS(keys, "b"); 12157 keys->f->pushS(keys, "c"); 12158 values->f->pushInt(values, 1); 12159 values->f->pushInt(values, 2); 12160 r = zipSmallJsonSmallArraySmallDictG(self, keys, values); 12161 terminateO(keys); 12162 smashO(values); 12163 ck_assert_ptr_ne(r, NULL); 12164 char *s = toStringO(r); 12165 ck_assert_str_eq(s, "{\"\":1,\"a\":1,\"b\":2}"); 12166 free(s); 12167 terminateO(self); 12168 12169 } 12170 12171 12172 void zipSmallJsonSmallJsonSmallDictGT(void) { 12173 12174 smallDictt* r; 12175 smallDictt *self = allocG(rtSmallDictt); 12176 smallJsont *keys = allocSmallJson(); 12177 smallJsont *values = allocSmallJson(); 12178 12179 self->f->setInt(self, "", 1); 12180 // 3 elements in keys 12181 // 2 elements in values 12182 // only 2 key/values are zipped 12183 keys->f->pushS(keys, "a"); 12184 keys->f->pushS(keys, "b"); 12185 keys->f->pushS(keys, "c"); 12186 values->f->pushInt(values, 1); 12187 values->f->pushInt(values, 2); 12188 r = zipSmallJsonSmallJsonSmallDictG(self, keys, values); 12189 terminateO(keys); 12190 smashO(values); 12191 ck_assert_ptr_ne(r, NULL); 12192 char *s = toStringO(r); 12193 ck_assert_str_eq(s, "{\"\":1,\"a\":1,\"b\":2}"); 12194 free(s); 12195 terminateO(self); 12196 12197 } 12198 12199 12200 void zipSmallJsonVArraySmallDictGT(void) { 12201 12202 smallDictt* r; 12203 smallDictt *self = allocG(rtSmallDictt); 12204 smallJsont *keys = allocSmallJson(); 12205 char **values; 12206 12207 self->f->setInt(self, "", 1); 12208 // 3 elements in keys 12209 // 2 elements in values 12210 // only 2 key/values are zipped 12211 keys->f->pushS(keys, "a"); 12212 keys->f->pushS(keys, "b"); 12213 keys->f->pushS(keys, "c"); 12214 values = listCreateS("1", "2"); 12215 r = zipSmallJsonVArraySmallDictG(self, keys, values); 12216 terminateO(keys); 12217 listFreeS(values); 12218 ck_assert_ptr_ne(r, NULL); 12219 char *s = toStringO(r); 12220 ck_assert_str_eq(s, "{\"\":1,\"a\":\"1\",\"b\":\"2\"}"); 12221 free(s); 12222 terminateO(self); 12223 12224 } 12225 12226 12227 void zipSmallJsonVCArraySmallDictGT(void) { 12228 12229 smallDictt* r; 12230 smallDictt *self = allocG(rtSmallDictt); 12231 smallJsont *keys = allocSmallJson(); 12232 const char *values[] = {"1","2",null}; 12233 12234 self->f->setInt(self, "", 1); 12235 // 3 elements in keys 12236 // 2 elements in values 12237 // only 2 key/values are zipped 12238 keys->f->pushS(keys, "a"); 12239 keys->f->pushS(keys, "b"); 12240 keys->f->pushS(keys, "c"); 12241 r = zipSmallJsonVCArraySmallDictG(self, keys, values); 12242 terminateO(keys); 12243 ck_assert_ptr_ne(r, NULL); 12244 char *s = toStringO(r); 12245 ck_assert_str_eq(s, "{\"\":1,\"a\":\"1\",\"b\":\"2\"}"); 12246 free(s); 12247 terminateO(self); 12248 12249 } 12250 12251 12252 void zipArraySmallDictGT(void) { 12253 12254 smallDictt* r; 12255 smallDictt *self = allocG(rtSmallDictt); 12256 char** keys; 12257 smallArrayt *values = allocSmallArray(); 12258 12259 self->f->setInt(self, "", 1); 12260 // 3 elements in keys 12261 // 2 elements in values 12262 // only 2 key/values are zipped 12263 keys = listCreateS("a", "b", "c"); 12264 values->f->pushInt(values, 1); 12265 values->f->pushInt(values, 2); 12266 r = zipArraySmallDictG(self, keys, values); 12267 listFreeS(keys); 12268 smashO(values); 12269 ck_assert_ptr_ne(r, NULL); 12270 char *s = toStringO(r); 12271 ck_assert_str_eq(s, "{\"\":1,\"a\":1,\"b\":2}"); 12272 free(s); 12273 terminateO(self); 12274 12275 } 12276 12277 12278 void zipArraySmallJsonSmallDictGT(void) { 12279 12280 smallDictt* r; 12281 smallDictt *self = allocG(rtSmallDictt); 12282 char** keys; 12283 smallJsont *values = allocSmallJson(); 12284 12285 self->f->setInt(self, "", 1); 12286 // 3 elements in keys 12287 // 2 elements in values 12288 // only 2 key/values are zipped 12289 keys = listCreateS("a", "b", "c"); 12290 values->f->pushInt(values, 1); 12291 values->f->pushInt(values, 2); 12292 r = zipArraySmallJsonSmallDictG(self, keys, values); 12293 listFreeS(keys); 12294 smashO(values); 12295 ck_assert_ptr_ne(r, NULL); 12296 char *s = toStringO(r); 12297 ck_assert_str_eq(s, "{\"\":1,\"a\":1,\"b\":2}"); 12298 free(s); 12299 terminateO(self); 12300 12301 } 12302 12303 12304 void zipCArraySmallDictGT(void) { 12305 12306 smallDictt* r; 12307 smallDictt *self = allocG(rtSmallDictt); 12308 const char* keys[] = {"a","b","c",null}; 12309 smallArrayt *values = allocSmallArray(); 12310 12311 self->f->setInt(self, "", 1); 12312 // 3 elements in keys 12313 // 2 elements in values 12314 // only 2 key/values are zipped 12315 values->f->pushInt(values, 1); 12316 values->f->pushInt(values, 2); 12317 r = zipCArraySmallDictG(self, keys, values); 12318 smashO(values); 12319 ck_assert_ptr_ne(r, NULL); 12320 char *s = toStringO(r); 12321 ck_assert_str_eq(s, "{\"\":1,\"a\":1,\"b\":2}"); 12322 free(s); 12323 terminateO(self); 12324 12325 } 12326 12327 12328 void zipCArraySmallJsonSmallDictGT(void) { 12329 12330 smallDictt* r; 12331 smallDictt *self = allocG(rtSmallDictt); 12332 const char* keys[] = {"a","b","c",null}; 12333 smallJsont *values = allocSmallJson(); 12334 12335 self->f->setInt(self, "", 1); 12336 // 3 elements in keys 12337 // 2 elements in values 12338 // only 2 key/values are zipped 12339 values->f->pushInt(values, 1); 12340 values->f->pushInt(values, 2); 12341 r = zipCArraySmallJsonSmallDictG(self, keys, values); 12342 smashO(values); 12343 ck_assert_ptr_ne(r, NULL); 12344 char *s = toStringO(r); 12345 ck_assert_str_eq(s, "{\"\":1,\"a\":1,\"b\":2}"); 12346 free(s); 12347 terminateO(self); 12348 12349 } 12350 12351 12352 void zipArrayArraySmallDictGT(void) { 12353 12354 smallDictt* r; 12355 smallDictt *self = allocG(rtSmallDictt); 12356 char** keys; 12357 char** values; 12358 12359 self->f->setInt(self, "", 1); 12360 // 3 elements in keys 12361 // 2 elements in values 12362 // only 2 key/values are zipped 12363 keys = listCreateS("a", "b", "c"); 12364 values = listCreateS("1", "2"); 12365 r = zipArrayArraySmallDictG(self, keys, values); 12366 listFreeS(keys); 12367 listFreeS(values); 12368 ck_assert_ptr_ne(r, NULL); 12369 char *s = toStringO(r); 12370 ck_assert_str_eq(s, "{\"\":1,\"a\":\"1\",\"b\":\"2\"}"); 12371 free(s); 12372 terminateO(self); 12373 12374 } 12375 12376 12377 void zipCArrayArraySmallDictGT(void) { 12378 12379 smallDictt* r; 12380 smallDictt *self = allocG(rtSmallDictt); 12381 const char* keys[] = {"a","b","c",null}; 12382 char** values; 12383 12384 //r = zipCArrayArraySmallDictG(self); 12385 self->f->setInt(self, "", 1); 12386 // 3 elements in keys 12387 // 2 elements in values 12388 // only 2 key/values are zipped 12389 values = listCreateS("1", "2"); 12390 r = zipCArrayArraySmallDictG(self, keys, values); 12391 listFreeS(values); 12392 ck_assert_ptr_ne(r, NULL); 12393 char *s = toStringO(r); 12394 ck_assert_str_eq(s, "{\"\":1,\"a\":\"1\",\"b\":\"2\"}"); 12395 free(s); 12396 terminateO(self); 12397 12398 } 12399 12400 12401 void zipArrayCArraySmallDictGT(void) { 12402 12403 smallDictt* r; 12404 smallDictt *self = allocG(rtSmallDictt); 12405 char** keys; 12406 const char* values[] = {"1","2",null}; 12407 12408 self->f->setInt(self, "", 1); 12409 // 3 elements in keys 12410 // 2 elements in values 12411 // only 2 key/values are zipped 12412 keys = listCreateS("a", "b", "c"); 12413 r = zipArrayCArraySmallDictG(self, keys, values); 12414 listFreeS(keys); 12415 ck_assert_ptr_ne(r, NULL); 12416 char *s = toStringO(r); 12417 ck_assert_str_eq(s, "{\"\":1,\"a\":\"1\",\"b\":\"2\"}"); 12418 free(s); 12419 terminateO(self); 12420 12421 } 12422 12423 12424 void zipCArrayCArraySmallDictGT(void) { 12425 12426 smallDictt* r; 12427 smallDictt *self = allocG(rtSmallDictt); 12428 const char* keys[] = {"a","b","c",null}; 12429 const char* values[] = {"1","2",null}; 12430 12431 self->f->setInt(self, "", 1); 12432 // 3 elements in keys 12433 // 2 elements in values 12434 // only 2 key/values are zipped 12435 r = zipCArrayCArraySmallDictG(self, keys, values); 12436 ck_assert_ptr_ne(r, NULL); 12437 char *s = toStringO(r); 12438 ck_assert_str_eq(s, "{\"\":1,\"a\":\"1\",\"b\":\"2\"}"); 12439 free(s); 12440 terminateO(self); 12441 12442 } 12443 12444 12445 void zipVArraySmallDictGT(void) { 12446 12447 smallDictt* r; 12448 smallDictt *self = allocG(rtSmallDictt); 12449 smallArrayt *keys = allocSmallArray(); 12450 char** values; 12451 12452 self->f->setInt(self, "", 1); 12453 // 3 elements in keys 12454 // 2 elements in values 12455 // only 2 key/values are zipped 12456 keys->f->pushS(keys, "a"); 12457 keys->f->pushS(keys, "b"); 12458 keys->f->pushS(keys, "c"); 12459 values = listCreateS("1", "2"); 12460 r = zipVArraySmallDictG(self, keys, values); 12461 terminateO(keys); 12462 listFreeS(values); 12463 ck_assert_ptr_ne(r, NULL); 12464 char *s = toStringO(r); 12465 ck_assert_str_eq(s, "{\"\":1,\"a\":\"1\",\"b\":\"2\"}"); 12466 free(s); 12467 terminateO(self); 12468 12469 } 12470 12471 12472 void zipVCArraySmallDictGT(void) { 12473 12474 smallDictt* r; 12475 smallDictt *self = allocG(rtSmallDictt); 12476 smallArrayt *keys = allocSmallArray(); 12477 const char* values[] = {"1","2",null}; 12478 12479 self->f->setInt(self, "", 1); 12480 // 3 elements in keys 12481 // 2 elements in values 12482 // only 2 key/values are zipped 12483 keys->f->pushS(keys, "a"); 12484 keys->f->pushS(keys, "b"); 12485 keys->f->pushS(keys, "c"); 12486 r = zipVCArraySmallDictG(self, keys, values); 12487 terminateO(keys); 12488 ck_assert_ptr_ne(r, NULL); 12489 char *s = toStringO(r); 12490 ck_assert_str_eq(s, "{\"\":1,\"a\":\"1\",\"b\":\"2\"}"); 12491 free(s); 12492 terminateO(self); 12493 12494 } 12495 12496 12497 void fromArraySmallDictGT(void) { 12498 12499 smallDictt* r; 12500 smallDictt *self = allocG(rtSmallDictt); 12501 smallArrayt *items = allocSmallArray(); 12502 12503 self->f->setInt(self, "", 1); 12504 // ignored item 12505 items->f->pushS(items, "ignored"); 12506 createAllocateSmallArray(a); 12507 a->f->pushS(a, "a"); 12508 a->f->pushInt(a, 1); 12509 items->f->pushNFreeArray(items, a); 12510 a = allocSmallArray(); 12511 items->f->pushNFreeArray(items, a); 12512 a = allocSmallArray(); 12513 a->f->pushInt(a, 1); 12514 a->f->pushInt(a, 2); 12515 items->f->pushNFreeArray(items, a); 12516 r = fromArraySmallDictG(self, items); 12517 ck_assert_ptr_ne(r, NULL); 12518 char *s = toStringO(r); 12519 ck_assert_str_eq(s, "{\"\":1,\"a\":1}"); 12520 free(s); 12521 terminateO(items); 12522 terminateO(self); 12523 12524 } 12525 12526 12527 void toArraySmallDictGT(void) { 12528 12529 smallArrayt* r; 12530 smallDictt *self = allocG(rtSmallDictt); 12531 12532 self->f->setInt(self, "", 1); 12533 self->f->setInt(self, "b", 2); 12534 self->f->setInt(self, "c", 3); 12535 self->f->del(self, ""); 12536 r = toArraySmallDictG(self); 12537 ck_assert_ptr_ne(r, NULL); 12538 char *s = toStringO(r); 12539 ck_assert_str_eq(s, "[[\"b\",2],[\"c\",3]]"); 12540 free(s); 12541 terminateO(r); 12542 smashO(self); 12543 12544 } 12545 12546 12547 void writeFileSmallDictGT(void) { 12548 12549 bool r; 12550 smallDictt *self = allocG(rtSmallDictt); 12551 12552 self->f->setInt(self, "", 1); 12553 self->f->setInt(self, "b", 2); 12554 r = writeFileSmallDictG(self, "smallDictFile.json"); 12555 ck_assert(r); 12556 ck_assert(fileExists("smallDictFile.json")); 12557 char *s = readFileToS("smallDictFile.json"); 12558 ck_assert_str_eq(s, "{\"\":1,\"b\":2}"); 12559 free(s); 12560 rmAll("smallDictFile.json"); 12561 terminateO(self); 12562 12563 } 12564 12565 12566 void writeFileSmallJsonSmallDictGT(void) { 12567 12568 bool r; 12569 smallDictt *self = allocG(rtSmallDictt); 12570 smallJsont *filePath = allocSmallJson(); 12571 12572 self->f->setInt(self, "", 1); 12573 self->f->setInt(self, "b", 2); 12574 setTopSO(filePath, "smallDictFile.json"); 12575 r = writeFileSmallJsonSmallDictG(self, filePath); 12576 ck_assert(r); 12577 ck_assert(fileExists("smallDictFile.json")); 12578 char *s = readFileToS("smallDictFile.json"); 12579 ck_assert_str_eq(s, "{\"\":1,\"b\":2}"); 12580 free(s); 12581 rmAll("smallDictFile.json"); 12582 terminateO(filePath); 12583 terminateO(self); 12584 12585 } 12586 12587 12588 void writeFileSmallStringSmallDictGT(void) { 12589 12590 bool r; 12591 smallDictt *self = allocG(rtSmallDictt); 12592 smallStringt *filePath = allocSmallString("smallDictFile.json"); 12593 12594 self->f->setInt(self, "", 1); 12595 self->f->setInt(self, "b", 2); 12596 r = writeFileSmallStringSmallDictG(self, filePath); 12597 ck_assert(r); 12598 ck_assert(fileExists("smallDictFile.json")); 12599 char *s = readFileToS("smallDictFile.json"); 12600 ck_assert_str_eq(s, "{\"\":1,\"b\":2}"); 12601 free(s); 12602 rmAll("smallDictFile.json"); 12603 terminateO(filePath); 12604 terminateO(self); 12605 12606 } 12607 12608 12609 void writeStreamSmallDictGT(void) { 12610 12611 bool r; 12612 smallDictt *self = allocG(rtSmallDictt); 12613 FILE *fp; 12614 12615 self->f->setInt(self, "", 1); 12616 self->f->setInt(self, "b", 2); 12617 fp = fopen("smallDictFile.json", "w"); 12618 r = writeStreamSmallDictG(self, fp); 12619 ck_assert(r); 12620 fclose(fp); 12621 ck_assert(fileExists("smallDictFile.json")); 12622 char *s = readFileToS("smallDictFile.json"); 12623 ck_assert_str_eq(s, "{\"\":1,\"b\":2}"); 12624 free(s); 12625 rmAll("smallDictFile.json"); 12626 terminateO(self); 12627 12628 } 12629 12630 12631 void appendFileSmallDictGT(void) { 12632 12633 bool r; 12634 smallDictt *self = allocG(rtSmallDictt); 12635 12636 self->f->setInt(self, "", 1); 12637 self->f->setInt(self, "b", 2); 12638 writeFileS("smallDictFile.json", "-"); 12639 r = appendFileSmallDictG(self, "smallDictFile.json"); 12640 ck_assert(r); 12641 ck_assert(fileExists("smallDictFile.json")); 12642 char *s = readFileToS("smallDictFile.json"); 12643 ck_assert_str_eq(s, "-{\"\":1,\"b\":2}"); 12644 free(s); 12645 rmAll("smallDictFile.json"); 12646 terminateO(self); 12647 12648 } 12649 12650 12651 void appendFileSmallStringSmallDictGT(void) { 12652 12653 bool r; 12654 smallDictt *self = allocG(rtSmallDictt); 12655 smallStringt *filePath = allocSmallString("smallDictFile.json"); 12656 12657 self->f->setInt(self, "", 1); 12658 self->f->setInt(self, "b", 2); 12659 writeFileS("smallDictFile.json", "-"); 12660 r = appendFileSmallStringSmallDictG(self, filePath); 12661 ck_assert(r); 12662 ck_assert(fileExists("smallDictFile.json")); 12663 char *s = readFileToS("smallDictFile.json"); 12664 ck_assert_str_eq(s, "-{\"\":1,\"b\":2}"); 12665 free(s); 12666 rmAll("smallDictFile.json"); 12667 terminateO(filePath); 12668 terminateO(self); 12669 12670 } 12671 12672 12673 void logSmallDictGT(void) { 12674 12675 smallDictt *self = allocG(rtSmallDictt); 12676 12677 self->f->setInt(self, "", 1); 12678 self->f->setInt(self, "b", 2); 12679 logSmallDictG(self); 12680 terminateO(self); 12681 12682 } 12683 12684 12685 void typeSmallStringSmallDictGT(void) { 12686 12687 smallStringt* r; 12688 smallDictt *self = allocG(rtSmallDictt); 12689 12690 self->f->setInt(self, "", 1); 12691 self->f->setInt(self, "b", 2); 12692 r = typeSmallStringSmallDictG(self, ""); 12693 ck_assert_str_eq(ssGet(r), "int"); 12694 terminateO(r); 12695 terminateO(self); 12696 12697 } 12698 12699 12700 void typeStringKCharSmallDictGT(void) { 12701 12702 const char* r; 12703 smallDictt *self = allocG(rtSmallDictt); 12704 12705 self->f->setInt(self, "", 1); 12706 self->f->setInt(self, "b", 2); 12707 r = typeStringKCharSmallDictG(self, 'b'); 12708 ck_assert_str_eq(r, "int"); 12709 terminateO(self); 12710 12711 } 12712 12713 12714 void typeSmallStringKCharSmallDictGT(void) { 12715 12716 smallStringt* r; 12717 smallDictt *self = allocG(rtSmallDictt); 12718 12719 self->f->setInt(self, "", 1); 12720 self->f->setInt(self, "b", 2); 12721 r = typeSmallStringKCharSmallDictG(self, 'b'); 12722 ck_assert_str_eq(ssGet(r), "int"); 12723 terminateO(r); 12724 terminateO(self); 12725 12726 } 12727 12728 12729 void cSmallDictT(void) { 12730 12731 // local object 12732 createSmallDict(obj); 12733 ck_assert_str_eq(obj.type, "smallDict"); 12734 // object 12735 createAllocateSmallDict(obj2); 12736 ck_assert_str_eq(obj2->type, "smallDict"); 12737 // toString 12738 char *s = obj2->f->toString(obj2); 12739 ck_assert_str_eq(s, "{}"); 12740 free(s); 12741 // duplicate 12742 smallDictt *o; 12743 createAllocateSmallBool(oBool2); 12744 oBool2->f->set(oBool2, true); 12745 obj2->f->set(obj2, "lib", (baset *)oBool2); 12746 finishO(oBool2); 12747 o = obj2->f->duplicate(obj2); 12748 smallBoolt *oBool3; 12749 oBool3 = (smallBoolt *)o->f->get(o, "lib"); 12750 ck_assert_ptr_ne(oBool3, NULL); 12751 ck_assert(oBool3->value->value == true); 12752 finishO(oBool3); 12753 terminateO(o); 12754 // toString 12755 createAllocateUndefined(oU); 12756 obj2->f->set(obj2, "u", (baset *)oU); 12757 finishO(oU); 12758 createAllocateSmallString(oStr); 12759 oStr->f->set(oStr, "sheepy"); 12760 obj2->f->set(obj2, "str", (baset *)oStr); 12761 finishO(oStr); 12762 s = obj2->f->toString(obj2); 12763 ck_assert_str_eq(s, "{\"lib\":true,\"u\":null,\"str\":\"sheepy\"}"); 12764 free(s); 12765 // dispose 12766 o = obj2->f->duplicate(obj2); 12767 undefinedt *u = (undefinedt *) o->f->get(o, "u"); 12768 smallStringt *st = (smallStringt *) o->f->get(o, "str"); 12769 oBool2 = (smallBoolt *) o->f->get(o, "lib"); 12770 smallt *data = sDictGetTiny(o->d, "u"); 12771 sFree(data); 12772 data = sDictGetTiny(o->d, "str"); 12773 sFree(data); 12774 data = sDictGetTiny(o->d, "lib"); 12775 sFree(data); 12776 o->f->dispose(o); 12777 ck_assert_uint_eq(o->f->len(o), 0); 12778 terminateO(u); 12779 smashO(st); 12780 smashO(oBool2); 12781 terminateO(o); 12782 // smash 12783 o = obj2->f->duplicate(obj2); 12784 u = (undefinedt *) o->f->get(o, "u"); 12785 st = (smallStringt *) o->f->get(o, "str"); 12786 oBool2 = (smallBoolt *) o->f->get(o, "lib"); 12787 data = sDictGetTiny(o->d, "u"); 12788 sFree(data); 12789 data = sDictGetTiny(o->d, "str"); 12790 sFree(data); 12791 data = sDictGetTiny(o->d, "lib"); 12792 sFree(data); 12793 o->f->smash(&o); 12794 terminateO(u); 12795 smashO(st); 12796 smashO(oBool2); 12797 ck_assert_ptr_eq(o, NULL); 12798 // set NULL (not possible) 12799 obj2->f->set(obj2, NULL, NULL); 12800 obj2->f->set(obj2, "no", NULL); 12801 ck_assert_uint_eq(obj2->f->len(obj2), 3); 12802 // get non existing element 12803 oBool3 = (smallBoolt *)obj2->f->get(obj2, "non existing"); 12804 ck_assert_ptr_eq(oBool3, NULL); 12805 ck_assert_ptr_eq(obj2->f->get(obj2, NULL), NULL); 12806 // delete element 12807 smallDictt *r = obj2->f->del(obj2, "lib"); 12808 ck_assert_ptr_ne(r, null); 12809 oBool3 = (smallBoolt *)obj2->f->get(obj2, "lib"); 12810 ck_assert_ptr_eq(oBool3, NULL); 12811 // delete non existing element 12812 r = obj2->f->del(obj2, NULL); 12813 ck_assert_ptr_eq(r, null); 12814 r = obj2->f->del(obj2, "non existing"); 12815 ck_assert_ptr_ne(r, null); 12816 // has 12817 ck_assert(!obj2->f->has(obj2, "qwe")); 12818 ck_assert(!obj2->f->has(obj2, NULL)); 12819 ck_assert(obj2->f->has(obj2, "u")); 12820 // empty dict 12821 createAllocateSmallDict(D); 12822 freeO(D); 12823 ck_assert(!D->f->has(D, "d")); 12824 terminateO(D); 12825 // keys 12826 char **keys = obj2->f->keys(obj2); 12827 ck_assert_uint_eq(listLengthS(keys), 2); 12828 ck_assert_str_eq(keys[0], "u"); 12829 ck_assert_str_eq(keys[1], "str"); 12830 listFreeS(keys); 12831 // empty dict 12832 initiateAllocateSmallDict(&o); 12833 keys = o->f->keys(o); 12834 ck_assert_ptr_eq(keys, NULL); 12835 terminateO(o); 12836 // values 12837 smallArrayt *values = obj2->f->values(obj2); 12838 s = toStringO(values); 12839 ck_assert_str_eq(s, "[null,\"sheepy\"]"); 12840 free(s); 12841 values->f->smash(&values); 12842 // empty dict 12843 initiateAllocateSmallDict(&o); 12844 values = o->f->values(o); 12845 ck_assert_ptr_eq(values, NULL); 12846 terminateO(o); 12847 // merge 12848 smallDictt *oM; 12849 o = obj2->f->duplicate(obj2); 12850 initiateAllocateSmallDict(&oM); 12851 initiateAllocateSmallString(&st); 12852 st->f->set(st, "SHEEPY MERGED"); 12853 oM->f->set(oM, "str", (baset *) st); 12854 finishO(st); 12855 s = toStringO(o); 12856 ck_assert_str_eq(s, "{\"u\":null,\"str\":\"sheepy\"}"); 12857 free(s); 12858 o->f->merge(o, oM); 12859 s = toStringO(o); 12860 ck_assert_str_eq(s, "{\"u\":null,\"str\":\"SHEEPY MERGED\"}"); 12861 free(s); 12862 oM->f->smash(&oM); 12863 terminateO(o); 12864 // empty dict 12865 o = obj2->f->duplicate(obj2); 12866 initiateAllocateSmallDict(&oM); 12867 s = toStringO(o); 12868 ck_assert_str_eq(s, "{\"u\":null,\"str\":\"sheepy\"}"); 12869 free(s); 12870 o->f->merge(o, oM); 12871 s = toStringO(o); 12872 ck_assert_str_eq(s, "{\"u\":null,\"str\":\"sheepy\"}"); 12873 free(s); 12874 oM->f->smash(&oM); 12875 // non smallDict object 12876 createAllocateSmallInt(z); 12877 r = o->f->merge(o, (smallDictt*)z); 12878 ck_assert_ptr_eq(r, null); 12879 terminateO(z); 12880 terminateO(o); 12881 // NULL dict 12882 o = obj2->f->duplicate(obj2); 12883 s = toStringO(o); 12884 ck_assert_str_eq(s, "{\"u\":null,\"str\":\"sheepy\"}"); 12885 free(s); 12886 o->f->merge(o, NULL); 12887 s = toStringO(o); 12888 ck_assert_str_eq(s, "{\"u\":null,\"str\":\"sheepy\"}"); 12889 free(s); 12890 terminateO(o); 12891 // append 12892 o = obj2->f->duplicate(obj2); 12893 initiateAllocateSmallDict(&oM); 12894 initiateAllocateSmallString(&st); 12895 initiateAllocateUndefined(&oU); 12896 st->f->set(st, "SHEEPY MERGED"); 12897 oM->f->set(oM, "str", (baset *) st); 12898 finishO(st); 12899 oM->f->set(oM, "u2", (baset *) oU); 12900 finishO(oU); 12901 s = toStringO(o); 12902 ck_assert_str_eq(s, "{\"u\":null,\"str\":\"sheepy\"}"); 12903 free(s); 12904 o->f->append(o, oM); 12905 s = toStringO(o); 12906 ck_assert_str_eq(s, "{\"u\":null,\"str\":\"sheepy\",\"u2\":null}"); 12907 free(s); 12908 data = sDictGetTiny(oM->d, "str"); 12909 sFree(data); 12910 oM->f->smash(&oM); 12911 terminateO(o); 12912 // empty dict 12913 o = obj2->f->duplicate(obj2); 12914 initiateAllocateSmallDict(&oM); 12915 s = toStringO(o); 12916 ck_assert_str_eq(s, "{\"u\":null,\"str\":\"sheepy\"}"); 12917 free(s); 12918 o->f->append(o, oM); 12919 s = toStringO(o); 12920 ck_assert_str_eq(s, "{\"u\":null,\"str\":\"sheepy\"}"); 12921 free(s); 12922 oM->f->smash(&oM); 12923 // non smallDict object 12924 z = allocSmallInt(0); 12925 r = o->f->append(o, (smallDictt*)z); 12926 ck_assert_ptr_eq(r, null); 12927 terminateO(z); 12928 terminateO(o); 12929 // NULL dict 12930 o = obj2->f->duplicate(obj2); 12931 s = toStringO(o); 12932 ck_assert_str_eq(s, "{\"u\":null,\"str\":\"sheepy\"}"); 12933 free(s); 12934 o->f->append(o, NULL); 12935 s = toStringO(o); 12936 ck_assert_str_eq(s, "{\"u\":null,\"str\":\"sheepy\"}"); 12937 free(s); 12938 terminateO(o); 12939 // len 12940 ck_assert_uint_eq(obj2->f->len(obj2), 2); 12941 // empty dict 12942 initiateAllocateSmallDict(&o); 12943 ck_assert_uint_eq(o->f->len(o), 0); 12944 terminateO(o); 12945 // empty 12946 o = obj2->f->duplicate(obj2); 12947 o->f->empty(o); 12948 ck_assert_uint_eq(o->f->len(o), 0); 12949 terminateO(o); 12950 // typeString type typeStrings 12951 initiateAllocateSmallDict(&oM); 12952 o = allocSmallDict(); 12953 oU = allocUndefined(); 12954 o->f->set(o, "u", (baset *)oU); 12955 finishO(oU); 12956 st = allocSmallString("sheepy"); 12957 o->f->set(o, "str", (baset *) st); 12958 finishO(st); 12959 oBool2 = allocSmallBool(true); 12960 o->f->set(o, "b", (baset *)oBool2); 12961 finishO(oBool2); 12962 oBool2 = allocSmallBool(true); 12963 o->f->set(o, "B", (baset *)oBool2); 12964 finishO(oBool2); 12965 o->f->del(o, "B"); 12966 // typeString 12967 s = (char *)o->f->typeString(o, "b"); 12968 ck_assert_str_eq(s, "bool"); 12969 // non existing key 12970 ck_assert_ptr_eq(o->f->typeString(o, "B"), NULL); 12971 // empty object 12972 ck_assert_ptr_eq(oM->f->typeString(oM, "B"), NULL); 12973 // type 12974 char c; 12975 c = o->f->type(o, "str"); 12976 ck_assert_uint_eq(c, STRING); 12977 // non existing key 12978 ck_assert(!o->f->type(o, "B")); 12979 // empty object 12980 ck_assert(!oM->f->type(oM, "B")); 12981 // typeStrings 12982 smallDictt *oT = o->f->typeStrings(o); 12983 s = toStringO(oT); 12984 ck_assert_str_eq(s, "{\"u\":\"undefined\",\"str\":\"string\",\"b\":\"bool\"}"); 12985 free(s); 12986 terminateO(oT); 12987 // empty object 12988 oT = oM->f->typeStrings(oM); 12989 ck_assert_ptr_eq(oT, NULL); 12990 terminateO(o); 12991 terminateO(oM); 12992 // free local object 12993 obj.f->free(&obj); 12994 ck_assert_str_eq(obj.type, "smallDict"); 12995 // free object 12996 obj2->f->terminate(&obj2); 12997 ck_assert_ptr_eq(obj2, NULL); 12998 12999 } 13000 13001 13002 13003 13004 int main(int n UNUSED, char**v UNUSED) { 13005 // disable btrace to make the test run faster 13006 btraceDisable(); 13007 getsoSmallDictT(); 13008 setsoSmallDictT(); 13009 mirrorSmallDictT(); 13010 setUndefinedSmallDictT(); 13011 setBoolSmallDictT(); 13012 setDoubleSmallDictT(); 13013 setIntSmallDictT(); 13014 setSSmallDictT(); 13015 setCharSmallDictT(); 13016 setDictSmallDictT(); 13017 setArraySmallDictT(); 13018 setArraycSmallDictT(); 13019 setSmallBoolSmallDictT(); 13020 setSmallBytesSmallDictT(); 13021 setSmallDoubleSmallDictT(); 13022 setSmallIntSmallDictT(); 13023 setSmallJsonSmallDictT(); 13024 setSmallStringSmallDictT(); 13025 setSmallContainerSmallDictT(); 13026 setKCharSmallDictT(); 13027 setUndefinedKCharSmallDictT(); 13028 setBoolKCharSmallDictT(); 13029 setDoubleKCharSmallDictT(); 13030 setIntKCharSmallDictT(); 13031 setSKCharSmallDictT(); 13032 setCharKCharSmallDictT(); 13033 setDictKCharSmallDictT(); 13034 setArrayKCharSmallDictT(); 13035 setArraycKCharSmallDictT(); 13036 setSmallBoolKCharSmallDictT(); 13037 setSmallBytesKCharSmallDictT(); 13038 setSmallDoubleKCharSmallDictT(); 13039 setSmallIntKCharSmallDictT(); 13040 setSmallJsonKCharSmallDictT(); 13041 setSmallStringKCharSmallDictT(); 13042 setSmallContainerKCharSmallDictT(); 13043 setNFreeSmallDictT(); 13044 setNFreeUndefinedSmallDictT(); 13045 setNFreeSSmallDictT(); 13046 setNFreeDictSmallDictT(); 13047 setNFreeArraySmallDictT(); 13048 setNFreeArraycSmallDictT(); 13049 setNFreeSmallBoolSmallDictT(); 13050 setNFreeSmallBytesSmallDictT(); 13051 setNFreeSmallDoubleSmallDictT(); 13052 setNFreeSmallIntSmallDictT(); 13053 setNFreeSmallJsonSmallDictT(); 13054 setNFreeSmallStringSmallDictT(); 13055 setNFreeSmallContainerSmallDictT(); 13056 setNFreeKCharSmallDictT(); 13057 setNFreeUndefinedKCharSmallDictT(); 13058 setNFreeSKCharSmallDictT(); 13059 setNFreeDictKCharSmallDictT(); 13060 setNFreeArrayKCharSmallDictT(); 13061 setNFreeArraycKCharSmallDictT(); 13062 setNFreeSmallBoolKCharSmallDictT(); 13063 setNFreeSmallBytesKCharSmallDictT(); 13064 setNFreeSmallDoubleKCharSmallDictT(); 13065 setNFreeSmallIntKCharSmallDictT(); 13066 setNFreeSmallJsonKCharSmallDictT(); 13067 setNFreeSmallStringKCharSmallDictT(); 13068 setNFreeSmallContainerKCharSmallDictT(); 13069 setPDictSmallDictT(); 13070 setPArraySmallDictT(); 13071 setPSmallJsonSmallDictT(); 13072 setPSmallStringSmallDictT(); 13073 setNFreePDictSmallDictT(); 13074 setNFreePArraySmallDictT(); 13075 setNFreePSmallJsonSmallDictT(); 13076 setNFreePSmallStringSmallDictT(); 13077 setPArrayKCharSmallDictT(); 13078 setPDictKCharSmallDictT(); 13079 setPSmallJsonKCharSmallDictT(); 13080 setPSmallStringKCharSmallDictT(); 13081 setNFreePArrayKCharSmallDictT(); 13082 setNFreePDictKCharSmallDictT(); 13083 setNFreePSmallJsonKCharSmallDictT(); 13084 setNFreePSmallStringKCharSmallDictT(); 13085 getUndefinedSmallDictT(); 13086 getBoolSmallDictT(); 13087 getBoolPSmallDictT(); 13088 getDoubleSmallDictT(); 13089 getDoublePSmallDictT(); 13090 getIntSmallDictT(); 13091 getIntPSmallDictT(); 13092 getInt32SmallDictT(); 13093 getInt32PSmallDictT(); 13094 getUintSmallDictT(); 13095 getUintPSmallDictT(); 13096 getUint32SmallDictT(); 13097 getUint32PSmallDictT(); 13098 getSSmallDictT(); 13099 getDictSmallDictT(); 13100 getArraySmallDictT(); 13101 getSmallBoolSmallDictT(); 13102 getSmallBytesSmallDictT(); 13103 getSmallDoubleSmallDictT(); 13104 getSmallIntSmallDictT(); 13105 getSmallJsonSmallDictT(); 13106 getSmallStringSmallDictT(); 13107 getVoidSmallDictT(); 13108 getSmallContainerSmallDictT(); 13109 getKCharSmallDictT(); 13110 getUndefinedKCharSmallDictT(); 13111 getBoolKCharSmallDictT(); 13112 getBoolPKCharSmallDictT(); 13113 getDoubleKCharSmallDictT(); 13114 getDoublePKCharSmallDictT(); 13115 getIntKCharSmallDictT(); 13116 getIntPKCharSmallDictT(); 13117 getInt32KCharSmallDictT(); 13118 getInt32PKCharSmallDictT(); 13119 getUintKCharSmallDictT(); 13120 getUintPKCharSmallDictT(); 13121 getUint32KCharSmallDictT(); 13122 getUint32PKCharSmallDictT(); 13123 getSKCharSmallDictT(); 13124 getDictKCharSmallDictT(); 13125 getArrayKCharSmallDictT(); 13126 getSmallBoolKCharSmallDictT(); 13127 getSmallBytesKCharSmallDictT(); 13128 getSmallDoubleKCharSmallDictT(); 13129 getSmallIntKCharSmallDictT(); 13130 getSmallJsonKCharSmallDictT(); 13131 getSmallStringKCharSmallDictT(); 13132 getVoidKCharSmallDictT(); 13133 getSmallContainerKCharSmallDictT(); 13134 getNDupSmallDictT(); 13135 getNDupUndefinedSmallDictT(); 13136 getNDupBoolSmallDictT(); 13137 getNDupDoubleSmallDictT(); 13138 getNDupIntSmallDictT(); 13139 getNDupInt32SmallDictT(); 13140 getNDupUintSmallDictT(); 13141 getNDupUint32SmallDictT(); 13142 getNDupSSmallDictT(); 13143 getNDupDictSmallDictT(); 13144 getNDupArraySmallDictT(); 13145 getNDupSmallBoolSmallDictT(); 13146 getNDupSmallBytesSmallDictT(); 13147 getNDupSmallDoubleSmallDictT(); 13148 getNDupSmallIntSmallDictT(); 13149 getNDupSmallJsonSmallDictT(); 13150 getNDupSmallStringSmallDictT(); 13151 getNDupVoidSmallDictT(); 13152 getNDupSmallContainerSmallDictT(); 13153 getNDupKCharSmallDictT(); 13154 getNDupUndefinedKCharSmallDictT(); 13155 getNDupBoolKCharSmallDictT(); 13156 getNDupDoubleKCharSmallDictT(); 13157 getNDupIntKCharSmallDictT(); 13158 getNDupInt32KCharSmallDictT(); 13159 getNDupUintKCharSmallDictT(); 13160 getNDupUint32KCharSmallDictT(); 13161 getNDupSKCharSmallDictT(); 13162 getNDupDictKCharSmallDictT(); 13163 getNDupArrayKCharSmallDictT(); 13164 getNDupSmallBoolKCharSmallDictT(); 13165 getNDupSmallBytesKCharSmallDictT(); 13166 getNDupSmallDoubleKCharSmallDictT(); 13167 getNDupSmallIntKCharSmallDictT(); 13168 getNDupSmallJsonKCharSmallDictT(); 13169 getNDupSmallStringKCharSmallDictT(); 13170 getNDupVoidKCharSmallDictT(); 13171 getNDupSmallContainerKCharSmallDictT(); 13172 getNumSmallDictT(); 13173 cropElemSmallDictT(); 13174 cropElemUndefinedSmallDictT(); 13175 cropElemBoolSmallDictT(); 13176 cropElemDoubleSmallDictT(); 13177 cropElemIntSmallDictT(); 13178 cropElemInt32SmallDictT(); 13179 cropElemUintSmallDictT(); 13180 cropElemUint32SmallDictT(); 13181 cropElemSSmallDictT(); 13182 cropElemDictSmallDictT(); 13183 cropElemArraySmallDictT(); 13184 cropElemSmallBoolSmallDictT(); 13185 cropElemSmallBytesSmallDictT(); 13186 cropElemSmallDoubleSmallDictT(); 13187 cropElemSmallIntSmallDictT(); 13188 cropElemSmallJsonSmallDictT(); 13189 cropElemSmallStringSmallDictT(); 13190 cropElemVoidSmallDictT(); 13191 cropElemSmallContainerSmallDictT(); 13192 delKCharSmallDictT(); 13193 removeSmallDictT(); 13194 removeKCharSmallDictT(); 13195 hasKCharSmallDictT(); 13196 keyBySmallDictT(); 13197 keyByUndefinedSmallDictT(); 13198 keyByBoolSmallDictT(); 13199 keyByDoubleSmallDictT(); 13200 keyByIntSmallDictT(); 13201 keyBySSmallDictT(); 13202 keyByCharSmallDictT(); 13203 keyByDictSmallDictT(); 13204 keyByArraySmallDictT(); 13205 keyByArraycSmallDictT(); 13206 keyBySmallBoolSmallDictT(); 13207 keyBySmallBytesSmallDictT(); 13208 keyBySmallDoubleSmallDictT(); 13209 keyBySmallIntSmallDictT(); 13210 keyBySmallJsonSmallDictT(); 13211 keyBySmallStringSmallDictT(); 13212 keyBySmallContainerSmallDictT(); 13213 icKeyBySmallDictT(); 13214 icKeyBySSmallDictT(); 13215 icKeyByCharSmallDictT(); 13216 icKeyByDictSmallDictT(); 13217 icKeyByArraySmallDictT(); 13218 icKeyByArraycSmallDictT(); 13219 icKeyBySmallJsonSmallDictT(); 13220 icKeyBySmallStringSmallDictT(); 13221 trimSmallDictT(); 13222 keysSmallStringSmallDictT(); 13223 mergeSmallJsonSmallDictT(); 13224 mergeNSmashSmallDictT(); 13225 mergeNSmashSmallJsonSmallDictT(); 13226 appendNSmashSmallDictT(); 13227 equalSmallDictBaseT(); 13228 equalSmallDictSmallJsonT(); 13229 equalSmallDictT(); 13230 icEqualSmallDictBaseT(); 13231 icEqualSmallDictSmallJsonT(); 13232 icEqualSmallDictT(); 13233 isEmptySmallDictT(); 13234 enumerateSmallDictFT(); 13235 iterStartSmallDictT(); 13236 iterStartKeySmallDictT(); 13237 iterNextSmallDictT(); 13238 iterNextKeySmallDictT(); 13239 iterElementSmallDictT(); 13240 iterKeySmallDictT(); 13241 zipSmallDictT(); 13242 zipSmallJsonSmallDictT(); 13243 zipSmallJsonSmallArraySmallDictT(); 13244 zipSmallJsonSmallJsonSmallDictT(); 13245 zipSmallJsonVArraySmallDictT(); 13246 zipArraySmallDictT(); 13247 zipArraySmallJsonSmallDictT(); 13248 zipArrayArraySmallDictT(); 13249 zipVArraySmallDictT(); 13250 fromArraySmallDictT(); 13251 toArraySmallDictT(); 13252 writeFileSmallDictT(); 13253 writeFileSmallJsonSmallDictT(); 13254 writeFileSmallStringSmallDictT(); 13255 writeStreamSmallDictT(); 13256 appendFileSmallDictT(); 13257 appendFileSmallStringSmallDictT(); 13258 logSmallDictT(); 13259 typeSmallStringSmallDictT(); 13260 typeStringKCharSmallDictT(); 13261 typeSmallStringKCharSmallDictT(); 13262 typeKCharSmallDictT(); 13263 isETypeSmallDictT(); 13264 isEUndefinedSmallDictT(); 13265 isEBoolSmallDictT(); 13266 isEContainerSmallDictT(); 13267 isEDictSmallDictT(); 13268 isEDoubleSmallDictT(); 13269 isEIntSmallDictT(); 13270 isEStringSmallDictT(); 13271 isEFaststringSmallDictT(); 13272 isEArraySmallDictT(); 13273 isEBytesSmallDictT(); 13274 areAllETypeSmallDictT(); 13275 areAllEUndefinedSmallDictT(); 13276 areAllEBoolSmallDictT(); 13277 areAllEContainerSmallDictT(); 13278 areAllEDictSmallDictT(); 13279 areAllEDoubleSmallDictT(); 13280 areAllEIntSmallDictT(); 13281 areAllEStringSmallDictT(); 13282 areAllEFaststringSmallDictT(); 13283 areAllEArraySmallDictT(); 13284 areAllEBytesSmallDictT(); 13285 duplicateSmallDictGT(); 13286 freeSmallDictGT(); 13287 setSmallDictGT(); 13288 getSmallDictGT(); 13289 getUndefinedSmallDictGT(); 13290 getBoolSmallDictGT(); 13291 getBoolPSmallDictGT(); 13292 getDoubleSmallDictGT(); 13293 getDoublePSmallDictGT(); 13294 getIntSmallDictGT(); 13295 getIntPSmallDictGT(); 13296 getInt32SmallDictGT(); 13297 getInt32PSmallDictGT(); 13298 getUintSmallDictGT(); 13299 getUintPSmallDictGT(); 13300 getUint32SmallDictGT(); 13301 getUint32PSmallDictGT(); 13302 getSSmallDictGT(); 13303 getDictSmallDictGT(); 13304 getArraySmallDictGT(); 13305 getSmallBoolSmallDictGT(); 13306 getSmallBytesSmallDictGT(); 13307 getSmallDoubleSmallDictGT(); 13308 getSmallIntSmallDictGT(); 13309 getSmallJsonSmallDictGT(); 13310 getSmallStringSmallDictGT(); 13311 getVoidSmallDictGT(); 13312 getSmallContainerSmallDictGT(); 13313 getKCharSmallDictGT(); 13314 getUndefinedKCharSmallDictGT(); 13315 getBoolKCharSmallDictGT(); 13316 getBoolPKCharSmallDictGT(); 13317 getDoubleKCharSmallDictGT(); 13318 getDoublePKCharSmallDictGT(); 13319 getIntKCharSmallDictGT(); 13320 getIntPKCharSmallDictGT(); 13321 getInt32KCharSmallDictGT(); 13322 getInt32PKCharSmallDictGT(); 13323 getUintKCharSmallDictGT(); 13324 getUintPKCharSmallDictGT(); 13325 getUint32KCharSmallDictGT(); 13326 getUint32PKCharSmallDictGT(); 13327 getSKCharSmallDictGT(); 13328 getDictKCharSmallDictGT(); 13329 getArrayKCharSmallDictGT(); 13330 getSmallBoolKCharSmallDictGT(); 13331 getSmallBytesKCharSmallDictGT(); 13332 getSmallDoubleKCharSmallDictGT(); 13333 getSmallIntKCharSmallDictGT(); 13334 getSmallJsonKCharSmallDictGT(); 13335 getSmallStringKCharSmallDictGT(); 13336 getVoidKCharSmallDictGT(); 13337 getSmallContainerKCharSmallDictGT(); 13338 getNDupSmallDictGT(); 13339 getNDupUndefinedSmallDictGT(); 13340 getNDupBoolSmallDictGT(); 13341 getNDupDoubleSmallDictGT(); 13342 getNDupIntSmallDictGT(); 13343 getNDupInt32SmallDictGT(); 13344 getNDupUintSmallDictGT(); 13345 getNDupUint32SmallDictGT(); 13346 getNDupSSmallDictGT(); 13347 getNDupDictSmallDictGT(); 13348 getNDupArraySmallDictGT(); 13349 getNDupSmallBoolSmallDictGT(); 13350 getNDupSmallBytesSmallDictGT(); 13351 getNDupSmallDoubleSmallDictGT(); 13352 getNDupSmallIntSmallDictGT(); 13353 getNDupSmallJsonSmallDictGT(); 13354 getNDupSmallStringSmallDictGT(); 13355 getNDupVoidSmallDictGT(); 13356 getNDupSmallContainerSmallDictGT(); 13357 getNDupKCharSmallDictGT(); 13358 getNDupUndefinedKCharSmallDictGT(); 13359 getNDupBoolKCharSmallDictGT(); 13360 getNDupDoubleKCharSmallDictGT(); 13361 getNDupIntKCharSmallDictGT(); 13362 getNDupInt32KCharSmallDictGT(); 13363 getNDupUintKCharSmallDictGT(); 13364 getNDupUint32KCharSmallDictGT(); 13365 getNDupSKCharSmallDictGT(); 13366 getNDupDictKCharSmallDictGT(); 13367 getNDupArrayKCharSmallDictGT(); 13368 getNDupSmallBoolKCharSmallDictGT(); 13369 getNDupSmallBytesKCharSmallDictGT(); 13370 getNDupSmallDoubleKCharSmallDictGT(); 13371 getNDupSmallIntKCharSmallDictGT(); 13372 getNDupSmallJsonKCharSmallDictGT(); 13373 getNDupSmallStringKCharSmallDictGT(); 13374 getNDupVoidKCharSmallDictGT(); 13375 getNDupSmallContainerKCharSmallDictGT(); 13376 setUndefinedSmallDictGT(); 13377 setBoolSmallDictGT(); 13378 setDoubleSmallDictGT(); 13379 setIntSmallDictGT(); 13380 setSSmallDictGT(); 13381 setCharSmallDictGT(); 13382 setDictSmallDictGT(); 13383 setArraySmallDictGT(); 13384 setArraycSmallDictGT(); 13385 setCArraycSmallDictGT(); 13386 setVoidSmallDictGT(); 13387 setSmallBoolSmallDictGT(); 13388 setSmallBytesSmallDictGT(); 13389 setSmallDoubleSmallDictGT(); 13390 setSmallIntSmallDictGT(); 13391 setSmallJsonSmallDictGT(); 13392 setSmallStringSmallDictGT(); 13393 setSmallContainerSmallDictGT(); 13394 setKCharSmallDictGT(); 13395 setUndefinedKCharSmallDictGT(); 13396 setBoolKCharSmallDictGT(); 13397 setDoubleKCharSmallDictGT(); 13398 setIntKCharSmallDictGT(); 13399 setSKCharSmallDictGT(); 13400 setCharKCharSmallDictGT(); 13401 setDictKCharSmallDictGT(); 13402 setArrayKCharSmallDictGT(); 13403 setArraycKCharSmallDictGT(); 13404 setCArraycKCharSmallDictGT(); 13405 setVoidKCharSmallDictGT(); 13406 setSmallBoolKCharSmallDictGT(); 13407 setSmallBytesKCharSmallDictGT(); 13408 setSmallDoubleKCharSmallDictGT(); 13409 setSmallIntKCharSmallDictGT(); 13410 setSmallJsonKCharSmallDictGT(); 13411 setSmallStringKCharSmallDictGT(); 13412 setSmallContainerKCharSmallDictGT(); 13413 setNFreeSmallDictGT(); 13414 setNFreeUndefinedSmallDictGT(); 13415 setNFreeSSmallDictGT(); 13416 setNFreeDictSmallDictGT(); 13417 setNFreeArraySmallDictGT(); 13418 setNFreeArraycSmallDictGT(); 13419 setNFreeSmallBoolSmallDictGT(); 13420 setNFreeSmallBytesSmallDictGT(); 13421 setNFreeSmallDoubleSmallDictGT(); 13422 setNFreeSmallIntSmallDictGT(); 13423 setNFreeSmallJsonSmallDictGT(); 13424 setNFreeSmallStringSmallDictGT(); 13425 setNFreeSmallContainerSmallDictGT(); 13426 setNFreeKCharSmallDictGT(); 13427 setNFreeUndefinedKCharSmallDictGT(); 13428 setNFreeSKCharSmallDictGT(); 13429 setNFreeDictKCharSmallDictGT(); 13430 setNFreeArrayKCharSmallDictGT(); 13431 setNFreeArraycKCharSmallDictGT(); 13432 setNFreeSmallBoolKCharSmallDictGT(); 13433 setNFreeSmallBytesKCharSmallDictGT(); 13434 setNFreeSmallDoubleKCharSmallDictGT(); 13435 setNFreeSmallIntKCharSmallDictGT(); 13436 setNFreeSmallJsonKCharSmallDictGT(); 13437 setNFreeSmallStringKCharSmallDictGT(); 13438 setNFreeSmallContainerKCharSmallDictGT(); 13439 setPDictSmallDictGT(); 13440 setPArraySmallDictGT(); 13441 setPSmallJsonSmallDictGT(); 13442 setPSmallStringSmallDictGT(); 13443 setNFreePDictSmallDictGT(); 13444 setNFreePArraySmallDictGT(); 13445 setNFreePSmallJsonSmallDictGT(); 13446 setNFreePSmallStringSmallDictGT(); 13447 setPArrayKCharSmallDictGT(); 13448 setPDictKCharSmallDictGT(); 13449 setPSmallJsonKCharSmallDictGT(); 13450 setPSmallStringKCharSmallDictGT(); 13451 setNFreePArrayKCharSmallDictGT(); 13452 setNFreePDictKCharSmallDictGT(); 13453 setNFreePSmallJsonKCharSmallDictGT(); 13454 setNFreePSmallStringKCharSmallDictGT(); 13455 mergeSmallDictGT(); 13456 mergeSmallJsonSmallDictGT(); 13457 mergeNSmashSmallDictGT(); 13458 mergeNSmashSmallJsonSmallDictGT(); 13459 equalSmallDictBaseGT(); 13460 equalSmallDictSmallJsonGT(); 13461 equalSmallDictGT(); 13462 icEqualSmallDictBaseGT(); 13463 icEqualSmallDictSmallJsonGT(); 13464 icEqualSmallDictGT(); 13465 getNumSmallDictGT(); 13466 cropElemSmallDictGT(); 13467 cropElemUndefinedSmallDictGT(); 13468 cropElemBoolSmallDictGT(); 13469 cropElemDoubleSmallDictGT(); 13470 cropElemIntSmallDictGT(); 13471 cropElemInt32SmallDictGT(); 13472 cropElemUintSmallDictGT(); 13473 cropElemUint32SmallDictGT(); 13474 cropElemSSmallDictGT(); 13475 cropElemDictSmallDictGT(); 13476 cropElemArraySmallDictGT(); 13477 cropElemSmallBoolSmallDictGT(); 13478 cropElemSmallBytesSmallDictGT(); 13479 cropElemSmallDoubleSmallDictGT(); 13480 cropElemSmallIntSmallDictGT(); 13481 cropElemSmallJsonSmallDictGT(); 13482 cropElemSmallStringSmallDictGT(); 13483 cropElemVoidSmallDictGT(); 13484 cropElemSmallContainerSmallDictGT(); 13485 delSmallDictGT(); 13486 delKCharSmallDictGT(); 13487 delElemSmallDictGT(); 13488 delElemKCharSmallDictGT(); 13489 removeSmallDictGT(); 13490 removeKCharSmallDictGT(); 13491 removeElemSmallDictGT(); 13492 removeElemKCharSmallDictGT(); 13493 hasSmallDictGT(); 13494 hasKCharSmallDictGT(); 13495 keyBySmallDictGT(); 13496 keyByUndefinedSmallDictGT(); 13497 keyByBoolSmallDictGT(); 13498 keyByDoubleSmallDictGT(); 13499 keyByIntSmallDictGT(); 13500 keyBySSmallDictGT(); 13501 keyByCharSmallDictGT(); 13502 keyByDictSmallDictGT(); 13503 keyByArraySmallDictGT(); 13504 keyByArraycSmallDictGT(); 13505 keyByCArraycSmallDictGT(); 13506 keyBySmallBoolSmallDictGT(); 13507 keyBySmallBytesSmallDictGT(); 13508 keyBySmallDoubleSmallDictGT(); 13509 keyBySmallIntSmallDictGT(); 13510 keyBySmallJsonSmallDictGT(); 13511 keyBySmallStringSmallDictGT(); 13512 keyBySmallContainerSmallDictGT(); 13513 icKeyBySmallDictGT(); 13514 icKeyBySSmallDictGT(); 13515 icKeyByCharSmallDictGT(); 13516 icKeyByDictSmallDictGT(); 13517 icKeyByArraySmallDictGT(); 13518 icKeyByArraycSmallDictGT(); 13519 icKeyByCArraycSmallDictGT(); 13520 icKeyBySmallJsonSmallDictGT(); 13521 icKeyBySmallStringSmallDictGT(); 13522 trimSmallDictGT(); 13523 keysSmallStringSmallDictGT(); 13524 lenSmallDictGT(); 13525 emptySmallDictGT(); 13526 isEmptySmallDictGT(); 13527 zipSmallDictGT(); 13528 zipSmallJsonSmallDictGT(); 13529 zipSmallJsonSmallArraySmallDictGT(); 13530 zipSmallJsonSmallJsonSmallDictGT(); 13531 zipSmallJsonVArraySmallDictGT(); 13532 zipSmallJsonVCArraySmallDictGT(); 13533 zipArraySmallDictGT(); 13534 zipArraySmallJsonSmallDictGT(); 13535 zipCArraySmallDictGT(); 13536 zipCArraySmallJsonSmallDictGT(); 13537 zipArrayArraySmallDictGT(); 13538 zipCArrayArraySmallDictGT(); 13539 zipArrayCArraySmallDictGT(); 13540 zipCArrayCArraySmallDictGT(); 13541 zipVArraySmallDictGT(); 13542 zipVCArraySmallDictGT(); 13543 fromArraySmallDictGT(); 13544 toArraySmallDictGT(); 13545 writeFileSmallDictGT(); 13546 writeFileSmallJsonSmallDictGT(); 13547 writeFileSmallStringSmallDictGT(); 13548 writeStreamSmallDictGT(); 13549 appendFileSmallDictGT(); 13550 appendFileSmallStringSmallDictGT(); 13551 logSmallDictGT(); 13552 typeSmallStringSmallDictGT(); 13553 typeStringKCharSmallDictGT(); 13554 typeSmallStringKCharSmallDictGT(); 13555 cSmallDictT(); 13556 13557 finalizeSmallDict(); 13558 finalizeSmallArray(); 13559 finalizeSmallJson(); 13560 finalizeUndefined(); 13561 finalizeSmallBytes(); 13562 finalizeSmallBool(); 13563 finalizeSmallContainer(); 13564 finalizeSmallDouble(); 13565 finalizeSmallInt(); 13566 finalizeSmallString(); 13567 }