libsheepyCSmallDictCuTest.c (335246B)
1 #include <stdlib.h> 2 #include <stdio.h> 3 #include <string.h> 4 5 #include "CuTest/CuTest.h" 6 7 #define ck_assert_str_eq(a,b) CuAssertStrEquals(tc, b, a) 8 #define ck_assert_str_ne(a,b) CuAssertStrNotEquals(tc, b, a) 9 #define ck_assert_ptr_eq(a,b) CuAssertPtrEquals(tc, b, a) 10 #define ck_assert_ptr_ne(a,b) CuAssertPtrNotEquals(tc, b, a) 11 #define ck_assert_uint_eq(a,b) CuAssertUintEquals(tc, b, a) 12 #define ck_assert_uint_ne(a,b) CuAssertUintNotEquals(tc, b, a) 13 #define ck_assert_int_eq(a,b) CuAssertIntEquals(tc, b, a) 14 #define ck_assert_int_ne(a,b) CuAssertIntNotEquals(tc, b, a) 15 #define ck_assert(a) CuAssertTrue(tc, a) 16 17 18 #include "../libsheepy.h" 19 #include "../libsheepyObject.h" 20 21 #ifdef __GNUC__ 22 #define UNUSED __attribute__ ((unused)) 23 #else 24 #define UNUSED 25 #endif 26 27 // TODO redirect stderr 28 29 30 void getsoSmallDictT(CuTest *tc UNUSED) { 31 32 sDictt* r; 33 smallDictt *self = allocG(rtSmallDictt); 34 35 self->f->setS(self, "qwe", "asd"); 36 r = getsoO(self); 37 ck_assert_ptr_eq(r, self->d); 38 terminateO(self); 39 40 } 41 42 43 void setsoSmallDictT(CuTest *tc UNUSED) { 44 45 smallDictt *self = allocG(rtSmallDictt); 46 sDictt *so; 47 48 createSmallDict(d); 49 (&d)->f->setS(&d, "1", "1"); 50 (&d)->f->setS(&d, "2", "2"); 51 char *as = null; 52 // reset test: free iterElement in d 53 iter(&d, E) { 54 as = toStringO(E); 55 break; 56 } 57 ck_assert_ptr_ne(as, null); 58 ck_assert_str_eq(as, "1"); 59 free(as); 60 so = getsoO(&d); 61 resetO(&d); 62 setsoO(self, so); 63 ck_assert_ptr_eq(so, self->d); 64 terminateO(self); 65 66 } 67 68 69 void mirrorSmallDictT(CuTest *tc UNUSED) { 70 71 smallDictt* r; 72 smallDictt *self = allocG(rtSmallDictt); 73 74 // empty self 75 r = mirrorO(self); 76 ck_assert_ptr_eq(r->d, null); 77 finishO(r); 78 // non empty with iterator 79 self->f->setS(self, "1", "1"); 80 self->f->setS(self, "2", "2"); 81 char *as = null; 82 iter(self, E) { 83 as = toStringO(E); 84 break; 85 } 86 ck_assert_str_eq(as, "1"); 87 free(as); 88 r = mirrorO(self); 89 ck_assert_ptr_eq(r->d, self->d); 90 finishO(r); 91 terminateO(self); 92 93 } 94 95 96 void setUndefinedSmallDictT(CuTest *tc UNUSED) { 97 98 smallDictt* r; 99 smallDictt *self = allocG(rtSmallDictt); 100 101 r = self->f->setUndefined(self, "1"); 102 ck_assert_ptr_ne(r, null); 103 char *s = toStringO(r); 104 ck_assert_str_eq(s, "{\"1\":null}"); 105 free(s); 106 // null key 107 r = self->f->setUndefined(self, null); 108 ck_assert_ptr_eq(r, null); 109 terminateO(self); 110 111 } 112 113 114 void setBoolSmallDictT(CuTest *tc UNUSED) { 115 116 smallDictt* r; 117 smallDictt *self = allocG(rtSmallDictt); 118 119 r = self->f->setBool(self, "1", true); 120 ck_assert_ptr_ne(r, null); 121 char *s = toStringO(r); 122 ck_assert_str_eq(s, "{\"1\":true}"); 123 free(s); 124 // null key 125 r = self->f->setBool(self, null, false); 126 ck_assert_ptr_eq(r, null); 127 terminateO(self); 128 129 } 130 131 132 void setDoubleSmallDictT(CuTest *tc UNUSED) { 133 134 smallDictt* r; 135 smallDictt *self = allocG(rtSmallDictt); 136 137 r = self->f->setDouble(self, "1", 2.2); 138 ck_assert_ptr_ne(r, null); 139 char *s = toStringO(r); 140 ck_assert_str_eq(s, "{\"1\":2.200000e+00}"); 141 free(s); 142 // null key 143 r = self->f->setDouble(self, null, 1); 144 ck_assert_ptr_eq(r, null); 145 terminateO(self); 146 147 } 148 149 150 void setIntSmallDictT(CuTest *tc UNUSED) { 151 152 smallDictt* r; 153 smallDictt *self = allocG(rtSmallDictt); 154 155 r = self->f->setInt(self, "1", 2); 156 ck_assert_ptr_ne(r, null); 157 char *s = toStringO(r); 158 ck_assert_str_eq(s, "{\"1\":2}"); 159 free(s); 160 // null key 161 r = self->f->setInt(self, null, 1); 162 ck_assert_ptr_eq(r, null); 163 terminateO(self); 164 165 } 166 167 168 void setSSmallDictT(CuTest *tc UNUSED) { 169 170 smallDictt* r; 171 smallDictt *self = allocG(rtSmallDictt); 172 173 r = self->f->setS(self, "1", "qwe"); 174 ck_assert_ptr_ne(r, null); 175 char *s = toStringO(r); 176 ck_assert_str_eq(s, "{\"1\":\"qwe\"}"); 177 free(s); 178 // null value 179 r = self->f->setS(self, "1", null); 180 ck_assert_ptr_eq(r, null); 181 // null key 182 r = self->f->setS(self, null, ""); 183 ck_assert_ptr_eq(r, null); 184 terminateO(self); 185 186 } 187 188 189 void setCharSmallDictT(CuTest *tc UNUSED) { 190 191 smallDictt* r; 192 smallDictt *self = allocG(rtSmallDictt); 193 194 r = self->f->setChar(self, "1", 'x'); 195 ck_assert_ptr_ne(r, null); 196 char *s = toStringO(r); 197 ck_assert_str_eq(s, "{\"1\":\"x\"}"); 198 free(s); 199 // null key 200 r = self->f->setChar(self, null, '1'); 201 ck_assert_ptr_eq(r, null); 202 terminateO(self); 203 204 } 205 206 207 void setDictSmallDictT(CuTest *tc UNUSED) { 208 209 smallDictt* r; 210 smallDictt *self = allocG(rtSmallDictt); 211 smallDictt *dict = allocSmallDict(); 212 213 // empty dict 214 r = self->f->setDict(self, "1", dict); 215 ck_assert_ptr_ne(r, null); 216 finishO(dict); 217 char *s = toStringO(r); 218 ck_assert_str_eq(s, "{\"1\":{}}"); 219 free(s); 220 // set dict 221 dict = allocSmallDict(); 222 dict->f->setS(dict, "a", "zxc"); 223 r = self->f->setDict(self, "1", dict); 224 ck_assert_ptr_ne(r, null); 225 finishO(dict); 226 s = toStringO(r); 227 ck_assert_str_eq(s, "{\"1\":{\"a\":\"zxc\"}}"); 228 free(s); 229 // non smallDict object 230 dict = (smallDictt*) allocSmallInt(2); 231 r = self->f->setDict(self, "1", dict); 232 ck_assert_ptr_eq(r, null); 233 terminateO(dict); 234 // null value 235 r = self->f->setDict(self, "1", null); 236 ck_assert_ptr_eq(r, null); 237 // null key 238 r = self->f->setDict(self, null, dict); 239 ck_assert_ptr_eq(r, null); 240 terminateO(self); 241 242 } 243 244 245 void setArraySmallDictT(CuTest *tc UNUSED) { 246 247 smallDictt* r; 248 smallDictt *self = allocG(rtSmallDictt); 249 smallArrayt *array = allocSmallArray(); 250 251 // empty array 252 r = self->f->setArray(self, "1", array); 253 ck_assert_ptr_ne(r, null); 254 finishO(array); 255 char *s = toStringO(r); 256 ck_assert_str_eq(s, "{\"1\":[]}"); 257 free(s); 258 // set array 259 array = allocSmallArray(); 260 array->f->pushS(array, "zxc"); 261 r = self->f->setArray(self, "1", array); 262 ck_assert_ptr_ne(r, null); 263 finishO(array); 264 s = toStringO(r); 265 ck_assert_str_eq(s, "{\"1\":[\"zxc\"]}"); 266 free(s); 267 // non smallArray object 268 array = (smallArrayt*) allocSmallInt(2); 269 r = self->f->setArray(self, "1", array); 270 ck_assert_ptr_eq(r, null); 271 terminateO(array); 272 // null value 273 r = self->f->setArray(self, "1", null); 274 ck_assert_ptr_eq(r, null); 275 // null key 276 r = self->f->setArray(self, null, array); 277 ck_assert_ptr_eq(r, null); 278 terminateO(self); 279 280 } 281 282 283 void setArraycSmallDictT(CuTest *tc UNUSED) { 284 285 smallDictt* r; 286 smallDictt *self = allocG(rtSmallDictt); 287 char **array = listCreateS("a", "b"); 288 289 r = self->f->setArrayc(self, "1", array); 290 ck_assert_ptr_ne(r, null); 291 char *s = toStringO(r); 292 ck_assert_str_eq(s, "{\"1\":[\"a\",\"b\"]}"); 293 free(s); 294 // zero element list 295 char *e0 = array[0]; 296 array[0] = null; 297 r = self->f->setArrayc(self, "1", array); 298 ck_assert_ptr_ne(r, null); 299 array[0] = e0; 300 listFreeS(array); 301 s = toStringO(r); 302 ck_assert_str_eq(s, "{\"1\":[]}"); 303 free(s); 304 // null value 305 r = self->f->setArrayc(self, "1", null); 306 ck_assert_ptr_eq(r, null); 307 // null key 308 r = self->f->setArrayc(self, null, array); 309 ck_assert_ptr_eq(r, null); 310 terminateO(self); 311 312 } 313 314 315 void setSmallBoolSmallDictT(CuTest *tc UNUSED) { 316 317 smallDictt* r; 318 smallDictt *self = allocG(rtSmallDictt); 319 smallBoolt *value = allocSmallBool(true); 320 321 r = self->f->setSmallBool(self, "1", value); 322 ck_assert_ptr_ne(r, null); 323 char *s = toStringO(r); 324 ck_assert_str_eq(s, "{\"1\":true}"); 325 free(s); 326 // empty smallBool 327 value->value = null; 328 r = self->f->setSmallBool(self, "1", value); 329 ck_assert_ptr_ne(r, null); 330 finishO(value); 331 s = toStringO(r); 332 ck_assert_str_eq(s, "{\"1\":false}"); 333 free(s); 334 // non smallBool object 335 value = (smallBoolt*) allocSmallInt(2); 336 r = self->f->setSmallBool(self, "1", value); 337 ck_assert_ptr_eq(r, null); 338 terminateO(value); 339 // null value 340 r = self->f->setSmallBool(self, "1", null); 341 ck_assert_ptr_eq(r, null); 342 // null key 343 r = self->f->setSmallBool(self, null, value); 344 ck_assert_ptr_eq(r, null); 345 terminateO(self); 346 347 } 348 349 350 void setSmallBytesSmallDictT(CuTest *tc UNUSED) { 351 352 smallDictt* r; 353 smallDictt *self = allocG(rtSmallDictt); 354 smallBytest *value = allocSmallBytes("qwe", sizeof("qwe")); 355 356 r = self->f->setSmallBytes(self, "1", value); 357 ck_assert_ptr_ne(r, null); 358 char *s = toStringO(r); 359 ck_assert_str_eq(s, "{\"1\":[0x71,0x77,0x65,0x00]}"); 360 free(s); 361 // empty smallBytes 362 value->B = null; 363 r = self->f->setSmallBytes(self, "1", value); 364 ck_assert_ptr_ne(r, null); 365 finishO(value); 366 s = toStringO(r); 367 ck_assert_str_eq(s, "{\"1\":[]}"); 368 free(s); 369 // non smallByes object 370 value = (smallBytest*) allocSmallInt(2); 371 r = self->f->setSmallBytes(self, "1", value); 372 ck_assert_ptr_eq(r, null); 373 terminateO(value); 374 // null value 375 r = self->f->setSmallBytes(self, "1", null); 376 ck_assert_ptr_eq(r, null); 377 // null key 378 r = self->f->setSmallBytes(self, null, value); 379 ck_assert_ptr_eq(r, null); 380 terminateO(self); 381 382 } 383 384 385 void setSmallDoubleSmallDictT(CuTest *tc UNUSED) { 386 387 smallDictt* r; 388 smallDictt *self = allocG(rtSmallDictt); 389 smallDoublet *value = allocSmallDouble(2.2); 390 391 r = self->f->setSmallDouble(self, "1", value); 392 ck_assert_ptr_ne(r, null); 393 char *s = toStringO(r); 394 ck_assert_str_eq(s, "{\"1\":2.200000e+00}"); 395 free(s); 396 // empty smallDouble 397 value->value = null; 398 r = self->f->setSmallDouble(self, "1", value); 399 ck_assert_ptr_ne(r, null); 400 finishO(value); 401 s = toStringO(r); 402 ck_assert_str_eq(s, "{\"1\":0.000000e+00}"); 403 free(s); 404 // non smallDouble object 405 value = (smallDoublet*) allocSmallInt(2); 406 r = self->f->setSmallDouble(self, "1", value); 407 ck_assert_ptr_eq(r, null); 408 terminateO(value); 409 // null value 410 r = self->f->setSmallDouble(self, "1", null); 411 ck_assert_ptr_eq(r, null); 412 // null key 413 r = self->f->setSmallDouble(self, null, value); 414 ck_assert_ptr_eq(r, null); 415 terminateO(self); 416 417 } 418 419 420 void setSmallIntSmallDictT(CuTest *tc UNUSED) { 421 422 smallDictt* r; 423 smallDictt *self = allocG(rtSmallDictt); 424 smallIntt *value = allocSmallInt(2); 425 426 r = self->f->setSmallInt(self, "1", value); 427 ck_assert_ptr_ne(r, null); 428 char *s = toStringO(r); 429 ck_assert_str_eq(s, "{\"1\":2}"); 430 free(s); 431 // empty smallInt 432 value->value = null; 433 r = self->f->setSmallInt(self, "1", value); 434 ck_assert_ptr_ne(r, null); 435 finishO(value); 436 s = toStringO(r); 437 ck_assert_str_eq(s, "{\"1\":0}"); 438 free(s); 439 // non smallInt object 440 value = (smallIntt*) allocSmallBool(true); 441 r = self->f->setSmallInt(self, "1", value); 442 ck_assert_ptr_eq(r, null); 443 terminateO(value); 444 // null value 445 r = self->f->setSmallInt(self, "1", null); 446 ck_assert_ptr_eq(r, null); 447 // null key 448 r = self->f->setSmallInt(self, null, value); 449 ck_assert_ptr_eq(r, null); 450 terminateO(self); 451 452 } 453 454 455 void setSmallJsonSmallDictT(CuTest *tc UNUSED) { 456 457 smallDictt* r; 458 smallDictt *self = allocG(rtSmallDictt); 459 smallJsont *value = allocSmallJson(); 460 461 setTopIntO(value, 2); 462 r = self->f->setSmallJson(self, "1", value); 463 ck_assert_ptr_ne(r, null); 464 char *s = toStringO(r); 465 ck_assert_str_eq(s, "{\"1\":2}"); 466 free(s); 467 // empty smallJson 468 resetO(value); 469 r = self->f->setSmallJson(self, "1", value); 470 ck_assert_ptr_ne(r, null); 471 finishO(value); 472 s = toStringO(r); 473 ck_assert_str_eq(s, "{\"1\":{}}"); 474 free(s); 475 // non smallJson object 476 value = (smallJsont*) allocSmallInt(2); 477 r = self->f->setSmallJson(self, "1", value); 478 ck_assert_ptr_eq(r, null); 479 terminateO(value); 480 // null value 481 r = self->f->setSmallJson(self, "1", null); 482 ck_assert_ptr_eq(r, null); 483 // null key 484 r = self->f->setSmallJson(self, null, value); 485 ck_assert_ptr_eq(r, null); 486 terminateO(self); 487 488 } 489 490 491 void setSmallStringSmallDictT(CuTest *tc UNUSED) { 492 493 smallDictt* r; 494 smallDictt *self = allocG(rtSmallDictt); 495 smallStringt *string = allocSmallString("qwe"); 496 497 r = self->f->setSmallString(self, "1", string); 498 ck_assert_ptr_ne(r, null); 499 char *s = toStringO(r); 500 ck_assert_str_eq(s, "{\"1\":\"qwe\"}"); 501 free(s); 502 // empty smallString 503 string->data = null; 504 r = self->f->setSmallString(self, "1", string); 505 ck_assert_ptr_ne(r, null); 506 finishO(string); 507 s = toStringO(r); 508 ck_assert_str_eq(s, "{\"1\":\"\"}"); 509 free(s); 510 // non smallString object 511 string = (smallStringt*) allocSmallInt(2); 512 r = self->f->setSmallString(self, "1", string); 513 ck_assert_ptr_eq(r, null); 514 terminateO(string); 515 // null value 516 r = self->f->setSmallString(self, "1", null); 517 ck_assert_ptr_eq(r, null); 518 // null key 519 r = self->f->setSmallString(self, null, string); 520 ck_assert_ptr_eq(r, null); 521 terminateO(self); 522 523 } 524 525 526 void setSmallContainerSmallDictT(CuTest *tc UNUSED) { 527 528 smallDictt* r; 529 smallDictt *self = allocG(rtSmallDictt); 530 smallContainert *container = allocSmallContainer(null); 531 532 r = self->f->setSmallContainer(self, "1", container); 533 ck_assert_ptr_ne(r, null); 534 char *s = toStringO(r); 535 ck_assert_str_eq(s, "{\"1\":\"<data container>\"}"); 536 free(s); 537 // empty smallContainer 538 container->data = null; 539 r = self->f->setSmallContainer(self, "1", container); 540 ck_assert_ptr_ne(r, null); 541 finishO(container); 542 s = toStringO(r); 543 ck_assert_str_eq(s, "{\"1\":\"<data container>\"}"); 544 free(s); 545 // non smallContainer object 546 container = (smallContainert*) allocSmallInt(2); 547 r = self->f->setSmallContainer(self, "1", container); 548 ck_assert_ptr_eq(r, null); 549 terminateO(container); 550 // null value 551 r = self->f->setSmallContainer(self, "1", null); 552 ck_assert_ptr_eq(r, null); 553 // null key 554 r = self->f->setSmallContainer(self, null, container); 555 ck_assert_ptr_eq(r, null); 556 terminateO(self); 557 558 } 559 560 561 void setKCharSmallDictT(CuTest *tc UNUSED) { 562 563 smallDictt* r; 564 smallDictt *self = allocG(rtSmallDictt); 565 baset *value = (baset*) allocSmallInt(2); 566 567 r = setKCharO(self, '1', value); 568 char *s = toStringO(r); 569 ck_assert_str_eq(s, "{\"1\":2}"); 570 free(s); 571 finishO(value); 572 terminateO(self); 573 574 } 575 576 577 void setUndefinedKCharSmallDictT(CuTest *tc UNUSED) { 578 579 smallDictt* r; 580 smallDictt *self = allocG(rtSmallDictt); 581 582 r = setUndefinedKCharO(self, '1'); 583 char *s = toStringO(r); 584 ck_assert_str_eq(s, "{\"1\":null}"); 585 free(s); 586 terminateO(self); 587 588 } 589 590 591 void setBoolKCharSmallDictT(CuTest *tc UNUSED) { 592 593 smallDictt* r; 594 smallDictt *self = allocG(rtSmallDictt); 595 596 r = setBoolKCharO(self, '1', true); 597 char *s = toStringO(r); 598 ck_assert_str_eq(s, "{\"1\":true}"); 599 free(s); 600 terminateO(self); 601 602 } 603 604 605 void setDoubleKCharSmallDictT(CuTest *tc UNUSED) { 606 607 smallDictt* r; 608 smallDictt *self = allocG(rtSmallDictt); 609 610 r = setDoubleKCharO(self, '1', 2.2); 611 char *s = toStringO(r); 612 ck_assert_str_eq(s, "{\"1\":2.200000e+00}"); 613 free(s); 614 terminateO(self); 615 616 } 617 618 619 void setIntKCharSmallDictT(CuTest *tc UNUSED) { 620 621 smallDictt* r; 622 smallDictt *self = allocG(rtSmallDictt); 623 624 r = setIntKCharO(self, '1', 2); 625 char *s = toStringO(r); 626 ck_assert_str_eq(s, "{\"1\":2}"); 627 free(s); 628 terminateO(self); 629 630 } 631 632 633 void setSKCharSmallDictT(CuTest *tc UNUSED) { 634 635 smallDictt* r; 636 smallDictt *self = allocG(rtSmallDictt); 637 638 r = setSKCharO(self, '1', "qwe"); 639 char *s = toStringO(r); 640 ck_assert_str_eq(s, "{\"1\":\"qwe\"}"); 641 free(s); 642 terminateO(self); 643 644 } 645 646 647 void setCharKCharSmallDictT(CuTest *tc UNUSED) { 648 649 smallDictt* r; 650 smallDictt *self = allocG(rtSmallDictt); 651 652 r = setCharKCharO(self, '1', 'c'); 653 char *s = toStringO(r); 654 ck_assert_str_eq(s, "{\"1\":\"c\"}"); 655 free(s); 656 terminateO(self); 657 658 } 659 660 661 void setDictKCharSmallDictT(CuTest *tc UNUSED) { 662 663 smallDictt* r; 664 smallDictt *self = allocG(rtSmallDictt); 665 smallDictt *dict = allocSmallDict(); 666 667 r = setDictKCharO(self, '1', dict); 668 char *s = toStringO(r); 669 ck_assert_str_eq(s, "{\"1\":{}}"); 670 free(s); 671 finishO(dict); 672 terminateO(self); 673 674 } 675 676 677 void setArrayKCharSmallDictT(CuTest *tc UNUSED) { 678 679 smallDictt* r; 680 smallDictt *self = allocG(rtSmallDictt); 681 smallArrayt *array = allocSmallArray(); 682 683 r = setArrayKCharO(self, '1', array); 684 char *s = toStringO(r); 685 ck_assert_str_eq(s, "{\"1\":[]}"); 686 free(s); 687 finishO(array); 688 terminateO(self); 689 690 } 691 692 693 void setArraycKCharSmallDictT(CuTest *tc UNUSED) { 694 695 smallDictt* r; 696 smallDictt *self = allocG(rtSmallDictt); 697 char **array = listCreateS("a", "bb"); 698 699 r = setArraycKCharO(self, '1', array); 700 char *s = toStringO(r); 701 ck_assert_str_eq(s, "{\"1\":[\"a\",\"bb\"]}"); 702 free(s); 703 listFreeS(array); 704 terminateO(self); 705 706 } 707 708 709 void setSmallBoolKCharSmallDictT(CuTest *tc UNUSED) { 710 711 smallDictt* r; 712 smallDictt *self = allocG(rtSmallDictt); 713 smallBoolt *value = allocSmallBool(true); 714 715 r = setSmallBoolKCharO(self, '1', value); 716 char *s = toStringO(r); 717 ck_assert_str_eq(s, "{\"1\":true}"); 718 free(s); 719 finishO(value); 720 terminateO(self); 721 722 } 723 724 725 void setSmallBytesKCharSmallDictT(CuTest *tc UNUSED) { 726 727 smallDictt* r; 728 smallDictt *self = allocG(rtSmallDictt); 729 smallBytest *value = allocSmallBytes("qwe", sizeof("qwe")); 730 731 r = setSmallBytesKCharO(self, '1', value); 732 char *s = toStringO(r); 733 ck_assert_str_eq(s, "{\"1\":[0x71,0x77,0x65,0x00]}"); 734 free(s); 735 finishO(value); 736 terminateO(self); 737 738 } 739 740 741 void setSmallDoubleKCharSmallDictT(CuTest *tc UNUSED) { 742 743 smallDictt* r; 744 smallDictt *self = allocG(rtSmallDictt); 745 smallDoublet *value = allocSmallDouble(2.2); 746 747 r = setSmallDoubleKCharO(self, '1', value); 748 char *s = toStringO(r); 749 ck_assert_str_eq(s, "{\"1\":2.200000e+00}"); 750 free(s); 751 finishO(value); 752 terminateO(self); 753 754 } 755 756 757 void setSmallIntKCharSmallDictT(CuTest *tc UNUSED) { 758 759 smallDictt* r; 760 smallDictt *self = allocG(rtSmallDictt); 761 smallIntt *value = allocSmallInt(2); 762 763 r = setSmallIntKCharO(self, '1', value); 764 char *s = toStringO(r); 765 ck_assert_str_eq(s, "{\"1\":2}"); 766 free(s); 767 finishO(value); 768 terminateO(self); 769 770 } 771 772 773 void setSmallJsonKCharSmallDictT(CuTest *tc UNUSED) { 774 775 smallDictt* r; 776 smallDictt *self = allocG(rtSmallDictt); 777 smallJsont *value = allocSmallJson(); 778 779 r = setSmallJsonKCharO(self, '1', value); 780 char *s = toStringO(r); 781 ck_assert_str_eq(s, "{\"1\":{}}"); 782 free(s); 783 finishO(value); 784 terminateO(self); 785 786 } 787 788 789 void setSmallStringKCharSmallDictT(CuTest *tc UNUSED) { 790 791 smallDictt* r; 792 smallDictt *self = allocG(rtSmallDictt); 793 smallStringt *string = allocSmallString("qwe"); 794 795 r = setSmallStringKCharO(self, '1', string); 796 char *s = toStringO(r); 797 ck_assert_str_eq(s, "{\"1\":\"qwe\"}"); 798 free(s); 799 finishO(string); 800 terminateO(self); 801 802 } 803 804 805 void setSmallContainerKCharSmallDictT(CuTest *tc UNUSED) { 806 807 smallDictt* r; 808 smallDictt *self = allocG(rtSmallDictt); 809 smallContainert *container = allocSmallContainer(null); 810 811 r = setSmallContainerKCharO(self, '1', container); 812 char *s = toStringO(r); 813 ck_assert_str_eq(s, "{\"1\":\"<data container>\"}"); 814 free(s); 815 finishO(container); 816 terminateO(self); 817 818 } 819 820 821 void setNFreeSmallDictT(CuTest *tc UNUSED) { 822 823 smallDictt* r; 824 smallDictt *self = allocG(rtSmallDictt); 825 baset *value; 826 827 // undefined object 828 value = (baset*)allocUndefined(); 829 r = self->f->setNFree(self, "1", value); 830 ck_assert_ptr_ne(r, null); 831 char *s = toStringO(r); 832 ck_assert_str_eq(s, "{\"1\":null}"); 833 free(s); 834 // container 835 createAllocateSmallContainer(c); 836 r = self->f->setNFree(self, "1", (baset*)c); 837 ck_assert_ptr_ne(r, null); 838 s = toStringO(r); 839 ck_assert_str_eq(s, "{\"1\":\"<data container>\"}"); 840 free(s); 841 // base object in container 842 createAllocateSmallInt(I); 843 setValG(I, 11); 844 I->type = "anothertype"; 845 r = self->f->setNFree(self, "1", (baset*)I); 846 ck_assert_ptr_ne(r, null); 847 s = toStringO(r); 848 ck_assert_str_eq(s, "{\"1\":\"<data container>\"}"); 849 free(s); 850 // null value 851 r = self->f->setNFree(self, "1", null); 852 ck_assert_ptr_eq(r, null); 853 // null key 854 r = self->f->setNFree(self, null, value); 855 ck_assert_ptr_eq(r, null); 856 terminateO(self); 857 858 } 859 860 861 void setNFreeUndefinedSmallDictT(CuTest *tc UNUSED) { 862 863 smallDictt* r; 864 smallDictt *self = allocG(rtSmallDictt); 865 undefinedt *undefined = allocUndefined(); 866 867 r = self->f->setNFreeUndefined(self, "1", undefined); 868 ck_assert_ptr_ne(r, null); 869 char *s = toStringO(r); 870 ck_assert_str_eq(s, "{\"1\":null}"); 871 free(s); 872 // null value 873 r = self->f->setNFreeUndefined(self, "1", null); 874 ck_assert_ptr_eq(r, null); 875 // null key 876 undefined = allocUndefined(); 877 r = self->f->setNFreeUndefined(self, null, undefined); 878 ck_assert_ptr_eq(r, null); 879 terminateO(self); 880 terminateO(undefined); 881 882 } 883 884 885 void setNFreeSSmallDictT(CuTest *tc UNUSED) { 886 887 smallDictt* r; 888 smallDictt *self = allocG(rtSmallDictt); 889 char *string = strdup("qwe"); 890 891 r = self->f->setNFreeS(self, "1", string); 892 ck_assert_ptr_ne(r, null); 893 char *s = toStringO(r); 894 ck_assert_str_eq(s, "{\"1\":\"qwe\"}"); 895 free(s); 896 // null value 897 r = self->f->setNFreeS(self, "1", null); 898 ck_assert_ptr_eq(r, null); 899 // null key 900 string = strdup("qwe"); 901 r = self->f->setNFreeS(self, null, string); 902 ck_assert_ptr_eq(r, null); 903 terminateO(self); 904 free(string); 905 906 } 907 908 909 void setNFreeDictSmallDictT(CuTest *tc UNUSED) { 910 911 smallDictt* r; 912 smallDictt *self = allocG(rtSmallDictt); 913 smallDictt *dict = allocSmallDict(); 914 915 r = self->f->setNFreeDict(self, "1", dict); 916 ck_assert_ptr_ne(r, null); 917 char *s = toStringO(r); 918 ck_assert_str_eq(s, "{\"1\":{}}"); 919 free(s); 920 // null value 921 r = self->f->setNFreeDict(self, "1", null); 922 ck_assert_ptr_eq(r, null); 923 // null key 924 dict = allocSmallDict(); 925 r = self->f->setNFreeDict(self, null, dict); 926 ck_assert_ptr_eq(r, null); 927 terminateO(self); 928 terminateO(dict); 929 930 } 931 932 933 void setNFreeArraySmallDictT(CuTest *tc UNUSED) { 934 935 smallDictt* r; 936 smallDictt *self = allocG(rtSmallDictt); 937 smallArrayt *array = allocSmallArray(); 938 939 // empty array 940 r = self->f->setNFreeArray(self, "1", array); 941 ck_assert_ptr_ne(r, null); 942 char *s = toStringO(r); 943 ck_assert_str_eq(s, "{\"1\":[]}"); 944 free(s); 945 // null value 946 r = self->f->setNFreeArray(self, "1", null); 947 ck_assert_ptr_eq(r, null); 948 // null key 949 r = self->f->setNFreeArray(self, null, array); 950 ck_assert_ptr_eq(r, null); 951 terminateO(self); 952 953 } 954 955 956 void setNFreeArraycSmallDictT(CuTest *tc UNUSED) { 957 958 smallDictt* r; 959 smallDictt *self = allocG(rtSmallDictt); 960 char **array = listCreateS("a", "b"); 961 962 r = self->f->setNFreeArrayc(self, "1", array); 963 ck_assert_ptr_ne(r, null); 964 char *s = toStringO(r); 965 ck_assert_str_eq(s, "{\"1\":[\"a\",\"b\"]}"); 966 free(s); 967 // null value 968 r = self->f->setNFreeArrayc(self, "1", null); 969 ck_assert_ptr_eq(r, null); 970 // null key 971 r = self->f->setNFreeArrayc(self, null, array); 972 ck_assert_ptr_eq(r, null); 973 terminateO(self); 974 975 } 976 977 978 void setNFreeSmallBoolSmallDictT(CuTest *tc UNUSED) { 979 980 smallDictt* r; 981 smallDictt *self = allocG(rtSmallDictt); 982 smallBoolt *value = allocSmallBool(true); 983 984 r = self->f->setNFreeSmallBool(self, "1", value); 985 ck_assert_ptr_ne(r, null); 986 char *s = toStringO(r); 987 ck_assert_str_eq(s, "{\"1\":true}"); 988 free(s); 989 // null value 990 r = self->f->setNFreeSmallBool(self, "1", null); 991 ck_assert_ptr_eq(r, null); 992 // null key 993 r = self->f->setNFreeSmallBool(self, null, value); 994 ck_assert_ptr_eq(r, null); 995 terminateO(self); 996 997 } 998 999 1000 void setNFreeSmallBytesSmallDictT(CuTest *tc UNUSED) { 1001 1002 smallDictt* r; 1003 smallDictt *self = allocG(rtSmallDictt); 1004 smallBytest *value = allocSmallBytes("qwe", sizeof("qwe")); 1005 1006 r = self->f->setNFreeSmallBytes(self, "1", value); 1007 ck_assert_ptr_ne(r, null); 1008 char *s = toStringO(r); 1009 ck_assert_str_eq(s, "{\"1\":[0x71,0x77,0x65,0x00]}"); 1010 free(s); 1011 // null value 1012 r = self->f->setNFreeSmallBytes(self, "1", null); 1013 ck_assert_ptr_eq(r, null); 1014 // null key 1015 r = self->f->setNFreeSmallBytes(self, null, value); 1016 ck_assert_ptr_eq(r, null); 1017 terminateO(self); 1018 1019 } 1020 1021 1022 void setNFreeSmallDoubleSmallDictT(CuTest *tc UNUSED) { 1023 1024 smallDictt* r; 1025 smallDictt *self = allocG(rtSmallDictt); 1026 smallDoublet *value = allocSmallDouble(2.2); 1027 1028 r = self->f->setNFreeSmallDouble(self, "1", value); 1029 ck_assert_ptr_ne(r, null); 1030 char *s = toStringO(r); 1031 ck_assert_str_eq(s, "{\"1\":2.200000e+00}"); 1032 free(s); 1033 // null value 1034 r = self->f->setNFreeSmallDouble(self, "1", null); 1035 ck_assert_ptr_eq(r, null); 1036 // null key 1037 r = self->f->setNFreeSmallDouble(self, null, value); 1038 ck_assert_ptr_eq(r, null); 1039 terminateO(self); 1040 1041 } 1042 1043 1044 void setNFreeSmallIntSmallDictT(CuTest *tc UNUSED) { 1045 1046 smallDictt* r; 1047 smallDictt *self = allocG(rtSmallDictt); 1048 smallIntt *value = allocSmallInt(2); 1049 1050 r = self->f->setNFreeSmallInt(self, "1", value); 1051 ck_assert_ptr_ne(r, null); 1052 char *s = toStringO(r); 1053 ck_assert_str_eq(s, "{\"1\":2}"); 1054 free(s); 1055 // null value 1056 r = self->f->setNFreeSmallInt(self, "1", null); 1057 ck_assert_ptr_eq(r, null); 1058 // null key 1059 r = self->f->setNFreeSmallInt(self, null, value); 1060 ck_assert_ptr_eq(r, null); 1061 terminateO(self); 1062 1063 } 1064 1065 1066 void setNFreeSmallJsonSmallDictT(CuTest *tc UNUSED) { 1067 1068 smallDictt* r; 1069 smallDictt *self = allocG(rtSmallDictt); 1070 smallJsont *value = allocSmallJson(); 1071 1072 setTopIntO(value, 2); 1073 r = self->f->setNFreeSmallJson(self, "1", value); 1074 ck_assert_ptr_ne(r, null); 1075 char *s = toStringO(r); 1076 ck_assert_str_eq(s, "{\"1\":2}"); 1077 free(s); 1078 // null value 1079 r = self->f->setNFreeSmallJson(self, "1", null); 1080 ck_assert_ptr_eq(r, null); 1081 // null key 1082 r = self->f->setNFreeSmallJson(self, null, value); 1083 ck_assert_ptr_eq(r, null); 1084 terminateO(self); 1085 1086 } 1087 1088 1089 void setNFreeSmallStringSmallDictT(CuTest *tc UNUSED) { 1090 1091 smallDictt* r; 1092 smallDictt *self = allocG(rtSmallDictt); 1093 smallStringt *string = allocSmallString("qwe"); 1094 1095 r = self->f->setNFreeSmallString(self, "1", string); 1096 ck_assert_ptr_ne(r, null); 1097 char *s = toStringO(r); 1098 ck_assert_str_eq(s, "{\"1\":\"qwe\"}"); 1099 free(s); 1100 // null value 1101 r = self->f->setNFreeSmallString(self, "1", null); 1102 ck_assert_ptr_eq(r, null); 1103 // null key 1104 r = self->f->setNFreeSmallString(self, null, string); 1105 ck_assert_ptr_eq(r, null); 1106 terminateO(self); 1107 1108 } 1109 1110 1111 void setNFreeSmallContainerSmallDictT(CuTest *tc UNUSED) { 1112 1113 smallDictt* r; 1114 smallDictt *self = allocG(rtSmallDictt); 1115 smallContainert *container = allocSmallContainer(null); 1116 1117 r = self->f->setNFreeSmallContainer(self, "1", container); 1118 ck_assert_ptr_ne(r, null); 1119 char *s = toStringO(r); 1120 ck_assert_str_eq(s, "{\"1\":\"<data container>\"}"); 1121 free(s); 1122 // null value 1123 r = self->f->setNFreeSmallContainer(self, "1", null); 1124 ck_assert_ptr_eq(r, null); 1125 // null key 1126 r = self->f->setNFreeSmallContainer(self, null, container); 1127 ck_assert_ptr_eq(r, null); 1128 terminateO(self); 1129 1130 } 1131 1132 1133 void setNFreeKCharSmallDictT(CuTest *tc UNUSED) { 1134 1135 smallDictt* r; 1136 smallDictt *self = allocG(rtSmallDictt); 1137 baset *value; 1138 1139 value = (baset*)allocUndefined(); 1140 r = self->f->setNFreeKChar(self, '1', value); 1141 ck_assert_ptr_ne(r, null); 1142 char *s = toStringO(r); 1143 ck_assert_str_eq(s, "{\"1\":null}"); 1144 free(s); 1145 terminateO(self); 1146 1147 } 1148 1149 1150 void setNFreeUndefinedKCharSmallDictT(CuTest *tc UNUSED) { 1151 1152 smallDictt* r; 1153 smallDictt *self = allocG(rtSmallDictt); 1154 undefinedt *undefined = allocUndefined(); 1155 1156 r = self->f->setNFreeUndefinedKChar(self, '1', undefined); 1157 ck_assert_ptr_ne(r, null); 1158 char *s = toStringO(r); 1159 ck_assert_str_eq(s, "{\"1\":null}"); 1160 free(s); 1161 terminateO(self); 1162 1163 } 1164 1165 1166 void setNFreeSKCharSmallDictT(CuTest *tc UNUSED) { 1167 1168 smallDictt* r; 1169 smallDictt *self = allocG(rtSmallDictt); 1170 char *string = strdup("qwe"); 1171 1172 r = self->f->setNFreeSKChar(self, '1', string); 1173 ck_assert_ptr_ne(r, null); 1174 char *s = toStringO(r); 1175 ck_assert_str_eq(s, "{\"1\":\"qwe\"}"); 1176 free(s); 1177 terminateO(self); 1178 1179 } 1180 1181 1182 void setNFreeDictKCharSmallDictT(CuTest *tc UNUSED) { 1183 1184 smallDictt* r; 1185 smallDictt *self = allocG(rtSmallDictt); 1186 smallDictt *dict = allocSmallDict(); 1187 1188 r = self->f->setNFreeDictKChar(self, '1', dict); 1189 ck_assert_ptr_ne(r, null); 1190 char *s = toStringO(r); 1191 ck_assert_str_eq(s, "{\"1\":{}}"); 1192 free(s); 1193 terminateO(self); 1194 1195 } 1196 1197 1198 void setNFreeArrayKCharSmallDictT(CuTest *tc UNUSED) { 1199 1200 smallDictt* r; 1201 smallDictt *self = allocG(rtSmallDictt); 1202 smallArrayt *array = allocSmallArray(); 1203 1204 r = self->f->setNFreeArrayKChar(self, '1', array); 1205 ck_assert_ptr_ne(r, null); 1206 char *s = toStringO(r); 1207 ck_assert_str_eq(s, "{\"1\":[]}"); 1208 free(s); 1209 terminateO(self); 1210 1211 } 1212 1213 1214 void setNFreeArraycKCharSmallDictT(CuTest *tc UNUSED) { 1215 1216 smallDictt* r; 1217 smallDictt *self = allocG(rtSmallDictt); 1218 char **array = listCreateS("a", "b"); 1219 1220 r = self->f->setNFreeArraycKChar(self, '1', array); 1221 ck_assert_ptr_ne(r, null); 1222 char *s = toStringO(r); 1223 ck_assert_str_eq(s, "{\"1\":[\"a\",\"b\"]}"); 1224 free(s); 1225 terminateO(self); 1226 1227 } 1228 1229 1230 void setNFreeSmallBoolKCharSmallDictT(CuTest *tc UNUSED) { 1231 1232 smallDictt* r; 1233 smallDictt *self = allocG(rtSmallDictt); 1234 smallBoolt *value = allocSmallBool(true); 1235 1236 r = self->f->setNFreeSmallBoolKChar(self, '1', value); 1237 ck_assert_ptr_ne(r, null); 1238 char *s = toStringO(r); 1239 ck_assert_str_eq(s, "{\"1\":true}"); 1240 free(s); 1241 terminateO(self); 1242 1243 } 1244 1245 1246 void setNFreeSmallBytesKCharSmallDictT(CuTest *tc UNUSED) { 1247 1248 smallDictt* r; 1249 smallDictt *self = allocG(rtSmallDictt); 1250 smallBytest *value = allocSmallBytes("qwe", sizeof("qwe")); 1251 1252 r = self->f->setNFreeSmallBytesKChar(self, '1', value); 1253 ck_assert_ptr_ne(r, null); 1254 char *s = toStringO(r); 1255 ck_assert_str_eq(s, "{\"1\":[0x71,0x77,0x65,0x00]}"); 1256 free(s); 1257 terminateO(self); 1258 1259 } 1260 1261 1262 void setNFreeSmallDoubleKCharSmallDictT(CuTest *tc UNUSED) { 1263 1264 smallDictt* r; 1265 smallDictt *self = allocG(rtSmallDictt); 1266 smallDoublet *value = allocSmallDouble(2.2); 1267 1268 r = self->f->setNFreeSmallDoubleKChar(self, '1', value); 1269 ck_assert_ptr_ne(r, null); 1270 char *s = toStringO(r); 1271 ck_assert_str_eq(s, "{\"1\":2.200000e+00}"); 1272 free(s); 1273 terminateO(self); 1274 1275 } 1276 1277 1278 void setNFreeSmallIntKCharSmallDictT(CuTest *tc UNUSED) { 1279 1280 smallDictt* r; 1281 smallDictt *self = allocG(rtSmallDictt); 1282 smallIntt *value = allocSmallInt(2); 1283 1284 r = self->f->setNFreeSmallIntKChar(self, '1', value); 1285 ck_assert_ptr_ne(r, null); 1286 char *s = toStringO(r); 1287 ck_assert_str_eq(s, "{\"1\":2}"); 1288 free(s); 1289 terminateO(self); 1290 1291 } 1292 1293 1294 void setNFreeSmallJsonKCharSmallDictT(CuTest *tc UNUSED) { 1295 1296 smallDictt* r; 1297 smallDictt *self = allocG(rtSmallDictt); 1298 smallJsont *value = allocSmallJson(); 1299 1300 setTopIntO(value, 2); 1301 r = self->f->setNFreeSmallJsonKChar(self, '1', value); 1302 ck_assert_ptr_ne(r, null); 1303 char *s = toStringO(r); 1304 ck_assert_str_eq(s, "{\"1\":2}"); 1305 free(s); 1306 terminateO(self); 1307 1308 } 1309 1310 1311 void setNFreeSmallStringKCharSmallDictT(CuTest *tc UNUSED) { 1312 1313 smallDictt* r; 1314 smallDictt *self = allocG(rtSmallDictt); 1315 smallStringt *string = allocSmallString("qwe"); 1316 1317 r = self->f->setNFreeSmallStringKChar(self, '1', string); 1318 ck_assert_ptr_ne(r, null); 1319 char *s = toStringO(r); 1320 ck_assert_str_eq(s, "{\"1\":\"qwe\"}"); 1321 free(s); 1322 terminateO(self); 1323 1324 } 1325 1326 1327 void setNFreeSmallContainerKCharSmallDictT(CuTest *tc UNUSED) { 1328 1329 smallDictt* r; 1330 smallDictt *self = allocG(rtSmallDictt); 1331 smallContainert *container = allocSmallContainer(null); 1332 1333 r = self->f->setNFreeSmallContainerKChar(self, '1', container); 1334 ck_assert_ptr_ne(r, null); 1335 char *s = toStringO(r); 1336 ck_assert_str_eq(s, "{\"1\":\"<data container>\"}"); 1337 free(s); 1338 terminateO(self); 1339 1340 } 1341 1342 1343 void setPDictSmallDictT(CuTest *tc UNUSED) { 1344 1345 smallDictt* r; 1346 smallDictt *self = allocG(rtSmallDictt); 1347 smallDictt *dict; 1348 1349 dict = allocSmallDict(); 1350 r = self->f->setDict(self, "1", dict); 1351 ck_assert_ptr_ne(r, null); 1352 dict->f->setInt(dict, "a", 1); 1353 r = self->f->setPDict(self, "1", dict); 1354 ck_assert_ptr_ne(r, null); 1355 char *s = toStringO(r); 1356 ck_assert_str_eq(s, "{\"1\":{\"a\":1}}"); 1357 free(s); 1358 // empty dict 1359 finishO(dict); 1360 dict = allocSmallDict(); 1361 r = self->f->setPDict(self, "1", dict); 1362 ck_assert_ptr_eq(r, null); 1363 finishO(dict); 1364 s = toStringO(self); 1365 ck_assert_str_eq(s, "{\"1\":{\"a\":1}}"); 1366 free(s); 1367 // non smallDict object 1368 dict = (smallDictt*) allocSmallInt(2); 1369 r = self->f->setPDict(self, "1", dict); 1370 ck_assert_ptr_eq(r, null); 1371 terminateO(dict); 1372 // null value 1373 r = self->f->setPDict(self, "1", null); 1374 ck_assert_ptr_eq(r, null); 1375 // null key 1376 r = self->f->setPDict(self, null, dict); 1377 ck_assert_ptr_eq(r, null); 1378 terminateO(self); 1379 1380 } 1381 1382 1383 void setPArraySmallDictT(CuTest *tc UNUSED) { 1384 1385 smallDictt* r; 1386 smallDictt *self = allocG(rtSmallDictt); 1387 smallArrayt *array; 1388 1389 array = allocSmallArray(); 1390 r = self->f->setArray(self, "1", array); 1391 ck_assert_ptr_ne(r, null); 1392 array->f->pushInt(array, 1); 1393 r = self->f->setPArray(self, "1", array); 1394 ck_assert_ptr_ne(r, null); 1395 char *s = toStringO(r); 1396 ck_assert_str_eq(s, "{\"1\":[1]}"); 1397 free(s); 1398 // empty array 1399 finishO(array); 1400 array = allocSmallArray(); 1401 r = self->f->setPArray(self, "1", array); 1402 ck_assert_ptr_eq(r, null); 1403 finishO(array); 1404 s = toStringO(self); 1405 ck_assert_str_eq(s, "{\"1\":[1]}"); 1406 free(s); 1407 // non smallDict object 1408 array = (smallArrayt*) allocSmallInt(2); 1409 r = self->f->setPArray(self, "1", array); 1410 ck_assert_ptr_eq(r, null); 1411 terminateO(array); 1412 // null value 1413 r = self->f->setPArray(self, "1", null); 1414 ck_assert_ptr_eq(r, null); 1415 // null key 1416 r = self->f->setPArray(self, null, array); 1417 ck_assert_ptr_eq(r, null); 1418 terminateO(self); 1419 1420 } 1421 1422 1423 void setPSmallJsonSmallDictT(CuTest *tc UNUSED) { 1424 1425 smallDictt* r; 1426 smallDictt *self = allocG(rtSmallDictt); 1427 smallJsont *json; 1428 1429 json = allocSmallJson(); 1430 r = self->f->setSmallJson(self, "1", json); 1431 ck_assert_ptr_ne(r, null); 1432 json->f->setInt(json, "a", 1); 1433 r = self->f->setPSmallJson(self, "1", json); 1434 ck_assert_ptr_ne(r, null); 1435 finishO(json); 1436 char *s = toStringO(r); 1437 ck_assert_str_eq(s, "{\"1\":{\"a\":1}}"); 1438 free(s); 1439 // empty smallJson 1440 json = allocSmallJson(); 1441 r = self->f->setPSmallJson(self, "1", json); 1442 ck_assert_ptr_eq(r, null); 1443 terminateO(json); 1444 // non smallJson object 1445 json = (smallJsont*) allocSmallInt(2); 1446 r = self->f->setPSmallJson(self, "1", json); 1447 ck_assert_ptr_eq(r, null); 1448 // null value 1449 r = self->f->setPSmallJson(self, "1", null); 1450 ck_assert_ptr_eq(r, null); 1451 // null key 1452 r = self->f->setPSmallJson(self, null, json); 1453 ck_assert_ptr_eq(r, null); 1454 terminateO(self); 1455 terminateO(json); 1456 1457 } 1458 1459 1460 void setPSmallStringSmallDictT(CuTest *tc UNUSED) { 1461 1462 smallDictt* r; 1463 smallDictt *self = allocG(rtSmallDictt); 1464 smallStringt *string; 1465 1466 string = allocSmallString(""); 1467 r = self->f->setSmallString(self, "1", string); 1468 ck_assert_ptr_ne(r, null); 1469 string->f->appendS(string, "s"); 1470 r = self->f->setPSmallString(self, "1", string); 1471 ck_assert_ptr_ne(r, null); 1472 finishO(string); 1473 char *s = toStringO(r); 1474 ck_assert_str_eq(s, "{\"1\":\"s\"}"); 1475 free(s); 1476 // empty SmallString 1477 string = allocSmallString(""); 1478 freeO(string); 1479 r = self->f->setPSmallString(self, "1", string); 1480 ck_assert_ptr_eq(r, null); 1481 terminateO(string); 1482 // non smallString object 1483 string = (smallStringt*) allocSmallInt(2); 1484 r = self->f->setPSmallString(self, "1", string); 1485 ck_assert_ptr_eq(r, null); 1486 terminateO(string); 1487 // null value 1488 r = self->f->setPSmallString(self, "1", null); 1489 ck_assert_ptr_eq(r, null); 1490 // null key 1491 string = allocSmallString(""); 1492 r = self->f->setPSmallString(self, null, string); 1493 ck_assert_ptr_eq(r, null); 1494 terminateO(self); 1495 terminateO(string); 1496 1497 } 1498 1499 1500 void setNFreePDictSmallDictT(CuTest *tc UNUSED) { 1501 1502 smallDictt* r; 1503 smallDictt *self = allocG(rtSmallDictt); 1504 smallDictt *value; 1505 1506 value = allocSmallDict(); 1507 r = self->f->setDict(self, "1", value); 1508 ck_assert_ptr_ne(r, null); 1509 value->f->setInt(value, "a", 1); 1510 r = self->f->setNFreePDict(self, "1", value); 1511 ck_assert_ptr_ne(r, null); 1512 char *s = toStringO(r); 1513 ck_assert_str_eq(s, "{\"1\":{\"a\":1}}"); 1514 free(s); 1515 // empty smallDict 1516 value = allocSmallDict(); 1517 r = self->f->setNFreePDict(self, "1", value); 1518 ck_assert_ptr_eq(r, null); 1519 terminateO(value); 1520 // non smallDict object 1521 value = (smallDictt*) allocSmallInt(2); 1522 r = self->f->setNFreePDict(self, "1", value); 1523 ck_assert_ptr_eq(r, null); 1524 terminateO(value); 1525 // null value 1526 value = allocSmallDict(); 1527 r = self->f->setNFreePDict(self, "1", null); 1528 ck_assert_ptr_eq(r, null); 1529 // null key 1530 r = self->f->setNFreePDict(self, null, value); 1531 ck_assert_ptr_eq(r, null); 1532 terminateO(self); 1533 terminateO(value); 1534 1535 } 1536 1537 1538 void setNFreePArraySmallDictT(CuTest *tc UNUSED) { 1539 1540 smallDictt* r; 1541 smallDictt *self = allocG(rtSmallDictt); 1542 smallArrayt *value; 1543 1544 value = allocSmallArray(); 1545 r = self->f->setArray(self, "1", value); 1546 ck_assert_ptr_ne(r, null); 1547 value->f->pushInt(value, 2); 1548 r = self->f->setNFreePArray(self, "1", value); 1549 ck_assert_ptr_ne(r, null); 1550 char *s = toStringO(r); 1551 ck_assert_str_eq(s, "{\"1\":[2]}"); 1552 free(s); 1553 // empty smallArray 1554 value = allocSmallArray(); 1555 r = self->f->setNFreePArray(self, "1", value); 1556 ck_assert_ptr_eq(r, null); 1557 terminateO(value); 1558 // non smallArray object 1559 value = (smallArrayt*) allocSmallInt(2); 1560 r = self->f->setNFreePArray(self, "1", value); 1561 ck_assert_ptr_eq(r, null); 1562 terminateO(value); 1563 // null value 1564 value = allocSmallArray(); 1565 r = self->f->setNFreePArray(self, "1", null); 1566 ck_assert_ptr_eq(r, null); 1567 // null key 1568 r = self->f->setNFreePArray(self, null, value); 1569 ck_assert_ptr_eq(r, null); 1570 terminateO(self); 1571 terminateO(value); 1572 1573 } 1574 1575 1576 void setNFreePSmallJsonSmallDictT(CuTest *tc UNUSED) { 1577 1578 smallDictt* r; 1579 smallDictt *self = allocG(rtSmallDictt); 1580 smallJsont *value; 1581 1582 value = allocSmallJson(); 1583 r = self->f->setSmallJson(self, "1", value); 1584 ck_assert_ptr_ne(r, null); 1585 value->f->setInt(value, "a", 1); 1586 r = self->f->setNFreePSmallJson(self, "1", value); 1587 ck_assert_ptr_ne(r, null); 1588 char *s = toStringO(r); 1589 ck_assert_str_eq(s, "{\"1\":{\"a\":1}}"); 1590 free(s); 1591 // empty smallJson 1592 value = allocSmallJson(); 1593 r = self->f->setNFreePSmallJson(self, "1", value); 1594 ck_assert_ptr_eq(r, null); 1595 terminateO(value); 1596 // non smallJson object 1597 value = (smallJsont*) allocSmallInt(2); 1598 r = self->f->setNFreePSmallJson(self, "1", value); 1599 ck_assert_ptr_eq(r, null); 1600 terminateO(value); 1601 // null value 1602 value = allocSmallJson(); 1603 r = self->f->setNFreePSmallJson(self, "1", null); 1604 ck_assert_ptr_eq(r, null); 1605 // null key 1606 r = self->f->setNFreePSmallJson(self, null, value); 1607 ck_assert_ptr_eq(r, null); 1608 terminateO(self); 1609 terminateO(value); 1610 1611 } 1612 1613 1614 void setNFreePSmallStringSmallDictT(CuTest *tc UNUSED) { 1615 1616 smallDictt* r; 1617 smallDictt *self = allocG(rtSmallDictt); 1618 smallStringt *value; 1619 1620 value = allocSmallString(""); 1621 r = self->f->setSmallString(self, "1", value); 1622 ck_assert_ptr_ne(r, null); 1623 value->f->appendS(value, "2"); 1624 r = self->f->setNFreePSmallString(self, "1", value); 1625 ck_assert_ptr_ne(r, null); 1626 char *s = toStringO(r); 1627 ck_assert_str_eq(s, "{\"1\":\"2\"}"); 1628 free(s); 1629 // empty SmallString 1630 value = allocSmallString(""); 1631 freeO(value); 1632 r = self->f->setNFreePSmallString(self, "1", value); 1633 ck_assert_ptr_eq(r, null); 1634 terminateO(value); 1635 // non smallString object 1636 value = (smallStringt*) allocSmallInt(2); 1637 r = self->f->setNFreePSmallString(self, "1", value); 1638 ck_assert_ptr_eq(r, null); 1639 terminateO(value); 1640 // null value 1641 value = allocSmallString(""); 1642 r = self->f->setNFreePSmallString(self, "1", null); 1643 ck_assert_ptr_eq(r, null); 1644 // null key 1645 r = self->f->setNFreePSmallString(self, null, value); 1646 ck_assert_ptr_eq(r, null); 1647 terminateO(self); 1648 terminateO(value); 1649 1650 } 1651 1652 1653 void setPArrayKCharSmallDictT(CuTest *tc UNUSED) { 1654 1655 smallDictt* r; 1656 smallDictt *self = allocG(rtSmallDictt); 1657 smallArrayt *array; 1658 1659 array = allocSmallArray(); 1660 r = self->f->setArray(self, "1", array); 1661 ck_assert_ptr_ne(r, null); 1662 array->f->pushInt(array, 2); 1663 r = self->f->setPArrayKChar(self, '1', array); 1664 ck_assert_ptr_ne(r, null); 1665 char *s = toStringO(r); 1666 ck_assert_str_eq(s, "{\"1\":[2]}"); 1667 free(s); 1668 terminateO(self); 1669 finishO(array); 1670 1671 } 1672 1673 1674 void setPDictKCharSmallDictT(CuTest *tc UNUSED) { 1675 1676 smallDictt* r; 1677 smallDictt *self = allocG(rtSmallDictt); 1678 smallDictt *dict; 1679 1680 dict = allocSmallDict(); 1681 r = self->f->setDict(self, "1", dict); 1682 ck_assert_ptr_ne(r, null); 1683 dict->f->setInt(dict, "a", 1); 1684 r = self->f->setPDictKChar(self, '1', dict); 1685 ck_assert_ptr_ne(r, null); 1686 char *s = toStringO(r); 1687 ck_assert_str_eq(s, "{\"1\":{\"a\":1}}"); 1688 free(s); 1689 terminateO(self); 1690 finishO(dict); 1691 1692 } 1693 1694 1695 void setPSmallJsonKCharSmallDictT(CuTest *tc UNUSED) { 1696 1697 smallDictt* r; 1698 smallDictt *self = allocG(rtSmallDictt); 1699 smallJsont *json; 1700 1701 json = allocSmallJson(); 1702 r = self->f->setSmallJson(self, "1", json); 1703 ck_assert_ptr_ne(r, null); 1704 json->f->setInt(json, "a", 1); 1705 r = self->f->setPSmallJsonKChar(self, '1', json); 1706 ck_assert_ptr_ne(r, null); 1707 finishO(json); 1708 char *s = toStringO(r); 1709 ck_assert_str_eq(s, "{\"1\":{\"a\":1}}"); 1710 free(s); 1711 terminateO(self); 1712 1713 } 1714 1715 1716 void setPSmallStringKCharSmallDictT(CuTest *tc UNUSED) { 1717 1718 smallDictt* r; 1719 smallDictt *self = allocG(rtSmallDictt); 1720 smallStringt *string; 1721 1722 string = allocSmallString(""); 1723 r = self->f->setSmallString(self, "1", string); 1724 ck_assert_ptr_ne(r, null); 1725 string->f->appendS(string, "s"); 1726 r = self->f->setPSmallStringKChar(self, '1', string); 1727 ck_assert_ptr_ne(r, null); 1728 finishO(string); 1729 char *s = toStringO(r); 1730 ck_assert_str_eq(s, "{\"1\":\"s\"}"); 1731 free(s); 1732 terminateO(self); 1733 1734 } 1735 1736 1737 void setNFreePArrayKCharSmallDictT(CuTest *tc UNUSED) { 1738 1739 smallDictt* r; 1740 smallDictt *self = allocG(rtSmallDictt); 1741 smallArrayt *value; 1742 1743 value = allocSmallArray(); 1744 r = self->f->setArray(self, "1", value); 1745 ck_assert_ptr_ne(r, null); 1746 value->f->pushInt(value, 2); 1747 r = self->f->setNFreePArrayKChar(self, '1', value); 1748 ck_assert_ptr_ne(r, null); 1749 char *s = toStringO(r); 1750 ck_assert_str_eq(s, "{\"1\":[2]}"); 1751 free(s); 1752 terminateO(self); 1753 1754 } 1755 1756 1757 void setNFreePDictKCharSmallDictT(CuTest *tc UNUSED) { 1758 1759 smallDictt* r; 1760 smallDictt *self = allocG(rtSmallDictt); 1761 smallDictt *value; 1762 1763 value = allocSmallDict(); 1764 r = self->f->setDict(self, "1", value); 1765 ck_assert_ptr_ne(r, null); 1766 value->f->setInt(value, "a", 1); 1767 r = self->f->setNFreePDictKChar(self, '1', value); 1768 ck_assert_ptr_ne(r, null); 1769 char *s = toStringO(r); 1770 ck_assert_str_eq(s, "{\"1\":{\"a\":1}}"); 1771 free(s); 1772 terminateO(self); 1773 1774 } 1775 1776 1777 void setNFreePSmallJsonKCharSmallDictT(CuTest *tc UNUSED) { 1778 1779 smallDictt* r; 1780 smallDictt *self = allocG(rtSmallDictt); 1781 smallJsont *value; 1782 1783 value = allocSmallJson(); 1784 r = self->f->setSmallJson(self, "1", value); 1785 ck_assert_ptr_ne(r, null); 1786 value->f->setInt(value, "a", 1); 1787 r = self->f->setNFreePSmallJsonKChar(self, '1', value); 1788 ck_assert_ptr_ne(r, null); 1789 char *s = toStringO(r); 1790 ck_assert_str_eq(s, "{\"1\":{\"a\":1}}"); 1791 free(s); 1792 terminateO(self); 1793 1794 } 1795 1796 1797 void setNFreePSmallStringKCharSmallDictT(CuTest *tc UNUSED) { 1798 1799 smallDictt* r; 1800 smallDictt *self = allocG(rtSmallDictt); 1801 smallStringt *value; 1802 1803 value = allocSmallString(""); 1804 r = self->f->setSmallString(self, "1", value); 1805 ck_assert_ptr_ne(r, null); 1806 value->f->appendS(value, "2"); 1807 r = self->f->setNFreePSmallStringKChar(self, '1', value); 1808 ck_assert_ptr_ne(r, null); 1809 char *s = toStringO(r); 1810 ck_assert_str_eq(s, "{\"1\":\"2\"}"); 1811 free(s); 1812 terminateO(self); 1813 1814 } 1815 1816 1817 void getUndefinedSmallDictT(CuTest *tc UNUSED) { 1818 1819 undefinedt* r; 1820 smallDictt *self = allocG(rtSmallDictt); 1821 1822 smallDictt *r2 = self->f->setUndefined(self, "1"); 1823 ck_assert_ptr_ne(r2, null); 1824 r = self->f->getUndefined(self, "1"); 1825 ck_assert_ptr_ne(r, null); 1826 terminateO(r); 1827 // non undefined object 1828 r2 = self->f->setInt(self, "1", 2); 1829 ck_assert_ptr_ne(r2, null); 1830 r = self->f->getUndefined(self, "1"); 1831 ck_assert_ptr_eq(r, null); 1832 // null key 1833 r = self->f->getUndefined(self, null); 1834 ck_assert_ptr_eq(r, null); 1835 // empty self 1836 freeO(self); 1837 r = self->f->getUndefined(self, "1"); 1838 ck_assert_ptr_eq(r, null); 1839 terminateO(self); 1840 1841 } 1842 1843 1844 void getBoolSmallDictT(CuTest *tc UNUSED) { 1845 1846 bool r; 1847 smallDictt *self = allocG(rtSmallDictt); 1848 1849 smallDictt *r2 = self->f->setBool(self, "1", true); 1850 ck_assert_ptr_ne(r2, null); 1851 r = self->f->getBool(self, "1"); 1852 ck_assert(r); 1853 // non bool object 1854 r2 = self->f->setInt(self, "1", 2); 1855 ck_assert_ptr_ne(r2, null); 1856 r = self->f->getBool(self, "1"); 1857 ck_assert(!r); 1858 // null key 1859 r = self->f->getBool(self, null); 1860 ck_assert(!r); 1861 // empty self 1862 freeO(self); 1863 r = self->f->getBool(self, "1"); 1864 ck_assert(!r); 1865 terminateO(self); 1866 1867 } 1868 1869 1870 void getBoolPSmallDictT(CuTest *tc UNUSED) { 1871 1872 bool* r; 1873 smallDictt *self = allocG(rtSmallDictt); 1874 1875 smallDictt *r2 = self->f->setBool(self, "1", true); 1876 ck_assert_ptr_ne(r2, null); 1877 r = self->f->getBoolP(self, "1"); 1878 ck_assert_ptr_ne(r, null); 1879 ck_assert(*r); 1880 // non bool object 1881 r2 = self->f->setInt(self, "1", 2); 1882 ck_assert_ptr_ne(r2, null); 1883 r = self->f->getBoolP(self, "1"); 1884 ck_assert_ptr_eq(r, null); 1885 // null key 1886 r = self->f->getBoolP(self, null); 1887 ck_assert_ptr_eq(r, null); 1888 // empty self 1889 freeO(self); 1890 r = self->f->getBoolP(self, "1"); 1891 ck_assert_ptr_eq(r, null); 1892 terminateO(self); 1893 1894 } 1895 1896 1897 void getDoubleSmallDictT(CuTest *tc UNUSED) { 1898 1899 double r; 1900 smallDictt *self = allocG(rtSmallDictt); 1901 1902 smallDictt *r2 = self->f->setDouble(self, "1", 2.2); 1903 ck_assert_ptr_ne(r2, null); 1904 r = self->f->getDouble(self, "1"); 1905 ck_assert(r == 2.2); 1906 // non double object 1907 r2 = self->f->setInt(self, "1", 2); 1908 ck_assert_ptr_ne(r2, null); 1909 r = self->f->getDouble(self, "1"); 1910 ck_assert(r == 0); 1911 // null key 1912 r = self->f->getDouble(self, null); 1913 ck_assert(!r); 1914 // empty self 1915 freeO(self); 1916 r = self->f->getDouble(self, "1"); 1917 ck_assert(!r); 1918 terminateO(self); 1919 1920 } 1921 1922 1923 void getDoublePSmallDictT(CuTest *tc UNUSED) { 1924 1925 double* r; 1926 smallDictt *self = allocG(rtSmallDictt); 1927 1928 smallDictt *r2 = self->f->setDouble(self, "1", 2.2); 1929 ck_assert_ptr_ne(r2, null); 1930 r = self->f->getDoubleP(self, "1"); 1931 ck_assert_ptr_ne(r, null); 1932 ck_assert(*r == 2.2); 1933 // non double object 1934 r2 = self->f->setInt(self, "1", 2); 1935 ck_assert_ptr_ne(r2, null); 1936 r = self->f->getDoubleP(self, "1"); 1937 ck_assert_ptr_eq(r, null); 1938 // null key 1939 r = self->f->getDoubleP(self, null); 1940 ck_assert_ptr_eq(r, null); 1941 // empty self 1942 freeO(self); 1943 r = self->f->getDoubleP(self, "1"); 1944 ck_assert_ptr_eq(r, null); 1945 terminateO(self); 1946 1947 } 1948 1949 1950 void getIntSmallDictT(CuTest *tc UNUSED) { 1951 1952 int64_t r; 1953 smallDictt *self = allocG(rtSmallDictt); 1954 1955 smallDictt *r2 = self->f->setInt(self, "1", 2); 1956 ck_assert_ptr_ne(r2, null); 1957 r = self->f->getInt(self, "1"); 1958 ck_assert_int_eq(r, 2); 1959 // non int object 1960 r2 = self->f->setBool(self, "1", true); 1961 ck_assert_ptr_ne(r2, null); 1962 r = self->f->getInt(self, "1"); 1963 ck_assert(!r); 1964 // null key 1965 r = self->f->getInt(self, null); 1966 ck_assert(!r); 1967 // empty self 1968 freeO(self); 1969 r = self->f->getInt(self, "1"); 1970 ck_assert(!r); 1971 terminateO(self); 1972 1973 } 1974 1975 1976 void getIntPSmallDictT(CuTest *tc UNUSED) { 1977 1978 int64_t* r; 1979 smallDictt *self = allocG(rtSmallDictt); 1980 1981 smallDictt *r2 = self->f->setInt(self, "1", 2); 1982 ck_assert_ptr_ne(r2, null); 1983 r = self->f->getIntP(self, "1"); 1984 ck_assert_ptr_ne(r, null); 1985 ck_assert_int_eq(*r, 2); 1986 // non int object 1987 r2 = self->f->setBool(self, "1", true); 1988 ck_assert_ptr_ne(r2, null); 1989 r = self->f->getIntP(self, "1"); 1990 ck_assert_ptr_eq(r, null); 1991 // null key 1992 r = self->f->getIntP(self, null); 1993 ck_assert_ptr_eq(r, null); 1994 // empty self 1995 freeO(self); 1996 r = self->f->getIntP(self, "1"); 1997 ck_assert_ptr_eq(r, null); 1998 terminateO(self); 1999 2000 } 2001 2002 2003 void getInt32SmallDictT(CuTest *tc UNUSED) { 2004 2005 int32_t r; 2006 smallDictt *self = allocG(rtSmallDictt); 2007 2008 smallDictt *r2 = self->f->setInt(self, "1", 2); 2009 ck_assert_ptr_ne(r2, null); 2010 r = self->f->getInt32(self, "1"); 2011 ck_assert_int_eq(r, 2); 2012 // non int object 2013 r2 = self->f->setBool(self, "1", true); 2014 ck_assert_ptr_ne(r2, null); 2015 r = self->f->getInt32(self, "1"); 2016 ck_assert(!r); 2017 // null key 2018 r = self->f->getInt32(self, null); 2019 ck_assert(!r); 2020 // empty self 2021 freeO(self); 2022 r = self->f->getInt32(self, "1"); 2023 ck_assert(!r); 2024 terminateO(self); 2025 2026 } 2027 2028 2029 void getInt32PSmallDictT(CuTest *tc UNUSED) { 2030 2031 int32_t* r; 2032 smallDictt *self = allocG(rtSmallDictt); 2033 2034 smallDictt *r2 = self->f->setInt(self, "1", 2); 2035 ck_assert_ptr_ne(r2, null); 2036 r = self->f->getInt32P(self, "1"); 2037 ck_assert_ptr_ne(r, null); 2038 ck_assert_int_eq(*r, 2); 2039 // non int object 2040 r2 = self->f->setBool(self, "1", true); 2041 ck_assert_ptr_ne(r2, null); 2042 r = self->f->getInt32P(self, "1"); 2043 ck_assert_ptr_eq(r, null); 2044 // null key 2045 r = self->f->getInt32P(self, null); 2046 ck_assert_ptr_eq(r, null); 2047 // empty self 2048 freeO(self); 2049 r = self->f->getInt32P(self, "1"); 2050 ck_assert_ptr_eq(r, null); 2051 terminateO(self); 2052 2053 } 2054 2055 2056 void getUintSmallDictT(CuTest *tc UNUSED) { 2057 2058 uint64_t r; 2059 smallDictt *self = allocG(rtSmallDictt); 2060 2061 smallDictt *r2 = self->f->setInt(self, "1", 2); 2062 ck_assert_ptr_ne(r2, null); 2063 r = self->f->getUint(self, "1"); 2064 ck_assert_int_eq(r, 2); 2065 // non int object 2066 r2 = self->f->setBool(self, "1", true); 2067 ck_assert_ptr_ne(r2, null); 2068 r = self->f->getUint(self, "1"); 2069 ck_assert(!r); 2070 // null key 2071 r = self->f->getUint(self, null); 2072 ck_assert(!r); 2073 // empty self 2074 freeO(self); 2075 r = self->f->getUint(self, "1"); 2076 ck_assert(!r); 2077 terminateO(self); 2078 2079 } 2080 2081 2082 void getUintPSmallDictT(CuTest *tc UNUSED) { 2083 2084 uint64_t* r; 2085 smallDictt *self = allocG(rtSmallDictt); 2086 2087 smallDictt *r2 = self->f->setInt(self, "1", 2); 2088 ck_assert_ptr_ne(r2, null); 2089 r = self->f->getUintP(self, "1"); 2090 ck_assert_ptr_ne(r, null); 2091 ck_assert_int_eq(*r, 2); 2092 // non int object 2093 r2 = self->f->setBool(self, "1", true); 2094 ck_assert_ptr_ne(r2, null); 2095 r = self->f->getUintP(self, "1"); 2096 ck_assert_ptr_eq(r, null); 2097 // null key 2098 r = self->f->getUintP(self, null); 2099 ck_assert_ptr_eq(r, null); 2100 // empty self 2101 freeO(self); 2102 r = self->f->getUintP(self, "1"); 2103 ck_assert_ptr_eq(r, null); 2104 terminateO(self); 2105 2106 } 2107 2108 2109 void getUint32SmallDictT(CuTest *tc UNUSED) { 2110 2111 uint32_t r; 2112 smallDictt *self = allocG(rtSmallDictt); 2113 2114 smallDictt *r2 = self->f->setInt(self, "1", 2); 2115 ck_assert_ptr_ne(r2, null); 2116 r = self->f->getUint32(self, "1"); 2117 ck_assert_int_eq(r, 2); 2118 // non int object 2119 r2 = self->f->setBool(self, "1", true); 2120 ck_assert_ptr_ne(r2, null); 2121 r = self->f->getUint32(self, "1"); 2122 ck_assert(!r); 2123 // null key 2124 r = self->f->getUint32(self, null); 2125 ck_assert(!r); 2126 // empty self 2127 freeO(self); 2128 r = self->f->getUint32(self, "1"); 2129 ck_assert(!r); 2130 terminateO(self); 2131 2132 } 2133 2134 2135 void getUint32PSmallDictT(CuTest *tc UNUSED) { 2136 2137 uint32_t* r; 2138 smallDictt *self = allocG(rtSmallDictt); 2139 2140 smallDictt *r2 = self->f->setInt(self, "1", 2); 2141 ck_assert_ptr_ne(r2, null); 2142 r = self->f->getUint32P(self, "1"); 2143 ck_assert_ptr_ne(r, null); 2144 ck_assert_int_eq(*r, 2); 2145 // non int object 2146 r2 = self->f->setBool(self, "1", true); 2147 ck_assert_ptr_ne(r2, null); 2148 r = self->f->getUint32P(self, "1"); 2149 ck_assert_ptr_eq(r, null); 2150 // null key 2151 r = self->f->getUint32P(self, null); 2152 ck_assert_ptr_eq(r, null); 2153 // empty self 2154 freeO(self); 2155 r = self->f->getUint32P(self, "1"); 2156 ck_assert_ptr_eq(r, null); 2157 terminateO(self); 2158 2159 } 2160 2161 2162 void getSSmallDictT(CuTest *tc UNUSED) { 2163 2164 char* r; 2165 smallDictt *self = allocG(rtSmallDictt); 2166 2167 smallDictt *r2 = self->f->setS(self, "1", "qwe"); 2168 ck_assert_ptr_ne(r2, null); 2169 r = self->f->getS(self, "1"); 2170 ck_assert_ptr_ne(r, null); 2171 ck_assert_str_eq(r, "qwe"); 2172 // non string object 2173 r2 = self->f->setBool(self, "1", true); 2174 ck_assert_ptr_ne(r2, null); 2175 r = self->f->getS(self, "1"); 2176 ck_assert_ptr_eq(r, null); 2177 // null key 2178 r = self->f->getS(self, null); 2179 ck_assert_ptr_eq(r, null); 2180 // empty self 2181 freeO(self); 2182 r = self->f->getS(self, "1"); 2183 ck_assert_ptr_eq(r, null); 2184 terminateO(self); 2185 2186 } 2187 2188 2189 void getDictSmallDictT(CuTest *tc UNUSED) { 2190 2191 smallDictt* r; 2192 smallDictt *self = allocG(rtSmallDictt); 2193 2194 createAllocateSmallDict(d); 2195 smallDictt *r2 = self->f->setNFreeDict(self, "1", d); 2196 ck_assert_ptr_ne(r2, null); 2197 r = self->f->getDict(self, "1"); 2198 ck_assert_ptr_ne(r, null); 2199 char *s = toStringO(r); 2200 finishO(r); 2201 ck_assert_str_eq(s, "{}"); 2202 free(s); 2203 // non dict object 2204 r2 = self->f->setBool(self, "1", true); 2205 ck_assert_ptr_ne(r2, null); 2206 r = self->f->getDict(self, "1"); 2207 ck_assert_ptr_eq(r, null); 2208 // null key 2209 r = self->f->getDict(self, null); 2210 ck_assert_ptr_eq(r, null); 2211 // empty self 2212 freeO(self); 2213 r = self->f->getDict(self, "1"); 2214 ck_assert_ptr_eq(r, null); 2215 terminateO(self); 2216 2217 } 2218 2219 2220 void getArraySmallDictT(CuTest *tc UNUSED) { 2221 2222 smallArrayt* r; 2223 smallDictt *self = allocG(rtSmallDictt); 2224 2225 createAllocateSmallArray(d); 2226 smallDictt *r2 = self->f->setNFreeArray(self, "1", d); 2227 ck_assert_ptr_ne(r2, null); 2228 r = self->f->getArray(self, "1"); 2229 ck_assert_ptr_ne(r, null); 2230 char *s = toStringO(r); 2231 finishO(r); 2232 ck_assert_str_eq(s, "[]"); 2233 free(s); 2234 // non Array object 2235 r2 = self->f->setBool(self, "1", true); 2236 ck_assert_ptr_ne(r2, null); 2237 r = self->f->getArray(self, "1"); 2238 ck_assert_ptr_eq(r, null); 2239 // null key 2240 r = self->f->getArray(self, null); 2241 ck_assert_ptr_eq(r, null); 2242 // empty self 2243 freeO(self); 2244 r = self->f->getArray(self, "1"); 2245 ck_assert_ptr_eq(r, null); 2246 terminateO(self); 2247 2248 } 2249 2250 2251 void getSmallBoolSmallDictT(CuTest *tc UNUSED) { 2252 2253 smallBoolt* r; 2254 smallDictt *self = allocG(rtSmallDictt); 2255 2256 createAllocateSmallBool(d); 2257 smallDictt *r2 = self->f->setNFreeSmallBool(self, "1", d); 2258 ck_assert_ptr_ne(r2, null); 2259 r = self->f->getSmallBool(self, "1"); 2260 ck_assert_ptr_ne(r, null); 2261 char *s = toStringO(r); 2262 finishO(r); 2263 ck_assert_str_eq(s, "false"); 2264 free(s); 2265 // non SmallBool object 2266 r2 = self->f->setInt(self, "1", 0); 2267 ck_assert_ptr_ne(r2, null); 2268 r = self->f->getSmallBool(self, "1"); 2269 ck_assert_ptr_eq(r, null); 2270 // null key 2271 r = self->f->getSmallBool(self, null); 2272 ck_assert_ptr_eq(r, null); 2273 // empty self 2274 freeO(self); 2275 r = self->f->getSmallBool(self, "1"); 2276 ck_assert_ptr_eq(r, null); 2277 terminateO(self); 2278 2279 } 2280 2281 2282 void getSmallBytesSmallDictT(CuTest *tc UNUSED) { 2283 2284 smallBytest* r; 2285 smallDictt *self = allocG(rtSmallDictt); 2286 2287 createAllocateSmallBytes(d); 2288 smallDictt *r2 = self->f->setNFreeSmallBytes(self, "1", d); 2289 ck_assert_ptr_ne(r2, null); 2290 r = self->f->getSmallBytes(self, "1"); 2291 ck_assert_ptr_ne(r, null); 2292 char *s = toStringO(r); 2293 finishO(r); 2294 ck_assert_str_eq(s, "[]"); 2295 free(s); 2296 // non SmallBytes object 2297 r2 = self->f->setBool(self, "1", true); 2298 ck_assert_ptr_ne(r2, null); 2299 r = self->f->getSmallBytes(self, "1"); 2300 ck_assert_ptr_eq(r, null); 2301 // null key 2302 r = self->f->getSmallBytes(self, null); 2303 ck_assert_ptr_eq(r, null); 2304 // empty self 2305 freeO(self); 2306 r = self->f->getSmallBytes(self, "1"); 2307 ck_assert_ptr_eq(r, null); 2308 terminateO(self); 2309 2310 } 2311 2312 2313 void getSmallDoubleSmallDictT(CuTest *tc UNUSED) { 2314 2315 smallDoublet* r; 2316 smallDictt *self = allocG(rtSmallDictt); 2317 2318 createAllocateSmallDouble(d); 2319 smallDictt *r2 = self->f->setNFreeSmallDouble(self, "1", d); 2320 ck_assert_ptr_ne(r2, null); 2321 r = self->f->getSmallDouble(self, "1"); 2322 ck_assert_ptr_ne(r, null); 2323 char *s = toStringO(r); 2324 finishO(r); 2325 ck_assert_str_eq(s, "0.000000e+00"); 2326 free(s); 2327 // non SmallDouble object 2328 r2 = self->f->setBool(self, "1", true); 2329 ck_assert_ptr_ne(r2, null); 2330 r = self->f->getSmallDouble(self, "1"); 2331 ck_assert_ptr_eq(r, null); 2332 // null key 2333 r = self->f->getSmallDouble(self, null); 2334 ck_assert_ptr_eq(r, null); 2335 // empty self 2336 freeO(self); 2337 r = self->f->getSmallDouble(self, "1"); 2338 ck_assert_ptr_eq(r, null); 2339 terminateO(self); 2340 2341 } 2342 2343 2344 void getSmallIntSmallDictT(CuTest *tc UNUSED) { 2345 2346 smallIntt* r; 2347 smallDictt *self = allocG(rtSmallDictt); 2348 2349 createAllocateSmallInt(d); 2350 smallDictt *r2 = self->f->setNFreeSmallInt(self, "1", d); 2351 ck_assert_ptr_ne(r2, null); 2352 r = self->f->getSmallInt(self, "1"); 2353 ck_assert_ptr_ne(r, null); 2354 char *s = toStringO(r); 2355 finishO(r); 2356 ck_assert_str_eq(s, "0"); 2357 free(s); 2358 // non SmallInt object 2359 r2 = self->f->setBool(self, "1", true); 2360 ck_assert_ptr_ne(r2, null); 2361 r = self->f->getSmallInt(self, "1"); 2362 ck_assert_ptr_eq(r, null); 2363 // null key 2364 r = self->f->getSmallInt(self, null); 2365 ck_assert_ptr_eq(r, null); 2366 // empty self 2367 freeO(self); 2368 r = self->f->getSmallInt(self, "1"); 2369 ck_assert_ptr_eq(r, null); 2370 terminateO(self); 2371 2372 } 2373 2374 2375 void getSmallJsonSmallDictT(CuTest *tc UNUSED) { 2376 2377 smallJsont* r; 2378 smallDictt *self = allocG(rtSmallDictt); 2379 2380 createAllocateSmallJson(d); 2381 smallDictt *r2 = self->f->setNFreeSmallJson(self, "1", d); 2382 ck_assert_ptr_ne(r2, null); 2383 r = self->f->getSmallJson(self, "1"); 2384 ck_assert_ptr_ne(r, null); 2385 char *s = toStringO(r); 2386 finishO(r); 2387 ck_assert_str_eq(s, "{}"); 2388 free(s); 2389 r2 = self->f->setBool(self, "1", true); 2390 ck_assert_ptr_ne(r2, null); 2391 r = self->f->getSmallJson(self, "1"); 2392 ck_assert_ptr_ne(r, null); 2393 s = toStringO(r); 2394 finishO(r); 2395 ck_assert_str_eq(s, "true"); 2396 free(s); 2397 // non SmallJson object 2398 smallContainert *c = allocSmallContainer(NULL); 2399 r2 = self->f->setNFreeSmallContainer(self, "1", c); 2400 ck_assert_ptr_ne(r2, null); 2401 r = self->f->getSmallJson(self, "1"); 2402 ck_assert_ptr_eq(r, null); 2403 // null key 2404 r = self->f->getSmallJson(self, null); 2405 ck_assert_ptr_eq(r, null); 2406 // empty self 2407 freeO(self); 2408 r = self->f->getSmallJson(self, "1"); 2409 ck_assert_ptr_eq(r, null); 2410 terminateO(self); 2411 2412 } 2413 2414 2415 void getSmallStringSmallDictT(CuTest *tc UNUSED) { 2416 2417 smallStringt* r; 2418 smallDictt *self = allocG(rtSmallDictt); 2419 2420 createAllocateSmallString(d); 2421 smallDictt *r2 = self->f->setNFreeSmallString(self, "1", d); 2422 ck_assert_ptr_ne(r2, null); 2423 r = self->f->getSmallString(self, "1"); 2424 ck_assert_ptr_ne(r, null); 2425 char *s = toStringO(r); 2426 finishO(r); 2427 ck_assert_str_eq(s, ""); 2428 free(s); 2429 // non SmallString object 2430 r2 = self->f->setBool(self, "1", true); 2431 ck_assert_ptr_ne(r2, null); 2432 r = self->f->getSmallString(self, "1"); 2433 ck_assert_ptr_eq(r, null); 2434 // null key 2435 r = self->f->getSmallString(self, null); 2436 ck_assert_ptr_eq(r, null); 2437 // empty self 2438 freeO(self); 2439 r = self->f->getSmallString(self, "1"); 2440 ck_assert_ptr_eq(r, null); 2441 terminateO(self); 2442 2443 } 2444 2445 2446 void getVoidSmallDictT(CuTest *tc UNUSED) { 2447 2448 void* r; 2449 smallDictt *self = allocG(rtSmallDictt); 2450 2451 smallContainert* d = allocSmallContainer(&r); 2452 smallDictt *r2 = self->f->setNFreeSmallContainer(self, "1", d); 2453 ck_assert_ptr_ne(r2, null); 2454 r = self->f->getVoid(self, "1"); 2455 ck_assert_ptr_eq(r, &r); 2456 // non container object 2457 r2 = self->f->setBool(self, "1", true); 2458 ck_assert_ptr_ne(r2, null); 2459 r = self->f->getVoid(self, "1"); 2460 ck_assert_ptr_eq(r, null); 2461 // null key 2462 r = self->f->getVoid(self, null); 2463 ck_assert_ptr_eq(r, null); 2464 // empty self 2465 freeO(self); 2466 r = self->f->getVoid(self, "1"); 2467 ck_assert_ptr_eq(r, null); 2468 terminateO(self); 2469 2470 } 2471 2472 2473 void getSmallContainerSmallDictT(CuTest *tc UNUSED) { 2474 2475 smallContainert* r; 2476 smallDictt *self = allocG(rtSmallDictt); 2477 2478 createAllocateSmallContainer(d); 2479 smallDictt *r2 = self->f->setNFreeSmallContainer(self, "1", d); 2480 ck_assert_ptr_ne(r2, null); 2481 r = self->f->getSmallContainer(self, "1"); 2482 ck_assert_ptr_ne(r, null); 2483 char *s = toStringO(r); 2484 finishO(r); 2485 ck_assert_str_eq(s, "<data smallContainer>"); 2486 free(s); 2487 // other base class 2488 smallIntt *t = allocSmallInt(2); 2489 t->type = "randomClass"; 2490 r2 = self->f->setNFree(self, "1", (baset*)t); 2491 ck_assert_ptr_ne(r2, null); 2492 r = self->f->getSmallContainer(self, "1"); 2493 ck_assert_ptr_eq(r, null); 2494 // non SmallContainer object 2495 r2 = self->f->setBool(self, "1", true); 2496 ck_assert_ptr_ne(r2, null); 2497 r = self->f->getSmallContainer(self, "1"); 2498 ck_assert_ptr_eq(r, null); 2499 // null key 2500 r = self->f->getSmallContainer(self, null); 2501 ck_assert_ptr_eq(r, null); 2502 // empty self 2503 freeO(self); 2504 r = self->f->getSmallContainer(self, "1"); 2505 ck_assert_ptr_eq(r, null); 2506 terminateO(self); 2507 2508 } 2509 2510 2511 void getKCharSmallDictT(CuTest *tc UNUSED) { 2512 2513 baset* r; 2514 smallDictt *self = allocG(rtSmallDictt); 2515 2516 smallIntt *c = allocSmallInt(2); 2517 smallDictt *r2 = self->f->setNFreeKChar(self, '1', (baset*) c); 2518 ck_assert_ptr_ne(r2, null); 2519 r = self->f->getKChar(self, '1'); 2520 ck_assert_ptr_ne(r, null); 2521 char *s = toStringO(r); 2522 finishO(r); 2523 ck_assert_str_eq(s, "2"); 2524 free(s); 2525 terminateO(self); 2526 2527 } 2528 2529 2530 void getUndefinedKCharSmallDictT(CuTest *tc UNUSED) { 2531 2532 undefinedt* r; 2533 smallDictt *self = allocG(rtSmallDictt); 2534 2535 smallDictt *r2 = self->f->setUndefined(self, "1"); 2536 ck_assert_ptr_ne(r2, null); 2537 r = self->f->getUndefinedKChar(self, '1'); 2538 ck_assert_ptr_ne(r, null); 2539 terminateO(r); 2540 terminateO(self); 2541 2542 } 2543 2544 2545 void getBoolKCharSmallDictT(CuTest *tc UNUSED) { 2546 2547 bool r; 2548 smallDictt *self = allocG(rtSmallDictt); 2549 2550 smallDictt *r2 = self->f->setBool(self, "1", true); 2551 ck_assert_ptr_ne(r2, null); 2552 r = self->f->getBoolKChar(self, '1'); 2553 ck_assert(r); 2554 terminateO(self); 2555 2556 } 2557 2558 2559 void getBoolPKCharSmallDictT(CuTest *tc UNUSED) { 2560 2561 bool* r; 2562 smallDictt *self = allocG(rtSmallDictt); 2563 2564 smallDictt *r2 = self->f->setBool(self, "1", true); 2565 ck_assert_ptr_ne(r2, null); 2566 r = self->f->getBoolPKChar(self, '1'); 2567 ck_assert_ptr_ne(r, null); 2568 ck_assert(*r); 2569 terminateO(self); 2570 2571 } 2572 2573 2574 void getDoubleKCharSmallDictT(CuTest *tc UNUSED) { 2575 2576 double r; 2577 smallDictt *self = allocG(rtSmallDictt); 2578 2579 smallDictt *r2 = self->f->setDouble(self, "1", 2.2); 2580 ck_assert_ptr_ne(r2, null); 2581 r = self->f->getDoubleKChar(self, '1'); 2582 ck_assert(r == 2.2); 2583 terminateO(self); 2584 2585 } 2586 2587 2588 void getDoublePKCharSmallDictT(CuTest *tc UNUSED) { 2589 2590 double* r; 2591 smallDictt *self = allocG(rtSmallDictt); 2592 2593 smallDictt *r2 = self->f->setDouble(self, "1", 2.2); 2594 ck_assert_ptr_ne(r2, null); 2595 r = self->f->getDoublePKChar(self, '1'); 2596 ck_assert_ptr_ne(r, null); 2597 ck_assert(*r == 2.2); 2598 terminateO(self); 2599 2600 } 2601 2602 2603 void getIntKCharSmallDictT(CuTest *tc UNUSED) { 2604 2605 int64_t r; 2606 smallDictt *self = allocG(rtSmallDictt); 2607 2608 smallDictt *r2 = self->f->setInt(self, "1", 2); 2609 ck_assert_ptr_ne(r2, null); 2610 r = self->f->getIntKChar(self, '1'); 2611 ck_assert_int_eq(r, 2); 2612 terminateO(self); 2613 2614 } 2615 2616 2617 void getIntPKCharSmallDictT(CuTest *tc UNUSED) { 2618 2619 int64_t* r; 2620 smallDictt *self = allocG(rtSmallDictt); 2621 2622 smallDictt *r2 = self->f->setInt(self, "1", 2); 2623 ck_assert_ptr_ne(r2, null); 2624 r = self->f->getIntPKChar(self, '1'); 2625 ck_assert_ptr_ne(r, null); 2626 ck_assert_int_eq(*r, 2); 2627 terminateO(self); 2628 2629 } 2630 2631 2632 void getInt32KCharSmallDictT(CuTest *tc UNUSED) { 2633 2634 int32_t r; 2635 smallDictt *self = allocG(rtSmallDictt); 2636 2637 smallDictt *r2 = self->f->setInt(self, "1", 2); 2638 ck_assert_ptr_ne(r2, null); 2639 r = self->f->getInt32KChar(self, '1'); 2640 ck_assert_int_eq(r, 2); 2641 terminateO(self); 2642 2643 } 2644 2645 2646 void getInt32PKCharSmallDictT(CuTest *tc UNUSED) { 2647 2648 int32_t* r; 2649 smallDictt *self = allocG(rtSmallDictt); 2650 2651 smallDictt *r2 = self->f->setInt(self, "1", 2); 2652 ck_assert_ptr_ne(r2, null); 2653 r = self->f->getInt32PKChar(self, '1'); 2654 ck_assert_ptr_ne(r, null); 2655 ck_assert_int_eq(*r, 2); 2656 terminateO(self); 2657 2658 } 2659 2660 2661 void getUintKCharSmallDictT(CuTest *tc UNUSED) { 2662 2663 uint64_t r; 2664 smallDictt *self = allocG(rtSmallDictt); 2665 2666 smallDictt *r2 = self->f->setInt(self, "1", 2); 2667 ck_assert_ptr_ne(r2, null); 2668 r = self->f->getUintKChar(self, '1'); 2669 ck_assert_int_eq(r, 2); 2670 terminateO(self); 2671 2672 } 2673 2674 2675 void getUintPKCharSmallDictT(CuTest *tc UNUSED) { 2676 2677 uint64_t* r; 2678 smallDictt *self = allocG(rtSmallDictt); 2679 2680 smallDictt *r2 = self->f->setInt(self, "1", 2); 2681 ck_assert_ptr_ne(r2, null); 2682 r = self->f->getUintPKChar(self, '1'); 2683 ck_assert_ptr_ne(r, null); 2684 ck_assert_int_eq(*r, 2); 2685 terminateO(self); 2686 2687 } 2688 2689 2690 void getUint32KCharSmallDictT(CuTest *tc UNUSED) { 2691 2692 uint32_t r; 2693 smallDictt *self = allocG(rtSmallDictt); 2694 2695 smallDictt *r2 = self->f->setInt(self, "1", 2); 2696 ck_assert_ptr_ne(r2, null); 2697 r = self->f->getUint32KChar(self, '1'); 2698 ck_assert_int_eq(r, 2); 2699 terminateO(self); 2700 2701 } 2702 2703 2704 void getUint32PKCharSmallDictT(CuTest *tc UNUSED) { 2705 2706 uint32_t* r; 2707 smallDictt *self = allocG(rtSmallDictt); 2708 2709 smallDictt *r2 = self->f->setInt(self, "1", 2); 2710 ck_assert_ptr_ne(r2, null); 2711 r = self->f->getUint32PKChar(self, '1'); 2712 ck_assert_ptr_ne(r, null); 2713 ck_assert_int_eq(*r, 2); 2714 terminateO(self); 2715 2716 } 2717 2718 2719 void getSKCharSmallDictT(CuTest *tc UNUSED) { 2720 2721 char* r; 2722 smallDictt *self = allocG(rtSmallDictt); 2723 2724 smallDictt *r2 = self->f->setS(self, "1", "qwe"); 2725 ck_assert_ptr_ne(r2, null); 2726 r = self->f->getSKChar(self, '1'); 2727 ck_assert_ptr_ne(r, null); 2728 ck_assert_str_eq(r, "qwe"); 2729 terminateO(self); 2730 2731 } 2732 2733 2734 void getDictKCharSmallDictT(CuTest *tc UNUSED) { 2735 2736 smallDictt* r; 2737 smallDictt *self = allocG(rtSmallDictt); 2738 2739 createAllocateSmallDict(d); 2740 smallDictt *r2 = self->f->setNFreeDict(self, "1", d); 2741 ck_assert_ptr_ne(r2, null); 2742 r = self->f->getDictKChar(self, '1'); 2743 ck_assert_ptr_ne(r, null); 2744 char *s = toStringO(r); 2745 finishO(r); 2746 ck_assert_str_eq(s, "{}"); 2747 free(s); 2748 terminateO(self); 2749 2750 } 2751 2752 2753 void getArrayKCharSmallDictT(CuTest *tc UNUSED) { 2754 2755 smallArrayt* r; 2756 smallDictt *self = allocG(rtSmallDictt); 2757 2758 createAllocateSmallArray(d); 2759 smallDictt *r2 = self->f->setNFreeArray(self, "1", d); 2760 ck_assert_ptr_ne(r2, null); 2761 r = self->f->getArrayKChar(self, '1'); 2762 ck_assert_ptr_ne(r, null); 2763 char *s = toStringO(r); 2764 finishO(r); 2765 ck_assert_str_eq(s, "[]"); 2766 free(s); 2767 terminateO(self); 2768 2769 } 2770 2771 2772 void getSmallBoolKCharSmallDictT(CuTest *tc UNUSED) { 2773 2774 smallBoolt* r; 2775 smallDictt *self = allocG(rtSmallDictt); 2776 2777 createAllocateSmallBool(d); 2778 smallDictt *r2 = self->f->setNFreeSmallBool(self, "1", d); 2779 ck_assert_ptr_ne(r2, null); 2780 r = self->f->getSmallBoolKChar(self, '1'); 2781 ck_assert_ptr_ne(r, null); 2782 char *s = toStringO(r); 2783 finishO(r); 2784 ck_assert_str_eq(s, "false"); 2785 free(s); 2786 terminateO(self); 2787 2788 } 2789 2790 2791 void getSmallBytesKCharSmallDictT(CuTest *tc UNUSED) { 2792 2793 smallBytest* r; 2794 smallDictt *self = allocG(rtSmallDictt); 2795 2796 createAllocateSmallBytes(d); 2797 smallDictt *r2 = self->f->setNFreeSmallBytes(self, "1", d); 2798 ck_assert_ptr_ne(r2, null); 2799 r = self->f->getSmallBytesKChar(self, '1'); 2800 ck_assert_ptr_ne(r, null); 2801 char *s = toStringO(r); 2802 finishO(r); 2803 ck_assert_str_eq(s, "[]"); 2804 free(s); 2805 terminateO(self); 2806 2807 } 2808 2809 2810 void getSmallDoubleKCharSmallDictT(CuTest *tc UNUSED) { 2811 2812 smallDoublet* r; 2813 smallDictt *self = allocG(rtSmallDictt); 2814 2815 createAllocateSmallDouble(d); 2816 smallDictt *r2 = self->f->setNFreeSmallDouble(self, "1", d); 2817 ck_assert_ptr_ne(r2, null); 2818 r = self->f->getSmallDoubleKChar(self, '1'); 2819 ck_assert_ptr_ne(r, null); 2820 char *s = toStringO(r); 2821 finishO(r); 2822 ck_assert_str_eq(s, "0.000000e+00"); 2823 free(s); 2824 terminateO(self); 2825 2826 } 2827 2828 2829 void getSmallIntKCharSmallDictT(CuTest *tc UNUSED) { 2830 2831 smallIntt* r; 2832 smallDictt *self = allocG(rtSmallDictt); 2833 2834 createAllocateSmallInt(d); 2835 smallDictt *r2 = self->f->setNFreeSmallInt(self, "1", d); 2836 ck_assert_ptr_ne(r2, null); 2837 r = self->f->getSmallIntKChar(self, '1'); 2838 ck_assert_ptr_ne(r, null); 2839 char *s = toStringO(r); 2840 finishO(r); 2841 ck_assert_str_eq(s, "0"); 2842 free(s); 2843 terminateO(self); 2844 2845 } 2846 2847 2848 void getSmallJsonKCharSmallDictT(CuTest *tc UNUSED) { 2849 2850 smallJsont* r; 2851 smallDictt *self = allocG(rtSmallDictt); 2852 2853 createAllocateSmallJson(d); 2854 smallDictt *r2 = self->f->setNFreeSmallJson(self, "1", d); 2855 ck_assert_ptr_ne(r2, null); 2856 r = self->f->getSmallJsonKChar(self, '1'); 2857 ck_assert_ptr_ne(r, null); 2858 char *s = toStringO(r); 2859 finishO(r); 2860 ck_assert_str_eq(s, "{}"); 2861 free(s); 2862 terminateO(self); 2863 2864 } 2865 2866 2867 void getSmallStringKCharSmallDictT(CuTest *tc UNUSED) { 2868 2869 smallStringt* r; 2870 smallDictt *self = allocG(rtSmallDictt); 2871 2872 createAllocateSmallString(d); 2873 smallDictt *r2 = self->f->setNFreeSmallString(self, "1", d); 2874 ck_assert_ptr_ne(r2, null); 2875 r = self->f->getSmallStringKChar(self, '1'); 2876 ck_assert_ptr_ne(r, null); 2877 char *s = toStringO(r); 2878 finishO(r); 2879 ck_assert_str_eq(s, ""); 2880 free(s); 2881 terminateO(self); 2882 2883 } 2884 2885 2886 void getVoidKCharSmallDictT(CuTest *tc UNUSED) { 2887 2888 void* r; 2889 smallDictt *self = allocG(rtSmallDictt); 2890 2891 smallContainert* d = allocSmallContainer(&r); 2892 smallDictt *r2 = self->f->setNFreeSmallContainer(self, "1", d); 2893 ck_assert_ptr_ne(r2, null); 2894 r = self->f->getVoidKChar(self, '1'); 2895 ck_assert_ptr_eq(r, &r); 2896 terminateO(self); 2897 2898 } 2899 2900 2901 void getSmallContainerKCharSmallDictT(CuTest *tc UNUSED) { 2902 2903 smallContainert* r; 2904 smallDictt *self = allocG(rtSmallDictt); 2905 2906 createAllocateSmallContainer(d); 2907 smallDictt *r2 = self->f->setNFreeSmallContainer(self, "1", d); 2908 ck_assert_ptr_ne(r2, null); 2909 r = self->f->getSmallContainerKChar(self, '1'); 2910 ck_assert_ptr_ne(r, null); 2911 char *s = toStringO(r); 2912 finishO(r); 2913 ck_assert_str_eq(s, "<data smallContainer>"); 2914 free(s); 2915 terminateO(self); 2916 2917 } 2918 2919 2920 void getNDupSmallDictT(CuTest *tc UNUSED) { 2921 2922 baset* r; 2923 smallDictt *self = allocG(rtSmallDictt); 2924 2925 smallIntt *c = allocSmallInt(2); 2926 smallDictt *r2 = self->f->setNFreeKChar(self, '1', (baset*) c); 2927 ck_assert_ptr_ne(r2, null); 2928 r = self->f->getNDup(self, "1"); 2929 ck_assert_ptr_ne(r, null); 2930 char *s = toStringO(r); 2931 terminateO(r); 2932 ck_assert_str_eq(s, "2"); 2933 free(s); 2934 // other base class 2935 smallIntt *t = allocSmallInt(3); 2936 t->type = "randomClass"; 2937 r2 = self->f->setNFree(self, "1", (baset*)t); 2938 ck_assert_ptr_ne(r2, null); 2939 r = self->f->getNDup(self, "1"); 2940 ck_assert_ptr_ne(r, null); 2941 s = toStringO(r); 2942 terminateO(r); 2943 ck_assert_str_eq(s, "3"); 2944 free(s); 2945 // null key 2946 r = self->f->getNDup(self, null); 2947 ck_assert_ptr_eq(r, null); 2948 // empty self 2949 freeO(self); 2950 r = self->f->getNDup(self, "1"); 2951 ck_assert_ptr_eq(r, null); 2952 terminateO(self); 2953 2954 } 2955 2956 2957 void getNDupUndefinedSmallDictT(CuTest *tc UNUSED) { 2958 2959 undefinedt* r; 2960 smallDictt *self = allocG(rtSmallDictt); 2961 2962 smallDictt *r2 = self->f->setUndefined(self, "1"); 2963 ck_assert_ptr_ne(r2, null); 2964 r = self->f->getNDupUndefined(self, "1"); 2965 ck_assert_ptr_ne(r, null); 2966 terminateO(r); 2967 // non undefined object 2968 r2 = self->f->setInt(self, "1", 2); 2969 ck_assert_ptr_ne(r2, null); 2970 r = self->f->getNDupUndefined(self, "1"); 2971 ck_assert_ptr_eq(r, null); 2972 // null key 2973 r = self->f->getNDupUndefined(self, null); 2974 ck_assert_ptr_eq(r, null); 2975 // empty self 2976 freeO(self); 2977 r = self->f->getNDupUndefined(self, "1"); 2978 ck_assert_ptr_eq(r, null); 2979 terminateO(self); 2980 2981 } 2982 2983 2984 void getNDupBoolSmallDictT(CuTest *tc UNUSED) { 2985 2986 bool r; 2987 smallDictt *self = allocG(rtSmallDictt); 2988 2989 smallDictt *r2 = self->f->setBool(self, "1", true); 2990 ck_assert_ptr_ne(r2, null); 2991 r = self->f->getNDupBool(self, "1"); 2992 ck_assert(r); 2993 // non bool object 2994 r2 = self->f->setInt(self, "1", 2); 2995 ck_assert_ptr_ne(r2, null); 2996 r = self->f->getNDupBool(self, "1"); 2997 ck_assert(!r); 2998 // null key 2999 r = self->f->getNDupBool(self, null); 3000 ck_assert(!r); 3001 // empty self 3002 freeO(self); 3003 r = self->f->getNDupBool(self, "1"); 3004 ck_assert(!r); 3005 terminateO(self); 3006 3007 } 3008 3009 3010 void getNDupDoubleSmallDictT(CuTest *tc UNUSED) { 3011 3012 double r; 3013 smallDictt *self = allocG(rtSmallDictt); 3014 3015 smallDictt *r2 = self->f->setDouble(self, "1", 2.2); 3016 ck_assert_ptr_ne(r2, null); 3017 r = self->f->getNDupDouble(self, "1"); 3018 ck_assert(r == 2.2); 3019 // non double object 3020 r2 = self->f->setInt(self, "1", 2); 3021 ck_assert_ptr_ne(r2, null); 3022 r = self->f->getNDupDouble(self, "1"); 3023 ck_assert(r == 0); 3024 // null key 3025 r = self->f->getNDupDouble(self, null); 3026 ck_assert(r == 0); 3027 // empty self 3028 freeO(self); 3029 r = self->f->getNDupDouble(self, "1"); 3030 ck_assert(!r); 3031 terminateO(self); 3032 3033 } 3034 3035 3036 void getNDupIntSmallDictT(CuTest *tc UNUSED) { 3037 3038 int64_t r; 3039 smallDictt *self = allocG(rtSmallDictt); 3040 3041 smallDictt *r2 = self->f->setInt(self, "1", 2); 3042 ck_assert_ptr_ne(r2, null); 3043 r = self->f->getNDupInt(self, "1"); 3044 ck_assert_int_eq(r, 2); 3045 // non int object 3046 r2 = self->f->setBool(self, "1", true); 3047 ck_assert_ptr_ne(r2, null); 3048 r = self->f->getNDupInt(self, "1"); 3049 ck_assert(!r); 3050 // null key 3051 r = self->f->getNDupInt(self, null); 3052 ck_assert_int_eq(r, 0); 3053 // empty self 3054 freeO(self); 3055 r = self->f->getNDupInt(self, "1"); 3056 ck_assert(!r); 3057 terminateO(self); 3058 3059 } 3060 3061 3062 void getNDupInt32SmallDictT(CuTest *tc UNUSED) { 3063 3064 int32_t r; 3065 smallDictt *self = allocG(rtSmallDictt); 3066 3067 smallDictt *r2 = self->f->setInt(self, "1", 2); 3068 ck_assert_ptr_ne(r2, null); 3069 r = self->f->getNDupInt32(self, "1"); 3070 ck_assert_int_eq(r, 2); 3071 // non int object 3072 r2 = self->f->setBool(self, "1", true); 3073 ck_assert_ptr_ne(r2, null); 3074 r = self->f->getNDupInt32(self, "1"); 3075 ck_assert(!r); 3076 // null key 3077 r = self->f->getNDupInt32(self, null); 3078 ck_assert_int_eq(r, 0); 3079 // empty self 3080 freeO(self); 3081 r = self->f->getNDupInt32(self, "1"); 3082 ck_assert(!r); 3083 terminateO(self); 3084 3085 } 3086 3087 3088 void getNDupUintSmallDictT(CuTest *tc UNUSED) { 3089 3090 uint64_t r; 3091 smallDictt *self = allocG(rtSmallDictt); 3092 3093 smallDictt *r2 = self->f->setInt(self, "1", 2); 3094 ck_assert_ptr_ne(r2, null); 3095 r = self->f->getNDupUint(self, "1"); 3096 ck_assert_int_eq(r, 2); 3097 // non int object 3098 r2 = self->f->setBool(self, "1", true); 3099 ck_assert_ptr_ne(r2, null); 3100 r = self->f->getNDupUint(self, "1"); 3101 ck_assert(!r); 3102 // null key 3103 r = self->f->getNDupUint(self, null); 3104 ck_assert_int_eq(r, 0); 3105 // empty self 3106 freeO(self); 3107 r = self->f->getNDupUint(self, "1"); 3108 ck_assert(!r); 3109 terminateO(self); 3110 3111 } 3112 3113 3114 void getNDupUint32SmallDictT(CuTest *tc UNUSED) { 3115 3116 uint32_t r; 3117 smallDictt *self = allocG(rtSmallDictt); 3118 3119 smallDictt *r2 = self->f->setInt(self, "1", 2); 3120 ck_assert_ptr_ne(r2, null); 3121 r = self->f->getNDupUint32(self, "1"); 3122 ck_assert_int_eq(r, 2); 3123 // non int object 3124 r2 = self->f->setBool(self, "1", true); 3125 ck_assert_ptr_ne(r2, null); 3126 r = self->f->getNDupUint32(self, "1"); 3127 ck_assert(!r); 3128 // null key 3129 r = self->f->getNDupUint32(self, null); 3130 ck_assert_int_eq(r, 0); 3131 // empty self 3132 freeO(self); 3133 r = self->f->getNDupUint32(self, "1"); 3134 ck_assert(!r); 3135 terminateO(self); 3136 3137 } 3138 3139 3140 void getNDupSSmallDictT(CuTest *tc UNUSED) { 3141 3142 char* r; 3143 smallDictt *self = allocG(rtSmallDictt); 3144 3145 smallDictt *r2 = self->f->setS(self, "1", "qwe"); 3146 ck_assert_ptr_ne(r2, null); 3147 r = self->f->getNDupS(self, "1"); 3148 ck_assert_ptr_ne(r, null); 3149 ck_assert_str_eq(r, "qwe"); 3150 free(r); 3151 // non string object 3152 r2 = self->f->setBool(self, "1", true); 3153 ck_assert_ptr_ne(r2, null); 3154 r = self->f->getNDupS(self, "1"); 3155 ck_assert_ptr_eq(r, null); 3156 // null key 3157 r = self->f->getNDupS(self, null); 3158 ck_assert_ptr_eq(r, null); 3159 // empty self 3160 freeO(self); 3161 r = self->f->getNDupS(self, "1"); 3162 ck_assert_ptr_eq(r, null); 3163 terminateO(self); 3164 3165 } 3166 3167 3168 void getNDupDictSmallDictT(CuTest *tc UNUSED) { 3169 3170 smallDictt* r; 3171 smallDictt *self = allocG(rtSmallDictt); 3172 3173 createAllocateSmallDict(d); 3174 smallDictt *r2 = self->f->setNFreeDict(self, "1", d); 3175 ck_assert_ptr_ne(r2, null); 3176 r = self->f->getNDupDict(self, "1"); 3177 ck_assert_ptr_ne(r, null); 3178 char *s = toStringO(r); 3179 terminateO(r); 3180 ck_assert_str_eq(s, "{}"); 3181 free(s); 3182 // non dict object 3183 r2 = self->f->setBool(self, "1", true); 3184 ck_assert_ptr_ne(r2, null); 3185 r = self->f->getNDupDict(self, "1"); 3186 ck_assert_ptr_eq(r, null); 3187 // null key 3188 r = self->f->getNDupDict(self, null); 3189 ck_assert_ptr_eq(r, null); 3190 // empty self 3191 freeO(self); 3192 r = self->f->getNDupDict(self, "1"); 3193 ck_assert_ptr_eq(r, null); 3194 terminateO(self); 3195 3196 } 3197 3198 3199 void getNDupArraySmallDictT(CuTest *tc UNUSED) { 3200 3201 smallArrayt* r; 3202 smallDictt *self = allocG(rtSmallDictt); 3203 3204 createAllocateSmallArray(d); 3205 smallDictt *r2 = self->f->setNFreeArray(self, "1", d); 3206 ck_assert_ptr_ne(r2, null); 3207 r = self->f->getNDupArray(self, "1"); 3208 ck_assert_ptr_ne(r, null); 3209 char *s = toStringO(r); 3210 terminateO(r); 3211 ck_assert_str_eq(s, "[]"); 3212 free(s); 3213 // non Array object 3214 r2 = self->f->setBool(self, "1", true); 3215 ck_assert_ptr_ne(r2, null); 3216 r = self->f->getNDupArray(self, "1"); 3217 ck_assert_ptr_eq(r, null); 3218 // null key 3219 r = self->f->getNDupArray(self, null); 3220 ck_assert_ptr_eq(r, null); 3221 // empty self 3222 freeO(self); 3223 r = self->f->getNDupArray(self, "1"); 3224 ck_assert_ptr_eq(r, null); 3225 terminateO(self); 3226 3227 } 3228 3229 3230 void getNDupSmallBoolSmallDictT(CuTest *tc UNUSED) { 3231 3232 smallBoolt* r; 3233 smallDictt *self = allocG(rtSmallDictt); 3234 3235 createAllocateSmallBool(d); 3236 smallDictt *r2 = self->f->setNFreeSmallBool(self, "1", d); 3237 ck_assert_ptr_ne(r2, null); 3238 r = self->f->getNDupSmallBool(self, "1"); 3239 ck_assert_ptr_ne(r, null); 3240 char *s = toStringO(r); 3241 terminateO(r); 3242 ck_assert_str_eq(s, "false"); 3243 free(s); 3244 // non SmallBool object 3245 r2 = self->f->setInt(self, "1", 0); 3246 ck_assert_ptr_ne(r2, null); 3247 r = self->f->getNDupSmallBool(self, "1"); 3248 ck_assert_ptr_eq(r, null); 3249 // null key 3250 r = self->f->getNDupSmallBool(self, null); 3251 ck_assert_ptr_eq(r, null); 3252 // empty self 3253 freeO(self); 3254 r = self->f->getNDupSmallBool(self, "1"); 3255 ck_assert_ptr_eq(r, null); 3256 terminateO(self); 3257 3258 } 3259 3260 3261 void getNDupSmallBytesSmallDictT(CuTest *tc UNUSED) { 3262 3263 smallBytest* r; 3264 smallDictt *self = allocG(rtSmallDictt); 3265 3266 createAllocateSmallBytes(d); 3267 smallDictt *r2 = self->f->setNFreeSmallBytes(self, "1", d); 3268 ck_assert_ptr_ne(r2, null); 3269 r = self->f->getNDupSmallBytes(self, "1"); 3270 ck_assert_ptr_ne(r, null); 3271 char *s = toStringO(r); 3272 terminateO(r); 3273 ck_assert_str_eq(s, "[]"); 3274 free(s); 3275 // non SmallBytes object 3276 r2 = self->f->setBool(self, "1", true); 3277 ck_assert_ptr_ne(r2, null); 3278 r = self->f->getNDupSmallBytes(self, "1"); 3279 ck_assert_ptr_eq(r, null); 3280 // null key 3281 r = self->f->getNDupSmallBytes(self, null); 3282 ck_assert_ptr_eq(r, null); 3283 // empty self 3284 freeO(self); 3285 r = self->f->getNDupSmallBytes(self, "1"); 3286 ck_assert_ptr_eq(r, null); 3287 terminateO(self); 3288 3289 } 3290 3291 3292 void getNDupSmallDoubleSmallDictT(CuTest *tc UNUSED) { 3293 3294 smallDoublet* r; 3295 smallDictt *self = allocG(rtSmallDictt); 3296 3297 createAllocateSmallDouble(d); 3298 smallDictt *r2 = self->f->setNFreeSmallDouble(self, "1", d); 3299 ck_assert_ptr_ne(r2, null); 3300 r = self->f->getNDupSmallDouble(self, "1"); 3301 ck_assert_ptr_ne(r, null); 3302 char *s = toStringO(r); 3303 terminateO(r); 3304 ck_assert_str_eq(s, "0.000000e+00"); 3305 free(s); 3306 // non SmallDouble object 3307 r2 = self->f->setBool(self, "1", true); 3308 ck_assert_ptr_ne(r2, null); 3309 r = self->f->getNDupSmallDouble(self, "1"); 3310 ck_assert_ptr_eq(r, null); 3311 // null key 3312 r = self->f->getNDupSmallDouble(self, null); 3313 ck_assert_ptr_eq(r, null); 3314 // empty self 3315 freeO(self); 3316 r = self->f->getNDupSmallDouble(self, "1"); 3317 ck_assert_ptr_eq(r, null); 3318 terminateO(self); 3319 3320 } 3321 3322 3323 void getNDupSmallIntSmallDictT(CuTest *tc UNUSED) { 3324 3325 smallIntt* r; 3326 smallDictt *self = allocG(rtSmallDictt); 3327 3328 createAllocateSmallInt(d); 3329 smallDictt *r2 = self->f->setNFreeSmallInt(self, "1", d); 3330 ck_assert_ptr_ne(r2, null); 3331 r = self->f->getNDupSmallInt(self, "1"); 3332 ck_assert_ptr_ne(r, null); 3333 char *s = toStringO(r); 3334 terminateO(r); 3335 ck_assert_str_eq(s, "0"); 3336 free(s); 3337 // non SmallInt object 3338 r2 = self->f->setBool(self, "1", true); 3339 ck_assert_ptr_ne(r2, null); 3340 r = self->f->getNDupSmallInt(self, "1"); 3341 ck_assert_ptr_eq(r, null); 3342 // null key 3343 r = self->f->getNDupSmallInt(self, null); 3344 ck_assert_ptr_eq(r, null); 3345 // empty self 3346 freeO(self); 3347 r = self->f->getNDupSmallInt(self, "1"); 3348 ck_assert_ptr_eq(r, null); 3349 terminateO(self); 3350 3351 } 3352 3353 3354 void getNDupSmallJsonSmallDictT(CuTest *tc UNUSED) { 3355 3356 smallJsont* r; 3357 smallDictt *self = allocG(rtSmallDictt); 3358 3359 createAllocateSmallJson(d); 3360 smallDictt *r2 = self->f->setNFreeSmallJson(self, "1", d); 3361 ck_assert_ptr_ne(r2, null); 3362 r = self->f->getNDupSmallJson(self, "1"); 3363 ck_assert_ptr_ne(r, null); 3364 char *s = toStringO(r); 3365 terminateO(r); 3366 ck_assert_str_eq(s, "{}"); 3367 free(s); 3368 r2 = self->f->setBool(self, "1", true); 3369 ck_assert_ptr_ne(r2, null); 3370 r = self->f->getNDupSmallJson(self, "1"); 3371 ck_assert_ptr_ne(r, null); 3372 s = toStringO(r); 3373 terminateO(r); 3374 ck_assert_str_eq(s, "true"); 3375 free(s); 3376 // non SmallJson object 3377 smallContainert *c = allocSmallContainer(NULL); 3378 r2 = self->f->setNFreeSmallContainer(self, "1", c); 3379 ck_assert_ptr_ne(r2, null); 3380 r = self->f->getNDupSmallJson(self, "1"); 3381 ck_assert_ptr_eq(r, null); 3382 // null key 3383 r = self->f->getNDupSmallJson(self, null); 3384 ck_assert_ptr_eq(r, null); 3385 // empty self 3386 freeO(self); 3387 r = self->f->getNDupSmallJson(self, "1"); 3388 ck_assert_ptr_eq(r, null); 3389 terminateO(self); 3390 3391 } 3392 3393 3394 void getNDupSmallStringSmallDictT(CuTest *tc UNUSED) { 3395 3396 smallStringt* r; 3397 smallDictt *self = allocG(rtSmallDictt); 3398 3399 createAllocateSmallString(d); 3400 smallDictt *r2 = self->f->setNFreeSmallString(self, "1", d); 3401 ck_assert_ptr_ne(r2, null); 3402 r = self->f->getNDupSmallString(self, "1"); 3403 ck_assert_ptr_ne(r, null); 3404 char *s = toStringO(r); 3405 terminateO(r); 3406 ck_assert_str_eq(s, ""); 3407 free(s); 3408 // non SmallString object 3409 r2 = self->f->setBool(self, "1", true); 3410 ck_assert_ptr_ne(r2, null); 3411 r = self->f->getNDupSmallString(self, "1"); 3412 ck_assert_ptr_eq(r, null); 3413 // null key 3414 r = self->f->getNDupSmallString(self, null); 3415 ck_assert_ptr_eq(r, null); 3416 // empty self 3417 freeO(self); 3418 r = self->f->getNDupSmallString(self, "1"); 3419 ck_assert_ptr_eq(r, null); 3420 terminateO(self); 3421 3422 } 3423 3424 3425 void getNDupVoidSmallDictT(CuTest *tc UNUSED) { 3426 3427 void* r; 3428 smallDictt *self = allocG(rtSmallDictt); 3429 3430 smallContainert* d = allocSmallContainer(&r); 3431 smallDictt *r2 = self->f->setNFreeSmallContainer(self, "1", d); 3432 ck_assert_ptr_ne(r2, null); 3433 r = self->f->getNDupVoid(self, "1"); 3434 // result is null because the duplicate function in the container 3435 // is not set. 3436 ck_assert_ptr_eq(r, null); 3437 // non container object 3438 r2 = self->f->setBool(self, "1", true); 3439 ck_assert_ptr_ne(r2, null); 3440 r = self->f->getNDupVoid(self, "1"); 3441 ck_assert_ptr_eq(r, null); 3442 // null key 3443 r = self->f->getNDupVoid(self, null); 3444 ck_assert_ptr_eq(r, null); 3445 // empty self 3446 freeO(self); 3447 r = self->f->getNDupVoid(self, "1"); 3448 ck_assert_ptr_eq(r, null); 3449 terminateO(self); 3450 3451 } 3452 3453 3454 void getNDupSmallContainerSmallDictT(CuTest *tc UNUSED) { 3455 3456 smallContainert* r; 3457 smallDictt *self = allocG(rtSmallDictt); 3458 3459 createAllocateSmallContainer(d); 3460 smallDictt *r2 = self->f->setNFreeSmallContainer(self, "1", d); 3461 ck_assert_ptr_ne(r2, null); 3462 r = self->f->getNDupSmallContainer(self, "1"); 3463 ck_assert_ptr_ne(r, null); 3464 char *s = toStringO(r); 3465 terminateO(r); 3466 ck_assert_str_eq(s, "<data smallContainer>"); 3467 free(s); 3468 // other base class 3469 smallIntt *t = allocSmallInt(2); 3470 t->type = "randomClass"; 3471 r2 = self->f->setNFree(self, "1", (baset*)t); 3472 ck_assert_ptr_ne(r2, null); 3473 r = self->f->getNDupSmallContainer(self, "1"); 3474 ck_assert_ptr_eq(r, null); 3475 // non SmallContainer object 3476 r2 = self->f->setBool(self, "1", true); 3477 ck_assert_ptr_ne(r2, null); 3478 r = self->f->getNDupSmallContainer(self, "1"); 3479 ck_assert_ptr_eq(r, null); 3480 // null key 3481 r = self->f->getNDupSmallContainer(self, null); 3482 ck_assert_ptr_eq(r, null); 3483 // empty self 3484 freeO(self); 3485 r = self->f->getNDupSmallContainer(self, "1"); 3486 ck_assert_ptr_eq(r, null); 3487 terminateO(self); 3488 3489 } 3490 3491 3492 void getNDupKCharSmallDictT(CuTest *tc UNUSED) { 3493 3494 baset* r; 3495 smallDictt *self = allocG(rtSmallDictt); 3496 3497 smallIntt *c = allocSmallInt(2); 3498 smallDictt *r2 = self->f->setNFreeKChar(self, '1', (baset*) c); 3499 ck_assert_ptr_ne(r2, null); 3500 r = self->f->getNDupKChar(self, '1'); 3501 ck_assert_ptr_ne(r, null); 3502 char *s = toStringO(r); 3503 terminateO(r); 3504 ck_assert_str_eq(s, "2"); 3505 free(s); 3506 terminateO(self); 3507 3508 } 3509 3510 3511 void getNDupUndefinedKCharSmallDictT(CuTest *tc UNUSED) { 3512 3513 undefinedt* r; 3514 smallDictt *self = allocG(rtSmallDictt); 3515 3516 smallDictt *r2 = self->f->setUndefined(self, "1"); 3517 ck_assert_ptr_ne(r2, null); 3518 r = self->f->getNDupUndefinedKChar(self, '1'); 3519 ck_assert_ptr_ne(r, null); 3520 terminateO(r); 3521 terminateO(self); 3522 3523 } 3524 3525 3526 void getNDupBoolKCharSmallDictT(CuTest *tc UNUSED) { 3527 3528 bool r; 3529 smallDictt *self = allocG(rtSmallDictt); 3530 3531 smallDictt *r2 = self->f->setBool(self, "1", true); 3532 ck_assert_ptr_ne(r2, null); 3533 r = self->f->getNDupBoolKChar(self, '1'); 3534 ck_assert(r); 3535 terminateO(self); 3536 3537 } 3538 3539 3540 void getNDupDoubleKCharSmallDictT(CuTest *tc UNUSED) { 3541 3542 double r; 3543 smallDictt *self = allocG(rtSmallDictt); 3544 3545 smallDictt *r2 = self->f->setDouble(self, "1", 2.2); 3546 ck_assert_ptr_ne(r2, null); 3547 r = self->f->getNDupDoubleKChar(self, '1'); 3548 ck_assert(r == 2.2); 3549 terminateO(self); 3550 3551 } 3552 3553 3554 void getNDupIntKCharSmallDictT(CuTest *tc UNUSED) { 3555 3556 int64_t r; 3557 smallDictt *self = allocG(rtSmallDictt); 3558 3559 smallDictt *r2 = self->f->setInt(self, "1", 2); 3560 ck_assert_ptr_ne(r2, null); 3561 r = self->f->getNDupIntKChar(self, '1'); 3562 ck_assert_int_eq(r, 2); 3563 terminateO(self); 3564 3565 } 3566 3567 3568 void getNDupInt32KCharSmallDictT(CuTest *tc UNUSED) { 3569 3570 int32_t r; 3571 smallDictt *self = allocG(rtSmallDictt); 3572 3573 smallDictt *r2 = self->f->setInt(self, "1", 2); 3574 ck_assert_ptr_ne(r2, null); 3575 r = self->f->getNDupInt32KChar(self, '1'); 3576 ck_assert_int_eq(r, 2); 3577 terminateO(self); 3578 3579 } 3580 3581 3582 void getNDupUintKCharSmallDictT(CuTest *tc UNUSED) { 3583 3584 uint64_t r; 3585 smallDictt *self = allocG(rtSmallDictt); 3586 3587 smallDictt *r2 = self->f->setInt(self, "1", 2); 3588 ck_assert_ptr_ne(r2, null); 3589 r = self->f->getNDupUintKChar(self, '1'); 3590 ck_assert_int_eq(r, 2); 3591 terminateO(self); 3592 3593 } 3594 3595 3596 void getNDupUint32KCharSmallDictT(CuTest *tc UNUSED) { 3597 3598 uint32_t r; 3599 smallDictt *self = allocG(rtSmallDictt); 3600 3601 smallDictt *r2 = self->f->setInt(self, "1", 2); 3602 ck_assert_ptr_ne(r2, null); 3603 r = self->f->getNDupUint32KChar(self, '1'); 3604 ck_assert_int_eq(r, 2); 3605 terminateO(self); 3606 3607 } 3608 3609 3610 void getNDupSKCharSmallDictT(CuTest *tc UNUSED) { 3611 3612 char* r; 3613 smallDictt *self = allocG(rtSmallDictt); 3614 3615 smallDictt *r2 = self->f->setS(self, "1", "qwe"); 3616 ck_assert_ptr_ne(r2, null); 3617 r = self->f->getNDupSKChar(self, '1'); 3618 ck_assert_ptr_ne(r, null); 3619 ck_assert_str_eq(r, "qwe"); 3620 free(r); 3621 terminateO(self); 3622 3623 } 3624 3625 3626 void getNDupDictKCharSmallDictT(CuTest *tc UNUSED) { 3627 3628 smallDictt* r; 3629 smallDictt *self = allocG(rtSmallDictt); 3630 3631 createAllocateSmallDict(d); 3632 smallDictt *r2 = self->f->setNFreeDict(self, "1", d); 3633 ck_assert_ptr_ne(r2, null); 3634 r = self->f->getNDupDictKChar(self, '1'); 3635 ck_assert_ptr_ne(r, null); 3636 char *s = toStringO(r); 3637 terminateO(r); 3638 ck_assert_str_eq(s, "{}"); 3639 free(s); 3640 terminateO(self); 3641 3642 } 3643 3644 3645 void getNDupArrayKCharSmallDictT(CuTest *tc UNUSED) { 3646 3647 smallArrayt* r; 3648 smallDictt *self = allocG(rtSmallDictt); 3649 3650 createAllocateSmallArray(d); 3651 smallDictt *r2 = self->f->setNFreeArray(self, "1", d); 3652 ck_assert_ptr_ne(r2, null); 3653 r = self->f->getNDupArrayKChar(self, '1'); 3654 ck_assert_ptr_ne(r, null); 3655 char *s = toStringO(r); 3656 terminateO(r); 3657 ck_assert_str_eq(s, "[]"); 3658 free(s); 3659 terminateO(self); 3660 3661 } 3662 3663 3664 void getNDupSmallBoolKCharSmallDictT(CuTest *tc UNUSED) { 3665 3666 smallBoolt* r; 3667 smallDictt *self = allocG(rtSmallDictt); 3668 3669 createAllocateSmallBool(d); 3670 smallDictt *r2 = self->f->setNFreeSmallBool(self, "1", d); 3671 ck_assert_ptr_ne(r2, null); 3672 r = self->f->getNDupSmallBoolKChar(self, '1'); 3673 ck_assert_ptr_ne(r, null); 3674 char *s = toStringO(r); 3675 terminateO(r); 3676 ck_assert_str_eq(s, "false"); 3677 free(s); 3678 terminateO(self); 3679 3680 } 3681 3682 3683 void getNDupSmallBytesKCharSmallDictT(CuTest *tc UNUSED) { 3684 3685 smallBytest* r; 3686 smallDictt *self = allocG(rtSmallDictt); 3687 3688 createAllocateSmallBytes(d); 3689 smallDictt *r2 = self->f->setNFreeSmallBytes(self, "1", d); 3690 ck_assert_ptr_ne(r2, null); 3691 r = self->f->getNDupSmallBytesKChar(self, '1'); 3692 ck_assert_ptr_ne(r, null); 3693 char *s = toStringO(r); 3694 terminateO(r); 3695 ck_assert_str_eq(s, "[]"); 3696 free(s); 3697 terminateO(self); 3698 3699 } 3700 3701 3702 void getNDupSmallDoubleKCharSmallDictT(CuTest *tc UNUSED) { 3703 3704 smallDoublet* r; 3705 smallDictt *self = allocG(rtSmallDictt); 3706 3707 createAllocateSmallDouble(d); 3708 smallDictt *r2 = self->f->setNFreeSmallDouble(self, "1", d); 3709 ck_assert_ptr_ne(r2, null); 3710 r = self->f->getNDupSmallDoubleKChar(self, '1'); 3711 ck_assert_ptr_ne(r, null); 3712 char *s = toStringO(r); 3713 terminateO(r); 3714 ck_assert_str_eq(s, "0.000000e+00"); 3715 free(s); 3716 terminateO(self); 3717 3718 } 3719 3720 3721 void getNDupSmallIntKCharSmallDictT(CuTest *tc UNUSED) { 3722 3723 smallIntt* r; 3724 smallDictt *self = allocG(rtSmallDictt); 3725 3726 createAllocateSmallInt(d); 3727 smallDictt *r2 = self->f->setNFreeSmallInt(self, "1", d); 3728 ck_assert_ptr_ne(r2, null); 3729 r = self->f->getNDupSmallIntKChar(self, '1'); 3730 ck_assert_ptr_ne(r, null); 3731 char *s = toStringO(r); 3732 terminateO(r); 3733 ck_assert_str_eq(s, "0"); 3734 free(s); 3735 terminateO(self); 3736 3737 } 3738 3739 3740 void getNDupSmallJsonKCharSmallDictT(CuTest *tc UNUSED) { 3741 3742 smallJsont* r; 3743 smallDictt *self = allocG(rtSmallDictt); 3744 3745 createAllocateSmallJson(d); 3746 smallDictt *r2 = self->f->setNFreeSmallJson(self, "1", d); 3747 ck_assert_ptr_ne(r2, null); 3748 r = self->f->getNDupSmallJsonKChar(self, '1'); 3749 ck_assert_ptr_ne(r, null); 3750 char *s = toStringO(r); 3751 terminateO(r); 3752 ck_assert_str_eq(s, "{}"); 3753 free(s); 3754 terminateO(self); 3755 3756 } 3757 3758 3759 void getNDupSmallStringKCharSmallDictT(CuTest *tc UNUSED) { 3760 3761 smallStringt* r; 3762 smallDictt *self = allocG(rtSmallDictt); 3763 3764 createAllocateSmallString(d); 3765 smallDictt *r2 = self->f->setNFreeSmallString(self, "1", d); 3766 ck_assert_ptr_ne(r2, null); 3767 r = self->f->getNDupSmallStringKChar(self, '1'); 3768 ck_assert_ptr_ne(r, null); 3769 char *s = toStringO(r); 3770 terminateO(r); 3771 ck_assert_str_eq(s, ""); 3772 free(s); 3773 terminateO(self); 3774 3775 } 3776 3777 3778 void getNDupVoidKCharSmallDictT(CuTest *tc UNUSED) { 3779 3780 void* r; 3781 smallDictt *self = allocG(rtSmallDictt); 3782 3783 smallContainert* d = allocSmallContainer(&r); 3784 smallDictt *r2 = self->f->setNFreeSmallContainer(self, "1", d); 3785 ck_assert_ptr_ne(r2, null); 3786 r = self->f->getNDupVoidKChar(self, '1'); 3787 // result is null because the duplicate function in the container 3788 // is not set. 3789 ck_assert_ptr_eq(r, null); 3790 terminateO(self); 3791 3792 } 3793 3794 3795 void getNDupSmallContainerKCharSmallDictT(CuTest *tc UNUSED) { 3796 3797 smallContainert* r; 3798 smallDictt *self = allocG(rtSmallDictt); 3799 3800 createAllocateSmallContainer(d); 3801 smallDictt *r2 = self->f->setNFreeSmallContainer(self, "1", d); 3802 ck_assert_ptr_ne(r2, null); 3803 r = self->f->getNDupSmallContainerKChar(self, '1'); 3804 ck_assert_ptr_ne(r, null); 3805 char *s = toStringO(r); 3806 terminateO(r); 3807 ck_assert_str_eq(s, "<data smallContainer>"); 3808 free(s); 3809 terminateO(self); 3810 3811 } 3812 3813 3814 void getNumSmallDictT(CuTest *tc UNUSED) { 3815 3816 double r; 3817 smallDictt *self = allocG(rtSmallDictt); 3818 smallDictt *r2; 3819 3820 r2 = self->f->setInt(self, "1", 1); 3821 ck_assert_ptr_ne(r2, null); 3822 r2 = self->f->setDouble(self, "2", 2.2); 3823 ck_assert_ptr_ne(r2, null); 3824 r2 = self->f->setS(self, "3", "2"); 3825 ck_assert_ptr_ne(r2, null); 3826 r = getNumO(self, "1"); 3827 ck_assert(r == 1); 3828 r = getNumO(self, "2"); 3829 ck_assert(r == 2.2); 3830 // not a number 3831 r = getNumO(self, "3"); 3832 ck_assert(r == 0); 3833 // null key 3834 r = getNumO(self, null); 3835 ck_assert(r == 0); 3836 // empty self 3837 freeO(self); 3838 r = getNumO(self, "1"); 3839 ck_assert(r == 0); 3840 terminateO(self); 3841 3842 } 3843 3844 3845 void cropElemSmallDictT(CuTest *tc UNUSED) { 3846 3847 baset* r; 3848 smallDictt *self = allocG(rtSmallDictt); 3849 smallDictt *r2; 3850 3851 r2 = self->f->setInt(self, "1", 1); 3852 ck_assert_ptr_ne(r2, null); 3853 r2 = self->f->setDouble(self, "2", 2.2); 3854 ck_assert_ptr_ne(r2, null); 3855 r2 = self->f->setS(self, "3", "2"); 3856 ck_assert_ptr_ne(r2, null); 3857 r2 = self->f->setUndefined(self, "u"); 3858 ck_assert_ptr_ne(r2, null); 3859 createSmallContainer(c); 3860 r2 = self->f->setSmallContainer(self, "c", &c); 3861 ck_assert_ptr_ne(r2, null); 3862 createAllocateSmallInt(I); 3863 setValG(I, 11); 3864 I->type = "anothertype"; 3865 r2 = self->f->set(self, "b", (baset*)I); 3866 ck_assert_ptr_ne(r2, null); 3867 // get int 3868 r = cropElemO(self, "3"); 3869 ck_assert_ptr_ne(r, null); 3870 char *s = toStringO(r); 3871 terminateO(r); 3872 ck_assert_str_eq(s, "2"); 3873 free(s); 3874 s = toStringO(self); 3875 ck_assert_str_eq(s, "{\"1\":1,\"2\":2.200000e+00,\"u\":null,\"c\":\"<data container>\",\"b\":\"<data container>\"}"); 3876 free(s); 3877 // undefined object 3878 r = cropElemO(self, "u"); 3879 ck_assert_ptr_ne(r, null); 3880 s = toStringO(r); 3881 terminateO(r); 3882 ck_assert_str_eq(s, "null"); 3883 free(s); 3884 s = toStringO(self); 3885 ck_assert_str_eq(s, "{\"1\":1,\"2\":2.200000e+00,\"c\":\"<data container>\",\"b\":\"<data container>\"}"); 3886 free(s); 3887 // container 3888 r = cropElemO(self, "c"); 3889 ck_assert_ptr_ne(r, null); 3890 s = toStringO(r); 3891 terminateO(r); 3892 ck_assert_str_eq(s, "<data smallContainer>"); 3893 free(s); 3894 s = toStringO(self); 3895 ck_assert_str_eq(s, "{\"1\":1,\"2\":2.200000e+00,\"b\":\"<data container>\"}"); 3896 free(s); 3897 // base object in container 3898 r = cropElemO(self, "b"); 3899 ck_assert_ptr_ne(r, null); 3900 s = toStringO(r); 3901 terminateO(r); 3902 ck_assert_str_eq(s, "11"); 3903 free(s); 3904 s = toStringO(self); 3905 ck_assert_str_eq(s, "{\"1\":1,\"2\":2.200000e+00}"); 3906 free(s); 3907 // non existing key 3908 r = cropElemO(self, "qwe"); 3909 ck_assert_ptr_eq(r, null); 3910 // null key 3911 r = cropElemO(self, null); 3912 ck_assert_ptr_eq(r, null); 3913 // empty self 3914 freeO(self); 3915 r = cropElemO(self, "1"); 3916 ck_assert_ptr_eq(r, null); 3917 terminateO(self); 3918 3919 } 3920 3921 3922 void cropElemUndefinedSmallDictT(CuTest *tc UNUSED) { 3923 3924 undefinedt* r; 3925 smallDictt *self = allocG(rtSmallDictt); 3926 smallDictt *r2; 3927 3928 r2 = self->f->setInt(self, "1", 1); 3929 ck_assert_ptr_ne(r2, null); 3930 r2 = self->f->setDouble(self, "2", 2.2); 3931 ck_assert_ptr_ne(r2, null); 3932 r2 = self->f->setUndefined(self, "u"); 3933 ck_assert_ptr_ne(r2, null); 3934 r = cropElemUndefinedO(self, "u"); 3935 ck_assert_ptr_ne(r, null); 3936 char *s = toStringO(r); 3937 terminateO(r); 3938 ck_assert_str_eq(s, "null"); 3939 free(s); 3940 s = toStringO(self); 3941 ck_assert_str_eq(s, "{\"1\":1,\"2\":2.200000e+00}"); 3942 free(s); 3943 // wrong object type 3944 r = cropElemUndefinedO(self, "1"); 3945 ck_assert_ptr_eq(r, null); 3946 s = toStringO(self); 3947 ck_assert_str_eq(s, "{\"1\":1,\"2\":2.200000e+00}"); 3948 free(s); 3949 // non existing key 3950 r = cropElemUndefinedO(self, "qwe"); 3951 ck_assert_ptr_eq(r, null); 3952 // null key 3953 r = cropElemUndefinedO(self, null); 3954 ck_assert_ptr_eq(r, null); 3955 // empty self 3956 freeO(self); 3957 r = cropElemUndefinedO(self, "1"); 3958 ck_assert_ptr_eq(r, null); 3959 terminateO(self); 3960 3961 } 3962 3963 3964 void cropElemBoolSmallDictT(CuTest *tc UNUSED) { 3965 3966 bool r; 3967 smallDictt *self = allocG(rtSmallDictt); 3968 smallDictt *r2; 3969 3970 r2 = self->f->setInt(self, "1", 1); 3971 ck_assert_ptr_ne(r2, null); 3972 r2 = self->f->setDouble(self, "2", 2.2); 3973 ck_assert_ptr_ne(r2, null); 3974 r2 = self->f->setBool(self, "b", true); 3975 ck_assert_ptr_ne(r2, null); 3976 createAllocateSmallInt(I); 3977 setValG(I, 11); 3978 I->type = "anothertype"; 3979 r2 = self->f->set(self, "B", (baset*)I); 3980 ck_assert_ptr_ne(r2, null); 3981 r = cropElemBoolO(self, "b"); 3982 ck_assert(r); 3983 char *s = toStringO(self); 3984 ck_assert_str_eq(s, "{\"1\":1,\"2\":2.200000e+00,\"B\":\"<data container>\"}"); 3985 free(s); 3986 // wrong object type 3987 r = cropElemBoolO(self, "1"); 3988 ck_assert(!r); 3989 s = toStringO(self); 3990 ck_assert_str_eq(s, "{\"1\":1,\"2\":2.200000e+00,\"B\":\"<data container>\"}"); 3991 free(s); 3992 r = cropElemBoolO(self, "B"); 3993 ck_assert(!r); 3994 s = toStringO(self); 3995 ck_assert_str_eq(s, "{\"1\":1,\"2\":2.200000e+00,\"B\":\"<data container>\"}"); 3996 free(s); 3997 // non existing key 3998 r = cropElemBoolO(self, "qwe"); 3999 ck_assert(!r); 4000 // null key 4001 r = cropElemBoolO(self, null); 4002 ck_assert(!r); 4003 // empty self 4004 freeO(self); 4005 r = cropElemBoolO(self, "1"); 4006 ck_assert(!r); 4007 terminateO(self); 4008 4009 } 4010 4011 4012 void cropElemDoubleSmallDictT(CuTest *tc UNUSED) { 4013 4014 double r; 4015 smallDictt *self = allocG(rtSmallDictt); 4016 smallDictt *r2; 4017 4018 r2 = self->f->setInt(self, "1", 1); 4019 ck_assert_ptr_ne(r2, null); 4020 r2 = self->f->setDouble(self, "2", 2.2); 4021 ck_assert_ptr_ne(r2, null); 4022 r2 = self->f->setDouble(self, "b", 3.3); 4023 ck_assert_ptr_ne(r2, null); 4024 createAllocateSmallInt(I); 4025 setValG(I, 11); 4026 I->type = "anothertype"; 4027 r2 = self->f->set(self, "B", (baset*)I); 4028 ck_assert_ptr_ne(r2, null); 4029 r = cropElemDoubleO(self, "b"); 4030 ck_assert(r == 3.3); 4031 char *s = toStringO(self); 4032 ck_assert_str_eq(s, "{\"1\":1,\"2\":2.200000e+00,\"B\":\"<data container>\"}"); 4033 free(s); 4034 // wrong object type 4035 r = cropElemDoubleO(self, "1"); 4036 ck_assert(!r); 4037 s = toStringO(self); 4038 ck_assert_str_eq(s, "{\"1\":1,\"2\":2.200000e+00,\"B\":\"<data container>\"}"); 4039 free(s); 4040 r = cropElemDoubleO(self, "B"); 4041 ck_assert(!r); 4042 s = toStringO(self); 4043 ck_assert_str_eq(s, "{\"1\":1,\"2\":2.200000e+00,\"B\":\"<data container>\"}"); 4044 free(s); 4045 // non existing key 4046 r = cropElemDoubleO(self, "qwe"); 4047 ck_assert(!r); 4048 // null key 4049 r = cropElemDoubleO(self, null); 4050 ck_assert(r == 0); 4051 // empty self 4052 freeO(self); 4053 r = cropElemDoubleO(self, "1"); 4054 ck_assert(r == 0); 4055 terminateO(self); 4056 4057 } 4058 4059 4060 void cropElemIntSmallDictT(CuTest *tc UNUSED) { 4061 4062 int64_t r; 4063 smallDictt *self = allocG(rtSmallDictt); 4064 smallDictt *r2; 4065 4066 r2 = self->f->setInt(self, "1", 1); 4067 ck_assert_ptr_ne(r2, null); 4068 r2 = self->f->setDouble(self, "2", 2.2); 4069 ck_assert_ptr_ne(r2, null); 4070 r2 = self->f->setInt(self, "b", 2); 4071 ck_assert_ptr_ne(r2, null); 4072 createAllocateSmallInt(I); 4073 setValG(I, 11); 4074 I->type = "anothertype"; 4075 r2 = self->f->set(self, "B", (baset*)I); 4076 ck_assert_ptr_ne(r2, null); 4077 r = cropElemIntO(self, "b"); 4078 ck_assert_int_eq(r, 2); 4079 char *s = toStringO(self); 4080 ck_assert_str_eq(s, "{\"1\":1,\"2\":2.200000e+00,\"B\":\"<data container>\"}"); 4081 free(s); 4082 // wrong object type 4083 r = cropElemIntO(self, "2"); 4084 ck_assert(!r); 4085 s = toStringO(self); 4086 ck_assert_str_eq(s, "{\"1\":1,\"2\":2.200000e+00,\"B\":\"<data container>\"}"); 4087 free(s); 4088 r = cropElemIntO(self, "B"); 4089 ck_assert(!r); 4090 s = toStringO(self); 4091 ck_assert_str_eq(s, "{\"1\":1,\"2\":2.200000e+00,\"B\":\"<data container>\"}"); 4092 free(s); 4093 // non existing key 4094 r = cropElemIntO(self, "qwe"); 4095 ck_assert(!r); 4096 //r = cropElemIntO(self); 4097 // null key 4098 r = cropElemIntO(self, null); 4099 ck_assert_int_eq(r, 0); 4100 // empty self 4101 freeO(self); 4102 r = cropElemIntO(self, "1"); 4103 ck_assert_int_eq(r, 0); 4104 terminateO(self); 4105 4106 } 4107 4108 4109 void cropElemInt32SmallDictT(CuTest *tc UNUSED) { 4110 4111 int32_t r; 4112 smallDictt *self = allocG(rtSmallDictt); 4113 smallDictt *r2; 4114 4115 r2 = self->f->setInt(self, "1", 1); 4116 ck_assert_ptr_ne(r2, null); 4117 r2 = self->f->setDouble(self, "2", 2.2); 4118 ck_assert_ptr_ne(r2, null); 4119 r2 = self->f->setInt(self, "b", 2); 4120 ck_assert_ptr_ne(r2, null); 4121 createAllocateSmallInt(I); 4122 setValG(I, 11); 4123 I->type = "anothertype"; 4124 r2 = self->f->set(self, "B", (baset*)I); 4125 ck_assert_ptr_ne(r2, null); 4126 r = cropElemInt32O(self, "b"); 4127 ck_assert_int_eq(r, 2); 4128 char *s = toStringO(self); 4129 ck_assert_str_eq(s, "{\"1\":1,\"2\":2.200000e+00,\"B\":\"<data container>\"}"); 4130 free(s); 4131 // wrong object type 4132 r = cropElemInt32O(self, "2"); 4133 ck_assert(!r); 4134 s = toStringO(self); 4135 ck_assert_str_eq(s, "{\"1\":1,\"2\":2.200000e+00,\"B\":\"<data container>\"}"); 4136 free(s); 4137 r = cropElemInt32O(self, "B"); 4138 ck_assert(!r); 4139 s = toStringO(self); 4140 ck_assert_str_eq(s, "{\"1\":1,\"2\":2.200000e+00,\"B\":\"<data container>\"}"); 4141 free(s); 4142 // non existing key 4143 r = cropElemInt32O(self, "qwe"); 4144 ck_assert(!r); 4145 // null key 4146 r = cropElemInt32O(self, null); 4147 ck_assert_int_eq(r, 0); 4148 // empty self 4149 freeO(self); 4150 r = cropElemInt32O(self, "1"); 4151 ck_assert_int_eq(r, 0); 4152 terminateO(self); 4153 4154 } 4155 4156 4157 void cropElemUintSmallDictT(CuTest *tc UNUSED) { 4158 4159 uint64_t r; 4160 smallDictt *self = allocG(rtSmallDictt); 4161 smallDictt *r2; 4162 4163 r2 = self->f->setInt(self, "1", 1); 4164 ck_assert_ptr_ne(r2, null); 4165 r2 = self->f->setDouble(self, "2", 2.2); 4166 ck_assert_ptr_ne(r2, null); 4167 r2 = self->f->setInt(self, "b", 2); 4168 ck_assert_ptr_ne(r2, null); 4169 createAllocateSmallInt(I); 4170 setValG(I, 11); 4171 I->type = "anothertype"; 4172 r2 = self->f->set(self, "B", (baset*)I); 4173 ck_assert_ptr_ne(r2, null); 4174 r = cropElemUintO(self, "b"); 4175 ck_assert_int_eq(r, 2); 4176 char *s = toStringO(self); 4177 ck_assert_str_eq(s, "{\"1\":1,\"2\":2.200000e+00,\"B\":\"<data container>\"}"); 4178 free(s); 4179 // wrong object type 4180 r = cropElemUintO(self, "2"); 4181 ck_assert(!r); 4182 s = toStringO(self); 4183 ck_assert_str_eq(s, "{\"1\":1,\"2\":2.200000e+00,\"B\":\"<data container>\"}"); 4184 free(s); 4185 r = cropElemUintO(self, "B"); 4186 ck_assert(!r); 4187 s = toStringO(self); 4188 ck_assert_str_eq(s, "{\"1\":1,\"2\":2.200000e+00,\"B\":\"<data container>\"}"); 4189 free(s); 4190 // non existing key 4191 r = cropElemUintO(self, "qwe"); 4192 ck_assert(!r); 4193 // null key 4194 r = cropElemUintO(self, null); 4195 ck_assert_int_eq(r, 0); 4196 // empty self 4197 freeO(self); 4198 r = cropElemUintO(self, "1"); 4199 ck_assert_int_eq(r, 0); 4200 terminateO(self); 4201 4202 } 4203 4204 4205 void cropElemUint32SmallDictT(CuTest *tc UNUSED) { 4206 4207 uint32_t r; 4208 smallDictt *self = allocG(rtSmallDictt); 4209 smallDictt *r2; 4210 4211 r2 = self->f->setInt(self, "1", 1); 4212 ck_assert_ptr_ne(r2, null); 4213 r2 = self->f->setDouble(self, "2", 2.2); 4214 ck_assert_ptr_ne(r2, null); 4215 r2 = self->f->setInt(self, "b", 2); 4216 ck_assert_ptr_ne(r2, null); 4217 createAllocateSmallInt(I); 4218 setValG(I, 11); 4219 I->type = "anothertype"; 4220 r2 = self->f->set(self, "B", (baset*)I); 4221 ck_assert_ptr_ne(r2, null); 4222 r = cropElemUint32O(self, "b"); 4223 ck_assert_int_eq(r, 2); 4224 char *s = toStringO(self); 4225 ck_assert_str_eq(s, "{\"1\":1,\"2\":2.200000e+00,\"B\":\"<data container>\"}"); 4226 free(s); 4227 // wrong object type 4228 r = cropElemUint32O(self, "2"); 4229 ck_assert(!r); 4230 s = toStringO(self); 4231 ck_assert_str_eq(s, "{\"1\":1,\"2\":2.200000e+00,\"B\":\"<data container>\"}"); 4232 free(s); 4233 r = cropElemUint32O(self, "B"); 4234 ck_assert(!r); 4235 s = toStringO(self); 4236 ck_assert_str_eq(s, "{\"1\":1,\"2\":2.200000e+00,\"B\":\"<data container>\"}"); 4237 free(s); 4238 // non existing key 4239 r = cropElemUint32O(self, "qwe"); 4240 ck_assert(!r); 4241 // null key 4242 r = cropElemUint32O(self, null); 4243 ck_assert_int_eq(r, 0); 4244 // empty self 4245 freeO(self); 4246 r = cropElemUint32O(self, "1"); 4247 ck_assert_int_eq(r, 0); 4248 terminateO(self); 4249 4250 } 4251 4252 4253 void cropElemSSmallDictT(CuTest *tc UNUSED) { 4254 4255 char* r; 4256 smallDictt *self = allocG(rtSmallDictt); 4257 smallDictt *r2; 4258 4259 r2 = self->f->setInt(self, "1", 1); 4260 ck_assert_ptr_ne(r2, null); 4261 r2 = self->f->setDouble(self, "2", 2.2); 4262 ck_assert_ptr_ne(r2, null); 4263 r2 = self->f->setS(self, "b", "qwe"); 4264 ck_assert_ptr_ne(r2, null); 4265 createAllocateSmallInt(I); 4266 setValG(I, 11); 4267 I->type = "anothertype"; 4268 r2 = self->f->set(self, "B", (baset*)I); 4269 ck_assert_ptr_ne(r2, null); 4270 r = cropElemSO(self, "b"); 4271 ck_assert_str_eq(r, "qwe"); 4272 free(r); 4273 char *s = toStringO(self); 4274 ck_assert_str_eq(s, "{\"1\":1,\"2\":2.200000e+00,\"B\":\"<data container>\"}"); 4275 free(s); 4276 // wrong object type 4277 r = cropElemSO(self, "2"); 4278 ck_assert_ptr_eq(r, null); 4279 s = toStringO(self); 4280 ck_assert_str_eq(s, "{\"1\":1,\"2\":2.200000e+00,\"B\":\"<data container>\"}"); 4281 free(s); 4282 r = cropElemSO(self, "B"); 4283 ck_assert_ptr_eq(r, null); 4284 s = toStringO(self); 4285 ck_assert_str_eq(s, "{\"1\":1,\"2\":2.200000e+00,\"B\":\"<data container>\"}"); 4286 free(s); 4287 // non existing key 4288 r = cropElemSO(self, "qwe"); 4289 ck_assert_ptr_eq(r, null); 4290 // null key 4291 r = cropElemSO(self, null); 4292 ck_assert_ptr_eq(r, null); 4293 // empty self 4294 freeO(self); 4295 r = cropElemSO(self, "1"); 4296 ck_assert_ptr_eq(r, null); 4297 terminateO(self); 4298 4299 } 4300 4301 4302 void cropElemDictSmallDictT(CuTest *tc UNUSED) { 4303 4304 smallDictt* r; 4305 smallDictt *self = allocG(rtSmallDictt); 4306 smallDictt *r2; 4307 4308 r2 = self->f->setInt(self, "1", 1); 4309 ck_assert_ptr_ne(r2, null); 4310 r2 = self->f->setDouble(self, "2", 2.2); 4311 ck_assert_ptr_ne(r2, null); 4312 createAllocateSmallDict(d); 4313 r2 = self->f->setNFreeDict(self, "b", d); 4314 ck_assert_ptr_ne(r2, null); 4315 createAllocateSmallInt(I); 4316 setValG(I, 11); 4317 I->type = "anothertype"; 4318 r2 = self->f->set(self, "B", (baset*)I); 4319 ck_assert_ptr_ne(r2, null); 4320 r = cropElemDictO(self, "b"); 4321 ck_assert_ptr_ne(r, null); 4322 char *s = toStringO(r); 4323 terminateO(r); 4324 ck_assert_str_eq(s, "{}"); 4325 free(s); 4326 s = toStringO(self); 4327 ck_assert_str_eq(s, "{\"1\":1,\"2\":2.200000e+00,\"B\":\"<data container>\"}"); 4328 free(s); 4329 // wrong object type 4330 r = cropElemDictO(self, "2"); 4331 ck_assert_ptr_eq(r, null); 4332 s = toStringO(self); 4333 ck_assert_str_eq(s, "{\"1\":1,\"2\":2.200000e+00,\"B\":\"<data container>\"}"); 4334 free(s); 4335 r = cropElemDictO(self, "B"); 4336 ck_assert_ptr_eq(r, null); 4337 s = toStringO(self); 4338 ck_assert_str_eq(s, "{\"1\":1,\"2\":2.200000e+00,\"B\":\"<data container>\"}"); 4339 free(s); 4340 // non existing key 4341 r = cropElemDictO(self, "qwe"); 4342 ck_assert_ptr_eq(r, null); 4343 // null key 4344 r = cropElemDictO(self, null); 4345 ck_assert_ptr_eq(r, null); 4346 // empty self 4347 freeO(self); 4348 r = cropElemDictO(self, "1"); 4349 ck_assert_ptr_eq(r, null); 4350 terminateO(self); 4351 4352 } 4353 4354 4355 void cropElemArraySmallDictT(CuTest *tc UNUSED) { 4356 4357 smallArrayt* r; 4358 smallDictt *self = allocG(rtSmallDictt); 4359 smallDictt *r2; 4360 4361 r2 = self->f->setInt(self, "1", 1); 4362 ck_assert_ptr_ne(r2, null); 4363 r2 = self->f->setDouble(self, "2", 2.2); 4364 ck_assert_ptr_ne(r2, null); 4365 createAllocateSmallArray(d); 4366 r2 = self->f->setNFreeArray(self, "b", d); 4367 ck_assert_ptr_ne(r2, null); 4368 createAllocateSmallInt(I); 4369 setValG(I, 11); 4370 I->type = "anothertype"; 4371 r2 = self->f->set(self, "B", (baset*)I); 4372 ck_assert_ptr_ne(r2, null); 4373 r = cropElemArrayO(self, "b"); 4374 ck_assert_ptr_ne(r, null); 4375 char *s = toStringO(r); 4376 terminateO(r); 4377 ck_assert_str_eq(s, "[]"); 4378 free(s); 4379 s = toStringO(self); 4380 ck_assert_str_eq(s, "{\"1\":1,\"2\":2.200000e+00,\"B\":\"<data container>\"}"); 4381 free(s); 4382 // wrong object type 4383 r = cropElemArrayO(self, "2"); 4384 ck_assert_ptr_eq(r, null); 4385 s = toStringO(self); 4386 ck_assert_str_eq(s, "{\"1\":1,\"2\":2.200000e+00,\"B\":\"<data container>\"}"); 4387 free(s); 4388 r = cropElemArrayO(self, "B"); 4389 ck_assert_ptr_eq(r, null); 4390 s = toStringO(self); 4391 ck_assert_str_eq(s, "{\"1\":1,\"2\":2.200000e+00,\"B\":\"<data container>\"}"); 4392 free(s); 4393 // non existing key 4394 r = cropElemArrayO(self, "qwe"); 4395 ck_assert_ptr_eq(r, null); 4396 // null key 4397 r = cropElemArrayO(self, null); 4398 ck_assert_ptr_eq(r, null); 4399 // empty self 4400 freeO(self); 4401 r = cropElemArrayO(self, "1"); 4402 ck_assert_ptr_eq(r, null); 4403 terminateO(self); 4404 4405 } 4406 4407 4408 void cropElemSmallBoolSmallDictT(CuTest *tc UNUSED) { 4409 4410 smallBoolt* r; 4411 smallDictt *self = allocG(rtSmallDictt); 4412 smallDictt *r2; 4413 4414 r2 = self->f->setInt(self, "1", 1); 4415 ck_assert_ptr_ne(r2, null); 4416 r2 = self->f->setDouble(self, "2", 2.2); 4417 ck_assert_ptr_ne(r2, null); 4418 r2 = self->f->setBool(self, "b", true); 4419 ck_assert_ptr_ne(r2, null); 4420 createAllocateSmallInt(I); 4421 setValG(I, 11); 4422 I->type = "anothertype"; 4423 r2 = self->f->set(self, "B", (baset*)I); 4424 ck_assert_ptr_ne(r2, null); 4425 r = cropElemSmallBoolO(self, "b"); 4426 ck_assert_ptr_ne(r, null); 4427 char *s = toStringO(r); 4428 terminateO(r); 4429 ck_assert_str_eq(s, "true"); 4430 free(s); 4431 s = toStringO(self); 4432 ck_assert_str_eq(s, "{\"1\":1,\"2\":2.200000e+00,\"B\":\"<data container>\"}"); 4433 free(s); 4434 // wrong object type 4435 r = cropElemSmallBoolO(self, "2"); 4436 ck_assert_ptr_eq(r, null); 4437 s = toStringO(self); 4438 ck_assert_str_eq(s, "{\"1\":1,\"2\":2.200000e+00,\"B\":\"<data container>\"}"); 4439 free(s); 4440 r = cropElemSmallBoolO(self, "B"); 4441 ck_assert_ptr_eq(r, null); 4442 s = toStringO(self); 4443 ck_assert_str_eq(s, "{\"1\":1,\"2\":2.200000e+00,\"B\":\"<data container>\"}"); 4444 free(s); 4445 // non existing key 4446 r = cropElemSmallBoolO(self, "qwe"); 4447 ck_assert_ptr_eq(r, null); 4448 // null key 4449 r = cropElemSmallBoolO(self, null); 4450 ck_assert_ptr_eq(r, null); 4451 // empty self 4452 freeO(self); 4453 r = cropElemSmallBoolO(self, "1"); 4454 ck_assert_ptr_eq(r, null); 4455 terminateO(self); 4456 4457 } 4458 4459 4460 void cropElemSmallBytesSmallDictT(CuTest *tc UNUSED) { 4461 4462 smallBytest* r; 4463 smallDictt *self = allocG(rtSmallDictt); 4464 smallDictt *r2; 4465 4466 r2 = self->f->setInt(self, "1", 1); 4467 ck_assert_ptr_ne(r2, null); 4468 r2 = self->f->setDouble(self, "2", 2.2); 4469 ck_assert_ptr_ne(r2, null); 4470 createAllocateSmallBytes(d); 4471 r2 = self->f->setNFreeSmallBytes(self, "b", d); 4472 ck_assert_ptr_ne(r2, null); 4473 createAllocateSmallInt(I); 4474 setValG(I, 11); 4475 I->type = "anothertype"; 4476 r2 = self->f->set(self, "B", (baset*)I); 4477 ck_assert_ptr_ne(r2, null); 4478 r = cropElemSmallBytesO(self, "b"); 4479 ck_assert_ptr_ne(r, null); 4480 char *s = toStringO(r); 4481 terminateO(r); 4482 ck_assert_str_eq(s, "[]"); 4483 free(s); 4484 s = toStringO(self); 4485 ck_assert_str_eq(s, "{\"1\":1,\"2\":2.200000e+00,\"B\":\"<data container>\"}"); 4486 free(s); 4487 // wrong object type 4488 r = cropElemSmallBytesO(self, "2"); 4489 ck_assert_ptr_eq(r, null); 4490 s = toStringO(self); 4491 ck_assert_str_eq(s, "{\"1\":1,\"2\":2.200000e+00,\"B\":\"<data container>\"}"); 4492 free(s); 4493 r = cropElemSmallBytesO(self, "B"); 4494 ck_assert_ptr_eq(r, null); 4495 s = toStringO(self); 4496 ck_assert_str_eq(s, "{\"1\":1,\"2\":2.200000e+00,\"B\":\"<data container>\"}"); 4497 free(s); 4498 // non existing key 4499 r = cropElemSmallBytesO(self, "qwe"); 4500 ck_assert_ptr_eq(r, null); 4501 //r = cropElemSmallBytesO(self); 4502 // null key 4503 r = cropElemSmallBytesO(self, null); 4504 ck_assert_ptr_eq(r, null); 4505 // empty self 4506 freeO(self); 4507 r = cropElemSmallBytesO(self, "1"); 4508 ck_assert_ptr_eq(r, null); 4509 terminateO(self); 4510 4511 } 4512 4513 4514 void cropElemSmallDoubleSmallDictT(CuTest *tc UNUSED) { 4515 4516 smallDoublet* r; 4517 smallDictt *self = allocG(rtSmallDictt); 4518 smallDictt *r2; 4519 4520 r2 = self->f->setInt(self, "1", 1); 4521 ck_assert_ptr_ne(r2, null); 4522 r2 = self->f->setDouble(self, "2", 2.2); 4523 ck_assert_ptr_ne(r2, null); 4524 r2 = self->f->setDouble(self, "b", 3.3); 4525 ck_assert_ptr_ne(r2, null); 4526 createAllocateSmallInt(I); 4527 setValG(I, 11); 4528 I->type = "anothertype"; 4529 r2 = self->f->set(self, "B", (baset*)I); 4530 ck_assert_ptr_ne(r2, null); 4531 r = cropElemSmallDoubleO(self, "b"); 4532 ck_assert_ptr_ne(r, null); 4533 char *s = toStringO(r); 4534 terminateO(r); 4535 ck_assert_str_eq(s, "3.300000e+00"); 4536 free(s); 4537 s = toStringO(self); 4538 ck_assert_str_eq(s, "{\"1\":1,\"2\":2.200000e+00,\"B\":\"<data container>\"}"); 4539 free(s); 4540 // wrong object type 4541 r = cropElemSmallDoubleO(self, "1"); 4542 ck_assert_ptr_eq(r, null); 4543 s = toStringO(self); 4544 ck_assert_str_eq(s, "{\"1\":1,\"2\":2.200000e+00,\"B\":\"<data container>\"}"); 4545 free(s); 4546 r = cropElemSmallDoubleO(self, "B"); 4547 ck_assert_ptr_eq(r, null); 4548 s = toStringO(self); 4549 ck_assert_str_eq(s, "{\"1\":1,\"2\":2.200000e+00,\"B\":\"<data container>\"}"); 4550 free(s); 4551 // non existing key 4552 r = cropElemSmallDoubleO(self, "qwe"); 4553 ck_assert_ptr_eq(r, null); 4554 // null key 4555 r = cropElemSmallDoubleO(self, null); 4556 ck_assert_ptr_eq(r, null); 4557 // empty self 4558 freeO(self); 4559 r = cropElemSmallDoubleO(self, "1"); 4560 ck_assert_ptr_eq(r, null); 4561 terminateO(self); 4562 4563 } 4564 4565 4566 void cropElemSmallIntSmallDictT(CuTest *tc UNUSED) { 4567 4568 smallIntt* r; 4569 smallDictt *self = allocG(rtSmallDictt); 4570 smallDictt *r2; 4571 4572 r2 = self->f->setInt(self, "1", 1); 4573 ck_assert_ptr_ne(r2, null); 4574 r2 = self->f->setDouble(self, "2", 2.2); 4575 ck_assert_ptr_ne(r2, null); 4576 r2 = self->f->setInt(self, "b", 2); 4577 ck_assert_ptr_ne(r2, null); 4578 createAllocateSmallInt(I); 4579 setValG(I, 11); 4580 I->type = "anothertype"; 4581 r2 = self->f->set(self, "B", (baset*)I); 4582 ck_assert_ptr_ne(r2, null); 4583 r = cropElemSmallIntO(self, "b"); 4584 ck_assert_ptr_ne(r, null); 4585 char *s = toStringO(r); 4586 terminateO(r); 4587 ck_assert_str_eq(s, "2"); 4588 free(s); 4589 s = toStringO(self); 4590 ck_assert_str_eq(s, "{\"1\":1,\"2\":2.200000e+00,\"B\":\"<data container>\"}"); 4591 free(s); 4592 // wrong object type 4593 r = cropElemSmallIntO(self, "2"); 4594 ck_assert_ptr_eq(r, null); 4595 s = toStringO(self); 4596 ck_assert_str_eq(s, "{\"1\":1,\"2\":2.200000e+00,\"B\":\"<data container>\"}"); 4597 free(s); 4598 r = cropElemSmallIntO(self, "B"); 4599 ck_assert_ptr_eq(r, null); 4600 s = toStringO(self); 4601 ck_assert_str_eq(s, "{\"1\":1,\"2\":2.200000e+00,\"B\":\"<data container>\"}"); 4602 free(s); 4603 // non existing key 4604 r = cropElemSmallIntO(self, "qwe"); 4605 ck_assert_ptr_eq(r, null); 4606 // null key 4607 r = cropElemSmallIntO(self, null); 4608 ck_assert_ptr_eq(r, null); 4609 // empty self 4610 freeO(self); 4611 r = cropElemSmallIntO(self, "1"); 4612 ck_assert_ptr_eq(r, null); 4613 terminateO(self); 4614 4615 } 4616 4617 4618 void cropElemSmallJsonSmallDictT(CuTest *tc UNUSED) { 4619 4620 smallJsont* r; 4621 smallDictt *self = allocG(rtSmallDictt); 4622 smallDictt *r2; 4623 4624 r2 = self->f->setInt(self, "1", 1); 4625 ck_assert_ptr_ne(r2, null); 4626 createAllocateSmallBytes(b); 4627 r2 = self->f->setNFreeSmallBytes(self, "2", b); 4628 ck_assert_ptr_ne(r2, null); 4629 createAllocateSmallJson(d); 4630 r2 = self->f->setNFreeSmallJson(self, "b", d); 4631 ck_assert_ptr_ne(r2, null); 4632 createAllocateSmallInt(I); 4633 setValG(I, 11); 4634 I->type = "anothertype"; 4635 r2 = self->f->set(self, "B", (baset*)I); 4636 ck_assert_ptr_ne(r2, null); 4637 r = cropElemSmallJsonO(self, "b"); 4638 ck_assert_ptr_ne(r, null); 4639 char *s = toStringO(r); 4640 terminateO(r); 4641 ck_assert_str_eq(s, "{}"); 4642 free(s); 4643 s = toStringO(self); 4644 ck_assert_str_eq(s, "{\"1\":1,\"2\":[],\"B\":\"<data container>\"}"); 4645 free(s); 4646 // wrong object type 4647 r = cropElemSmallJsonO(self, "2"); 4648 ck_assert_ptr_eq(r, null); 4649 s = toStringO(self); 4650 ck_assert_str_eq(s, "{\"1\":1,\"2\":[],\"B\":\"<data container>\"}"); 4651 free(s); 4652 r = cropElemSmallJsonO(self, "B"); 4653 ck_assert_ptr_eq(r, null); 4654 s = toStringO(self); 4655 ck_assert_str_eq(s, "{\"1\":1,\"2\":[],\"B\":\"<data container>\"}"); 4656 free(s); 4657 // non existing key 4658 r = cropElemSmallJsonO(self, "qwe"); 4659 ck_assert_ptr_eq(r, null); 4660 // null key 4661 r = cropElemSmallJsonO(self, null); 4662 ck_assert_ptr_eq(r, null); 4663 // empty self 4664 freeO(self); 4665 r = cropElemSmallJsonO(self, "1"); 4666 ck_assert_ptr_eq(r, null); 4667 terminateO(self); 4668 4669 } 4670 4671 4672 void cropElemSmallStringSmallDictT(CuTest *tc UNUSED) { 4673 4674 smallStringt* r; 4675 smallDictt *self = allocG(rtSmallDictt); 4676 smallDictt *r2; 4677 4678 r2 = self->f->setInt(self, "1", 1); 4679 ck_assert_ptr_ne(r2, null); 4680 r2 = self->f->setDouble(self, "2", 2.2); 4681 ck_assert_ptr_ne(r2, null); 4682 r2 = self->f->setS(self, "b", "qwe"); 4683 ck_assert_ptr_ne(r2, null); 4684 createAllocateSmallInt(I); 4685 setValG(I, 11); 4686 I->type = "anothertype"; 4687 r2 = self->f->set(self, "B", (baset*)I); 4688 ck_assert_ptr_ne(r2, null); 4689 r = cropElemSmallStringO(self, "b"); 4690 ck_assert_ptr_ne(r, null); 4691 char *s = toStringO(r); 4692 terminateO(r); 4693 ck_assert_str_eq(s, "qwe"); 4694 free(s); 4695 s = toStringO(self); 4696 ck_assert_str_eq(s, "{\"1\":1,\"2\":2.200000e+00,\"B\":\"<data container>\"}"); 4697 free(s); 4698 // wrong object type 4699 r = cropElemSmallStringO(self, "2"); 4700 ck_assert_ptr_eq(r, null); 4701 s = toStringO(self); 4702 ck_assert_str_eq(s, "{\"1\":1,\"2\":2.200000e+00,\"B\":\"<data container>\"}"); 4703 free(s); 4704 r = cropElemSmallStringO(self, "B"); 4705 ck_assert_ptr_eq(r, null); 4706 s = toStringO(self); 4707 ck_assert_str_eq(s, "{\"1\":1,\"2\":2.200000e+00,\"B\":\"<data container>\"}"); 4708 free(s); 4709 // non existing key 4710 r = cropElemSmallStringO(self, "qwe"); 4711 ck_assert_ptr_eq(r, null); 4712 // null key 4713 r = cropElemSmallStringO(self, null); 4714 ck_assert_ptr_eq(r, null); 4715 // empty self 4716 freeO(self); 4717 r = cropElemSmallStringO(self, "1"); 4718 ck_assert_ptr_eq(r, null); 4719 terminateO(self); 4720 4721 } 4722 4723 4724 void cropElemVoidSmallDictT(CuTest *tc UNUSED) { 4725 4726 void* r; 4727 smallDictt *self = allocG(rtSmallDictt); 4728 smallDictt *r2; 4729 4730 r2 = self->f->setInt(self, "1", 1); 4731 ck_assert_ptr_ne(r2, null); 4732 r2 = self->f->setDouble(self, "2", 2.2); 4733 ck_assert_ptr_ne(r2, null); 4734 smallContainert *c = allocSmallContainer(&r); 4735 r2 = self->f->setNFreeSmallContainer(self, "b", c); 4736 ck_assert_ptr_ne(r2, null); 4737 createAllocateSmallInt(I); 4738 setValG(I, 11); 4739 I->type = "anothertype"; 4740 r2 = self->f->set(self, "B", (baset*)I); 4741 ck_assert_ptr_ne(r2, null); 4742 r = cropElemVoidO(self, "b"); 4743 ck_assert_ptr_eq(r, &r); 4744 char *s = toStringO(self); 4745 ck_assert_str_eq(s, "{\"1\":1,\"2\":2.200000e+00,\"B\":\"<data container>\"}"); 4746 free(s); 4747 // wrong object type 4748 r = cropElemVoidO(self, "2"); 4749 ck_assert_ptr_eq(r, null); 4750 s = toStringO(self); 4751 ck_assert_str_eq(s, "{\"1\":1,\"2\":2.200000e+00,\"B\":\"<data container>\"}"); 4752 free(s); 4753 r = cropElemVoidO(self, "B"); 4754 ck_assert_ptr_eq(r, null); 4755 s = toStringO(self); 4756 ck_assert_str_eq(s, "{\"1\":1,\"2\":2.200000e+00,\"B\":\"<data container>\"}"); 4757 free(s); 4758 // non existing key 4759 r = cropElemVoidO(self, "qwe"); 4760 ck_assert_ptr_eq(r, null); 4761 // null key 4762 r = cropElemVoidO(self, null); 4763 ck_assert_ptr_eq(r, null); 4764 // empty self 4765 freeO(self); 4766 r = cropElemVoidO(self, "1"); 4767 ck_assert_ptr_eq(r, null); 4768 terminateO(self); 4769 4770 } 4771 4772 4773 void cropElemSmallContainerSmallDictT(CuTest *tc UNUSED) { 4774 4775 smallContainert* r; 4776 smallDictt *self = allocG(rtSmallDictt); 4777 smallDictt *r2; 4778 4779 r2 = self->f->setInt(self, "1", 1); 4780 ck_assert_ptr_ne(r2, null); 4781 r2 = self->f->setDouble(self, "2", 2.2); 4782 ck_assert_ptr_ne(r2, null); 4783 smallContainert *c = allocSmallContainer(&r); 4784 r2 = self->f->setNFreeSmallContainer(self, "b", c); 4785 ck_assert_ptr_ne(r2, null); 4786 createAllocateSmallInt(I); 4787 setValG(I, 11); 4788 I->type = "anothertype"; 4789 r2 = self->f->set(self, "B", (baset*)I); 4790 ck_assert_ptr_ne(r2, null); 4791 r = cropElemSmallContainerO(self, "b"); 4792 ck_assert_ptr_ne(r, null); 4793 char *s = toStringO(r); 4794 terminateO(r); 4795 ck_assert_str_eq(s, "<data smallContainer>"); 4796 free(s); 4797 s = toStringO(self); 4798 ck_assert_str_eq(s, "{\"1\":1,\"2\":2.200000e+00,\"B\":\"<data container>\"}"); 4799 free(s); 4800 // wrong object type 4801 r = cropElemSmallContainerO(self, "2"); 4802 ck_assert_ptr_eq(r, null); 4803 s = toStringO(self); 4804 ck_assert_str_eq(s, "{\"1\":1,\"2\":2.200000e+00,\"B\":\"<data container>\"}"); 4805 free(s); 4806 r = cropElemSmallContainerO(self, "B"); 4807 ck_assert_ptr_eq(r, null); 4808 s = toStringO(self); 4809 ck_assert_str_eq(s, "{\"1\":1,\"2\":2.200000e+00,\"B\":\"<data container>\"}"); 4810 free(s); 4811 // non existing key 4812 r = cropElemSmallContainerO(self, "qwe"); 4813 ck_assert_ptr_eq(r, null); 4814 // null key 4815 r = cropElemSmallContainerO(self, null); 4816 ck_assert_ptr_eq(r, null); 4817 // empty self 4818 freeO(self); 4819 r = cropElemSmallContainerO(self, "1"); 4820 ck_assert_ptr_eq(r, null); 4821 terminateO(self); 4822 4823 } 4824 4825 4826 void delKCharSmallDictT(CuTest *tc UNUSED) { 4827 4828 smallDictt* r; 4829 smallDictt *self = allocG(rtSmallDictt); 4830 4831 r = self->f->setInt(self, "1", 1); 4832 ck_assert_ptr_ne(r, null); 4833 r = self->f->setDouble(self, "2", 2.2); 4834 ck_assert_ptr_ne(r, null); 4835 // non existing key 4836 r = delKCharO(self, 'q'); 4837 ck_assert_ptr_ne(r, null); 4838 char *s = toStringO(r); 4839 ck_assert_str_eq(s, "{\"1\":1,\"2\":2.200000e+00}"); 4840 free(s); 4841 // delete key value 4842 r = delKCharO(self, '2'); 4843 ck_assert_ptr_ne(r, null); 4844 s = toStringO(r); 4845 ck_assert_str_eq(s, "{\"1\":1}"); 4846 free(s); 4847 terminateO(self); 4848 4849 } 4850 4851 4852 void removeSmallDictT(CuTest *tc UNUSED) { 4853 4854 smallDictt* r; 4855 smallDictt *self = allocG(rtSmallDictt); 4856 4857 smallIntt *i = allocSmallInt(1); 4858 r = self->f->setSmallInt(self, "1", i); 4859 ck_assert_ptr_ne(r, null); 4860 r = self->f->remove(self, "1"); 4861 ck_assert_ptr_ne(r, null); 4862 terminateO(i); 4863 char *s = toStringO(r); 4864 ck_assert_str_eq(s, "{}"); 4865 free(s); 4866 // non existing key 4867 r = self->f->remove(self, "1"); 4868 ck_assert_ptr_ne(r, null); 4869 s = toStringO(r); 4870 ck_assert_str_eq(s, "{}"); 4871 free(s); 4872 // null key 4873 r = self->f->remove(self, null); 4874 ck_assert_ptr_eq(r, null); 4875 // empty self 4876 freeO(self); 4877 r = self->f->remove(self, "qwe"); 4878 ck_assert_ptr_eq(r, null); 4879 terminateO(self); 4880 4881 } 4882 4883 4884 void removeKCharSmallDictT(CuTest *tc UNUSED) { 4885 4886 smallDictt* r; 4887 smallDictt *self = allocG(rtSmallDictt); 4888 4889 smallIntt *i = allocSmallInt(1); 4890 r = self->f->setSmallInt(self, "1", i); 4891 ck_assert_ptr_ne(r, null); 4892 r = self->f->removeKChar(self, '1'); 4893 ck_assert_ptr_ne(r, null); 4894 terminateO(i); 4895 char *s = toStringO(r); 4896 ck_assert_str_eq(s, "{}"); 4897 free(s); 4898 // non existing key 4899 r = self->f->removeKChar(self, '1'); 4900 ck_assert_ptr_ne(r, null); 4901 s = toStringO(r); 4902 ck_assert_str_eq(s, "{}"); 4903 free(s); 4904 // empty self 4905 freeO(self); 4906 r = self->f->removeKChar(self, 'q'); 4907 ck_assert_ptr_eq(r, null); 4908 terminateO(self); 4909 4910 } 4911 4912 4913 void hasKCharSmallDictT(CuTest *tc UNUSED) { 4914 4915 smallDictt *self = allocG(rtSmallDictt); 4916 4917 smallDictt *r2 = self->f->setInt(self, "1", 1); 4918 ck_assert_ptr_ne(r2, null); 4919 ck_assert(self->f->hasKChar(self, '1')); 4920 terminateO(self); 4921 4922 } 4923 4924 4925 void keyBySmallDictT(CuTest *tc UNUSED) { 4926 4927 char* r; 4928 smallDictt *self = allocG(rtSmallDictt); 4929 baset *value; 4930 4931 smallDictt *r2 = self->f->setInt(self, "1", 1); 4932 ck_assert_ptr_ne(r2, null); 4933 value = (baset*) allocSmallInt(1); 4934 r = keyByO(self, value); 4935 ck_assert_str_eq(r, "1"); 4936 // non existing object 4937 smallIntt *i = allocSmallInt(2); 4938 r = keyByO(self, (baset*)i); 4939 terminateO(i); 4940 ck_assert_ptr_eq(r, null); 4941 // null value 4942 r = keyByO(self, null); 4943 ck_assert_ptr_eq(r, null); 4944 // empty self 4945 freeO(self); 4946 r = keyByO(self, value); 4947 ck_assert_ptr_eq(r, null); 4948 terminateO(self); 4949 terminateO(value); 4950 4951 } 4952 4953 4954 void keyByUndefinedSmallDictT(CuTest *tc UNUSED) { 4955 4956 char* r; 4957 smallDictt *self = allocG(rtSmallDictt); 4958 undefinedt *value; 4959 4960 smallDictt *r2 = self->f->setUndefined(self, "1"); 4961 ck_assert_ptr_ne(r2, null); 4962 value = allocUndefined(); 4963 r = keyByUndefinedO(self, value); 4964 ck_assert_str_eq(r, "1"); 4965 // non existing object 4966 r2 = self->f->setInt(self, "1", 1); 4967 ck_assert_ptr_ne(r2, null); 4968 r = keyByUndefinedO(self, value); 4969 ck_assert_ptr_eq(r, null); 4970 // non undefined object 4971 smallIntt *i = allocSmallInt(2); 4972 r = keyByUndefinedO(self, (undefinedt*)i); 4973 terminateO(i); 4974 ck_assert_ptr_eq(r, null); 4975 // null value 4976 r = keyByUndefinedO(self, null); 4977 ck_assert_ptr_eq(r, null); 4978 // empty self 4979 freeO(self); 4980 r = keyByUndefinedO(self, value); 4981 ck_assert_ptr_eq(r, null); 4982 terminateO(self); 4983 terminateO(value); 4984 4985 } 4986 4987 4988 void keyByBoolSmallDictT(CuTest *tc UNUSED) { 4989 4990 char* r; 4991 smallDictt *self = allocG(rtSmallDictt); 4992 4993 smallDictt *r2 = self->f->setBool(self, "1", true); 4994 ck_assert_ptr_ne(r2, null); 4995 r = keyByBoolO(self, true); 4996 ck_assert_str_eq(r, "1"); 4997 // non existing object 4998 r2 = self->f->setInt(self, "1", 1); 4999 ck_assert_ptr_ne(r2, null); 5000 r = keyByBoolO(self, true); 5001 ck_assert_ptr_eq(r, null); 5002 // empty self 5003 freeO(self); 5004 r = keyByBoolO(self, true); 5005 ck_assert_ptr_eq(r, null); 5006 terminateO(self); 5007 5008 } 5009 5010 5011 void keyByDoubleSmallDictT(CuTest *tc UNUSED) { 5012 5013 char* r; 5014 smallDictt *self = allocG(rtSmallDictt); 5015 5016 smallDictt *r2 = self->f->setDouble(self, "1", 2.2); 5017 ck_assert_ptr_ne(r2, null); 5018 r = keyByDoubleO(self, 2.2); 5019 ck_assert_str_eq(r, "1"); 5020 // non existing object 5021 r2 = self->f->setInt(self, "1", 1); 5022 ck_assert_ptr_ne(r2, null); 5023 r = keyByDoubleO(self, 2.2); 5024 ck_assert_ptr_eq(r, null); 5025 // empty self 5026 freeO(self); 5027 r = keyByDoubleO(self, 2.2); 5028 ck_assert_ptr_eq(r, null); 5029 terminateO(self); 5030 5031 } 5032 5033 5034 void keyByIntSmallDictT(CuTest *tc UNUSED) { 5035 5036 char* r; 5037 smallDictt *self = allocG(rtSmallDictt); 5038 5039 smallDictt *r2 = self->f->setInt(self, "1", 2); 5040 ck_assert_ptr_ne(r2, null); 5041 r = keyByIntO(self, 2); 5042 ck_assert_str_eq(r, "1"); 5043 // non existing object 5044 r2 = self->f->setInt(self, "1", 1); 5045 ck_assert_ptr_ne(r2, null); 5046 r = keyByIntO(self, 2); 5047 ck_assert_ptr_eq(r, null); 5048 // empty self 5049 freeO(self); 5050 r = keyByIntO(self, 2); 5051 ck_assert_ptr_eq(r, null); 5052 terminateO(self); 5053 5054 } 5055 5056 5057 void keyBySSmallDictT(CuTest *tc UNUSED) { 5058 5059 char* r; 5060 smallDictt *self = allocG(rtSmallDictt); 5061 5062 smallDictt *r2 = self->f->setS(self, "1", "qwe"); 5063 ck_assert_ptr_ne(r2, null); 5064 r = keyBySO(self, "qwe"); 5065 ck_assert_str_eq(r, "1"); 5066 // non existing object 5067 r2 = self->f->setInt(self, "1", 1); 5068 ck_assert_ptr_ne(r2, null); 5069 r = keyBySO(self, "qwe"); 5070 ck_assert_ptr_eq(r, null); 5071 // null value 5072 r = keyBySO(self, null); 5073 ck_assert_ptr_eq(r, null); 5074 // empty self 5075 freeO(self); 5076 r = keyBySO(self, "qwe"); 5077 ck_assert_ptr_eq(r, null); 5078 terminateO(self); 5079 5080 } 5081 5082 5083 void keyByCharSmallDictT(CuTest *tc UNUSED) { 5084 5085 char* r; 5086 smallDictt *self = allocG(rtSmallDictt); 5087 5088 smallDictt *r2 = self->f->setS(self, "1", "q"); 5089 ck_assert_ptr_ne(r2, null); 5090 r = keyByCharO(self, 'q'); 5091 ck_assert_str_eq(r, "1"); 5092 // non existing object 5093 r2 = self->f->setInt(self, "1", 1); 5094 ck_assert_ptr_ne(r2, null); 5095 r = keyByCharO(self, 'q'); 5096 ck_assert_ptr_eq(r, null); 5097 // empty self 5098 freeO(self); 5099 r = keyByCharO(self, 'q'); 5100 ck_assert_ptr_eq(r, null); 5101 terminateO(self); 5102 5103 } 5104 5105 5106 void keyByDictSmallDictT(CuTest *tc UNUSED) { 5107 5108 char* r; 5109 smallDictt *self = allocG(rtSmallDictt); 5110 smallDictt *dict = allocSmallDict(); 5111 5112 createAllocateSmallDict(d); 5113 d->f->setS(d, "another", "dict"); 5114 smallDictt *r2 = self->f->setNFreeDict(self, "d", d); 5115 ck_assert_ptr_ne(r2, null); 5116 r2 = self->f->setNFreeDict(self, "1", dict); 5117 ck_assert_ptr_ne(r2, null); 5118 dict = allocSmallDict(); 5119 r = keyByDictO(self, dict); 5120 ck_assert_str_eq(r, "1"); 5121 // non existing object 5122 r2 = self->f->setInt(self, "1", 1); 5123 ck_assert_ptr_ne(r2, null); 5124 r = keyByDictO(self, dict); 5125 ck_assert_ptr_eq(r, null); 5126 // non smallDict object 5127 smallIntt *i = allocSmallInt(2); 5128 r = keyByDictO(self, (smallDictt*)i); 5129 terminateO(i); 5130 ck_assert_ptr_eq(r, null); 5131 // null value 5132 r = keyByDictO(self, null); 5133 ck_assert_ptr_eq(r, null); 5134 // empty self 5135 freeO(self); 5136 r = keyByDictO(self, dict); 5137 ck_assert_ptr_eq(r, null); 5138 terminateO(self); 5139 terminateO(dict); 5140 5141 } 5142 5143 5144 void keyByArraySmallDictT(CuTest *tc UNUSED) { 5145 5146 char* r; 5147 smallDictt *self = allocG(rtSmallDictt); 5148 smallArrayt *array = allocSmallArray(); 5149 5150 createAllocateSmallArray(d); 5151 d->f->pushS(d, "another array"); 5152 smallDictt *r2 = self->f->setNFreeArray(self, "d", d); 5153 ck_assert_ptr_ne(r2, null); 5154 r2 = self->f->setNFreeArray(self, "1", array); 5155 ck_assert_ptr_ne(r2, null); 5156 array = allocSmallArray(); 5157 r = keyByArrayO(self, array); 5158 ck_assert_str_eq(r, "1"); 5159 // non existing object 5160 r2 = self->f->setInt(self, "1", 1); 5161 ck_assert_ptr_ne(r2, null); 5162 r = keyByArrayO(self, array); 5163 ck_assert_ptr_eq(r, null); 5164 // non smallArray object 5165 smallIntt *i = allocSmallInt(2); 5166 r = keyByArrayO(self, (smallArrayt*)i); 5167 terminateO(i); 5168 ck_assert_ptr_eq(r, null); 5169 // null value 5170 r = keyByArrayO(self, null); 5171 ck_assert_ptr_eq(r, null); 5172 // empty self 5173 freeO(self); 5174 r = keyByArrayO(self, array); 5175 ck_assert_ptr_eq(r, null); 5176 terminateO(self); 5177 terminateO(array); 5178 5179 } 5180 5181 5182 void keyByArraycSmallDictT(CuTest *tc UNUSED) { 5183 5184 char* r; 5185 smallDictt *self = allocG(rtSmallDictt); 5186 char **array = listCreateS("a","b"); 5187 5188 char **d = listCreateS("asd", "zxcv"); 5189 smallDictt *r2 = self->f->setNFreeArrayc(self, "d", d); 5190 ck_assert_ptr_ne(r2, null); 5191 r2 = self->f->setArrayc(self, "1", array); 5192 ck_assert_ptr_ne(r2, null); 5193 r = keyByArraycO(self, array); 5194 ck_assert_ptr_ne(r, NULL); 5195 ck_assert_str_eq(r, "1"); 5196 // non existing object 5197 r2 = self->f->setInt(self, "1", 1); 5198 ck_assert_ptr_ne(r2, null); 5199 r = keyByArraycO(self, array); 5200 ck_assert_ptr_eq(r, null); 5201 // null value 5202 r = keyByArraycO(self, null); 5203 ck_assert_ptr_eq(r, null); 5204 // empty self 5205 freeO(self); 5206 r = keyByArraycO(self, array); 5207 ck_assert_ptr_eq(r, null); 5208 terminateO(self); 5209 listFreeS(array); 5210 5211 } 5212 5213 5214 void keyBySmallBoolSmallDictT(CuTest *tc UNUSED) { 5215 5216 char* r; 5217 smallDictt *self = allocG(rtSmallDictt); 5218 smallBoolt *value = allocSmallBool(true); 5219 5220 createAllocateSmallBool(d); 5221 setValO(d, false); 5222 smallDictt *r2 = self->f->setNFreeSmallBool(self, "d", d); 5223 ck_assert_ptr_ne(r2, null); 5224 r2 = self->f->setNFreeSmallBool(self, "1", value); 5225 ck_assert_ptr_ne(r2, null); 5226 value = allocSmallBool(true); 5227 r = keyBySmallBoolO(self, value); 5228 ck_assert_str_eq(r, "1"); 5229 // non existing object 5230 r2 = self->f->setInt(self, "1", 1); 5231 ck_assert_ptr_ne(r2, null); 5232 r = keyBySmallBoolO(self, value); 5233 ck_assert_ptr_eq(r, null); 5234 // non smallBool object 5235 smallIntt *i = allocSmallInt(2); 5236 r = keyBySmallBoolO(self, (smallBoolt*)i); 5237 terminateO(i); 5238 ck_assert_ptr_eq(r, null); 5239 // null value 5240 r = keyBySmallBoolO(self, null); 5241 ck_assert_ptr_eq(r, null); 5242 // empty self 5243 freeO(self); 5244 r = keyBySmallBoolO(self, value); 5245 ck_assert_ptr_eq(r, null); 5246 terminateO(self); 5247 terminateO(value); 5248 5249 } 5250 5251 5252 void keyBySmallBytesSmallDictT(CuTest *tc UNUSED) { 5253 5254 char* r; 5255 smallDictt *self = allocG(rtSmallDictt); 5256 smallBytest *value = allocSmallBytes("qwe", sizeof("qwe")); 5257 5258 smallBytest *d = allocSmallBytes("asd", sizeof("asd")); 5259 smallDictt *r2 = self->f->setNFreeSmallBytes(self, "d", d); 5260 ck_assert_ptr_ne(r2, null); 5261 r2 = self->f->setNFreeSmallBytes(self, "1", value); 5262 ck_assert_ptr_ne(r2, null); 5263 value = allocSmallBytes("qwe", sizeof("qwe")); 5264 r = keyBySmallBytesO(self, value); 5265 ck_assert_str_eq(r, "1"); 5266 // non existing object 5267 r2 = self->f->setInt(self, "1", 1); 5268 ck_assert_ptr_ne(r2, null); 5269 r = keyBySmallBytesO(self, value); 5270 ck_assert_ptr_eq(r, null); 5271 // empty value 5272 freeO(value); 5273 r = keyBySmallBytesO(self, value); 5274 ck_assert_ptr_eq(r, null); 5275 // non smallBytes object 5276 smallIntt *i = allocSmallInt(2); 5277 r = keyBySmallBytesO(self, (smallBytest*)i); 5278 terminateO(i); 5279 ck_assert_ptr_eq(r, null); 5280 // null value 5281 r = keyBySmallBytesO(self, null); 5282 ck_assert_ptr_eq(r, null); 5283 // empty self 5284 freeO(self); 5285 r = keyBySmallBytesO(self, value); 5286 ck_assert_ptr_eq(r, null); 5287 terminateO(self); 5288 terminateO(value); 5289 5290 } 5291 5292 5293 void keyBySmallDoubleSmallDictT(CuTest *tc UNUSED) { 5294 5295 char* r; 5296 smallDictt *self = allocG(rtSmallDictt); 5297 smallDoublet *value = allocSmallDouble(2.2); 5298 5299 createAllocateSmallDouble(d); 5300 smallDictt *r2 = self->f->setNFreeSmallDouble(self, "d", d); 5301 ck_assert_ptr_ne(r2, null); 5302 r2 = self->f->setNFreeSmallDouble(self, "1", value); 5303 ck_assert_ptr_ne(r2, null); 5304 value = allocSmallDouble(2.2); 5305 r = keyBySmallDoubleO(self, value); 5306 ck_assert_str_eq(r, "1"); 5307 // non existing object 5308 r2 = self->f->setInt(self, "1", 1); 5309 ck_assert_ptr_ne(r2, null); 5310 r = keyBySmallDoubleO(self, value); 5311 ck_assert_ptr_eq(r, null); 5312 // non smallDouble object 5313 smallIntt *i = allocSmallInt(2); 5314 r = keyBySmallDoubleO(self, (smallDoublet*)i); 5315 terminateO(i); 5316 ck_assert_ptr_eq(r, null); 5317 // null value 5318 r = keyBySmallDoubleO(self, null); 5319 ck_assert_ptr_eq(r, null); 5320 // empty self 5321 freeO(self); 5322 r = keyBySmallDoubleO(self, value); 5323 ck_assert_ptr_eq(r, null); 5324 terminateO(self); 5325 terminateO(value); 5326 5327 } 5328 5329 5330 void keyBySmallIntSmallDictT(CuTest *tc UNUSED) { 5331 5332 char* r; 5333 smallDictt *self = allocG(rtSmallDictt); 5334 smallIntt *value = allocSmallInt(2); 5335 5336 createAllocateSmallInt(d); 5337 smallDictt *r2 = self->f->setNFreeSmallInt(self, "d", d); 5338 ck_assert_ptr_ne(r2, null); 5339 r2 = self->f->setNFreeSmallInt(self, "1", value); 5340 ck_assert_ptr_ne(r2, null); 5341 value = allocSmallInt(2); 5342 r = keyBySmallIntO(self, value); 5343 ck_assert_str_eq(r, "1"); 5344 // non existing object 5345 r2 = self->f->setInt(self, "1", 1); 5346 ck_assert_ptr_ne(r2, null); 5347 r = keyBySmallIntO(self, value); 5348 ck_assert_ptr_eq(r, null); 5349 // non smallInt object 5350 smallBoolt *i = allocSmallBool(false); 5351 r = keyBySmallIntO(self, (smallIntt*)i); 5352 terminateO(i); 5353 ck_assert_ptr_eq(r, null); 5354 // null value 5355 r = keyBySmallIntO(self, null); 5356 ck_assert_ptr_eq(r, null); 5357 // empty self 5358 freeO(self); 5359 r = keyBySmallIntO(self, value); 5360 ck_assert_ptr_eq(r, null); 5361 terminateO(self); 5362 terminateO(value); 5363 5364 } 5365 5366 5367 void keyBySmallJsonSmallDictT(CuTest *tc UNUSED) { 5368 5369 char* r; 5370 smallDictt *self = allocG(rtSmallDictt); 5371 smallJsont *value = allocSmallJson(); 5372 5373 // undefined 5374 createUndefined(u); 5375 setTopO(value, (baset*)&u); 5376 self->f->setUndefined(self, "1"); 5377 r = self->f->keyBySmallJson(self, value); 5378 ck_assert_str_eq(r, "1"); 5379 freeO(value); 5380 // bool 5381 setTopBoolO(value, true); 5382 self->f->setBool(self, "b", true); 5383 r = self->f->keyBySmallJson(self, value); 5384 ck_assert_str_eq(r, "b"); 5385 freeO(value); 5386 // double 5387 setTopDoubleO(value, 2.2); 5388 self->f->setDouble(self, "db", 2.2); 5389 r = self->f->keyBySmallJson(self, value); 5390 ck_assert_str_eq(r, "db"); 5391 freeO(value); 5392 // int 5393 setTopIntO(value, 2); 5394 self->f->setInt(self, "i", 2); 5395 r = self->f->keyBySmallJson(self, value); 5396 ck_assert_str_eq(r, "i"); 5397 freeO(value); 5398 // string 5399 setTopSO(value, "qwe"); 5400 self->f->setS(self, "s", "qwe"); 5401 r = self->f->keyBySmallJson(self, value); 5402 ck_assert_str_eq(r, "s"); 5403 freeO(value); 5404 // dict 5405 smallDictt *D = allocSmallDict(); 5406 setTopNFreeDictO(value, D); 5407 self->f->setNFreeDict(self, "d", allocSmallDict()); 5408 r = self->f->keyBySmallJson(self, value); 5409 ck_assert_str_eq(r, "d"); 5410 freeO(value); 5411 // array 5412 smallArrayt *a = allocSmallArray(); 5413 setTopNFreeArrayO(value, a); 5414 self->f->setNFreeArray(self, "a", allocSmallArray()); 5415 r = self->f->keyBySmallJson(self, value); 5416 ck_assert_str_eq(r, "a"); 5417 freeO(value); 5418 // empty value 5419 r = self->f->keyBySmallJson(self, value); 5420 ck_assert_ptr_eq(r, null); 5421 // non smallJson object 5422 smallIntt *i = allocSmallInt(2); 5423 r = self->f->keyBySmallJson(self, (smallJsont*)i); 5424 terminateO(i); 5425 ck_assert_ptr_eq(r, null); 5426 // null value 5427 r = self->f->keyBySmallJson(self, null); 5428 ck_assert_ptr_eq(r, null); 5429 // empty self 5430 freeO(self); 5431 r = self->f->keyBySmallJson(self, value); 5432 ck_assert_ptr_eq(r, null); 5433 terminateO(self); 5434 terminateO(value); 5435 5436 } 5437 5438 5439 void keyBySmallStringSmallDictT(CuTest *tc UNUSED) { 5440 5441 char* r; 5442 smallDictt *self = allocG(rtSmallDictt); 5443 smallStringt *value = allocSmallString("qwe"); 5444 5445 createAllocateSmallString(d); 5446 smallDictt *r2 = self->f->setNFreeSmallString(self, "d", d); 5447 ck_assert_ptr_ne(r2, null); 5448 r2 = self->f->setNFreeSmallString(self, "1", value); 5449 ck_assert_ptr_ne(r2, null); 5450 value = allocSmallString("qwe"); 5451 r = keyBySmallStringO(self, value); 5452 ck_assert_str_eq(r, "1"); 5453 // non existing object 5454 r2 = self->f->setInt(self, "1", 1); 5455 ck_assert_ptr_ne(r2, null); 5456 r = keyBySmallStringO(self, value); 5457 ck_assert_ptr_eq(r, null); 5458 // empty value 5459 freeO(value); 5460 r = keyBySmallStringO(self, value); 5461 ck_assert_ptr_eq(r, null); 5462 // non smallString object 5463 smallIntt *i = allocSmallInt(2); 5464 r = keyBySmallStringO(self, (smallStringt*)i); 5465 terminateO(i); 5466 ck_assert_ptr_eq(r, null); 5467 // null value 5468 r = keyBySmallStringO(self, null); 5469 ck_assert_ptr_eq(r, null); 5470 // empty self 5471 freeO(self); 5472 r = keyBySmallStringO(self, value); 5473 ck_assert_ptr_eq(r, null); 5474 terminateO(self); 5475 terminateO(value); 5476 5477 } 5478 5479 5480 void keyBySmallContainerSmallDictT(CuTest *tc UNUSED) { 5481 5482 char* r; 5483 smallDictt *self = allocG(rtSmallDictt); 5484 smallContainert *value = allocSmallContainer(null); 5485 5486 createAllocateSmallString(d); 5487 smallDictt *r2 = self->f->setNFreeSmallString(self, "d", d); 5488 ck_assert_ptr_ne(r2, null); 5489 r = keyBySmallContainerO(self, value); 5490 ck_assert_ptr_eq(r, null); 5491 // non smallContainer object 5492 smallIntt *i = allocSmallInt(2); 5493 r = keyBySmallContainerO(self, (smallContainert*)i); 5494 terminateO(i); 5495 ck_assert_ptr_eq(r, null); 5496 // null value 5497 r = keyBySmallContainerO(self, null); 5498 ck_assert_ptr_eq(r, null); 5499 // empty self 5500 freeO(self); 5501 r = keyBySmallContainerO(self, value); 5502 ck_assert_ptr_eq(r, null); 5503 terminateO(self); 5504 terminateO(value); 5505 5506 } 5507 5508 5509 void icKeyBySmallDictT(CuTest *tc UNUSED) { 5510 5511 char* r; 5512 smallDictt *self = allocG(rtSmallDictt); 5513 baset *value; 5514 5515 smallDictt *r2 = self->f->setS(self, "1", "QQ"); 5516 ck_assert_ptr_ne(r2, null); 5517 value = (baset*) allocSmallString("qq"); 5518 r = icKeyByO(self, value); 5519 ck_assert_str_eq(r, "1"); 5520 // non existing object 5521 smallIntt *i = allocSmallInt(2); 5522 r = icKeyByO(self, (baset*)i); 5523 terminateO(i); 5524 ck_assert_ptr_eq(r, null); 5525 // null value 5526 r = icKeyByO(self, null); 5527 ck_assert_ptr_eq(r, null); 5528 // empty self 5529 freeO(self); 5530 r = icKeyByO(self, value); 5531 ck_assert_ptr_eq(r, null); 5532 terminateO(self); 5533 terminateO(value); 5534 5535 } 5536 5537 5538 void icKeyBySSmallDictT(CuTest *tc UNUSED) { 5539 5540 char* r; 5541 smallDictt *self = allocG(rtSmallDictt); 5542 5543 smallDictt *r2 = self->f->setS(self, "1", "qwe"); 5544 ck_assert_ptr_ne(r2, null); 5545 r = icKeyBySO(self, "QWE"); 5546 ck_assert_str_eq(r, "1"); 5547 // non existing object 5548 r2 = self->f->setInt(self, "1", 1); 5549 ck_assert_ptr_ne(r2, null); 5550 r = icKeyBySO(self, "qwe"); 5551 ck_assert_ptr_eq(r, null); 5552 // null value 5553 r = icKeyBySO(self, null); 5554 ck_assert_ptr_eq(r, null); 5555 // empty self 5556 freeO(self); 5557 r = icKeyBySO(self, "qwe"); 5558 ck_assert_ptr_eq(r, null); 5559 terminateO(self); 5560 5561 } 5562 5563 5564 void icKeyByCharSmallDictT(CuTest *tc UNUSED) { 5565 5566 char* r; 5567 smallDictt *self = allocG(rtSmallDictt); 5568 5569 smallDictt *r2 = self->f->setS(self, "1", "q"); 5570 ck_assert_ptr_ne(r2, null); 5571 r = icKeyByCharO(self, 'Q'); 5572 ck_assert_str_eq(r, "1"); 5573 // non existing object 5574 r2 = self->f->setInt(self, "1", 1); 5575 ck_assert_ptr_ne(r2, null); 5576 r = icKeyByCharO(self, 'q'); 5577 ck_assert_ptr_eq(r, null); 5578 // empty self 5579 freeO(self); 5580 r = icKeyByCharO(self, 'q'); 5581 ck_assert_ptr_eq(r, null); 5582 terminateO(self); 5583 5584 } 5585 5586 5587 void icKeyByDictSmallDictT(CuTest *tc UNUSED) { 5588 5589 char* r; 5590 smallDictt *self = allocG(rtSmallDictt); 5591 smallDictt *dict = allocSmallDict(); 5592 5593 createAllocateSmallDict(d); 5594 d->f->setS(d, "another", "dict"); 5595 smallDictt *r2 = self->f->setNFreeDict(self, "d", d); 5596 ck_assert_ptr_ne(r2, null); 5597 dict->f->setS(dict, "asd", "asd"); 5598 r2 = self->f->setNFreeDict(self, "1", dict); 5599 ck_assert_ptr_ne(r2, null); 5600 dict = allocSmallDict(); 5601 dict->f->setS(dict, "ASD", "asd"); 5602 r = icKeyByDictO(self, dict); 5603 ck_assert_str_eq(r, "1"); 5604 // non existing object 5605 r2 = self->f->setInt(self, "1", 1); 5606 ck_assert_ptr_ne(r2, null); 5607 r = icKeyByDictO(self, dict); 5608 ck_assert_ptr_eq(r, null); 5609 // non smallDict object 5610 smallIntt *i = allocSmallInt(2); 5611 r = icKeyByDictO(self, (smallDictt*)i); 5612 terminateO(i); 5613 ck_assert_ptr_eq(r, null); 5614 // null value 5615 r = icKeyByDictO(self, null); 5616 ck_assert_ptr_eq(r, null); 5617 // empty self 5618 freeO(self); 5619 r = icKeyByDictO(self, dict); 5620 ck_assert_ptr_eq(r, null); 5621 terminateO(self); 5622 terminateO(dict); 5623 5624 } 5625 5626 5627 void icKeyByArraySmallDictT(CuTest *tc UNUSED) { 5628 5629 char* r; 5630 smallDictt *self = allocG(rtSmallDictt); 5631 smallArrayt *array = allocSmallArray(); 5632 5633 createAllocateSmallArray(d); 5634 d->f->pushS(d, "another array"); 5635 smallDictt *r2 = self->f->setNFreeArray(self, "d", d); 5636 ck_assert_ptr_ne(r2, null); 5637 array->f->pushS(array, "the array"); 5638 r2 = self->f->setNFreeArray(self, "1", array); 5639 ck_assert_ptr_ne(r2, null); 5640 array = allocSmallArray(); 5641 array->f->pushS(array, "The array"); 5642 r = icKeyByArrayO(self, array); 5643 ck_assert_str_eq(r, "1"); 5644 // non existing object 5645 r2 = self->f->setInt(self, "1", 1); 5646 ck_assert_ptr_ne(r2, null); 5647 r = icKeyByArrayO(self, array); 5648 ck_assert_ptr_eq(r, null); 5649 // non smallArray object 5650 smallIntt *i = allocSmallInt(2); 5651 r = icKeyByArrayO(self, (smallArrayt*)i); 5652 terminateO(i); 5653 ck_assert_ptr_eq(r, null); 5654 // null value 5655 r = icKeyByArrayO(self, null); 5656 ck_assert_ptr_eq(r, null); 5657 // empty self 5658 freeO(self); 5659 r = icKeyByArrayO(self, array); 5660 ck_assert_ptr_eq(r, null); 5661 terminateO(self); 5662 terminateO(array); 5663 5664 } 5665 5666 5667 void icKeyByArraycSmallDictT(CuTest *tc UNUSED) { 5668 5669 char* r; 5670 smallDictt *self = allocG(rtSmallDictt); 5671 char **array = listCreateS("a","b"); 5672 5673 char **d = listCreateS("asd", "zxcv"); 5674 smallDictt *r2 = self->f->setNFreeArrayc(self, "d", d); 5675 ck_assert_ptr_ne(r2, null); 5676 r2 = self->f->setArrayc(self, "1", array); 5677 ck_assert_ptr_ne(r2, null); 5678 iUpperS(&array[0]); 5679 r = icKeyByArraycO(self, array); 5680 ck_assert_ptr_ne(r, NULL); 5681 ck_assert_str_eq(r, "1"); 5682 // non existing object 5683 r2 = self->f->setInt(self, "1", 1); 5684 ck_assert_ptr_ne(r2, null); 5685 r = icKeyByArraycO(self, array); 5686 ck_assert_ptr_eq(r, null); 5687 // null value 5688 r = icKeyByArraycO(self, null); 5689 ck_assert_ptr_eq(r, null); 5690 // empty self 5691 freeO(self); 5692 r = icKeyByArraycO(self, array); 5693 ck_assert_ptr_eq(r, null); 5694 terminateO(self); 5695 listFreeS(array); 5696 5697 } 5698 5699 5700 void icKeyBySmallJsonSmallDictT(CuTest *tc UNUSED) { 5701 5702 char* r; 5703 smallDictt *self = allocG(rtSmallDictt); 5704 smallJsont *value = allocSmallJson(); 5705 5706 // undefined 5707 createUndefined(u); 5708 setTopO(value, (baset*)&u); 5709 self->f->setUndefined(self, "1"); 5710 r = self->f->icKeyBySmallJson(self, value); 5711 ck_assert_str_eq(r, "1"); 5712 freeO(value); 5713 // bool 5714 setTopBoolO(value, true); 5715 self->f->setBool(self, "b", true); 5716 r = self->f->icKeyBySmallJson(self, value); 5717 ck_assert_str_eq(r, "b"); 5718 freeO(value); 5719 // double 5720 setTopDoubleO(value, 2.2); 5721 self->f->setDouble(self, "db", 2.2); 5722 r = self->f->icKeyBySmallJson(self, value); 5723 ck_assert_str_eq(r, "db"); 5724 freeO(value); 5725 // int 5726 setTopIntO(value, 2); 5727 self->f->setInt(self, "i", 2); 5728 r = self->f->icKeyBySmallJson(self, value); 5729 ck_assert_str_eq(r, "i"); 5730 freeO(value); 5731 // string 5732 setTopSO(value, "qwe"); 5733 self->f->setS(self, "s", "QWE"); 5734 r = self->f->icKeyBySmallJson(self, value); 5735 ck_assert_str_eq(r, "s"); 5736 freeO(value); 5737 // dict 5738 smallDictt *D = allocSmallDict(); 5739 D->f->setS(D, "q", "wee"); 5740 setTopNFreeDictO(value, D); 5741 D = allocSmallDict(); 5742 D->f->setS(D, "Q", "wee"); 5743 self->f->setNFreeDict(self, "d", D); 5744 r = self->f->icKeyBySmallJson(self, value); 5745 ck_assert_str_eq(r, "d"); 5746 freeO(value); 5747 // array 5748 smallArrayt *a = allocSmallArray(); 5749 a->f->pushS(a, "QWE"); 5750 setTopNFreeArrayO(value, a); 5751 a = allocSmallArray(); 5752 a->f->pushS(a, "qwe"); 5753 self->f->setNFreeArray(self, "a", a); 5754 r = self->f->icKeyBySmallJson(self, value); 5755 ck_assert_str_eq(r, "a"); 5756 freeO(value); 5757 // empty value 5758 r = self->f->icKeyBySmallJson(self, value); 5759 ck_assert_ptr_eq(r, null); 5760 // non smallJson object 5761 smallIntt *i = allocSmallInt(2); 5762 r = self->f->icKeyBySmallJson(self, (smallJsont*)i); 5763 terminateO(i); 5764 ck_assert_ptr_eq(r, null); 5765 // null value 5766 r = self->f->icKeyBySmallJson(self, null); 5767 ck_assert_ptr_eq(r, null); 5768 // empty self 5769 freeO(self); 5770 r = self->f->icKeyBySmallJson(self, value); 5771 ck_assert_ptr_eq(r, null); 5772 terminateO(self); 5773 terminateO(value); 5774 5775 } 5776 5777 5778 void icKeyBySmallStringSmallDictT(CuTest *tc UNUSED) { 5779 5780 char* r; 5781 smallDictt *self = allocG(rtSmallDictt); 5782 smallStringt *value = allocSmallString("qwe"); 5783 5784 createAllocateSmallString(d); 5785 smallDictt *r2 = self->f->setNFreeSmallString(self, "d", d); 5786 ck_assert_ptr_ne(r2, null); 5787 r2 = self->f->setNFreeSmallString(self, "1", value); 5788 ck_assert_ptr_ne(r2, null); 5789 value = allocSmallString("QWE"); 5790 r = icKeyBySmallStringO(self, value); 5791 ck_assert_str_eq(r, "1"); 5792 // non existing object 5793 r2 = self->f->setInt(self, "1", 1); 5794 ck_assert_ptr_ne(r2, null); 5795 r = icKeyBySmallStringO(self, value); 5796 ck_assert_ptr_eq(r, null); 5797 // empty value 5798 freeO(value); 5799 r = icKeyBySmallStringO(self, value); 5800 ck_assert_ptr_eq(r, null); 5801 // non smallString object 5802 smallIntt *i = allocSmallInt(2); 5803 r = icKeyBySmallStringO(self, (smallStringt*)i); 5804 terminateO(i); 5805 ck_assert_ptr_eq(r, null); 5806 // null value 5807 r = icKeyBySmallStringO(self, null); 5808 ck_assert_ptr_eq(r, null); 5809 // empty self 5810 freeO(self); 5811 r = icKeyBySmallStringO(self, value); 5812 ck_assert_ptr_eq(r, null); 5813 terminateO(self); 5814 terminateO(value); 5815 5816 } 5817 5818 5819 void trimSmallDictT(CuTest *tc UNUSED) { 5820 5821 smallDictt* r; 5822 smallDictt *self = allocG(rtSmallDictt); 5823 5824 self->f->setS(self, "1", "2"); 5825 self->f->setS(self, "3", "4"); 5826 self->f->del(self, "3"); 5827 r = trimO(self); 5828 ck_assert_ptr_ne(r, null); 5829 ck_assert_int_eq(lenO(self), 1); 5830 char *s = toStringO(r); 5831 ck_assert_str_eq(s, "{\"1\":\"2\"}"); 5832 free(s); 5833 self->f->del(self, "1"); 5834 r = trimO(self); 5835 ck_assert_ptr_ne(r, null); 5836 ck_assert_int_eq(lenO(self), 0); 5837 s = toStringO(r); 5838 ck_assert_str_eq(s, "{}"); 5839 free(s); 5840 terminateO(self); 5841 5842 } 5843 5844 5845 void keysSmallStringSmallDictT(CuTest *tc UNUSED) { 5846 5847 smallArrayt* r; 5848 smallDictt *self = allocG(rtSmallDictt); 5849 5850 self->f->setS(self, "1", "2"); 5851 self->f->setS(self, "3", "4"); 5852 r = keysSmallStringO(self); 5853 ck_assert_ptr_ne(r, null); 5854 char *s = toStringO(r); 5855 ck_assert_str_eq(s, "[\"1\",\"3\"]"); 5856 free(s); 5857 terminateO(r); 5858 // empty self 5859 freeO(self); 5860 r = keysSmallStringO(self); 5861 ck_assert_ptr_ne(r, null); 5862 s = toStringO(r); 5863 ck_assert_str_eq(s, "[]"); 5864 free(s); 5865 terminateO(r); 5866 terminateO(self); 5867 5868 } 5869 5870 5871 void mergeSmallJsonSmallDictT(CuTest *tc UNUSED) { 5872 5873 smallDictt* r; 5874 smallDictt *self = allocG(rtSmallDictt); 5875 smallJsont *json = allocSmallJson(); 5876 5877 self->f->setS(self, "1", "2"); 5878 self->f->setS(self, "3", "4"); 5879 json->f->setS(json, "3", "#"); 5880 json->f->setInt(json, "4", 0); 5881 r = self->f->mergeSmallJson(self, json); 5882 ck_assert_ptr_ne(r, null); 5883 char *s = toStringO(r); 5884 ck_assert_str_eq(s, "{\"1\":\"2\",\"3\":\"#\",\"4\":0}"); 5885 free(s); 5886 // empty json dict 5887 disposeO(json); 5888 json->f->setS(json, "a", "s"); 5889 delElemO(json, "a"); 5890 trimO(json); 5891 r = self->f->mergeSmallJson(self, json); 5892 ck_assert_ptr_eq(r, self); 5893 // non json dict 5894 freeO(json); 5895 setTopSO(json, "qwe"); 5896 r = self->f->mergeSmallJson(self, json); 5897 ck_assert_ptr_eq(r, null); 5898 // non smallJson object 5899 createAllocateSmallInt(i); 5900 r = self->f->mergeSmallJson(self, (smallJsont*)i); 5901 ck_assert_ptr_eq(r, null); 5902 terminateO(i); 5903 // null 5904 r = self->f->mergeSmallJson(self, null); 5905 ck_assert_ptr_eq(r, null); 5906 terminateO(self); 5907 terminateO(json); 5908 5909 } 5910 5911 5912 void mergeNSmashSmallDictT(CuTest *tc UNUSED) { 5913 5914 smallDictt* r; 5915 smallDictt *self = allocG(rtSmallDictt); 5916 smallDictt *value = allocSmallDict(); 5917 5918 self->f->setS(self, "1", "2"); 5919 self->f->setS(self, "3", "4"); 5920 value->f->setS(value, "3", "#"); 5921 value->f->setInt(value, "4", 0); 5922 r = self->f->mergeNSmash(self, value); 5923 ck_assert_ptr_ne(r, null); 5924 char *s = toStringO(r); 5925 ck_assert_str_eq(s, "{\"1\":\"2\",\"3\":\"#\",\"4\":0}"); 5926 free(s); 5927 // empty dict 5928 value = allocSmallDict(); 5929 r = self->f->mergeNSmash(self, value); 5930 ck_assert_ptr_eq(r, self); 5931 // non smallDict object 5932 createAllocateSmallInt(i); 5933 r = self->f->mergeNSmash(self, (smallDictt*)i); 5934 ck_assert_ptr_eq(r, null); 5935 terminateO(i); 5936 // null 5937 r = self->f->mergeNSmash(self, null); 5938 ck_assert_ptr_eq(r, null); 5939 terminateO(self); 5940 5941 } 5942 5943 5944 void mergeNSmashSmallJsonSmallDictT(CuTest *tc UNUSED) { 5945 5946 smallDictt* r; 5947 smallDictt *self = allocG(rtSmallDictt); 5948 smallJsont *value = allocSmallJson(); 5949 5950 self->f->setS(self, "1", "2"); 5951 self->f->setS(self, "3", "4"); 5952 value->f->setS(value, "3", "#"); 5953 value->f->setInt(value, "4", 0); 5954 r = self->f->mergeNSmashSmallJson(self, value); 5955 ck_assert_ptr_ne(r, null); 5956 char *s = toStringO(r); 5957 ck_assert_str_eq(s, "{\"1\":\"2\",\"3\":\"#\",\"4\":0}"); 5958 free(s); 5959 // empty json dict 5960 value = allocSmallJson(); 5961 value->f->setS(value, "a", "s"); 5962 delElemO(value, "a"); 5963 trimO(value); 5964 r = self->f->mergeNSmashSmallJson(self, value); 5965 ck_assert_ptr_eq(r, self); 5966 // non smallDict object 5967 createAllocateSmallInt(i); 5968 r = self->f->mergeNSmashSmallJson(self, (smallJsont*)i); 5969 ck_assert_ptr_eq(r, null); 5970 terminateO(i); 5971 // null 5972 r = self->f->mergeNSmashSmallJson(self, null); 5973 ck_assert_ptr_eq(r, null); 5974 terminateO(self); 5975 5976 } 5977 5978 5979 void appendNSmashSmallDictT(CuTest *tc UNUSED) { 5980 5981 smallDictt* r; 5982 smallDictt *self = allocG(rtSmallDictt); 5983 smallDictt *value = allocSmallDict(); 5984 5985 self->f->setS(self, "1", "2"); 5986 self->f->setS(self, "3", "4"); 5987 value->f->setS(value, "3", "#"); 5988 value->f->setInt(value, "4", 0); 5989 smallt *data = sDictGetTiny(value->d, "3"); 5990 r = self->f->appendNSmash(self, value); 5991 ck_assert_ptr_ne(r, null); 5992 sFree(data); 5993 char *s = toStringO(r); 5994 ck_assert_str_eq(s, "{\"1\":\"2\",\"3\":\"4\",\"4\":0}"); 5995 free(s); 5996 // empty dict 5997 value = allocSmallDict(); 5998 r = self->f->appendNSmash(self, value); 5999 ck_assert_ptr_eq(r, self); 6000 // non smallDict object 6001 createAllocateSmallInt(i); 6002 r = self->f->appendNSmash(self, (smallDictt*)i); 6003 ck_assert_ptr_eq(r, null); 6004 terminateO(i); 6005 // null 6006 r = self->f->appendNSmash(self, null); 6007 ck_assert_ptr_eq(r, null); 6008 terminateO(self); 6009 6010 } 6011 6012 6013 void equalSmallDictBaseT(CuTest *tc UNUSED) { 6014 6015 bool r; 6016 smallDictt* self = allocG(rtSmallDictt); 6017 6018 createAllocateSmallDict(d); 6019 r = self->f->equalBase(self, (baset*)d); 6020 ck_assert(!r); 6021 terminateO(d); 6022 // non smallDict 6023 createAllocateSmallInt(i); 6024 r = self->f->equalBase(self, (baset*)i); 6025 terminateO(i); 6026 ck_assert(!r); 6027 // null 6028 r = self->f->equalBase(self, null); 6029 ck_assert(!r); 6030 terminateO(self); 6031 6032 } 6033 6034 6035 void equalSmallDictSmallJsonT(CuTest *tc UNUSED) { 6036 6037 bool r; 6038 smallDictt* self = allocG(rtSmallDictt); 6039 smallJsont* p2 = allocSmallJson(); 6040 6041 self->f->setS(self, "3", "#"); 6042 p2->f->setS(p2, "3", "#"); 6043 r = self->f->equalSmallJson(self, p2); 6044 ck_assert(r); 6045 // non json dict 6046 freeO(self); 6047 freeO(p2); 6048 r = self->f->equalSmallJson(self, p2); 6049 ck_assert(!r); 6050 terminateO(p2); 6051 // non smallJson 6052 createAllocateSmallInt(i); 6053 r = self->f->equalSmallJson(self, (smallJsont*)i); 6054 terminateO(i); 6055 ck_assert(!r); 6056 // null 6057 r = self->f->equalSmallJson(self, null); 6058 ck_assert(!r); 6059 terminateO(self); 6060 6061 } 6062 6063 6064 void equalSmallDictT(CuTest *tc UNUSED) { 6065 6066 bool r; 6067 smallDictt* self = allocG(rtSmallDictt); 6068 smallDictt* p2 = allocSmallDict(); 6069 6070 self->f->setS(self, "3", "#"); 6071 p2->f->setS(p2, "3", "#"); 6072 r = self->f->equal(self, p2); 6073 ck_assert(r); 6074 // not equal 6075 self->f->setS(self, "4", "#"); 6076 p2->f->setS(p2, "4", "$"); 6077 r = self->f->equal(self, p2); 6078 ck_assert(!r); 6079 // different keys 6080 self->f->del(self, "4"); 6081 self->f->setS(self, "$", "#"); 6082 r = self->f->equal(self, p2); 6083 ck_assert(!r); 6084 // different key count 6085 p2->f->del(p2, "4"); 6086 r = self->f->equal(self, p2); 6087 ck_assert(!r); 6088 // empty dict 6089 freeO(p2); 6090 r = self->f->equal(self, p2); 6091 ck_assert(!r); 6092 terminateO(p2); 6093 // non smallDict 6094 createAllocateSmallInt(i); 6095 r = self->f->equal(self, (smallDictt*)i); 6096 terminateO(i); 6097 ck_assert(!r); 6098 // null 6099 r = self->f->equal(self, null); 6100 ck_assert(!r); 6101 terminateO(self); 6102 6103 } 6104 6105 6106 void icEqualSmallDictBaseT(CuTest *tc UNUSED) { 6107 6108 bool r; 6109 smallDictt* self = allocG(rtSmallDictt); 6110 6111 createAllocateSmallDict(d); 6112 self->f->setS(self, "q", "q"); 6113 d->f->setS(d, "q", "Q"); 6114 r = self->f->icEqualBase(self, (baset*)d); 6115 ck_assert(r); 6116 terminateO(d); 6117 // non smallDict 6118 createAllocateSmallInt(i); 6119 r = self->f->icEqualBase(self, (baset*)i); 6120 terminateO(i); 6121 ck_assert(!r); 6122 // null 6123 r = self->f->icEqualBase(self, null); 6124 ck_assert(!r); 6125 terminateO(self); 6126 6127 } 6128 6129 6130 void icEqualSmallDictSmallJsonT(CuTest *tc UNUSED) { 6131 6132 bool r; 6133 smallDictt* self = allocG(rtSmallDictt); 6134 smallJsont* p2 = allocSmallJson(); 6135 6136 self->f->setS(self, "3", "W"); 6137 p2->f->setS(p2, "3", "w"); 6138 r = self->f->icEqualSmallJson(self, p2); 6139 ck_assert(r); 6140 // non json dict 6141 freeO(self); 6142 freeO(p2); 6143 r = self->f->icEqualSmallJson(self, p2); 6144 ck_assert(!r); 6145 terminateO(p2); 6146 // non smallJson 6147 createAllocateSmallInt(i); 6148 r = self->f->icEqualSmallJson(self, (smallJsont*)i); 6149 terminateO(i); 6150 ck_assert(!r); 6151 // null 6152 r = self->f->icEqualSmallJson(self, null); 6153 ck_assert(!r); 6154 terminateO(self); 6155 6156 } 6157 6158 6159 void icEqualSmallDictT(CuTest *tc UNUSED) { 6160 6161 bool r; 6162 smallDictt* self = allocG(rtSmallDictt); 6163 smallDictt* p2 = allocSmallDict(); 6164 6165 self->f->setS(self, "3", "A"); 6166 p2->f->setS(p2, "3", "a"); 6167 r = self->f->icEqual(self, p2); 6168 ck_assert(r); 6169 // not equal 6170 self->f->setS(self, "4", "#"); 6171 p2->f->setS(p2, "4", "$"); 6172 r = self->f->icEqual(self, p2); 6173 ck_assert(!r); 6174 // different keys 6175 self->f->del(self, "4"); 6176 self->f->setS(self, "$", "#"); 6177 r = self->f->icEqual(self, p2); 6178 ck_assert(!r); 6179 // different key count 6180 p2->f->del(p2, "4"); 6181 r = self->f->icEqual(self, p2); 6182 ck_assert(!r); 6183 // empty dict 6184 freeO(p2); 6185 r = self->f->icEqual(self, p2); 6186 ck_assert(!r); 6187 terminateO(p2); 6188 // non smallDict 6189 createAllocateSmallInt(i); 6190 r = self->f->icEqual(self, (smallDictt*)i); 6191 terminateO(i); 6192 ck_assert(!r); 6193 // null 6194 r = self->f->icEqual(self, null); 6195 ck_assert(!r); 6196 terminateO(self); 6197 6198 } 6199 6200 6201 void isEmptySmallDictT(CuTest *tc UNUSED) { 6202 6203 bool r; 6204 smallDictt *self = allocG(rtSmallDictt); 6205 6206 r = isEmptyO(self); 6207 ck_assert(r); 6208 self->f->setInt(self, "a", 1); 6209 r = isEmptyO(self); 6210 ck_assert(!r); 6211 self->f->del(self, "a"); 6212 r = isEmptyO(self); 6213 ck_assert(r); 6214 terminateO(self); 6215 6216 } 6217 6218 bool enumerateElement(void *closure, char *key UNUSED, baset *element UNUSED) { 6219 int *c = closure; 6220 (*c)++; 6221 return *c != 2 ? true : false; 6222 } 6223 6224 void enumerateSmallDictFT(CuTest *tc UNUSED) { 6225 6226 smallDictt *self = allocG(rtSmallDictt); 6227 int closure = 0; 6228 6229 self->f->enumerate(self, &closure, enumerateElement); 6230 self->f->setInt(self, "a", 1); 6231 self->f->setInt(self, "b", 2); 6232 self->f->setInt(self, "c", 3); 6233 self->f->del(self, "a"); 6234 self->f->enumerate(self, &closure, enumerateElement); 6235 ck_assert_int_eq(closure, 2); 6236 // baset object in container 6237 closure = -2; 6238 smallIntt *i = allocSmallInt(2); 6239 i->type = "randomClass"; 6240 self->f->set(self, "d", (baset*)i); 6241 i = allocSmallInt(3); 6242 i->type = "randomClass"; 6243 self->f->set(self, "e", (baset*)i); 6244 self->f->enumerate(self, &closure, enumerateElement); 6245 ck_assert_int_eq(closure, 2); 6246 terminateO(self); 6247 6248 } 6249 6250 6251 void iterStartSmallDictT(CuTest *tc UNUSED) { 6252 6253 baset* r; 6254 smallDictt *self = allocG(rtSmallDictt); 6255 6256 // dict with keys and values 6257 self->f->setInt(self, "a", 1); 6258 self->f->setInt(self, "b", 2); 6259 r = iterStartO(self); 6260 ck_assert_ptr_ne(r, NULL); 6261 ck_assert(isOSmallInt(r)); 6262 // dict with objects from other classes 6263 emptyO(self); 6264 smallIntt *ip = allocSmallInt(2); 6265 ip->type = "anothertype"; 6266 self->f->set(self, "d", (baset*)ip); 6267 r = iterStartO(self); 6268 ck_assert_ptr_ne(r, NULL); 6269 // dict with deleted elements 6270 self->f->setInt(self, "a", 1); 6271 self->f->del(self, "d"); 6272 r = iterStartO(self); 6273 ck_assert_ptr_ne(r, NULL); 6274 // call iterStart again to trigger if (self->iterElementDataType != SH_DT_BASET) finishO(self->iterElement); 6275 r = iterStartO(self); 6276 ck_assert_ptr_ne(r, NULL); 6277 // empty self 6278 emptyO(self); 6279 r = iterStartO(self); 6280 ck_assert_ptr_eq(r, NULL); 6281 terminateO(self); 6282 6283 } 6284 6285 6286 void iterStartKeySmallDictT(CuTest *tc UNUSED) { 6287 6288 const char* r; 6289 smallDictt *self = allocG(rtSmallDictt); 6290 6291 // dict with keys and values 6292 self->f->setInt(self, "a", 1); 6293 self->f->setInt(self, "b", 2); 6294 r = iterStartKeyO(self); 6295 ck_assert_ptr_ne(r, NULL); 6296 ck_assert_str_eq(r, "a"); 6297 // dict with objects from other classes 6298 emptyO(self); 6299 smallIntt *ip = allocSmallInt(2); 6300 ip->type = "anothertype"; 6301 self->f->set(self, "d", (baset*)ip); 6302 r = iterStartKeyO(self); 6303 ck_assert_ptr_ne(r, NULL); 6304 ck_assert_str_eq(r, "d"); 6305 // dict with deleted elements 6306 self->f->setInt(self, "a", 1); 6307 self->f->del(self, "d"); 6308 r = iterStartKeyO(self); 6309 ck_assert_ptr_ne(r, NULL); 6310 ck_assert_str_eq(r, "a"); 6311 // call iterStart again to trigger if (self->iterElementDataType != SH_DT_BASET) finishO(self->iterElement); 6312 r = iterStartKeyO(self); 6313 ck_assert_ptr_ne(r, NULL); 6314 ck_assert_str_eq(r, "a"); 6315 // empty self 6316 emptyO(self); 6317 r = iterStartKeyO(self); 6318 ck_assert_ptr_eq(r, NULL); 6319 terminateO(self); 6320 6321 } 6322 6323 6324 void iterNextSmallDictT(CuTest *tc UNUSED) { 6325 6326 baset* r; 6327 smallDictt *self = allocG(rtSmallDictt); 6328 6329 // dict with keys and values 6330 self->f->setInt(self, "a", 1); 6331 self->f->setInt(self, "b", 2); 6332 r = iterStartO(self); 6333 ck_assert_ptr_ne(r, NULL); 6334 ck_assert(isOSmallInt(r)); 6335 smallIntt *i = (smallIntt*)r; 6336 ck_assert_int_eq(getValO(i), 1); 6337 r = iterNextO(self); 6338 ck_assert_ptr_ne(r, NULL); 6339 ck_assert(isOSmallInt(r)); 6340 i = (smallIntt*)r; 6341 ck_assert_int_eq(getValO(i), 2); 6342 // dict with objects from other classes 6343 emptyO(self); 6344 smallIntt *ip = allocSmallInt(2); 6345 ip->type = "anothertype"; 6346 self->f->set(self, "d", (baset*)ip); 6347 self->f->setInt(self, "a", 1); 6348 ip = allocSmallInt(3); 6349 ip->type = "anothertype2"; 6350 self->f->set(self, "e", (baset*)ip); 6351 self->f->setInt(self, "b", 2); 6352 self->f->del(self, "a"); 6353 self->f->del(self, "b"); 6354 r = iterStartO(self); 6355 ck_assert_ptr_ne(r, NULL); 6356 ck_assert(isOType(r, "anothertype")); 6357 r = iterNextO(self); 6358 ck_assert_ptr_ne(r, NULL); 6359 ck_assert(isOType(r, "anothertype2")); 6360 // iteration ended 6361 r = iterNextO(self); 6362 ck_assert_ptr_eq(r, NULL); 6363 // empty self, uninitialized iterator 6364 emptyO(self); 6365 r = iterNextO(self); 6366 ck_assert_ptr_eq(r, NULL); 6367 terminateO(self); 6368 6369 } 6370 6371 6372 void iterNextKeySmallDictT(CuTest *tc UNUSED) { 6373 6374 const char* r; 6375 smallDictt *self = allocG(rtSmallDictt); 6376 6377 // dict with keys and values 6378 self->f->setInt(self, "a", 1); 6379 self->f->setInt(self, "b", 2); 6380 r = iterStartKeyO(self); 6381 ck_assert_ptr_ne(r, NULL); 6382 ck_assert_str_eq(r, "a"); 6383 r = iterNextKeyO(self); 6384 ck_assert_ptr_ne(r, NULL); 6385 ck_assert_str_eq(r, "b"); 6386 // dict with objects from other classes 6387 emptyO(self); 6388 smallIntt *ip = allocSmallInt(2); 6389 ip->type = "anothertype"; 6390 self->f->set(self, "d", (baset*)ip); 6391 self->f->setInt(self, "a", 1); 6392 ip = allocSmallInt(3); 6393 ip->type = "anothertype2"; 6394 self->f->set(self, "e", (baset*)ip); 6395 self->f->setInt(self, "b", 2); 6396 self->f->del(self, "a"); 6397 self->f->del(self, "b"); 6398 r = iterStartKeyO(self); 6399 ck_assert_ptr_ne(r, NULL); 6400 ck_assert_str_eq(r, "d"); 6401 r = iterNextKeyO(self); 6402 ck_assert_ptr_ne(r, NULL); 6403 ck_assert_str_eq(r, "e"); 6404 // iteration ended 6405 r = iterNextKeyO(self); 6406 ck_assert_ptr_eq(r, NULL); 6407 // empty self 6408 emptyO(self); 6409 r = iterNextKeyO(self); 6410 ck_assert_ptr_eq(r, NULL); 6411 terminateO(self); 6412 6413 } 6414 6415 6416 void iterElementSmallDictT(CuTest *tc UNUSED) { 6417 6418 baset* r; 6419 smallDictt *self = allocG(rtSmallDictt); 6420 6421 self->f->setInt(self, "a", 1); 6422 r = iterStartO(self); 6423 ck_assert_ptr_ne(r, NULL); 6424 r = iterElementO(self); 6425 ck_assert_ptr_ne(r, NULL); 6426 char *s = toStringO(r); 6427 ck_assert_str_eq(s, "1"); 6428 free(s); 6429 // empty self 6430 freeO(self); 6431 r = iterElementO(self); 6432 ck_assert_ptr_eq(r, NULL); 6433 terminateO(self); 6434 6435 } 6436 6437 6438 void iterKeySmallDictT(CuTest *tc UNUSED) { 6439 6440 const char* r; 6441 smallDictt *self = allocG(rtSmallDictt); 6442 6443 self->f->setInt(self, "a", 1); 6444 baset *r2 = iterStartO(self); 6445 ck_assert_ptr_ne(r2, NULL); 6446 r = iterKeyO(self); 6447 ck_assert_ptr_ne(r, NULL); 6448 ck_assert_str_eq(r, "a"); 6449 // empty self 6450 freeO(self); 6451 r = iterKeyO(self); 6452 ck_assert_ptr_eq(r, NULL); 6453 terminateO(self); 6454 6455 } 6456 6457 6458 void zipSmallDictT(CuTest *tc UNUSED) { 6459 6460 smallDictt* r; 6461 smallDictt *self = allocG(rtSmallDictt); 6462 smallArrayt *keys = allocSmallArray(); 6463 smallArrayt *values = allocSmallArray(); 6464 6465 self->f->setInt(self, "", 1); 6466 // 3 elements in keys 6467 // 2 elements in values 6468 // only 2 key/values are zipped 6469 keys->f->pushS(keys, "a"); 6470 keys->f->pushS(keys, "b"); 6471 keys->f->pushS(keys, "c"); 6472 values->f->pushInt(values, 1); 6473 values->f->pushInt(values, 2); 6474 r = zipO(self, keys, values); 6475 terminateO(keys); 6476 smashO(values); 6477 ck_assert_ptr_ne(r, NULL); 6478 char *s = toStringO(r); 6479 ck_assert_str_eq(s, "{\"\":1,\"a\":1,\"b\":2}"); 6480 free(s); 6481 // keys array with non string objects 6482 keys = allocSmallArray(); 6483 values = allocSmallArray(); 6484 keys->f->pushInt(keys, 1); 6485 values->f->pushInt(values, 1); 6486 r = zipO(self, keys, values); 6487 ck_assert_ptr_eq(r, NULL); 6488 terminateO(keys); 6489 terminateO(values); 6490 // empty values 6491 keys = allocSmallArray(); 6492 values = allocSmallArray(); 6493 keys->f->pushInt(keys, 1); 6494 r = zipO(self, keys, values); 6495 ck_assert_ptr_eq(r, self); 6496 terminateO(keys); 6497 // non smallArray object 6498 keys = (smallArrayt*) allocSmallInt(1); 6499 r = zipO(self, keys, values); 6500 ck_assert_ptr_eq(r, null); 6501 terminateO(keys); 6502 keys = allocSmallArray(); 6503 terminateO(values); 6504 values = (smallArrayt*) allocSmallInt(2); 6505 r = zipO(self, keys, values); 6506 ck_assert_ptr_eq(r, null); 6507 // null 6508 r = zipO(self, null, values); 6509 ck_assert_ptr_eq(r, null); 6510 r = zipO(self, keys, null); 6511 ck_assert_ptr_eq(r, null); 6512 terminateO(keys); 6513 terminateO(values); 6514 terminateO(self); 6515 6516 } 6517 6518 6519 void zipSmallJsonSmallDictT(CuTest *tc UNUSED) { 6520 6521 smallDictt* r; 6522 smallDictt *self = allocG(rtSmallDictt); 6523 smallArrayt *keys = allocSmallArray(); 6524 smallJsont *values = allocSmallJson(); 6525 6526 self->f->setInt(self, "", 1); 6527 // 3 elements in keys 6528 // 2 elements in values 6529 // only 2 key/values are zipped 6530 keys->f->pushS(keys, "a"); 6531 keys->f->pushS(keys, "b"); 6532 keys->f->pushS(keys, "c"); 6533 values->f->pushInt(values, 1); 6534 values->f->pushInt(values, 2); 6535 r = self->f->zipSmallJson(self, keys, values); 6536 terminateO(keys); 6537 smashO(values); 6538 ck_assert_ptr_ne(r, NULL); 6539 char *s = toStringO(r); 6540 ck_assert_str_eq(s, "{\"\":1,\"a\":1,\"b\":2}"); 6541 free(s); 6542 // keys array with non string objects 6543 keys = allocSmallArray(); 6544 values = allocSmallJson(); 6545 keys->f->pushInt(keys, 1); 6546 values->f->pushInt(values, 1); 6547 r = self->f->zipSmallJson(self, keys, values); 6548 ck_assert_ptr_eq(r, NULL); 6549 terminateO(keys); 6550 terminateO(values); 6551 // empty values 6552 keys = allocSmallArray(); 6553 values = allocSmallJson(); 6554 keys->f->pushInt(keys, 1); 6555 values->f->pushInt(values, 1); 6556 delElemIndexO(values, 0); 6557 trimO(values); 6558 r = self->f->zipSmallJson(self, keys, values); 6559 ck_assert_ptr_eq(r, self); 6560 terminateO(keys); 6561 // non smallArray object 6562 keys = (smallArrayt*) allocSmallInt(1); 6563 r = self->f->zipSmallJson(self, keys, values); 6564 ck_assert_ptr_eq(r, null); 6565 terminateO(keys); 6566 keys = allocSmallArray(); 6567 terminateO(values); 6568 // non json array 6569 values = allocSmallJson(); 6570 setTopIntO(values, 1); 6571 r = self->f->zipSmallJson(self, keys, values); 6572 ck_assert_ptr_eq(r, null); 6573 terminateO(values); 6574 // non smallJson values 6575 values = (smallJsont*) allocSmallInt(2); 6576 r = self->f->zipSmallJson(self, keys, values); 6577 ck_assert_ptr_eq(r, null); 6578 // null 6579 r = self->f->zipSmallJson(self, null, values); 6580 ck_assert_ptr_eq(r, null); 6581 r = self->f->zipSmallJson(self, keys, null); 6582 ck_assert_ptr_eq(r, null); 6583 terminateO(keys); 6584 terminateO(values); 6585 terminateO(self); 6586 6587 } 6588 6589 6590 void zipSmallJsonSmallArraySmallDictT(CuTest *tc UNUSED) { 6591 6592 smallDictt* r; 6593 smallDictt *self = allocG(rtSmallDictt); 6594 smallJsont *keys = allocSmallJson(); 6595 smallArrayt *values = allocSmallArray(); 6596 6597 self->f->setInt(self, "", 1); 6598 // 3 elements in keys 6599 // 2 elements in values 6600 // only 2 key/values are zipped 6601 keys->f->pushS(keys, "a"); 6602 keys->f->pushS(keys, "b"); 6603 keys->f->pushS(keys, "c"); 6604 values->f->pushInt(values, 1); 6605 values->f->pushInt(values, 2); 6606 r = self->f->zipSmallJsonSmallArray(self, keys, values); 6607 terminateO(keys); 6608 smashO(values); 6609 ck_assert_ptr_ne(r, NULL); 6610 char *s = toStringO(r); 6611 ck_assert_str_eq(s, "{\"\":1,\"a\":1,\"b\":2}"); 6612 free(s); 6613 // keys array with non string objects 6614 keys = allocSmallJson(); 6615 values = allocSmallArray(); 6616 keys->f->pushInt(keys, 1); 6617 values->f->pushInt(values, 1); 6618 r = self->f->zipSmallJsonSmallArray(self, keys, values); 6619 ck_assert_ptr_eq(r, NULL); 6620 terminateO(keys); 6621 terminateO(values); 6622 // empty values 6623 keys = allocSmallJson(); 6624 values = allocSmallArray(); 6625 keys->f->pushInt(keys, 1); 6626 r = self->f->zipSmallJsonSmallArray(self, keys, values); 6627 ck_assert_ptr_eq(r, self); 6628 terminateO(keys); 6629 // non json array keys 6630 keys = allocSmallJson(); 6631 setTopIntO(keys, 1); 6632 r = self->f->zipSmallJsonSmallArray(self, keys, values); 6633 ck_assert_ptr_eq(r, null); 6634 terminateO(keys); 6635 // non smallArray object 6636 keys = (smallJsont*) allocSmallInt(1); 6637 r = self->f->zipSmallJsonSmallArray(self, keys, values); 6638 ck_assert_ptr_eq(r, null); 6639 terminateO(keys); 6640 keys = allocSmallJson(); 6641 terminateO(values); 6642 values = (smallArrayt*) allocSmallInt(2); 6643 r = self->f->zipSmallJsonSmallArray(self, keys, values); 6644 ck_assert_ptr_eq(r, null); 6645 // null 6646 r = self->f->zipSmallJsonSmallArray(self, null, values); 6647 ck_assert_ptr_eq(r, null); 6648 r = self->f->zipSmallJsonSmallArray(self, keys, null); 6649 ck_assert_ptr_eq(r, null); 6650 terminateO(keys); 6651 terminateO(values); 6652 terminateO(self); 6653 6654 } 6655 6656 6657 void zipSmallJsonSmallJsonSmallDictT(CuTest *tc UNUSED) { 6658 6659 smallDictt* r; 6660 smallDictt *self = allocG(rtSmallDictt); 6661 smallJsont *keys = allocSmallJson(); 6662 smallJsont *values = allocSmallJson(); 6663 6664 self->f->setInt(self, "", 1); 6665 // 3 elements in keys 6666 // 2 elements in values 6667 // only 2 key/values are zipped 6668 keys->f->pushS(keys, "a"); 6669 keys->f->pushS(keys, "b"); 6670 keys->f->pushS(keys, "c"); 6671 values->f->pushInt(values, 1); 6672 values->f->pushInt(values, 2); 6673 r = zipSmallJsonSmallJsonO(self, keys, values); 6674 terminateO(keys); 6675 smashO(values); 6676 ck_assert_ptr_ne(r, NULL); 6677 char *s = toStringO(r); 6678 ck_assert_str_eq(s, "{\"\":1,\"a\":1,\"b\":2}"); 6679 free(s); 6680 // keys array with non string objects 6681 keys = allocSmallJson(); 6682 values = allocSmallJson(); 6683 keys->f->pushInt(keys, 1); 6684 values->f->pushInt(values, 1); 6685 r = zipSmallJsonSmallJsonO(self, keys, values); 6686 ck_assert_ptr_eq(r, NULL); 6687 terminateO(keys); 6688 terminateO(values); 6689 // empty values 6690 keys = allocSmallJson(); 6691 values = allocSmallJson(); 6692 keys->f->pushInt(keys, 1); 6693 values->f->pushInt(values, 1); 6694 delElemIndexO(values, 0); 6695 trimO(values); 6696 r = zipSmallJsonSmallJsonO(self, keys, values); 6697 ck_assert_ptr_eq(r, self); 6698 terminateO(keys); 6699 // non json array keys 6700 keys = allocSmallJson(); 6701 setTopIntO(keys, 1); 6702 r = zipSmallJsonSmallJsonO(self, keys, values); 6703 ck_assert_ptr_eq(r, null); 6704 terminateO(keys); 6705 // non json array values 6706 keys = allocSmallJson(); 6707 keys->f->pushInt(keys, 1); 6708 freeO(values); 6709 setTopIntO(values, 1); 6710 r = zipSmallJsonSmallJsonO(self, keys, values); 6711 ck_assert_ptr_eq(r, null); 6712 terminateO(keys); 6713 terminateO(values); 6714 // non smallJson object 6715 keys = (smallJsont*) allocSmallInt(1); 6716 values = allocSmallJson(); 6717 r = zipSmallJsonSmallJsonO(self, keys, values); 6718 ck_assert_ptr_eq(r, null); 6719 terminateO(keys); 6720 keys = allocSmallJson(); 6721 terminateO(values); 6722 values = (smallJsont*) allocSmallInt(2); 6723 r = zipSmallJsonSmallJsonO(self, keys, values); 6724 ck_assert_ptr_eq(r, null); 6725 // null 6726 r = zipSmallJsonSmallJsonO(self, null, values); 6727 ck_assert_ptr_eq(r, null); 6728 r = zipSmallJsonSmallJsonO(self, keys, null); 6729 ck_assert_ptr_eq(r, null); 6730 terminateO(keys); 6731 terminateO(values); 6732 terminateO(self); 6733 6734 } 6735 6736 6737 void zipSmallJsonVArraySmallDictT(CuTest *tc UNUSED) { 6738 6739 smallDictt* r; 6740 smallDictt *self = allocG(rtSmallDictt); 6741 smallJsont *keys = allocSmallJson(); 6742 char** values; 6743 6744 self->f->setInt(self, "", 1); 6745 // 3 elements in keys 6746 // 2 elements in values 6747 // only 2 key/values are zipped 6748 keys->f->pushS(keys, "a"); 6749 keys->f->pushS(keys, "b"); 6750 keys->f->pushS(keys, "c"); 6751 values = listCreateS("1", "2"); 6752 r = zipSmallJsonVArrayO(self, keys, values); 6753 terminateO(keys); 6754 listFreeS(values); 6755 ck_assert_ptr_ne(r, NULL); 6756 char *s = toStringO(r); 6757 ck_assert_str_eq(s, "{\"\":1,\"a\":\"1\",\"b\":\"2\"}"); 6758 free(s); 6759 // keys array with non string objects 6760 keys = allocSmallJson(); 6761 keys->f->pushInt(keys, 1); 6762 values = listCreateS("1"); 6763 r = zipSmallJsonVArrayO(self, keys, values); 6764 ck_assert_ptr_eq(r, NULL); 6765 terminateO(keys); 6766 listFreeS(values); 6767 // empty values 6768 keys = allocSmallJson(); 6769 keys->f->pushInt(keys, 1); 6770 listEmptyS(values); 6771 r = zipSmallJsonVArrayO(self, keys, values); 6772 ck_assert_ptr_eq(r, self); 6773 terminateO(keys); 6774 // non json array keys 6775 keys = allocSmallJson(); 6776 setTopIntO(keys, 1); 6777 r = zipSmallJsonVArrayO(self, keys, values); 6778 ck_assert_ptr_eq(r, null); 6779 terminateO(keys); 6780 // non smallArray object 6781 keys = (smallJsont*) allocSmallInt(1); 6782 r = zipSmallJsonVArrayO(self, keys, values); 6783 ck_assert_ptr_eq(r, null); 6784 terminateO(keys); 6785 keys = allocSmallJson(); 6786 // null 6787 r = zipSmallJsonVArrayO(self, null, values); 6788 ck_assert_ptr_eq(r, null); 6789 r = zipSmallJsonVArrayO(self, keys, null); 6790 ck_assert_ptr_eq(r, null); 6791 terminateO(keys); 6792 listFreeS(values); 6793 terminateO(self); 6794 6795 } 6796 6797 6798 void zipArraySmallDictT(CuTest *tc UNUSED) { 6799 6800 smallDictt* r; 6801 smallDictt *self = allocG(rtSmallDictt); 6802 char** keys; 6803 smallArrayt *values = allocSmallArray(); 6804 6805 self->f->setInt(self, "", 1); 6806 // 3 elements in keys 6807 // 2 elements in values 6808 // only 2 key/values are zipped 6809 keys = listCreateS("a", "b", "c"); 6810 values->f->pushInt(values, 1); 6811 values->f->pushInt(values, 2); 6812 r = zipArrayO(self, keys, values); 6813 listFreeS(keys); 6814 smashO(values); 6815 ck_assert_ptr_ne(r, NULL); 6816 char *s = toStringO(r); 6817 ck_assert_str_eq(s, "{\"\":1,\"a\":1,\"b\":2}"); 6818 free(s); 6819 // empty values 6820 keys = listCreateS("a"); 6821 values = allocSmallArray(); 6822 r = zipArrayO(self, keys, values); 6823 ck_assert_ptr_eq(r, self); 6824 // non smallArray object 6825 terminateO(values); 6826 values = (smallArrayt*) allocSmallInt(2); 6827 r = zipArrayO(self, keys, values); 6828 ck_assert_ptr_eq(r, null); 6829 // null 6830 r = zipArrayO(self, null, values); 6831 ck_assert_ptr_eq(r, null); 6832 r = zipArrayO(self, keys, null); 6833 ck_assert_ptr_eq(r, null); 6834 listFreeS(keys); 6835 terminateO(values); 6836 terminateO(self); 6837 6838 } 6839 6840 6841 void zipArraySmallJsonSmallDictT(CuTest *tc UNUSED) { 6842 6843 smallDictt* r; 6844 smallDictt *self = allocG(rtSmallDictt); 6845 char** keys; 6846 smallJsont *values = allocSmallJson(); 6847 6848 self->f->setInt(self, "", 1); 6849 // 3 elements in keys 6850 // 2 elements in values 6851 // only 2 key/values are zipped 6852 keys = listCreateS("a", "b", "c"); 6853 values->f->pushInt(values, 1); 6854 values->f->pushInt(values, 2); 6855 r = self->f->zipArraySmallJson(self, keys, values); 6856 listFreeS(keys); 6857 smashO(values); 6858 ck_assert_ptr_ne(r, NULL); 6859 char *s = toStringO(r); 6860 ck_assert_str_eq(s, "{\"\":1,\"a\":1,\"b\":2}"); 6861 free(s); 6862 // empty values 6863 keys = listCreateS("a"); 6864 values = allocSmallJson(); 6865 values->f->pushInt(values, 1); 6866 delElemIndexO(values, 0); 6867 trimO(values); 6868 r = self->f->zipArraySmallJson(self, keys, values); 6869 ck_assert_ptr_eq(r, self); 6870 terminateO(values); 6871 // non json array 6872 values = allocSmallJson(); 6873 setTopIntO(values, 1); 6874 r = self->f->zipArraySmallJson(self, keys, values); 6875 ck_assert_ptr_eq(r, null); 6876 terminateO(values); 6877 // non smallJson values 6878 values = (smallJsont*) allocSmallInt(2); 6879 r = self->f->zipArraySmallJson(self, keys, values); 6880 ck_assert_ptr_eq(r, null); 6881 // null 6882 r = self->f->zipArraySmallJson(self, null, values); 6883 ck_assert_ptr_eq(r, null); 6884 r = self->f->zipArraySmallJson(self, keys, null); 6885 ck_assert_ptr_eq(r, null); 6886 listFreeS(keys); 6887 terminateO(values); 6888 terminateO(self); 6889 6890 } 6891 6892 6893 void zipArrayArraySmallDictT(CuTest *tc UNUSED) { 6894 6895 smallDictt* r; 6896 smallDictt *self = allocG(rtSmallDictt); 6897 char** keys; 6898 char** values; 6899 6900 self->f->setInt(self, "", 1); 6901 // 3 elements in keys 6902 // 2 elements in values 6903 // only 2 key/values are zipped 6904 keys = listCreateS("a", "b", "c"); 6905 values = listCreateS("1", "2"); 6906 r = zipArrayArrayO(self, keys, values); 6907 listFreeS(keys); 6908 listFreeS(values); 6909 ck_assert_ptr_ne(r, NULL); 6910 char *s = toStringO(r); 6911 ck_assert_str_eq(s, "{\"\":1,\"a\":\"1\",\"b\":\"2\"}"); 6912 free(s); 6913 // empty values 6914 keys = listCreateS("a"); 6915 listEmptyS(values); 6916 r = zipArrayArrayO(self, keys, values); 6917 ck_assert_ptr_eq(r, self); 6918 // null 6919 r = zipArrayArrayO(self, null, values); 6920 ck_assert_ptr_eq(r, null); 6921 r = zipArrayArrayO(self, keys, null); 6922 ck_assert_ptr_eq(r, null); 6923 listFreeS(keys); 6924 listFreeS(values); 6925 terminateO(self); 6926 6927 } 6928 6929 6930 void zipVArraySmallDictT(CuTest *tc UNUSED) { 6931 6932 smallDictt* r; 6933 smallDictt *self = allocG(rtSmallDictt); 6934 smallArrayt *keys = allocSmallArray(); 6935 char** values; 6936 6937 self->f->setInt(self, "", 1); 6938 // 3 elements in keys 6939 // 2 elements in values 6940 // only 2 key/values are zipped 6941 keys->f->pushS(keys, "a"); 6942 keys->f->pushS(keys, "b"); 6943 keys->f->pushS(keys, "c"); 6944 values = listCreateS("1", "2"); 6945 r = zipVArrayO(self, keys, values); 6946 terminateO(keys); 6947 listFreeS(values); 6948 ck_assert_ptr_ne(r, NULL); 6949 char *s = toStringO(r); 6950 ck_assert_str_eq(s, "{\"\":1,\"a\":\"1\",\"b\":\"2\"}"); 6951 free(s); 6952 // keys array with non string objects 6953 keys = allocSmallArray(); 6954 keys->f->pushInt(keys, 1); 6955 values = listCreateS("1"); 6956 r = zipVArrayO(self, keys, values); 6957 ck_assert_ptr_eq(r, NULL); 6958 terminateO(keys); 6959 listFreeS(values); 6960 // empty values 6961 keys = allocSmallArray(); 6962 keys->f->pushInt(keys, 1); 6963 listEmptyS(values); 6964 r = zipVArrayO(self, keys, values); 6965 ck_assert_ptr_eq(r, self); 6966 terminateO(keys); 6967 // non smallArray object 6968 keys = (smallArrayt*) allocSmallInt(1); 6969 r = zipVArrayO(self, keys, values); 6970 ck_assert_ptr_eq(r, null); 6971 terminateO(keys); 6972 keys = allocSmallArray(); 6973 // null 6974 r = zipVArrayO(self, null, values); 6975 ck_assert_ptr_eq(r, null); 6976 r = zipVArrayO(self, keys, null); 6977 ck_assert_ptr_eq(r, null); 6978 terminateO(keys); 6979 listFreeS(values); 6980 terminateO(self); 6981 6982 } 6983 6984 6985 void fromArraySmallDictT(CuTest *tc UNUSED) { 6986 6987 smallDictt* r; 6988 smallDictt *self = allocG(rtSmallDictt); 6989 smallArrayt *items = allocSmallArray(); 6990 6991 self->f->setInt(self, "", 1); 6992 // ignored item 6993 items->f->pushS(items, "ignored"); 6994 createAllocateSmallArray(a); 6995 a->f->pushS(a, "a"); 6996 a->f->pushInt(a, 1); 6997 items->f->pushNFreeArray(items, a); 6998 a = allocSmallArray(); 6999 items->f->pushNFreeArray(items, a); 7000 a = allocSmallArray(); 7001 a->f->pushInt(a, 1); 7002 a->f->pushInt(a, 2); 7003 items->f->pushNFreeArray(items, a); 7004 r = self->f->fromArray(self, items); 7005 ck_assert_ptr_ne(r, NULL); 7006 char *s = toStringO(r); 7007 ck_assert_str_eq(s, "{\"\":1,\"a\":1}"); 7008 free(s); 7009 terminateO(items); 7010 // non smallArray items 7011 items = (smallArrayt*) allocSmallInt(2); 7012 r = self->f->fromArray(self, items); 7013 ck_assert_ptr_eq(r, NULL); 7014 // null items 7015 r = self->f->fromArray(self, null); 7016 ck_assert_ptr_eq(r, NULL); 7017 terminateO(items); 7018 terminateO(self); 7019 7020 } 7021 7022 7023 void toArraySmallDictT(CuTest *tc UNUSED) { 7024 7025 smallArrayt* r; 7026 smallDictt *self = allocG(rtSmallDictt); 7027 7028 self->f->setInt(self, "", 1); 7029 self->f->setInt(self, "b", 2); 7030 self->f->setInt(self, "c", 3); 7031 self->f->del(self, ""); 7032 r = toArrayO(self); 7033 ck_assert_ptr_ne(r, NULL); 7034 char *s = toStringO(r); 7035 ck_assert_str_eq(s, "[[\"b\",2],[\"c\",3]]"); 7036 free(s); 7037 terminateO(r); 7038 disposeO(self); 7039 // empty dict 7040 r = toArrayO(self); 7041 ck_assert_ptr_eq(r, NULL); 7042 terminateO(self); 7043 7044 } 7045 7046 7047 void writeFileSmallDictT(CuTest *tc UNUSED) { 7048 7049 bool r; 7050 smallDictt *self = allocG(rtSmallDictt); 7051 7052 self->f->setInt(self, "", 1); 7053 self->f->setInt(self, "b", 2); 7054 r = writeFileO(self, "smallDictFile.json"); 7055 ck_assert(r); 7056 ck_assert(fileExists("smallDictFile.json")); 7057 char *s = readFileToS("smallDictFile.json"); 7058 ck_assert_str_eq(s, "{\"\":1,\"b\":2}"); 7059 free(s); 7060 rmAll("smallDictFile.json"); 7061 // blank file path 7062 r = writeFileO(self, " "); 7063 ck_assert(!r); 7064 // null file path 7065 r = writeFileO(self, null); 7066 ck_assert(!r); 7067 terminateO(self); 7068 7069 } 7070 7071 7072 void writeFileSmallJsonSmallDictT(CuTest *tc UNUSED) { 7073 7074 bool r; 7075 smallDictt *self = allocG(rtSmallDictt); 7076 smallJsont *filePath = allocSmallJson(); 7077 7078 self->f->setInt(self, "", 1); 7079 self->f->setInt(self, "b", 2); 7080 setTopSO(filePath, "smallDictFile.json"); 7081 r = self->f->writeFileSmallJson(self, filePath); 7082 ck_assert(r); 7083 ck_assert(fileExists("smallDictFile.json")); 7084 char *s = readFileToS("smallDictFile.json"); 7085 ck_assert_str_eq(s, "{\"\":1,\"b\":2}"); 7086 free(s); 7087 rmAll("smallDictFile.json"); 7088 // blank path 7089 freeO(filePath); 7090 setTopSO(filePath, " "); 7091 r = self->f->writeFileSmallJson(self, filePath); 7092 ck_assert(!r); 7093 // non json string 7094 freeO(filePath); 7095 setTopIntO(filePath, 2); 7096 r = self->f->writeFileSmallJson(self, filePath); 7097 ck_assert(!r); 7098 // non json object 7099 terminateO(filePath); 7100 filePath = (smallJsont*) allocSmallInt(2); 7101 r = self->f->writeFileSmallJson(self, filePath); 7102 ck_assert(!r); 7103 // null path 7104 r = self->f->writeFileSmallJson(self, null); 7105 ck_assert(!r); 7106 terminateO(filePath); 7107 terminateO(self); 7108 7109 } 7110 7111 7112 void writeFileSmallStringSmallDictT(CuTest *tc UNUSED) { 7113 7114 bool r; 7115 smallDictt *self = allocG(rtSmallDictt); 7116 smallStringt *filePath = allocSmallString("smallDictFile.json"); 7117 7118 self->f->setInt(self, "", 1); 7119 self->f->setInt(self, "b", 2); 7120 r = self->f->writeFileSmallString(self, filePath); 7121 ck_assert(r); 7122 ck_assert(fileExists("smallDictFile.json")); 7123 char *s = readFileToS("smallDictFile.json"); 7124 ck_assert_str_eq(s, "{\"\":1,\"b\":2}"); 7125 free(s); 7126 rmAll("smallDictFile.json"); 7127 // blank path 7128 setValO(filePath, " "); 7129 r = self->f->writeFileSmallString(self, filePath); 7130 ck_assert(!r); 7131 // non smallString object 7132 terminateO(filePath); 7133 filePath = (smallStringt*) allocSmallInt(2); 7134 r = self->f->writeFileSmallString(self, filePath); 7135 ck_assert(!r); 7136 // null path 7137 r = self->f->writeFileSmallString(self, null); 7138 ck_assert(!r); 7139 terminateO(filePath); 7140 terminateO(self); 7141 7142 } 7143 7144 7145 void writeStreamSmallDictT(CuTest *tc UNUSED) { 7146 7147 bool r; 7148 smallDictt *self = allocG(rtSmallDictt); 7149 FILE *fp; 7150 7151 self->f->setInt(self, "", 1); 7152 self->f->setInt(self, "b", 2); 7153 fp = fopen("smallDictFile.json", "w"); 7154 r = writeStreamO(self, fp); 7155 ck_assert(r); 7156 fclose(fp); 7157 ck_assert(fileExists("smallDictFile.json")); 7158 char *s = readFileToS("smallDictFile.json"); 7159 ck_assert_str_eq(s, "{\"\":1,\"b\":2}"); 7160 free(s); 7161 rmAll("smallDictFile.json"); 7162 // null file pointer 7163 r = writeStreamO(self, null); 7164 ck_assert(!r); 7165 terminateO(self); 7166 7167 } 7168 7169 7170 void appendFileSmallDictT(CuTest *tc UNUSED) { 7171 7172 bool r; 7173 smallDictt *self = allocG(rtSmallDictt); 7174 7175 self->f->setInt(self, "", 1); 7176 self->f->setInt(self, "b", 2); 7177 writeFileS("smallDictFile.json", "-"); 7178 r = appendFileO(self, "smallDictFile.json"); 7179 ck_assert(r); 7180 ck_assert(fileExists("smallDictFile.json")); 7181 char *s = readFileToS("smallDictFile.json"); 7182 ck_assert_str_eq(s, "-{\"\":1,\"b\":2}"); 7183 free(s); 7184 rmAll("smallDictFile.json"); 7185 // blank file path 7186 r = appendFileO(self, " "); 7187 ck_assert(!r); 7188 // null file path 7189 r = appendFileO(self, null); 7190 ck_assert(!r); 7191 terminateO(self); 7192 7193 } 7194 7195 7196 void appendFileSmallStringSmallDictT(CuTest *tc UNUSED) { 7197 7198 bool r; 7199 smallDictt *self = allocG(rtSmallDictt); 7200 smallStringt *filePath = allocSmallString("smallDictFile.json"); 7201 7202 self->f->setInt(self, "", 1); 7203 self->f->setInt(self, "b", 2); 7204 writeFileS("smallDictFile.json", "-"); 7205 r = self->f->appendFileSmallString(self, filePath); 7206 ck_assert(r); 7207 ck_assert(fileExists("smallDictFile.json")); 7208 char *s = readFileToS("smallDictFile.json"); 7209 ck_assert_str_eq(s, "-{\"\":1,\"b\":2}"); 7210 free(s); 7211 rmAll("smallDictFile.json"); 7212 // blank path 7213 setValO(filePath, " "); 7214 r = self->f->appendFileSmallString(self, filePath); 7215 ck_assert(!r); 7216 // non smallString object 7217 terminateO(filePath); 7218 filePath = (smallStringt*) allocSmallInt(2); 7219 r = self->f->appendFileSmallString(self, filePath); 7220 ck_assert(!r); 7221 // null path 7222 r = self->f->appendFileSmallString(self, null); 7223 ck_assert(!r); 7224 terminateO(filePath); 7225 terminateO(self); 7226 7227 } 7228 7229 7230 void logSmallDictT(CuTest *tc UNUSED) { 7231 7232 smallDictt *self = allocG(rtSmallDictt); 7233 7234 self->f->setInt(self, "", 1); 7235 self->f->setInt(self, "b", 2); 7236 logO(self); 7237 // empty self 7238 freeO(self); 7239 logO(self); 7240 terminateO(self); 7241 7242 } 7243 7244 7245 void typeSmallStringSmallDictT(CuTest *tc UNUSED) { 7246 7247 smallStringt* r; 7248 smallDictt *self = allocG(rtSmallDictt); 7249 7250 self->f->setInt(self, "", 1); 7251 self->f->setInt(self, "b", 2); 7252 r = typeSmallStringO(self, ""); 7253 ck_assert_str_eq(ssGet(r), "int"); 7254 terminateO(r); 7255 // non existing key 7256 r = typeSmallStringO(self, "asd"); 7257 ck_assert_ptr_eq(r, null); 7258 terminateO(self); 7259 7260 } 7261 7262 7263 void typeStringKCharSmallDictT(CuTest *tc UNUSED) { 7264 7265 const char* r; 7266 smallDictt *self = allocG(rtSmallDictt); 7267 7268 self->f->setInt(self, "", 1); 7269 self->f->setInt(self, "b", 2); 7270 r = typeStringKCharO(self, 'b'); 7271 ck_assert_str_eq(r, "int"); 7272 terminateO(self); 7273 7274 } 7275 7276 7277 void typeSmallStringKCharSmallDictT(CuTest *tc UNUSED) { 7278 7279 smallStringt* r; 7280 smallDictt *self = allocG(rtSmallDictt); 7281 7282 self->f->setInt(self, "", 1); 7283 self->f->setInt(self, "b", 2); 7284 r = typeSmallStringKCharO(self, 'b'); 7285 ck_assert_str_eq(ssGet(r), "int"); 7286 terminateO(r); 7287 // non existing key 7288 r = typeSmallStringKCharO(self, 'a'); 7289 ck_assert_ptr_eq(r, null); 7290 terminateO(self); 7291 7292 } 7293 7294 7295 void typeKCharSmallDictT(CuTest *tc UNUSED) { 7296 7297 char r; 7298 smallDictt *self = allocG(rtSmallDictt); 7299 7300 self->f->setInt(self, "", 1); 7301 self->f->setInt(self, "b", 2); 7302 r = typeKCharO(self, 'b'); 7303 ck_assert_int_eq(r, 7); 7304 terminateO(self); 7305 7306 } 7307 7308 7309 void isETypeSmallDictT(CuTest *tc UNUSED) { 7310 7311 bool r; 7312 smallDictt *self = allocG(rtSmallDictt); 7313 7314 self->f->setInt(self, "", 1); 7315 r = isETypeO(self, "", "int"); 7316 ck_assert(r); 7317 // null type 7318 r = isETypeO(self, "", null); 7319 ck_assert(!r); 7320 // null key 7321 r = isETypeO(self, null, "int"); 7322 ck_assert(!r); 7323 // empty dict 7324 freeO(self); 7325 r = isETypeO(self, "", "int"); 7326 ck_assert(!r); 7327 terminateO(self); 7328 7329 } 7330 7331 7332 void isEUndefinedSmallDictT(CuTest *tc UNUSED) { 7333 7334 bool r; 7335 smallDictt *self = allocG(rtSmallDictt); 7336 7337 self->f->setInt(self, "", 1); 7338 self->f->setUndefined(self, "b"); 7339 r = isEUndefinedO(self, "b"); 7340 ck_assert(r); 7341 r = isEUndefinedO(self, ""); 7342 ck_assert(!r); 7343 // non existing key 7344 r = isEUndefinedO(self, "qwe"); 7345 ck_assert(!r); 7346 // empty dict 7347 freeO(self); 7348 r = isEUndefinedO(self, ""); 7349 ck_assert(!r); 7350 terminateO(self); 7351 7352 } 7353 7354 7355 void isEBoolSmallDictT(CuTest *tc UNUSED) { 7356 7357 bool r; 7358 smallDictt *self = allocG(rtSmallDictt); 7359 7360 self->f->setInt(self, "", 1); 7361 self->f->setBool(self, "b", true); 7362 r = isEBoolO(self, "b"); 7363 ck_assert(r); 7364 r = isEBoolO(self, ""); 7365 ck_assert(!r); 7366 // non existing key 7367 r = isEBoolO(self, "qwe"); 7368 ck_assert(!r); 7369 // empty dict 7370 freeO(self); 7371 r = isEBoolO(self, ""); 7372 ck_assert(!r); 7373 terminateO(self); 7374 7375 } 7376 7377 7378 void isEContainerSmallDictT(CuTest *tc UNUSED) { 7379 7380 bool r; 7381 smallDictt *self = allocG(rtSmallDictt); 7382 7383 createSmallContainer(c); 7384 self->f->setInt(self, "", 1); 7385 self->f->setBool(self, "b", true); 7386 self->f->setSmallContainer(self, "c", &c); 7387 r = isEContainerO(self, "c"); 7388 ck_assert(r); 7389 r = isEContainerO(self, "b"); 7390 ck_assert(!r); 7391 // non existing key 7392 r = isEContainerO(self, "qwe"); 7393 ck_assert(!r); 7394 // empty dict 7395 freeO(self); 7396 r = isEContainerO(self, ""); 7397 ck_assert(!r); 7398 terminateO(self); 7399 7400 } 7401 7402 7403 void isEDictSmallDictT(CuTest *tc UNUSED) { 7404 7405 bool r; 7406 smallDictt *self = allocG(rtSmallDictt); 7407 7408 self->f->setInt(self, "", 1); 7409 createSmallDict(d); 7410 self->f->setDict(self, "b", &d); 7411 r = isEDictO(self, "b"); 7412 ck_assert(r); 7413 r = isEDictO(self, ""); 7414 ck_assert(!r); 7415 // non existing key 7416 r = isEDictO(self, "qwe"); 7417 ck_assert(!r); 7418 // empty dict 7419 freeO(self); 7420 r = isEDictO(self, ""); 7421 ck_assert(!r); 7422 terminateO(self); 7423 7424 } 7425 7426 7427 void isEDoubleSmallDictT(CuTest *tc UNUSED) { 7428 7429 bool r; 7430 smallDictt *self = allocG(rtSmallDictt); 7431 7432 self->f->setInt(self, "", 1); 7433 self->f->setDouble(self, "b", 2.2); 7434 r = isEDoubleO(self, "b"); 7435 ck_assert(r); 7436 r = isEDoubleO(self, ""); 7437 ck_assert(!r); 7438 // non existing key 7439 r = isEDoubleO(self, "qwe"); 7440 ck_assert(!r); 7441 // empty dict 7442 freeO(self); 7443 r = isEDoubleO(self, ""); 7444 ck_assert(!r); 7445 terminateO(self); 7446 7447 } 7448 7449 7450 void isEIntSmallDictT(CuTest *tc UNUSED) { 7451 7452 bool r; 7453 smallDictt *self = allocG(rtSmallDictt); 7454 7455 self->f->setBool(self, "", true); 7456 self->f->setInt(self, "b", 2); 7457 r = isEIntO(self, "b"); 7458 ck_assert(r); 7459 r = isEIntO(self, ""); 7460 ck_assert(!r); 7461 // non existing key 7462 r = isEIntO(self, "qwe"); 7463 ck_assert(!r); 7464 // empty dict 7465 freeO(self); 7466 r = isEIntO(self, ""); 7467 ck_assert(!r); 7468 terminateO(self); 7469 7470 } 7471 7472 7473 void isEStringSmallDictT(CuTest *tc UNUSED) { 7474 7475 bool r; 7476 smallDictt *self = allocG(rtSmallDictt); 7477 7478 self->f->setInt(self, "", 1); 7479 self->f->setS(self, "b", "!@#"); 7480 r = isEStringO(self, "b"); 7481 ck_assert(r); 7482 r = isEStringO(self, ""); 7483 ck_assert(!r); 7484 // non existing key 7485 r = isEStringO(self, "qwe"); 7486 ck_assert(!r); 7487 // empty dict 7488 freeO(self); 7489 r = isEStringO(self, ""); 7490 ck_assert(!r); 7491 terminateO(self); 7492 7493 } 7494 7495 7496 void isEFaststringSmallDictT(CuTest *tc UNUSED) { 7497 7498 bool r; 7499 smallDictt *self = allocG(rtSmallDictt); 7500 7501 self->f->setInt(self, "", 1); 7502 r = isEFaststringO(self, ""); 7503 ck_assert(!r); 7504 // non existing key 7505 r = isEFaststringO(self, "qwe"); 7506 ck_assert(!r); 7507 // empty dict 7508 freeO(self); 7509 r = isEFaststringO(self, ""); 7510 ck_assert(!r); 7511 terminateO(self); 7512 7513 } 7514 7515 7516 void isEArraySmallDictT(CuTest *tc UNUSED) { 7517 7518 bool r; 7519 smallDictt *self = allocG(rtSmallDictt); 7520 7521 createSmallArray(a); 7522 self->f->setInt(self, "", 1); 7523 self->f->setArray(self, "b", &a); 7524 r = isEArrayO(self, "b"); 7525 ck_assert(r); 7526 r = isEArrayO(self, ""); 7527 ck_assert(!r); 7528 // non existing key 7529 r = isEArrayO(self, "qwe"); 7530 ck_assert(!r); 7531 // empty dict 7532 freeO(self); 7533 r = isEArrayO(self, ""); 7534 ck_assert(!r); 7535 terminateO(self); 7536 7537 } 7538 7539 7540 void isEBytesSmallDictT(CuTest *tc UNUSED) { 7541 7542 bool r; 7543 smallDictt *self = allocG(rtSmallDictt); 7544 7545 createSmallBytes(b); 7546 self->f->setInt(self, "", 1); 7547 self->f->setSmallBytes(self, "b", &b); 7548 r = isEBytesO(self, "b"); 7549 ck_assert(r); 7550 r = isEBytesO(self, ""); 7551 ck_assert(!r); 7552 // non existing key 7553 r = isEBytesO(self, "qwe"); 7554 ck_assert(!r); 7555 // empty dict 7556 freeO(self); 7557 r = isEBytesO(self, ""); 7558 ck_assert(!r); 7559 terminateO(self); 7560 7561 } 7562 7563 7564 void areAllETypeSmallDictT(CuTest *tc UNUSED) { 7565 7566 bool r; 7567 smallDictt *self = allocG(rtSmallDictt); 7568 7569 self->f->setBool(self, "a", true); 7570 self->f->setBool(self, "b", true); 7571 r = areAllETypeO(self, "bool"); 7572 ck_assert(r); 7573 self->f->setInt(self, "c", 2); 7574 r = areAllETypeO(self, "bool"); 7575 ck_assert(!r); 7576 // null type 7577 r = areAllETypeO(self, null); 7578 ck_assert(!r); 7579 // empty self 7580 freeO(self); 7581 r = areAllETypeO(self, "bool"); 7582 ck_assert(!r); 7583 self->f->setS(self, "a", ""); 7584 self->f->del(self, "a"); 7585 r = areAllETypeO(self, "bool"); 7586 ck_assert(!r); 7587 terminateO(self); 7588 7589 } 7590 7591 7592 void areAllEUndefinedSmallDictT(CuTest *tc UNUSED) { 7593 7594 bool r; 7595 smallDictt *self = allocG(rtSmallDictt); 7596 7597 self->f->setUndefined(self, "b"); 7598 r = areAllEUndefinedO(self); 7599 ck_assert(r); 7600 terminateO(self); 7601 7602 } 7603 7604 7605 void areAllEBoolSmallDictT(CuTest *tc UNUSED) { 7606 7607 bool r; 7608 smallDictt *self = allocG(rtSmallDictt); 7609 7610 self->f->setBool(self, "a", true); 7611 r = areAllEBoolO(self); 7612 ck_assert(r); 7613 terminateO(self); 7614 7615 } 7616 7617 7618 void areAllEContainerSmallDictT(CuTest *tc UNUSED) { 7619 7620 bool r; 7621 smallDictt *self = allocG(rtSmallDictt); 7622 7623 createSmallContainer(c); 7624 self->f->setSmallContainer(self, "c", &c); 7625 r = areAllEContainerO(self); 7626 ck_assert(r); 7627 terminateO(self); 7628 7629 } 7630 7631 7632 void areAllEDictSmallDictT(CuTest *tc UNUSED) { 7633 7634 bool r; 7635 smallDictt *self = allocG(rtSmallDictt); 7636 7637 createSmallDict(d); 7638 self->f->setDict(self, "b", &d); 7639 r = areAllEDictO(self); 7640 ck_assert(r); 7641 terminateO(self); 7642 7643 } 7644 7645 7646 void areAllEDoubleSmallDictT(CuTest *tc UNUSED) { 7647 7648 bool r; 7649 smallDictt *self = allocG(rtSmallDictt); 7650 7651 self->f->setDouble(self, "b", 2.2); 7652 r = areAllEDoubleO(self); 7653 ck_assert(r); 7654 terminateO(self); 7655 7656 } 7657 7658 7659 void areAllEIntSmallDictT(CuTest *tc UNUSED) { 7660 7661 bool r; 7662 smallDictt *self = allocG(rtSmallDictt); 7663 7664 self->f->setInt(self, "b", 2); 7665 r = areAllEIntO(self); 7666 ck_assert(r); 7667 terminateO(self); 7668 7669 } 7670 7671 7672 void areAllEStringSmallDictT(CuTest *tc UNUSED) { 7673 7674 bool r; 7675 smallDictt *self = allocG(rtSmallDictt); 7676 7677 self->f->setS(self, "b", "!@#"); 7678 r = areAllEStringO(self); 7679 ck_assert(r); 7680 terminateO(self); 7681 7682 } 7683 7684 7685 void areAllEFaststringSmallDictT(CuTest *tc UNUSED) { 7686 7687 bool r; 7688 smallDictt *self = allocG(rtSmallDictt); 7689 7690 r = areAllEFaststringO(self); 7691 ck_assert(!r); 7692 terminateO(self); 7693 7694 } 7695 7696 7697 void areAllEArraySmallDictT(CuTest *tc UNUSED) { 7698 7699 bool r; 7700 smallDictt *self = allocG(rtSmallDictt); 7701 7702 createSmallArray(a); 7703 self->f->setArray(self, "b", &a); 7704 r = areAllEArrayO(self); 7705 ck_assert(r); 7706 terminateO(self); 7707 7708 } 7709 7710 7711 void areAllEBytesSmallDictT(CuTest *tc UNUSED) { 7712 7713 bool r; 7714 smallDictt *self = allocG(rtSmallDictt); 7715 7716 createSmallBytes(b); 7717 self->f->setSmallBytes(self, "b", &b); 7718 r = areAllEBytesO(self); 7719 ck_assert(r); 7720 terminateO(self); 7721 7722 } 7723 7724 7725 void duplicateSmallDictGT(CuTest *tc UNUSED) { 7726 7727 smallDictt *r; 7728 smallDictt *self = allocG(rtSmallDictt); 7729 7730 r = duplicateSmallDictG(self); 7731 ck_assert_ptr_ne(r, null); 7732 terminateO(r); 7733 // with iterator 7734 self->f->setS(self, "qwe", "asd"); 7735 iterStartO(self); 7736 r = duplicateSmallDictG(self); 7737 ck_assert_ptr_ne(r, null); 7738 char *s = toStringO(r); 7739 ck_assert_str_eq(s, "{\"qwe\":\"asd\"}"); 7740 free(s); 7741 ck_assert_str_eq(r->iterKey, "qwe"); 7742 terminateO(r); 7743 terminateO(self); 7744 7745 } 7746 7747 7748 void freeSmallDictGT(CuTest *tc UNUSED) { 7749 7750 smallDictt *self = allocG(rtSmallDictt); 7751 7752 self->f->setS(self, "qwe", "asd"); 7753 freeSmallDictG(self); 7754 terminateO(self); 7755 7756 } 7757 7758 7759 void setSmallDictGT(CuTest *tc UNUSED) { 7760 7761 smallDictt* r; 7762 smallDictt *self = allocG(rtSmallDictt); 7763 baset *value = (baset*) allocSmallInt(2); 7764 7765 r = setSmallDictG(self, "1", value); 7766 ck_assert_ptr_ne(r, null); 7767 finishO(value); 7768 char *s = toStringO(r); 7769 ck_assert_str_eq(s, "{\"1\":2}"); 7770 free(s); 7771 terminateO(self); 7772 7773 } 7774 7775 7776 void getSmallDictGT(CuTest *tc UNUSED) { 7777 7778 baset* r; 7779 smallDictt *self = allocG(rtSmallDictt); 7780 7781 self->f->setInt(self, "1", 2); 7782 r = getSmallDictG(self, null, "1"); 7783 ck_assert_ptr_ne(r, null); 7784 char *s = toStringO(r); 7785 finishO(r); 7786 ck_assert_str_eq(s, "2"); 7787 free(s); 7788 terminateO(self); 7789 7790 } 7791 7792 7793 void getUndefinedSmallDictGT(CuTest *tc UNUSED) { 7794 7795 undefinedt* r; 7796 smallDictt *self = allocG(rtSmallDictt); 7797 7798 smallDictt *r2 = self->f->setUndefined(self, "1"); 7799 ck_assert_ptr_ne(r2, null); 7800 r = getUndefinedSmallDictG(self, null, "1"); 7801 ck_assert_ptr_ne(r, null); 7802 finishO(r); 7803 terminateO(self); 7804 7805 } 7806 7807 7808 void getBoolSmallDictGT(CuTest *tc UNUSED) { 7809 7810 bool r; 7811 smallDictt *self = allocG(rtSmallDictt); 7812 7813 smallDictt* r2 = self->f->setBool(self, "1", true); 7814 ck_assert_ptr_ne(r2, null); 7815 r = getBoolSmallDictG(self, false, "1"); 7816 ck_assert(r); 7817 terminateO(self); 7818 7819 } 7820 7821 7822 void getBoolPSmallDictGT(CuTest *tc UNUSED) { 7823 7824 bool* r; 7825 smallDictt *self = allocG(rtSmallDictt); 7826 7827 smallDictt* r2 = self->f->setBool(self, "1", true); 7828 ck_assert_ptr_ne(r2, null); 7829 r = getBoolPSmallDictG(self, null, "1"); 7830 ck_assert_ptr_ne(r, null); 7831 ck_assert(*r); 7832 terminateO(self); 7833 7834 } 7835 7836 7837 void getDoubleSmallDictGT(CuTest *tc UNUSED) { 7838 7839 double r; 7840 smallDictt *self = allocG(rtSmallDictt); 7841 7842 smallDictt *r2 = self->f->setDouble(self, "1", 2.2); 7843 ck_assert_ptr_ne(r2, null); 7844 r = getDoubleSmallDictG(self, 0, "1"); 7845 ck_assert(r == 2.2); 7846 terminateO(self); 7847 7848 } 7849 7850 7851 void getDoublePSmallDictGT(CuTest *tc UNUSED) { 7852 7853 double* r; 7854 smallDictt *self = allocG(rtSmallDictt); 7855 7856 smallDictt *r2 = self->f->setDouble(self, "1", 2.2); 7857 ck_assert_ptr_ne(r2, null); 7858 r = getDoublePSmallDictG(self, null, "1"); 7859 ck_assert_ptr_ne(r, null); 7860 ck_assert(*r == 2.2); 7861 terminateO(self); 7862 7863 } 7864 7865 7866 void getIntSmallDictGT(CuTest *tc UNUSED) { 7867 7868 int64_t r; 7869 smallDictt *self = allocG(rtSmallDictt); 7870 7871 smallDictt *r2 = self->f->setInt(self, "1", 2); 7872 ck_assert_ptr_ne(r2, null); 7873 r = getIntSmallDictG(self, 0, "1"); 7874 ck_assert_int_eq(r, 2); 7875 terminateO(self); 7876 7877 } 7878 7879 7880 void getIntPSmallDictGT(CuTest *tc UNUSED) { 7881 7882 int64_t* r; 7883 smallDictt *self = allocG(rtSmallDictt); 7884 7885 smallDictt *r2 = self->f->setInt(self, "1", 2); 7886 ck_assert_ptr_ne(r2, null); 7887 r = getIntPSmallDictG(self, null, "1"); 7888 ck_assert_ptr_ne(r, null); 7889 ck_assert_int_eq(*r, 2); 7890 terminateO(self); 7891 7892 } 7893 7894 7895 void getInt32SmallDictGT(CuTest *tc UNUSED) { 7896 7897 int32_t r; 7898 smallDictt *self = allocG(rtSmallDictt); 7899 7900 smallDictt *r2 = self->f->setInt(self, "1", 2); 7901 ck_assert_ptr_ne(r2, null); 7902 r = getInt32SmallDictG(self, 0, "1"); 7903 ck_assert_int_eq(r, 2); 7904 terminateO(self); 7905 7906 } 7907 7908 7909 void getInt32PSmallDictGT(CuTest *tc UNUSED) { 7910 7911 int32_t* r; 7912 smallDictt *self = allocG(rtSmallDictt); 7913 7914 smallDictt *r2 = self->f->setInt(self, "1", 2); 7915 ck_assert_ptr_ne(r2, null); 7916 r = getInt32PSmallDictG(self, null, "1"); 7917 ck_assert_ptr_ne(r, null); 7918 ck_assert_int_eq(*r, 2); 7919 terminateO(self); 7920 7921 } 7922 7923 7924 void getUintSmallDictGT(CuTest *tc UNUSED) { 7925 7926 uint64_t r; 7927 smallDictt *self = allocG(rtSmallDictt); 7928 7929 smallDictt *r2 = self->f->setInt(self, "1", 2); 7930 ck_assert_ptr_ne(r2, null); 7931 r = getUintSmallDictG(self, 0, "1"); 7932 ck_assert_int_eq(r, 2); 7933 terminateO(self); 7934 7935 } 7936 7937 7938 void getUintPSmallDictGT(CuTest *tc UNUSED) { 7939 7940 uint64_t* r; 7941 smallDictt *self = allocG(rtSmallDictt); 7942 7943 smallDictt *r2 = self->f->setInt(self, "1", 2); 7944 ck_assert_ptr_ne(r2, null); 7945 r = getUintPSmallDictG(self, null, "1"); 7946 ck_assert_ptr_ne(r, null); 7947 ck_assert_int_eq(*r, 2); 7948 terminateO(self); 7949 7950 } 7951 7952 7953 void getUint32SmallDictGT(CuTest *tc UNUSED) { 7954 7955 uint32_t r; 7956 smallDictt *self = allocG(rtSmallDictt); 7957 7958 smallDictt *r2 = self->f->setInt(self, "1", 2); 7959 ck_assert_ptr_ne(r2, null); 7960 r = getUint32SmallDictG(self, 0, "1"); 7961 ck_assert_int_eq(r, 2); 7962 terminateO(self); 7963 7964 } 7965 7966 7967 void getUint32PSmallDictGT(CuTest *tc UNUSED) { 7968 7969 uint32_t* r; 7970 smallDictt *self = allocG(rtSmallDictt); 7971 7972 smallDictt *r2 = self->f->setInt(self, "1", 2); 7973 ck_assert_ptr_ne(r2, null); 7974 r = getUint32PSmallDictG(self, null, "1"); 7975 ck_assert_ptr_ne(r, null); 7976 ck_assert_int_eq(*r, 2); 7977 terminateO(self); 7978 7979 } 7980 7981 7982 void getSSmallDictGT(CuTest *tc UNUSED) { 7983 7984 char* r; 7985 smallDictt *self = allocG(rtSmallDictt); 7986 7987 smallDictt *r2 = self->f->setS(self, "1", "qwe"); 7988 ck_assert_ptr_ne(r2, null); 7989 r = getSSmallDictG(self, null, "1"); 7990 ck_assert_ptr_ne(r, null); 7991 ck_assert_str_eq(r, "qwe"); 7992 terminateO(self); 7993 7994 } 7995 7996 7997 void getDictSmallDictGT(CuTest *tc UNUSED) { 7998 7999 smallDictt* r; 8000 smallDictt *self = allocG(rtSmallDictt); 8001 smallDictt *dict = allocSmallDict(); 8002 8003 r = self->f->setNFreeDict(self, "1", dict); 8004 ck_assert_ptr_ne(r, null); 8005 r = getDictSmallDictG(self, null, "1"); 8006 ck_assert_ptr_ne(r, null); 8007 char *s = toStringO(r); 8008 finishO(r); 8009 ck_assert_str_eq(s, "{}"); 8010 free(s); 8011 terminateO(self); 8012 8013 } 8014 8015 8016 void getArraySmallDictGT(CuTest *tc UNUSED) { 8017 8018 smallArrayt *r; 8019 smallDictt *self = allocG(rtSmallDictt); 8020 smallArrayt *array = allocSmallArray(); 8021 8022 smallDictt *r2 = self->f->setNFreeArray(self, "1", array); 8023 ck_assert_ptr_ne(r2, null); 8024 r = getArraySmallDictG(self, null, "1"); 8025 ck_assert_ptr_ne(r, null); 8026 char *s = toStringO(r); 8027 finishO(r); 8028 ck_assert_str_eq(s, "[]"); 8029 free(s); 8030 terminateO(self); 8031 8032 } 8033 8034 8035 void getSmallBoolSmallDictGT(CuTest *tc UNUSED) { 8036 8037 smallBoolt* r; 8038 smallDictt *self = allocG(rtSmallDictt); 8039 8040 smallDictt* r2 = self->f->setBool(self, "1", true); 8041 ck_assert_ptr_ne(r2, null); 8042 r = getSmallBoolSmallDictG(self, null, "1"); 8043 ck_assert_ptr_ne(r, null); 8044 char *s = toStringO(r); 8045 finishO(r); 8046 ck_assert_str_eq(s, "true"); 8047 free(s); 8048 terminateO(self); 8049 8050 } 8051 8052 8053 void getSmallBytesSmallDictGT(CuTest *tc UNUSED) { 8054 8055 smallBytest* r; 8056 smallDictt *self = allocG(rtSmallDictt); 8057 smallBytest *value = allocSmallBytes("qwe", sizeof("qwe")); 8058 8059 smallDictt *r2 = self->f->setNFreeSmallBytes(self, "1", value); 8060 ck_assert_ptr_ne(r2, null); 8061 r = getSmallBytesSmallDictG(self, null, "1"); 8062 ck_assert_ptr_ne(r, null); 8063 char *s = toStringO(r); 8064 finishO(r); 8065 ck_assert_str_eq(s, "[0x71,0x77,0x65,0x00]"); 8066 free(s); 8067 terminateO(self); 8068 8069 } 8070 8071 8072 void getSmallDoubleSmallDictGT(CuTest *tc UNUSED) { 8073 8074 smallDoublet* r; 8075 smallDictt *self = allocG(rtSmallDictt); 8076 8077 smallDictt *r2 = self->f->setDouble(self, "1", 2.2); 8078 ck_assert_ptr_ne(r2, null); 8079 r = getSmallDoubleSmallDictG(self, null, "1"); 8080 ck_assert_ptr_ne(r, null); 8081 char *s = toStringO(r); 8082 finishO(r); 8083 ck_assert_str_eq(s, "2.200000e+00"); 8084 free(s); 8085 terminateO(self); 8086 8087 } 8088 8089 8090 void getSmallIntSmallDictGT(CuTest *tc UNUSED) { 8091 8092 smallIntt* r; 8093 smallDictt *self = allocG(rtSmallDictt); 8094 8095 smallDictt *r2 = self->f->setInt(self, "1", 2); 8096 ck_assert_ptr_ne(r2, null); 8097 r = getSmallIntSmallDictG(self, null, "1"); 8098 ck_assert_ptr_ne(r, null); 8099 char *s = toStringO(r); 8100 finishO(r); 8101 ck_assert_str_eq(s, "2"); 8102 free(s); 8103 terminateO(self); 8104 8105 } 8106 8107 8108 void getSmallJsonSmallDictGT(CuTest *tc UNUSED) { 8109 8110 smallJsont* r; 8111 smallDictt *self = allocG(rtSmallDictt); 8112 smallJsont *value = allocSmallJson(); 8113 8114 setTopIntO(value, 2); 8115 smallDictt *r2 = self->f->setNFreeSmallJson(self, "1", value); 8116 ck_assert_ptr_ne(r2, null); 8117 r = getSmallJsonSmallDictG(self, null, "1"); 8118 ck_assert_ptr_ne(r, null); 8119 char *s = toStringO(r); 8120 finishO(r); 8121 ck_assert_str_eq(s, "2"); 8122 free(s); 8123 terminateO(self); 8124 8125 } 8126 8127 8128 void getSmallStringSmallDictGT(CuTest *tc UNUSED) { 8129 8130 smallStringt* r; 8131 smallDictt *self = allocG(rtSmallDictt); 8132 8133 smallDictt *r2 = self->f->setS(self, "1", "qwe"); 8134 ck_assert_ptr_ne(r2, null); 8135 r = getSmallStringSmallDictG(self, null, "1"); 8136 ck_assert_ptr_ne(r, null); 8137 char *s = toStringO(r); 8138 finishO(r); 8139 ck_assert_str_eq(s, "qwe"); 8140 free(s); 8141 terminateO(self); 8142 8143 } 8144 8145 8146 void getVoidSmallDictGT(CuTest *tc UNUSED) { 8147 8148 void* r; 8149 smallDictt *self = allocG(rtSmallDictt); 8150 8151 createSmallContainer(c); 8152 setValO(&c, &r); 8153 smallDictt *r2 = self->f->setSmallContainer(self, "1", &c); 8154 ck_assert_ptr_ne(r2, null); 8155 r = getVoidSmallDictG(self, null, "1"); 8156 ck_assert_ptr_eq(r, &r); 8157 terminateO(self); 8158 8159 } 8160 8161 8162 void getSmallContainerSmallDictGT(CuTest *tc UNUSED) { 8163 8164 smallContainert* r; 8165 smallDictt *self = allocG(rtSmallDictt); 8166 8167 createSmallContainer(c); 8168 setValO(&c, &r); 8169 smallDictt *r2 = self->f->setSmallContainer(self, "1", &c); 8170 ck_assert_ptr_ne(r2, null); 8171 r = getSmallContainerSmallDictG(self, null, "1"); 8172 ck_assert_ptr_ne(r, null); 8173 char *s = toStringO(r); 8174 finishO(r); 8175 ck_assert_str_eq(s, "<data smallContainer>"); 8176 free(s); 8177 terminateO(self); 8178 8179 } 8180 8181 8182 void getKCharSmallDictGT(CuTest *tc UNUSED) { 8183 8184 baset* r; 8185 smallDictt *self = allocG(rtSmallDictt); 8186 8187 self->f->setInt(self, "1", 2); 8188 r = getKCharSmallDictG(self, null, '1'); 8189 ck_assert_ptr_ne(r, null); 8190 char *s = toStringO(r); 8191 finishO(r); 8192 ck_assert_str_eq(s, "2"); 8193 free(s); 8194 terminateO(self); 8195 8196 } 8197 8198 8199 void getUndefinedKCharSmallDictGT(CuTest *tc UNUSED) { 8200 8201 undefinedt* r; 8202 smallDictt *self = allocG(rtSmallDictt); 8203 8204 smallDictt *r2 = self->f->setUndefined(self, "1"); 8205 ck_assert_ptr_ne(r2, null); 8206 r = getUndefinedKCharSmallDictG(self, null, '1'); 8207 ck_assert_ptr_ne(r, null); 8208 finishO(r); 8209 terminateO(self); 8210 8211 } 8212 8213 8214 void getBoolKCharSmallDictGT(CuTest *tc UNUSED) { 8215 8216 bool r; 8217 smallDictt *self = allocG(rtSmallDictt); 8218 8219 smallDictt* r2 = self->f->setBool(self, "1", true); 8220 ck_assert_ptr_ne(r2, null); 8221 r = getBoolKCharSmallDictG(self, false, '1'); 8222 ck_assert(r); 8223 terminateO(self); 8224 8225 } 8226 8227 8228 void getBoolPKCharSmallDictGT(CuTest *tc UNUSED) { 8229 8230 bool* r; 8231 smallDictt *self = allocG(rtSmallDictt); 8232 8233 smallDictt* r2 = self->f->setBool(self, "1", true); 8234 ck_assert_ptr_ne(r2, null); 8235 r = getBoolPKCharSmallDictG(self, null, '1'); 8236 ck_assert_ptr_ne(r, null); 8237 ck_assert(*r); 8238 terminateO(self); 8239 8240 } 8241 8242 8243 void getDoubleKCharSmallDictGT(CuTest *tc UNUSED) { 8244 8245 double r; 8246 smallDictt *self = allocG(rtSmallDictt); 8247 8248 smallDictt *r2 = self->f->setDouble(self, "1", 2.2); 8249 ck_assert_ptr_ne(r2, null); 8250 r = getDoubleKCharSmallDictG(self, 0, '1'); 8251 ck_assert(r == 2.2); 8252 terminateO(self); 8253 8254 } 8255 8256 8257 void getDoublePKCharSmallDictGT(CuTest *tc UNUSED) { 8258 8259 double* r; 8260 smallDictt *self = allocG(rtSmallDictt); 8261 8262 smallDictt *r2 = self->f->setDouble(self, "1", 2.2); 8263 ck_assert_ptr_ne(r2, null); 8264 r = getDoublePKCharSmallDictG(self, null, '1'); 8265 ck_assert_ptr_ne(r, null); 8266 ck_assert(*r == 2.2); 8267 terminateO(self); 8268 8269 } 8270 8271 8272 void getIntKCharSmallDictGT(CuTest *tc UNUSED) { 8273 8274 int64_t r; 8275 smallDictt *self = allocG(rtSmallDictt); 8276 8277 smallDictt *r2 = self->f->setInt(self, "1", 2); 8278 ck_assert_ptr_ne(r2, null); 8279 r = getIntKCharSmallDictG(self, 0, '1'); 8280 ck_assert_int_eq(r, 2); 8281 terminateO(self); 8282 8283 } 8284 8285 8286 void getIntPKCharSmallDictGT(CuTest *tc UNUSED) { 8287 8288 int64_t* r; 8289 smallDictt *self = allocG(rtSmallDictt); 8290 8291 smallDictt *r2 = self->f->setInt(self, "1", 2); 8292 ck_assert_ptr_ne(r2, null); 8293 r = getIntPKCharSmallDictG(self, null, '1'); 8294 ck_assert_ptr_ne(r, null); 8295 ck_assert_int_eq(*r, 2); 8296 terminateO(self); 8297 8298 } 8299 8300 8301 void getInt32KCharSmallDictGT(CuTest *tc UNUSED) { 8302 8303 int32_t r; 8304 smallDictt *self = allocG(rtSmallDictt); 8305 8306 smallDictt *r2 = self->f->setInt(self, "1", 2); 8307 ck_assert_ptr_ne(r2, null); 8308 r = getInt32KCharSmallDictG(self, 0, '1'); 8309 ck_assert_int_eq(r, 2); 8310 terminateO(self); 8311 8312 } 8313 8314 8315 void getInt32PKCharSmallDictGT(CuTest *tc UNUSED) { 8316 8317 int32_t* r; 8318 smallDictt *self = allocG(rtSmallDictt); 8319 8320 smallDictt *r2 = self->f->setInt(self, "1", 2); 8321 ck_assert_ptr_ne(r2, null); 8322 r = getInt32PKCharSmallDictG(self, null, '1'); 8323 ck_assert_ptr_ne(r, null); 8324 ck_assert_int_eq(*r, 2); 8325 terminateO(self); 8326 8327 } 8328 8329 8330 void getUintKCharSmallDictGT(CuTest *tc UNUSED) { 8331 8332 uint64_t r; 8333 smallDictt *self = allocG(rtSmallDictt); 8334 8335 smallDictt *r2 = self->f->setInt(self, "1", 2); 8336 ck_assert_ptr_ne(r2, null); 8337 r = getUintKCharSmallDictG(self, 0, '1'); 8338 ck_assert_int_eq(r, 2); 8339 terminateO(self); 8340 8341 } 8342 8343 8344 void getUintPKCharSmallDictGT(CuTest *tc UNUSED) { 8345 8346 uint64_t* r; 8347 smallDictt *self = allocG(rtSmallDictt); 8348 8349 smallDictt *r2 = self->f->setInt(self, "1", 2); 8350 ck_assert_ptr_ne(r2, null); 8351 r = getUintPKCharSmallDictG(self, null, '1'); 8352 ck_assert_ptr_ne(r, null); 8353 ck_assert_int_eq(*r, 2); 8354 terminateO(self); 8355 8356 } 8357 8358 8359 void getUint32KCharSmallDictGT(CuTest *tc UNUSED) { 8360 8361 uint32_t r; 8362 smallDictt *self = allocG(rtSmallDictt); 8363 8364 smallDictt *r2 = self->f->setInt(self, "1", 2); 8365 ck_assert_ptr_ne(r2, null); 8366 r = getUint32KCharSmallDictG(self, 0, '1'); 8367 ck_assert_int_eq(r, 2); 8368 terminateO(self); 8369 8370 } 8371 8372 8373 void getUint32PKCharSmallDictGT(CuTest *tc UNUSED) { 8374 8375 uint32_t* r; 8376 smallDictt *self = allocG(rtSmallDictt); 8377 8378 smallDictt *r2 = self->f->setInt(self, "1", 2); 8379 ck_assert_ptr_ne(r2, null); 8380 r = getUint32PKCharSmallDictG(self, null, '1'); 8381 ck_assert_ptr_ne(r, null); 8382 ck_assert_int_eq(*r, 2); 8383 terminateO(self); 8384 8385 } 8386 8387 8388 void getSKCharSmallDictGT(CuTest *tc UNUSED) { 8389 8390 char* r; 8391 smallDictt *self = allocG(rtSmallDictt); 8392 8393 smallDictt *r2 = self->f->setS(self, "1", "qwe"); 8394 ck_assert_ptr_ne(r2, null); 8395 r = getSKCharSmallDictG(self, null, '1'); 8396 ck_assert_ptr_ne(r, null); 8397 ck_assert_str_eq(r, "qwe"); 8398 terminateO(self); 8399 8400 } 8401 8402 8403 void getDictKCharSmallDictGT(CuTest *tc UNUSED) { 8404 8405 smallDictt* r; 8406 smallDictt *self = allocG(rtSmallDictt); 8407 smallDictt *dict = allocSmallDict(); 8408 8409 r = self->f->setNFreeDict(self, "1", dict); 8410 ck_assert_ptr_ne(r, null); 8411 r = getDictKCharSmallDictG(self, null, '1'); 8412 ck_assert_ptr_ne(r, null); 8413 char *s = toStringO(r); 8414 finishO(r); 8415 ck_assert_str_eq(s, "{}"); 8416 free(s); 8417 terminateO(self); 8418 8419 } 8420 8421 8422 void getArrayKCharSmallDictGT(CuTest *tc UNUSED) { 8423 8424 smallArrayt* r; 8425 smallDictt *self = allocG(rtSmallDictt); 8426 smallArrayt *array = allocSmallArray(); 8427 8428 smallDictt *r2 = self->f->setNFreeArray(self, "1", array); 8429 ck_assert_ptr_ne(r2, null); 8430 r = getArrayKCharSmallDictG(self, null, '1'); 8431 ck_assert_ptr_ne(r, null); 8432 char *s = toStringO(r); 8433 finishO(r); 8434 ck_assert_str_eq(s, "[]"); 8435 free(s); 8436 terminateO(self); 8437 8438 } 8439 8440 8441 void getSmallBoolKCharSmallDictGT(CuTest *tc UNUSED) { 8442 8443 smallBoolt* r; 8444 smallDictt *self = allocG(rtSmallDictt); 8445 8446 smallDictt* r2 = self->f->setBool(self, "1", true); 8447 ck_assert_ptr_ne(r2, null); 8448 r = getSmallBoolKCharSmallDictG(self, null, '1'); 8449 ck_assert_ptr_ne(r, null); 8450 char *s = toStringO(r); 8451 finishO(r); 8452 ck_assert_str_eq(s, "true"); 8453 free(s); 8454 terminateO(self); 8455 8456 } 8457 8458 8459 void getSmallBytesKCharSmallDictGT(CuTest *tc UNUSED) { 8460 8461 smallBytest* r; 8462 smallDictt *self = allocG(rtSmallDictt); 8463 smallBytest *value = allocSmallBytes("qwe", sizeof("qwe")); 8464 8465 smallDictt *r2 = self->f->setNFreeSmallBytes(self, "1", value); 8466 ck_assert_ptr_ne(r2, null); 8467 r = getSmallBytesKCharSmallDictG(self, null, '1'); 8468 ck_assert_ptr_ne(r, null); 8469 char *s = toStringO(r); 8470 finishO(r); 8471 ck_assert_str_eq(s, "[0x71,0x77,0x65,0x00]"); 8472 free(s); 8473 terminateO(self); 8474 8475 } 8476 8477 8478 void getSmallDoubleKCharSmallDictGT(CuTest *tc UNUSED) { 8479 8480 smallDoublet* r; 8481 smallDictt *self = allocG(rtSmallDictt); 8482 8483 smallDictt *r2 = self->f->setDouble(self, "1", 2.2); 8484 ck_assert_ptr_ne(r2, null); 8485 r = getSmallDoubleKCharSmallDictG(self, null, '1'); 8486 ck_assert_ptr_ne(r, null); 8487 char *s = toStringO(r); 8488 finishO(r); 8489 ck_assert_str_eq(s, "2.200000e+00"); 8490 free(s); 8491 terminateO(self); 8492 8493 } 8494 8495 8496 void getSmallIntKCharSmallDictGT(CuTest *tc UNUSED) { 8497 8498 smallIntt* r; 8499 smallDictt *self = allocG(rtSmallDictt); 8500 8501 smallDictt *r2 = self->f->setInt(self, "1", 2); 8502 ck_assert_ptr_ne(r2, null); 8503 r = getSmallIntKCharSmallDictG(self, null, '1'); 8504 ck_assert_ptr_ne(r, null); 8505 char *s = toStringO(r); 8506 finishO(r); 8507 ck_assert_str_eq(s, "2"); 8508 free(s); 8509 terminateO(self); 8510 8511 } 8512 8513 8514 void getSmallJsonKCharSmallDictGT(CuTest *tc UNUSED) { 8515 8516 smallJsont* r; 8517 smallDictt *self = allocG(rtSmallDictt); 8518 smallJsont *value = allocSmallJson(); 8519 8520 setTopIntO(value, 2); 8521 smallDictt *r2 = self->f->setNFreeSmallJson(self, "1", value); 8522 ck_assert_ptr_ne(r2, null); 8523 r = getSmallJsonKCharSmallDictG(self, null, '1'); 8524 ck_assert_ptr_ne(r, null); 8525 char *s = toStringO(r); 8526 finishO(r); 8527 ck_assert_str_eq(s, "2"); 8528 free(s); 8529 terminateO(self); 8530 8531 } 8532 8533 8534 void getSmallStringKCharSmallDictGT(CuTest *tc UNUSED) { 8535 8536 smallStringt* r; 8537 smallDictt *self = allocG(rtSmallDictt); 8538 8539 smallDictt *r2 = self->f->setS(self, "1", "qwe"); 8540 ck_assert_ptr_ne(r2, null); 8541 r = getSmallStringKCharSmallDictG(self, null, '1'); 8542 ck_assert_ptr_ne(r, null); 8543 char *s = toStringO(r); 8544 finishO(r); 8545 ck_assert_str_eq(s, "qwe"); 8546 free(s); 8547 terminateO(self); 8548 8549 } 8550 8551 8552 void getVoidKCharSmallDictGT(CuTest *tc UNUSED) { 8553 8554 void* r; 8555 smallDictt *self = allocG(rtSmallDictt); 8556 8557 createSmallContainer(c); 8558 setValO(&c, &r); 8559 smallDictt *r2 = self->f->setSmallContainer(self, "1", &c); 8560 ck_assert_ptr_ne(r2, null); 8561 r = getVoidKCharSmallDictG(self, null, '1'); 8562 ck_assert_ptr_eq(r, &r); 8563 terminateO(self); 8564 8565 } 8566 8567 8568 void getSmallContainerKCharSmallDictGT(CuTest *tc UNUSED) { 8569 8570 smallContainert* r; 8571 smallDictt *self = allocG(rtSmallDictt); 8572 8573 createSmallContainer(c); 8574 setValO(&c, &r); 8575 smallDictt *r2 = self->f->setSmallContainer(self, "1", &c); 8576 ck_assert_ptr_ne(r2, null); 8577 r = getSmallContainerKCharSmallDictG(self, null, '1'); 8578 ck_assert_ptr_ne(r, null); 8579 char *s = toStringO(r); 8580 finishO(r); 8581 ck_assert_str_eq(s, "<data smallContainer>"); 8582 free(s); 8583 terminateO(self); 8584 8585 } 8586 8587 8588 void getNDupSmallDictGT(CuTest *tc UNUSED) { 8589 8590 baset* r; 8591 smallDictt *self = allocG(rtSmallDictt); 8592 8593 self->f->setInt(self, "1", 2); 8594 r = getNDupSmallDictG(self, null, "1"); 8595 ck_assert_ptr_ne(r, null); 8596 char *s = toStringO(r); 8597 terminateO(r); 8598 ck_assert_str_eq(s, "2"); 8599 free(s); 8600 terminateO(self); 8601 8602 } 8603 8604 8605 void getNDupUndefinedSmallDictGT(CuTest *tc UNUSED) { 8606 8607 undefinedt* r; 8608 smallDictt *self = allocG(rtSmallDictt); 8609 8610 smallDictt *r2 = self->f->setUndefined(self, "1"); 8611 ck_assert_ptr_ne(r2, null); 8612 r = getNDupUndefinedSmallDictG(self, null, "1"); 8613 ck_assert_ptr_ne(r, null); 8614 terminateO(r); 8615 terminateO(self); 8616 8617 } 8618 8619 8620 void getNDupBoolSmallDictGT(CuTest *tc UNUSED) { 8621 8622 bool r; 8623 smallDictt *self = allocG(rtSmallDictt); 8624 8625 smallDictt* r2 = self->f->setBool(self, "1", true); 8626 ck_assert_ptr_ne(r2, null); 8627 r = getNDupBoolSmallDictG(self, false, "1"); 8628 ck_assert(r); 8629 terminateO(self); 8630 8631 } 8632 8633 8634 void getNDupDoubleSmallDictGT(CuTest *tc UNUSED) { 8635 8636 double r; 8637 smallDictt *self = allocG(rtSmallDictt); 8638 8639 smallDictt *r2 = self->f->setDouble(self, "1", 2.2); 8640 ck_assert_ptr_ne(r2, null); 8641 r = getNDupDoubleSmallDictG(self, 0, "1"); 8642 ck_assert(r == 2.2); 8643 terminateO(self); 8644 8645 } 8646 8647 8648 void getNDupIntSmallDictGT(CuTest *tc UNUSED) { 8649 8650 int64_t r; 8651 smallDictt *self = allocG(rtSmallDictt); 8652 8653 smallDictt *r2 = self->f->setInt(self, "1", 2); 8654 ck_assert_ptr_ne(r2, null); 8655 r = getNDupIntSmallDictG(self, 0, "1"); 8656 ck_assert_int_eq(r, 2); 8657 terminateO(self); 8658 8659 } 8660 8661 8662 void getNDupInt32SmallDictGT(CuTest *tc UNUSED) { 8663 8664 int32_t r; 8665 smallDictt *self = allocG(rtSmallDictt); 8666 8667 smallDictt *r2 = self->f->setInt(self, "1", 2); 8668 ck_assert_ptr_ne(r2, null); 8669 r = getNDupInt32SmallDictG(self, 0, "1"); 8670 ck_assert_int_eq(r, 2); 8671 terminateO(self); 8672 8673 } 8674 8675 8676 void getNDupUintSmallDictGT(CuTest *tc UNUSED) { 8677 8678 uint64_t r; 8679 smallDictt *self = allocG(rtSmallDictt); 8680 8681 smallDictt *r2 = self->f->setInt(self, "1", 2); 8682 ck_assert_ptr_ne(r2, null); 8683 r = getNDupUintSmallDictG(self, 0, "1"); 8684 ck_assert_int_eq(r, 2); 8685 terminateO(self); 8686 8687 } 8688 8689 8690 void getNDupUint32SmallDictGT(CuTest *tc UNUSED) { 8691 8692 uint32_t r; 8693 smallDictt *self = allocG(rtSmallDictt); 8694 8695 smallDictt *r2 = self->f->setInt(self, "1", 2); 8696 ck_assert_ptr_ne(r2, null); 8697 r = getNDupUint32SmallDictG(self, 0, "1"); 8698 ck_assert_int_eq(r, 2); 8699 terminateO(self); 8700 8701 } 8702 8703 8704 void getNDupSSmallDictGT(CuTest *tc UNUSED) { 8705 8706 char* r; 8707 smallDictt *self = allocG(rtSmallDictt); 8708 8709 smallDictt *r2 = self->f->setS(self, "1", "qwe"); 8710 ck_assert_ptr_ne(r2, null); 8711 r = getNDupSSmallDictG(self, null, "1"); 8712 ck_assert_ptr_ne(r, null); 8713 ck_assert_str_eq(r, "qwe"); 8714 free(r); 8715 terminateO(self); 8716 8717 } 8718 8719 8720 void getNDupDictSmallDictGT(CuTest *tc UNUSED) { 8721 8722 smallDictt* r; 8723 smallDictt *self = allocG(rtSmallDictt); 8724 smallDictt *dict = allocSmallDict(); 8725 8726 r = self->f->setNFreeDict(self, "1", dict); 8727 ck_assert_ptr_ne(r, null); 8728 r = getNDupDictSmallDictG(self, null, "1"); 8729 ck_assert_ptr_ne(r, null); 8730 char *s = toStringO(r); 8731 terminateO(r); 8732 ck_assert_str_eq(s, "{}"); 8733 free(s); 8734 terminateO(self); 8735 8736 } 8737 8738 8739 void getNDupArraySmallDictGT(CuTest *tc UNUSED) { 8740 8741 smallArrayt* r; 8742 smallDictt *self = allocG(rtSmallDictt); 8743 smallArrayt *array = allocSmallArray(); 8744 8745 smallDictt *r2 = self->f->setNFreeArray(self, "1", array); 8746 ck_assert_ptr_ne(r2, null); 8747 r = getNDupArraySmallDictG(self, null, "1"); 8748 ck_assert_ptr_ne(r, null); 8749 char *s = toStringO(r); 8750 terminateO(r); 8751 ck_assert_str_eq(s, "[]"); 8752 free(s); 8753 terminateO(self); 8754 8755 } 8756 8757 8758 void getNDupSmallBoolSmallDictGT(CuTest *tc UNUSED) { 8759 8760 smallBoolt* r; 8761 smallDictt *self = allocG(rtSmallDictt); 8762 8763 smallDictt* r2 = self->f->setBool(self, "1", true); 8764 ck_assert_ptr_ne(r2, null); 8765 r = getNDupSmallBoolSmallDictG(self, null, "1"); 8766 ck_assert_ptr_ne(r, null); 8767 char *s = toStringO(r); 8768 terminateO(r); 8769 ck_assert_str_eq(s, "true"); 8770 free(s); 8771 terminateO(self); 8772 8773 } 8774 8775 8776 void getNDupSmallBytesSmallDictGT(CuTest *tc UNUSED) { 8777 8778 smallBytest* r; 8779 smallDictt *self = allocG(rtSmallDictt); 8780 smallBytest *value = allocSmallBytes("qwe", sizeof("qwe")); 8781 8782 smallDictt *r2 = self->f->setNFreeSmallBytes(self, "1", value); 8783 ck_assert_ptr_ne(r2, null); 8784 r = getNDupSmallBytesSmallDictG(self, null, "1"); 8785 ck_assert_ptr_ne(r, null); 8786 char *s = toStringO(r); 8787 terminateO(r); 8788 ck_assert_str_eq(s, "[0x71,0x77,0x65,0x00]"); 8789 free(s); 8790 terminateO(self); 8791 8792 } 8793 8794 8795 void getNDupSmallDoubleSmallDictGT(CuTest *tc UNUSED) { 8796 8797 smallDoublet* r; 8798 smallDictt *self = allocG(rtSmallDictt); 8799 8800 smallDictt *r2 = self->f->setDouble(self, "1", 2.2); 8801 ck_assert_ptr_ne(r2, null); 8802 r = getNDupSmallDoubleSmallDictG(self, null, "1"); 8803 ck_assert_ptr_ne(r, null); 8804 char *s = toStringO(r); 8805 terminateO(r); 8806 ck_assert_str_eq(s, "2.200000e+00"); 8807 free(s); 8808 terminateO(self); 8809 8810 } 8811 8812 8813 void getNDupSmallIntSmallDictGT(CuTest *tc UNUSED) { 8814 8815 smallIntt* r; 8816 smallDictt *self = allocG(rtSmallDictt); 8817 8818 smallDictt *r2 = self->f->setInt(self, "1", 2); 8819 ck_assert_ptr_ne(r2, null); 8820 r = getNDupSmallIntSmallDictG(self, null, "1"); 8821 ck_assert_ptr_ne(r, null); 8822 char *s = toStringO(r); 8823 terminateO(r); 8824 ck_assert_str_eq(s, "2"); 8825 free(s); 8826 terminateO(self); 8827 8828 } 8829 8830 8831 void getNDupSmallJsonSmallDictGT(CuTest *tc UNUSED) { 8832 8833 smallJsont* r; 8834 smallDictt *self = allocG(rtSmallDictt); 8835 smallJsont *value = allocSmallJson(); 8836 8837 setTopIntO(value, 2); 8838 smallDictt *r2 = self->f->setNFreeSmallJson(self, "1", value); 8839 ck_assert_ptr_ne(r2, null); 8840 r = getNDupSmallJsonSmallDictG(self, null, "1"); 8841 ck_assert_ptr_ne(r, null); 8842 char *s = toStringO(r); 8843 terminateO(r); 8844 ck_assert_str_eq(s, "2"); 8845 free(s); 8846 terminateO(self); 8847 8848 } 8849 8850 8851 void getNDupSmallStringSmallDictGT(CuTest *tc UNUSED) { 8852 8853 smallStringt* r; 8854 smallDictt *self = allocG(rtSmallDictt); 8855 8856 smallDictt *r2 = self->f->setS(self, "1", "qwe"); 8857 ck_assert_ptr_ne(r2, null); 8858 r = getNDupSmallStringSmallDictG(self, null, "1"); 8859 ck_assert_ptr_ne(r, null); 8860 char *s = toStringO(r); 8861 terminateO(r); 8862 ck_assert_str_eq(s, "qwe"); 8863 free(s); 8864 terminateO(self); 8865 8866 } 8867 8868 8869 void getNDupVoidSmallDictGT(CuTest *tc UNUSED) { 8870 8871 void* r; 8872 smallDictt *self = allocG(rtSmallDictt); 8873 8874 createSmallContainer(c); 8875 setValO(&c, &r); 8876 smallDictt *r2 = self->f->setSmallContainer(self, "1", &c); 8877 ck_assert_ptr_ne(r2, null); 8878 r = getNDupVoidSmallDictG(self, null, "1"); 8879 ck_assert_ptr_eq(r, null); 8880 terminateO(self); 8881 8882 } 8883 8884 8885 void getNDupSmallContainerSmallDictGT(CuTest *tc UNUSED) { 8886 8887 smallContainert* r; 8888 smallDictt *self = allocG(rtSmallDictt); 8889 8890 createSmallContainer(c); 8891 setValO(&c, &r); 8892 smallDictt *r2 = self->f->setSmallContainer(self, "1", &c); 8893 ck_assert_ptr_ne(r2, null); 8894 r = getNDupSmallContainerSmallDictG(self, null, "1"); 8895 ck_assert_ptr_ne(r, null); 8896 char *s = toStringO(r); 8897 terminateO(r); 8898 ck_assert_str_eq(s, "<data smallContainer>"); 8899 free(s); 8900 terminateO(self); 8901 8902 } 8903 8904 8905 void getNDupKCharSmallDictGT(CuTest *tc UNUSED) { 8906 8907 baset* r; 8908 smallDictt *self = allocG(rtSmallDictt); 8909 8910 self->f->setInt(self, "1", 2); 8911 r = getNDupKCharSmallDictG(self, null, '1'); 8912 ck_assert_ptr_ne(r, null); 8913 char *s = toStringO(r); 8914 terminateO(r); 8915 ck_assert_str_eq(s, "2"); 8916 free(s); 8917 terminateO(self); 8918 8919 } 8920 8921 8922 void getNDupUndefinedKCharSmallDictGT(CuTest *tc UNUSED) { 8923 8924 undefinedt* r; 8925 smallDictt *self = allocG(rtSmallDictt); 8926 8927 smallDictt *r2 = self->f->setUndefined(self, "1"); 8928 ck_assert_ptr_ne(r2, null); 8929 r = getNDupUndefinedKCharSmallDictG(self, null, '1'); 8930 ck_assert_ptr_ne(r, null); 8931 terminateO(r); 8932 terminateO(self); 8933 8934 } 8935 8936 8937 void getNDupBoolKCharSmallDictGT(CuTest *tc UNUSED) { 8938 8939 bool r; 8940 smallDictt *self = allocG(rtSmallDictt); 8941 8942 smallDictt* r2 = self->f->setBool(self, "1", true); 8943 ck_assert_ptr_ne(r2, null); 8944 r = getNDupBoolKCharSmallDictG(self, false, '1'); 8945 ck_assert(r); 8946 terminateO(self); 8947 8948 } 8949 8950 8951 void getNDupDoubleKCharSmallDictGT(CuTest *tc UNUSED) { 8952 8953 double r; 8954 smallDictt *self = allocG(rtSmallDictt); 8955 8956 smallDictt *r2 = self->f->setDouble(self, "1", 2.2); 8957 ck_assert_ptr_ne(r2, null); 8958 r = getNDupDoubleKCharSmallDictG(self, 0, '1'); 8959 ck_assert(r == 2.2); 8960 terminateO(self); 8961 8962 } 8963 8964 8965 void getNDupIntKCharSmallDictGT(CuTest *tc UNUSED) { 8966 8967 int64_t r; 8968 smallDictt *self = allocG(rtSmallDictt); 8969 8970 smallDictt *r2 = self->f->setInt(self, "1", 2); 8971 ck_assert_ptr_ne(r2, null); 8972 r = getNDupIntKCharSmallDictG(self, 0, '1'); 8973 ck_assert_int_eq(r, 2); 8974 terminateO(self); 8975 8976 } 8977 8978 8979 void getNDupInt32KCharSmallDictGT(CuTest *tc UNUSED) { 8980 8981 int32_t r; 8982 smallDictt *self = allocG(rtSmallDictt); 8983 8984 smallDictt *r2 = self->f->setInt(self, "1", 2); 8985 ck_assert_ptr_ne(r2, null); 8986 r = getNDupInt32KCharSmallDictG(self, 0, '1'); 8987 ck_assert_int_eq(r, 2); 8988 terminateO(self); 8989 8990 } 8991 8992 8993 void getNDupUintKCharSmallDictGT(CuTest *tc UNUSED) { 8994 8995 uint64_t r; 8996 smallDictt *self = allocG(rtSmallDictt); 8997 8998 smallDictt *r2 = self->f->setInt(self, "1", 2); 8999 ck_assert_ptr_ne(r2, null); 9000 r = getNDupUintKCharSmallDictG(self, 0, '1'); 9001 ck_assert_int_eq(r, 2); 9002 terminateO(self); 9003 9004 } 9005 9006 9007 void getNDupUint32KCharSmallDictGT(CuTest *tc UNUSED) { 9008 9009 uint32_t r; 9010 smallDictt *self = allocG(rtSmallDictt); 9011 9012 smallDictt *r2 = self->f->setInt(self, "1", 2); 9013 ck_assert_ptr_ne(r2, null); 9014 r = getNDupUint32KCharSmallDictG(self, 0, '1'); 9015 ck_assert_int_eq(r, 2); 9016 terminateO(self); 9017 9018 } 9019 9020 9021 void getNDupSKCharSmallDictGT(CuTest *tc UNUSED) { 9022 9023 char* r; 9024 smallDictt *self = allocG(rtSmallDictt); 9025 9026 smallDictt *r2 = self->f->setS(self, "1", "qwe"); 9027 ck_assert_ptr_ne(r2, null); 9028 r = getNDupSKCharSmallDictG(self, null, '1'); 9029 ck_assert_ptr_ne(r, null); 9030 ck_assert_str_eq(r, "qwe"); 9031 free(r); 9032 terminateO(self); 9033 9034 } 9035 9036 9037 void getNDupDictKCharSmallDictGT(CuTest *tc UNUSED) { 9038 9039 smallDictt* r; 9040 smallDictt *self = allocG(rtSmallDictt); 9041 smallDictt *dict = allocSmallDict(); 9042 9043 r = self->f->setNFreeDict(self, "1", dict); 9044 ck_assert_ptr_ne(r, null); 9045 r = getNDupDictKCharSmallDictG(self, null, '1'); 9046 ck_assert_ptr_ne(r, null); 9047 char *s = toStringO(r); 9048 terminateO(r); 9049 ck_assert_str_eq(s, "{}"); 9050 free(s); 9051 terminateO(self); 9052 9053 } 9054 9055 9056 void getNDupArrayKCharSmallDictGT(CuTest *tc UNUSED) { 9057 9058 smallArrayt* r; 9059 smallDictt *self = allocG(rtSmallDictt); 9060 smallArrayt *array = allocSmallArray(); 9061 9062 smallDictt *r2 = self->f->setNFreeArray(self, "1", array); 9063 ck_assert_ptr_ne(r2, null); 9064 r = getNDupArrayKCharSmallDictG(self, null, '1'); 9065 ck_assert_ptr_ne(r, null); 9066 char *s = toStringO(r); 9067 terminateO(r); 9068 ck_assert_str_eq(s, "[]"); 9069 free(s); 9070 terminateO(self); 9071 9072 } 9073 9074 9075 void getNDupSmallBoolKCharSmallDictGT(CuTest *tc UNUSED) { 9076 9077 smallBoolt* r; 9078 smallDictt *self = allocG(rtSmallDictt); 9079 9080 smallDictt* r2 = self->f->setBool(self, "1", true); 9081 ck_assert_ptr_ne(r2, null); 9082 r = getNDupSmallBoolKCharSmallDictG(self, null, '1'); 9083 ck_assert_ptr_ne(r, null); 9084 char *s = toStringO(r); 9085 terminateO(r); 9086 ck_assert_str_eq(s, "true"); 9087 free(s); 9088 terminateO(self); 9089 9090 } 9091 9092 9093 void getNDupSmallBytesKCharSmallDictGT(CuTest *tc UNUSED) { 9094 9095 smallBytest* r; 9096 smallDictt *self = allocG(rtSmallDictt); 9097 smallBytest *value = allocSmallBytes("qwe", sizeof("qwe")); 9098 9099 smallDictt *r2 = self->f->setNFreeSmallBytes(self, "1", value); 9100 ck_assert_ptr_ne(r2, null); 9101 r = getNDupSmallBytesKCharSmallDictG(self, null, '1'); 9102 ck_assert_ptr_ne(r, null); 9103 char *s = toStringO(r); 9104 terminateO(r); 9105 ck_assert_str_eq(s, "[0x71,0x77,0x65,0x00]"); 9106 free(s); 9107 terminateO(self); 9108 9109 } 9110 9111 9112 void getNDupSmallDoubleKCharSmallDictGT(CuTest *tc UNUSED) { 9113 9114 smallDoublet* r; 9115 smallDictt *self = allocG(rtSmallDictt); 9116 9117 smallDictt *r2 = self->f->setDouble(self, "1", 2.2); 9118 ck_assert_ptr_ne(r2, null); 9119 r = getNDupSmallDoubleKCharSmallDictG(self, null, '1'); 9120 ck_assert_ptr_ne(r, null); 9121 char *s = toStringO(r); 9122 terminateO(r); 9123 ck_assert_str_eq(s, "2.200000e+00"); 9124 free(s); 9125 terminateO(self); 9126 9127 } 9128 9129 9130 void getNDupSmallIntKCharSmallDictGT(CuTest *tc UNUSED) { 9131 9132 smallIntt* r; 9133 smallDictt *self = allocG(rtSmallDictt); 9134 9135 smallDictt *r2 = self->f->setInt(self, "1", 2); 9136 ck_assert_ptr_ne(r2, null); 9137 r = getNDupSmallIntKCharSmallDictG(self, null, '1'); 9138 ck_assert_ptr_ne(r, null); 9139 char *s = toStringO(r); 9140 terminateO(r); 9141 ck_assert_str_eq(s, "2"); 9142 free(s); 9143 terminateO(self); 9144 9145 } 9146 9147 9148 void getNDupSmallJsonKCharSmallDictGT(CuTest *tc UNUSED) { 9149 9150 smallJsont* r; 9151 smallDictt *self = allocG(rtSmallDictt); 9152 smallJsont *value = allocSmallJson(); 9153 9154 setTopIntO(value, 2); 9155 smallDictt *r2 = self->f->setNFreeSmallJson(self, "1", value); 9156 ck_assert_ptr_ne(r2, null); 9157 r = getNDupSmallJsonKCharSmallDictG(self, null, '1'); 9158 ck_assert_ptr_ne(r, null); 9159 char *s = toStringO(r); 9160 terminateO(r); 9161 ck_assert_str_eq(s, "2"); 9162 free(s); 9163 terminateO(self); 9164 9165 } 9166 9167 9168 void getNDupSmallStringKCharSmallDictGT(CuTest *tc UNUSED) { 9169 9170 smallStringt* r; 9171 smallDictt *self = allocG(rtSmallDictt); 9172 9173 smallDictt *r2 = self->f->setS(self, "1", "qwe"); 9174 ck_assert_ptr_ne(r2, null); 9175 r = getNDupSmallStringKCharSmallDictG(self, null, '1'); 9176 ck_assert_ptr_ne(r, null); 9177 char *s = toStringO(r); 9178 terminateO(r); 9179 ck_assert_str_eq(s, "qwe"); 9180 free(s); 9181 terminateO(self); 9182 9183 } 9184 9185 9186 void getNDupVoidKCharSmallDictGT(CuTest *tc UNUSED) { 9187 9188 void* r; 9189 smallDictt *self = allocG(rtSmallDictt); 9190 9191 createSmallContainer(c); 9192 setValO(&c, &r); 9193 smallDictt *r2 = self->f->setSmallContainer(self, "1", &c); 9194 ck_assert_ptr_ne(r2, null); 9195 r = getNDupVoidKCharSmallDictG(self, null, '1'); 9196 ck_assert_ptr_eq(r, null); 9197 terminateO(self); 9198 9199 } 9200 9201 9202 void getNDupSmallContainerKCharSmallDictGT(CuTest *tc UNUSED) { 9203 9204 smallContainert* r; 9205 smallDictt *self = allocG(rtSmallDictt); 9206 9207 createSmallContainer(c); 9208 setValO(&c, &r); 9209 smallDictt *r2 = self->f->setSmallContainer(self, "1", &c); 9210 ck_assert_ptr_ne(r2, null); 9211 r = getNDupSmallContainerKCharSmallDictG(self, null, '1'); 9212 ck_assert_ptr_ne(r, null); 9213 char *s = toStringO(r); 9214 terminateO(r); 9215 ck_assert_str_eq(s, "<data smallContainer>"); 9216 free(s); 9217 terminateO(self); 9218 9219 } 9220 9221 9222 void setUndefinedSmallDictGT(CuTest *tc UNUSED) { 9223 9224 smallDictt* r; 9225 smallDictt *self = allocG(rtSmallDictt); 9226 9227 r = setUndefinedSmallDictG(self, "1", null); 9228 ck_assert_ptr_ne(r, null); 9229 char *s = toStringO(r); 9230 ck_assert_str_eq(s, "{\"1\":null}"); 9231 free(s); 9232 terminateO(self); 9233 9234 } 9235 9236 9237 void setBoolSmallDictGT(CuTest *tc UNUSED) { 9238 9239 smallDictt* r; 9240 smallDictt *self = allocG(rtSmallDictt); 9241 9242 r = setBoolSmallDictG(self, "1", true); 9243 ck_assert_ptr_ne(r, null); 9244 char *s = toStringO(r); 9245 ck_assert_str_eq(s, "{\"1\":true}"); 9246 free(s); 9247 terminateO(self); 9248 9249 } 9250 9251 9252 void setDoubleSmallDictGT(CuTest *tc UNUSED) { 9253 9254 smallDictt* r; 9255 smallDictt *self = allocG(rtSmallDictt); 9256 9257 r = setDoubleSmallDictG(self, "1", 2.2); 9258 ck_assert_ptr_ne(r, null); 9259 char *s = toStringO(r); 9260 ck_assert_str_eq(s, "{\"1\":2.200000e+00}"); 9261 free(s); 9262 terminateO(self); 9263 9264 } 9265 9266 9267 void setIntSmallDictGT(CuTest *tc UNUSED) { 9268 9269 smallDictt* r; 9270 smallDictt *self = allocG(rtSmallDictt); 9271 9272 r = setIntSmallDictG(self, "1", 2); 9273 ck_assert_ptr_ne(r, null); 9274 char *s = toStringO(r); 9275 ck_assert_str_eq(s, "{\"1\":2}"); 9276 free(s); 9277 terminateO(self); 9278 9279 } 9280 9281 9282 void setSSmallDictGT(CuTest *tc UNUSED) { 9283 9284 smallDictt* r; 9285 smallDictt *self = allocG(rtSmallDictt); 9286 9287 r = setSSmallDictG(self, "1", "qwe"); 9288 ck_assert_ptr_ne(r, null); 9289 char *s = toStringO(r); 9290 ck_assert_str_eq(s, "{\"1\":\"qwe\"}"); 9291 free(s); 9292 terminateO(self); 9293 9294 } 9295 9296 9297 void setCharSmallDictGT(CuTest *tc UNUSED) { 9298 9299 smallDictt* r; 9300 smallDictt *self = allocG(rtSmallDictt); 9301 9302 r = setCharSmallDictG(self, "1", 'x'); 9303 ck_assert_ptr_ne(r, null); 9304 char *s = toStringO(r); 9305 ck_assert_str_eq(s, "{\"1\":\"x\"}"); 9306 free(s); 9307 terminateO(self); 9308 9309 } 9310 9311 9312 void setDictSmallDictGT(CuTest *tc UNUSED) { 9313 9314 smallDictt* r; 9315 smallDictt *self = allocG(rtSmallDictt); 9316 smallDictt *dict = allocSmallDict(); 9317 9318 r = setDictSmallDictG(self, "1", dict); 9319 ck_assert_ptr_ne(r, null); 9320 finishO(dict); 9321 char *s = toStringO(r); 9322 ck_assert_str_eq(s, "{\"1\":{}}"); 9323 free(s); 9324 terminateO(self); 9325 9326 } 9327 9328 9329 void setArraySmallDictGT(CuTest *tc UNUSED) { 9330 9331 smallDictt* r; 9332 smallDictt *self = allocG(rtSmallDictt); 9333 smallArrayt *array = allocSmallArray(); 9334 9335 r = setArraySmallDictG(self, "1", array); 9336 ck_assert_ptr_ne(r, null); 9337 finishO(array); 9338 char *s = toStringO(r); 9339 ck_assert_str_eq(s, "{\"1\":[]}"); 9340 free(s); 9341 terminateO(self); 9342 9343 } 9344 9345 9346 void setArraycSmallDictGT(CuTest *tc UNUSED) { 9347 9348 smallDictt* r; 9349 smallDictt *self = allocG(rtSmallDictt); 9350 char **array = listCreateS("a", "b"); 9351 9352 r = setArraycSmallDictG(self, "1", array); 9353 ck_assert_ptr_ne(r, null); 9354 listFreeS(array); 9355 char *s = toStringO(r); 9356 ck_assert_str_eq(s, "{\"1\":[\"a\",\"b\"]}"); 9357 free(s); 9358 terminateO(self); 9359 9360 } 9361 9362 9363 void setCArraycSmallDictGT(CuTest *tc UNUSED) { 9364 9365 smallDictt* r; 9366 smallDictt *self = allocG(rtSmallDictt); 9367 const char *array[] = {"a", "b", null}; 9368 9369 r = setCArraycSmallDictG(self, "1", array); 9370 ck_assert_ptr_ne(r, null); 9371 char *s = toStringO(r); 9372 ck_assert_str_eq(s, "{\"1\":[\"a\",\"b\"]}"); 9373 free(s); 9374 terminateO(self); 9375 9376 } 9377 9378 9379 void setVoidSmallDictGT(CuTest *tc UNUSED) { 9380 9381 smallDictt* r; 9382 smallDictt *self = allocG(rtSmallDictt); 9383 9384 r = setVoidSmallDictG(self, "1", null); 9385 ck_assert_ptr_ne(r, null); 9386 char *s = toStringO(r); 9387 ck_assert_str_eq(s, "{\"1\":null}"); 9388 free(s); 9389 r = setVoidSmallDictG(self, "1", &r); 9390 ck_assert_ptr_ne(r, null); 9391 s = toStringO(r); 9392 ck_assert_str_eq(s, "{\"1\":\"<data container>\"}"); 9393 free(s); 9394 // null key 9395 r = setVoidSmallDictG(self, null, &r); 9396 ck_assert_ptr_eq(r, null); 9397 terminateO(self); 9398 9399 } 9400 9401 9402 void setSmallBoolSmallDictGT(CuTest *tc UNUSED) { 9403 9404 smallDictt* r; 9405 smallDictt *self = allocG(rtSmallDictt); 9406 smallBoolt *value = allocSmallBool(true); 9407 9408 r = setSmallBoolSmallDictG(self, "1", value); 9409 ck_assert_ptr_ne(r, null); 9410 finishO(value); 9411 char *s = toStringO(r); 9412 ck_assert_str_eq(s, "{\"1\":true}"); 9413 free(s); 9414 terminateO(self); 9415 9416 } 9417 9418 9419 void setSmallBytesSmallDictGT(CuTest *tc UNUSED) { 9420 9421 smallDictt* r; 9422 smallDictt *self = allocG(rtSmallDictt); 9423 smallBytest *value = allocSmallBytes("qwe", sizeof("qwe")); 9424 9425 r = setSmallBytesSmallDictG(self, "1", value); 9426 ck_assert_ptr_ne(r, null); 9427 finishO(value); 9428 char *s = toStringO(r); 9429 ck_assert_str_eq(s, "{\"1\":[0x71,0x77,0x65,0x00]}"); 9430 free(s); 9431 terminateO(self); 9432 9433 } 9434 9435 9436 void setSmallDoubleSmallDictGT(CuTest *tc UNUSED) { 9437 9438 smallDictt* r; 9439 smallDictt *self = allocG(rtSmallDictt); 9440 smallDoublet *value = allocSmallDouble(2.2); 9441 9442 r = setSmallDoubleSmallDictG(self, "1", value); 9443 ck_assert_ptr_ne(r, null); 9444 finishO(value); 9445 char *s = toStringO(r); 9446 ck_assert_str_eq(s, "{\"1\":2.200000e+00}"); 9447 free(s); 9448 terminateO(self); 9449 9450 } 9451 9452 9453 void setSmallIntSmallDictGT(CuTest *tc UNUSED) { 9454 9455 smallDictt* r; 9456 smallDictt *self = allocG(rtSmallDictt); 9457 smallIntt *value = allocSmallInt(2); 9458 9459 r = setSmallIntSmallDictG(self, "1", value); 9460 ck_assert_ptr_ne(r, null); 9461 finishO(value); 9462 char *s = toStringO(r); 9463 ck_assert_str_eq(s, "{\"1\":2}"); 9464 free(s); 9465 terminateO(self); 9466 9467 } 9468 9469 9470 void setSmallJsonSmallDictGT(CuTest *tc UNUSED) { 9471 9472 smallDictt* r; 9473 smallDictt *self = allocG(rtSmallDictt); 9474 smallJsont *value = allocSmallJson(); 9475 9476 setTopIntO(value, 2); 9477 r = setSmallJsonSmallDictG(self, "1", value); 9478 ck_assert_ptr_ne(r, null); 9479 finishO(value); 9480 char *s = toStringO(r); 9481 ck_assert_str_eq(s, "{\"1\":2}"); 9482 free(s); 9483 terminateO(self); 9484 9485 } 9486 9487 9488 void setSmallStringSmallDictGT(CuTest *tc UNUSED) { 9489 9490 smallDictt* r; 9491 smallDictt *self = allocG(rtSmallDictt); 9492 smallStringt *string = allocSmallString("qwe"); 9493 9494 r = setSmallStringSmallDictG(self, "1", string); 9495 ck_assert_ptr_ne(r, null); 9496 finishO(string); 9497 char *s = toStringO(r); 9498 ck_assert_str_eq(s, "{\"1\":\"qwe\"}"); 9499 free(s); 9500 terminateO(self); 9501 9502 } 9503 9504 9505 void setSmallContainerSmallDictGT(CuTest *tc UNUSED) { 9506 9507 smallDictt* r; 9508 smallDictt *self = allocG(rtSmallDictt); 9509 smallContainert *container = allocSmallContainer(null); 9510 9511 r = setSmallContainerSmallDictG(self, "1", container); 9512 ck_assert_ptr_ne(r, null); 9513 finishO(container); 9514 char *s = toStringO(r); 9515 ck_assert_str_eq(s, "{\"1\":\"<data container>\"}"); 9516 free(s); 9517 terminateO(self); 9518 9519 } 9520 9521 9522 void setKCharSmallDictGT(CuTest *tc UNUSED) { 9523 9524 smallDictt* r; 9525 smallDictt *self = allocG(rtSmallDictt); 9526 baset *value = (baset*) allocSmallInt(2); 9527 9528 r = setKCharSmallDictG(self, '1', value); 9529 ck_assert_ptr_ne(r, null); 9530 finishO(value); 9531 char *s = toStringO(r); 9532 ck_assert_str_eq(s, "{\"1\":2}"); 9533 free(s); 9534 terminateO(self); 9535 9536 } 9537 9538 9539 void setUndefinedKCharSmallDictGT(CuTest *tc UNUSED) { 9540 9541 smallDictt* r; 9542 smallDictt *self = allocG(rtSmallDictt); 9543 9544 r = setUndefinedKCharSmallDictG(self, '1', null); 9545 ck_assert_ptr_ne(r, null); 9546 char *s = toStringO(r); 9547 ck_assert_str_eq(s, "{\"1\":null}"); 9548 free(s); 9549 terminateO(self); 9550 9551 } 9552 9553 9554 void setBoolKCharSmallDictGT(CuTest *tc UNUSED) { 9555 9556 smallDictt* r; 9557 smallDictt *self = allocG(rtSmallDictt); 9558 9559 r = setBoolKCharSmallDictG(self, '1', true); 9560 ck_assert_ptr_ne(r, null); 9561 char *s = toStringO(r); 9562 ck_assert_str_eq(s, "{\"1\":true}"); 9563 free(s); 9564 terminateO(self); 9565 9566 } 9567 9568 9569 void setDoubleKCharSmallDictGT(CuTest *tc UNUSED) { 9570 9571 smallDictt* r; 9572 smallDictt *self = allocG(rtSmallDictt); 9573 9574 r = setDoubleKCharSmallDictG(self, '1', 2.2); 9575 ck_assert_ptr_ne(r, null); 9576 char *s = toStringO(r); 9577 ck_assert_str_eq(s, "{\"1\":2.200000e+00}"); 9578 free(s); 9579 terminateO(self); 9580 9581 } 9582 9583 9584 void setIntKCharSmallDictGT(CuTest *tc UNUSED) { 9585 9586 smallDictt* r; 9587 smallDictt *self = allocG(rtSmallDictt); 9588 9589 r = setIntKCharSmallDictG(self, '1', 2); 9590 ck_assert_ptr_ne(r, null); 9591 char *s = toStringO(r); 9592 ck_assert_str_eq(s, "{\"1\":2}"); 9593 free(s); 9594 terminateO(self); 9595 9596 } 9597 9598 9599 void setSKCharSmallDictGT(CuTest *tc UNUSED) { 9600 9601 smallDictt* r; 9602 smallDictt *self = allocG(rtSmallDictt); 9603 9604 r = setSKCharSmallDictG(self, '1', "qwe"); 9605 ck_assert_ptr_ne(r, null); 9606 char *s = toStringO(r); 9607 ck_assert_str_eq(s, "{\"1\":\"qwe\"}"); 9608 free(s); 9609 terminateO(self); 9610 9611 } 9612 9613 9614 void setCharKCharSmallDictGT(CuTest *tc UNUSED) { 9615 9616 smallDictt* r; 9617 smallDictt *self = allocG(rtSmallDictt); 9618 9619 r = setCharKCharSmallDictG(self, '1', 'x'); 9620 ck_assert_ptr_ne(r, null); 9621 char *s = toStringO(r); 9622 ck_assert_str_eq(s, "{\"1\":\"x\"}"); 9623 free(s); 9624 terminateO(self); 9625 9626 } 9627 9628 9629 void setDictKCharSmallDictGT(CuTest *tc UNUSED) { 9630 9631 smallDictt* r; 9632 smallDictt *self = allocG(rtSmallDictt); 9633 smallDictt *dict = allocSmallDict(); 9634 9635 r = setDictKCharSmallDictG(self, '1', dict); 9636 ck_assert_ptr_ne(r, null); 9637 finishO(dict); 9638 char *s = toStringO(r); 9639 ck_assert_str_eq(s, "{\"1\":{}}"); 9640 free(s); 9641 terminateO(self); 9642 9643 } 9644 9645 9646 void setArrayKCharSmallDictGT(CuTest *tc UNUSED) { 9647 9648 smallDictt* r; 9649 smallDictt *self = allocG(rtSmallDictt); 9650 smallArrayt *array = allocSmallArray(); 9651 9652 r = setArrayKCharSmallDictG(self, '1', array); 9653 ck_assert_ptr_ne(r, null); 9654 finishO(array); 9655 char *s = toStringO(r); 9656 ck_assert_str_eq(s, "{\"1\":[]}"); 9657 free(s); 9658 terminateO(self); 9659 9660 } 9661 9662 9663 void setArraycKCharSmallDictGT(CuTest *tc UNUSED) { 9664 9665 smallDictt* r; 9666 smallDictt *self = allocG(rtSmallDictt); 9667 char **array = listCreateS("a", "b"); 9668 9669 r = setArraycKCharSmallDictG(self, '1', array); 9670 ck_assert_ptr_ne(r, null); 9671 listFreeS(array); 9672 char *s = toStringO(r); 9673 ck_assert_str_eq(s, "{\"1\":[\"a\",\"b\"]}"); 9674 free(s); 9675 terminateO(self); 9676 9677 } 9678 9679 9680 void setCArraycKCharSmallDictGT(CuTest *tc UNUSED) { 9681 9682 smallDictt* r; 9683 smallDictt *self = allocG(rtSmallDictt); 9684 const char *array[] = {"a", "b", null}; 9685 9686 r = setCArraycKCharSmallDictG(self, '1', array); 9687 ck_assert_ptr_ne(r, null); 9688 char *s = toStringO(r); 9689 ck_assert_str_eq(s, "{\"1\":[\"a\",\"b\"]}"); 9690 free(s); 9691 terminateO(self); 9692 9693 } 9694 9695 9696 void setVoidKCharSmallDictGT(CuTest *tc UNUSED) { 9697 9698 smallDictt* r; 9699 smallDictt *self = allocG(rtSmallDictt); 9700 9701 r = setVoidKCharSmallDictG(self, '1', null); 9702 ck_assert_ptr_ne(r, null); 9703 char *s = toStringO(r); 9704 ck_assert_str_eq(s, "{\"1\":null}"); 9705 free(s); 9706 terminateO(self); 9707 9708 } 9709 9710 9711 void setSmallBoolKCharSmallDictGT(CuTest *tc UNUSED) { 9712 9713 smallDictt* r; 9714 smallDictt *self = allocG(rtSmallDictt); 9715 smallBoolt *value = allocSmallBool(true); 9716 9717 r = setSmallBoolKCharSmallDictG(self, '1', value); 9718 ck_assert_ptr_ne(r, null); 9719 finishO(value); 9720 char *s = toStringO(r); 9721 ck_assert_str_eq(s, "{\"1\":true}"); 9722 free(s); 9723 terminateO(self); 9724 9725 } 9726 9727 9728 void setSmallBytesKCharSmallDictGT(CuTest *tc UNUSED) { 9729 9730 smallDictt* r; 9731 smallDictt *self = allocG(rtSmallDictt); 9732 smallBytest *value = allocSmallBytes("qwe", sizeof("qwe")); 9733 9734 r = setSmallBytesKCharSmallDictG(self, '1', value); 9735 ck_assert_ptr_ne(r, null); 9736 finishO(value); 9737 char *s = toStringO(r); 9738 ck_assert_str_eq(s, "{\"1\":[0x71,0x77,0x65,0x00]}"); 9739 free(s); 9740 terminateO(self); 9741 9742 } 9743 9744 9745 void setSmallDoubleKCharSmallDictGT(CuTest *tc UNUSED) { 9746 9747 smallDictt* r; 9748 smallDictt *self = allocG(rtSmallDictt); 9749 smallDoublet *value = allocSmallDouble(2.2); 9750 9751 r = setSmallDoubleKCharSmallDictG(self, '1', value); 9752 ck_assert_ptr_ne(r, null); 9753 finishO(value); 9754 char *s = toStringO(r); 9755 ck_assert_str_eq(s, "{\"1\":2.200000e+00}"); 9756 free(s); 9757 terminateO(self); 9758 9759 } 9760 9761 9762 void setSmallIntKCharSmallDictGT(CuTest *tc UNUSED) { 9763 9764 smallDictt* r; 9765 smallDictt *self = allocG(rtSmallDictt); 9766 smallIntt *value = allocSmallInt(2); 9767 9768 r = setSmallIntKCharSmallDictG(self, '1', value); 9769 ck_assert_ptr_ne(r, null); 9770 finishO(value); 9771 char *s = toStringO(r); 9772 ck_assert_str_eq(s, "{\"1\":2}"); 9773 free(s); 9774 terminateO(self); 9775 9776 } 9777 9778 9779 void setSmallJsonKCharSmallDictGT(CuTest *tc UNUSED) { 9780 9781 smallDictt* r; 9782 smallDictt *self = allocG(rtSmallDictt); 9783 smallJsont *value = allocSmallJson(); 9784 9785 setTopIntO(value, 2); 9786 r = setSmallJsonKCharSmallDictG(self, '1', value); 9787 ck_assert_ptr_ne(r, null); 9788 finishO(value); 9789 char *s = toStringO(r); 9790 ck_assert_str_eq(s, "{\"1\":2}"); 9791 free(s); 9792 terminateO(self); 9793 9794 } 9795 9796 9797 void setSmallStringKCharSmallDictGT(CuTest *tc UNUSED) { 9798 9799 smallDictt* r; 9800 smallDictt *self = allocG(rtSmallDictt); 9801 smallStringt *string = allocSmallString("qwe"); 9802 9803 r = setSmallStringKCharSmallDictG(self, '1', string); 9804 ck_assert_ptr_ne(r, null); 9805 finishO(string); 9806 char *s = toStringO(r); 9807 ck_assert_str_eq(s, "{\"1\":\"qwe\"}"); 9808 free(s); 9809 terminateO(self); 9810 9811 } 9812 9813 9814 void setSmallContainerKCharSmallDictGT(CuTest *tc UNUSED) { 9815 9816 smallDictt* r; 9817 smallDictt *self = allocG(rtSmallDictt); 9818 smallContainert *container = allocSmallContainer(null); 9819 9820 r = setSmallContainerKCharSmallDictG(self, '1', container); 9821 ck_assert_ptr_ne(r, null); 9822 finishO(container); 9823 char *s = toStringO(r); 9824 ck_assert_str_eq(s, "{\"1\":\"<data container>\"}"); 9825 free(s); 9826 terminateO(self); 9827 9828 } 9829 9830 9831 void setNFreeSmallDictGT(CuTest *tc UNUSED) { 9832 9833 smallDictt* r; 9834 smallDictt *self = allocG(rtSmallDictt); 9835 baset *value; 9836 9837 value = (baset*)allocUndefined(); 9838 r = setNFreeSmallDictG(self, "1", value); 9839 ck_assert_ptr_ne(r, null); 9840 char *s = toStringO(r); 9841 ck_assert_str_eq(s, "{\"1\":null}"); 9842 free(s); 9843 terminateO(self); 9844 9845 } 9846 9847 9848 void setNFreeUndefinedSmallDictGT(CuTest *tc UNUSED) { 9849 9850 smallDictt* r; 9851 smallDictt *self = allocG(rtSmallDictt); 9852 undefinedt *undefined = allocUndefined(); 9853 9854 r = setNFreeUndefinedSmallDictG(self, "1", undefined); 9855 ck_assert_ptr_ne(r, null); 9856 char *s = toStringO(r); 9857 ck_assert_str_eq(s, "{\"1\":null}"); 9858 free(s); 9859 terminateO(self); 9860 9861 } 9862 9863 9864 void setNFreeSSmallDictGT(CuTest *tc UNUSED) { 9865 9866 smallDictt* r; 9867 smallDictt *self = allocG(rtSmallDictt); 9868 char *string = strdup("qwe"); 9869 9870 r = setNFreeSSmallDictG(self, "1", string); 9871 ck_assert_ptr_ne(r, null); 9872 char *s = toStringO(r); 9873 ck_assert_str_eq(s, "{\"1\":\"qwe\"}"); 9874 free(s); 9875 terminateO(self); 9876 9877 } 9878 9879 9880 void setNFreeDictSmallDictGT(CuTest *tc UNUSED) { 9881 9882 smallDictt* r; 9883 smallDictt *self = allocG(rtSmallDictt); 9884 smallDictt *dict = allocSmallDict(); 9885 9886 r = setNFreeDictSmallDictG(self, "1", dict); 9887 ck_assert_ptr_ne(r, null); 9888 char *s = toStringO(r); 9889 ck_assert_str_eq(s, "{\"1\":{}}"); 9890 free(s); 9891 terminateO(self); 9892 9893 } 9894 9895 9896 void setNFreeArraySmallDictGT(CuTest *tc UNUSED) { 9897 9898 smallDictt* r; 9899 smallDictt *self = allocG(rtSmallDictt); 9900 smallArrayt *array = allocSmallArray(); 9901 9902 r = setNFreeArraySmallDictG(self, "1", array); 9903 ck_assert_ptr_ne(r, null); 9904 char *s = toStringO(r); 9905 ck_assert_str_eq(s, "{\"1\":[]}"); 9906 free(s); 9907 terminateO(self); 9908 9909 } 9910 9911 9912 void setNFreeArraycSmallDictGT(CuTest *tc UNUSED) { 9913 9914 smallDictt* r; 9915 smallDictt *self = allocG(rtSmallDictt); 9916 char **array = listCreateS("a", "b"); 9917 9918 r = setNFreeArraycSmallDictG(self, "1", array); 9919 ck_assert_ptr_ne(r, null); 9920 char *s = toStringO(r); 9921 ck_assert_str_eq(s, "{\"1\":[\"a\",\"b\"]}"); 9922 free(s); 9923 terminateO(self); 9924 9925 } 9926 9927 9928 void setNFreeSmallBoolSmallDictGT(CuTest *tc UNUSED) { 9929 9930 smallDictt* r; 9931 smallDictt *self = allocG(rtSmallDictt); 9932 smallBoolt *value = allocSmallBool(true); 9933 9934 r = setNFreeSmallBoolSmallDictG(self, "1", value); 9935 ck_assert_ptr_ne(r, null); 9936 char *s = toStringO(r); 9937 ck_assert_str_eq(s, "{\"1\":true}"); 9938 free(s); 9939 terminateO(self); 9940 9941 } 9942 9943 9944 void setNFreeSmallBytesSmallDictGT(CuTest *tc UNUSED) { 9945 9946 smallDictt* r; 9947 smallDictt *self = allocG(rtSmallDictt); 9948 smallBytest *value = allocSmallBytes("qwe", sizeof("qwe")); 9949 9950 r = setNFreeSmallBytesSmallDictG(self, "1", value); 9951 ck_assert_ptr_ne(r, null); 9952 char *s = toStringO(r); 9953 ck_assert_str_eq(s, "{\"1\":[0x71,0x77,0x65,0x00]}"); 9954 free(s); 9955 terminateO(self); 9956 9957 } 9958 9959 9960 void setNFreeSmallDoubleSmallDictGT(CuTest *tc UNUSED) { 9961 9962 smallDictt* r; 9963 smallDictt *self = allocG(rtSmallDictt); 9964 smallDoublet *value = allocSmallDouble(2.2); 9965 9966 r = setNFreeSmallDoubleSmallDictG(self, "1", value); 9967 ck_assert_ptr_ne(r, null); 9968 char *s = toStringO(r); 9969 ck_assert_str_eq(s, "{\"1\":2.200000e+00}"); 9970 free(s); 9971 terminateO(self); 9972 9973 } 9974 9975 9976 void setNFreeSmallIntSmallDictGT(CuTest *tc UNUSED) { 9977 9978 smallDictt* r; 9979 smallDictt *self = allocG(rtSmallDictt); 9980 smallIntt *value = allocSmallInt(2); 9981 9982 r = setNFreeSmallIntSmallDictG(self, "1", value); 9983 ck_assert_ptr_ne(r, null); 9984 char *s = toStringO(r); 9985 ck_assert_str_eq(s, "{\"1\":2}"); 9986 free(s); 9987 terminateO(self); 9988 9989 } 9990 9991 9992 void setNFreeSmallJsonSmallDictGT(CuTest *tc UNUSED) { 9993 9994 smallDictt* r; 9995 smallDictt *self = allocG(rtSmallDictt); 9996 smallJsont *value = allocSmallJson(); 9997 9998 setTopIntO(value, 2); 9999 r = setNFreeSmallJsonSmallDictG(self, "1", value); 10000 ck_assert_ptr_ne(r, null); 10001 char *s = toStringO(r); 10002 ck_assert_str_eq(s, "{\"1\":2}"); 10003 free(s); 10004 terminateO(self); 10005 10006 } 10007 10008 10009 void setNFreeSmallStringSmallDictGT(CuTest *tc UNUSED) { 10010 10011 smallDictt* r; 10012 smallDictt *self = allocG(rtSmallDictt); 10013 smallStringt *string = allocSmallString("qwe"); 10014 10015 r = setNFreeSmallStringSmallDictG(self, "1", string); 10016 ck_assert_ptr_ne(r, null); 10017 char *s = toStringO(r); 10018 ck_assert_str_eq(s, "{\"1\":\"qwe\"}"); 10019 free(s); 10020 terminateO(self); 10021 10022 } 10023 10024 10025 void setNFreeSmallContainerSmallDictGT(CuTest *tc UNUSED) { 10026 10027 smallDictt* r; 10028 smallDictt *self = allocG(rtSmallDictt); 10029 smallContainert *container = allocSmallContainer(null); 10030 10031 r = setNFreeSmallContainerSmallDictG(self, "1", container); 10032 ck_assert_ptr_ne(r, null); 10033 char *s = toStringO(r); 10034 ck_assert_str_eq(s, "{\"1\":\"<data container>\"}"); 10035 free(s); 10036 terminateO(self); 10037 10038 } 10039 10040 10041 void setNFreeKCharSmallDictGT(CuTest *tc UNUSED) { 10042 10043 smallDictt* r; 10044 smallDictt *self = allocG(rtSmallDictt); 10045 baset *value; 10046 10047 value = (baset*)allocUndefined(); 10048 r = setNFreeKCharSmallDictG(self, '1', value); 10049 ck_assert_ptr_ne(r, null); 10050 char *s = toStringO(r); 10051 ck_assert_str_eq(s, "{\"1\":null}"); 10052 free(s); 10053 terminateO(self); 10054 10055 } 10056 10057 10058 void setNFreeUndefinedKCharSmallDictGT(CuTest *tc UNUSED) { 10059 10060 smallDictt* r; 10061 smallDictt *self = allocG(rtSmallDictt); 10062 undefinedt *undefined = allocUndefined(); 10063 10064 r = setNFreeUndefinedKCharSmallDictG(self, '1', undefined); 10065 ck_assert_ptr_ne(r, null); 10066 char *s = toStringO(r); 10067 ck_assert_str_eq(s, "{\"1\":null}"); 10068 free(s); 10069 terminateO(self); 10070 10071 } 10072 10073 10074 void setNFreeSKCharSmallDictGT(CuTest *tc UNUSED) { 10075 10076 smallDictt* r; 10077 smallDictt *self = allocG(rtSmallDictt); 10078 char *string = strdup("qwe"); 10079 10080 r = setNFreeSKCharSmallDictG(self, '1', string); 10081 ck_assert_ptr_ne(r, null); 10082 char *s = toStringO(r); 10083 ck_assert_str_eq(s, "{\"1\":\"qwe\"}"); 10084 free(s); 10085 terminateO(self); 10086 10087 } 10088 10089 10090 void setNFreeDictKCharSmallDictGT(CuTest *tc UNUSED) { 10091 10092 smallDictt* r; 10093 smallDictt *self = allocG(rtSmallDictt); 10094 smallDictt *dict = allocSmallDict(); 10095 10096 r = setNFreeDictKCharSmallDictG(self, '1', dict); 10097 ck_assert_ptr_ne(r, null); 10098 char *s = toStringO(r); 10099 ck_assert_str_eq(s, "{\"1\":{}}"); 10100 free(s); 10101 terminateO(self); 10102 10103 } 10104 10105 10106 void setNFreeArrayKCharSmallDictGT(CuTest *tc UNUSED) { 10107 10108 smallDictt* r; 10109 smallDictt *self = allocG(rtSmallDictt); 10110 smallArrayt *array = allocSmallArray(); 10111 10112 r = setNFreeArrayKCharSmallDictG(self, '1', array); 10113 ck_assert_ptr_ne(r, null); 10114 char *s = toStringO(r); 10115 ck_assert_str_eq(s, "{\"1\":[]}"); 10116 free(s); 10117 terminateO(self); 10118 10119 } 10120 10121 10122 void setNFreeArraycKCharSmallDictGT(CuTest *tc UNUSED) { 10123 10124 smallDictt* r; 10125 smallDictt *self = allocG(rtSmallDictt); 10126 char **array = listCreateS("a", "b"); 10127 10128 r = setNFreeArraycKCharSmallDictG(self, '1', array); 10129 ck_assert_ptr_ne(r, null); 10130 char *s = toStringO(r); 10131 ck_assert_str_eq(s, "{\"1\":[\"a\",\"b\"]}"); 10132 free(s); 10133 terminateO(self); 10134 10135 } 10136 10137 10138 void setNFreeSmallBoolKCharSmallDictGT(CuTest *tc UNUSED) { 10139 10140 smallDictt* r; 10141 smallDictt *self = allocG(rtSmallDictt); 10142 smallBoolt *value = allocSmallBool(true); 10143 10144 r = setNFreeSmallBoolKCharSmallDictG(self, '1', value); 10145 ck_assert_ptr_ne(r, null); 10146 char *s = toStringO(r); 10147 ck_assert_str_eq(s, "{\"1\":true}"); 10148 free(s); 10149 terminateO(self); 10150 10151 } 10152 10153 10154 void setNFreeSmallBytesKCharSmallDictGT(CuTest *tc UNUSED) { 10155 10156 smallDictt* r; 10157 smallDictt *self = allocG(rtSmallDictt); 10158 smallBytest *value = allocSmallBytes("qwe", sizeof("qwe")); 10159 10160 r = setNFreeSmallBytesKCharSmallDictG(self, '1', value); 10161 ck_assert_ptr_ne(r, null); 10162 char *s = toStringO(r); 10163 ck_assert_str_eq(s, "{\"1\":[0x71,0x77,0x65,0x00]}"); 10164 free(s); 10165 terminateO(self); 10166 10167 } 10168 10169 10170 void setNFreeSmallDoubleKCharSmallDictGT(CuTest *tc UNUSED) { 10171 10172 smallDictt* r; 10173 smallDictt *self = allocG(rtSmallDictt); 10174 smallDoublet *value = allocSmallDouble(2.2); 10175 10176 r = setNFreeSmallDoubleKCharSmallDictG(self, '1', value); 10177 ck_assert_ptr_ne(r, null); 10178 char *s = toStringO(r); 10179 ck_assert_str_eq(s, "{\"1\":2.200000e+00}"); 10180 free(s); 10181 terminateO(self); 10182 10183 } 10184 10185 10186 void setNFreeSmallIntKCharSmallDictGT(CuTest *tc UNUSED) { 10187 10188 smallDictt* r; 10189 smallDictt *self = allocG(rtSmallDictt); 10190 smallIntt *value = allocSmallInt(2); 10191 10192 r = setNFreeSmallIntKCharSmallDictG(self, '1', value); 10193 ck_assert_ptr_ne(r, null); 10194 char *s = toStringO(r); 10195 ck_assert_str_eq(s, "{\"1\":2}"); 10196 free(s); 10197 terminateO(self); 10198 10199 } 10200 10201 10202 void setNFreeSmallJsonKCharSmallDictGT(CuTest *tc UNUSED) { 10203 10204 smallDictt* r; 10205 smallDictt *self = allocG(rtSmallDictt); 10206 smallJsont *value = allocSmallJson(); 10207 10208 setTopIntO(value, 2); 10209 r = setNFreeSmallJsonKCharSmallDictG(self, '1', value); 10210 ck_assert_ptr_ne(r, null); 10211 char *s = toStringO(r); 10212 ck_assert_str_eq(s, "{\"1\":2}"); 10213 free(s); 10214 terminateO(self); 10215 10216 } 10217 10218 10219 void setNFreeSmallStringKCharSmallDictGT(CuTest *tc UNUSED) { 10220 10221 smallDictt* r; 10222 smallDictt *self = allocG(rtSmallDictt); 10223 smallStringt *string = allocSmallString("qwe"); 10224 10225 r = setNFreeSmallStringKCharSmallDictG(self, '1', string); 10226 ck_assert_ptr_ne(r, null); 10227 char *s = toStringO(r); 10228 ck_assert_str_eq(s, "{\"1\":\"qwe\"}"); 10229 free(s); 10230 terminateO(self); 10231 10232 } 10233 10234 10235 void setNFreeSmallContainerKCharSmallDictGT(CuTest *tc UNUSED) { 10236 10237 smallDictt* r; 10238 smallDictt *self = allocG(rtSmallDictt); 10239 smallContainert *container = allocSmallContainer(null); 10240 10241 r = setNFreeSmallContainerKCharSmallDictG(self, '1', container); 10242 ck_assert_ptr_ne(r, null); 10243 char *s = toStringO(r); 10244 ck_assert_str_eq(s, "{\"1\":\"<data container>\"}"); 10245 free(s); 10246 terminateO(self); 10247 10248 } 10249 10250 10251 void setPDictSmallDictGT(CuTest *tc UNUSED) { 10252 10253 smallDictt* r; 10254 smallDictt *self = allocG(rtSmallDictt); 10255 smallDictt *dict; 10256 10257 dict = allocSmallDict(); 10258 r = self->f->setDict(self, "1", dict); 10259 ck_assert_ptr_ne(r, null); 10260 dict->f->setInt(dict, "a", 1); 10261 r = setPDictSmallDictG(self, "1", dict); 10262 ck_assert_ptr_ne(r, null); 10263 char *s = toStringO(r); 10264 ck_assert_str_eq(s, "{\"1\":{\"a\":1}}"); 10265 free(s); 10266 finishO(dict); 10267 terminateO(self); 10268 10269 } 10270 10271 10272 void setPArraySmallDictGT(CuTest *tc UNUSED) { 10273 10274 smallDictt* r; 10275 smallDictt *self = allocG(rtSmallDictt); 10276 smallArrayt *array; 10277 10278 array = allocSmallArray(); 10279 r = self->f->setArray(self, "1", array); 10280 ck_assert_ptr_ne(r, null); 10281 array->f->pushInt(array, 1); 10282 r = setPArraySmallDictG(self, "1", array); 10283 ck_assert_ptr_ne(r, null); 10284 char *s = toStringO(r); 10285 ck_assert_str_eq(s, "{\"1\":[1]}"); 10286 free(s); 10287 finishO(array); 10288 terminateO(self); 10289 10290 } 10291 10292 10293 void setPSmallJsonSmallDictGT(CuTest *tc UNUSED) { 10294 10295 smallDictt* r; 10296 smallDictt *self = allocG(rtSmallDictt); 10297 smallJsont *json; 10298 10299 json = allocSmallJson(); 10300 r = self->f->setSmallJson(self, "1", json); 10301 ck_assert_ptr_ne(r, null); 10302 json->f->setInt(json, "a", 1); 10303 r = setPSmallJsonSmallDictG(self, "1", json); 10304 ck_assert_ptr_ne(r, null); 10305 finishO(json); 10306 char *s = toStringO(r); 10307 ck_assert_str_eq(s, "{\"1\":{\"a\":1}}"); 10308 free(s); 10309 terminateO(self); 10310 10311 } 10312 10313 10314 void setPSmallStringSmallDictGT(CuTest *tc UNUSED) { 10315 10316 smallDictt* r; 10317 smallDictt *self = allocG(rtSmallDictt); 10318 smallStringt *string; 10319 10320 string = allocSmallString(""); 10321 r = self->f->setSmallString(self, "1", string); 10322 ck_assert_ptr_ne(r, null); 10323 string->f->appendS(string, "s"); 10324 r = setPSmallStringSmallDictG(self, "1", string); 10325 ck_assert_ptr_ne(r, null); 10326 finishO(string); 10327 char *s = toStringO(r); 10328 ck_assert_str_eq(s, "{\"1\":\"s\"}"); 10329 free(s); 10330 terminateO(self); 10331 10332 } 10333 10334 10335 void setNFreePDictSmallDictGT(CuTest *tc UNUSED) { 10336 10337 smallDictt* r; 10338 smallDictt *self = allocG(rtSmallDictt); 10339 smallDictt *value; 10340 10341 value = allocSmallDict(); 10342 r = self->f->setDict(self, "1", value); 10343 ck_assert_ptr_ne(r, null); 10344 value->f->setInt(value, "a", 1); 10345 r = setNFreePDictSmallDictG(self, "1", value); 10346 ck_assert_ptr_ne(r, null); 10347 char *s = toStringO(r); 10348 ck_assert_str_eq(s, "{\"1\":{\"a\":1}}"); 10349 free(s); 10350 terminateO(self); 10351 10352 } 10353 10354 10355 void setNFreePArraySmallDictGT(CuTest *tc UNUSED) { 10356 10357 smallDictt* r; 10358 smallDictt *self = allocG(rtSmallDictt); 10359 smallArrayt *value; 10360 10361 value = allocSmallArray(); 10362 r = self->f->setArray(self, "1", value); 10363 ck_assert_ptr_ne(r, null); 10364 value->f->pushInt(value, 2); 10365 r = setNFreePArraySmallDictG(self, "1", value); 10366 ck_assert_ptr_ne(r, null); 10367 char *s = toStringO(r); 10368 ck_assert_str_eq(s, "{\"1\":[2]}"); 10369 free(s); 10370 terminateO(self); 10371 10372 } 10373 10374 10375 void setNFreePSmallJsonSmallDictGT(CuTest *tc UNUSED) { 10376 10377 smallDictt* r; 10378 smallDictt *self = allocG(rtSmallDictt); 10379 smallJsont *value; 10380 10381 value = allocSmallJson(); 10382 r = self->f->setSmallJson(self, "1", value); 10383 ck_assert_ptr_ne(r, null); 10384 value->f->setInt(value, "a", 1); 10385 r = setNFreePSmallJsonSmallDictG(self, "1", value); 10386 ck_assert_ptr_ne(r, null); 10387 char *s = toStringO(r); 10388 ck_assert_str_eq(s, "{\"1\":{\"a\":1}}"); 10389 free(s); 10390 terminateO(self); 10391 10392 } 10393 10394 10395 void setNFreePSmallStringSmallDictGT(CuTest *tc UNUSED) { 10396 10397 smallDictt* r; 10398 smallDictt *self = allocG(rtSmallDictt); 10399 smallStringt *value; 10400 10401 value = allocSmallString(""); 10402 r = self->f->setSmallString(self, "1", value); 10403 ck_assert_ptr_ne(r, null); 10404 value->f->appendS(value, "2"); 10405 r = setNFreePSmallStringSmallDictG(self, "1", value); 10406 ck_assert_ptr_ne(r, null); 10407 char *s = toStringO(r); 10408 ck_assert_str_eq(s, "{\"1\":\"2\"}"); 10409 free(s); 10410 terminateO(self); 10411 10412 } 10413 10414 10415 void setPArrayKCharSmallDictGT(CuTest *tc UNUSED) { 10416 10417 smallDictt* r; 10418 smallDictt *self = allocG(rtSmallDictt); 10419 smallArrayt *array; 10420 10421 array = allocSmallArray(); 10422 r = self->f->setArray(self, "1", array); 10423 ck_assert_ptr_ne(r, null); 10424 array->f->pushInt(array, 2); 10425 r = setPArrayKCharSmallDictG(self, '1', array); 10426 ck_assert_ptr_ne(r, null); 10427 char *s = toStringO(r); 10428 ck_assert_str_eq(s, "{\"1\":[2]}"); 10429 free(s); 10430 terminateO(self); 10431 finishO(array); 10432 10433 } 10434 10435 10436 void setPDictKCharSmallDictGT(CuTest *tc UNUSED) { 10437 10438 smallDictt* r; 10439 smallDictt *self = allocG(rtSmallDictt); 10440 smallDictt *dict; 10441 10442 dict = allocSmallDict(); 10443 r = self->f->setDict(self, "1", dict); 10444 ck_assert_ptr_ne(r, null); 10445 dict->f->setInt(dict, "a", 1); 10446 r = setPDictKCharSmallDictG(self, '1', dict); 10447 ck_assert_ptr_ne(r, null); 10448 char *s = toStringO(r); 10449 ck_assert_str_eq(s, "{\"1\":{\"a\":1}}"); 10450 free(s); 10451 terminateO(self); 10452 finishO(dict); 10453 10454 } 10455 10456 10457 void setPSmallJsonKCharSmallDictGT(CuTest *tc UNUSED) { 10458 10459 smallDictt* r; 10460 smallDictt *self = allocG(rtSmallDictt); 10461 smallJsont *json; 10462 10463 json = allocSmallJson(); 10464 r = self->f->setSmallJson(self, "1", json); 10465 ck_assert_ptr_ne(r, null); 10466 json->f->setInt(json, "a", 1); 10467 r = setPSmallJsonKCharSmallDictG(self, '1', json); 10468 ck_assert_ptr_ne(r, null); 10469 finishO(json); 10470 char *s = toStringO(r); 10471 ck_assert_str_eq(s, "{\"1\":{\"a\":1}}"); 10472 free(s); 10473 terminateO(self); 10474 10475 } 10476 10477 10478 void setPSmallStringKCharSmallDictGT(CuTest *tc UNUSED) { 10479 10480 smallDictt* r; 10481 smallDictt *self = allocG(rtSmallDictt); 10482 smallStringt *string; 10483 10484 string = allocSmallString(""); 10485 r = self->f->setSmallString(self, "1", string); 10486 ck_assert_ptr_ne(r, null); 10487 string->f->appendS(string, "s"); 10488 r = setPSmallStringKCharSmallDictG(self, '1', string); 10489 ck_assert_ptr_ne(r, null); 10490 finishO(string); 10491 char *s = toStringO(r); 10492 ck_assert_str_eq(s, "{\"1\":\"s\"}"); 10493 free(s); 10494 terminateO(self); 10495 10496 } 10497 10498 10499 void setNFreePArrayKCharSmallDictGT(CuTest *tc UNUSED) { 10500 10501 smallDictt* r; 10502 smallDictt *self = allocG(rtSmallDictt); 10503 smallArrayt *value; 10504 10505 value = allocSmallArray(); 10506 r = self->f->setArray(self, "1", value); 10507 ck_assert_ptr_ne(r, null); 10508 value->f->pushInt(value, 2); 10509 r = setNFreePArrayKCharSmallDictG(self, '1', value); 10510 ck_assert_ptr_ne(r, null); 10511 char *s = toStringO(r); 10512 ck_assert_str_eq(s, "{\"1\":[2]}"); 10513 free(s); 10514 terminateO(self); 10515 10516 } 10517 10518 10519 void setNFreePDictKCharSmallDictGT(CuTest *tc UNUSED) { 10520 10521 smallDictt* r; 10522 smallDictt *self = allocG(rtSmallDictt); 10523 smallDictt *value; 10524 10525 value = allocSmallDict(); 10526 r = self->f->setDict(self, "1", value); 10527 ck_assert_ptr_ne(r, null); 10528 value->f->setInt(value, "a", 1); 10529 r = setNFreePDictKCharSmallDictG(self, '1', value); 10530 ck_assert_ptr_ne(r, null); 10531 char *s = toStringO(r); 10532 ck_assert_str_eq(s, "{\"1\":{\"a\":1}}"); 10533 free(s); 10534 terminateO(self); 10535 10536 } 10537 10538 10539 void setNFreePSmallJsonKCharSmallDictGT(CuTest *tc UNUSED) { 10540 10541 smallDictt* r; 10542 smallDictt *self = allocG(rtSmallDictt); 10543 smallJsont *value; 10544 10545 value = allocSmallJson(); 10546 r = self->f->setSmallJson(self, "1", value); 10547 ck_assert_ptr_ne(r, null); 10548 value->f->setInt(value, "a", 1); 10549 r = setNFreePSmallJsonKCharSmallDictG(self, '1', value); 10550 ck_assert_ptr_ne(r, null); 10551 char *s = toStringO(r); 10552 ck_assert_str_eq(s, "{\"1\":{\"a\":1}}"); 10553 free(s); 10554 terminateO(self); 10555 10556 } 10557 10558 10559 void setNFreePSmallStringKCharSmallDictGT(CuTest *tc UNUSED) { 10560 10561 smallDictt* r; 10562 smallDictt *self = allocG(rtSmallDictt); 10563 smallStringt *value; 10564 10565 value = allocSmallString(""); 10566 r = self->f->setSmallString(self, "1", value); 10567 ck_assert_ptr_ne(r, null); 10568 value->f->appendS(value, "2"); 10569 r = setNFreePSmallStringKCharSmallDictG(self, '1', value); 10570 ck_assert_ptr_ne(r, null); 10571 char *s = toStringO(r); 10572 ck_assert_str_eq(s, "{\"1\":\"2\"}"); 10573 free(s); 10574 terminateO(self); 10575 10576 } 10577 10578 10579 void mergeSmallDictGT(CuTest *tc UNUSED) { 10580 10581 smallDictt* r; 10582 smallDictt *self = allocG(rtSmallDictt); 10583 smallDictt *value = allocSmallDict(); 10584 10585 self->f->setS(self, "1", "2"); 10586 self->f->setS(self, "3", "4"); 10587 value->f->setS(value, "3", "#"); 10588 value->f->setInt(value, "4", 0); 10589 r = mergeSmallDictG(self, value); 10590 ck_assert_ptr_ne(r, null); 10591 char *s = toStringO(r); 10592 ck_assert_str_eq(s, "{\"1\":\"2\",\"3\":\"#\",\"4\":0}"); 10593 free(s); 10594 smashO(value); 10595 terminateO(self); 10596 10597 } 10598 10599 10600 void mergeSmallJsonSmallDictGT(CuTest *tc UNUSED) { 10601 10602 smallDictt* r; 10603 smallDictt *self = allocG(rtSmallDictt); 10604 smallJsont *json = allocSmallJson(); 10605 10606 self->f->setS(self, "1", "2"); 10607 self->f->setS(self, "3", "4"); 10608 json->f->setS(json, "3", "#"); 10609 json->f->setInt(json, "4", 0); 10610 r = mergeSmallJsonSmallDictG(self, json); 10611 ck_assert_ptr_ne(r, null); 10612 char *s = toStringO(r); 10613 ck_assert_str_eq(s, "{\"1\":\"2\",\"3\":\"#\",\"4\":0}"); 10614 free(s); 10615 smashO(json); 10616 terminateO(self); 10617 10618 } 10619 10620 10621 void mergeNSmashSmallDictGT(CuTest *tc UNUSED) { 10622 10623 smallDictt* r; 10624 smallDictt *self = allocG(rtSmallDictt); 10625 smallDictt *value = allocSmallDict(); 10626 10627 self->f->setS(self, "1", "2"); 10628 self->f->setS(self, "3", "4"); 10629 value->f->setS(value, "3", "#"); 10630 value->f->setInt(value, "4", 0); 10631 r = mergeNSmashSmallDictG(self, value); 10632 ck_assert_ptr_ne(r, null); 10633 char *s = toStringO(r); 10634 ck_assert_str_eq(s, "{\"1\":\"2\",\"3\":\"#\",\"4\":0}"); 10635 free(s); 10636 terminateO(self); 10637 10638 } 10639 10640 10641 void mergeNSmashSmallJsonSmallDictGT(CuTest *tc UNUSED) { 10642 10643 smallDictt* r; 10644 smallDictt *self = allocG(rtSmallDictt); 10645 smallJsont *json = allocSmallJson(); 10646 10647 self->f->setS(self, "1", "2"); 10648 self->f->setS(self, "3", "4"); 10649 json->f->setS(json, "3", "#"); 10650 json->f->setInt(json, "4", 0); 10651 r = mergeNSmashSmallJsonSmallDictG(self, json); 10652 ck_assert_ptr_ne(r, null); 10653 char *s = toStringO(r); 10654 ck_assert_str_eq(s, "{\"1\":\"2\",\"3\":\"#\",\"4\":0}"); 10655 free(s); 10656 terminateO(self); 10657 10658 } 10659 10660 10661 void equalSmallDictBaseGT(CuTest *tc UNUSED) { 10662 10663 bool r; 10664 smallDictt* self = allocG(rtSmallDictt); 10665 10666 createAllocateSmallDict(d); 10667 r = equalSmallDictBaseG(self, (baset*)d); 10668 ck_assert(!r); 10669 terminateO(d); 10670 terminateO(self); 10671 10672 } 10673 10674 10675 void equalSmallDictSmallJsonGT(CuTest *tc UNUSED) { 10676 10677 bool r; 10678 smallDictt* self = allocG(rtSmallDictt); 10679 smallJsont* p2 = allocSmallJson(); 10680 10681 self->f->setS(self, "3", "#"); 10682 p2->f->setS(p2, "3", "#"); 10683 r = equalSmallDictSmallJsonG(self, p2); 10684 ck_assert(r); 10685 terminateO(p2); 10686 terminateO(self); 10687 10688 } 10689 10690 10691 void equalSmallDictGT(CuTest *tc UNUSED) { 10692 10693 bool r; 10694 smallDictt* self = allocG(rtSmallDictt); 10695 smallDictt* p2 = allocSmallDict(); 10696 10697 self->f->setS(self, "3", "#"); 10698 p2->f->setS(p2, "3", "#"); 10699 r = equalSmallDictG(self, p2); 10700 ck_assert(r); 10701 terminateO(p2); 10702 terminateO(self); 10703 10704 } 10705 10706 10707 void icEqualSmallDictBaseGT(CuTest *tc UNUSED) { 10708 10709 bool r; 10710 smallDictt* self = allocG(rtSmallDictt); 10711 10712 createAllocateSmallDict(d); 10713 self->f->setS(self, "q", "q"); 10714 d->f->setS(d, "q", "Q"); 10715 r = icEqualSmallDictBaseG(self, (baset*)d); 10716 ck_assert(r); 10717 terminateO(d); 10718 terminateO(self); 10719 10720 } 10721 10722 10723 void icEqualSmallDictSmallJsonGT(CuTest *tc UNUSED) { 10724 10725 bool r; 10726 smallDictt* self = allocG(rtSmallDictt); 10727 smallJsont* p2 = allocSmallJson(); 10728 10729 self->f->setS(self, "3", "W"); 10730 p2->f->setS(p2, "3", "w"); 10731 r = icEqualSmallDictSmallJsonG(self, p2); 10732 ck_assert(r); 10733 terminateO(p2); 10734 terminateO(self); 10735 10736 } 10737 10738 10739 void icEqualSmallDictGT(CuTest *tc UNUSED) { 10740 10741 bool r; 10742 smallDictt* self = allocG(rtSmallDictt); 10743 smallDictt* p2 = allocSmallDict(); 10744 10745 self->f->setS(self, "3", "A"); 10746 p2->f->setS(p2, "3", "a"); 10747 r = icEqualSmallDictG(self, p2); 10748 ck_assert(r); 10749 terminateO(p2); 10750 terminateO(self); 10751 10752 } 10753 10754 10755 void getNumSmallDictGT(CuTest *tc UNUSED) { 10756 10757 double r; 10758 smallDictt *self = allocG(rtSmallDictt); 10759 smallDictt *r2; 10760 10761 r2 = self->f->setInt(self, "1", 1); 10762 ck_assert_ptr_ne(r2, null); 10763 r2 = self->f->setDouble(self, "2", 2.2); 10764 ck_assert_ptr_ne(r2, null); 10765 r2 = self->f->setS(self, "3", "2"); 10766 ck_assert_ptr_ne(r2, null); 10767 r = getNumSmallDictG(self, "1"); 10768 ck_assert(r == 1); 10769 r = getNumSmallDictG(self, "2"); 10770 ck_assert(r == 2.2); 10771 terminateO(self); 10772 10773 } 10774 10775 10776 void cropElemSmallDictGT(CuTest *tc UNUSED) { 10777 10778 baset* r; 10779 smallDictt *self = allocG(rtSmallDictt); 10780 smallDictt *r2; 10781 10782 r2 = self->f->setInt(self, "1", 1); 10783 ck_assert_ptr_ne(r2, null); 10784 r2 = self->f->setDouble(self, "2", 2.2); 10785 ck_assert_ptr_ne(r2, null); 10786 r2 = self->f->setS(self, "3", "2"); 10787 ck_assert_ptr_ne(r2, null); 10788 r2 = self->f->setUndefined(self, "u"); 10789 ck_assert_ptr_ne(r2, null); 10790 createSmallContainer(c); 10791 r2 = self->f->setSmallContainer(self, "c", &c); 10792 ck_assert_ptr_ne(r2, null); 10793 createAllocateSmallInt(I); 10794 setValG(I, 11); 10795 I->type = "anothertype"; 10796 r2 = self->f->set(self, "b", (baset*)I); 10797 ck_assert_ptr_ne(r2, null); 10798 // crop string 10799 r = cropElemSmallDictG(self, "3"); 10800 ck_assert_ptr_ne(r, null); 10801 char *s = toStringO(r); 10802 terminateO(r); 10803 ck_assert_str_eq(s, "2"); 10804 free(s); 10805 s = toStringO(self); 10806 ck_assert_str_eq(s, "{\"1\":1,\"2\":2.200000e+00,\"u\":null,\"c\":\"<data container>\",\"b\":\"<data container>\"}"); 10807 free(s); 10808 terminateO(self); 10809 10810 } 10811 10812 10813 void cropElemUndefinedSmallDictGT(CuTest *tc UNUSED) { 10814 10815 undefinedt* r; 10816 smallDictt *self = allocG(rtSmallDictt); 10817 smallDictt *r2; 10818 10819 r2 = self->f->setInt(self, "1", 1); 10820 ck_assert_ptr_ne(r2, null); 10821 r2 = self->f->setDouble(self, "2", 2.2); 10822 ck_assert_ptr_ne(r2, null); 10823 r2 = self->f->setUndefined(self, "u"); 10824 ck_assert_ptr_ne(r2, null); 10825 r = cropElemUndefinedSmallDictG(self, "u"); 10826 ck_assert_ptr_ne(r, null); 10827 char *s = toStringO(r); 10828 terminateO(r); 10829 ck_assert_str_eq(s, "null"); 10830 free(s); 10831 s = toStringO(self); 10832 ck_assert_str_eq(s, "{\"1\":1,\"2\":2.200000e+00}"); 10833 free(s); 10834 terminateO(self); 10835 10836 } 10837 10838 10839 void cropElemBoolSmallDictGT(CuTest *tc UNUSED) { 10840 10841 bool r; 10842 smallDictt *self = allocG(rtSmallDictt); 10843 smallDictt *r2; 10844 10845 r2 = self->f->setInt(self, "1", 1); 10846 ck_assert_ptr_ne(r2, null); 10847 r2 = self->f->setDouble(self, "2", 2.2); 10848 ck_assert_ptr_ne(r2, null); 10849 r2 = self->f->setBool(self, "b", true); 10850 ck_assert_ptr_ne(r2, null); 10851 createAllocateSmallInt(I); 10852 setValG(I, 11); 10853 I->type = "anothertype"; 10854 r2 = self->f->set(self, "B", (baset*)I); 10855 ck_assert_ptr_ne(r2, null); 10856 r = cropElemBoolSmallDictG(self, "b"); 10857 ck_assert(r); 10858 char *s = toStringO(self); 10859 ck_assert_str_eq(s, "{\"1\":1,\"2\":2.200000e+00,\"B\":\"<data container>\"}"); 10860 free(s); 10861 terminateO(self); 10862 10863 } 10864 10865 10866 void cropElemDoubleSmallDictGT(CuTest *tc UNUSED) { 10867 10868 double r; 10869 smallDictt *self = allocG(rtSmallDictt); 10870 smallDictt *r2; 10871 10872 r2 = self->f->setInt(self, "1", 1); 10873 ck_assert_ptr_ne(r2, null); 10874 r2 = self->f->setDouble(self, "2", 2.2); 10875 ck_assert_ptr_ne(r2, null); 10876 r2 = self->f->setDouble(self, "b", 3.3); 10877 ck_assert_ptr_ne(r2, null); 10878 createAllocateSmallInt(I); 10879 setValG(I, 11); 10880 I->type = "anothertype"; 10881 r2 = self->f->set(self, "B", (baset*)I); 10882 ck_assert_ptr_ne(r2, null); 10883 r = cropElemDoubleSmallDictG(self, "b"); 10884 ck_assert(r == 3.3); 10885 char *s = toStringO(self); 10886 ck_assert_str_eq(s, "{\"1\":1,\"2\":2.200000e+00,\"B\":\"<data container>\"}"); 10887 free(s); 10888 terminateO(self); 10889 10890 } 10891 10892 10893 void cropElemIntSmallDictGT(CuTest *tc UNUSED) { 10894 10895 int64_t r; 10896 smallDictt *self = allocG(rtSmallDictt); 10897 smallDictt *r2; 10898 10899 r2 = self->f->setInt(self, "1", 1); 10900 ck_assert_ptr_ne(r2, null); 10901 r2 = self->f->setDouble(self, "2", 2.2); 10902 ck_assert_ptr_ne(r2, null); 10903 r2 = self->f->setInt(self, "b", 2); 10904 ck_assert_ptr_ne(r2, null); 10905 createAllocateSmallInt(I); 10906 setValG(I, 11); 10907 I->type = "anothertype"; 10908 r2 = self->f->set(self, "B", (baset*)I); 10909 ck_assert_ptr_ne(r2, null); 10910 r = cropElemIntSmallDictG(self, "b"); 10911 ck_assert_int_eq(r, 2); 10912 char *s = toStringO(self); 10913 ck_assert_str_eq(s, "{\"1\":1,\"2\":2.200000e+00,\"B\":\"<data container>\"}"); 10914 free(s); 10915 terminateO(self); 10916 10917 } 10918 10919 10920 void cropElemInt32SmallDictGT(CuTest *tc UNUSED) { 10921 10922 int32_t r; 10923 smallDictt *self = allocG(rtSmallDictt); 10924 smallDictt *r2; 10925 10926 r2 = self->f->setInt(self, "1", 1); 10927 ck_assert_ptr_ne(r2, null); 10928 r2 = self->f->setDouble(self, "2", 2.2); 10929 ck_assert_ptr_ne(r2, null); 10930 r2 = self->f->setInt(self, "b", 2); 10931 ck_assert_ptr_ne(r2, null); 10932 createAllocateSmallInt(I); 10933 setValG(I, 11); 10934 I->type = "anothertype"; 10935 r2 = self->f->set(self, "B", (baset*)I); 10936 ck_assert_ptr_ne(r2, null); 10937 r = cropElemInt32SmallDictG(self, "b"); 10938 ck_assert_int_eq(r, 2); 10939 char *s = toStringO(self); 10940 ck_assert_str_eq(s, "{\"1\":1,\"2\":2.200000e+00,\"B\":\"<data container>\"}"); 10941 free(s); 10942 terminateO(self); 10943 10944 } 10945 10946 10947 void cropElemUintSmallDictGT(CuTest *tc UNUSED) { 10948 10949 uint64_t r; 10950 smallDictt *self = allocG(rtSmallDictt); 10951 smallDictt *r2; 10952 10953 r2 = self->f->setInt(self, "1", 1); 10954 ck_assert_ptr_ne(r2, null); 10955 r2 = self->f->setDouble(self, "2", 2.2); 10956 ck_assert_ptr_ne(r2, null); 10957 r2 = self->f->setInt(self, "b", 2); 10958 ck_assert_ptr_ne(r2, null); 10959 createAllocateSmallInt(I); 10960 setValG(I, 11); 10961 I->type = "anothertype"; 10962 r2 = self->f->set(self, "B", (baset*)I); 10963 ck_assert_ptr_ne(r2, null); 10964 r = cropElemUintSmallDictG(self, "b"); 10965 ck_assert_int_eq(r, 2); 10966 char *s = toStringO(self); 10967 ck_assert_str_eq(s, "{\"1\":1,\"2\":2.200000e+00,\"B\":\"<data container>\"}"); 10968 free(s); 10969 terminateO(self); 10970 10971 } 10972 10973 10974 void cropElemUint32SmallDictGT(CuTest *tc UNUSED) { 10975 10976 uint32_t r; 10977 smallDictt *self = allocG(rtSmallDictt); 10978 smallDictt *r2; 10979 10980 r2 = self->f->setInt(self, "1", 1); 10981 ck_assert_ptr_ne(r2, null); 10982 r2 = self->f->setDouble(self, "2", 2.2); 10983 ck_assert_ptr_ne(r2, null); 10984 r2 = self->f->setInt(self, "b", 2); 10985 ck_assert_ptr_ne(r2, null); 10986 createAllocateSmallInt(I); 10987 setValG(I, 11); 10988 I->type = "anothertype"; 10989 r2 = self->f->set(self, "B", (baset*)I); 10990 ck_assert_ptr_ne(r2, null); 10991 r = cropElemUint32SmallDictG(self, "b"); 10992 ck_assert_int_eq(r, 2); 10993 char *s = toStringO(self); 10994 ck_assert_str_eq(s, "{\"1\":1,\"2\":2.200000e+00,\"B\":\"<data container>\"}"); 10995 free(s); 10996 terminateO(self); 10997 10998 } 10999 11000 11001 void cropElemSSmallDictGT(CuTest *tc UNUSED) { 11002 11003 char* r; 11004 smallDictt *self = allocG(rtSmallDictt); 11005 smallDictt *r2; 11006 11007 r2 = self->f->setInt(self, "1", 1); 11008 ck_assert_ptr_ne(r2, null); 11009 r2 = self->f->setDouble(self, "2", 2.2); 11010 ck_assert_ptr_ne(r2, null); 11011 r2 = self->f->setS(self, "b", "qwe"); 11012 ck_assert_ptr_ne(r2, null); 11013 createAllocateSmallInt(I); 11014 setValG(I, 11); 11015 I->type = "anothertype"; 11016 r2 = self->f->set(self, "B", (baset*)I); 11017 ck_assert_ptr_ne(r2, null); 11018 r = cropElemSSmallDictG(self, "b"); 11019 ck_assert_str_eq(r, "qwe"); 11020 free(r); 11021 char *s = toStringO(self); 11022 ck_assert_str_eq(s, "{\"1\":1,\"2\":2.200000e+00,\"B\":\"<data container>\"}"); 11023 free(s); 11024 terminateO(self); 11025 11026 } 11027 11028 11029 void cropElemDictSmallDictGT(CuTest *tc UNUSED) { 11030 11031 smallDictt* r; 11032 smallDictt *self = allocG(rtSmallDictt); 11033 smallDictt *r2; 11034 11035 r2 = self->f->setInt(self, "1", 1); 11036 ck_assert_ptr_ne(r2, null); 11037 r2 = self->f->setDouble(self, "2", 2.2); 11038 ck_assert_ptr_ne(r2, null); 11039 createAllocateSmallDict(d); 11040 r2 = self->f->setNFreeDict(self, "b", d); 11041 ck_assert_ptr_ne(r2, null); 11042 createAllocateSmallInt(I); 11043 setValG(I, 11); 11044 I->type = "anothertype"; 11045 r2 = self->f->set(self, "B", (baset*)I); 11046 ck_assert_ptr_ne(r2, null); 11047 r = cropElemDictSmallDictG(self, "b"); 11048 ck_assert_ptr_ne(r, null); 11049 char *s = toStringO(r); 11050 terminateO(r); 11051 ck_assert_str_eq(s, "{}"); 11052 free(s); 11053 s = toStringO(self); 11054 ck_assert_str_eq(s, "{\"1\":1,\"2\":2.200000e+00,\"B\":\"<data container>\"}"); 11055 free(s); 11056 terminateO(self); 11057 11058 } 11059 11060 11061 void cropElemArraySmallDictGT(CuTest *tc UNUSED) { 11062 11063 smallArrayt* r; 11064 smallDictt *self = allocG(rtSmallDictt); 11065 smallDictt *r2; 11066 11067 r2 = self->f->setInt(self, "1", 1); 11068 ck_assert_ptr_ne(r2, null); 11069 r2 = self->f->setDouble(self, "2", 2.2); 11070 ck_assert_ptr_ne(r2, null); 11071 createAllocateSmallArray(d); 11072 r2 = self->f->setNFreeArray(self, "b", d); 11073 ck_assert_ptr_ne(r2, null); 11074 createAllocateSmallInt(I); 11075 setValG(I, 11); 11076 I->type = "anothertype"; 11077 r2 = self->f->set(self, "B", (baset*)I); 11078 ck_assert_ptr_ne(r2, null); 11079 r = cropElemArraySmallDictG(self, "b"); 11080 ck_assert_ptr_ne(r, null); 11081 char *s = toStringO(r); 11082 terminateO(r); 11083 ck_assert_str_eq(s, "[]"); 11084 free(s); 11085 s = toStringO(self); 11086 ck_assert_str_eq(s, "{\"1\":1,\"2\":2.200000e+00,\"B\":\"<data container>\"}"); 11087 free(s); 11088 terminateO(self); 11089 11090 } 11091 11092 11093 void cropElemSmallBoolSmallDictGT(CuTest *tc UNUSED) { 11094 11095 smallBoolt* r; 11096 smallDictt *self = allocG(rtSmallDictt); 11097 smallDictt *r2; 11098 11099 r2 = self->f->setInt(self, "1", 1); 11100 ck_assert_ptr_ne(r2, null); 11101 r2 = self->f->setDouble(self, "2", 2.2); 11102 ck_assert_ptr_ne(r2, null); 11103 r2 = self->f->setBool(self, "b", true); 11104 ck_assert_ptr_ne(r2, null); 11105 createAllocateSmallInt(I); 11106 setValG(I, 11); 11107 I->type = "anothertype"; 11108 r2 = self->f->set(self, "B", (baset*)I); 11109 ck_assert_ptr_ne(r2, null); 11110 r = cropElemSmallBoolSmallDictG(self, "b"); 11111 ck_assert_ptr_ne(r, null); 11112 char *s = toStringO(r); 11113 terminateO(r); 11114 ck_assert_str_eq(s, "true"); 11115 free(s); 11116 s = toStringO(self); 11117 ck_assert_str_eq(s, "{\"1\":1,\"2\":2.200000e+00,\"B\":\"<data container>\"}"); 11118 free(s); 11119 terminateO(self); 11120 11121 } 11122 11123 11124 void cropElemSmallBytesSmallDictGT(CuTest *tc UNUSED) { 11125 11126 smallBytest* r; 11127 smallDictt *self = allocG(rtSmallDictt); 11128 smallDictt *r2; 11129 11130 r2 = self->f->setInt(self, "1", 1); 11131 ck_assert_ptr_ne(r2, null); 11132 r2 = self->f->setDouble(self, "2", 2.2); 11133 ck_assert_ptr_ne(r2, null); 11134 createAllocateSmallBytes(d); 11135 r2 = self->f->setNFreeSmallBytes(self, "b", d); 11136 ck_assert_ptr_ne(r2, null); 11137 createAllocateSmallInt(I); 11138 setValG(I, 11); 11139 I->type = "anothertype"; 11140 r2 = self->f->set(self, "B", (baset*)I); 11141 ck_assert_ptr_ne(r2, null); 11142 r = cropElemSmallBytesSmallDictG(self, "b"); 11143 ck_assert_ptr_ne(r, null); 11144 char *s = toStringO(r); 11145 terminateO(r); 11146 ck_assert_str_eq(s, "[]"); 11147 free(s); 11148 s = toStringO(self); 11149 ck_assert_str_eq(s, "{\"1\":1,\"2\":2.200000e+00,\"B\":\"<data container>\"}"); 11150 free(s); 11151 terminateO(self); 11152 11153 } 11154 11155 11156 void cropElemSmallDoubleSmallDictGT(CuTest *tc UNUSED) { 11157 11158 smallDoublet* r; 11159 smallDictt *self = allocG(rtSmallDictt); 11160 smallDictt *r2; 11161 11162 r2 = self->f->setInt(self, "1", 1); 11163 ck_assert_ptr_ne(r2, null); 11164 r2 = self->f->setDouble(self, "2", 2.2); 11165 ck_assert_ptr_ne(r2, null); 11166 r2 = self->f->setDouble(self, "b", 3.3); 11167 ck_assert_ptr_ne(r2, null); 11168 createAllocateSmallInt(I); 11169 setValG(I, 11); 11170 I->type = "anothertype"; 11171 r2 = self->f->set(self, "B", (baset*)I); 11172 ck_assert_ptr_ne(r2, null); 11173 r = cropElemSmallDoubleSmallDictG(self, "b"); 11174 ck_assert_ptr_ne(r, null); 11175 char *s = toStringO(r); 11176 terminateO(r); 11177 ck_assert_str_eq(s, "3.300000e+00"); 11178 free(s); 11179 s = toStringO(self); 11180 ck_assert_str_eq(s, "{\"1\":1,\"2\":2.200000e+00,\"B\":\"<data container>\"}"); 11181 free(s); 11182 terminateO(self); 11183 11184 } 11185 11186 11187 void cropElemSmallIntSmallDictGT(CuTest *tc UNUSED) { 11188 11189 smallIntt* r; 11190 smallDictt *self = allocG(rtSmallDictt); 11191 smallDictt *r2; 11192 11193 r2 = self->f->setInt(self, "1", 1); 11194 ck_assert_ptr_ne(r2, null); 11195 r2 = self->f->setDouble(self, "2", 2.2); 11196 ck_assert_ptr_ne(r2, null); 11197 r2 = self->f->setInt(self, "b", 2); 11198 ck_assert_ptr_ne(r2, null); 11199 createAllocateSmallInt(I); 11200 setValG(I, 11); 11201 I->type = "anothertype"; 11202 r2 = self->f->set(self, "B", (baset*)I); 11203 ck_assert_ptr_ne(r2, null); 11204 r = cropElemSmallIntSmallDictG(self, "b"); 11205 ck_assert_ptr_ne(r, null); 11206 char *s = toStringO(r); 11207 terminateO(r); 11208 ck_assert_str_eq(s, "2"); 11209 free(s); 11210 s = toStringO(self); 11211 ck_assert_str_eq(s, "{\"1\":1,\"2\":2.200000e+00,\"B\":\"<data container>\"}"); 11212 free(s); 11213 terminateO(self); 11214 11215 } 11216 11217 11218 void cropElemSmallJsonSmallDictGT(CuTest *tc UNUSED) { 11219 11220 smallJsont* r; 11221 smallDictt *self = allocG(rtSmallDictt); 11222 smallDictt *r2; 11223 11224 r2 = self->f->setInt(self, "1", 1); 11225 ck_assert_ptr_ne(r2, null); 11226 createAllocateSmallBytes(b); 11227 r2 = self->f->setNFreeSmallBytes(self, "2", b); 11228 ck_assert_ptr_ne(r2, null); 11229 createAllocateSmallJson(d); 11230 r2 = self->f->setNFreeSmallJson(self, "b", d); 11231 ck_assert_ptr_ne(r2, null); 11232 createAllocateSmallInt(I); 11233 setValG(I, 11); 11234 I->type = "anothertype"; 11235 r2 = self->f->set(self, "B", (baset*)I); 11236 ck_assert_ptr_ne(r2, null); 11237 r = cropElemSmallJsonSmallDictG(self, "b"); 11238 ck_assert_ptr_ne(r, null); 11239 char *s = toStringO(r); 11240 terminateO(r); 11241 ck_assert_str_eq(s, "{}"); 11242 free(s); 11243 s = toStringO(self); 11244 ck_assert_str_eq(s, "{\"1\":1,\"2\":[],\"B\":\"<data container>\"}"); 11245 free(s); 11246 terminateO(self); 11247 11248 } 11249 11250 11251 void cropElemSmallStringSmallDictGT(CuTest *tc UNUSED) { 11252 11253 smallStringt* r; 11254 smallDictt *self = allocG(rtSmallDictt); 11255 smallDictt *r2; 11256 11257 r2 = self->f->setInt(self, "1", 1); 11258 ck_assert_ptr_ne(r2, null); 11259 r2 = self->f->setDouble(self, "2", 2.2); 11260 ck_assert_ptr_ne(r2, null); 11261 r2 = self->f->setS(self, "b", "qwe"); 11262 ck_assert_ptr_ne(r2, null); 11263 createAllocateSmallInt(I); 11264 setValG(I, 11); 11265 I->type = "anothertype"; 11266 r2 = self->f->set(self, "B", (baset*)I); 11267 ck_assert_ptr_ne(r2, null); 11268 r = cropElemSmallStringSmallDictG(self, "b"); 11269 ck_assert_ptr_ne(r, null); 11270 char *s = toStringO(r); 11271 terminateO(r); 11272 ck_assert_str_eq(s, "qwe"); 11273 free(s); 11274 s = toStringO(self); 11275 ck_assert_str_eq(s, "{\"1\":1,\"2\":2.200000e+00,\"B\":\"<data container>\"}"); 11276 free(s); 11277 terminateO(self); 11278 11279 } 11280 11281 11282 void cropElemVoidSmallDictGT(CuTest *tc UNUSED) { 11283 11284 void* r; 11285 smallDictt *self = allocG(rtSmallDictt); 11286 smallDictt *r2; 11287 11288 r2 = self->f->setInt(self, "1", 1); 11289 ck_assert_ptr_ne(r2, null); 11290 r2 = self->f->setDouble(self, "2", 2.2); 11291 ck_assert_ptr_ne(r2, null); 11292 smallContainert *c = allocSmallContainer(&r); 11293 r2 = self->f->setNFreeSmallContainer(self, "b", c); 11294 ck_assert_ptr_ne(r2, null); 11295 createAllocateSmallInt(I); 11296 setValG(I, 11); 11297 I->type = "anothertype"; 11298 r2 = self->f->set(self, "B", (baset*)I); 11299 ck_assert_ptr_ne(r2, null); 11300 r = cropElemVoidSmallDictG(self, "b"); 11301 ck_assert_ptr_eq(r, &r); 11302 char *s = toStringO(self); 11303 ck_assert_str_eq(s, "{\"1\":1,\"2\":2.200000e+00,\"B\":\"<data container>\"}"); 11304 free(s); 11305 terminateO(self); 11306 11307 } 11308 11309 11310 void cropElemSmallContainerSmallDictGT(CuTest *tc UNUSED) { 11311 11312 smallContainert* r; 11313 smallDictt *self = allocG(rtSmallDictt); 11314 smallDictt *r2; 11315 11316 r2 = self->f->setInt(self, "1", 1); 11317 ck_assert_ptr_ne(r2, null); 11318 r2 = self->f->setDouble(self, "2", 2.2); 11319 ck_assert_ptr_ne(r2, null); 11320 smallContainert *c = allocSmallContainer(&r); 11321 r2 = self->f->setNFreeSmallContainer(self, "b", c); 11322 ck_assert_ptr_ne(r2, null); 11323 createAllocateSmallInt(I); 11324 setValG(I, 11); 11325 I->type = "anothertype"; 11326 r2 = self->f->set(self, "B", (baset*)I); 11327 ck_assert_ptr_ne(r2, null); 11328 r = cropElemSmallContainerSmallDictG(self, "b"); 11329 ck_assert_ptr_ne(r, null); 11330 char *s = toStringO(r); 11331 terminateO(r); 11332 ck_assert_str_eq(s, "<data smallContainer>"); 11333 free(s); 11334 s = toStringO(self); 11335 ck_assert_str_eq(s, "{\"1\":1,\"2\":2.200000e+00,\"B\":\"<data container>\"}"); 11336 free(s); 11337 terminateO(self); 11338 11339 } 11340 11341 11342 void delSmallDictGT(CuTest *tc UNUSED) { 11343 11344 smallDictt* r; 11345 smallDictt *self = allocG(rtSmallDictt); 11346 11347 r = self->f->setInt(self, "1", 1); 11348 ck_assert_ptr_ne(r, null); 11349 r = self->f->setDouble(self, "2", 2.2); 11350 ck_assert_ptr_ne(r, null); 11351 r = delSmallDictG(self, "2", 0); 11352 ck_assert_ptr_ne(r, null); 11353 char *s = toStringO(r); 11354 ck_assert_str_eq(s, "{\"1\":1}"); 11355 free(s); 11356 terminateO(self); 11357 11358 } 11359 11360 11361 void delKCharSmallDictGT(CuTest *tc UNUSED) { 11362 11363 smallDictt* r; 11364 smallDictt *self = allocG(rtSmallDictt); 11365 11366 r = self->f->setInt(self, "1", 1); 11367 ck_assert_ptr_ne(r, null); 11368 r = self->f->setDouble(self, "2", 2.2); 11369 ck_assert_ptr_ne(r, null); 11370 r = delKCharSmallDictG(self, '2', 0); 11371 ck_assert_ptr_ne(r, null); 11372 char *s = toStringO(r); 11373 ck_assert_str_eq(s, "{\"1\":1}"); 11374 free(s); 11375 terminateO(self); 11376 11377 } 11378 11379 11380 void delElemSmallDictGT(CuTest *tc UNUSED) { 11381 11382 smallDictt* r; 11383 smallDictt *self = allocG(rtSmallDictt); 11384 11385 r = self->f->setInt(self, "1", 1); 11386 ck_assert_ptr_ne(r, null); 11387 r = self->f->setDouble(self, "2", 2.2); 11388 ck_assert_ptr_ne(r, null); 11389 r = delElemSmallDictG(self, "2"); 11390 ck_assert_ptr_ne(r, null); 11391 char *s = toStringO(r); 11392 ck_assert_str_eq(s, "{\"1\":1}"); 11393 free(s); 11394 terminateO(self); 11395 11396 } 11397 11398 11399 void delElemKCharSmallDictGT(CuTest *tc UNUSED) { 11400 11401 smallDictt* r; 11402 smallDictt *self = allocG(rtSmallDictt); 11403 11404 r = self->f->setInt(self, "1", 1); 11405 ck_assert_ptr_ne(r, null); 11406 r = self->f->setDouble(self, "2", 2.2); 11407 ck_assert_ptr_ne(r, null); 11408 r = delElemKCharSmallDictG(self, '2'); 11409 ck_assert_ptr_ne(r, null); 11410 char *s = toStringO(r); 11411 ck_assert_str_eq(s, "{\"1\":1}"); 11412 free(s); 11413 terminateO(self); 11414 11415 } 11416 11417 11418 void removeSmallDictGT(CuTest *tc UNUSED) { 11419 11420 smallDictt* r; 11421 smallDictt *self = allocG(rtSmallDictt); 11422 11423 smallIntt *i = allocSmallInt(1); 11424 r = self->f->setSmallInt(self, "1", i); 11425 ck_assert_ptr_ne(r, null); 11426 r = removeSmallDictG(self, "1", 0); 11427 ck_assert_ptr_ne(r, null); 11428 terminateO(i); 11429 char *s = toStringO(r); 11430 ck_assert_str_eq(s, "{}"); 11431 free(s); 11432 terminateO(self); 11433 11434 } 11435 11436 11437 void removeKCharSmallDictGT(CuTest *tc UNUSED) { 11438 11439 smallDictt* r; 11440 smallDictt *self = allocG(rtSmallDictt); 11441 11442 smallIntt *i = allocSmallInt(1); 11443 r = self->f->setSmallInt(self, "1", i); 11444 ck_assert_ptr_ne(r, null); 11445 r = removeKCharSmallDictG(self, '1', 0); 11446 ck_assert_ptr_ne(r, null); 11447 terminateO(i); 11448 char *s = toStringO(r); 11449 ck_assert_str_eq(s, "{}"); 11450 free(s); 11451 terminateO(self); 11452 11453 } 11454 11455 11456 void removeElemSmallDictGT(CuTest *tc UNUSED) { 11457 11458 smallDictt* r; 11459 smallDictt *self = allocG(rtSmallDictt); 11460 11461 smallIntt *i = allocSmallInt(1); 11462 r = self->f->setSmallInt(self, "1", i); 11463 ck_assert_ptr_ne(r, null); 11464 r = removeElemSmallDictG(self, "1"); 11465 ck_assert_ptr_ne(r, null); 11466 terminateO(i); 11467 char *s = toStringO(r); 11468 ck_assert_str_eq(s, "{}"); 11469 free(s); 11470 terminateO(self); 11471 11472 } 11473 11474 11475 void removeElemKCharSmallDictGT(CuTest *tc UNUSED) { 11476 11477 smallDictt* r; 11478 smallDictt *self = allocG(rtSmallDictt); 11479 11480 smallIntt *i = allocSmallInt(1); 11481 r = self->f->setSmallInt(self, "1", i); 11482 ck_assert_ptr_ne(r, null); 11483 r = removeElemKCharSmallDictG(self, '1'); 11484 ck_assert_ptr_ne(r, null); 11485 terminateO(i); 11486 char *s = toStringO(r); 11487 ck_assert_str_eq(s, "{}"); 11488 free(s); 11489 terminateO(self); 11490 11491 } 11492 11493 11494 void hasSmallDictGT(CuTest *tc UNUSED) { 11495 11496 smallDictt *self = allocG(rtSmallDictt); 11497 11498 smallDictt *r2 = self->f->setInt(self, "1", 1); 11499 ck_assert_ptr_ne(r2, null); 11500 ck_assert(hasSmallDictG(self, "1")); 11501 terminateO(self); 11502 11503 } 11504 11505 11506 void hasKCharSmallDictGT(CuTest *tc UNUSED) { 11507 11508 smallDictt *self = allocG(rtSmallDictt); 11509 11510 smallDictt *r2 = self->f->setInt(self, "1", 1); 11511 ck_assert_ptr_ne(r2, null); 11512 ck_assert(hasKCharSmallDictG(self, '1')); 11513 terminateO(self); 11514 11515 } 11516 11517 11518 void keyBySmallDictGT(CuTest *tc UNUSED) { 11519 11520 char* r; 11521 smallDictt *self = allocG(rtSmallDictt); 11522 baset *value; 11523 11524 smallDictt *r2 = self->f->setInt(self, "1", 1); 11525 ck_assert_ptr_ne(r2, null); 11526 value = (baset*) allocSmallInt(1); 11527 r = keyBySmallDictG(self, value); 11528 ck_assert_str_eq(r, "1"); 11529 terminateO(value); 11530 terminateO(self); 11531 11532 } 11533 11534 11535 void keyByUndefinedSmallDictGT(CuTest *tc UNUSED) { 11536 11537 char* r; 11538 smallDictt *self = allocG(rtSmallDictt); 11539 undefinedt *value; 11540 11541 smallDictt *r2 = self->f->setUndefined(self, "1"); 11542 ck_assert_ptr_ne(r2, null); 11543 value = allocUndefined(); 11544 r = keyByUndefinedSmallDictG(self, value); 11545 ck_assert_str_eq(r, "1"); 11546 terminateO(value); 11547 terminateO(self); 11548 11549 } 11550 11551 11552 void keyByBoolSmallDictGT(CuTest *tc UNUSED) { 11553 11554 char* r; 11555 smallDictt *self = allocG(rtSmallDictt); 11556 11557 smallDictt *r2 = self->f->setBool(self, "1", true); 11558 ck_assert_ptr_ne(r2, null); 11559 r = keyByBoolSmallDictG(self, true); 11560 ck_assert_str_eq(r, "1"); 11561 terminateO(self); 11562 11563 } 11564 11565 11566 void keyByDoubleSmallDictGT(CuTest *tc UNUSED) { 11567 11568 char* r; 11569 smallDictt *self = allocG(rtSmallDictt); 11570 11571 smallDictt *r2 = self->f->setDouble(self, "1", 2.2); 11572 ck_assert_ptr_ne(r2, null); 11573 r = keyByDoubleSmallDictG(self, 2.2); 11574 ck_assert_str_eq(r, "1"); 11575 terminateO(self); 11576 11577 } 11578 11579 11580 void keyByIntSmallDictGT(CuTest *tc UNUSED) { 11581 11582 char* r; 11583 smallDictt *self = allocG(rtSmallDictt); 11584 11585 smallDictt *r2 = self->f->setInt(self, "1", 2); 11586 ck_assert_ptr_ne(r2, null); 11587 r = keyByIntSmallDictG(self, 2); 11588 ck_assert_str_eq(r, "1"); 11589 terminateO(self); 11590 11591 } 11592 11593 11594 void keyBySSmallDictGT(CuTest *tc UNUSED) { 11595 11596 char* r; 11597 smallDictt *self = allocG(rtSmallDictt); 11598 11599 smallDictt *r2 = self->f->setS(self, "1", "qwe"); 11600 ck_assert_ptr_ne(r2, null); 11601 r = keyBySSmallDictG(self, "qwe"); 11602 ck_assert_str_eq(r, "1"); 11603 terminateO(self); 11604 11605 } 11606 11607 11608 void keyByCharSmallDictGT(CuTest *tc UNUSED) { 11609 11610 char* r; 11611 smallDictt *self = allocG(rtSmallDictt); 11612 11613 smallDictt *r2 = self->f->setS(self, "1", "q"); 11614 ck_assert_ptr_ne(r2, null); 11615 r = keyByCharSmallDictG(self, 'q'); 11616 ck_assert_str_eq(r, "1"); 11617 terminateO(self); 11618 11619 } 11620 11621 11622 void keyByDictSmallDictGT(CuTest *tc UNUSED) { 11623 11624 char* r; 11625 smallDictt *self = allocG(rtSmallDictt); 11626 smallDictt *dict = allocSmallDict(); 11627 11628 createAllocateSmallDict(d); 11629 d->f->setS(d, "another", "dict"); 11630 smallDictt *r2 = self->f->setNFreeDict(self, "d", d); 11631 ck_assert_ptr_ne(r2, null); 11632 r2 = self->f->setNFreeDict(self, "1", dict); 11633 ck_assert_ptr_ne(r2, null); 11634 dict = allocSmallDict(); 11635 r = keyByDictSmallDictG(self, dict); 11636 ck_assert_str_eq(r, "1"); 11637 terminateO(dict); 11638 terminateO(self); 11639 11640 } 11641 11642 11643 void keyByArraySmallDictGT(CuTest *tc UNUSED) { 11644 11645 char* r; 11646 smallDictt *self = allocG(rtSmallDictt); 11647 smallArrayt *array = allocSmallArray(); 11648 11649 createAllocateSmallArray(d); 11650 d->f->pushS(d, "another array"); 11651 smallDictt *r2 = self->f->setNFreeArray(self, "d", d); 11652 ck_assert_ptr_ne(r2, null); 11653 r2 = self->f->setNFreeArray(self, "1", array); 11654 ck_assert_ptr_ne(r2, null); 11655 array = allocSmallArray(); 11656 r = keyByArraySmallDictG(self, array); 11657 ck_assert_str_eq(r, "1"); 11658 terminateO(array); 11659 terminateO(self); 11660 11661 } 11662 11663 11664 void keyByArraycSmallDictGT(CuTest *tc UNUSED) { 11665 11666 char* r; 11667 smallDictt *self = allocG(rtSmallDictt); 11668 char **array = listCreateS("a","b"); 11669 11670 char **d = listCreateS("asd", "zxcv"); 11671 smallDictt *r2 = self->f->setNFreeArrayc(self, "d", d); 11672 ck_assert_ptr_ne(r2, null); 11673 r2 = self->f->setArrayc(self, "1", array); 11674 ck_assert_ptr_ne(r2, null); 11675 r = keyByArraycSmallDictG(self, array); 11676 ck_assert_ptr_ne(r, NULL); 11677 ck_assert_str_eq(r, "1"); 11678 listFreeS(array); 11679 terminateO(self); 11680 11681 } 11682 11683 11684 void keyByCArraycSmallDictGT(CuTest *tc UNUSED) { 11685 11686 char* r; 11687 smallDictt *self = allocG(rtSmallDictt); 11688 char **array = listCreateS("a","b"); 11689 const char *a[] = {"a", "b", null}; 11690 11691 char **d = listCreateS("asd", "zxcv"); 11692 smallDictt *r2 = self->f->setNFreeArrayc(self, "d", d); 11693 ck_assert_ptr_ne(r2, null); 11694 r2 = self->f->setArrayc(self, "1", array); 11695 ck_assert_ptr_ne(r2, null); 11696 r = keyByCArraycSmallDictG(self, a); 11697 ck_assert_ptr_ne(r, NULL); 11698 ck_assert_str_eq(r, "1"); 11699 listFreeS(array); 11700 terminateO(self); 11701 11702 } 11703 11704 11705 void keyBySmallBoolSmallDictGT(CuTest *tc UNUSED) { 11706 11707 char* r; 11708 smallDictt *self = allocG(rtSmallDictt); 11709 smallBoolt *value = allocSmallBool(true); 11710 11711 createAllocateSmallBool(d); 11712 setValO(d, false); 11713 smallDictt *r2 = self->f->setNFreeSmallBool(self, "d", d); 11714 ck_assert_ptr_ne(r2, null); 11715 r2 = self->f->setNFreeSmallBool(self, "1", value); 11716 ck_assert_ptr_ne(r2, null); 11717 value = allocSmallBool(true); 11718 r = keyBySmallBoolSmallDictG(self, value); 11719 ck_assert_str_eq(r, "1"); 11720 terminateO(value); 11721 terminateO(self); 11722 11723 } 11724 11725 11726 void keyBySmallBytesSmallDictGT(CuTest *tc UNUSED) { 11727 11728 char* r; 11729 smallDictt *self = allocG(rtSmallDictt); 11730 smallBytest *value = allocSmallBytes("qwe", sizeof("qwe")); 11731 11732 smallBytest *d = allocSmallBytes("asd", sizeof("asd")); 11733 smallDictt *r2 = self->f->setNFreeSmallBytes(self, "d", d); 11734 ck_assert_ptr_ne(r2, null); 11735 r2 = self->f->setNFreeSmallBytes(self, "1", value); 11736 ck_assert_ptr_ne(r2, null); 11737 value = allocSmallBytes("qwe", sizeof("qwe")); 11738 r = keyBySmallBytesSmallDictG(self, value); 11739 ck_assert_str_eq(r, "1"); 11740 terminateO(value); 11741 terminateO(self); 11742 11743 } 11744 11745 11746 void keyBySmallDoubleSmallDictGT(CuTest *tc UNUSED) { 11747 11748 char* r; 11749 smallDictt *self = allocG(rtSmallDictt); 11750 smallDoublet *value = allocSmallDouble(2.2); 11751 11752 createAllocateSmallDouble(d); 11753 smallDictt *r2 = self->f->setNFreeSmallDouble(self, "d", d); 11754 ck_assert_ptr_ne(r2, null); 11755 r2 = self->f->setNFreeSmallDouble(self, "1", value); 11756 ck_assert_ptr_ne(r2, null); 11757 value = allocSmallDouble(2.2); 11758 r = keyBySmallDoubleSmallDictG(self, value); 11759 ck_assert_str_eq(r, "1"); 11760 terminateO(value); 11761 terminateO(self); 11762 11763 } 11764 11765 11766 void keyBySmallIntSmallDictGT(CuTest *tc UNUSED) { 11767 11768 char* r; 11769 smallDictt *self = allocG(rtSmallDictt); 11770 smallIntt *value = allocSmallInt(2); 11771 11772 createAllocateSmallInt(d); 11773 smallDictt *r2 = self->f->setNFreeSmallInt(self, "d", d); 11774 ck_assert_ptr_ne(r2, null); 11775 r2 = self->f->setNFreeSmallInt(self, "1", value); 11776 ck_assert_ptr_ne(r2, null); 11777 value = allocSmallInt(2); 11778 r = keyBySmallIntSmallDictG(self, value); 11779 ck_assert_str_eq(r, "1"); 11780 terminateO(value); 11781 terminateO(self); 11782 11783 } 11784 11785 11786 void keyBySmallJsonSmallDictGT(CuTest *tc UNUSED) { 11787 11788 char* r; 11789 smallDictt *self = allocG(rtSmallDictt); 11790 smallJsont *value = allocSmallJson(); 11791 11792 createUndefined(u); 11793 setTopO(value, (baset*)&u); 11794 self->f->setUndefined(self, "1"); 11795 r = keyBySmallJsonSmallDictG(self, value); 11796 ck_assert_str_eq(r, "1"); 11797 terminateO(value); 11798 terminateO(self); 11799 11800 } 11801 11802 11803 void keyBySmallStringSmallDictGT(CuTest *tc UNUSED) { 11804 11805 char* r; 11806 smallDictt *self = allocG(rtSmallDictt); 11807 smallStringt *value = allocSmallString("qwe"); 11808 11809 createAllocateSmallString(d); 11810 smallDictt *r2 = self->f->setNFreeSmallString(self, "d", d); 11811 ck_assert_ptr_ne(r2, null); 11812 r2 = self->f->setNFreeSmallString(self, "1", value); 11813 ck_assert_ptr_ne(r2, null); 11814 value = allocSmallString("qwe"); 11815 r = keyBySmallStringSmallDictG(self, value); 11816 ck_assert_str_eq(r, "1"); 11817 terminateO(value); 11818 terminateO(self); 11819 11820 } 11821 11822 11823 void keyBySmallContainerSmallDictGT(CuTest *tc UNUSED) { 11824 11825 char* r; 11826 smallDictt *self = allocG(rtSmallDictt); 11827 smallContainert *value = allocSmallContainer(null); 11828 11829 createAllocateSmallString(d); 11830 smallDictt *r2 = self->f->setNFreeSmallString(self, "d", d); 11831 ck_assert_ptr_ne(r2, null); 11832 r = keyBySmallContainerSmallDictG(self, value); 11833 ck_assert_ptr_eq(r, null); 11834 terminateO(value); 11835 terminateO(self); 11836 11837 } 11838 11839 11840 void icKeyBySmallDictGT(CuTest *tc UNUSED) { 11841 11842 char* r; 11843 smallDictt *self = allocG(rtSmallDictt); 11844 baset *value; 11845 11846 smallDictt *r2 = self->f->setS(self, "1", "QQ"); 11847 ck_assert_ptr_ne(r2, null); 11848 value = (baset*) allocSmallString("qq"); 11849 r = icKeyBySmallDictG(self, value); 11850 ck_assert_str_eq(r, "1"); 11851 terminateO(value); 11852 terminateO(self); 11853 11854 } 11855 11856 11857 void icKeyBySSmallDictGT(CuTest *tc UNUSED) { 11858 11859 char* r; 11860 smallDictt *self = allocG(rtSmallDictt); 11861 11862 smallDictt *r2 = self->f->setS(self, "1", "qwe"); 11863 ck_assert_ptr_ne(r2, null); 11864 r = icKeyBySSmallDictG(self, "QWE"); 11865 ck_assert_str_eq(r, "1"); 11866 terminateO(self); 11867 11868 } 11869 11870 11871 void icKeyByCharSmallDictGT(CuTest *tc UNUSED) { 11872 11873 char* r; 11874 smallDictt *self = allocG(rtSmallDictt); 11875 11876 smallDictt *r2 = self->f->setS(self, "1", "q"); 11877 ck_assert_ptr_ne(r2, null); 11878 r = icKeyByCharSmallDictG(self, 'Q'); 11879 ck_assert_str_eq(r, "1"); 11880 terminateO(self); 11881 11882 } 11883 11884 11885 void icKeyByDictSmallDictGT(CuTest *tc UNUSED) { 11886 11887 char* r; 11888 smallDictt *self = allocG(rtSmallDictt); 11889 smallDictt *dict = allocSmallDict(); 11890 11891 createAllocateSmallDict(d); 11892 d->f->setS(d, "another", "dict"); 11893 smallDictt *r2 = self->f->setNFreeDict(self, "d", d); 11894 ck_assert_ptr_ne(r2, null); 11895 dict->f->setS(dict, "asd", "asd"); 11896 r2 = self->f->setNFreeDict(self, "1", dict); 11897 ck_assert_ptr_ne(r2, null); 11898 dict = allocSmallDict(); 11899 dict->f->setS(dict, "ASD", "asd"); 11900 r = icKeyByDictSmallDictG(self, dict); 11901 ck_assert_str_eq(r, "1"); 11902 terminateO(dict); 11903 terminateO(self); 11904 11905 } 11906 11907 11908 void icKeyByArraySmallDictGT(CuTest *tc UNUSED) { 11909 11910 char* r; 11911 smallDictt *self = allocG(rtSmallDictt); 11912 smallArrayt *array = allocSmallArray(); 11913 11914 createAllocateSmallArray(d); 11915 d->f->pushS(d, "another array"); 11916 smallDictt *r2 = self->f->setNFreeArray(self, "d", d); 11917 ck_assert_ptr_ne(r2, null); 11918 array->f->pushS(array, "the array"); 11919 r2 = self->f->setNFreeArray(self, "1", array); 11920 ck_assert_ptr_ne(r2, null); 11921 array = allocSmallArray(); 11922 array->f->pushS(array, "The array"); 11923 r = icKeyByArraySmallDictG(self, array); 11924 ck_assert_str_eq(r, "1"); 11925 terminateO(array); 11926 terminateO(self); 11927 11928 } 11929 11930 11931 void icKeyByArraycSmallDictGT(CuTest *tc UNUSED) { 11932 11933 char* r; 11934 smallDictt *self = allocG(rtSmallDictt); 11935 char **array = listCreateS("a","b"); 11936 11937 char **d = listCreateS("asd", "zxcv"); 11938 smallDictt *r2 = self->f->setNFreeArrayc(self, "d", d); 11939 ck_assert_ptr_ne(r2, null); 11940 r2 = self->f->setArrayc(self, "1", array); 11941 ck_assert_ptr_ne(r2, null); 11942 iUpperS(&array[0]); 11943 r = icKeyByArraycSmallDictG(self, array); 11944 ck_assert_ptr_ne(r, NULL); 11945 ck_assert_str_eq(r, "1"); 11946 listFreeS(array); 11947 terminateO(self); 11948 11949 } 11950 11951 11952 void icKeyByCArraycSmallDictGT(CuTest *tc UNUSED) { 11953 11954 char* r; 11955 smallDictt *self = allocG(rtSmallDictt); 11956 const char *a2[] = {"a","b",null}; 11957 char **array = listCreateS("a","b"); 11958 11959 char **d = listCreateS("asd", "zxcv"); 11960 smallDictt *r2 = self->f->setNFreeArrayc(self, "d", d); 11961 ck_assert_ptr_ne(r2, null); 11962 r2 = self->f->setArrayc(self, "1", array); 11963 ck_assert_ptr_ne(r2, null); 11964 iUpperS(&array[0]); 11965 r = icKeyByCArraycSmallDictG(self, a2); 11966 ck_assert_ptr_ne(r, NULL); 11967 ck_assert_str_eq(r, "1"); 11968 listFreeS(array); 11969 terminateO(self); 11970 11971 } 11972 11973 11974 void icKeyBySmallJsonSmallDictGT(CuTest *tc UNUSED) { 11975 11976 char* r; 11977 smallDictt *self = allocG(rtSmallDictt); 11978 smallJsont *value = allocSmallJson(); 11979 11980 //r = icKeyBySmallJsonSmallDictG(self); 11981 createUndefined(u); 11982 setTopO(value, (baset*)&u); 11983 self->f->setUndefined(self, "1"); 11984 r = icKeyBySmallJsonSmallDictG(self, value); 11985 ck_assert_str_eq(r, "1"); 11986 terminateO(value); 11987 terminateO(self); 11988 11989 } 11990 11991 11992 void icKeyBySmallStringSmallDictGT(CuTest *tc UNUSED) { 11993 11994 char* r; 11995 smallDictt *self = allocG(rtSmallDictt); 11996 smallStringt *value = allocSmallString("qwe"); 11997 11998 createAllocateSmallString(d); 11999 smallDictt *r2 = self->f->setNFreeSmallString(self, "d", d); 12000 ck_assert_ptr_ne(r2, null); 12001 r2 = self->f->setNFreeSmallString(self, "1", value); 12002 ck_assert_ptr_ne(r2, null); 12003 value = allocSmallString("QWE"); 12004 r = icKeyBySmallStringSmallDictG(self, value); 12005 ck_assert_str_eq(r, "1"); 12006 terminateO(value); 12007 terminateO(self); 12008 12009 } 12010 12011 12012 void trimSmallDictGT(CuTest *tc UNUSED) { 12013 12014 smallDictt* r; 12015 smallDictt *self = allocG(rtSmallDictt); 12016 12017 self->f->setS(self, "1", "2"); 12018 self->f->setS(self, "3", "4"); 12019 self->f->del(self, "3"); 12020 r = trimSmallDictG(self); 12021 ck_assert_ptr_ne(r, null); 12022 ck_assert_int_eq(lenO(self), 1); 12023 char *s = toStringO(r); 12024 ck_assert_str_eq(s, "{\"1\":\"2\"}"); 12025 free(s); 12026 terminateO(self); 12027 12028 } 12029 12030 12031 void keysSmallStringSmallDictGT(CuTest *tc UNUSED) { 12032 12033 smallArrayt* r; 12034 smallDictt *self = allocG(rtSmallDictt); 12035 12036 self->f->setS(self, "1", "2"); 12037 self->f->setS(self, "3", "4"); 12038 r = keysSmallStringSmallDictG(self); 12039 ck_assert_ptr_ne(r, null); 12040 char *s = toStringO(r); 12041 ck_assert_str_eq(s, "[\"1\",\"3\"]"); 12042 free(s); 12043 terminateO(r); 12044 terminateO(self); 12045 12046 } 12047 12048 12049 void lenSmallDictGT(CuTest *tc UNUSED) { 12050 12051 size_t r; 12052 smallDictt *self = allocG(rtSmallDictt); 12053 12054 self->f->setS(self, "1", "2"); 12055 self->f->setS(self, "3", "4"); 12056 r = lenSmallDictG(self); 12057 ck_assert_int_eq(r, 2); 12058 terminateO(self); 12059 12060 } 12061 12062 12063 void emptySmallDictGT(CuTest *tc UNUSED) { 12064 12065 smallDictt* r; 12066 smallDictt *self = allocG(rtSmallDictt); 12067 12068 self->f->setS(self, "1", "2"); 12069 self->f->setS(self, "3", "4"); 12070 r = emptySmallDictG(self); 12071 ck_assert_ptr_ne(r, null); 12072 ck_assert_int_eq(lenO(self), 0); 12073 terminateO(self); 12074 12075 } 12076 12077 12078 void isEmptySmallDictGT(CuTest *tc UNUSED) { 12079 12080 bool r; 12081 smallDictt *self = allocG(rtSmallDictt); 12082 12083 r = isEmptySmallDictG(self); 12084 ck_assert(r); 12085 terminateO(self); 12086 12087 } 12088 12089 12090 void zipSmallDictGT(CuTest *tc UNUSED) { 12091 12092 smallDictt* r; 12093 smallDictt *self = allocG(rtSmallDictt); 12094 smallArrayt *keys = allocSmallArray(); 12095 smallArrayt *values = allocSmallArray(); 12096 12097 self->f->setInt(self, "", 1); 12098 // 3 elements in keys 12099 // 2 elements in values 12100 // only 2 key/values are zipped 12101 keys->f->pushS(keys, "a"); 12102 keys->f->pushS(keys, "b"); 12103 keys->f->pushS(keys, "c"); 12104 values->f->pushInt(values, 1); 12105 values->f->pushInt(values, 2); 12106 r = zipSmallDictG(self, keys, values); 12107 terminateO(keys); 12108 smashO(values); 12109 ck_assert_ptr_ne(r, NULL); 12110 char *s = toStringO(r); 12111 ck_assert_str_eq(s, "{\"\":1,\"a\":1,\"b\":2}"); 12112 free(s); 12113 terminateO(self); 12114 12115 } 12116 12117 12118 void zipSmallJsonSmallDictGT(CuTest *tc UNUSED) { 12119 12120 smallDictt* r; 12121 smallDictt *self = allocG(rtSmallDictt); 12122 smallArrayt *keys = allocSmallArray(); 12123 smallJsont *values = allocSmallJson(); 12124 12125 self->f->setInt(self, "", 1); 12126 // 3 elements in keys 12127 // 2 elements in values 12128 // only 2 key/values are zipped 12129 keys->f->pushS(keys, "a"); 12130 keys->f->pushS(keys, "b"); 12131 keys->f->pushS(keys, "c"); 12132 values->f->pushInt(values, 1); 12133 values->f->pushInt(values, 2); 12134 r = zipSmallJsonSmallDictG(self, keys, values); 12135 terminateO(keys); 12136 smashO(values); 12137 ck_assert_ptr_ne(r, NULL); 12138 char *s = toStringO(r); 12139 ck_assert_str_eq(s, "{\"\":1,\"a\":1,\"b\":2}"); 12140 free(s); 12141 terminateO(self); 12142 12143 } 12144 12145 12146 void zipSmallJsonSmallArraySmallDictGT(CuTest *tc UNUSED) { 12147 12148 smallDictt* r; 12149 smallDictt *self = allocG(rtSmallDictt); 12150 smallJsont *keys = allocSmallJson(); 12151 smallArrayt *values = allocSmallArray(); 12152 12153 self->f->setInt(self, "", 1); 12154 // 3 elements in keys 12155 // 2 elements in values 12156 // only 2 key/values are zipped 12157 keys->f->pushS(keys, "a"); 12158 keys->f->pushS(keys, "b"); 12159 keys->f->pushS(keys, "c"); 12160 values->f->pushInt(values, 1); 12161 values->f->pushInt(values, 2); 12162 r = zipSmallJsonSmallArraySmallDictG(self, keys, values); 12163 terminateO(keys); 12164 smashO(values); 12165 ck_assert_ptr_ne(r, NULL); 12166 char *s = toStringO(r); 12167 ck_assert_str_eq(s, "{\"\":1,\"a\":1,\"b\":2}"); 12168 free(s); 12169 terminateO(self); 12170 12171 } 12172 12173 12174 void zipSmallJsonSmallJsonSmallDictGT(CuTest *tc UNUSED) { 12175 12176 smallDictt* r; 12177 smallDictt *self = allocG(rtSmallDictt); 12178 smallJsont *keys = allocSmallJson(); 12179 smallJsont *values = allocSmallJson(); 12180 12181 self->f->setInt(self, "", 1); 12182 // 3 elements in keys 12183 // 2 elements in values 12184 // only 2 key/values are zipped 12185 keys->f->pushS(keys, "a"); 12186 keys->f->pushS(keys, "b"); 12187 keys->f->pushS(keys, "c"); 12188 values->f->pushInt(values, 1); 12189 values->f->pushInt(values, 2); 12190 r = zipSmallJsonSmallJsonSmallDictG(self, keys, values); 12191 terminateO(keys); 12192 smashO(values); 12193 ck_assert_ptr_ne(r, NULL); 12194 char *s = toStringO(r); 12195 ck_assert_str_eq(s, "{\"\":1,\"a\":1,\"b\":2}"); 12196 free(s); 12197 terminateO(self); 12198 12199 } 12200 12201 12202 void zipSmallJsonVArraySmallDictGT(CuTest *tc UNUSED) { 12203 12204 smallDictt* r; 12205 smallDictt *self = allocG(rtSmallDictt); 12206 smallJsont *keys = allocSmallJson(); 12207 char **values; 12208 12209 self->f->setInt(self, "", 1); 12210 // 3 elements in keys 12211 // 2 elements in values 12212 // only 2 key/values are zipped 12213 keys->f->pushS(keys, "a"); 12214 keys->f->pushS(keys, "b"); 12215 keys->f->pushS(keys, "c"); 12216 values = listCreateS("1", "2"); 12217 r = zipSmallJsonVArraySmallDictG(self, keys, values); 12218 terminateO(keys); 12219 listFreeS(values); 12220 ck_assert_ptr_ne(r, NULL); 12221 char *s = toStringO(r); 12222 ck_assert_str_eq(s, "{\"\":1,\"a\":\"1\",\"b\":\"2\"}"); 12223 free(s); 12224 terminateO(self); 12225 12226 } 12227 12228 12229 void zipSmallJsonVCArraySmallDictGT(CuTest *tc UNUSED) { 12230 12231 smallDictt* r; 12232 smallDictt *self = allocG(rtSmallDictt); 12233 smallJsont *keys = allocSmallJson(); 12234 const char *values[] = {"1","2",null}; 12235 12236 self->f->setInt(self, "", 1); 12237 // 3 elements in keys 12238 // 2 elements in values 12239 // only 2 key/values are zipped 12240 keys->f->pushS(keys, "a"); 12241 keys->f->pushS(keys, "b"); 12242 keys->f->pushS(keys, "c"); 12243 r = zipSmallJsonVCArraySmallDictG(self, keys, values); 12244 terminateO(keys); 12245 ck_assert_ptr_ne(r, NULL); 12246 char *s = toStringO(r); 12247 ck_assert_str_eq(s, "{\"\":1,\"a\":\"1\",\"b\":\"2\"}"); 12248 free(s); 12249 terminateO(self); 12250 12251 } 12252 12253 12254 void zipArraySmallDictGT(CuTest *tc UNUSED) { 12255 12256 smallDictt* r; 12257 smallDictt *self = allocG(rtSmallDictt); 12258 char** keys; 12259 smallArrayt *values = allocSmallArray(); 12260 12261 self->f->setInt(self, "", 1); 12262 // 3 elements in keys 12263 // 2 elements in values 12264 // only 2 key/values are zipped 12265 keys = listCreateS("a", "b", "c"); 12266 values->f->pushInt(values, 1); 12267 values->f->pushInt(values, 2); 12268 r = zipArraySmallDictG(self, keys, values); 12269 listFreeS(keys); 12270 smashO(values); 12271 ck_assert_ptr_ne(r, NULL); 12272 char *s = toStringO(r); 12273 ck_assert_str_eq(s, "{\"\":1,\"a\":1,\"b\":2}"); 12274 free(s); 12275 terminateO(self); 12276 12277 } 12278 12279 12280 void zipArraySmallJsonSmallDictGT(CuTest *tc UNUSED) { 12281 12282 smallDictt* r; 12283 smallDictt *self = allocG(rtSmallDictt); 12284 char** keys; 12285 smallJsont *values = allocSmallJson(); 12286 12287 self->f->setInt(self, "", 1); 12288 // 3 elements in keys 12289 // 2 elements in values 12290 // only 2 key/values are zipped 12291 keys = listCreateS("a", "b", "c"); 12292 values->f->pushInt(values, 1); 12293 values->f->pushInt(values, 2); 12294 r = zipArraySmallJsonSmallDictG(self, keys, values); 12295 listFreeS(keys); 12296 smashO(values); 12297 ck_assert_ptr_ne(r, NULL); 12298 char *s = toStringO(r); 12299 ck_assert_str_eq(s, "{\"\":1,\"a\":1,\"b\":2}"); 12300 free(s); 12301 terminateO(self); 12302 12303 } 12304 12305 12306 void zipCArraySmallDictGT(CuTest *tc UNUSED) { 12307 12308 smallDictt* r; 12309 smallDictt *self = allocG(rtSmallDictt); 12310 const char* keys[] = {"a","b","c",null}; 12311 smallArrayt *values = allocSmallArray(); 12312 12313 self->f->setInt(self, "", 1); 12314 // 3 elements in keys 12315 // 2 elements in values 12316 // only 2 key/values are zipped 12317 values->f->pushInt(values, 1); 12318 values->f->pushInt(values, 2); 12319 r = zipCArraySmallDictG(self, keys, values); 12320 smashO(values); 12321 ck_assert_ptr_ne(r, NULL); 12322 char *s = toStringO(r); 12323 ck_assert_str_eq(s, "{\"\":1,\"a\":1,\"b\":2}"); 12324 free(s); 12325 terminateO(self); 12326 12327 } 12328 12329 12330 void zipCArraySmallJsonSmallDictGT(CuTest *tc UNUSED) { 12331 12332 smallDictt* r; 12333 smallDictt *self = allocG(rtSmallDictt); 12334 const char* keys[] = {"a","b","c",null}; 12335 smallJsont *values = allocSmallJson(); 12336 12337 self->f->setInt(self, "", 1); 12338 // 3 elements in keys 12339 // 2 elements in values 12340 // only 2 key/values are zipped 12341 values->f->pushInt(values, 1); 12342 values->f->pushInt(values, 2); 12343 r = zipCArraySmallJsonSmallDictG(self, keys, values); 12344 smashO(values); 12345 ck_assert_ptr_ne(r, NULL); 12346 char *s = toStringO(r); 12347 ck_assert_str_eq(s, "{\"\":1,\"a\":1,\"b\":2}"); 12348 free(s); 12349 terminateO(self); 12350 12351 } 12352 12353 12354 void zipArrayArraySmallDictGT(CuTest *tc UNUSED) { 12355 12356 smallDictt* r; 12357 smallDictt *self = allocG(rtSmallDictt); 12358 char** keys; 12359 char** values; 12360 12361 self->f->setInt(self, "", 1); 12362 // 3 elements in keys 12363 // 2 elements in values 12364 // only 2 key/values are zipped 12365 keys = listCreateS("a", "b", "c"); 12366 values = listCreateS("1", "2"); 12367 r = zipArrayArraySmallDictG(self, keys, values); 12368 listFreeS(keys); 12369 listFreeS(values); 12370 ck_assert_ptr_ne(r, NULL); 12371 char *s = toStringO(r); 12372 ck_assert_str_eq(s, "{\"\":1,\"a\":\"1\",\"b\":\"2\"}"); 12373 free(s); 12374 terminateO(self); 12375 12376 } 12377 12378 12379 void zipCArrayArraySmallDictGT(CuTest *tc UNUSED) { 12380 12381 smallDictt* r; 12382 smallDictt *self = allocG(rtSmallDictt); 12383 const char* keys[] = {"a","b","c",null}; 12384 char** values; 12385 12386 //r = zipCArrayArraySmallDictG(self); 12387 self->f->setInt(self, "", 1); 12388 // 3 elements in keys 12389 // 2 elements in values 12390 // only 2 key/values are zipped 12391 values = listCreateS("1", "2"); 12392 r = zipCArrayArraySmallDictG(self, keys, values); 12393 listFreeS(values); 12394 ck_assert_ptr_ne(r, NULL); 12395 char *s = toStringO(r); 12396 ck_assert_str_eq(s, "{\"\":1,\"a\":\"1\",\"b\":\"2\"}"); 12397 free(s); 12398 terminateO(self); 12399 12400 } 12401 12402 12403 void zipArrayCArraySmallDictGT(CuTest *tc UNUSED) { 12404 12405 smallDictt* r; 12406 smallDictt *self = allocG(rtSmallDictt); 12407 char** keys; 12408 const char* values[] = {"1","2",null}; 12409 12410 self->f->setInt(self, "", 1); 12411 // 3 elements in keys 12412 // 2 elements in values 12413 // only 2 key/values are zipped 12414 keys = listCreateS("a", "b", "c"); 12415 r = zipArrayCArraySmallDictG(self, keys, values); 12416 listFreeS(keys); 12417 ck_assert_ptr_ne(r, NULL); 12418 char *s = toStringO(r); 12419 ck_assert_str_eq(s, "{\"\":1,\"a\":\"1\",\"b\":\"2\"}"); 12420 free(s); 12421 terminateO(self); 12422 12423 } 12424 12425 12426 void zipCArrayCArraySmallDictGT(CuTest *tc UNUSED) { 12427 12428 smallDictt* r; 12429 smallDictt *self = allocG(rtSmallDictt); 12430 const char* keys[] = {"a","b","c",null}; 12431 const char* values[] = {"1","2",null}; 12432 12433 self->f->setInt(self, "", 1); 12434 // 3 elements in keys 12435 // 2 elements in values 12436 // only 2 key/values are zipped 12437 r = zipCArrayCArraySmallDictG(self, keys, values); 12438 ck_assert_ptr_ne(r, NULL); 12439 char *s = toStringO(r); 12440 ck_assert_str_eq(s, "{\"\":1,\"a\":\"1\",\"b\":\"2\"}"); 12441 free(s); 12442 terminateO(self); 12443 12444 } 12445 12446 12447 void zipVArraySmallDictGT(CuTest *tc UNUSED) { 12448 12449 smallDictt* r; 12450 smallDictt *self = allocG(rtSmallDictt); 12451 smallArrayt *keys = allocSmallArray(); 12452 char** values; 12453 12454 self->f->setInt(self, "", 1); 12455 // 3 elements in keys 12456 // 2 elements in values 12457 // only 2 key/values are zipped 12458 keys->f->pushS(keys, "a"); 12459 keys->f->pushS(keys, "b"); 12460 keys->f->pushS(keys, "c"); 12461 values = listCreateS("1", "2"); 12462 r = zipVArraySmallDictG(self, keys, values); 12463 terminateO(keys); 12464 listFreeS(values); 12465 ck_assert_ptr_ne(r, NULL); 12466 char *s = toStringO(r); 12467 ck_assert_str_eq(s, "{\"\":1,\"a\":\"1\",\"b\":\"2\"}"); 12468 free(s); 12469 terminateO(self); 12470 12471 } 12472 12473 12474 void zipVCArraySmallDictGT(CuTest *tc UNUSED) { 12475 12476 smallDictt* r; 12477 smallDictt *self = allocG(rtSmallDictt); 12478 smallArrayt *keys = allocSmallArray(); 12479 const char* values[] = {"1","2",null}; 12480 12481 self->f->setInt(self, "", 1); 12482 // 3 elements in keys 12483 // 2 elements in values 12484 // only 2 key/values are zipped 12485 keys->f->pushS(keys, "a"); 12486 keys->f->pushS(keys, "b"); 12487 keys->f->pushS(keys, "c"); 12488 r = zipVCArraySmallDictG(self, keys, values); 12489 terminateO(keys); 12490 ck_assert_ptr_ne(r, NULL); 12491 char *s = toStringO(r); 12492 ck_assert_str_eq(s, "{\"\":1,\"a\":\"1\",\"b\":\"2\"}"); 12493 free(s); 12494 terminateO(self); 12495 12496 } 12497 12498 12499 void fromArraySmallDictGT(CuTest *tc UNUSED) { 12500 12501 smallDictt* r; 12502 smallDictt *self = allocG(rtSmallDictt); 12503 smallArrayt *items = allocSmallArray(); 12504 12505 self->f->setInt(self, "", 1); 12506 // ignored item 12507 items->f->pushS(items, "ignored"); 12508 createAllocateSmallArray(a); 12509 a->f->pushS(a, "a"); 12510 a->f->pushInt(a, 1); 12511 items->f->pushNFreeArray(items, a); 12512 a = allocSmallArray(); 12513 items->f->pushNFreeArray(items, a); 12514 a = allocSmallArray(); 12515 a->f->pushInt(a, 1); 12516 a->f->pushInt(a, 2); 12517 items->f->pushNFreeArray(items, a); 12518 r = fromArraySmallDictG(self, items); 12519 ck_assert_ptr_ne(r, NULL); 12520 char *s = toStringO(r); 12521 ck_assert_str_eq(s, "{\"\":1,\"a\":1}"); 12522 free(s); 12523 terminateO(items); 12524 terminateO(self); 12525 12526 } 12527 12528 12529 void toArraySmallDictGT(CuTest *tc UNUSED) { 12530 12531 smallArrayt* r; 12532 smallDictt *self = allocG(rtSmallDictt); 12533 12534 self->f->setInt(self, "", 1); 12535 self->f->setInt(self, "b", 2); 12536 self->f->setInt(self, "c", 3); 12537 self->f->del(self, ""); 12538 r = toArraySmallDictG(self); 12539 ck_assert_ptr_ne(r, NULL); 12540 char *s = toStringO(r); 12541 ck_assert_str_eq(s, "[[\"b\",2],[\"c\",3]]"); 12542 free(s); 12543 terminateO(r); 12544 smashO(self); 12545 12546 } 12547 12548 12549 void writeFileSmallDictGT(CuTest *tc UNUSED) { 12550 12551 bool r; 12552 smallDictt *self = allocG(rtSmallDictt); 12553 12554 self->f->setInt(self, "", 1); 12555 self->f->setInt(self, "b", 2); 12556 r = writeFileSmallDictG(self, "smallDictFile.json"); 12557 ck_assert(r); 12558 ck_assert(fileExists("smallDictFile.json")); 12559 char *s = readFileToS("smallDictFile.json"); 12560 ck_assert_str_eq(s, "{\"\":1,\"b\":2}"); 12561 free(s); 12562 rmAll("smallDictFile.json"); 12563 terminateO(self); 12564 12565 } 12566 12567 12568 void writeFileSmallJsonSmallDictGT(CuTest *tc UNUSED) { 12569 12570 bool r; 12571 smallDictt *self = allocG(rtSmallDictt); 12572 smallJsont *filePath = allocSmallJson(); 12573 12574 self->f->setInt(self, "", 1); 12575 self->f->setInt(self, "b", 2); 12576 setTopSO(filePath, "smallDictFile.json"); 12577 r = writeFileSmallJsonSmallDictG(self, filePath); 12578 ck_assert(r); 12579 ck_assert(fileExists("smallDictFile.json")); 12580 char *s = readFileToS("smallDictFile.json"); 12581 ck_assert_str_eq(s, "{\"\":1,\"b\":2}"); 12582 free(s); 12583 rmAll("smallDictFile.json"); 12584 terminateO(filePath); 12585 terminateO(self); 12586 12587 } 12588 12589 12590 void writeFileSmallStringSmallDictGT(CuTest *tc UNUSED) { 12591 12592 bool r; 12593 smallDictt *self = allocG(rtSmallDictt); 12594 smallStringt *filePath = allocSmallString("smallDictFile.json"); 12595 12596 self->f->setInt(self, "", 1); 12597 self->f->setInt(self, "b", 2); 12598 r = writeFileSmallStringSmallDictG(self, filePath); 12599 ck_assert(r); 12600 ck_assert(fileExists("smallDictFile.json")); 12601 char *s = readFileToS("smallDictFile.json"); 12602 ck_assert_str_eq(s, "{\"\":1,\"b\":2}"); 12603 free(s); 12604 rmAll("smallDictFile.json"); 12605 terminateO(filePath); 12606 terminateO(self); 12607 12608 } 12609 12610 12611 void writeStreamSmallDictGT(CuTest *tc UNUSED) { 12612 12613 bool r; 12614 smallDictt *self = allocG(rtSmallDictt); 12615 FILE *fp; 12616 12617 self->f->setInt(self, "", 1); 12618 self->f->setInt(self, "b", 2); 12619 fp = fopen("smallDictFile.json", "w"); 12620 r = writeStreamSmallDictG(self, fp); 12621 ck_assert(r); 12622 fclose(fp); 12623 ck_assert(fileExists("smallDictFile.json")); 12624 char *s = readFileToS("smallDictFile.json"); 12625 ck_assert_str_eq(s, "{\"\":1,\"b\":2}"); 12626 free(s); 12627 rmAll("smallDictFile.json"); 12628 terminateO(self); 12629 12630 } 12631 12632 12633 void appendFileSmallDictGT(CuTest *tc UNUSED) { 12634 12635 bool r; 12636 smallDictt *self = allocG(rtSmallDictt); 12637 12638 self->f->setInt(self, "", 1); 12639 self->f->setInt(self, "b", 2); 12640 writeFileS("smallDictFile.json", "-"); 12641 r = appendFileSmallDictG(self, "smallDictFile.json"); 12642 ck_assert(r); 12643 ck_assert(fileExists("smallDictFile.json")); 12644 char *s = readFileToS("smallDictFile.json"); 12645 ck_assert_str_eq(s, "-{\"\":1,\"b\":2}"); 12646 free(s); 12647 rmAll("smallDictFile.json"); 12648 terminateO(self); 12649 12650 } 12651 12652 12653 void appendFileSmallStringSmallDictGT(CuTest *tc UNUSED) { 12654 12655 bool r; 12656 smallDictt *self = allocG(rtSmallDictt); 12657 smallStringt *filePath = allocSmallString("smallDictFile.json"); 12658 12659 self->f->setInt(self, "", 1); 12660 self->f->setInt(self, "b", 2); 12661 writeFileS("smallDictFile.json", "-"); 12662 r = appendFileSmallStringSmallDictG(self, filePath); 12663 ck_assert(r); 12664 ck_assert(fileExists("smallDictFile.json")); 12665 char *s = readFileToS("smallDictFile.json"); 12666 ck_assert_str_eq(s, "-{\"\":1,\"b\":2}"); 12667 free(s); 12668 rmAll("smallDictFile.json"); 12669 terminateO(filePath); 12670 terminateO(self); 12671 12672 } 12673 12674 12675 void logSmallDictGT(CuTest *tc UNUSED) { 12676 12677 smallDictt *self = allocG(rtSmallDictt); 12678 12679 self->f->setInt(self, "", 1); 12680 self->f->setInt(self, "b", 2); 12681 logSmallDictG(self); 12682 terminateO(self); 12683 12684 } 12685 12686 12687 void typeSmallStringSmallDictGT(CuTest *tc UNUSED) { 12688 12689 smallStringt* r; 12690 smallDictt *self = allocG(rtSmallDictt); 12691 12692 self->f->setInt(self, "", 1); 12693 self->f->setInt(self, "b", 2); 12694 r = typeSmallStringSmallDictG(self, ""); 12695 ck_assert_str_eq(ssGet(r), "int"); 12696 terminateO(r); 12697 terminateO(self); 12698 12699 } 12700 12701 12702 void typeStringKCharSmallDictGT(CuTest *tc UNUSED) { 12703 12704 const char* r; 12705 smallDictt *self = allocG(rtSmallDictt); 12706 12707 self->f->setInt(self, "", 1); 12708 self->f->setInt(self, "b", 2); 12709 r = typeStringKCharSmallDictG(self, 'b'); 12710 ck_assert_str_eq(r, "int"); 12711 terminateO(self); 12712 12713 } 12714 12715 12716 void typeSmallStringKCharSmallDictGT(CuTest *tc UNUSED) { 12717 12718 smallStringt* r; 12719 smallDictt *self = allocG(rtSmallDictt); 12720 12721 self->f->setInt(self, "", 1); 12722 self->f->setInt(self, "b", 2); 12723 r = typeSmallStringKCharSmallDictG(self, 'b'); 12724 ck_assert_str_eq(ssGet(r), "int"); 12725 terminateO(r); 12726 terminateO(self); 12727 12728 } 12729 12730 12731 void cSmallDictT(CuTest *tc UNUSED) { 12732 12733 // local object 12734 createSmallDict(obj); 12735 ck_assert_str_eq(obj.type, "smallDict"); 12736 // object 12737 createAllocateSmallDict(obj2); 12738 ck_assert_str_eq(obj2->type, "smallDict"); 12739 // toString 12740 char *s = obj2->f->toString(obj2); 12741 ck_assert_str_eq(s, "{}"); 12742 free(s); 12743 // duplicate 12744 smallDictt *o; 12745 createAllocateSmallBool(oBool2); 12746 oBool2->f->set(oBool2, true); 12747 obj2->f->set(obj2, "lib", (baset *)oBool2); 12748 finishO(oBool2); 12749 o = obj2->f->duplicate(obj2); 12750 smallBoolt *oBool3; 12751 oBool3 = (smallBoolt *)o->f->get(o, "lib"); 12752 ck_assert_ptr_ne(oBool3, NULL); 12753 ck_assert(oBool3->value->value == true); 12754 finishO(oBool3); 12755 terminateO(o); 12756 // toString 12757 createAllocateUndefined(oU); 12758 obj2->f->set(obj2, "u", (baset *)oU); 12759 finishO(oU); 12760 createAllocateSmallString(oStr); 12761 oStr->f->set(oStr, "sheepy"); 12762 obj2->f->set(obj2, "str", (baset *)oStr); 12763 finishO(oStr); 12764 s = obj2->f->toString(obj2); 12765 ck_assert_str_eq(s, "{\"lib\":true,\"u\":null,\"str\":\"sheepy\"}"); 12766 free(s); 12767 // dispose 12768 o = obj2->f->duplicate(obj2); 12769 undefinedt *u = (undefinedt *) o->f->get(o, "u"); 12770 smallStringt *st = (smallStringt *) o->f->get(o, "str"); 12771 oBool2 = (smallBoolt *) o->f->get(o, "lib"); 12772 smallt *data = sDictGetTiny(o->d, "u"); 12773 sFree(data); 12774 data = sDictGetTiny(o->d, "str"); 12775 sFree(data); 12776 data = sDictGetTiny(o->d, "lib"); 12777 sFree(data); 12778 o->f->dispose(o); 12779 ck_assert_uint_eq(o->f->len(o), 0); 12780 terminateO(u); 12781 smashO(st); 12782 smashO(oBool2); 12783 terminateO(o); 12784 // smash 12785 o = obj2->f->duplicate(obj2); 12786 u = (undefinedt *) o->f->get(o, "u"); 12787 st = (smallStringt *) o->f->get(o, "str"); 12788 oBool2 = (smallBoolt *) o->f->get(o, "lib"); 12789 data = sDictGetTiny(o->d, "u"); 12790 sFree(data); 12791 data = sDictGetTiny(o->d, "str"); 12792 sFree(data); 12793 data = sDictGetTiny(o->d, "lib"); 12794 sFree(data); 12795 o->f->smash(&o); 12796 terminateO(u); 12797 smashO(st); 12798 smashO(oBool2); 12799 ck_assert_ptr_eq(o, NULL); 12800 // set NULL (not possible) 12801 obj2->f->set(obj2, NULL, NULL); 12802 obj2->f->set(obj2, "no", NULL); 12803 ck_assert_uint_eq(obj2->f->len(obj2), 3); 12804 // get non existing element 12805 oBool3 = (smallBoolt *)obj2->f->get(obj2, "non existing"); 12806 ck_assert_ptr_eq(oBool3, NULL); 12807 ck_assert_ptr_eq(obj2->f->get(obj2, NULL), NULL); 12808 // delete element 12809 smallDictt *r = obj2->f->del(obj2, "lib"); 12810 ck_assert_ptr_ne(r, null); 12811 oBool3 = (smallBoolt *)obj2->f->get(obj2, "lib"); 12812 ck_assert_ptr_eq(oBool3, NULL); 12813 // delete non existing element 12814 r = obj2->f->del(obj2, NULL); 12815 ck_assert_ptr_eq(r, null); 12816 r = obj2->f->del(obj2, "non existing"); 12817 ck_assert_ptr_ne(r, null); 12818 // has 12819 ck_assert(!obj2->f->has(obj2, "qwe")); 12820 ck_assert(!obj2->f->has(obj2, NULL)); 12821 ck_assert(obj2->f->has(obj2, "u")); 12822 // empty dict 12823 createAllocateSmallDict(D); 12824 freeO(D); 12825 ck_assert(!D->f->has(D, "d")); 12826 terminateO(D); 12827 // keys 12828 char **keys = obj2->f->keys(obj2); 12829 ck_assert_uint_eq(listLengthS(keys), 2); 12830 ck_assert_str_eq(keys[0], "u"); 12831 ck_assert_str_eq(keys[1], "str"); 12832 listFreeS(keys); 12833 // empty dict 12834 initiateAllocateSmallDict(&o); 12835 keys = o->f->keys(o); 12836 ck_assert_ptr_eq(keys, NULL); 12837 terminateO(o); 12838 // values 12839 smallArrayt *values = obj2->f->values(obj2); 12840 s = toStringO(values); 12841 ck_assert_str_eq(s, "[null,\"sheepy\"]"); 12842 free(s); 12843 values->f->smash(&values); 12844 // empty dict 12845 initiateAllocateSmallDict(&o); 12846 values = o->f->values(o); 12847 ck_assert_ptr_eq(values, NULL); 12848 terminateO(o); 12849 // merge 12850 smallDictt *oM; 12851 o = obj2->f->duplicate(obj2); 12852 initiateAllocateSmallDict(&oM); 12853 initiateAllocateSmallString(&st); 12854 st->f->set(st, "SHEEPY MERGED"); 12855 oM->f->set(oM, "str", (baset *) st); 12856 finishO(st); 12857 s = toStringO(o); 12858 ck_assert_str_eq(s, "{\"u\":null,\"str\":\"sheepy\"}"); 12859 free(s); 12860 o->f->merge(o, oM); 12861 s = toStringO(o); 12862 ck_assert_str_eq(s, "{\"u\":null,\"str\":\"SHEEPY MERGED\"}"); 12863 free(s); 12864 oM->f->smash(&oM); 12865 terminateO(o); 12866 // empty dict 12867 o = obj2->f->duplicate(obj2); 12868 initiateAllocateSmallDict(&oM); 12869 s = toStringO(o); 12870 ck_assert_str_eq(s, "{\"u\":null,\"str\":\"sheepy\"}"); 12871 free(s); 12872 o->f->merge(o, oM); 12873 s = toStringO(o); 12874 ck_assert_str_eq(s, "{\"u\":null,\"str\":\"sheepy\"}"); 12875 free(s); 12876 oM->f->smash(&oM); 12877 // non smallDict object 12878 createAllocateSmallInt(z); 12879 r = o->f->merge(o, (smallDictt*)z); 12880 ck_assert_ptr_eq(r, null); 12881 terminateO(z); 12882 terminateO(o); 12883 // NULL dict 12884 o = obj2->f->duplicate(obj2); 12885 s = toStringO(o); 12886 ck_assert_str_eq(s, "{\"u\":null,\"str\":\"sheepy\"}"); 12887 free(s); 12888 o->f->merge(o, NULL); 12889 s = toStringO(o); 12890 ck_assert_str_eq(s, "{\"u\":null,\"str\":\"sheepy\"}"); 12891 free(s); 12892 terminateO(o); 12893 // append 12894 o = obj2->f->duplicate(obj2); 12895 initiateAllocateSmallDict(&oM); 12896 initiateAllocateSmallString(&st); 12897 initiateAllocateUndefined(&oU); 12898 st->f->set(st, "SHEEPY MERGED"); 12899 oM->f->set(oM, "str", (baset *) st); 12900 finishO(st); 12901 oM->f->set(oM, "u2", (baset *) oU); 12902 finishO(oU); 12903 s = toStringO(o); 12904 ck_assert_str_eq(s, "{\"u\":null,\"str\":\"sheepy\"}"); 12905 free(s); 12906 o->f->append(o, oM); 12907 s = toStringO(o); 12908 ck_assert_str_eq(s, "{\"u\":null,\"str\":\"sheepy\",\"u2\":null}"); 12909 free(s); 12910 data = sDictGetTiny(oM->d, "str"); 12911 sFree(data); 12912 oM->f->smash(&oM); 12913 terminateO(o); 12914 // empty dict 12915 o = obj2->f->duplicate(obj2); 12916 initiateAllocateSmallDict(&oM); 12917 s = toStringO(o); 12918 ck_assert_str_eq(s, "{\"u\":null,\"str\":\"sheepy\"}"); 12919 free(s); 12920 o->f->append(o, oM); 12921 s = toStringO(o); 12922 ck_assert_str_eq(s, "{\"u\":null,\"str\":\"sheepy\"}"); 12923 free(s); 12924 oM->f->smash(&oM); 12925 // non smallDict object 12926 z = allocSmallInt(0); 12927 r = o->f->append(o, (smallDictt*)z); 12928 ck_assert_ptr_eq(r, null); 12929 terminateO(z); 12930 terminateO(o); 12931 // NULL dict 12932 o = obj2->f->duplicate(obj2); 12933 s = toStringO(o); 12934 ck_assert_str_eq(s, "{\"u\":null,\"str\":\"sheepy\"}"); 12935 free(s); 12936 o->f->append(o, NULL); 12937 s = toStringO(o); 12938 ck_assert_str_eq(s, "{\"u\":null,\"str\":\"sheepy\"}"); 12939 free(s); 12940 terminateO(o); 12941 // len 12942 ck_assert_uint_eq(obj2->f->len(obj2), 2); 12943 // empty dict 12944 initiateAllocateSmallDict(&o); 12945 ck_assert_uint_eq(o->f->len(o), 0); 12946 terminateO(o); 12947 // empty 12948 o = obj2->f->duplicate(obj2); 12949 o->f->empty(o); 12950 ck_assert_uint_eq(o->f->len(o), 0); 12951 terminateO(o); 12952 // typeString type typeStrings 12953 initiateAllocateSmallDict(&oM); 12954 o = allocSmallDict(); 12955 oU = allocUndefined(); 12956 o->f->set(o, "u", (baset *)oU); 12957 finishO(oU); 12958 st = allocSmallString("sheepy"); 12959 o->f->set(o, "str", (baset *) st); 12960 finishO(st); 12961 oBool2 = allocSmallBool(true); 12962 o->f->set(o, "b", (baset *)oBool2); 12963 finishO(oBool2); 12964 oBool2 = allocSmallBool(true); 12965 o->f->set(o, "B", (baset *)oBool2); 12966 finishO(oBool2); 12967 o->f->del(o, "B"); 12968 // typeString 12969 s = (char *)o->f->typeString(o, "b"); 12970 ck_assert_str_eq(s, "bool"); 12971 // non existing key 12972 ck_assert_ptr_eq(o->f->typeString(o, "B"), NULL); 12973 // empty object 12974 ck_assert_ptr_eq(oM->f->typeString(oM, "B"), NULL); 12975 // type 12976 char c; 12977 c = o->f->type(o, "str"); 12978 ck_assert_uint_eq(c, STRING); 12979 // non existing key 12980 ck_assert(!o->f->type(o, "B")); 12981 // empty object 12982 ck_assert(!oM->f->type(oM, "B")); 12983 // typeStrings 12984 smallDictt *oT = o->f->typeStrings(o); 12985 s = toStringO(oT); 12986 ck_assert_str_eq(s, "{\"u\":\"undefined\",\"str\":\"string\",\"b\":\"bool\"}"); 12987 free(s); 12988 terminateO(oT); 12989 // empty object 12990 oT = oM->f->typeStrings(oM); 12991 ck_assert_ptr_eq(oT, NULL); 12992 terminateO(o); 12993 terminateO(oM); 12994 // free local object 12995 obj.f->free(&obj); 12996 ck_assert_str_eq(obj.type, "smallDict"); 12997 // free object 12998 obj2->f->terminate(&obj2); 12999 ck_assert_ptr_eq(obj2, NULL); 13000 13001 } 13002 13003 13004 13005 13006 int main(int n UNUSED, char**v UNUSED) { 13007 // disable btrace to make the test run faster 13008 btraceDisable(); 13009 CuString *output = CuStringNew(); 13010 CuSuite *suite = CuSuiteNew(); 13011 13012 SUITE_ADD_TEST(suite, getsoSmallDictT); 13013 SUITE_ADD_TEST(suite, setsoSmallDictT); 13014 SUITE_ADD_TEST(suite, mirrorSmallDictT); 13015 SUITE_ADD_TEST(suite, setUndefinedSmallDictT); 13016 SUITE_ADD_TEST(suite, setBoolSmallDictT); 13017 SUITE_ADD_TEST(suite, setDoubleSmallDictT); 13018 SUITE_ADD_TEST(suite, setIntSmallDictT); 13019 SUITE_ADD_TEST(suite, setSSmallDictT); 13020 SUITE_ADD_TEST(suite, setCharSmallDictT); 13021 SUITE_ADD_TEST(suite, setDictSmallDictT); 13022 SUITE_ADD_TEST(suite, setArraySmallDictT); 13023 SUITE_ADD_TEST(suite, setArraycSmallDictT); 13024 SUITE_ADD_TEST(suite, setSmallBoolSmallDictT); 13025 SUITE_ADD_TEST(suite, setSmallBytesSmallDictT); 13026 SUITE_ADD_TEST(suite, setSmallDoubleSmallDictT); 13027 SUITE_ADD_TEST(suite, setSmallIntSmallDictT); 13028 SUITE_ADD_TEST(suite, setSmallJsonSmallDictT); 13029 SUITE_ADD_TEST(suite, setSmallStringSmallDictT); 13030 SUITE_ADD_TEST(suite, setSmallContainerSmallDictT); 13031 SUITE_ADD_TEST(suite, setKCharSmallDictT); 13032 SUITE_ADD_TEST(suite, setUndefinedKCharSmallDictT); 13033 SUITE_ADD_TEST(suite, setBoolKCharSmallDictT); 13034 SUITE_ADD_TEST(suite, setDoubleKCharSmallDictT); 13035 SUITE_ADD_TEST(suite, setIntKCharSmallDictT); 13036 SUITE_ADD_TEST(suite, setSKCharSmallDictT); 13037 SUITE_ADD_TEST(suite, setCharKCharSmallDictT); 13038 SUITE_ADD_TEST(suite, setDictKCharSmallDictT); 13039 SUITE_ADD_TEST(suite, setArrayKCharSmallDictT); 13040 SUITE_ADD_TEST(suite, setArraycKCharSmallDictT); 13041 SUITE_ADD_TEST(suite, setSmallBoolKCharSmallDictT); 13042 SUITE_ADD_TEST(suite, setSmallBytesKCharSmallDictT); 13043 SUITE_ADD_TEST(suite, setSmallDoubleKCharSmallDictT); 13044 SUITE_ADD_TEST(suite, setSmallIntKCharSmallDictT); 13045 SUITE_ADD_TEST(suite, setSmallJsonKCharSmallDictT); 13046 SUITE_ADD_TEST(suite, setSmallStringKCharSmallDictT); 13047 SUITE_ADD_TEST(suite, setSmallContainerKCharSmallDictT); 13048 SUITE_ADD_TEST(suite, setNFreeSmallDictT); 13049 SUITE_ADD_TEST(suite, setNFreeUndefinedSmallDictT); 13050 SUITE_ADD_TEST(suite, setNFreeSSmallDictT); 13051 SUITE_ADD_TEST(suite, setNFreeDictSmallDictT); 13052 SUITE_ADD_TEST(suite, setNFreeArraySmallDictT); 13053 SUITE_ADD_TEST(suite, setNFreeArraycSmallDictT); 13054 SUITE_ADD_TEST(suite, setNFreeSmallBoolSmallDictT); 13055 SUITE_ADD_TEST(suite, setNFreeSmallBytesSmallDictT); 13056 SUITE_ADD_TEST(suite, setNFreeSmallDoubleSmallDictT); 13057 SUITE_ADD_TEST(suite, setNFreeSmallIntSmallDictT); 13058 SUITE_ADD_TEST(suite, setNFreeSmallJsonSmallDictT); 13059 SUITE_ADD_TEST(suite, setNFreeSmallStringSmallDictT); 13060 SUITE_ADD_TEST(suite, setNFreeSmallContainerSmallDictT); 13061 SUITE_ADD_TEST(suite, setNFreeKCharSmallDictT); 13062 SUITE_ADD_TEST(suite, setNFreeUndefinedKCharSmallDictT); 13063 SUITE_ADD_TEST(suite, setNFreeSKCharSmallDictT); 13064 SUITE_ADD_TEST(suite, setNFreeDictKCharSmallDictT); 13065 SUITE_ADD_TEST(suite, setNFreeArrayKCharSmallDictT); 13066 SUITE_ADD_TEST(suite, setNFreeArraycKCharSmallDictT); 13067 SUITE_ADD_TEST(suite, setNFreeSmallBoolKCharSmallDictT); 13068 SUITE_ADD_TEST(suite, setNFreeSmallBytesKCharSmallDictT); 13069 SUITE_ADD_TEST(suite, setNFreeSmallDoubleKCharSmallDictT); 13070 SUITE_ADD_TEST(suite, setNFreeSmallIntKCharSmallDictT); 13071 SUITE_ADD_TEST(suite, setNFreeSmallJsonKCharSmallDictT); 13072 SUITE_ADD_TEST(suite, setNFreeSmallStringKCharSmallDictT); 13073 SUITE_ADD_TEST(suite, setNFreeSmallContainerKCharSmallDictT); 13074 SUITE_ADD_TEST(suite, setPDictSmallDictT); 13075 SUITE_ADD_TEST(suite, setPArraySmallDictT); 13076 SUITE_ADD_TEST(suite, setPSmallJsonSmallDictT); 13077 SUITE_ADD_TEST(suite, setPSmallStringSmallDictT); 13078 SUITE_ADD_TEST(suite, setNFreePDictSmallDictT); 13079 SUITE_ADD_TEST(suite, setNFreePArraySmallDictT); 13080 SUITE_ADD_TEST(suite, setNFreePSmallJsonSmallDictT); 13081 SUITE_ADD_TEST(suite, setNFreePSmallStringSmallDictT); 13082 SUITE_ADD_TEST(suite, setPArrayKCharSmallDictT); 13083 SUITE_ADD_TEST(suite, setPDictKCharSmallDictT); 13084 SUITE_ADD_TEST(suite, setPSmallJsonKCharSmallDictT); 13085 SUITE_ADD_TEST(suite, setPSmallStringKCharSmallDictT); 13086 SUITE_ADD_TEST(suite, setNFreePArrayKCharSmallDictT); 13087 SUITE_ADD_TEST(suite, setNFreePDictKCharSmallDictT); 13088 SUITE_ADD_TEST(suite, setNFreePSmallJsonKCharSmallDictT); 13089 SUITE_ADD_TEST(suite, setNFreePSmallStringKCharSmallDictT); 13090 SUITE_ADD_TEST(suite, getUndefinedSmallDictT); 13091 SUITE_ADD_TEST(suite, getBoolSmallDictT); 13092 SUITE_ADD_TEST(suite, getBoolPSmallDictT); 13093 SUITE_ADD_TEST(suite, getDoubleSmallDictT); 13094 SUITE_ADD_TEST(suite, getDoublePSmallDictT); 13095 SUITE_ADD_TEST(suite, getIntSmallDictT); 13096 SUITE_ADD_TEST(suite, getIntPSmallDictT); 13097 SUITE_ADD_TEST(suite, getInt32SmallDictT); 13098 SUITE_ADD_TEST(suite, getInt32PSmallDictT); 13099 SUITE_ADD_TEST(suite, getUintSmallDictT); 13100 SUITE_ADD_TEST(suite, getUintPSmallDictT); 13101 SUITE_ADD_TEST(suite, getUint32SmallDictT); 13102 SUITE_ADD_TEST(suite, getUint32PSmallDictT); 13103 SUITE_ADD_TEST(suite, getSSmallDictT); 13104 SUITE_ADD_TEST(suite, getDictSmallDictT); 13105 SUITE_ADD_TEST(suite, getArraySmallDictT); 13106 SUITE_ADD_TEST(suite, getSmallBoolSmallDictT); 13107 SUITE_ADD_TEST(suite, getSmallBytesSmallDictT); 13108 SUITE_ADD_TEST(suite, getSmallDoubleSmallDictT); 13109 SUITE_ADD_TEST(suite, getSmallIntSmallDictT); 13110 SUITE_ADD_TEST(suite, getSmallJsonSmallDictT); 13111 SUITE_ADD_TEST(suite, getSmallStringSmallDictT); 13112 SUITE_ADD_TEST(suite, getVoidSmallDictT); 13113 SUITE_ADD_TEST(suite, getSmallContainerSmallDictT); 13114 SUITE_ADD_TEST(suite, getKCharSmallDictT); 13115 SUITE_ADD_TEST(suite, getUndefinedKCharSmallDictT); 13116 SUITE_ADD_TEST(suite, getBoolKCharSmallDictT); 13117 SUITE_ADD_TEST(suite, getBoolPKCharSmallDictT); 13118 SUITE_ADD_TEST(suite, getDoubleKCharSmallDictT); 13119 SUITE_ADD_TEST(suite, getDoublePKCharSmallDictT); 13120 SUITE_ADD_TEST(suite, getIntKCharSmallDictT); 13121 SUITE_ADD_TEST(suite, getIntPKCharSmallDictT); 13122 SUITE_ADD_TEST(suite, getInt32KCharSmallDictT); 13123 SUITE_ADD_TEST(suite, getInt32PKCharSmallDictT); 13124 SUITE_ADD_TEST(suite, getUintKCharSmallDictT); 13125 SUITE_ADD_TEST(suite, getUintPKCharSmallDictT); 13126 SUITE_ADD_TEST(suite, getUint32KCharSmallDictT); 13127 SUITE_ADD_TEST(suite, getUint32PKCharSmallDictT); 13128 SUITE_ADD_TEST(suite, getSKCharSmallDictT); 13129 SUITE_ADD_TEST(suite, getDictKCharSmallDictT); 13130 SUITE_ADD_TEST(suite, getArrayKCharSmallDictT); 13131 SUITE_ADD_TEST(suite, getSmallBoolKCharSmallDictT); 13132 SUITE_ADD_TEST(suite, getSmallBytesKCharSmallDictT); 13133 SUITE_ADD_TEST(suite, getSmallDoubleKCharSmallDictT); 13134 SUITE_ADD_TEST(suite, getSmallIntKCharSmallDictT); 13135 SUITE_ADD_TEST(suite, getSmallJsonKCharSmallDictT); 13136 SUITE_ADD_TEST(suite, getSmallStringKCharSmallDictT); 13137 SUITE_ADD_TEST(suite, getVoidKCharSmallDictT); 13138 SUITE_ADD_TEST(suite, getSmallContainerKCharSmallDictT); 13139 SUITE_ADD_TEST(suite, getNDupSmallDictT); 13140 SUITE_ADD_TEST(suite, getNDupUndefinedSmallDictT); 13141 SUITE_ADD_TEST(suite, getNDupBoolSmallDictT); 13142 SUITE_ADD_TEST(suite, getNDupDoubleSmallDictT); 13143 SUITE_ADD_TEST(suite, getNDupIntSmallDictT); 13144 SUITE_ADD_TEST(suite, getNDupInt32SmallDictT); 13145 SUITE_ADD_TEST(suite, getNDupUintSmallDictT); 13146 SUITE_ADD_TEST(suite, getNDupUint32SmallDictT); 13147 SUITE_ADD_TEST(suite, getNDupSSmallDictT); 13148 SUITE_ADD_TEST(suite, getNDupDictSmallDictT); 13149 SUITE_ADD_TEST(suite, getNDupArraySmallDictT); 13150 SUITE_ADD_TEST(suite, getNDupSmallBoolSmallDictT); 13151 SUITE_ADD_TEST(suite, getNDupSmallBytesSmallDictT); 13152 SUITE_ADD_TEST(suite, getNDupSmallDoubleSmallDictT); 13153 SUITE_ADD_TEST(suite, getNDupSmallIntSmallDictT); 13154 SUITE_ADD_TEST(suite, getNDupSmallJsonSmallDictT); 13155 SUITE_ADD_TEST(suite, getNDupSmallStringSmallDictT); 13156 SUITE_ADD_TEST(suite, getNDupVoidSmallDictT); 13157 SUITE_ADD_TEST(suite, getNDupSmallContainerSmallDictT); 13158 SUITE_ADD_TEST(suite, getNDupKCharSmallDictT); 13159 SUITE_ADD_TEST(suite, getNDupUndefinedKCharSmallDictT); 13160 SUITE_ADD_TEST(suite, getNDupBoolKCharSmallDictT); 13161 SUITE_ADD_TEST(suite, getNDupDoubleKCharSmallDictT); 13162 SUITE_ADD_TEST(suite, getNDupIntKCharSmallDictT); 13163 SUITE_ADD_TEST(suite, getNDupInt32KCharSmallDictT); 13164 SUITE_ADD_TEST(suite, getNDupUintKCharSmallDictT); 13165 SUITE_ADD_TEST(suite, getNDupUint32KCharSmallDictT); 13166 SUITE_ADD_TEST(suite, getNDupSKCharSmallDictT); 13167 SUITE_ADD_TEST(suite, getNDupDictKCharSmallDictT); 13168 SUITE_ADD_TEST(suite, getNDupArrayKCharSmallDictT); 13169 SUITE_ADD_TEST(suite, getNDupSmallBoolKCharSmallDictT); 13170 SUITE_ADD_TEST(suite, getNDupSmallBytesKCharSmallDictT); 13171 SUITE_ADD_TEST(suite, getNDupSmallDoubleKCharSmallDictT); 13172 SUITE_ADD_TEST(suite, getNDupSmallIntKCharSmallDictT); 13173 SUITE_ADD_TEST(suite, getNDupSmallJsonKCharSmallDictT); 13174 SUITE_ADD_TEST(suite, getNDupSmallStringKCharSmallDictT); 13175 SUITE_ADD_TEST(suite, getNDupVoidKCharSmallDictT); 13176 SUITE_ADD_TEST(suite, getNDupSmallContainerKCharSmallDictT); 13177 SUITE_ADD_TEST(suite, getNumSmallDictT); 13178 SUITE_ADD_TEST(suite, cropElemSmallDictT); 13179 SUITE_ADD_TEST(suite, cropElemUndefinedSmallDictT); 13180 SUITE_ADD_TEST(suite, cropElemBoolSmallDictT); 13181 SUITE_ADD_TEST(suite, cropElemDoubleSmallDictT); 13182 SUITE_ADD_TEST(suite, cropElemIntSmallDictT); 13183 SUITE_ADD_TEST(suite, cropElemInt32SmallDictT); 13184 SUITE_ADD_TEST(suite, cropElemUintSmallDictT); 13185 SUITE_ADD_TEST(suite, cropElemUint32SmallDictT); 13186 SUITE_ADD_TEST(suite, cropElemSSmallDictT); 13187 SUITE_ADD_TEST(suite, cropElemDictSmallDictT); 13188 SUITE_ADD_TEST(suite, cropElemArraySmallDictT); 13189 SUITE_ADD_TEST(suite, cropElemSmallBoolSmallDictT); 13190 SUITE_ADD_TEST(suite, cropElemSmallBytesSmallDictT); 13191 SUITE_ADD_TEST(suite, cropElemSmallDoubleSmallDictT); 13192 SUITE_ADD_TEST(suite, cropElemSmallIntSmallDictT); 13193 SUITE_ADD_TEST(suite, cropElemSmallJsonSmallDictT); 13194 SUITE_ADD_TEST(suite, cropElemSmallStringSmallDictT); 13195 SUITE_ADD_TEST(suite, cropElemVoidSmallDictT); 13196 SUITE_ADD_TEST(suite, cropElemSmallContainerSmallDictT); 13197 SUITE_ADD_TEST(suite, delKCharSmallDictT); 13198 SUITE_ADD_TEST(suite, removeSmallDictT); 13199 SUITE_ADD_TEST(suite, removeKCharSmallDictT); 13200 SUITE_ADD_TEST(suite, hasKCharSmallDictT); 13201 SUITE_ADD_TEST(suite, keyBySmallDictT); 13202 SUITE_ADD_TEST(suite, keyByUndefinedSmallDictT); 13203 SUITE_ADD_TEST(suite, keyByBoolSmallDictT); 13204 SUITE_ADD_TEST(suite, keyByDoubleSmallDictT); 13205 SUITE_ADD_TEST(suite, keyByIntSmallDictT); 13206 SUITE_ADD_TEST(suite, keyBySSmallDictT); 13207 SUITE_ADD_TEST(suite, keyByCharSmallDictT); 13208 SUITE_ADD_TEST(suite, keyByDictSmallDictT); 13209 SUITE_ADD_TEST(suite, keyByArraySmallDictT); 13210 SUITE_ADD_TEST(suite, keyByArraycSmallDictT); 13211 SUITE_ADD_TEST(suite, keyBySmallBoolSmallDictT); 13212 SUITE_ADD_TEST(suite, keyBySmallBytesSmallDictT); 13213 SUITE_ADD_TEST(suite, keyBySmallDoubleSmallDictT); 13214 SUITE_ADD_TEST(suite, keyBySmallIntSmallDictT); 13215 SUITE_ADD_TEST(suite, keyBySmallJsonSmallDictT); 13216 SUITE_ADD_TEST(suite, keyBySmallStringSmallDictT); 13217 SUITE_ADD_TEST(suite, keyBySmallContainerSmallDictT); 13218 SUITE_ADD_TEST(suite, icKeyBySmallDictT); 13219 SUITE_ADD_TEST(suite, icKeyBySSmallDictT); 13220 SUITE_ADD_TEST(suite, icKeyByCharSmallDictT); 13221 SUITE_ADD_TEST(suite, icKeyByDictSmallDictT); 13222 SUITE_ADD_TEST(suite, icKeyByArraySmallDictT); 13223 SUITE_ADD_TEST(suite, icKeyByArraycSmallDictT); 13224 SUITE_ADD_TEST(suite, icKeyBySmallJsonSmallDictT); 13225 SUITE_ADD_TEST(suite, icKeyBySmallStringSmallDictT); 13226 SUITE_ADD_TEST(suite, trimSmallDictT); 13227 SUITE_ADD_TEST(suite, keysSmallStringSmallDictT); 13228 SUITE_ADD_TEST(suite, mergeSmallJsonSmallDictT); 13229 SUITE_ADD_TEST(suite, mergeNSmashSmallDictT); 13230 SUITE_ADD_TEST(suite, mergeNSmashSmallJsonSmallDictT); 13231 SUITE_ADD_TEST(suite, appendNSmashSmallDictT); 13232 SUITE_ADD_TEST(suite, equalSmallDictBaseT); 13233 SUITE_ADD_TEST(suite, equalSmallDictSmallJsonT); 13234 SUITE_ADD_TEST(suite, equalSmallDictT); 13235 SUITE_ADD_TEST(suite, icEqualSmallDictBaseT); 13236 SUITE_ADD_TEST(suite, icEqualSmallDictSmallJsonT); 13237 SUITE_ADD_TEST(suite, icEqualSmallDictT); 13238 SUITE_ADD_TEST(suite, isEmptySmallDictT); 13239 SUITE_ADD_TEST(suite, enumerateSmallDictFT); 13240 SUITE_ADD_TEST(suite, iterStartSmallDictT); 13241 SUITE_ADD_TEST(suite, iterStartKeySmallDictT); 13242 SUITE_ADD_TEST(suite, iterNextSmallDictT); 13243 SUITE_ADD_TEST(suite, iterNextKeySmallDictT); 13244 SUITE_ADD_TEST(suite, iterElementSmallDictT); 13245 SUITE_ADD_TEST(suite, iterKeySmallDictT); 13246 SUITE_ADD_TEST(suite, zipSmallDictT); 13247 SUITE_ADD_TEST(suite, zipSmallJsonSmallDictT); 13248 SUITE_ADD_TEST(suite, zipSmallJsonSmallArraySmallDictT); 13249 SUITE_ADD_TEST(suite, zipSmallJsonSmallJsonSmallDictT); 13250 SUITE_ADD_TEST(suite, zipSmallJsonVArraySmallDictT); 13251 SUITE_ADD_TEST(suite, zipArraySmallDictT); 13252 SUITE_ADD_TEST(suite, zipArraySmallJsonSmallDictT); 13253 SUITE_ADD_TEST(suite, zipArrayArraySmallDictT); 13254 SUITE_ADD_TEST(suite, zipVArraySmallDictT); 13255 SUITE_ADD_TEST(suite, fromArraySmallDictT); 13256 SUITE_ADD_TEST(suite, toArraySmallDictT); 13257 SUITE_ADD_TEST(suite, writeFileSmallDictT); 13258 SUITE_ADD_TEST(suite, writeFileSmallJsonSmallDictT); 13259 SUITE_ADD_TEST(suite, writeFileSmallStringSmallDictT); 13260 SUITE_ADD_TEST(suite, writeStreamSmallDictT); 13261 SUITE_ADD_TEST(suite, appendFileSmallDictT); 13262 SUITE_ADD_TEST(suite, appendFileSmallStringSmallDictT); 13263 SUITE_ADD_TEST(suite, logSmallDictT); 13264 SUITE_ADD_TEST(suite, typeSmallStringSmallDictT); 13265 SUITE_ADD_TEST(suite, typeStringKCharSmallDictT); 13266 SUITE_ADD_TEST(suite, typeSmallStringKCharSmallDictT); 13267 SUITE_ADD_TEST(suite, typeKCharSmallDictT); 13268 SUITE_ADD_TEST(suite, isETypeSmallDictT); 13269 SUITE_ADD_TEST(suite, isEUndefinedSmallDictT); 13270 SUITE_ADD_TEST(suite, isEBoolSmallDictT); 13271 SUITE_ADD_TEST(suite, isEContainerSmallDictT); 13272 SUITE_ADD_TEST(suite, isEDictSmallDictT); 13273 SUITE_ADD_TEST(suite, isEDoubleSmallDictT); 13274 SUITE_ADD_TEST(suite, isEIntSmallDictT); 13275 SUITE_ADD_TEST(suite, isEStringSmallDictT); 13276 SUITE_ADD_TEST(suite, isEFaststringSmallDictT); 13277 SUITE_ADD_TEST(suite, isEArraySmallDictT); 13278 SUITE_ADD_TEST(suite, isEBytesSmallDictT); 13279 SUITE_ADD_TEST(suite, areAllETypeSmallDictT); 13280 SUITE_ADD_TEST(suite, areAllEUndefinedSmallDictT); 13281 SUITE_ADD_TEST(suite, areAllEBoolSmallDictT); 13282 SUITE_ADD_TEST(suite, areAllEContainerSmallDictT); 13283 SUITE_ADD_TEST(suite, areAllEDictSmallDictT); 13284 SUITE_ADD_TEST(suite, areAllEDoubleSmallDictT); 13285 SUITE_ADD_TEST(suite, areAllEIntSmallDictT); 13286 SUITE_ADD_TEST(suite, areAllEStringSmallDictT); 13287 SUITE_ADD_TEST(suite, areAllEFaststringSmallDictT); 13288 SUITE_ADD_TEST(suite, areAllEArraySmallDictT); 13289 SUITE_ADD_TEST(suite, areAllEBytesSmallDictT); 13290 SUITE_ADD_TEST(suite, duplicateSmallDictGT); 13291 SUITE_ADD_TEST(suite, freeSmallDictGT); 13292 SUITE_ADD_TEST(suite, setSmallDictGT); 13293 SUITE_ADD_TEST(suite, getSmallDictGT); 13294 SUITE_ADD_TEST(suite, getUndefinedSmallDictGT); 13295 SUITE_ADD_TEST(suite, getBoolSmallDictGT); 13296 SUITE_ADD_TEST(suite, getBoolPSmallDictGT); 13297 SUITE_ADD_TEST(suite, getDoubleSmallDictGT); 13298 SUITE_ADD_TEST(suite, getDoublePSmallDictGT); 13299 SUITE_ADD_TEST(suite, getIntSmallDictGT); 13300 SUITE_ADD_TEST(suite, getIntPSmallDictGT); 13301 SUITE_ADD_TEST(suite, getInt32SmallDictGT); 13302 SUITE_ADD_TEST(suite, getInt32PSmallDictGT); 13303 SUITE_ADD_TEST(suite, getUintSmallDictGT); 13304 SUITE_ADD_TEST(suite, getUintPSmallDictGT); 13305 SUITE_ADD_TEST(suite, getUint32SmallDictGT); 13306 SUITE_ADD_TEST(suite, getUint32PSmallDictGT); 13307 SUITE_ADD_TEST(suite, getSSmallDictGT); 13308 SUITE_ADD_TEST(suite, getDictSmallDictGT); 13309 SUITE_ADD_TEST(suite, getArraySmallDictGT); 13310 SUITE_ADD_TEST(suite, getSmallBoolSmallDictGT); 13311 SUITE_ADD_TEST(suite, getSmallBytesSmallDictGT); 13312 SUITE_ADD_TEST(suite, getSmallDoubleSmallDictGT); 13313 SUITE_ADD_TEST(suite, getSmallIntSmallDictGT); 13314 SUITE_ADD_TEST(suite, getSmallJsonSmallDictGT); 13315 SUITE_ADD_TEST(suite, getSmallStringSmallDictGT); 13316 SUITE_ADD_TEST(suite, getVoidSmallDictGT); 13317 SUITE_ADD_TEST(suite, getSmallContainerSmallDictGT); 13318 SUITE_ADD_TEST(suite, getKCharSmallDictGT); 13319 SUITE_ADD_TEST(suite, getUndefinedKCharSmallDictGT); 13320 SUITE_ADD_TEST(suite, getBoolKCharSmallDictGT); 13321 SUITE_ADD_TEST(suite, getBoolPKCharSmallDictGT); 13322 SUITE_ADD_TEST(suite, getDoubleKCharSmallDictGT); 13323 SUITE_ADD_TEST(suite, getDoublePKCharSmallDictGT); 13324 SUITE_ADD_TEST(suite, getIntKCharSmallDictGT); 13325 SUITE_ADD_TEST(suite, getIntPKCharSmallDictGT); 13326 SUITE_ADD_TEST(suite, getInt32KCharSmallDictGT); 13327 SUITE_ADD_TEST(suite, getInt32PKCharSmallDictGT); 13328 SUITE_ADD_TEST(suite, getUintKCharSmallDictGT); 13329 SUITE_ADD_TEST(suite, getUintPKCharSmallDictGT); 13330 SUITE_ADD_TEST(suite, getUint32KCharSmallDictGT); 13331 SUITE_ADD_TEST(suite, getUint32PKCharSmallDictGT); 13332 SUITE_ADD_TEST(suite, getSKCharSmallDictGT); 13333 SUITE_ADD_TEST(suite, getDictKCharSmallDictGT); 13334 SUITE_ADD_TEST(suite, getArrayKCharSmallDictGT); 13335 SUITE_ADD_TEST(suite, getSmallBoolKCharSmallDictGT); 13336 SUITE_ADD_TEST(suite, getSmallBytesKCharSmallDictGT); 13337 SUITE_ADD_TEST(suite, getSmallDoubleKCharSmallDictGT); 13338 SUITE_ADD_TEST(suite, getSmallIntKCharSmallDictGT); 13339 SUITE_ADD_TEST(suite, getSmallJsonKCharSmallDictGT); 13340 SUITE_ADD_TEST(suite, getSmallStringKCharSmallDictGT); 13341 SUITE_ADD_TEST(suite, getVoidKCharSmallDictGT); 13342 SUITE_ADD_TEST(suite, getSmallContainerKCharSmallDictGT); 13343 SUITE_ADD_TEST(suite, getNDupSmallDictGT); 13344 SUITE_ADD_TEST(suite, getNDupUndefinedSmallDictGT); 13345 SUITE_ADD_TEST(suite, getNDupBoolSmallDictGT); 13346 SUITE_ADD_TEST(suite, getNDupDoubleSmallDictGT); 13347 SUITE_ADD_TEST(suite, getNDupIntSmallDictGT); 13348 SUITE_ADD_TEST(suite, getNDupInt32SmallDictGT); 13349 SUITE_ADD_TEST(suite, getNDupUintSmallDictGT); 13350 SUITE_ADD_TEST(suite, getNDupUint32SmallDictGT); 13351 SUITE_ADD_TEST(suite, getNDupSSmallDictGT); 13352 SUITE_ADD_TEST(suite, getNDupDictSmallDictGT); 13353 SUITE_ADD_TEST(suite, getNDupArraySmallDictGT); 13354 SUITE_ADD_TEST(suite, getNDupSmallBoolSmallDictGT); 13355 SUITE_ADD_TEST(suite, getNDupSmallBytesSmallDictGT); 13356 SUITE_ADD_TEST(suite, getNDupSmallDoubleSmallDictGT); 13357 SUITE_ADD_TEST(suite, getNDupSmallIntSmallDictGT); 13358 SUITE_ADD_TEST(suite, getNDupSmallJsonSmallDictGT); 13359 SUITE_ADD_TEST(suite, getNDupSmallStringSmallDictGT); 13360 SUITE_ADD_TEST(suite, getNDupVoidSmallDictGT); 13361 SUITE_ADD_TEST(suite, getNDupSmallContainerSmallDictGT); 13362 SUITE_ADD_TEST(suite, getNDupKCharSmallDictGT); 13363 SUITE_ADD_TEST(suite, getNDupUndefinedKCharSmallDictGT); 13364 SUITE_ADD_TEST(suite, getNDupBoolKCharSmallDictGT); 13365 SUITE_ADD_TEST(suite, getNDupDoubleKCharSmallDictGT); 13366 SUITE_ADD_TEST(suite, getNDupIntKCharSmallDictGT); 13367 SUITE_ADD_TEST(suite, getNDupInt32KCharSmallDictGT); 13368 SUITE_ADD_TEST(suite, getNDupUintKCharSmallDictGT); 13369 SUITE_ADD_TEST(suite, getNDupUint32KCharSmallDictGT); 13370 SUITE_ADD_TEST(suite, getNDupSKCharSmallDictGT); 13371 SUITE_ADD_TEST(suite, getNDupDictKCharSmallDictGT); 13372 SUITE_ADD_TEST(suite, getNDupArrayKCharSmallDictGT); 13373 SUITE_ADD_TEST(suite, getNDupSmallBoolKCharSmallDictGT); 13374 SUITE_ADD_TEST(suite, getNDupSmallBytesKCharSmallDictGT); 13375 SUITE_ADD_TEST(suite, getNDupSmallDoubleKCharSmallDictGT); 13376 SUITE_ADD_TEST(suite, getNDupSmallIntKCharSmallDictGT); 13377 SUITE_ADD_TEST(suite, getNDupSmallJsonKCharSmallDictGT); 13378 SUITE_ADD_TEST(suite, getNDupSmallStringKCharSmallDictGT); 13379 SUITE_ADD_TEST(suite, getNDupVoidKCharSmallDictGT); 13380 SUITE_ADD_TEST(suite, getNDupSmallContainerKCharSmallDictGT); 13381 SUITE_ADD_TEST(suite, setUndefinedSmallDictGT); 13382 SUITE_ADD_TEST(suite, setBoolSmallDictGT); 13383 SUITE_ADD_TEST(suite, setDoubleSmallDictGT); 13384 SUITE_ADD_TEST(suite, setIntSmallDictGT); 13385 SUITE_ADD_TEST(suite, setSSmallDictGT); 13386 SUITE_ADD_TEST(suite, setCharSmallDictGT); 13387 SUITE_ADD_TEST(suite, setDictSmallDictGT); 13388 SUITE_ADD_TEST(suite, setArraySmallDictGT); 13389 SUITE_ADD_TEST(suite, setArraycSmallDictGT); 13390 SUITE_ADD_TEST(suite, setCArraycSmallDictGT); 13391 SUITE_ADD_TEST(suite, setVoidSmallDictGT); 13392 SUITE_ADD_TEST(suite, setSmallBoolSmallDictGT); 13393 SUITE_ADD_TEST(suite, setSmallBytesSmallDictGT); 13394 SUITE_ADD_TEST(suite, setSmallDoubleSmallDictGT); 13395 SUITE_ADD_TEST(suite, setSmallIntSmallDictGT); 13396 SUITE_ADD_TEST(suite, setSmallJsonSmallDictGT); 13397 SUITE_ADD_TEST(suite, setSmallStringSmallDictGT); 13398 SUITE_ADD_TEST(suite, setSmallContainerSmallDictGT); 13399 SUITE_ADD_TEST(suite, setKCharSmallDictGT); 13400 SUITE_ADD_TEST(suite, setUndefinedKCharSmallDictGT); 13401 SUITE_ADD_TEST(suite, setBoolKCharSmallDictGT); 13402 SUITE_ADD_TEST(suite, setDoubleKCharSmallDictGT); 13403 SUITE_ADD_TEST(suite, setIntKCharSmallDictGT); 13404 SUITE_ADD_TEST(suite, setSKCharSmallDictGT); 13405 SUITE_ADD_TEST(suite, setCharKCharSmallDictGT); 13406 SUITE_ADD_TEST(suite, setDictKCharSmallDictGT); 13407 SUITE_ADD_TEST(suite, setArrayKCharSmallDictGT); 13408 SUITE_ADD_TEST(suite, setArraycKCharSmallDictGT); 13409 SUITE_ADD_TEST(suite, setCArraycKCharSmallDictGT); 13410 SUITE_ADD_TEST(suite, setVoidKCharSmallDictGT); 13411 SUITE_ADD_TEST(suite, setSmallBoolKCharSmallDictGT); 13412 SUITE_ADD_TEST(suite, setSmallBytesKCharSmallDictGT); 13413 SUITE_ADD_TEST(suite, setSmallDoubleKCharSmallDictGT); 13414 SUITE_ADD_TEST(suite, setSmallIntKCharSmallDictGT); 13415 SUITE_ADD_TEST(suite, setSmallJsonKCharSmallDictGT); 13416 SUITE_ADD_TEST(suite, setSmallStringKCharSmallDictGT); 13417 SUITE_ADD_TEST(suite, setSmallContainerKCharSmallDictGT); 13418 SUITE_ADD_TEST(suite, setNFreeSmallDictGT); 13419 SUITE_ADD_TEST(suite, setNFreeUndefinedSmallDictGT); 13420 SUITE_ADD_TEST(suite, setNFreeSSmallDictGT); 13421 SUITE_ADD_TEST(suite, setNFreeDictSmallDictGT); 13422 SUITE_ADD_TEST(suite, setNFreeArraySmallDictGT); 13423 SUITE_ADD_TEST(suite, setNFreeArraycSmallDictGT); 13424 SUITE_ADD_TEST(suite, setNFreeSmallBoolSmallDictGT); 13425 SUITE_ADD_TEST(suite, setNFreeSmallBytesSmallDictGT); 13426 SUITE_ADD_TEST(suite, setNFreeSmallDoubleSmallDictGT); 13427 SUITE_ADD_TEST(suite, setNFreeSmallIntSmallDictGT); 13428 SUITE_ADD_TEST(suite, setNFreeSmallJsonSmallDictGT); 13429 SUITE_ADD_TEST(suite, setNFreeSmallStringSmallDictGT); 13430 SUITE_ADD_TEST(suite, setNFreeSmallContainerSmallDictGT); 13431 SUITE_ADD_TEST(suite, setNFreeKCharSmallDictGT); 13432 SUITE_ADD_TEST(suite, setNFreeUndefinedKCharSmallDictGT); 13433 SUITE_ADD_TEST(suite, setNFreeSKCharSmallDictGT); 13434 SUITE_ADD_TEST(suite, setNFreeDictKCharSmallDictGT); 13435 SUITE_ADD_TEST(suite, setNFreeArrayKCharSmallDictGT); 13436 SUITE_ADD_TEST(suite, setNFreeArraycKCharSmallDictGT); 13437 SUITE_ADD_TEST(suite, setNFreeSmallBoolKCharSmallDictGT); 13438 SUITE_ADD_TEST(suite, setNFreeSmallBytesKCharSmallDictGT); 13439 SUITE_ADD_TEST(suite, setNFreeSmallDoubleKCharSmallDictGT); 13440 SUITE_ADD_TEST(suite, setNFreeSmallIntKCharSmallDictGT); 13441 SUITE_ADD_TEST(suite, setNFreeSmallJsonKCharSmallDictGT); 13442 SUITE_ADD_TEST(suite, setNFreeSmallStringKCharSmallDictGT); 13443 SUITE_ADD_TEST(suite, setNFreeSmallContainerKCharSmallDictGT); 13444 SUITE_ADD_TEST(suite, setPDictSmallDictGT); 13445 SUITE_ADD_TEST(suite, setPArraySmallDictGT); 13446 SUITE_ADD_TEST(suite, setPSmallJsonSmallDictGT); 13447 SUITE_ADD_TEST(suite, setPSmallStringSmallDictGT); 13448 SUITE_ADD_TEST(suite, setNFreePDictSmallDictGT); 13449 SUITE_ADD_TEST(suite, setNFreePArraySmallDictGT); 13450 SUITE_ADD_TEST(suite, setNFreePSmallJsonSmallDictGT); 13451 SUITE_ADD_TEST(suite, setNFreePSmallStringSmallDictGT); 13452 SUITE_ADD_TEST(suite, setPArrayKCharSmallDictGT); 13453 SUITE_ADD_TEST(suite, setPDictKCharSmallDictGT); 13454 SUITE_ADD_TEST(suite, setPSmallJsonKCharSmallDictGT); 13455 SUITE_ADD_TEST(suite, setPSmallStringKCharSmallDictGT); 13456 SUITE_ADD_TEST(suite, setNFreePArrayKCharSmallDictGT); 13457 SUITE_ADD_TEST(suite, setNFreePDictKCharSmallDictGT); 13458 SUITE_ADD_TEST(suite, setNFreePSmallJsonKCharSmallDictGT); 13459 SUITE_ADD_TEST(suite, setNFreePSmallStringKCharSmallDictGT); 13460 SUITE_ADD_TEST(suite, mergeSmallDictGT); 13461 SUITE_ADD_TEST(suite, mergeSmallJsonSmallDictGT); 13462 SUITE_ADD_TEST(suite, mergeNSmashSmallDictGT); 13463 SUITE_ADD_TEST(suite, mergeNSmashSmallJsonSmallDictGT); 13464 SUITE_ADD_TEST(suite, equalSmallDictBaseGT); 13465 SUITE_ADD_TEST(suite, equalSmallDictSmallJsonGT); 13466 SUITE_ADD_TEST(suite, equalSmallDictGT); 13467 SUITE_ADD_TEST(suite, icEqualSmallDictBaseGT); 13468 SUITE_ADD_TEST(suite, icEqualSmallDictSmallJsonGT); 13469 SUITE_ADD_TEST(suite, icEqualSmallDictGT); 13470 SUITE_ADD_TEST(suite, getNumSmallDictGT); 13471 SUITE_ADD_TEST(suite, cropElemSmallDictGT); 13472 SUITE_ADD_TEST(suite, cropElemUndefinedSmallDictGT); 13473 SUITE_ADD_TEST(suite, cropElemBoolSmallDictGT); 13474 SUITE_ADD_TEST(suite, cropElemDoubleSmallDictGT); 13475 SUITE_ADD_TEST(suite, cropElemIntSmallDictGT); 13476 SUITE_ADD_TEST(suite, cropElemInt32SmallDictGT); 13477 SUITE_ADD_TEST(suite, cropElemUintSmallDictGT); 13478 SUITE_ADD_TEST(suite, cropElemUint32SmallDictGT); 13479 SUITE_ADD_TEST(suite, cropElemSSmallDictGT); 13480 SUITE_ADD_TEST(suite, cropElemDictSmallDictGT); 13481 SUITE_ADD_TEST(suite, cropElemArraySmallDictGT); 13482 SUITE_ADD_TEST(suite, cropElemSmallBoolSmallDictGT); 13483 SUITE_ADD_TEST(suite, cropElemSmallBytesSmallDictGT); 13484 SUITE_ADD_TEST(suite, cropElemSmallDoubleSmallDictGT); 13485 SUITE_ADD_TEST(suite, cropElemSmallIntSmallDictGT); 13486 SUITE_ADD_TEST(suite, cropElemSmallJsonSmallDictGT); 13487 SUITE_ADD_TEST(suite, cropElemSmallStringSmallDictGT); 13488 SUITE_ADD_TEST(suite, cropElemVoidSmallDictGT); 13489 SUITE_ADD_TEST(suite, cropElemSmallContainerSmallDictGT); 13490 SUITE_ADD_TEST(suite, delSmallDictGT); 13491 SUITE_ADD_TEST(suite, delKCharSmallDictGT); 13492 SUITE_ADD_TEST(suite, delElemSmallDictGT); 13493 SUITE_ADD_TEST(suite, delElemKCharSmallDictGT); 13494 SUITE_ADD_TEST(suite, removeSmallDictGT); 13495 SUITE_ADD_TEST(suite, removeKCharSmallDictGT); 13496 SUITE_ADD_TEST(suite, removeElemSmallDictGT); 13497 SUITE_ADD_TEST(suite, removeElemKCharSmallDictGT); 13498 SUITE_ADD_TEST(suite, hasSmallDictGT); 13499 SUITE_ADD_TEST(suite, hasKCharSmallDictGT); 13500 SUITE_ADD_TEST(suite, keyBySmallDictGT); 13501 SUITE_ADD_TEST(suite, keyByUndefinedSmallDictGT); 13502 SUITE_ADD_TEST(suite, keyByBoolSmallDictGT); 13503 SUITE_ADD_TEST(suite, keyByDoubleSmallDictGT); 13504 SUITE_ADD_TEST(suite, keyByIntSmallDictGT); 13505 SUITE_ADD_TEST(suite, keyBySSmallDictGT); 13506 SUITE_ADD_TEST(suite, keyByCharSmallDictGT); 13507 SUITE_ADD_TEST(suite, keyByDictSmallDictGT); 13508 SUITE_ADD_TEST(suite, keyByArraySmallDictGT); 13509 SUITE_ADD_TEST(suite, keyByArraycSmallDictGT); 13510 SUITE_ADD_TEST(suite, keyByCArraycSmallDictGT); 13511 SUITE_ADD_TEST(suite, keyBySmallBoolSmallDictGT); 13512 SUITE_ADD_TEST(suite, keyBySmallBytesSmallDictGT); 13513 SUITE_ADD_TEST(suite, keyBySmallDoubleSmallDictGT); 13514 SUITE_ADD_TEST(suite, keyBySmallIntSmallDictGT); 13515 SUITE_ADD_TEST(suite, keyBySmallJsonSmallDictGT); 13516 SUITE_ADD_TEST(suite, keyBySmallStringSmallDictGT); 13517 SUITE_ADD_TEST(suite, keyBySmallContainerSmallDictGT); 13518 SUITE_ADD_TEST(suite, icKeyBySmallDictGT); 13519 SUITE_ADD_TEST(suite, icKeyBySSmallDictGT); 13520 SUITE_ADD_TEST(suite, icKeyByCharSmallDictGT); 13521 SUITE_ADD_TEST(suite, icKeyByDictSmallDictGT); 13522 SUITE_ADD_TEST(suite, icKeyByArraySmallDictGT); 13523 SUITE_ADD_TEST(suite, icKeyByArraycSmallDictGT); 13524 SUITE_ADD_TEST(suite, icKeyByCArraycSmallDictGT); 13525 SUITE_ADD_TEST(suite, icKeyBySmallJsonSmallDictGT); 13526 SUITE_ADD_TEST(suite, icKeyBySmallStringSmallDictGT); 13527 SUITE_ADD_TEST(suite, trimSmallDictGT); 13528 SUITE_ADD_TEST(suite, keysSmallStringSmallDictGT); 13529 SUITE_ADD_TEST(suite, lenSmallDictGT); 13530 SUITE_ADD_TEST(suite, emptySmallDictGT); 13531 SUITE_ADD_TEST(suite, isEmptySmallDictGT); 13532 SUITE_ADD_TEST(suite, zipSmallDictGT); 13533 SUITE_ADD_TEST(suite, zipSmallJsonSmallDictGT); 13534 SUITE_ADD_TEST(suite, zipSmallJsonSmallArraySmallDictGT); 13535 SUITE_ADD_TEST(suite, zipSmallJsonSmallJsonSmallDictGT); 13536 SUITE_ADD_TEST(suite, zipSmallJsonVArraySmallDictGT); 13537 SUITE_ADD_TEST(suite, zipSmallJsonVCArraySmallDictGT); 13538 SUITE_ADD_TEST(suite, zipArraySmallDictGT); 13539 SUITE_ADD_TEST(suite, zipArraySmallJsonSmallDictGT); 13540 SUITE_ADD_TEST(suite, zipCArraySmallDictGT); 13541 SUITE_ADD_TEST(suite, zipCArraySmallJsonSmallDictGT); 13542 SUITE_ADD_TEST(suite, zipArrayArraySmallDictGT); 13543 SUITE_ADD_TEST(suite, zipCArrayArraySmallDictGT); 13544 SUITE_ADD_TEST(suite, zipArrayCArraySmallDictGT); 13545 SUITE_ADD_TEST(suite, zipCArrayCArraySmallDictGT); 13546 SUITE_ADD_TEST(suite, zipVArraySmallDictGT); 13547 SUITE_ADD_TEST(suite, zipVCArraySmallDictGT); 13548 SUITE_ADD_TEST(suite, fromArraySmallDictGT); 13549 SUITE_ADD_TEST(suite, toArraySmallDictGT); 13550 SUITE_ADD_TEST(suite, writeFileSmallDictGT); 13551 SUITE_ADD_TEST(suite, writeFileSmallJsonSmallDictGT); 13552 SUITE_ADD_TEST(suite, writeFileSmallStringSmallDictGT); 13553 SUITE_ADD_TEST(suite, writeStreamSmallDictGT); 13554 SUITE_ADD_TEST(suite, appendFileSmallDictGT); 13555 SUITE_ADD_TEST(suite, appendFileSmallStringSmallDictGT); 13556 SUITE_ADD_TEST(suite, logSmallDictGT); 13557 SUITE_ADD_TEST(suite, typeSmallStringSmallDictGT); 13558 SUITE_ADD_TEST(suite, typeStringKCharSmallDictGT); 13559 SUITE_ADD_TEST(suite, typeSmallStringKCharSmallDictGT); 13560 SUITE_ADD_TEST(suite, cSmallDictT); 13561 13562 13563 CuSuiteRun(suite); 13564 CuSuiteDetails(suite, output); 13565 printf ("%s\n", output->buffer); 13566 return suite->failCount; 13567 }