libsheepy

C lib for handling text files, strings and json like data structure with an object oriented system
git clone https://spartatek.se/git/libsheepy.git
Log | Files | Refs | README | LICENSE

libsheepyCSmallJsonTest.c (1505731B)


      1 #include <stdlib.h>
      2 #include <stdio.h>
      3 #include <check.h>
      4 
      5 //START MEM TEST ANCHOR
      6 
      7 #include "../libsheepy.h"
      8 #include "../libsheepyObject.h"
      9 
     10 #ifdef __GNUC__
     11 #define UNUSED __attribute__ ((unused))
     12 #else
     13 #define UNUSED
     14 #endif
     15 
     16 // TODO redirect stderr
     17 
     18 
     19 START_TEST(createSJFT)
     20 
     21   smallJsont* r;
     22 
     23   r = createSJ("a", "bb");
     24   ck_assert_ptr_ne(r, NULL);
     25   char *s      = toStringO(r);
     26   ck_assert_str_eq(s, "[\"a\",\"bb\"]");
     27   free(s);
     28 
     29   terminateO(r);
     30 
     31 END_TEST
     32 
     33 
     34 START_TEST(getsoSmallJsonT)
     35 
     36   smallt* r;
     37   smallJsont *self = allocG(rtSmallJsont);
     38 
     39   // undefined
     40   freeO(self);
     41   createUndefined(u);
     42   setTopO(self, (baset*)&u);
     43   r = getsoO(self);
     44   ck_assert_ptr_eq(r, self->topU);
     45   // bool
     46   freeO(self);
     47   setTopBoolO(self, true);
     48   r = getsoO(self);
     49   ck_assert_ptr_eq(r, self->topB);
     50   // double
     51   freeO(self);
     52   setTopDoubleO(self, 1);
     53   r = getsoO(self);
     54   ck_assert_ptr_eq(r, self->topD);
     55   // int
     56   freeO(self);
     57   setTopIntO(self, 1);
     58   r = getsoO(self);
     59   ck_assert_ptr_eq(r, self->topI);
     60   // string
     61   freeO(self);
     62   setTopSO(self, "qwe");
     63   r = getsoO(self);
     64   ck_assert_ptr_eq(r, self->topS);
     65   // dict
     66   freeO(self);
     67   self->f->setS(self, "qwe", "asd");
     68   r = getsoO(self);
     69   ck_assert_ptr_eq(r, self->top);
     70   // array
     71   freeO(self);
     72   pushG(self, 1);
     73   r = getsoO(self);
     74   ck_assert_ptr_eq(r, self->topA);
     75   terminateO(self);
     76 
     77 END_TEST
     78 
     79 
     80 START_TEST(setsoSmallJsonT)
     81 
     82   smallJsont *self = allocG(rtSmallJsont);
     83   smallt *so;
     84 
     85   createSmallJson(src);
     86   // undefined
     87   createUndefined(u);
     88   setTopO(&src, (baset*)&u);
     89   so = getsoO(&src);
     90   resetO(&src);
     91   setsoO(self, so);
     92   ck_assert_ptr_eq(so, self->topU);
     93   freeO(self);
     94   // bool
     95   setTopBoolO(&src, true);
     96   so = getsoO(&src);
     97   resetO(&src);
     98   setsoO(self, so);
     99   ck_assert_ptr_eq(so, self->topB);
    100   freeO(self);
    101   // double
    102   setTopDoubleO(&src, 1);
    103   so = getsoO(&src);
    104   resetO(&src);
    105   setsoO(self, so);
    106   ck_assert_ptr_eq(so, self->topD);
    107   freeO(self);
    108   // int
    109   setTopIntO(&src, 1);
    110   so = getsoO(&src);
    111   resetO(&src);
    112   setsoO(self, so);
    113   ck_assert_ptr_eq(so, self->topI);
    114   freeO(self);
    115   // string
    116   setTopSO(&src, "qwe");
    117   so = getsoO(&src);
    118   resetO(&src);
    119   setsoO(self, so);
    120   ck_assert_ptr_eq(so, self->topS);
    121   freeO(self);
    122   // dict
    123   createSmallDict(d);
    124   (&d)->f->setS(&d, "1", "1");
    125   (&d)->f->setS(&d, "2", "2");
    126   char *as = null;
    127   // reset test: free iterElement in d
    128   iter(&d, E) {
    129     as = toStringO(E);
    130     break;
    131   }
    132   ck_assert_ptr_ne(as, null);
    133   ck_assert_str_eq(as, "1");
    134   free(as);
    135   so = (smallt*)getsoO(&d);
    136   resetO(&d);
    137   setsoO(self, so);
    138   ck_assert_ptr_eq(so, self->top);
    139   freeO(self);
    140   // array
    141   createSmallArray(a);
    142   pushG(&a, 1);
    143   pushG(&a, 2);
    144   as = null;
    145   // reset test: free iterElement in a
    146   iter(&a, E) {
    147     as = toStringO(E);
    148     break;
    149   }
    150   ck_assert_str_eq(as, "1");
    151   free(as);
    152   so = (smallt*)getsoO(&a);
    153   resetO(&a);
    154   setsoO(self, so);
    155   ck_assert_ptr_eq(so, self->topA);
    156   terminateO(self);
    157 
    158 END_TEST
    159 
    160 
    161 START_TEST(mirrorSmallJsonT)
    162 
    163   smallJsont* r;
    164   smallJsont *self = allocG(rtSmallJsont);
    165 
    166   // dict
    167   // empty self
    168   r = mirrorO(self);
    169   ck_assert_ptr_eq(r, null);
    170   // non empty with iterator
    171   self->f->setS(self, "1", "1");
    172   self->f->setS(self, "2", "2");
    173   char *as = null;
    174   iter(self, E) {
    175     as = toStringO(E);
    176     break;
    177   }
    178   ck_assert_str_eq(as, "1");
    179   free(as);
    180   r = mirrorO(self);
    181   ck_assert_ptr_eq(r->top, self->top);
    182   finishO(r);
    183   freeO(self);
    184   // array
    185   // empty self
    186   r = mirrorO(self);
    187   ck_assert_ptr_eq(r, null);
    188   // non empty with iterator
    189   pushG(self, 1);
    190   pushG(self, 2);
    191   as = null;
    192   iter(self, E) {
    193     as = toStringO(E);
    194     break;
    195   }
    196   ck_assert_str_eq(as, "1");
    197   free(as);
    198   r = mirrorO(self);
    199   ck_assert_ptr_eq(r->topA, self->topA);
    200   finishO(r);
    201   terminateO(self);
    202 
    203 END_TEST
    204 
    205 
    206 START_TEST(setTopBoolSmallJsonT)
    207 
    208   smallJsont* r;
    209   smallJsont *self = allocG(rtSmallJsont);
    210 
    211   r = setTopBoolO(self, true);
    212   ck_assert_ptr_ne(r, null);
    213   char *s = toStringO(r);
    214   ck_assert_str_eq(s, "true");
    215   free(s);
    216   terminateO(self);
    217 
    218 END_TEST
    219 
    220 
    221 START_TEST(setTopDoubleSmallJsonT)
    222 
    223   smallJsont* r;
    224   smallJsont *self = allocG(rtSmallJsont);
    225 
    226   r = setTopDoubleO(self, 2);
    227   ck_assert_ptr_ne(r, null);
    228   char *s = toStringO(r);
    229   ck_assert_str_eq(s, "2.000000e+00");
    230   free(s);
    231   terminateO(self);
    232 
    233 END_TEST
    234 
    235 
    236 START_TEST(setTopIntSmallJsonT)
    237 
    238   smallJsont* r;
    239   smallJsont *self = allocG(rtSmallJsont);
    240 
    241   r = setTopIntO(self, 2);
    242   ck_assert_ptr_ne(r, null);
    243   char *s = toStringO(r);
    244   ck_assert_str_eq(s, "2");
    245   free(s);
    246   terminateO(self);
    247 
    248 END_TEST
    249 
    250 
    251 START_TEST(setTopStringSmallJsonT)
    252 
    253   smallJsont* r;
    254   smallJsont *self = allocG(rtSmallJsont);
    255 
    256   r = setTopStringO(self, "qwe");
    257   ck_assert_ptr_ne(r, null);
    258   char *s = toStringO(r);
    259   ck_assert_str_eq(s, "qwe");
    260   free(s);
    261   // null
    262   ck_assert_ptr_eq(setTopStringO(self, null), null);
    263   terminateO(self);
    264 
    265 END_TEST
    266 
    267 
    268 START_TEST(setTopCharSmallJsonT)
    269 
    270   smallJsont* r;
    271   smallJsont *self = allocG(rtSmallJsont);
    272 
    273   r = setTopCharO(self, 'X');
    274   ck_assert_ptr_ne(r, null);
    275   char *s = toStringO(r);
    276   ck_assert_str_eq(s, "X");
    277   free(s);
    278   terminateO(self);
    279 
    280 END_TEST
    281 
    282 
    283 START_TEST(setTopDictSmallJsonT)
    284 
    285   smallJsont* r;
    286   smallJsont *self  = allocG(rtSmallJsont);
    287   smallDictt *value = allocSmallDict();
    288 
    289   r = setTopDictO(self, value);
    290   ck_assert_ptr_ne(r, null);
    291   finishG(value);
    292   char *s = toStringO(r);
    293   ck_assert_str_eq(s, "{}");
    294   free(s);
    295   // non smallDict value
    296   value = (smallDictt*) allocSmallInt(1);
    297   ck_assert_ptr_eq(setTopDictO(self, value), null);
    298   terminateO(value);
    299   // null
    300   ck_assert_ptr_eq(setTopDictO(self, null), null);
    301   terminateO(self);
    302 
    303 END_TEST
    304 
    305 
    306 START_TEST(setTopArraySmallJsonT)
    307 
    308   smallJsont* r;
    309   smallJsont *self   = allocG(rtSmallJsont);
    310   smallArrayt *value = allocSmallArray();
    311 
    312   r = setTopArrayO(self, value);
    313   ck_assert_ptr_ne(r, null);
    314   finishG(value);
    315   char *s = toStringO(r);
    316   ck_assert_str_eq(s, "[]");
    317   free(s);
    318   // non smallArray value
    319   value = (smallArrayt*) allocSmallInt(1);
    320   ck_assert_ptr_eq(setTopArrayO(self, value), null);
    321   terminateO(value);
    322   // null
    323   ck_assert_ptr_eq(setTopArrayO(self, null), null);
    324   terminateO(self);
    325 
    326 END_TEST
    327 
    328 
    329 START_TEST(setTopArraycSmallJsonT)
    330 
    331   smallJsont* r;
    332   smallJsont *self = allocG(rtSmallJsont);
    333   char **value     = listCreateS("a","bb");
    334 
    335   r = setTopArraycO(self, value);
    336   ck_assert_ptr_ne(r, null);
    337   listFreeS(value);
    338   char *s = toStringO(r);
    339   ck_assert_str_eq(s, "[\"a\",\"bb\"]");
    340   free(s);
    341   // null
    342   ck_assert_ptr_eq(setTopArraycO(self, null), null);
    343   terminateO(self);
    344 
    345 END_TEST
    346 
    347 
    348 START_TEST(setTopSmallBoolSmallJsonT)
    349 
    350   smallJsont* r;
    351   smallJsont *self  = allocG(rtSmallJsont);
    352   smallBoolt *value = allocSmallBool(true);
    353 
    354   r = setTopSmallBoolO(self, value);
    355   ck_assert_ptr_ne(r, null);
    356   finishG(value);
    357   char *s = toStringO(r);
    358   ck_assert_str_eq(s, "true");
    359   free(s);
    360   // non smallBool value
    361   value = (smallBoolt*) allocSmallInt(1);
    362   ck_assert_ptr_eq(setTopSmallBoolO(self, value), null);
    363   terminateO(value);
    364   // null
    365   ck_assert_ptr_eq(setTopSmallBoolO(self, null), null);
    366   terminateO(self);
    367 
    368 END_TEST
    369 
    370 
    371 START_TEST(setTopSmallDoubleSmallJsonT)
    372 
    373   smallJsont* r;
    374   smallJsont *self    = allocG(rtSmallJsont);
    375   smallDoublet *value = allocSmallDouble(2);
    376 
    377   r = setTopSmallDoubleO(self, value);
    378   ck_assert_ptr_ne(r, null);
    379   finishG(value);
    380   char *s = toStringO(r);
    381   ck_assert_str_eq(s, "2.000000e+00");
    382   free(s);
    383   // non smallDouble value
    384   value = (smallDoublet*) allocSmallInt(1);
    385   ck_assert_ptr_eq(setTopSmallDoubleO(self, value), null);
    386   terminateO(value);
    387   // null
    388   ck_assert_ptr_eq(setTopSmallDoubleO(self, null), null);
    389   terminateO(self);
    390 
    391 END_TEST
    392 
    393 
    394 START_TEST(setTopSmallIntSmallJsonT)
    395 
    396   smallJsont* r;
    397   smallJsont *self = allocG(rtSmallJsont);
    398   smallIntt *value = allocSmallInt(2);
    399 
    400   r = setTopSmallIntO(self, value);
    401   ck_assert_ptr_ne(r, null);
    402   finishG(value);
    403   char *s = toStringO(r);
    404   ck_assert_str_eq(s, "2");
    405   free(s);
    406   // non smallInt value
    407   value = (smallIntt*) allocSmallBool(true);
    408   ck_assert_ptr_eq(setTopSmallIntO(self, value), null);
    409   terminateO(value);
    410   // null
    411   ck_assert_ptr_eq(setTopSmallIntO(self, null), null);
    412   terminateO(self);
    413 
    414 END_TEST
    415 
    416 
    417 START_TEST(setTopSmallJsonSmallJsonT)
    418 
    419   smallJsont* r;
    420   smallJsont *self  = allocG(rtSmallJsont);
    421   smallJsont *value = allocSmallJson();
    422 
    423   r = self->f->setTopSmallJson(self, value);
    424   ck_assert_ptr_ne(r, null);
    425   finishG(value);
    426   char *s = toStringO(r);
    427   ck_assert_str_eq(s, "{}");
    428   free(s);
    429   // non smallJson value
    430   value = (smallJsont*) allocSmallInt(1);
    431   ck_assert_ptr_eq(self->f->setTopSmallJson(self, value), null);
    432   terminateO(value);
    433   // null
    434   ck_assert_ptr_eq(self->f->setTopSmallJson(self, null), null);
    435   terminateO(self);
    436 
    437 END_TEST
    438 
    439 
    440 START_TEST(setTopSmallStringSmallJsonT)
    441 
    442   smallJsont* r;
    443   smallJsont *self    = allocG(rtSmallJsont);
    444   smallStringt *value = allocSmallString("qwe");
    445 
    446   r = setTopSmallStringO(self, value);
    447   ck_assert_ptr_ne(r, null);
    448   finishG(value);
    449   char *s = toStringO(r);
    450   ck_assert_str_eq(s, "qwe");
    451   free(s);
    452   // non smallString value
    453   value = (smallStringt*) allocSmallInt(1);
    454   ck_assert_ptr_eq(setTopSmallStringO(self, value), null);
    455   terminateO(value);
    456   // null
    457   ck_assert_ptr_eq(setTopSmallStringO(self, null), null);
    458   terminateO(self);
    459 
    460 END_TEST
    461 
    462 
    463 START_TEST(setTopNFreeSmallJsonT)
    464 
    465   smallJsont* r;
    466   smallJsont *self = allocG(rtSmallJsont);
    467   baset *value     = (baset*)allocSmallInt(2);
    468 
    469   r = setTopNFreeO(self, value);
    470   ck_assert_ptr_ne(r, null);
    471   char *s = toStringO(r);
    472   ck_assert_str_eq(s, "2");
    473   free(s);
    474   terminateO(self);
    475 
    476 END_TEST
    477 
    478 
    479 START_TEST(setTopNFreeBoolSmallJsonT)
    480 
    481   smallJsont* r;
    482   smallJsont *self = allocG(rtSmallJsont);
    483 
    484   r = setTopNFreeBoolO(self, true);
    485   ck_assert_ptr_ne(r, null);
    486   char *s = toStringO(r);
    487   ck_assert_str_eq(s, "true");
    488   free(s);
    489   terminateO(self);
    490 
    491 END_TEST
    492 
    493 
    494 START_TEST(setTopNFreeDoubleSmallJsonT)
    495 
    496   smallJsont* r;
    497   smallJsont *self = allocG(rtSmallJsont);
    498 
    499   r = setTopNFreeDoubleO(self, 2);
    500   ck_assert_ptr_ne(r, null);
    501   char *s = toStringO(r);
    502   ck_assert_str_eq(s, "2.000000e+00");
    503   free(s);
    504   terminateO(self);
    505 
    506 END_TEST
    507 
    508 
    509 START_TEST(setTopNFreeIntSmallJsonT)
    510 
    511   smallJsont* r;
    512   smallJsont *self = allocG(rtSmallJsont);
    513 
    514   r = setTopNFreeIntO(self, 2);
    515   ck_assert_ptr_ne(r, null);
    516   char *s = toStringO(r);
    517   ck_assert_str_eq(s, "2");
    518   free(s);
    519   terminateO(self);
    520 
    521 END_TEST
    522 
    523 
    524 START_TEST(setTopNFreeStringSmallJsonT)
    525 
    526   smallJsont* r;
    527   smallJsont *self = allocG(rtSmallJsont);
    528   char *value      = strdup("qwe");
    529 
    530   r = setTopNFreeStringO(self, value);
    531   ck_assert_ptr_ne(r, null);
    532   char *s = toStringO(r);
    533   ck_assert_str_eq(s, "qwe");
    534   free(s);
    535   // null
    536   ck_assert_ptr_eq(setTopNFreeStringO(self, null), null);
    537   terminateO(self);
    538 
    539 END_TEST
    540 
    541 
    542 START_TEST(setTopNFreeDictSmallJsonT)
    543 
    544   smallJsont* r;
    545   smallJsont *self  = allocG(rtSmallJsont);
    546   smallDictt *value = allocSmallDict();
    547 
    548   r = setTopNFreeDictO(self, value);
    549   ck_assert_ptr_ne(r, null);
    550   char *s = toStringO(r);
    551   ck_assert_str_eq(s, "{}");
    552   free(s);
    553   // non smallDict value
    554   value = (smallDictt*) allocSmallInt(1);
    555   ck_assert_ptr_eq(setTopNFreeDictO(self, value), null);
    556   terminateO(value);
    557   // null
    558   ck_assert_ptr_eq(setTopNFreeDictO(self, null), null);
    559   terminateO(self);
    560 
    561 END_TEST
    562 
    563 
    564 START_TEST(setTopNFreeArraySmallJsonT)
    565 
    566   smallJsont* r;
    567   smallJsont *self   = allocG(rtSmallJsont);
    568   smallArrayt *value = allocSmallArray();
    569 
    570   r = setTopNFreeArrayO(self, value);
    571   ck_assert_ptr_ne(r, null);
    572   char *s = toStringO(r);
    573   ck_assert_str_eq(s, "[]");
    574   free(s);
    575   // non smallArray value
    576   value = (smallArrayt*) allocSmallInt(1);
    577   ck_assert_ptr_eq(setTopNFreeArrayO(self, value), null);
    578   terminateO(value);
    579   // null
    580   ck_assert_ptr_eq(setTopNFreeArrayO(self, null), null);
    581   terminateO(self);
    582 
    583 END_TEST
    584 
    585 
    586 START_TEST(setTopNFreeArraycSmallJsonT)
    587 
    588   smallJsont* r;
    589   smallJsont *self = allocG(rtSmallJsont);
    590   char **value     = listCreateS("a","bb");
    591 
    592   r = setTopNFreeArraycO(self, value);
    593   ck_assert_ptr_ne(r, null);
    594   char *s = toStringO(r);
    595   ck_assert_str_eq(s, "[\"a\",\"bb\"]");
    596   free(s);
    597   // null
    598   ck_assert_ptr_eq(setTopNFreeArraycO(self, null), null);
    599   terminateO(self);
    600 
    601 END_TEST
    602 
    603 
    604 START_TEST(setTopNFreeSmallBoolSmallJsonT)
    605 
    606   smallJsont* r;
    607   smallJsont *self  = allocG(rtSmallJsont);
    608   smallBoolt *value = allocSmallBool(true);
    609 
    610   r = setTopNFreeSmallBoolO(self, value);
    611   ck_assert_ptr_ne(r, null);
    612   char *s = toStringO(r);
    613   ck_assert_str_eq(s, "true");
    614   free(s);
    615   // non smallBool value
    616   value = (smallBoolt*) allocSmallInt(1);
    617   ck_assert_ptr_eq(setTopNFreeSmallBoolO(self, value), null);
    618   terminateO(value);
    619   // null
    620   ck_assert_ptr_eq(setTopNFreeSmallBoolO(self, null), null);
    621   terminateO(self);
    622 
    623 END_TEST
    624 
    625 
    626 START_TEST(setTopNFreeSmallDoubleSmallJsonT)
    627 
    628   smallJsont* r;
    629   smallJsont *self    = allocG(rtSmallJsont);
    630   smallDoublet *value = allocSmallDouble(2);
    631 
    632   r = setTopNFreeSmallDoubleO(self, value);
    633   ck_assert_ptr_ne(r, null);
    634   char *s = toStringO(r);
    635   ck_assert_str_eq(s, "2.000000e+00");
    636   free(s);
    637   // non smallDouble value
    638   value = (smallDoublet*) allocSmallInt(1);
    639   ck_assert_ptr_eq(setTopNFreeSmallDoubleO(self, value), null);
    640   terminateO(value);
    641   // null
    642   ck_assert_ptr_eq(setTopNFreeSmallDoubleO(self, null), null);
    643   terminateO(self);
    644 
    645 END_TEST
    646 
    647 
    648 START_TEST(setTopNFreeSmallIntSmallJsonT)
    649 
    650   smallJsont* r;
    651   smallJsont *self = allocG(rtSmallJsont);
    652   smallIntt *value = allocSmallInt(2);
    653 
    654   r = setTopNFreeSmallIntO(self, value);
    655   ck_assert_ptr_ne(r, null);
    656   char *s = toStringO(r);
    657   ck_assert_str_eq(s, "2");
    658   free(s);
    659   // non smallInt value
    660   value = (smallIntt*) allocSmallBool(true);
    661   ck_assert_ptr_eq(setTopNFreeSmallIntO(self, value), null);
    662   terminateO(value);
    663   // null
    664   ck_assert_ptr_eq(setTopNFreeSmallIntO(self, null), null);
    665   terminateO(self);
    666 
    667 END_TEST
    668 
    669 
    670 START_TEST(setTopNFreeSmallJsonSmallJsonT)
    671 
    672   smallJsont* r;
    673   smallJsont *self  = allocG(rtSmallJsont);
    674   smallJsont *value = allocSmallJson();
    675 
    676   r = self->f->setTopNFreeSmallJson(self, value);
    677   ck_assert_ptr_ne(r, null);
    678   char *s = toStringO(r);
    679   ck_assert_str_eq(s, "{}");
    680   free(s);
    681   // non smallJson value
    682   value = (smallJsont*) allocSmallInt(1);
    683   ck_assert_ptr_eq(self->f->setTopNFreeSmallJson(self, value), null);
    684   terminateO(value);
    685   // null
    686   ck_assert_ptr_eq(self->f->setTopNFreeSmallJson(self, null), null);
    687   terminateO(self);
    688 
    689 END_TEST
    690 
    691 
    692 START_TEST(setTopNFreeSmallStringSmallJsonT)
    693 
    694   smallJsont* r;
    695   smallJsont *self    = allocG(rtSmallJsont);
    696   smallStringt *value = allocSmallString("qwe");
    697 
    698   r = setTopNFreeSmallStringO(self, value);
    699   ck_assert_ptr_ne(r, null);
    700   char *s = toStringO(r);
    701   ck_assert_str_eq(s, "qwe");
    702   free(s);
    703   // non smallString value
    704   value = (smallStringt*) allocSmallInt(1);
    705   ck_assert_ptr_eq(setTopNFreeSmallStringO(self, value), null);
    706   terminateO(value);
    707   // null
    708   ck_assert_ptr_eq(setTopNFreeSmallStringO(self, null), null);
    709   terminateO(self);
    710 
    711 END_TEST
    712 
    713 
    714 START_TEST(fromArraySmallJsonT)
    715 
    716   smallJsont* r;
    717   smallJsont *self = allocG(rtSmallJsont);
    718   char **array;
    719   size_t size = 3;
    720 
    721   // libsheepy list
    722   array = listCreateS("a", "bb", "ccc");
    723   r = fromArrayO(self, array, 0);
    724   ck_assert_ptr_eq(self, r);
    725   char *s = toStringO(r);
    726   ck_assert_str_eq(s, "[\"a\",\"bb\",\"ccc\"]");
    727   free(s);
    728   listFreeS(array);
    729   // array with strings
    730   freeO(self);
    731   array = allocArray(array, size+1);
    732   array[0] = strdup("a1");
    733   array[1] = strdup("bb1");
    734   array[2] = strdup("ccc1");
    735   array[3] = array[2];
    736   r = fromArrayO(self, array, size);
    737   ck_assert_ptr_eq(self, r);
    738   s = toStringO(r);
    739   ck_assert_str_eq(s, "[\"a1\",\"bb1\",\"ccc1\"]");
    740   free(s);
    741   // null in array
    742   freeO(self);
    743   char *elem = array[0];
    744   array[0]   = null;
    745   r = fromArrayO(self, array, size);
    746   ck_assert_ptr_eq(self, r);
    747   s = toStringO(r);
    748   ck_assert_str_eq(s, "[\"bb1\",\"ccc1\"]");
    749   ck_assert_uint_eq(lenO(self), 3);
    750   free(s);
    751   array[0] = elem;
    752   // json dict
    753   freeO(self);
    754   setTypeIntO(self);
    755   r = fromArrayO(self, array, 1);
    756   ck_assert_ptr_eq(r, null);
    757   array[3] = null;
    758   listFreeS(array);
    759   // NULL array
    760   r = fromArrayO(self, null, 1);
    761   ck_assert_ptr_eq(r, null);
    762   terminateO(self);
    763 
    764 END_TEST
    765 
    766 
    767 START_TEST(fromArrayNFreeSmallJsonT)
    768 
    769   smallJsont* r;
    770   smallJsont *self = allocSmallJson();
    771   char **array;
    772   size_t size = 3;
    773 
    774   // libsheepy list
    775   array = listCreateS("a", "bb", "ccc");
    776   r = fromArrayNFreeO(self, array, 0);
    777   ck_assert_ptr_eq(self, r);
    778   char *s = toStringO(r);
    779   ck_assert_str_eq(s, "[\"a\",\"bb\",\"ccc\"]");
    780   free(s);
    781   // array with strings
    782   array = allocArray(array, size);
    783   array[0] = strdup("a1");
    784   array[1] = strdup("bb1");
    785   array[2] = strdup("ccc1");
    786   r = fromArrayNFreeO(self, array, size);
    787   ck_assert_ptr_eq(self, r);
    788   s = toStringO(r);
    789   ck_assert_str_eq(s, "[\"a1\",\"bb1\",\"ccc1\"]");
    790   free(s);
    791   // NULL array
    792   r = fromArrayNFreeO(self, null, 1);
    793   ck_assert_ptr_eq(r, null);
    794   terminateO(self);
    795 
    796 END_TEST
    797 
    798 
    799 START_TEST(fromArrayDictSmallJsonT)
    800 
    801   smallJsont* r;
    802   smallJsont *self   = allocG(rtSmallJsont);
    803   smallArrayt *items = allocSmallArray();
    804 
    805   self->f->setInt(self, "", 1);
    806   // ignored item
    807   items->f->pushS(items, "ignored");
    808   createAllocateSmallArray(a);
    809   a->f->pushS(a, "a");
    810   a->f->pushInt(a, 1);
    811   items->f->pushNFreeArray(items, a);
    812   a = allocSmallArray();
    813   items->f->pushNFreeArray(items, a);
    814   a = allocSmallArray();
    815   a->f->pushInt(a, 1);
    816   a->f->pushInt(a, 2);
    817   items->f->pushNFreeArray(items, a);
    818   r = fromArrayDictO(self, items);
    819   ck_assert_ptr_ne(r, NULL);
    820   char *s = toStringO(r);
    821   ck_assert_str_eq(s, "{\"\":1,\"a\":1}");
    822   free(s);
    823   // empty json
    824   freeO(self);
    825   r = fromArrayDictO(self, items);
    826   ck_assert_ptr_ne(r, NULL);
    827   s = toStringO(r);
    828   ck_assert_str_eq(s, "{\"a\":1}");
    829   free(s);
    830   // non json dict
    831   freeO(self);
    832   setTypeIntO(self);
    833   r = fromArrayDictO(self, items);
    834   ck_assert_ptr_eq(r, NULL);
    835   terminateO(items);
    836   // non smallArray items
    837   freeO(self);
    838   items = (smallArrayt*) allocSmallInt(2);
    839   r = fromArrayDictO(self, items);
    840   ck_assert_ptr_eq(r, NULL);
    841   // null items
    842   r = fromArrayDictO(self, null);
    843   ck_assert_ptr_eq(r, NULL);
    844   terminateO(items);
    845   terminateO(self);
    846 
    847 END_TEST
    848 
    849 
    850 START_TEST(toArrayDictSmallJsonT)
    851 
    852   smallArrayt* r;
    853   smallJsont *self = allocG(rtSmallJsont);
    854 
    855   parseO(self, "{\"a\":2,\"bb\":4}");
    856 
    857   r = toArrayDictO(self);
    858   ck_assert_ptr_ne(r, null);
    859   char *s = toStringO(r);
    860   terminateO(r);
    861   ck_assert_str_eq(s, "[[\"a\",2],[\"bb\",4]]");
    862   free(s);
    863   // empty self
    864   freeO(self);
    865   setTypeDictO(self);
    866   ck_assert_ptr_eq(toArrayDictO(self), null);
    867   // non json dict
    868   freeO(self);
    869   ck_assert_ptr_eq(toArrayDictO(self), null);
    870   terminateO(self);
    871 
    872 END_TEST
    873 
    874 
    875 START_TEST(getTopUndefinedSmallJsonT)
    876 
    877   undefinedt*   r  = allocUndefined();
    878   smallJsont *self = allocG(rtSmallJsont);
    879 
    880   setTopO(self, (baset*) r);
    881   finishO(r);
    882   r = getTopUndefinedO(self);
    883   ck_assert_ptr_ne(r, null);
    884   char *s = toStringO(r);
    885   finishO(r);
    886   ck_assert_str_eq(s, "null");
    887   free(s);
    888   // non json undefined
    889   freeO(self);
    890   ck_assert_ptr_eq(getTopUndefinedO(self), null);
    891   terminateO(self);
    892 
    893 END_TEST
    894 
    895 
    896 START_TEST(getTopBoolSmallJsonT)
    897 
    898   bool          r;
    899   smallJsont *self = allocG(rtSmallJsont);
    900 
    901   setTopBoolO(self, true);
    902   r = getTopBoolO(self);
    903   ck_assert(r);
    904   terminateO(self);
    905 
    906 END_TEST
    907 
    908 
    909 START_TEST(getTopBoolPSmallJsonT)
    910 
    911   bool*         r;
    912   smallJsont *self = allocG(rtSmallJsont);
    913 
    914   setTopBoolO(self, true);
    915   r = getTopBoolPO(self);
    916   ck_assert_ptr_ne(r, null);
    917   ck_assert(*r);
    918   terminateO(self);
    919 
    920 END_TEST
    921 
    922 
    923 START_TEST(getTopDoubleSmallJsonT)
    924 
    925   double        r;
    926   smallJsont *self = allocG(rtSmallJsont);
    927 
    928   setTopDoubleO(self, 2);
    929   r = getTopDoubleO(self);
    930   ck_assert(r==2);
    931   terminateO(self);
    932 
    933 END_TEST
    934 
    935 
    936 START_TEST(getTopDoublePSmallJsonT)
    937 
    938   double*       r;
    939   smallJsont *self = allocG(rtSmallJsont);
    940 
    941   setTopDoubleO(self, 2);
    942   r = getTopDoublePO(self);
    943   ck_assert_ptr_ne(r, null);
    944   ck_assert(*r==2);
    945   terminateO(self);
    946 
    947 END_TEST
    948 
    949 
    950 START_TEST(getTopIntSmallJsonT)
    951 
    952   int64_t       r;
    953   smallJsont *self = allocG(rtSmallJsont);
    954 
    955   setTopIntO(self, 3);
    956   r = getTopIntO(self);
    957   ck_assert_int_eq(r, 3);
    958   terminateO(self);
    959 
    960 END_TEST
    961 
    962 
    963 START_TEST(getTopIntPSmallJsonT)
    964 
    965   int64_t*      r;
    966   smallJsont *self = allocG(rtSmallJsont);
    967 
    968   setTopIntO(self, 3);
    969   r = getTopIntPO(self);
    970   ck_assert_ptr_ne(r, null);
    971   ck_assert_int_eq(*r, 3);
    972   terminateO(self);
    973 
    974 END_TEST
    975 
    976 
    977 START_TEST(getTopInt32SmallJsonT)
    978 
    979   int32_t       r;
    980   smallJsont *self = allocG(rtSmallJsont);
    981 
    982   setTopIntO(self, 3);
    983   r = getTopInt32O(self);
    984   ck_assert_int_eq(r, 3);
    985   terminateO(self);
    986 
    987 END_TEST
    988 
    989 
    990 START_TEST(getTopInt32PSmallJsonT)
    991 
    992   int32_t*      r;
    993   smallJsont *self = allocG(rtSmallJsont);
    994 
    995   setTopIntO(self, 3);
    996   r = getTopInt32PO(self);
    997   ck_assert_ptr_ne(r, null);
    998   ck_assert_int_eq(*r, 3);
    999   terminateO(self);
   1000 
   1001 END_TEST
   1002 
   1003 
   1004 START_TEST(getTopUintSmallJsonT)
   1005 
   1006   uint64_t      r;
   1007   smallJsont *self = allocG(rtSmallJsont);
   1008 
   1009   setTopIntO(self, 3);
   1010   r = getTopUintO(self);
   1011   ck_assert_int_eq(r, 3);
   1012   terminateO(self);
   1013 
   1014 END_TEST
   1015 
   1016 
   1017 START_TEST(getTopUintPSmallJsonT)
   1018 
   1019   uint64_t*     r;
   1020   smallJsont *self = allocG(rtSmallJsont);
   1021 
   1022   setTopIntO(self, 3);
   1023   r = getTopUintPO(self);
   1024   ck_assert_ptr_ne(r, null);
   1025   ck_assert_int_eq(*r, 3);
   1026   terminateO(self);
   1027 
   1028 END_TEST
   1029 
   1030 
   1031 START_TEST(getTopUint32SmallJsonT)
   1032 
   1033   uint32_t      r;
   1034   smallJsont *self = allocG(rtSmallJsont);
   1035 
   1036   setTopIntO(self, 3);
   1037   r = getTopUint32O(self);
   1038   ck_assert_int_eq(r, 3);
   1039   terminateO(self);
   1040 
   1041 END_TEST
   1042 
   1043 
   1044 START_TEST(getTopUint32PSmallJsonT)
   1045 
   1046   uint32_t*     r;
   1047   smallJsont *self = allocG(rtSmallJsont);
   1048 
   1049   setTopIntO(self, 3);
   1050   r = getTopUint32PO(self);
   1051   ck_assert_ptr_ne(r, null);
   1052   ck_assert_int_eq(*r, 3);
   1053   terminateO(self);
   1054 
   1055 END_TEST
   1056 
   1057 
   1058 START_TEST(getTopSSmallJsonT)
   1059 
   1060   char*         r;
   1061   smallJsont *self = allocG(rtSmallJsont);
   1062 
   1063   setTopStringO(self, "qwe");
   1064   r = getTopSO(self);
   1065   ck_assert_ptr_ne(r, null);
   1066   ck_assert_str_eq(r, "qwe");
   1067   terminateO(self);
   1068 
   1069 END_TEST
   1070 
   1071 
   1072 START_TEST(getTopDictSmallJsonT)
   1073 
   1074   smallDictt*   r  = allocSmallDict();
   1075   smallJsont *self = allocG(rtSmallJsont);
   1076 
   1077   setTopNFreeDictO(self, r);
   1078   r = getTopDictO(self);
   1079   ck_assert_ptr_ne(r, null);
   1080   char *s = toStringO(r);
   1081   finishO(r);
   1082   ck_assert_str_eq(s, "{}");
   1083   free(s);
   1084   // non json dict
   1085   freeO(self);
   1086   ck_assert_ptr_eq(getTopDictO(self), null);
   1087   terminateO(self);
   1088 
   1089 END_TEST
   1090 
   1091 
   1092 START_TEST(getTopArraySmallJsonT)
   1093 
   1094   smallArrayt*  r  = allocSmallArray();
   1095   smallJsont *self = allocG(rtSmallJsont);
   1096 
   1097   setTopNFreeArrayO(self, r);
   1098   r = getTopArrayO(self);
   1099   ck_assert_ptr_ne(r, null);
   1100   char *s = toStringO(r);
   1101   finishO(r);
   1102   ck_assert_str_eq(s, "[]");
   1103   free(s);
   1104   // non json array
   1105   freeO(self);
   1106   ck_assert_ptr_eq(getTopArrayO(self), null);
   1107   terminateO(self);
   1108 
   1109 END_TEST
   1110 
   1111 
   1112 START_TEST(getTopSmallBoolSmallJsonT)
   1113 
   1114   smallBoolt*   r  = allocSmallBool(true);
   1115   smallJsont *self = allocG(rtSmallJsont);
   1116 
   1117   setTopNFreeSmallBoolO(self, r);
   1118   r = getTopSmallBoolO(self);
   1119   ck_assert_ptr_ne(r, null);
   1120   char *s = toStringO(r);
   1121   finishO(r);
   1122   ck_assert_str_eq(s, "true");
   1123   free(s);
   1124   // non json bool
   1125   freeO(self);
   1126   ck_assert_ptr_eq(getTopSmallBoolO(self), null);
   1127   terminateO(self);
   1128 
   1129 END_TEST
   1130 
   1131 
   1132 START_TEST(getTopSmallDoubleSmallJsonT)
   1133 
   1134   smallDoublet* r  = allocSmallDouble(2);
   1135   smallJsont *self = allocG(rtSmallJsont);
   1136 
   1137   setTopNFreeSmallDoubleO(self, r);
   1138   r = getTopSmallDoubleO(self);
   1139   ck_assert_ptr_ne(r, null);
   1140   char *s = toStringO(r);
   1141   finishO(r);
   1142   ck_assert_str_eq(s, "2.000000e+00");
   1143   free(s);
   1144   // non json double
   1145   freeO(self);
   1146   ck_assert_ptr_eq(getTopSmallDoubleO(self), null);
   1147   terminateO(self);
   1148 
   1149 END_TEST
   1150 
   1151 
   1152 START_TEST(getTopSmallIntSmallJsonT)
   1153 
   1154   smallIntt* r     = allocSmallInt(2);
   1155   smallJsont *self = allocG(rtSmallJsont);
   1156 
   1157   setTopNFreeSmallIntO(self, r);
   1158   r = getTopSmallIntO(self);
   1159   ck_assert_ptr_ne(r, null);
   1160   char *s = toStringO(r);
   1161   finishO(r);
   1162   ck_assert_str_eq(s, "2");
   1163   free(s);
   1164   // non json int
   1165   freeO(self);
   1166   ck_assert_ptr_eq(getTopSmallIntO(self), null);
   1167   terminateO(self);
   1168 
   1169 END_TEST
   1170 
   1171 
   1172 START_TEST(getTopSmallStringSmallJsonT)
   1173 
   1174   smallStringt* r  = allocSmallString("qwe");
   1175   smallJsont *self = allocG(rtSmallJsont);
   1176 
   1177   setTopNFreeSmallStringO(self, r);
   1178   r = getTopSmallStringO(self);
   1179   ck_assert_ptr_ne(r, null);
   1180   char *s = toStringO(r);
   1181   finishO(r);
   1182   ck_assert_str_eq(s, "qwe");
   1183   free(s);
   1184   // non json string
   1185   freeO(self);
   1186   ck_assert_ptr_eq(getTopSmallStringO(self), null);
   1187   terminateO(self);
   1188 
   1189 END_TEST
   1190 
   1191 
   1192 START_TEST(keyIsSmallJsonT)
   1193 
   1194   jsonPathRest r;
   1195   smallJsont *self = allocG(rtSmallJsont);
   1196 
   1197   // array path
   1198   r = keyIsO(self, "[123].\"wef\"");
   1199   ck_assert_int_eq(r, ARRAY_PATH);
   1200   // dict path
   1201   r = keyIsO(self, "\"wef\"[-123]");
   1202   ck_assert_int_eq(r, DICT_PATH);
   1203   // not a path
   1204   r = keyIsO(self, "[\"");
   1205   ck_assert_int_eq(r, NOT_A_PATH);
   1206   r = keyIsO(self, "[[123]");
   1207   ck_assert_int_eq(r, NOT_A_PATH);
   1208   r = keyIsO(self, "[123]]");
   1209   ck_assert_int_eq(r, NOT_A_PATH);
   1210   r = keyIsO(self, "[123]qwe");
   1211   ck_assert_int_eq(r, NOT_A_PATH);
   1212   r = keyIsO(self, "['123]");
   1213   ck_assert_int_eq(r, NOT_A_PATH);
   1214   r = keyIsO(self, "[1-]");
   1215   ck_assert_int_eq(r, NOT_A_PATH);
   1216   // null key
   1217   r = keyIsO(self, null);
   1218   ck_assert_int_eq(r, KEY_IS_NULL);
   1219   terminateO(self);
   1220 
   1221 END_TEST
   1222 
   1223 
   1224 START_TEST(keyIsSSmallJsonT)
   1225 
   1226   const char* r;
   1227   smallJsont *self = allocG(rtSmallJsont);
   1228 
   1229   // array path
   1230   r = keyIsSO(self, "[123].\"wef\"");
   1231   ck_assert_ptr_ne(r, null);
   1232   ck_assert_str_eq(r, "ARRAY_PATH");
   1233   // dict path
   1234   r = keyIsSO(self, "\"wef\"[-123]");
   1235   ck_assert_ptr_ne(r, null);
   1236   ck_assert_str_eq(r, "DICT_PATH");
   1237   // not a path
   1238   r = keyIsSO(self, "key");
   1239   ck_assert_ptr_ne(r, null);
   1240   ck_assert_str_eq(r, "NOT_A_PATH");
   1241   // null key
   1242   r = keyIsSO(self, null);
   1243   ck_assert_ptr_eq(r, null);
   1244   terminateO(self);
   1245 
   1246 END_TEST
   1247 
   1248 
   1249 START_TEST(makeKeySmallJsonT)
   1250 
   1251   char*  r;
   1252   smallJsont *self = allocG(rtSmallJsont);
   1253 
   1254 
   1255   r = makeKeyO(self, "\"\\asd");
   1256   ck_assert_ptr_ne(r, null);
   1257   ck_assert_str_eq(r, "\"\\\"\\\\asd\"");
   1258   free(r);
   1259   // null key
   1260   r = makeKeyO(self, null);
   1261   ck_assert_ptr_eq(r, null);
   1262   terminateO(self);
   1263 
   1264 END_TEST
   1265 
   1266 
   1267 START_TEST(iMakeKeySmallJsonT)
   1268 
   1269   char*  r;
   1270   smallJsont *self = allocG(rtSmallJsont);
   1271   char *key = strdup("qwe");
   1272 
   1273   r = iMakeKeyO(self, &key);
   1274   ck_assert_ptr_ne(r, null);
   1275   ck_assert_ptr_eq(r, key);
   1276   ck_assert_str_eq(r, "\"qwe\"");
   1277   // null key
   1278   freen(key);
   1279   r = iMakeKeyO(self, &key);
   1280   ck_assert_ptr_eq(r, null);
   1281   r = iMakeKeyO(self, null);
   1282   ck_assert_ptr_eq(r, null);
   1283   terminateO(self);
   1284 
   1285 END_TEST
   1286 
   1287 
   1288 START_TEST(bMakeKeySmallJsonT)
   1289 
   1290   char*  r;
   1291   smallJsont *self = allocG(rtSmallJsont);
   1292   char dest[20];
   1293 
   1294   r = bMakeKeyO(self, dest, "\"\\123");
   1295   ck_assert_ptr_ne(r, null);
   1296   ck_assert_str_eq(r, "\"\\\"\\\\123\"");
   1297   // null
   1298   r = bMakeKeyO(self, dest, null);
   1299   ck_assert_ptr_eq(r, null);
   1300   r = bMakeKeyO(self, null, "\"\\123");
   1301   ck_assert_ptr_eq(r, null);
   1302   terminateO(self);
   1303 
   1304 END_TEST
   1305 
   1306 
   1307 START_TEST(bLMakeKeySmallJsonT)
   1308 
   1309   char*  r;
   1310   smallJsont *self = allocG(rtSmallJsont);
   1311   char dest[20];
   1312 
   1313   r = bLMakeKeyO(self, dest, sizeof(dest), "\"\\123");
   1314   ck_assert_ptr_ne(r, null);
   1315   ck_assert_str_eq(r, "\"\\\"\\\\123\"");
   1316   // just enough space
   1317   r = bLMakeKeyO(self, dest, 10, "\"\\123");
   1318   ck_assert_ptr_ne(r, null);
   1319   ck_assert_str_eq(r, "\"\\\"\\\\123\"");
   1320   // dest too short
   1321   r = bLMakeKeyO(self, dest, 9, "\"\\123");
   1322   ck_assert_ptr_eq(r, null);
   1323   // null
   1324   r = bLMakeKeyO(self, dest, 45, null);
   1325   ck_assert_ptr_eq(r, null);
   1326   r = bLMakeKeyO(self, null, 4, "\"\\123");
   1327   ck_assert_ptr_eq(r, null);
   1328   r = bLMakeKeyO(self, dest, 0, "\"\\123");
   1329   ck_assert_ptr_eq(r, null);
   1330   terminateO(self);
   1331 
   1332 END_TEST
   1333 
   1334 
   1335 START_TEST(makeKeyLenSmallJsonT)
   1336 
   1337   size_t r;
   1338   smallJsont *self = allocG(rtSmallJsont);
   1339 
   1340   r = makeKeyLenO(self, "\"\\asd");
   1341   ck_assert_int_eq(r, 9);
   1342   r = makeKeyLenO(self, "");
   1343   ck_assert_int_eq(r, 2);
   1344   // null
   1345   ck_assert_int_eq(makeKeyLenO(self, null), 0);
   1346   terminateO(self);
   1347 
   1348 END_TEST
   1349 
   1350 
   1351 START_TEST(setSmallJsonT)
   1352 
   1353   smallJsont* r;
   1354   smallJsont *self = allocSmallJson();
   1355   baset *value     = (baset*) allocSmallInt(1);
   1356 
   1357   r = self->f->set(self, "1", value);
   1358   ck_assert_ptr_ne(r, null);
   1359   finishO(value);
   1360   char *s = toStringO(r);
   1361   ck_assert_str_eq(s, "{\"1\":1}");
   1362   free(s);
   1363   // path
   1364   value = (baset*) allocSmallInt(2);
   1365   createSmallArray(a);
   1366   createSmallDict(d);
   1367   a.f->pushDict(&a, &d);
   1368   self->f->setArray(self, "array", &a);
   1369   r = self->f->set(self, "\"array\"[0].\"key\"", value);
   1370   ck_assert_ptr_ne(r, null);
   1371   finishO(value);
   1372   s = toStringO(r);
   1373   ck_assert_str_eq(s, "{\"1\":1,\"array\":[{\"key\":2}]}");
   1374   free(s);
   1375   // json bool
   1376   freeO(self);
   1377   value = (baset*) allocSmallInt(2);
   1378   setTypeBoolO(self);
   1379   r = self->f->set(self, "1", value);
   1380   ck_assert_ptr_eq(r, null);
   1381   // json array
   1382   freeO(self);
   1383   setTypeArrayO(self);
   1384   r = self->f->set(self, "1", value);
   1385   ck_assert_ptr_eq(r, null);
   1386   // non existing dict path
   1387   freeO(self);
   1388   r = self->f->set(self, "\"1\"[1]", value);
   1389   ck_assert_ptr_eq(r, null);
   1390   //    wrong path and empty smallInt container (sInt is allocated in toSmallt)
   1391   createSmallInt(i);
   1392   r = self->f->set(self, "\"1\".[1]", (baset*)&i);
   1393   ck_assert_ptr_eq(r, null);
   1394   freeO(&i);
   1395   //    wrong path and user class
   1396   i.type = "myclass";
   1397   r = self->f->set(self, "\"1\".[1]", (baset*)&i);
   1398   ck_assert_ptr_eq(r, null);
   1399   //   dict path but the object is an array
   1400   resetO(&a);
   1401   self->f->setArray(self, "1", &a);
   1402   r = self->f->set(self, "\"1\".\"1\"", value);
   1403   ck_assert_ptr_eq(r, null);
   1404   //   dict object in path but the key doesn't exists
   1405   resetO(&d);
   1406   self->f->setDict(self, "2", &d);
   1407   r = self->f->set(self, "\"2\".\"1\".[12]", value);
   1408   ck_assert_ptr_eq(r, null);
   1409   // null key
   1410   r = self->f->set(self, null, value);
   1411   ck_assert_ptr_eq(r, null);
   1412   terminateO(value);
   1413   terminateO(self);
   1414 
   1415 END_TEST
   1416 
   1417 
   1418 START_TEST(setUndefinedSmallJsonT)
   1419 
   1420   smallJsont* r;
   1421   smallJsont *self = allocSmallJson();
   1422 
   1423   r = self->f->setUndefined(self, "1");
   1424   ck_assert_ptr_ne(r, null);
   1425   char *s = toStringO(r);
   1426   ck_assert_str_eq(s, "{\"1\":null}");
   1427   free(s);
   1428   // path
   1429   createSmallArray(a);
   1430   createSmallDict(d);
   1431   a.f->pushDict(&a, &d);
   1432   self->f->setArray(self, "array", &a);
   1433   r = self->f->setUndefined(self, "\"array\"[0].\"key\"");
   1434   ck_assert_ptr_ne(r, null);
   1435   s = toStringO(r);
   1436   ck_assert_str_eq(s, "{\"1\":null,\"array\":[{\"key\":null}]}");
   1437   free(s);
   1438   // json bool
   1439   freeO(self);
   1440   setTypeBoolO(self);
   1441   r = self->f->setUndefined(self, "1");
   1442   ck_assert_ptr_eq(r, null);
   1443   // json array
   1444   freeO(self);
   1445   setTypeArrayO(self);
   1446   r = self->f->setUndefined(self, "1");
   1447   ck_assert_ptr_eq(r, null);
   1448   // non existing dict path
   1449   freeO(self);
   1450   r = self->f->setUndefined(self, "\"1\"[1]");
   1451   ck_assert_ptr_eq(r, null);
   1452   //   dict path but the object is an array
   1453   resetO(&a);
   1454   self->f->setArray(self, "1", &a);
   1455   r = self->f->setUndefined(self, "\"1\".\"1\"");
   1456   ck_assert_ptr_eq(r, null);
   1457   //   dict object in path but the key doesn't exists
   1458   resetO(&d);
   1459   self->f->setDict(self, "2", &d);
   1460   r = self->f->setUndefined(self, "\"2\".\"1\".[12]");
   1461   ck_assert_ptr_eq(r, null);
   1462   // null key
   1463   r = self->f->setUndefined(self, null);
   1464   ck_assert_ptr_eq(r, null);
   1465   terminateO(self);
   1466 
   1467 END_TEST
   1468 
   1469 
   1470 START_TEST(setBoolSmallJsonT)
   1471 
   1472   smallJsont* r;
   1473   smallJsont *self = allocSmallJson();
   1474 
   1475   r = self->f->setBool(self, "1", true);
   1476   ck_assert_ptr_ne(r, null);
   1477   char *s = toStringO(r);
   1478   ck_assert_str_eq(s, "{\"1\":true}");
   1479   free(s);
   1480   // path
   1481   createSmallArray(a);
   1482   createSmallDict(d);
   1483   a.f->pushDict(&a, &d);
   1484   self->f->setArray(self, "array", &a);
   1485   r = self->f->setBool(self, "\"array\"[0].\"key\"", false);
   1486   ck_assert_ptr_ne(r, null);
   1487   s = toStringO(r);
   1488   ck_assert_str_eq(s, "{\"1\":true,\"array\":[{\"key\":false}]}");
   1489   free(s);
   1490   // json bool
   1491   freeO(self);
   1492   setTypeBoolO(self);
   1493   r = self->f->setBool(self, "1", true);
   1494   ck_assert_ptr_eq(r, null);
   1495   // json array
   1496   freeO(self);
   1497   setTypeArrayO(self);
   1498   r = self->f->setBool(self, "1", true);
   1499   ck_assert_ptr_eq(r, null);
   1500   // non existing dict path
   1501   freeO(self);
   1502   r = self->f->setBool(self, "\"1\"[1]", true);
   1503   ck_assert_ptr_eq(r, null);
   1504   //   dict path but the object is an array
   1505   resetO(&a);
   1506   self->f->setArray(self, "1", &a);
   1507   r = self->f->setBool(self, "\"1\".\"1\"", true);
   1508   ck_assert_ptr_eq(r, null);
   1509   //   dict object in path but the key doesn't exists
   1510   resetO(&d);
   1511   self->f->setDict(self, "2", &d);
   1512   r = self->f->setBool(self, "\"2\".\"1\".[12]", true);
   1513   ck_assert_ptr_eq(r, null);
   1514   // null key
   1515   r = self->f->setBool(self, null, false);
   1516   ck_assert_ptr_eq(r, null);
   1517   terminateO(self);
   1518 
   1519 END_TEST
   1520 
   1521 
   1522 START_TEST(setDoubleSmallJsonT)
   1523 
   1524   smallJsont* r;
   1525   smallJsont *self = allocSmallJson();
   1526 
   1527   r = self->f->setDouble(self, "1", 2.2);
   1528   ck_assert_ptr_ne(r, null);
   1529   char *s = toStringO(r);
   1530   ck_assert_str_eq(s, "{\"1\":2.200000e+00}");
   1531   free(s);
   1532   // path
   1533   createSmallArray(a);
   1534   createSmallDict(d);
   1535   a.f->pushDict(&a, &d);
   1536   self->f->setArray(self, "array", &a);
   1537   r = self->f->setDouble(self, "\"array\"[0].\"key\"", 1.2);
   1538   ck_assert_ptr_ne(r, null);
   1539   s = toStringO(r);
   1540   ck_assert_str_eq(s, "{\"1\":2.200000e+00,\"array\":[{\"key\":1.200000e+00}]}");
   1541   free(s);
   1542   // json bool
   1543   freeO(self);
   1544   setTypeBoolO(self);
   1545   r = self->f->setDouble(self, "1", 2.2);
   1546   ck_assert_ptr_eq(r, null);
   1547   // json array
   1548   freeO(self);
   1549   setTypeArrayO(self);
   1550   r = self->f->setDouble(self, "1", 2.2);
   1551   ck_assert_ptr_eq(r, null);
   1552   // non existing dict path
   1553   freeO(self);
   1554   r = self->f->setDouble(self, "\"1\"[1]", 2.2);
   1555   ck_assert_ptr_eq(r, null);
   1556   //   dict path but the object is an array
   1557   resetO(&a);
   1558   self->f->setArray(self, "1", &a);
   1559   r = self->f->setDouble(self, "\"1\".\"1\"", 2.2);
   1560   ck_assert_ptr_eq(r, null);
   1561   //   dict object in path but the key doesn't exists
   1562   resetO(&d);
   1563   self->f->setDict(self, "2", &d);
   1564   r = self->f->setDouble(self, "\"2\".\"1\".[12]", 2.2);
   1565   ck_assert_ptr_eq(r, null);
   1566   // null key
   1567   r = self->f->setDouble(self, null, 1);
   1568   ck_assert_ptr_eq(r, null);
   1569   terminateO(self);
   1570 
   1571 END_TEST
   1572 
   1573 
   1574 START_TEST(setIntSmallJsonT)
   1575 
   1576   smallJsont* r;
   1577   smallJsont *self = allocSmallJson();
   1578 
   1579   r = self->f->setInt(self, "1", 2);
   1580   ck_assert_ptr_ne(r, null);
   1581   char *s = toStringO(r);
   1582   ck_assert_str_eq(s, "{\"1\":2}");
   1583   free(s);
   1584   // path
   1585   createSmallArray(a);
   1586   createSmallDict(d);
   1587   a.f->pushDict(&a, &d);
   1588   self->f->setArray(self, "array", &a);
   1589   r = self->f->setInt(self, "\"array\"[0].\"key\"", 4);
   1590   ck_assert_ptr_ne(r, null);
   1591   s = toStringO(r);
   1592   ck_assert_str_eq(s, "{\"1\":2,\"array\":[{\"key\":4}]}");
   1593   free(s);
   1594   // json bool
   1595   freeO(self);
   1596   setTypeBoolO(self);
   1597   r = self->f->setInt(self, "1", 1);
   1598   ck_assert_ptr_eq(r, null);
   1599   // json array
   1600   freeO(self);
   1601   setTypeArrayO(self);
   1602   r = self->f->setInt(self, "1", 1);
   1603   ck_assert_ptr_eq(r, null);
   1604   // non existing dict path
   1605   freeO(self);
   1606   r = self->f->setInt(self, "\"1\"[1]", 1);
   1607   ck_assert_ptr_eq(r, null);
   1608   //   dict path but the object is an array
   1609   resetO(&a);
   1610   self->f->setArray(self, "1", &a);
   1611   r = self->f->setInt(self, "\"1\".\"1\"", 1);
   1612   ck_assert_ptr_eq(r, null);
   1613   //   dict object in path but the key doesn't exists
   1614   resetO(&d);
   1615   self->f->setDict(self, "2", &d);
   1616   r = self->f->setInt(self, "\"2\".\"1\".[12]", 1);
   1617   ck_assert_ptr_eq(r, null);
   1618   // null key
   1619   r = self->f->setInt(self, null, 1);
   1620   ck_assert_ptr_eq(r, null);
   1621   terminateO(self);
   1622 
   1623 END_TEST
   1624 
   1625 
   1626 START_TEST(setSSmallJsonT)
   1627 
   1628   smallJsont* r;
   1629   smallJsont *self = allocSmallJson();
   1630 
   1631   r = self->f->setS(self, "1", "qwe");
   1632   ck_assert_ptr_ne(r, null);
   1633   char *s = toStringO(r);
   1634   ck_assert_str_eq(s, "{\"1\":\"qwe\"}");
   1635   free(s);
   1636   // path
   1637   createSmallArray(a);
   1638   createSmallDict(d);
   1639   a.f->pushDict(&a, &d);
   1640   self->f->setArray(self, "array", &a);
   1641   r = self->f->setS(self, "\"array\"[0].\"key\"", "a");
   1642   ck_assert_ptr_ne(r, null);
   1643   s = toStringO(r);
   1644   ck_assert_str_eq(s, "{\"1\":\"qwe\",\"array\":[{\"key\":\"a\"}]}");
   1645   free(s);
   1646   // json bool
   1647   freeO(self);
   1648   setTypeBoolO(self);
   1649   r = self->f->setS(self, "1", "");
   1650   ck_assert_ptr_eq(r, null);
   1651   // json array
   1652   freeO(self);
   1653   setTypeArrayO(self);
   1654   r = self->f->setS(self, "1", "");
   1655   ck_assert_ptr_eq(r, null);
   1656   // non existing dict path
   1657   freeO(self);
   1658   r = self->f->setS(self, "\"1\"[1]", "");
   1659   ck_assert_ptr_eq(r, null);
   1660   //   dict path but the object is an array
   1661   resetO(&a);
   1662   self->f->setArray(self, "1", &a);
   1663   r = self->f->setS(self, "\"1\".\"1\"", "");
   1664   ck_assert_ptr_eq(r, null);
   1665   //   dict object in path but the key doesn't exists
   1666   resetO(&d);
   1667   self->f->setDict(self, "2", &d);
   1668   r = self->f->setS(self, "\"2\".\"1\".[12]", "");
   1669   ck_assert_ptr_eq(r, null);
   1670   // null value
   1671   r = self->f->setS(self, "1", null);
   1672   ck_assert_ptr_eq(r, null);
   1673   // null key
   1674   r = self->f->setS(self, null, "");
   1675   ck_assert_ptr_eq(r, null);
   1676   terminateO(self);
   1677 
   1678 END_TEST
   1679 
   1680 
   1681 START_TEST(setCharSmallJsonT)
   1682 
   1683   smallJsont* r;
   1684   smallJsont *self = allocSmallJson();
   1685 
   1686   r = self->f->setChar(self, "1", 'x');
   1687   ck_assert_ptr_ne(r, null);
   1688   char *s = toStringO(r);
   1689   ck_assert_str_eq(s, "{\"1\":\"x\"}");
   1690   free(s);
   1691   // path
   1692   createSmallArray(a);
   1693   createSmallDict(d);
   1694   a.f->pushDict(&a, &d);
   1695   self->f->setArray(self, "array", &a);
   1696   r = self->f->setChar(self, "\"array\"[0].\"key\"", 'q');
   1697   ck_assert_ptr_ne(r, null);
   1698   s = toStringO(r);
   1699   ck_assert_str_eq(s, "{\"1\":\"x\",\"array\":[{\"key\":\"q\"}]}");
   1700   free(s);
   1701   // json bool
   1702   freeO(self);
   1703   setTypeBoolO(self);
   1704   r = self->f->setChar(self, "1", 'c');
   1705   ck_assert_ptr_eq(r, null);
   1706   // json array
   1707   freeO(self);
   1708   setTypeArrayO(self);
   1709   r = self->f->setChar(self, "1", 'x');
   1710   ck_assert_ptr_eq(r, null);
   1711   // non existing dict path
   1712   freeO(self);
   1713   r = self->f->setChar(self, "\"1\"[1]", 'x');
   1714   ck_assert_ptr_eq(r, null);
   1715   //   dict path but the object is an array
   1716   resetO(&a);
   1717   self->f->setArray(self, "1", &a);
   1718   r = self->f->setChar(self, "\"1\".\"1\"", 'q');
   1719   ck_assert_ptr_eq(r, null);
   1720   //   dict object in path but the key doesn't exists
   1721   resetO(&d);
   1722   self->f->setDict(self, "2", &d);
   1723   r = self->f->setChar(self, "\"2\".\"1\".[12]", 'q');
   1724   ck_assert_ptr_eq(r, null);
   1725   // null key
   1726   r = self->f->setChar(self, null, '1');
   1727   ck_assert_ptr_eq(r, null);
   1728   terminateO(self);
   1729 
   1730 END_TEST
   1731 
   1732 
   1733 START_TEST(setDictSmallJsonT)
   1734 
   1735   smallJsont* r;
   1736   smallJsont *self = allocSmallJson();
   1737   smallDictt *dict = allocSmallDict();
   1738 
   1739   // empty dict
   1740   r = self->f->setDict(self, "1", dict);
   1741   ck_assert_ptr_ne(r, null);
   1742   finishO(dict);
   1743   char *s = toStringO(r);
   1744   ck_assert_str_eq(s, "{\"1\":{}}");
   1745   free(s);
   1746   // set dict
   1747   dict = allocSmallDict();
   1748   dict->f->setS(dict, "a", "zxc");
   1749   r = self->f->setDict(self, "1", dict);
   1750   ck_assert_ptr_ne(r, null);
   1751   finishO(dict);
   1752   s = toStringO(r);
   1753   ck_assert_str_eq(s, "{\"1\":{\"a\":\"zxc\"}}");
   1754   free(s);
   1755   // non smallDict object
   1756   dict = (smallDictt*) allocSmallInt(2);
   1757   r = self->f->setDict(self, "1", dict);
   1758   ck_assert_ptr_eq(r, null);
   1759   terminateO(dict);
   1760   // path
   1761   dict = allocSmallDict();
   1762   createSmallArray(a);
   1763   createSmallDict(d);
   1764   a.f->pushDict(&a, &d);
   1765   self->f->setArray(self, "array", &a);
   1766   r = self->f->setDict(self, "\"array\"[0].\"key\"", dict);
   1767   ck_assert_ptr_ne(r, null);
   1768   finishO(dict);
   1769   s = toStringO(r);
   1770   ck_assert_str_eq(s, "{\"1\":{\"a\":\"zxc\"},\"array\":[{\"key\":{}}]}");
   1771   free(s);
   1772   // json bool
   1773   freeO(self);
   1774   setTypeBoolO(self);
   1775   dict = allocSmallDict();
   1776   r = self->f->setDict(self, "1", dict);
   1777   ck_assert_ptr_eq(r, null);
   1778   // json array
   1779   freeO(self);
   1780   setTypeArrayO(self);
   1781   r = self->f->setDict(self, "1", dict);
   1782   ck_assert_ptr_eq(r, null);
   1783   // non existing dict path
   1784   freeO(self);
   1785   r = self->f->setDict(self, "\"1\"[1]", dict);
   1786   ck_assert_ptr_eq(r, null);
   1787   //   dict path but the object is an array
   1788   resetO(&a);
   1789   self->f->setArray(self, "1", &a);
   1790   r = self->f->setDict(self, "\"1\".\"1\"", dict);
   1791   ck_assert_ptr_eq(r, null);
   1792   //   dict object in path but the key doesn't exists
   1793   resetO(&d);
   1794   self->f->setDict(self, "2", &d);
   1795   r = self->f->setDict(self, "\"2\".\"1\".[12]", dict);
   1796   ck_assert_ptr_eq(r, null);
   1797   // null value
   1798   r = self->f->setDict(self, "1", null);
   1799   ck_assert_ptr_eq(r, null);
   1800   // null key
   1801   r = self->f->setDict(self, null, dict);
   1802   ck_assert_ptr_eq(r, null);
   1803   terminateO(dict);
   1804   terminateO(self);
   1805 
   1806 END_TEST
   1807 
   1808 
   1809 START_TEST(setArraySmallJsonT)
   1810 
   1811   smallJsont* r;
   1812   smallJsont *self   = allocSmallJson();
   1813   smallArrayt *array = allocSmallArray();
   1814 
   1815   // empty array
   1816   r = self->f->setArray(self, "1", array);
   1817   ck_assert_ptr_ne(r, null);
   1818   finishO(array);
   1819   char *s = toStringO(r);
   1820   ck_assert_str_eq(s, "{\"1\":[]}");
   1821   free(s);
   1822   // set array
   1823   array = allocSmallArray();
   1824   array->f->pushS(array, "zxc");
   1825   r = self->f->setArray(self, "1", array);
   1826   ck_assert_ptr_ne(r, null);
   1827   finishO(array);
   1828   s = toStringO(r);
   1829   ck_assert_str_eq(s, "{\"1\":[\"zxc\"]}");
   1830   free(s);
   1831   // non smallArray object
   1832   array = (smallArrayt*) allocSmallInt(2);
   1833   r = self->f->setArray(self, "1", array);
   1834   ck_assert_ptr_eq(r, null);
   1835   terminateO(array);
   1836   // path
   1837   array = allocSmallArray();
   1838   createSmallArray(a);
   1839   createSmallDict(d);
   1840   a.f->pushDict(&a, &d);
   1841   self->f->setArray(self, "array", &a);
   1842   r = self->f->setArray(self, "\"array\"[0].\"key\"", array);
   1843   ck_assert_ptr_ne(r, null);
   1844   s = toStringO(r);
   1845   ck_assert_str_eq(s, "{\"1\":[\"zxc\"],\"array\":[{\"key\":[]}]}");
   1846   free(s);
   1847   // json bool
   1848   freeO(self);
   1849   setTypeBoolO(self);
   1850   r = self->f->setArray(self, "1", array);
   1851   ck_assert_ptr_eq(r, null);
   1852   // json array
   1853   freeO(self);
   1854   setTypeArrayO(self);
   1855   r = self->f->setArray(self, "1", array);
   1856   ck_assert_ptr_eq(r, null);
   1857   // non existing dict path
   1858   freeO(self);
   1859   r = self->f->setArray(self, "\"1\"[1]", array);
   1860   ck_assert_ptr_eq(r, null);
   1861   //   dict path but the object is an array
   1862   resetO(&a);
   1863   self->f->setArray(self, "1", &a);
   1864   r = self->f->setArray(self, "\"1\".\"1\"", array);
   1865   ck_assert_ptr_eq(r, null);
   1866   //   dict object in path but the key doesn't exists
   1867   resetO(&d);
   1868   self->f->setDict(self, "2", &d);
   1869   r = self->f->setArray(self, "\"2\".\"1\".[12]", array);
   1870   ck_assert_ptr_eq(r, null);
   1871   // null value
   1872   r = self->f->setArray(self, "1", null);
   1873   ck_assert_ptr_eq(r, null);
   1874   // null key
   1875   r = self->f->setArray(self, null, array);
   1876   ck_assert_ptr_eq(r, null);
   1877   finishO(array);
   1878   terminateO(self);
   1879 
   1880 END_TEST
   1881 
   1882 
   1883 START_TEST(setArraycSmallJsonT)
   1884 
   1885   smallJsont* r;
   1886   smallJsont *self = allocSmallJson();
   1887   char **array     = listCreateS("a", "b");
   1888 
   1889   r = self->f->setArrayc(self, "1", array);
   1890   ck_assert_ptr_ne(r, null);
   1891   char *s = toStringO(r);
   1892   ck_assert_str_eq(s, "{\"1\":[\"a\",\"b\"]}");
   1893   free(s);
   1894   // zero element list
   1895   char *e0 = array[0];
   1896   array[0] = null;
   1897   r = self->f->setArrayc(self, "1", array);
   1898   ck_assert_ptr_ne(r, null);
   1899   array[0] = e0;
   1900   listFreeS(array);
   1901   s = toStringO(r);
   1902   ck_assert_str_eq(s, "{\"1\":[]}");
   1903   free(s);
   1904   // path
   1905   array = listCreateS("1", "2");
   1906   createSmallArray(a);
   1907   createSmallDict(d);
   1908   a.f->pushDict(&a, &d);
   1909   self->f->setArray(self, "array", &a);
   1910   r = self->f->setArrayc(self, "\"array\"[0].\"key\"", array);
   1911   ck_assert_ptr_ne(r, null);
   1912   s = toStringO(r);
   1913   ck_assert_str_eq(s, "{\"1\":[],\"array\":[{\"key\":[\"1\",\"2\"]}]}");
   1914   free(s);
   1915   // json bool
   1916   freeO(self);
   1917   setTypeBoolO(self);
   1918   r = self->f->setArrayc(self, "1", array);
   1919   ck_assert_ptr_eq(r, null);
   1920   // json array
   1921   freeO(self);
   1922   setTypeArrayO(self);
   1923   r = self->f->setArrayc(self, "1", array);
   1924   ck_assert_ptr_eq(r, null);
   1925   // non existing dict path
   1926   freeO(self);
   1927   r = self->f->setArrayc(self, "\"1\"[1]", array);
   1928   ck_assert_ptr_eq(r, null);
   1929   //   dict path but the object is an array
   1930   resetO(&a);
   1931   self->f->setArray(self, "1", &a);
   1932   r = self->f->setArrayc(self, "\"1\".\"1\"", array);
   1933   ck_assert_ptr_eq(r, null);
   1934   //   dict object in path but the key doesn't exists
   1935   resetO(&d);
   1936   self->f->setDict(self, "2", &d);
   1937   r = self->f->setArrayc(self, "\"2\".\"1\".[12]", array);
   1938   ck_assert_ptr_eq(r, null);
   1939   // null value
   1940   r = self->f->setArrayc(self, "1", null);
   1941   ck_assert_ptr_eq(r, null);
   1942   // null key
   1943   r = self->f->setArrayc(self, null, array);
   1944   ck_assert_ptr_eq(r, null);
   1945   listFreeS(array);
   1946   terminateO(self);
   1947 
   1948 END_TEST
   1949 
   1950 
   1951 START_TEST(setSmallBoolSmallJsonT)
   1952 
   1953   smallJsont* r;
   1954   smallJsont *self  = allocSmallJson();
   1955   smallBoolt *value = allocSmallBool(true);
   1956 
   1957   r = self->f->setSmallBool(self, "1", value);
   1958   ck_assert_ptr_ne(r, null);
   1959   char *s = toStringO(r);
   1960   ck_assert_str_eq(s, "{\"1\":true}");
   1961   free(s);
   1962   // empty smallBool
   1963   value->value = null;
   1964   r = self->f->setSmallBool(self, "1", value);
   1965   ck_assert_ptr_ne(r, null);
   1966   finishO(value);
   1967   s = toStringO(r);
   1968   ck_assert_str_eq(s, "{\"1\":false}");
   1969   free(s);
   1970   // non smallBool object
   1971   value = (smallBoolt*) allocSmallInt(2);
   1972   r = self->f->setSmallBool(self, "1", value);
   1973   ck_assert_ptr_eq(r, null);
   1974   terminateO(value);
   1975   // path
   1976   value = allocSmallBool(true);
   1977   createSmallArray(a);
   1978   createSmallDict(d);
   1979   a.f->pushDict(&a, &d);
   1980   self->f->setArray(self, "array", &a);
   1981   r = self->f->setSmallBool(self, "\"array\"[0].\"key\"", value);
   1982   ck_assert_ptr_ne(r, null);
   1983   s = toStringO(r);
   1984   ck_assert_str_eq(s, "{\"1\":false,\"array\":[{\"key\":true}]}");
   1985   free(s);
   1986   // json bool
   1987   freeO(self);
   1988   setTypeBoolO(self);
   1989   r = self->f->setSmallBool(self, "1", value);
   1990   ck_assert_ptr_eq(r, null);
   1991   // json array
   1992   freeO(self);
   1993   setTypeArrayO(self);
   1994   r = self->f->setSmallBool(self, "1", value);
   1995   ck_assert_ptr_eq(r, null);
   1996   // non existing dict path
   1997   freeO(self);
   1998   r = self->f->setSmallBool(self, "\"1\"[1]", value);
   1999   ck_assert_ptr_eq(r, null);
   2000   //    wrong path and empty smallInt container (sInt is allocated in toSmallt)
   2001   createSmallBool(i);
   2002   r = self->f->setSmallBool(self, "\"1\".[1]", &i);
   2003   ck_assert_ptr_eq(r, null);
   2004   freeO(&i);
   2005   //   dict path but the object is an array
   2006   resetO(&a);
   2007   self->f->setArray(self, "1", &a);
   2008   r = self->f->setSmallBool(self, "\"1\".\"1\"", value);
   2009   ck_assert_ptr_eq(r, null);
   2010   //   dict object in path but the key doesn't exists
   2011   resetO(&d);
   2012   self->f->setDict(self, "2", &d);
   2013   r = self->f->setSmallBool(self, "\"2\".\"1\".[12]", value);
   2014   ck_assert_ptr_eq(r, null);
   2015   // null value
   2016   r = self->f->setSmallBool(self, "1", null);
   2017   ck_assert_ptr_eq(r, null);
   2018   // null key
   2019   r = self->f->setSmallBool(self, null, value);
   2020   ck_assert_ptr_eq(r, null);
   2021   finishO(value);
   2022   terminateO(self);
   2023 
   2024 END_TEST
   2025 
   2026 
   2027 START_TEST(setSmallBytesSmallJsonT)
   2028 
   2029   smallJsont* r;
   2030   smallJsont *self   = allocSmallJson();
   2031   smallBytest *value = allocSmallBytes("qwe", sizeof("qwe"));
   2032 
   2033   r = self->f->setSmallBytes(self, "1", value);
   2034   ck_assert_ptr_ne(r, null);
   2035   char *s = toStringO(r);
   2036   ck_assert_str_eq(s, "{\"1\":[0x71,0x77,0x65,0x00]}");
   2037   free(s);
   2038   // empty smallBytes
   2039   value->B = null;
   2040   r = self->f->setSmallBytes(self, "1", value);
   2041   ck_assert_ptr_ne(r, null);
   2042   finishO(value);
   2043   s = toStringO(r);
   2044   ck_assert_str_eq(s, "{\"1\":[]}");
   2045   free(s);
   2046   // non smallBytes object
   2047   value = (smallBytest*) allocSmallInt(2);
   2048   r = self->f->setSmallBytes(self, "1", value);
   2049   ck_assert_ptr_eq(r, null);
   2050   terminateO(value);
   2051   // path
   2052   value = allocSmallBytes("qwf", sizeof("qwf"));
   2053   createSmallArray(a);
   2054   createSmallDict(d);
   2055   a.f->pushDict(&a, &d);
   2056   self->f->setArray(self, "array", &a);
   2057   r = self->f->setSmallBytes(self, "\"array\"[0].\"key\"", value);
   2058   ck_assert_ptr_ne(r, null);
   2059   s = toStringO(r);
   2060   ck_assert_str_eq(s, "{\"1\":[],\"array\":[{\"key\":[0x71,0x77,0x66,0x00]}]}");
   2061   free(s);
   2062   // json bool
   2063   freeO(self);
   2064   setTypeBoolO(self);
   2065   r = self->f->setSmallBytes(self, "1", value);
   2066   ck_assert_ptr_eq(r, null);
   2067   // json array
   2068   freeO(self);
   2069   setTypeArrayO(self);
   2070   r = self->f->setSmallBytes(self, "1", value);
   2071   ck_assert_ptr_eq(r, null);
   2072   // non existing dict path
   2073   freeO(self);
   2074   r = self->f->setSmallBytes(self, "\"1\"[1]", value);
   2075   ck_assert_ptr_eq(r, null);
   2076   //    wrong path and empty smallInt container (sInt is allocated in toSmallt)
   2077   createSmallBytes(i);
   2078   r = self->f->setSmallBytes(self, "\"1\".[1]", &i);
   2079   ck_assert_ptr_eq(r, null);
   2080   freeO(&i);
   2081   //   dict path but the object is an array
   2082   resetO(&a);
   2083   self->f->setArray(self, "1", &a);
   2084   r = self->f->setSmallBytes(self, "\"1\".\"1\"", value);
   2085   ck_assert_ptr_eq(r, null);
   2086   //   dict object in path but the key doesn't exists
   2087   resetO(&d);
   2088   self->f->setDict(self, "2", &d);
   2089   r = self->f->setSmallBytes(self, "\"2\".\"1\".[12]", value);
   2090   ck_assert_ptr_eq(r, null);
   2091   // null value
   2092   r = self->f->setSmallBytes(self, "1", null);
   2093   ck_assert_ptr_eq(r, null);
   2094   // null key
   2095   r = self->f->setSmallBytes(self, null, value);
   2096   ck_assert_ptr_eq(r, null);
   2097   finishO(value);
   2098   terminateO(self);
   2099 
   2100 END_TEST
   2101 
   2102 
   2103 START_TEST(setSmallDoubleSmallJsonT)
   2104 
   2105   smallJsont* r;
   2106   smallJsont *self    = allocSmallJson();
   2107   smallDoublet *value = allocSmallDouble(2.2);
   2108 
   2109   r = self->f->setSmallDouble(self, "1", value);
   2110   ck_assert_ptr_ne(r, null);
   2111   char *s = toStringO(r);
   2112   ck_assert_str_eq(s, "{\"1\":2.200000e+00}");
   2113   free(s);
   2114   // empty smallDouble
   2115   value->value = null;
   2116   r = self->f->setSmallDouble(self, "1", value);
   2117   ck_assert_ptr_ne(r, null);
   2118   finishO(value);
   2119   s = toStringO(r);
   2120   ck_assert_str_eq(s, "{\"1\":0.000000e+00}");
   2121   free(s);
   2122   // non smallDouble object
   2123   value = (smallDoublet*) allocSmallInt(2);
   2124   r = self->f->setSmallDouble(self, "1", value);
   2125   ck_assert_ptr_eq(r, null);
   2126   terminateO(value);
   2127   // path
   2128   value = allocSmallDouble(1.2);
   2129   createSmallArray(a);
   2130   createSmallDict(d);
   2131   a.f->pushDict(&a, &d);
   2132   self->f->setArray(self, "array", &a);
   2133   r = self->f->setSmallDouble(self, "\"array\"[0].\"key\"", value);
   2134   ck_assert_ptr_ne(r, null);
   2135   s = toStringO(r);
   2136   ck_assert_str_eq(s, "{\"1\":0.000000e+00,\"array\":[{\"key\":1.200000e+00}]}");
   2137   free(s);
   2138   // json bool
   2139   freeO(self);
   2140   setTypeBoolO(self);
   2141   r = self->f->setSmallDouble(self, "1", value);
   2142   ck_assert_ptr_eq(r, null);
   2143   // json array
   2144   freeO(self);
   2145   setTypeArrayO(self);
   2146   r = self->f->setSmallDouble(self, "1", value);
   2147   ck_assert_ptr_eq(r, null);
   2148   // non existing dict path
   2149   freeO(self);
   2150   r = self->f->setSmallDouble(self, "\"1\"[1]", value);
   2151   ck_assert_ptr_eq(r, null);
   2152   //    wrong path and empty smallInt container (sInt is allocated in toSmallt)
   2153   createSmallDouble(i);
   2154   r = self->f->setSmallDouble(self, "\"1\".[1]", &i);
   2155   ck_assert_ptr_eq(r, null);
   2156   freeO(&i);
   2157   //   dict path but the object is an array
   2158   resetO(&a);
   2159   self->f->setArray(self, "1", &a);
   2160   r = self->f->setSmallDouble(self, "\"1\".\"1\"", value);
   2161   ck_assert_ptr_eq(r, null);
   2162   //   dict object in path but the key doesn't exists
   2163   resetO(&d);
   2164   self->f->setDict(self, "2", &d);
   2165   r = self->f->setSmallDouble(self, "\"2\".\"1\".[12]", value);
   2166   ck_assert_ptr_eq(r, null);
   2167   // null value
   2168   r = self->f->setSmallDouble(self, "1", null);
   2169   ck_assert_ptr_eq(r, null);
   2170   // null key
   2171   r = self->f->setSmallDouble(self, null, value);
   2172   ck_assert_ptr_eq(r, null);
   2173   finishO(value);
   2174   terminateO(self);
   2175 
   2176 END_TEST
   2177 
   2178 
   2179 START_TEST(setSmallIntSmallJsonT)
   2180 
   2181   smallJsont* r;
   2182   smallJsont *self = allocSmallJson();
   2183   smallIntt *value = allocSmallInt(2);
   2184 
   2185   r = self->f->setSmallInt(self, "1", value);
   2186   ck_assert_ptr_ne(r, null);
   2187   char *s = toStringO(r);
   2188   ck_assert_str_eq(s, "{\"1\":2}");
   2189   free(s);
   2190   // empty smallInt
   2191   value->value = null;
   2192   r = self->f->setSmallInt(self, "1", value);
   2193   ck_assert_ptr_ne(r, null);
   2194   finishO(value);
   2195   s = toStringO(r);
   2196   ck_assert_str_eq(s, "{\"1\":0}");
   2197   free(s);
   2198   // non smallInt object
   2199   value = (smallIntt*) allocSmallBool(true);
   2200   r = self->f->setSmallInt(self, "1", value);
   2201   ck_assert_ptr_eq(r, null);
   2202   terminateO(value);
   2203   // path
   2204   value = allocSmallInt(1);
   2205   createSmallArray(a);
   2206   createSmallDict(d);
   2207   a.f->pushDict(&a, &d);
   2208   self->f->setArray(self, "array", &a);
   2209   r = self->f->setSmallInt(self, "\"array\"[0].\"key\"", value);
   2210   ck_assert_ptr_ne(r, null);
   2211   s = toStringO(r);
   2212   ck_assert_str_eq(s, "{\"1\":0,\"array\":[{\"key\":1}]}");
   2213   free(s);
   2214   // json bool
   2215   freeO(self);
   2216   setTypeBoolO(self);
   2217   r = self->f->setSmallInt(self, "1", value);
   2218   ck_assert_ptr_eq(r, null);
   2219   // json array
   2220   freeO(self);
   2221   setTypeArrayO(self);
   2222   r = self->f->setSmallInt(self, "1", value);
   2223   ck_assert_ptr_eq(r, null);
   2224   // non existing dict path
   2225   freeO(self);
   2226   r = self->f->setSmallInt(self, "\"1\"[1]", value);
   2227   ck_assert_ptr_eq(r, null);
   2228   //    wrong path and empty smallInt container (sInt is allocated in toSmallt)
   2229   createSmallInt(i);
   2230   r = self->f->setSmallInt(self, "\"1\".[1]", &i);
   2231   freeO(&i);
   2232   ck_assert_ptr_eq(r, null);
   2233   //   dict path but the object is an array
   2234   resetO(&a);
   2235   self->f->setArray(self, "1", &a);
   2236   r = self->f->setSmallInt(self, "\"1\".\"1\"", value);
   2237   ck_assert_ptr_eq(r, null);
   2238   //   dict object in path but the key doesn't exists
   2239   resetO(&d);
   2240   self->f->setDict(self, "2", &d);
   2241   r = self->f->setSmallInt(self, "\"2\".\"1\".[12]", value);
   2242   ck_assert_ptr_eq(r, null);
   2243   // null value
   2244   r = self->f->setSmallInt(self, "1", null);
   2245   ck_assert_ptr_eq(r, null);
   2246   // null key
   2247   r = self->f->setSmallInt(self, null, value);
   2248   ck_assert_ptr_eq(r, null);
   2249   finishO(value);
   2250   terminateO(self);
   2251 
   2252 END_TEST
   2253 
   2254 
   2255 START_TEST(setSmallJsonSmallJsonT)
   2256 
   2257   smallJsont* r;
   2258   smallJsont *self = allocSmallJson();
   2259   smallJsont *value = allocSmallJson();
   2260 
   2261   setTopIntO(value, 2);
   2262   r = self->f->setSmallJson(self, "1", value);
   2263   ck_assert_ptr_ne(r, null);
   2264   char *s = toStringO(r);
   2265   ck_assert_str_eq(s, "{\"1\":2}");
   2266   free(s);
   2267   // empty smallJson
   2268   resetO(value);
   2269   r = self->f->setSmallJson(self, "1", value);
   2270   ck_assert_ptr_ne(r, null);
   2271   finishO(value);
   2272   s = toStringO(r);
   2273   ck_assert_str_eq(s, "{\"1\":{}}");
   2274   free(s);
   2275   // non smallJson object
   2276   value = (smallJsont*) allocSmallInt(2);
   2277   r = self->f->setSmallJson(self, "1", value);
   2278   ck_assert_ptr_eq(r, null);
   2279   terminateO(value);
   2280   // path
   2281   value = allocSmallJson();
   2282   createSmallArray(a);
   2283   createSmallDict(d);
   2284   a.f->pushDict(&a, &d);
   2285   self->f->setArray(self, "array", &a);
   2286   r = self->f->setSmallJson(self, "\"array\"[0].\"key\"", value);
   2287   ck_assert_ptr_ne(r, null);
   2288   s = toStringO(r);
   2289   ck_assert_str_eq(s, "{\"1\":{},\"array\":[{\"key\":{}}]}");
   2290   free(s);
   2291   // json bool
   2292   freeO(self);
   2293   setTypeBoolO(self);
   2294   r = self->f->setSmallJson(self, "1", value);
   2295   ck_assert_ptr_eq(r, null);
   2296   // json array
   2297   freeO(self);
   2298   setTypeArrayO(self);
   2299   r = self->f->setSmallJson(self, "1", value);
   2300   ck_assert_ptr_eq(r, null);
   2301   // non existing dict path
   2302   freeO(self);
   2303   r = self->f->setSmallJson(self, "\"1\"[1]", value);
   2304   ck_assert_ptr_eq(r, null);
   2305   //    wrong path and empty smallInt container (sInt is allocated in toSmallt)
   2306   createSmallJson(i);
   2307   r = self->f->setSmallJson(self, "\"1\".[1]", &i);
   2308   ck_assert_ptr_eq(r, null);
   2309   freeO(&i);
   2310   //   dict path but the object is an array
   2311   resetO(&a);
   2312   self->f->setArray(self, "1", &a);
   2313   r = self->f->setSmallJson(self, "\"1\".\"1\"", value);
   2314   ck_assert_ptr_eq(r, null);
   2315   //   dict object in path but the key doesn't exists
   2316   resetO(&d);
   2317   self->f->setDict(self, "2", &d);
   2318   r = self->f->setSmallJson(self, "\"2\".\"1\".[12]", value);
   2319   ck_assert_ptr_eq(r, null);
   2320   // null value
   2321   r = self->f->setSmallJson(self, "1", null);
   2322   ck_assert_ptr_eq(r, null);
   2323   // null key
   2324   r = self->f->setSmallJson(self, null, value);
   2325   ck_assert_ptr_eq(r, null);
   2326   finishO(value);
   2327   terminateO(self);
   2328 
   2329 END_TEST
   2330 
   2331 
   2332 START_TEST(setSmallStringSmallJsonT)
   2333 
   2334   smallJsont* r;
   2335   smallJsont *self     = allocSmallJson();
   2336   smallStringt *string = allocSmallString("qwe");
   2337 
   2338   r = self->f->setSmallString(self, "1", string);
   2339   ck_assert_ptr_ne(r, null);
   2340   char *s = toStringO(r);
   2341   ck_assert_str_eq(s, "{\"1\":\"qwe\"}");
   2342   free(s);
   2343   // empty smallString
   2344   string->data = null;
   2345   r = self->f->setSmallString(self, "1", string);
   2346   ck_assert_ptr_ne(r, null);
   2347   finishO(string);
   2348   s = toStringO(r);
   2349   ck_assert_str_eq(s, "{\"1\":\"\"}");
   2350   free(s);
   2351   // non smallString object
   2352   string = (smallStringt*) allocSmallInt(2);
   2353   r = self->f->setSmallString(self, "1", string);
   2354   ck_assert_ptr_eq(r, null);
   2355   terminateO(string);
   2356   // path
   2357   smallStringt *value = allocSmallString("asd");
   2358   createSmallArray(a);
   2359   createSmallDict(d);
   2360   a.f->pushDict(&a, &d);
   2361   self->f->setArray(self, "array", &a);
   2362   r = self->f->setSmallString(self, "\"array\"[0].\"key\"", value);
   2363   ck_assert_ptr_ne(r, null);
   2364   s = toStringO(r);
   2365   ck_assert_str_eq(s, "{\"1\":\"\",\"array\":[{\"key\":\"asd\"}]}");
   2366   free(s);
   2367   // json bool
   2368   freeO(self);
   2369   setTypeBoolO(self);
   2370   r = self->f->setSmallString(self, "1", value);
   2371   ck_assert_ptr_eq(r, null);
   2372   // json array
   2373   freeO(self);
   2374   setTypeArrayO(self);
   2375   r = self->f->setSmallString(self, "1", value);
   2376   ck_assert_ptr_eq(r, null);
   2377   // non existing dict path
   2378   freeO(self);
   2379   r = self->f->setSmallString(self, "\"1\"[1]", value);
   2380   ck_assert_ptr_eq(r, null);
   2381   //    wrong path and empty smallInt container (sInt is allocated in toSmallt)
   2382   createSmallString(i);
   2383   r = self->f->setSmallString(self, "\"1\".[1]", &i);
   2384   ck_assert_ptr_eq(r, null);
   2385   freeO(&i);
   2386   //   dict path but the object is an array
   2387   resetO(&a);
   2388   self->f->setArray(self, "1", &a);
   2389   r = self->f->setSmallString(self, "\"1\".\"1\"", value);
   2390   ck_assert_ptr_eq(r, null);
   2391   //   dict object in path but the key doesn't exists
   2392   resetO(&d);
   2393   self->f->setDict(self, "2", &d);
   2394   r = self->f->setSmallString(self, "\"2\".\"1\".[12]", value);
   2395   ck_assert_ptr_eq(r, null);
   2396   // null value
   2397   r = self->f->setSmallString(self, "1", null);
   2398   ck_assert_ptr_eq(r, null);
   2399   // null key
   2400   r = self->f->setSmallString(self, null, string);
   2401   ck_assert_ptr_eq(r, null);
   2402   finishO(value);
   2403   terminateO(self);
   2404 
   2405 END_TEST
   2406 
   2407 
   2408 START_TEST(setSmallContainerSmallJsonT)
   2409 
   2410   smallJsont* r;
   2411   smallJsont *self           = allocSmallJson();
   2412   smallContainert *container = allocSmallContainer(null);
   2413 
   2414   r = self->f->setSmallContainer(self, "1", container);
   2415   ck_assert_ptr_ne(r, null);
   2416   char *s = toStringO(r);
   2417   ck_assert_str_eq(s, "{\"1\":\"<data container>\"}");
   2418   free(s);
   2419   // empty smallContainer
   2420   container->data = null;
   2421   r = self->f->setSmallContainer(self, "1", container);
   2422   ck_assert_ptr_ne(r, null);
   2423   finishO(container);
   2424   s = toStringO(r);
   2425   ck_assert_str_eq(s, "{\"1\":\"<data container>\"}");
   2426   free(s);
   2427   // non smallContainer object
   2428   container = (smallContainert*) allocSmallInt(2);
   2429   r = self->f->setSmallContainer(self, "1", container);
   2430   ck_assert_ptr_eq(r, null);
   2431   terminateO(container);
   2432   // path
   2433   smallContainert *value = allocSmallContainer(null);
   2434   createSmallArray(a);
   2435   createSmallDict(d);
   2436   a.f->pushDict(&a, &d);
   2437   self->f->setArray(self, "array", &a);
   2438   r = self->f->setSmallContainer(self, "\"array\"[0].\"key\"", value);
   2439   ck_assert_ptr_ne(r, null);
   2440   s = toStringO(r);
   2441   ck_assert_str_eq(s, "{\"1\":\"<data container>\",\"array\":[{\"key\":\"<data container>\"}]}");
   2442   free(s);
   2443   // json bool
   2444   freeO(self);
   2445   setTypeBoolO(self);
   2446   r = self->f->setSmallContainer(self, "1", value);
   2447   ck_assert_ptr_eq(r, null);
   2448   // json array
   2449   freeO(self);
   2450   setTypeArrayO(self);
   2451   r = self->f->setSmallContainer(self, "1", value);
   2452   ck_assert_ptr_eq(r, null);
   2453   // non existing dict path
   2454   freeO(self);
   2455   r = self->f->setSmallContainer(self, "\"1\"[1]", value);
   2456   ck_assert_ptr_eq(r, null);
   2457   //    wrong path and empty smallInt container (sInt is allocated in toSmallt)
   2458   createSmallContainer(i);
   2459   r = self->f->setSmallContainer(self, "\"1\".[1]", &i);
   2460   ck_assert_ptr_eq(r, null);
   2461   freeO(&i);
   2462   //   dict path but the object is an array
   2463   resetO(&a);
   2464   self->f->setArray(self, "1", &a);
   2465   r = self->f->setSmallContainer(self, "\"1\".\"1\"", value);
   2466   ck_assert_ptr_eq(r, null);
   2467   //   dict object in path but the key doesn't exists
   2468   resetO(&d);
   2469   self->f->setDict(self, "2", &d);
   2470   r = self->f->setSmallContainer(self, "\"2\".\"1\".[12]", value);
   2471   ck_assert_ptr_eq(r, null);
   2472   // null value
   2473   r = self->f->setSmallContainer(self, "1", null);
   2474   ck_assert_ptr_eq(r, null);
   2475   // null key
   2476   r = self->f->setSmallContainer(self, null, container);
   2477   ck_assert_ptr_eq(r, null);
   2478   finishO(value);
   2479   terminateO(self);
   2480 
   2481 END_TEST
   2482 
   2483 
   2484 START_TEST(setNFreeSmallJsonT)
   2485 
   2486   smallJsont* r;
   2487   smallJsont *self = allocSmallJson();
   2488   baset *value;
   2489 
   2490   // undefined object
   2491   value   = (baset*)allocUndefined();
   2492   r = self->f->setNFree(self, "1", value);
   2493   ck_assert_ptr_ne(r, null);
   2494   char *s = toStringO(r);
   2495   ck_assert_str_eq(s, "{\"1\":null}");
   2496   free(s);
   2497   // container
   2498   createAllocateSmallContainer(c);
   2499   r = self->f->setNFree(self, "1", (baset*)c);
   2500   ck_assert_ptr_ne(r, null);
   2501   s = toStringO(r);
   2502   ck_assert_str_eq(s, "{\"1\":\"<data container>\"}");
   2503   free(s);
   2504   // base object in container
   2505   createAllocateSmallInt(I);
   2506   setValG(I, 11);
   2507   I->type = "anothertype";
   2508   r = self->f->setNFree(self, "1", (baset*)I);
   2509   ck_assert_ptr_ne(r, null);
   2510   s = toStringO(r);
   2511   ck_assert_str_eq(s, "{\"1\":\"<data container>\"}");
   2512   free(s);
   2513   // path
   2514   value = (baset*) allocSmallInt(2);
   2515   createSmallArray(a);
   2516   createSmallDict(d);
   2517   a.f->pushDict(&a, &d);
   2518   self->f->setArray(self, "array", &a);
   2519   r = self->f->setNFree(self, "\"array\"[0].\"key\"", value);
   2520   ck_assert_ptr_ne(r, null);
   2521   s = toStringO(r);
   2522   ck_assert_str_eq(s, "{\"1\":\"<data container>\",\"array\":[{\"key\":2}]}");
   2523   free(s);
   2524   // json bool
   2525   freeO(self);
   2526   setTypeBoolO(self);
   2527   value = (baset*) allocSmallInt(2);
   2528   r = self->f->setNFree(self, "1", value);
   2529   ck_assert_ptr_eq(r, null);
   2530   // json array
   2531   freeO(self);
   2532   setTypeArrayO(self);
   2533   r = self->f->setNFree(self, "1", value);
   2534   ck_assert_ptr_eq(r, null);
   2535   // non existing dict path
   2536   freeO(self);
   2537   r = self->f->setNFree(self, "\"1\"[1]", value);
   2538   ck_assert_ptr_eq(r, null);
   2539   //    wrong path and empty smallInt container (sInt is allocated in toSmallt)
   2540   createSmallInt(i);
   2541   r = self->f->setNFree(self, "\"1\".[1]", (baset*)&i);
   2542   ck_assert_ptr_eq(r, null);
   2543   freeO(&i);
   2544   //    wrong path and user class
   2545   i.type = "myclass";
   2546   r = self->f->setNFree(self, "\"1\".[1]", (baset*)&i);
   2547   ck_assert_ptr_eq(r, null);
   2548   //   dict path but the object is an array
   2549   resetO(&a);
   2550   self->f->setArray(self, "1", &a);
   2551   r = self->f->setNFree(self, "\"1\".\"1\"", value);
   2552   ck_assert_ptr_eq(r, null);
   2553   //   dict object in path but the key doesn't exists
   2554   resetO(&d);
   2555   self->f->setDict(self, "2", &d);
   2556   r = self->f->setNFree(self, "\"2\".\"1\".[12]", value);
   2557   ck_assert_ptr_eq(r, null);
   2558   terminateO(value);
   2559   // null value
   2560   r = self->f->setNFree(self, "1", null);
   2561   ck_assert_ptr_eq(r, null);
   2562   // null key
   2563   r = self->f->setNFree(self, null, value);
   2564   ck_assert_ptr_eq(r, null);
   2565   terminateO(self);
   2566 
   2567 END_TEST
   2568 
   2569 
   2570 START_TEST(setNFreeUndefinedSmallJsonT)
   2571 
   2572   smallJsont* r;
   2573   smallJsont *self      = allocSmallJson();
   2574   undefinedt *undefined = allocUndefined();
   2575 
   2576   r = self->f->setNFreeUndefined(self, "1", undefined);
   2577   ck_assert_ptr_ne(r, null);
   2578   char *s = toStringO(r);
   2579   ck_assert_str_eq(s, "{\"1\":null}");
   2580   free(s);
   2581   // path
   2582   undefined = allocUndefined();
   2583   createSmallArray(a);
   2584   createSmallDict(d);
   2585   a.f->pushDict(&a, &d);
   2586   self->f->setArray(self, "array", &a);
   2587   r = self->f->setNFreeUndefined(self, "\"array\"[0].\"key\"", undefined);
   2588   ck_assert_ptr_ne(r, null);
   2589   s = toStringO(r);
   2590   ck_assert_str_eq(s, "{\"1\":null,\"array\":[{\"key\":null}]}");
   2591   free(s);
   2592   // json bool
   2593   freeO(self);
   2594   setTypeBoolO(self);
   2595   undefined = allocUndefined();
   2596   r = self->f->setNFreeUndefined(self, "1", undefined);
   2597   ck_assert_ptr_eq(r, null);
   2598   // json array
   2599   freeO(self);
   2600   setTypeArrayO(self);
   2601   r = self->f->setNFreeUndefined(self, "1", undefined);
   2602   ck_assert_ptr_eq(r, null);
   2603   // non existing dict path
   2604   freeO(self);
   2605   r = self->f->setNFreeUndefined(self, "\"1\"[1]", undefined);
   2606   ck_assert_ptr_eq(r, null);
   2607   //   dict path but the object is an array
   2608   resetO(&a);
   2609   self->f->setArray(self, "1", &a);
   2610   r = self->f->setNFreeUndefined(self, "\"1\".\"1\"", undefined);
   2611   ck_assert_ptr_eq(r, null);
   2612   //   dict object in path but the key doesn't exists
   2613   resetO(&d);
   2614   self->f->setDict(self, "2", &d);
   2615   r = self->f->setNFreeUndefined(self, "\"2\".\"1\".[12]", undefined);
   2616   ck_assert_ptr_eq(r, null);
   2617   terminateO(undefined);
   2618   // null value
   2619   r = self->f->setNFreeUndefined(self, "1", null);
   2620   ck_assert_ptr_eq(r, null);
   2621   // null key
   2622   undefined = allocUndefined();
   2623   r = self->f->setNFreeUndefined(self, null, undefined);
   2624   ck_assert_ptr_eq(r, null);
   2625   terminateO(self);
   2626   terminateO(undefined);
   2627 
   2628 END_TEST
   2629 
   2630 
   2631 START_TEST(setNFreeSSmallJsonT)
   2632 
   2633   smallJsont* r;
   2634   smallJsont *self = allocSmallJson();
   2635   char *string     = strdup("qwe");
   2636 
   2637   r = self->f->setNFreeS(self, "1", string);
   2638   ck_assert_ptr_ne(r, null);
   2639   char *s = toStringO(r);
   2640   ck_assert_str_eq(s, "{\"1\":\"qwe\"}");
   2641   free(s);
   2642   // path
   2643   string = strdup("asd");
   2644   createSmallArray(a);
   2645   createSmallDict(d);
   2646   a.f->pushDict(&a, &d);
   2647   self->f->setArray(self, "array", &a);
   2648   r = self->f->setNFreeS(self, "\"array\"[0].\"key\"", string);
   2649   ck_assert_ptr_ne(r, null);
   2650   s = toStringO(r);
   2651   ck_assert_str_eq(s, "{\"1\":\"qwe\",\"array\":[{\"key\":\"asd\"}]}");
   2652   free(s);
   2653   // json bool
   2654   freeO(self);
   2655   setTypeBoolO(self);
   2656   string = strdup("asd");
   2657   r = self->f->setNFreeS(self, "1", string);
   2658   ck_assert_ptr_eq(r, null);
   2659   // json array
   2660   freeO(self);
   2661   setTypeArrayO(self);
   2662   r = self->f->setNFreeS(self, "1", string);
   2663   ck_assert_ptr_eq(r, null);
   2664   // non existing dict path
   2665   freeO(self);
   2666   r = self->f->setNFreeS(self, "\"1\"[1]", string);
   2667   ck_assert_ptr_eq(r, null);
   2668   //   dict path but the object is an array
   2669   resetO(&a);
   2670   self->f->setArray(self, "1", &a);
   2671   r = self->f->setNFreeS(self, "\"1\".\"1\"", string);
   2672   ck_assert_ptr_eq(r, null);
   2673   //   dict object in path but the key doesn't exists
   2674   resetO(&d);
   2675   self->f->setDict(self, "2", &d);
   2676   r = self->f->setNFreeS(self, "\"2\".\"1\".[12]", string);
   2677   ck_assert_ptr_eq(r, null);
   2678   free(string);
   2679   // null value
   2680   r = self->f->setNFreeS(self, "1", null);
   2681   ck_assert_ptr_eq(r, null);
   2682   // null key
   2683   string = strdup("qwe");
   2684   r = self->f->setNFreeS(self, null, string);
   2685   ck_assert_ptr_eq(r, null);
   2686   terminateO(self);
   2687   free(string);
   2688 
   2689 END_TEST
   2690 
   2691 
   2692 START_TEST(setNFreeDictSmallJsonT)
   2693 
   2694   smallJsont* r;
   2695   smallJsont *self = allocSmallJson();
   2696   smallDictt *dict = allocSmallDict();
   2697 
   2698   r = self->f->setNFreeDict(self, "1", dict);
   2699   ck_assert_ptr_ne(r, null);
   2700   char *s = toStringO(r);
   2701   ck_assert_str_eq(s, "{\"1\":{}}");
   2702   free(s);
   2703   // null value
   2704   r = self->f->setNFreeDict(self, "1", null);
   2705   ck_assert_ptr_eq(r, null);
   2706   // path
   2707   smallDictt *value = allocSmallDict();
   2708   createSmallArray(a);
   2709   createSmallDict(d);
   2710   a.f->pushDict(&a, &d);
   2711   self->f->setArray(self, "array", &a);
   2712   r = self->f->setNFreeDict(self, "\"array\"[0].\"key\"", value);
   2713   ck_assert_ptr_ne(r, null);
   2714   s = toStringO(r);
   2715   ck_assert_str_eq(s, "{\"1\":{},\"array\":[{\"key\":{}}]}");
   2716   free(s);
   2717   // json bool
   2718   freeO(self);
   2719   setTypeBoolO(self);
   2720   value = allocSmallDict();
   2721   r = self->f->setNFreeDict(self, "1", value);
   2722   ck_assert_ptr_eq(r, null);
   2723   // json array
   2724   freeO(self);
   2725   setTypeArrayO(self);
   2726   r = self->f->setNFreeDict(self, "1", value);
   2727   ck_assert_ptr_eq(r, null);
   2728   // non existing dict path
   2729   freeO(self);
   2730   r = self->f->setNFreeDict(self, "\"1\"[1]", value);
   2731   ck_assert_ptr_eq(r, null);
   2732   //   dict path but the object is an array
   2733   resetO(&a);
   2734   self->f->setArray(self, "1", &a);
   2735   r = self->f->setNFreeDict(self, "\"1\".\"1\"", value);
   2736   ck_assert_ptr_eq(r, null);
   2737   //   dict object in path but the key doesn't exists
   2738   resetO(&d);
   2739   self->f->setDict(self, "2", &d);
   2740   r = self->f->setNFreeDict(self, "\"2\".\"1\".[12]", value);
   2741   ck_assert_ptr_eq(r, null);
   2742   terminateO(value);
   2743   // null key
   2744   dict = allocSmallDict();
   2745   r = self->f->setNFreeDict(self, null, dict);
   2746   ck_assert_ptr_eq(r, null);
   2747   terminateO(self);
   2748   terminateO(dict);
   2749 
   2750 END_TEST
   2751 
   2752 
   2753 START_TEST(setNFreeArraySmallJsonT)
   2754 
   2755   smallJsont* r;
   2756   smallJsont *self   = allocSmallJson();
   2757   smallArrayt *array = allocSmallArray();
   2758 
   2759   // empty array
   2760   r = self->f->setNFreeArray(self, "1", array);
   2761   ck_assert_ptr_ne(r, null);
   2762   char *s = toStringO(r);
   2763   ck_assert_str_eq(s, "{\"1\":[]}");
   2764   free(s);
   2765   // path
   2766   smallArrayt *value = allocSmallArray();
   2767   createSmallArray(a);
   2768   createSmallDict(d);
   2769   a.f->pushDict(&a, &d);
   2770   self->f->setArray(self, "array", &a);
   2771   r = self->f->setNFreeArray(self, "\"array\"[0].\"key\"", value);
   2772   ck_assert_ptr_ne(r, null);
   2773   s = toStringO(r);
   2774   ck_assert_str_eq(s, "{\"1\":[],\"array\":[{\"key\":[]}]}");
   2775   free(s);
   2776   // json bool
   2777   freeO(self);
   2778   setTypeBoolO(self);
   2779   value = allocSmallArray();
   2780   r = self->f->setNFreeArray(self, "1", value);
   2781   ck_assert_ptr_eq(r, null);
   2782   // json array
   2783   freeO(self);
   2784   setTypeArrayO(self);
   2785   r = self->f->setNFreeArray(self, "1", value);
   2786   ck_assert_ptr_eq(r, null);
   2787   // non existing dict path
   2788   freeO(self);
   2789   r = self->f->setNFreeArray(self, "\"1\"[1]", value);
   2790   ck_assert_ptr_eq(r, null);
   2791   //   dict path but the object is an array
   2792   resetO(&a);
   2793   self->f->setArray(self, "1", &a);
   2794   r = self->f->setNFreeArray(self, "\"1\".\"1\"", value);
   2795   ck_assert_ptr_eq(r, null);
   2796   //   dict object in path but the key doesn't exists
   2797   resetO(&d);
   2798   self->f->setDict(self, "2", &d);
   2799   r = self->f->setNFreeArray(self, "\"2\".\"1\".[12]", value);
   2800   ck_assert_ptr_eq(r, null);
   2801   terminateO(value);
   2802   // null value
   2803   r = self->f->setNFreeArray(self, "1", null);
   2804   ck_assert_ptr_eq(r, null);
   2805   // null key
   2806   r = self->f->setNFreeArray(self, null, array);
   2807   ck_assert_ptr_eq(r, null);
   2808   terminateO(self);
   2809 
   2810 END_TEST
   2811 
   2812 
   2813 START_TEST(setNFreeArraycSmallJsonT)
   2814 
   2815   smallJsont* r;
   2816   smallJsont *self = allocSmallJson();
   2817   char **array     = listCreateS("a", "b");
   2818 
   2819   r = self->f->setNFreeArrayc(self, "1", array);
   2820   ck_assert_ptr_ne(r, null);
   2821   char *s = toStringO(r);
   2822   ck_assert_str_eq(s, "{\"1\":[\"a\",\"b\"]}");
   2823   free(s);
   2824   // path
   2825   char **value = listCreateS("1", "2");
   2826   createSmallArray(a);
   2827   createSmallDict(d);
   2828   a.f->pushDict(&a, &d);
   2829   self->f->setArray(self, "array", &a);
   2830   r = self->f->setNFreeArrayc(self, "\"array\"[0].\"key\"", value);
   2831   ck_assert_ptr_ne(r, null);
   2832   s = toStringO(r);
   2833   ck_assert_str_eq(s, "{\"1\":[\"a\",\"b\"],\"array\":[{\"key\":[\"1\",\"2\"]}]}");
   2834   free(s);
   2835   // json bool
   2836   freeO(self);
   2837   setTypeBoolO(self);
   2838   value = listCreateS("1", "2");
   2839   r = self->f->setNFreeArrayc(self, "1", value);
   2840   ck_assert_ptr_eq(r, null);
   2841   // json array
   2842   freeO(self);
   2843   setTypeArrayO(self);
   2844   r = self->f->setNFreeArrayc(self, "1", value);
   2845   ck_assert_ptr_eq(r, null);
   2846   // non existing dict path
   2847   freeO(self);
   2848   r = self->f->setNFreeArrayc(self, "\"1\"[1]", value);
   2849   ck_assert_ptr_eq(r, null);
   2850   //   dict path but the object is an array
   2851   resetO(&a);
   2852   self->f->setArray(self, "1", &a);
   2853   r = self->f->setNFreeArrayc(self, "\"1\".\"1\"", value);
   2854   ck_assert_ptr_eq(r, null);
   2855   //   dict object in path but the key doesn't exists
   2856   resetO(&d);
   2857   self->f->setDict(self, "2", &d);
   2858   r = self->f->setNFreeArrayc(self, "\"2\".\"1\".[12]", value);
   2859   ck_assert_ptr_eq(r, null);
   2860   listFreeS(value);
   2861   // null value
   2862   r = self->f->setNFreeArrayc(self, "1", null);
   2863   ck_assert_ptr_eq(r, null);
   2864   // null key
   2865   r = self->f->setNFreeArrayc(self, null, array);
   2866   ck_assert_ptr_eq(r, null);
   2867   terminateO(self);
   2868 
   2869 END_TEST
   2870 
   2871 
   2872 START_TEST(setNFreeSmallBoolSmallJsonT)
   2873 
   2874   smallJsont* r;
   2875   smallJsont *self  = allocSmallJson();
   2876   smallBoolt *value = allocSmallBool(true);
   2877 
   2878   r = self->f->setNFreeSmallBool(self, "1", value);
   2879   ck_assert_ptr_ne(r, null);
   2880   char *s = toStringO(r);
   2881   ck_assert_str_eq(s, "{\"1\":true}");
   2882   free(s);
   2883   // path
   2884   value = allocSmallBool(false);
   2885   createSmallArray(a);
   2886   createSmallDict(d);
   2887   a.f->pushDict(&a, &d);
   2888   self->f->setArray(self, "array", &a);
   2889   r = self->f->setNFreeSmallBool(self, "\"array\"[0].\"key\"", value);
   2890   ck_assert_ptr_ne(r, null);
   2891   s = toStringO(r);
   2892   ck_assert_str_eq(s, "{\"1\":true,\"array\":[{\"key\":false}]}");
   2893   free(s);
   2894   // json bool
   2895   freeO(self);
   2896   setTypeBoolO(self);
   2897   value = allocSmallBool(true);
   2898   r = self->f->setNFreeSmallBool(self, "1", value);
   2899   ck_assert_ptr_eq(r, null);
   2900   // json array
   2901   freeO(self);
   2902   setTypeArrayO(self);
   2903   r = self->f->setNFreeSmallBool(self, "1", value);
   2904   ck_assert_ptr_eq(r, null);
   2905   // non existing dict path
   2906   freeO(self);
   2907   r = self->f->setNFreeSmallBool(self, "\"1\"[1]", value);
   2908   ck_assert_ptr_eq(r, null);
   2909   //   dict path but the object is an array
   2910   resetO(&a);
   2911   self->f->setArray(self, "1", &a);
   2912   r = self->f->setNFreeSmallBool(self, "\"1\".\"1\"", value);
   2913   ck_assert_ptr_eq(r, null);
   2914   //   dict object in path but the key doesn't exists
   2915   resetO(&d);
   2916   self->f->setDict(self, "2", &d);
   2917   r = self->f->setNFreeSmallBool(self, "\"2\".\"1\".[12]", value);
   2918   ck_assert_ptr_eq(r, null);
   2919   // null value
   2920   r = self->f->setNFreeSmallBool(self, "1", null);
   2921   ck_assert_ptr_eq(r, null);
   2922   // null key
   2923   r = self->f->setNFreeSmallBool(self, null, value);
   2924   ck_assert_ptr_eq(r, null);
   2925   terminateO(value);
   2926   terminateO(self);
   2927 
   2928 END_TEST
   2929 
   2930 
   2931 START_TEST(setNFreeSmallBytesSmallJsonT)
   2932 
   2933   smallJsont* r;
   2934   smallJsont *self   = allocSmallJson();
   2935   smallBytest *value = allocSmallBytes("qwe", sizeof("qwe"));
   2936 
   2937   r = self->f->setNFreeSmallBytes(self, "1", value);
   2938   ck_assert_ptr_ne(r, null);
   2939   char *s = toStringO(r);
   2940   ck_assert_str_eq(s, "{\"1\":[0x71,0x77,0x65,0x00]}");
   2941   free(s);
   2942   // path
   2943   value = allocSmallBytes("qwf", sizeof("qwf"));
   2944   createSmallArray(a);
   2945   createSmallDict(d);
   2946   a.f->pushDict(&a, &d);
   2947   self->f->setArray(self, "array", &a);
   2948   r = self->f->setNFreeSmallBytes(self, "\"array\"[0].\"key\"", value);
   2949   ck_assert_ptr_ne(r, null);
   2950   s = toStringO(r);
   2951   ck_assert_str_eq(s, "{\"1\":[0x71,0x77,0x65,0x00],\"array\":[{\"key\":[0x71,0x77,0x66,0x00]}]}");
   2952   free(s);
   2953   // json bool
   2954   freeO(self);
   2955   setTypeBoolO(self);
   2956   value = allocSmallBytes("qwf", sizeof("qwf"));
   2957   r = self->f->setNFreeSmallBytes(self, "1", value);
   2958   ck_assert_ptr_eq(r, null);
   2959   // json array
   2960   freeO(self);
   2961   setTypeArrayO(self);
   2962   r = self->f->setNFreeSmallBytes(self, "1", value);
   2963   ck_assert_ptr_eq(r, null);
   2964   // non existing dict path
   2965   freeO(self);
   2966   r = self->f->setNFreeSmallBytes(self, "\"1\"[1]", value);
   2967   ck_assert_ptr_eq(r, null);
   2968   //   dict path but the object is an array
   2969   resetO(&a);
   2970   self->f->setArray(self, "1", &a);
   2971   r = self->f->setNFreeSmallBytes(self, "\"1\".\"1\"", value);
   2972   ck_assert_ptr_eq(r, null);
   2973   //   dict object in path but the key doesn't exists
   2974   resetO(&d);
   2975   self->f->setDict(self, "2", &d);
   2976   r = self->f->setNFreeSmallBytes(self, "\"2\".\"1\".[12]", value);
   2977   ck_assert_ptr_eq(r, null);
   2978   // null value
   2979   r = self->f->setNFreeSmallBytes(self, "1", null);
   2980   ck_assert_ptr_eq(r, null);
   2981   // null key
   2982   r = self->f->setNFreeSmallBytes(self, null, value);
   2983   ck_assert_ptr_eq(r, null);
   2984   terminateO(value);
   2985   terminateO(self);
   2986 
   2987 END_TEST
   2988 
   2989 
   2990 START_TEST(setNFreeSmallDoubleSmallJsonT)
   2991 
   2992   smallJsont* r;
   2993   smallJsont *self    = allocSmallJson();
   2994   smallDoublet *value = allocSmallDouble(2.2);
   2995 
   2996   r = self->f->setNFreeSmallDouble(self, "1", value);
   2997   ck_assert_ptr_ne(r, null);
   2998   char *s = toStringO(r);
   2999   ck_assert_str_eq(s, "{\"1\":2.200000e+00}");
   3000   free(s);
   3001   // path
   3002   value = allocSmallDouble(1.2);
   3003   createSmallArray(a);
   3004   createSmallDict(d);
   3005   a.f->pushDict(&a, &d);
   3006   self->f->setArray(self, "array", &a);
   3007   r = self->f->setNFreeSmallDouble(self, "\"array\"[0].\"key\"", value);
   3008   ck_assert_ptr_ne(r, null);
   3009   s = toStringO(r);
   3010   ck_assert_str_eq(s, "{\"1\":2.200000e+00,\"array\":[{\"key\":1.200000e+00}]}");
   3011   free(s);
   3012   // json bool
   3013   freeO(self);
   3014   setTypeBoolO(self);
   3015   value = allocSmallDouble(3.2);
   3016   r = self->f->setNFreeSmallDouble(self, "1", value);
   3017   ck_assert_ptr_eq(r, null);
   3018   // json array
   3019   freeO(self);
   3020   setTypeArrayO(self);
   3021   r = self->f->setNFreeSmallDouble(self, "1", value);
   3022   ck_assert_ptr_eq(r, null);
   3023   // non existing dict path
   3024   freeO(self);
   3025   r = self->f->setNFreeSmallDouble(self, "\"1\"[1]", value);
   3026   ck_assert_ptr_eq(r, null);
   3027   //   dict path but the object is an array
   3028   resetO(&a);
   3029   self->f->setArray(self, "1", &a);
   3030   r = self->f->setNFreeSmallDouble(self, "\"1\".\"1\"", value);
   3031   ck_assert_ptr_eq(r, null);
   3032   //   dict object in path but the key doesn't exists
   3033   resetO(&d);
   3034   self->f->setDict(self, "2", &d);
   3035   r = self->f->setNFreeSmallDouble(self, "\"2\".\"1\".[12]", value);
   3036   ck_assert_ptr_eq(r, null);
   3037   // null value
   3038   r = self->f->setNFreeSmallDouble(self, "1", null);
   3039   ck_assert_ptr_eq(r, null);
   3040   // null key
   3041   r = self->f->setNFreeSmallDouble(self, null, value);
   3042   ck_assert_ptr_eq(r, null);
   3043   terminateO(value);
   3044   terminateO(self);
   3045 
   3046 END_TEST
   3047 
   3048 
   3049 START_TEST(setNFreeSmallIntSmallJsonT)
   3050 
   3051   smallJsont* r;
   3052   smallJsont *self = allocSmallJson();
   3053   smallIntt *value = allocSmallInt(2);
   3054 
   3055   r = self->f->setNFreeSmallInt(self, "1", value);
   3056   ck_assert_ptr_ne(r, null);
   3057   char *s = toStringO(r);
   3058   ck_assert_str_eq(s, "{\"1\":2}");
   3059   free(s);
   3060   // path
   3061   value = allocSmallInt(3);
   3062   createSmallArray(a);
   3063   createSmallDict(d);
   3064   a.f->pushDict(&a, &d);
   3065   self->f->setArray(self, "array", &a);
   3066   r = self->f->setNFreeSmallInt(self, "\"array\"[0].\"key\"", value);
   3067   ck_assert_ptr_ne(r, null);
   3068   s = toStringO(r);
   3069   ck_assert_str_eq(s, "{\"1\":2,\"array\":[{\"key\":3}]}");
   3070   free(s);
   3071   // json bool
   3072   freeO(self);
   3073   setTypeBoolO(self);
   3074   value = allocSmallInt(1);
   3075   r = self->f->setNFreeSmallInt(self, "1", value);
   3076   ck_assert_ptr_eq(r, null);
   3077   // json array
   3078   freeO(self);
   3079   setTypeArrayO(self);
   3080   r = self->f->setNFreeSmallInt(self, "1", value);
   3081   ck_assert_ptr_eq(r, null);
   3082   // non existing dict path
   3083   freeO(self);
   3084   r = self->f->setNFreeSmallInt(self, "\"1\"[1]", value);
   3085   ck_assert_ptr_eq(r, null);
   3086   //   dict path but the object is an array
   3087   resetO(&a);
   3088   self->f->setArray(self, "1", &a);
   3089   r = self->f->setNFreeSmallInt(self, "\"1\".\"1\"", value);
   3090   ck_assert_ptr_eq(r, null);
   3091   //   dict object in path but the key doesn't exists
   3092   resetO(&d);
   3093   self->f->setDict(self, "2", &d);
   3094   r = self->f->setNFreeSmallInt(self, "\"2\".\"1\".[12]", value);
   3095   ck_assert_ptr_eq(r, null);
   3096   // null value
   3097   r = self->f->setNFreeSmallInt(self, "1", null);
   3098   ck_assert_ptr_eq(r, null);
   3099   // null key
   3100   r = self->f->setNFreeSmallInt(self, null, value);
   3101   ck_assert_ptr_eq(r, null);
   3102   terminateO(value);
   3103   terminateO(self);
   3104 
   3105 END_TEST
   3106 
   3107 
   3108 START_TEST(setNFreeSmallJsonSmallJsonT)
   3109 
   3110   smallJsont* r;
   3111   smallJsont *self  = allocSmallJson();
   3112   smallJsont *value = allocSmallJson();
   3113 
   3114   setTopIntO(value, 2);
   3115   r = self->f->setNFreeSmallJson(self, "1", value);
   3116   ck_assert_ptr_ne(r, null);
   3117   char *s = toStringO(r);
   3118   ck_assert_str_eq(s, "{\"1\":2}");
   3119   free(s);
   3120   // path
   3121   value = allocSmallJson();
   3122   createSmallArray(a);
   3123   createSmallDict(d);
   3124   a.f->pushDict(&a, &d);
   3125   self->f->setArray(self, "array", &a);
   3126   r = self->f->setNFreeSmallJson(self, "\"array\"[0].\"key\"", value);
   3127   ck_assert_ptr_ne(r, null);
   3128   s = toStringO(r);
   3129   ck_assert_str_eq(s, "{\"1\":2,\"array\":[{\"key\":{}}]}");
   3130   free(s);
   3131   // json bool
   3132   freeO(self);
   3133   setTypeBoolO(self);
   3134   value = allocSmallJson();
   3135   r = self->f->setNFreeSmallJson(self, "1", value);
   3136   ck_assert_ptr_eq(r, null);
   3137   // json array
   3138   freeO(self);
   3139   setTypeArrayO(self);
   3140   r = self->f->setNFreeSmallJson(self, "1", value);
   3141   ck_assert_ptr_eq(r, null);
   3142   // non existing dict path
   3143   freeO(self);
   3144   r = self->f->setNFreeSmallJson(self, "\"1\"[1]", value);
   3145   ck_assert_ptr_eq(r, null);
   3146   //   dict path but the object is an array
   3147   resetO(&a);
   3148   self->f->setArray(self, "1", &a);
   3149   r = self->f->setNFreeSmallJson(self, "\"1\".\"1\"", value);
   3150   ck_assert_ptr_eq(r, null);
   3151   //   dict object in path but the key doesn't exists
   3152   resetO(&d);
   3153   self->f->setDict(self, "2", &d);
   3154   r = self->f->setNFreeSmallJson(self, "\"2\".\"1\".[12]", value);
   3155   ck_assert_ptr_eq(r, null);
   3156   // null value
   3157   r = self->f->setNFreeSmallJson(self, "1", null);
   3158   ck_assert_ptr_eq(r, null);
   3159   // null key
   3160   r = self->f->setNFreeSmallJson(self, null, value);
   3161   ck_assert_ptr_eq(r, null);
   3162   terminateO(value);
   3163   terminateO(self);
   3164 
   3165 END_TEST
   3166 
   3167 
   3168 START_TEST(setNFreeSmallStringSmallJsonT)
   3169 
   3170   smallJsont* r;
   3171   smallJsont *self     = allocSmallJson();
   3172   smallStringt *string = allocSmallString("qwe");
   3173 
   3174   r = self->f->setNFreeSmallString(self, "1", string);
   3175   ck_assert_ptr_ne(r, null);
   3176   char *s = toStringO(r);
   3177   ck_assert_str_eq(s, "{\"1\":\"qwe\"}");
   3178   free(s);
   3179   // path
   3180   smallStringt *value = allocSmallString("asd");
   3181   createSmallArray(a);
   3182   createSmallDict(d);
   3183   a.f->pushDict(&a, &d);
   3184   self->f->setArray(self, "array", &a);
   3185   r = self->f->setNFreeSmallString(self, "\"array\"[0].\"key\"", value);
   3186   ck_assert_ptr_ne(r, null);
   3187   s = toStringO(r);
   3188   ck_assert_str_eq(s, "{\"1\":\"qwe\",\"array\":[{\"key\":\"asd\"}]}");
   3189   free(s);
   3190   // json bool
   3191   freeO(self);
   3192   setTypeBoolO(self);
   3193   value = allocSmallString("123");
   3194   r = self->f->setNFreeSmallString(self, "1", value);
   3195   ck_assert_ptr_eq(r, null);
   3196   // json array
   3197   freeO(self);
   3198   setTypeArrayO(self);
   3199   r = self->f->setNFreeSmallString(self, "1", value);
   3200   ck_assert_ptr_eq(r, null);
   3201   // non existing dict path
   3202   freeO(self);
   3203   r = self->f->setNFreeSmallString(self, "\"1\"[1]", value);
   3204   ck_assert_ptr_eq(r, null);
   3205   //   dict path but the object is an array
   3206   resetO(&a);
   3207   self->f->setArray(self, "1", &a);
   3208   r = self->f->setNFreeSmallString(self, "\"1\".\"1\"", value);
   3209   ck_assert_ptr_eq(r, null);
   3210   //   dict object in path but the key doesn't exists
   3211   resetO(&d);
   3212   self->f->setDict(self, "2", &d);
   3213   r = self->f->setNFreeSmallString(self, "\"2\".\"1\".[12]", value);
   3214   ck_assert_ptr_eq(r, null);
   3215   // null value
   3216   r = self->f->setNFreeSmallString(self, "1", null);
   3217   ck_assert_ptr_eq(r, null);
   3218   // null key
   3219   r = self->f->setNFreeSmallString(self, null, string);
   3220   ck_assert_ptr_eq(r, null);
   3221   terminateO(value);
   3222   terminateO(self);
   3223 
   3224 END_TEST
   3225 
   3226 
   3227 START_TEST(setNFreeSmallContainerSmallJsonT)
   3228 
   3229   smallJsont* r;
   3230   smallJsont *self           = allocSmallJson();
   3231   smallContainert *container = allocSmallContainer(null);
   3232 
   3233   r = self->f->setNFreeSmallContainer(self, "1", container);
   3234   ck_assert_ptr_ne(r, null);
   3235   char *s = toStringO(r);
   3236   ck_assert_str_eq(s, "{\"1\":\"<data container>\"}");
   3237   free(s);
   3238   // path
   3239   smallContainert *value = allocSmallContainer(null);
   3240   createSmallArray(a);
   3241   createSmallDict(d);
   3242   a.f->pushDict(&a, &d);
   3243   self->f->setArray(self, "array", &a);
   3244   r = self->f->setNFreeSmallContainer(self, "\"array\"[0].\"key\"", value);
   3245   ck_assert_ptr_ne(r, null);
   3246   s = toStringO(r);
   3247   ck_assert_str_eq(s, "{\"1\":\"<data container>\",\"array\":[{\"key\":\"<data container>\"}]}");
   3248   free(s);
   3249   // json bool
   3250   freeO(self);
   3251   setTypeBoolO(self);
   3252   value = allocSmallContainer(null);
   3253   r = self->f->setNFreeSmallContainer(self, "1", value);
   3254   ck_assert_ptr_eq(r, null);
   3255   // json array
   3256   freeO(self);
   3257   setTypeArrayO(self);
   3258   r = self->f->setNFreeSmallContainer(self, "1", value);
   3259   ck_assert_ptr_eq(r, null);
   3260   // non existing dict path
   3261   freeO(self);
   3262   r = self->f->setNFreeSmallContainer(self, "\"1\"[1]", value);
   3263   ck_assert_ptr_eq(r, null);
   3264   //   dict path but the object is an array
   3265   resetO(&a);
   3266   self->f->setArray(self, "1", &a);
   3267   r = self->f->setNFreeSmallContainer(self, "\"1\".\"1\"", value);
   3268   ck_assert_ptr_eq(r, null);
   3269   //   dict object in path but the key doesn't exists
   3270   resetO(&d);
   3271   self->f->setDict(self, "2", &d);
   3272   r = self->f->setNFreeSmallContainer(self, "\"2\".\"1\".[12]", value);
   3273   ck_assert_ptr_eq(r, null);
   3274   // null value
   3275   r = self->f->setNFreeSmallContainer(self, "1", null);
   3276   ck_assert_ptr_eq(r, null);
   3277   // null key
   3278   r = self->f->setNFreeSmallContainer(self, null, container);
   3279   ck_assert_ptr_eq(r, null);
   3280   terminateO(value);
   3281   terminateO(self);
   3282 
   3283 END_TEST
   3284 
   3285 
   3286 START_TEST(setPDictSmallJsonT)
   3287 
   3288   smallJsont* r;
   3289   smallJsont *self = allocSmallJson();
   3290   smallDictt *dict;
   3291 
   3292   dict = allocSmallDict();
   3293   r    = self->f->setDict(self, "1", dict);
   3294   ck_assert_ptr_ne(r, null);
   3295   dict->f->setInt(dict, "a", 1);
   3296   r    = self->f->setPDict(self, "1", dict);
   3297   ck_assert_ptr_ne(r, null);
   3298   char *s = toStringO(r);
   3299   ck_assert_str_eq(s, "{\"1\":{\"a\":1}}");
   3300   free(s);
   3301   // empty dict
   3302 	finishO(dict);
   3303   dict = allocSmallDict();
   3304   r    = self->f->setPDict(self, "1", dict);
   3305   ck_assert_ptr_eq(r, null);
   3306   finishO(dict);
   3307   s = toStringO(self);
   3308   ck_assert_str_eq(s, "{\"1\":{\"a\":1}}");
   3309   free(s);
   3310   // non smallDict object
   3311   dict = (smallDictt*) allocSmallInt(2);
   3312   r = self->f->setPDict(self, "1", dict);
   3313   ck_assert_ptr_eq(r, null);
   3314   terminateO(dict);
   3315   // path
   3316   dict = allocSmallDict();
   3317   dict->f->setInt(dict, "b", 2);
   3318   createSmallArray(a);
   3319   createSmallDict(d);
   3320   a.f->pushDict(&a, &d);
   3321   self->f->setArray(self, "array", &a);
   3322   r = self->f->setPDict(self, "\"array\"[0].\"key\"", dict);
   3323   ck_assert_ptr_ne(r, null);
   3324   finishO(dict);
   3325   s = toStringO(r);
   3326   ck_assert_str_eq(s, "{\"1\":{\"a\":1},\"array\":[{\"key\":{\"b\":2}}]}");
   3327   free(s);
   3328   // json bool
   3329   freeO(self);
   3330   setTypeBoolO(self);
   3331   dict = allocSmallDict();
   3332   dict->f->setInt(dict, "b", 2);
   3333   r = self->f->setPDict(self, "1", dict);
   3334   ck_assert_ptr_eq(r, null);
   3335   // json array
   3336   freeO(self);
   3337   setTypeArrayO(self);
   3338   r = self->f->setPDict(self, "1", dict);
   3339   ck_assert_ptr_eq(r, null);
   3340   // non existing dict path
   3341   freeO(self);
   3342   r = self->f->setPDict(self, "\"1\"[1]", dict);
   3343   ck_assert_ptr_eq(r, null);
   3344   //   dict path but the object is an array
   3345   resetO(&a);
   3346   self->f->setArray(self, "1", &a);
   3347   r = self->f->setPDict(self, "\"1\".\"1\"", dict);
   3348   ck_assert_ptr_eq(r, null);
   3349   //   dict object in path but the key doesn't exists
   3350   resetO(&d);
   3351   self->f->setDict(self, "2", &d);
   3352   r = self->f->setPDict(self, "\"2\".\"1\".[12]", dict);
   3353   ck_assert_ptr_eq(r, null);
   3354   // null value
   3355   r = self->f->setPDict(self, "1", null);
   3356   ck_assert_ptr_eq(r, null);
   3357   // null key
   3358   r = self->f->setPDict(self, null, dict);
   3359   ck_assert_ptr_eq(r, null);
   3360   terminateO(dict);
   3361   terminateO(self);
   3362 
   3363 END_TEST
   3364 
   3365 
   3366 START_TEST(setPArraySmallJsonT)
   3367 
   3368   smallJsont* r;
   3369   smallJsont *self = allocSmallJson();
   3370   smallArrayt *array;
   3371 
   3372   array   = allocSmallArray();
   3373   r       = self->f->setArray(self, "1", array);
   3374   ck_assert_ptr_ne(r, null);
   3375   array->f->pushInt(array, 1);
   3376   r       = self->f->setPArray(self, "1", array);
   3377   ck_assert_ptr_ne(r, null);
   3378   char *s = toStringO(r);
   3379   ck_assert_str_eq(s, "{\"1\":[1]}");
   3380   free(s);
   3381   // empty array
   3382 	finishO(array);
   3383   array = allocSmallArray();
   3384   r    = self->f->setPArray(self, "1", array);
   3385   ck_assert_ptr_eq(r, null);
   3386   finishO(array);
   3387   s = toStringO(self);
   3388   ck_assert_str_eq(s, "{\"1\":[1]}");
   3389   free(s);
   3390   // non smallDict object
   3391   array = (smallArrayt*) allocSmallInt(2);
   3392   r = self->f->setPArray(self, "1", array);
   3393   ck_assert_ptr_eq(r, null);
   3394   terminateO(array);
   3395   // path
   3396   array = allocSmallArray();
   3397   array->f->pushInt(array, 2);
   3398   createSmallArray(a);
   3399   createSmallDict(d);
   3400   a.f->pushDict(&a, &d);
   3401   self->f->setArray(self, "array", &a);
   3402   r = self->f->setPArray(self, "\"array\"[0].\"key\"", array);
   3403   ck_assert_ptr_ne(r, null);
   3404   finishO(array);
   3405   s = toStringO(r);
   3406   ck_assert_str_eq(s, "{\"1\":[1],\"array\":[{\"key\":[2]}]}");
   3407   free(s);
   3408   // json bool
   3409   array = allocSmallArray();
   3410   array->f->pushInt(array, 2);
   3411   freeO(self);
   3412   setTypeBoolO(self);
   3413   r = self->f->setPArray(self, "1", array);
   3414   ck_assert_ptr_eq(r, null);
   3415   // json array
   3416   freeO(self);
   3417   setTypeArrayO(self);
   3418   r = self->f->setPArray(self, "1", array);
   3419   ck_assert_ptr_eq(r, null);
   3420   // non existing dict path
   3421   freeO(self);
   3422   r = self->f->setPArray(self, "\"1\"[1]", array);
   3423   ck_assert_ptr_eq(r, null);
   3424   //   dict path but the object is an array
   3425   resetO(&a);
   3426   self->f->setArray(self, "1", &a);
   3427   r = self->f->setPArray(self, "\"1\".\"1\"", array);
   3428   ck_assert_ptr_eq(r, null);
   3429   //   dict object in path but the key doesn't exists
   3430   resetO(&d);
   3431   self->f->setDict(self, "2", &d);
   3432   r = self->f->setPArray(self, "\"2\".\"1\".[12]", array);
   3433   ck_assert_ptr_eq(r, null);
   3434   // null value
   3435   r = self->f->setPArray(self, "1", null);
   3436   ck_assert_ptr_eq(r, null);
   3437   // null key
   3438   r = self->f->setPArray(self, null, array);
   3439   ck_assert_ptr_eq(r, null);
   3440   terminateO(array);
   3441   terminateO(self);
   3442 
   3443 END_TEST
   3444 
   3445 
   3446 START_TEST(setPSmallJsonSmallJsonT)
   3447 
   3448   smallJsont* r;
   3449   smallJsont *self = allocSmallJson();
   3450   smallJsont *json;
   3451 
   3452   json    = allocSmallJson();
   3453   r       = self->f->setSmallJson(self, "1", json);
   3454   ck_assert_ptr_ne(r, null);
   3455   json->f->setInt(json, "a", 1);
   3456   r       = self->f->setPSmallJson(self, "1", json);
   3457   ck_assert_ptr_ne(r, null);
   3458   finishO(json);
   3459   char *s = toStringO(r);
   3460   ck_assert_str_eq(s, "{\"1\":{\"a\":1}}");
   3461   free(s);
   3462   // empty smallJson
   3463   json   = allocSmallJson();
   3464   r = self->f->setPSmallJson(self, "1", json);
   3465   ck_assert_ptr_eq(r, null);
   3466   terminateO(json);
   3467   // non smallJson object
   3468   json = (smallJsont*) allocSmallInt(2);
   3469   r = self->f->setPSmallJson(self, "1", json);
   3470   ck_assert_ptr_eq(r, null);
   3471   // path
   3472   smallJsont *value = allocSmallJson();
   3473   value->f->setInt(value, "b", 2);
   3474   createSmallArray(a);
   3475   createSmallDict(d);
   3476   a.f->pushDict(&a, &d);
   3477   self->f->setArray(self, "array", &a);
   3478   r = self->f->setPSmallJson(self, "\"array\"[0].\"key\"", value);
   3479   ck_assert_ptr_ne(r, null);
   3480   finishO(value);
   3481   s = toStringO(r);
   3482   ck_assert_str_eq(s, "{\"1\":{\"a\":1},\"array\":[{\"key\":{\"b\":2}}]}");
   3483   free(s);
   3484   // json bool
   3485   value = allocSmallJson();
   3486   value->f->setInt(value, "b", 2);
   3487   freeO(self);
   3488   setTypeBoolO(self);
   3489   r = self->f->setPSmallJson(self, "1", value);
   3490   ck_assert_ptr_eq(r, null);
   3491   // json array
   3492   freeO(self);
   3493   setTypeArrayO(self);
   3494   r = self->f->setPSmallJson(self, "1", value);
   3495   ck_assert_ptr_eq(r, null);
   3496   // non existing dict path
   3497   freeO(self);
   3498   r = self->f->setPSmallJson(self, "\"1\"[1]", value);
   3499   ck_assert_ptr_eq(r, null);
   3500   //    wrong path and empty smallInt container (sInt is allocated in toSmallt)
   3501   createSmallJson(i);
   3502   r = self->f->setPSmallJson(self, "\"1\".[1]", &i);
   3503   ck_assert_ptr_eq(r, null);
   3504   freeO(&i);
   3505   //   dict path but the object is an array
   3506   resetO(&a);
   3507   self->f->setArray(self, "1", &a);
   3508   r = self->f->setPSmallJson(self, "\"1\".\"1\"", value);
   3509   ck_assert_ptr_eq(r, null);
   3510   //   dict object in path but the key doesn't exists
   3511   resetO(&d);
   3512   self->f->setDict(self, "2", &d);
   3513   r = self->f->setPSmallJson(self, "\"2\".\"1\".[12]", value);
   3514   ck_assert_ptr_eq(r, null);
   3515   terminateO(value);
   3516   // null value
   3517   r = self->f->setPSmallJson(self, "1", null);
   3518   ck_assert_ptr_eq(r, null);
   3519   // null key
   3520   r = self->f->setPSmallJson(self, null, json);
   3521   ck_assert_ptr_eq(r, null);
   3522   terminateO(self);
   3523   terminateO(json);
   3524 
   3525 END_TEST
   3526 
   3527 
   3528 START_TEST(setPSmallStringSmallJsonT)
   3529 
   3530   smallJsont* r;
   3531   smallJsont *self = allocSmallJson();
   3532   smallStringt *string;
   3533 
   3534   string = allocSmallString("");
   3535   r      = self->f->setSmallString(self, "1", string);
   3536   ck_assert_ptr_ne(r, null);
   3537   string->f->appendS(string, "s");
   3538   r      = self->f->setPSmallString(self, "1", string);
   3539   ck_assert_ptr_ne(r, null);
   3540   finishO(string);
   3541   char *s = toStringO(r);
   3542   ck_assert_str_eq(s, "{\"1\":\"s\"}");
   3543   free(s);
   3544   // empty SmallString
   3545   string = allocSmallString("");
   3546   freeO(string);
   3547   r = self->f->setPSmallString(self, "1", string);
   3548   ck_assert_ptr_eq(r, null);
   3549   terminateO(string);
   3550   // non smallString object
   3551   string = (smallStringt*) allocSmallInt(2);
   3552   r = self->f->setPSmallString(self, "1", string);
   3553   ck_assert_ptr_eq(r, null);
   3554   terminateO(string);
   3555   // path
   3556   smallStringt *value = allocSmallString("asd");
   3557   createSmallArray(a);
   3558   createSmallDict(d);
   3559   a.f->pushDict(&a, &d);
   3560   self->f->setArray(self, "array", &a);
   3561   r = self->f->setPSmallString(self, "\"array\"[0].\"key\"", value);
   3562   ck_assert_ptr_ne(r, null);
   3563   finishO(value);
   3564   s = toStringO(r);
   3565   ck_assert_str_eq(s, "{\"1\":\"s\",\"array\":[{\"key\":\"asd\"}]}");
   3566   free(s);
   3567   // json bool
   3568   value = allocSmallString("ASD");
   3569   freeO(self);
   3570   setTypeBoolO(self);
   3571   r = self->f->setPSmallString(self, "1", value);
   3572   ck_assert_ptr_eq(r, null);
   3573   // json array
   3574   freeO(self);
   3575   setTypeArrayO(self);
   3576   r = self->f->setPSmallString(self, "1", value);
   3577   ck_assert_ptr_eq(r, null);
   3578   // non existing dict path
   3579   freeO(self);
   3580   r = self->f->setPSmallString(self, "\"1\"[1]", value);
   3581   ck_assert_ptr_eq(r, null);
   3582   //    wrong path and empty smallInt container (sInt is allocated in toSmallt)
   3583   createSmallString(i);
   3584   r = self->f->setPSmallString(self, "\"1\".[1]", &i);
   3585   ck_assert_ptr_eq(r, null);
   3586   freeO(&i);
   3587   //   dict path but the object is an array
   3588   resetO(&a);
   3589   self->f->setArray(self, "1", &a);
   3590   r = self->f->setPSmallString(self, "\"1\".\"1\"", value);
   3591   ck_assert_ptr_eq(r, null);
   3592   //   dict object in path but the key doesn't exists
   3593   resetO(&d);
   3594   self->f->setDict(self, "2", &d);
   3595   r = self->f->setPSmallString(self, "\"2\".\"1\".[12]", value);
   3596   ck_assert_ptr_eq(r, null);
   3597   terminateO(value);
   3598   // null value
   3599   r = self->f->setPSmallString(self, "1", null);
   3600   ck_assert_ptr_eq(r, null);
   3601   // null key
   3602   string = allocSmallString("");
   3603   r = self->f->setPSmallString(self, null, string);
   3604   ck_assert_ptr_eq(r, null);
   3605   terminateO(self);
   3606   terminateO(string);
   3607 
   3608 END_TEST
   3609 
   3610 
   3611 START_TEST(setNFreePDictSmallJsonT)
   3612 
   3613   smallJsont* r;
   3614   smallJsont *self = allocSmallJson();
   3615   smallDictt *value;
   3616 
   3617   value   = allocSmallDict();
   3618   r       = self->f->setDict(self, "1", value);
   3619   ck_assert_ptr_ne(r, null);
   3620   value->f->setInt(value, "a", 1);
   3621   r       = self->f->setNFreePDict(self, "1", value);
   3622   ck_assert_ptr_ne(r, null);
   3623   char *s = toStringO(r);
   3624   ck_assert_str_eq(s, "{\"1\":{\"a\":1}}");
   3625   free(s);
   3626   // empty smallDict
   3627   value   = allocSmallDict();
   3628   r       = self->f->setNFreePDict(self, "1", value);
   3629   ck_assert_ptr_eq(r, null);
   3630   terminateO(value);
   3631   // non smallDict object
   3632   value = (smallDictt*) allocSmallInt(2);
   3633   r = self->f->setNFreePDict(self, "1", value);
   3634   ck_assert_ptr_eq(r, null);
   3635   terminateO(value);
   3636   // path
   3637   value = allocSmallDict();
   3638   value->f->setInt(value, "b", 2);
   3639   createSmallArray(a);
   3640   createSmallDict(d);
   3641   a.f->pushDict(&a, &d);
   3642   self->f->setArray(self, "array", &a);
   3643   r = self->f->setNFreePDict(self, "\"array\"[0].\"key\"", value);
   3644   ck_assert_ptr_ne(r, null);
   3645   s = toStringO(r);
   3646   ck_assert_str_eq(s, "{\"1\":{\"a\":1},\"array\":[{\"key\":{\"b\":2}}]}");
   3647   free(s);
   3648   // json bool
   3649   freeO(self);
   3650   setTypeBoolO(self);
   3651   value = allocSmallDict();
   3652   value->f->setInt(value, "b", 2);
   3653   r = self->f->setNFreePDict(self, "1", value);
   3654   ck_assert_ptr_eq(r, null);
   3655   // json array
   3656   freeO(self);
   3657   setTypeArrayO(self);
   3658   r = self->f->setNFreePDict(self, "1", value);
   3659   ck_assert_ptr_eq(r, null);
   3660   // non existing dict path
   3661   freeO(self);
   3662   r = self->f->setNFreePDict(self, "\"1\"[1]", value);
   3663   ck_assert_ptr_eq(r, null);
   3664   //   dict path but the object is an array
   3665   resetO(&a);
   3666   self->f->setArray(self, "1", &a);
   3667   r = self->f->setNFreePDict(self, "\"1\".\"1\"", value);
   3668   ck_assert_ptr_eq(r, null);
   3669   //   dict object in path but the key doesn't exists
   3670   resetO(&d);
   3671   self->f->setDict(self, "2", &d);
   3672   r = self->f->setNFreePDict(self, "\"2\".\"1\".[12]", value);
   3673   ck_assert_ptr_eq(r, null);
   3674   // null value
   3675   r = self->f->setNFreePDict(self, "1", null);
   3676   ck_assert_ptr_eq(r, null);
   3677   // null key
   3678   r = self->f->setNFreePDict(self, null, value);
   3679   ck_assert_ptr_eq(r, null);
   3680   terminateO(self);
   3681   terminateO(value);
   3682 
   3683 END_TEST
   3684 
   3685 
   3686 START_TEST(setNFreePArraySmallJsonT)
   3687 
   3688   smallJsont* r;
   3689   smallJsont *self = allocSmallJson();
   3690   smallArrayt *value;
   3691 
   3692   value   = allocSmallArray();
   3693   r       = self->f->setArray(self, "1", value);
   3694   ck_assert_ptr_ne(r, null);
   3695   value->f->pushInt(value, 2);
   3696   r       = self->f->setNFreePArray(self, "1", value);
   3697   ck_assert_ptr_ne(r, null);
   3698   char *s = toStringO(r);
   3699   ck_assert_str_eq(s, "{\"1\":[2]}");
   3700   free(s);
   3701   // empty smallArray
   3702   value   = allocSmallArray();
   3703   r       = self->f->setNFreePArray(self, "1", value);
   3704   ck_assert_ptr_eq(r, null);
   3705   terminateO(value);
   3706   // non smallArray object
   3707   value   = (smallArrayt*) allocSmallInt(2);
   3708   r       = self->f->setNFreePArray(self, "1", value);
   3709   ck_assert_ptr_eq(r, null);
   3710   terminateO(value);
   3711   // path
   3712   value = allocSmallArray();
   3713   value->f->pushInt(value, 3);
   3714   createSmallArray(a);
   3715   createSmallDict(d);
   3716   a.f->pushDict(&a, &d);
   3717   self->f->setArray(self, "array", &a);
   3718   r = self->f->setNFreePArray(self, "\"array\"[0].\"key\"", value);
   3719   ck_assert_ptr_ne(r, null);
   3720   s = toStringO(r);
   3721   ck_assert_str_eq(s, "{\"1\":[2],\"array\":[{\"key\":[3]}]}");
   3722   free(s);
   3723   // json bool
   3724   value = allocSmallArray();
   3725   value->f->pushInt(value, 2);
   3726   freeO(self);
   3727   setTypeBoolO(self);
   3728   r = self->f->setNFreePArray(self, "1", value);
   3729   ck_assert_ptr_eq(r, null);
   3730   // json array
   3731   freeO(self);
   3732   setTypeArrayO(self);
   3733   r = self->f->setNFreePArray(self, "1", value);
   3734   ck_assert_ptr_eq(r, null);
   3735   // non existing dict path
   3736   freeO(self);
   3737   r = self->f->setNFreePArray(self, "\"1\"[1]", value);
   3738   ck_assert_ptr_eq(r, null);
   3739   //   dict path but the object is an array
   3740   resetO(&a);
   3741   self->f->setArray(self, "1", &a);
   3742   r = self->f->setNFreePArray(self, "\"1\".\"1\"", value);
   3743   ck_assert_ptr_eq(r, null);
   3744   //   dict object in path but the key doesn't exists
   3745   resetO(&d);
   3746   self->f->setDict(self, "2", &d);
   3747   r = self->f->setNFreePArray(self, "\"2\".\"1\".[12]", value);
   3748   ck_assert_ptr_eq(r, null);
   3749   // null value
   3750   r = self->f->setNFreePArray(self, "1", null);
   3751   ck_assert_ptr_eq(r, null);
   3752   // null key
   3753   r = self->f->setNFreePArray(self, null, value);
   3754   ck_assert_ptr_eq(r, null);
   3755   terminateO(self);
   3756   terminateO(value);
   3757 
   3758 END_TEST
   3759 
   3760 
   3761 START_TEST(setNFreePSmallJsonSmallJsonT)
   3762 
   3763   smallJsont* r;
   3764   smallJsont *self = allocSmallJson();
   3765   smallJsont *value;
   3766 
   3767   value   = allocSmallJson();
   3768   r       = self->f->setSmallJson(self, "1", value);
   3769   ck_assert_ptr_ne(r, null);
   3770   value->f->setInt(value, "a", 1);
   3771   r       = self->f->setNFreePSmallJson(self, "1", value);
   3772   ck_assert_ptr_ne(r, null);
   3773   char *s = toStringO(r);
   3774   ck_assert_str_eq(s, "{\"1\":{\"a\":1}}");
   3775   free(s);
   3776   // empty smallJson
   3777   value   = allocSmallJson();
   3778   r = self->f->setNFreePSmallJson(self, "1", value);
   3779   ck_assert_ptr_eq(r, null);
   3780   terminateO(value);
   3781   // non smallJson object
   3782   value = (smallJsont*) allocSmallInt(2);
   3783   r = self->f->setNFreePSmallJson(self, "1", value);
   3784   ck_assert_ptr_eq(r, null);
   3785   terminateO(value);
   3786   // path
   3787   value = allocSmallJson();
   3788   value->f->setInt(value, "b", 2);
   3789   createSmallArray(a);
   3790   createSmallDict(d);
   3791   a.f->pushDict(&a, &d);
   3792   self->f->setArray(self, "array", &a);
   3793   r = self->f->setNFreePSmallJson(self, "\"array\"[0].\"key\"", value);
   3794   ck_assert_ptr_ne(r, null);
   3795   s = toStringO(r);
   3796   ck_assert_str_eq(s, "{\"1\":{\"a\":1},\"array\":[{\"key\":{\"b\":2}}]}");
   3797   free(s);
   3798   // json bool
   3799   value = allocSmallJson();
   3800   value->f->setInt(value, "b", 2);
   3801   freeO(self);
   3802   setTypeBoolO(self);
   3803   r = self->f->setNFreePSmallJson(self, "1", value);
   3804   ck_assert_ptr_eq(r, null);
   3805   // json array
   3806   freeO(self);
   3807   setTypeArrayO(self);
   3808   r = self->f->setNFreePSmallJson(self, "1", value);
   3809   ck_assert_ptr_eq(r, null);
   3810   // non existing dict path
   3811   freeO(self);
   3812   r = self->f->setNFreePSmallJson(self, "\"1\"[1]", value);
   3813   ck_assert_ptr_eq(r, null);
   3814   //    wrong path and empty smallInt container (sInt is allocated in toSmallt)
   3815   createSmallJson(i);
   3816   r = self->f->setNFreePSmallJson(self, "\"1\".[1]", &i);
   3817   ck_assert_ptr_eq(r, null);
   3818   freeO(&i);
   3819   //   dict path but the object is an array
   3820   resetO(&a);
   3821   self->f->setArray(self, "1", &a);
   3822   r = self->f->setNFreePSmallJson(self, "\"1\".\"1\"", value);
   3823   ck_assert_ptr_eq(r, null);
   3824   //   dict object in path but the key doesn't exists
   3825   resetO(&d);
   3826   self->f->setDict(self, "2", &d);
   3827   r = self->f->setNFreePSmallJson(self, "\"2\".\"1\".[12]", value);
   3828   ck_assert_ptr_eq(r, null);
   3829   // null value
   3830   r = self->f->setNFreePSmallJson(self, "1", null);
   3831   ck_assert_ptr_eq(r, null);
   3832   // null key
   3833   r = self->f->setNFreePSmallJson(self, null, value);
   3834   ck_assert_ptr_eq(r, null);
   3835   terminateO(self);
   3836   terminateO(value);
   3837 
   3838 END_TEST
   3839 
   3840 
   3841 START_TEST(setNFreePSmallStringSmallJsonT)
   3842 
   3843   smallJsont* r;
   3844   smallJsont *self = allocSmallJson();
   3845   smallStringt *value;
   3846 
   3847   value = allocSmallString("");
   3848   r       = self->f->setSmallString(self, "1", value);
   3849   ck_assert_ptr_ne(r, null);
   3850   value->f->appendS(value, "2");
   3851   r       = self->f->setNFreePSmallString(self, "1", value);
   3852   ck_assert_ptr_ne(r, null);
   3853   char *s = toStringO(r);
   3854   ck_assert_str_eq(s, "{\"1\":\"2\"}");
   3855   free(s);
   3856   // empty SmallString
   3857   value   = allocSmallString("");
   3858   freeO(value);
   3859   r = self->f->setNFreePSmallString(self, "1", value);
   3860   ck_assert_ptr_eq(r, null);
   3861   terminateO(value);
   3862   // non smallString object
   3863   value = (smallStringt*) allocSmallInt(2);
   3864   r = self->f->setNFreePSmallString(self, "1", value);
   3865   ck_assert_ptr_eq(r, null);
   3866   terminateO(value);
   3867   // path
   3868   value = allocSmallString("asd");
   3869   createSmallArray(a);
   3870   createSmallDict(d);
   3871   a.f->pushDict(&a, &d);
   3872   self->f->setArray(self, "array", &a);
   3873   r = self->f->setNFreePSmallString(self, "\"array\"[0].\"key\"", value);
   3874   ck_assert_ptr_ne(r, null);
   3875   s = toStringO(r);
   3876   ck_assert_str_eq(s, "{\"1\":\"2\",\"array\":[{\"key\":\"asd\"}]}");
   3877   free(s);
   3878   // json bool
   3879   value = allocSmallString("ASD");
   3880   freeO(self);
   3881   setTypeBoolO(self);
   3882   r = self->f->setNFreePSmallString(self, "1", value);
   3883   ck_assert_ptr_eq(r, null);
   3884   // json array
   3885   freeO(self);
   3886   setTypeArrayO(self);
   3887   r = self->f->setNFreePSmallString(self, "1", value);
   3888   ck_assert_ptr_eq(r, null);
   3889   // non existing dict path
   3890   freeO(self);
   3891   r = self->f->setNFreePSmallString(self, "\"1\"[1]", value);
   3892   ck_assert_ptr_eq(r, null);
   3893   //    wrong path and empty smallInt container (sInt is allocated in toSmallt)
   3894   createSmallString(i);
   3895   r = self->f->setNFreePSmallString(self, "\"1\".[1]", &i);
   3896   ck_assert_ptr_eq(r, null);
   3897   freeO(&i);
   3898   //   dict path but the object is an array
   3899   resetO(&a);
   3900   self->f->setArray(self, "1", &a);
   3901   r = self->f->setNFreePSmallString(self, "\"1\".\"1\"", value);
   3902   ck_assert_ptr_eq(r, null);
   3903   //   dict object in path but the key doesn't exists
   3904   resetO(&d);
   3905   self->f->setDict(self, "2", &d);
   3906   r = self->f->setNFreePSmallString(self, "\"2\".\"1\".[12]", value);
   3907   ck_assert_ptr_eq(r, null);
   3908   // null value
   3909   r = self->f->setNFreePSmallString(self, "1", null);
   3910   ck_assert_ptr_eq(r, null);
   3911   // null key
   3912   r = self->f->setNFreePSmallString(self, null, value);
   3913   ck_assert_ptr_eq(r, null);
   3914   terminateO(self);
   3915   terminateO(value);
   3916 
   3917 END_TEST
   3918 
   3919 
   3920 START_TEST(setAtSmallJsonT)
   3921 
   3922   smallJsont* r;
   3923   smallJsont *self = allocSmallJson();
   3924   baset *value;
   3925 
   3926   // add elements to self
   3927   r = self->f->pushInt(self, 1);
   3928   ck_assert_ptr_ne(r, null);
   3929   r = self->f->pushInt(self, 2);
   3930   ck_assert_ptr_ne(r, null);
   3931   r = self->f->pushInt(self, 3);
   3932   ck_assert_ptr_ne(r, null);
   3933   r = self->f->pushInt(self, 4);
   3934   ck_assert_ptr_ne(r, null);
   3935 
   3936   // positive index
   3937   value   = (baset*)allocSmallInt(123);
   3938   r       = self->f->setAt(self, 1, value);
   3939   ck_assert_ptr_ne(r, null);
   3940   finishO(value);
   3941   char *s = toStringO(r);
   3942   ck_assert_str_eq(s, "[1,123,3,4]");
   3943   free(s);
   3944   // negative index
   3945   value   = (baset*)allocSmallInt(234);
   3946   r = self->f->setAt(self, -1, value);
   3947   ck_assert_ptr_ne(r, null);
   3948   finishO(value);
   3949   s = toStringO(r);
   3950   ck_assert_str_eq(s, "[1,123,3,234]");
   3951   free(s);
   3952   // undefined object
   3953   value   = (baset*)allocUndefined();
   3954   r = self->f->setAt(self, -1, value);
   3955   ck_assert_ptr_ne(r, null);
   3956   finishO(value);
   3957   s = toStringO(r);
   3958   ck_assert_str_eq(s, "[1,123,3,null]");
   3959   free(s);
   3960   // container
   3961   createAllocateSmallContainer(c);
   3962   r = self->f->setAt(self, -1, (baset*)c);
   3963   ck_assert_ptr_ne(r, null);
   3964   finishO(c);
   3965   s = toStringO(r);
   3966   ck_assert_str_eq(s, "[1,123,3,\"<data container>\"]");
   3967   free(s);
   3968   // base object in container
   3969   createAllocateSmallInt(I);
   3970   setValG(I, 11);
   3971   I->type = "anothertype";
   3972   r = self->f->setAt(self, -1, (baset*)I);
   3973   ck_assert_ptr_ne(r, null);
   3974   s = toStringO(r);
   3975   ck_assert_str_eq(s, "[1,123,3,\"<data container>\"]");
   3976   free(s);
   3977   // index outside
   3978   value = (baset*)allocSmallInt(123);
   3979   ck_assert_ptr_eq(self->f->setAt(self, 20, value), NULL);
   3980   ck_assert_ptr_eq(self->f->setAt(self, -8, value), NULL);
   3981   // empty list
   3982   emptyO(self);
   3983   ck_assert_ptr_eq(self->f->setAt(self, 0, value), NULL);
   3984   ck_assert_ptr_eq(self->f->setAt(self, -1, value), NULL);
   3985   terminateO(value);
   3986   // NULL value
   3987   ck_assert_ptr_eq(self->f->setAt(self, 0, NULL), NULL);
   3988   terminateO(self);
   3989 
   3990 END_TEST
   3991 
   3992 
   3993 START_TEST(setAtUndefinedSmallJsonT)
   3994 
   3995   smallJsont* r;
   3996   smallJsont *self = allocSmallJson();
   3997 
   3998   // add elements to self
   3999   r = self->f->pushInt(self, 1);
   4000   ck_assert_ptr_ne(r, null);
   4001   r = self->f->pushInt(self, 2);
   4002   ck_assert_ptr_ne(r, null);
   4003   r = self->f->pushInt(self, 3);
   4004   ck_assert_ptr_ne(r, null);
   4005   r = self->f->pushInt(self, 4);
   4006   ck_assert_ptr_ne(r, null);
   4007 
   4008   // positive index
   4009   r       = self->f->setAtUndefined(self, 1);
   4010   ck_assert_ptr_ne(r, null);
   4011   char *s = toStringO(r);
   4012   ck_assert_str_eq(s, "[1,null,3,4]");
   4013   free(s);
   4014   // negative index
   4015   r = self->f->setAtUndefined(self, -1);
   4016   ck_assert_ptr_ne(r, null);
   4017   s = toStringO(r);
   4018   ck_assert_str_eq(s, "[1,null,3,null]");
   4019   free(s);
   4020   // index outside
   4021   ck_assert_ptr_eq(self->f->setAtUndefined(self, 20), NULL);
   4022   ck_assert_ptr_eq(self->f->setAtUndefined(self, -8), NULL);
   4023   // empty list
   4024   emptyO(self);
   4025   ck_assert_ptr_eq(self->f->setAtUndefined(self, 0), NULL);
   4026   ck_assert_ptr_eq(self->f->setAtUndefined(self, -1), NULL);
   4027   // non json array
   4028   freeO(self);
   4029   setTypeBoolO(self);
   4030   ck_assert_ptr_eq(self->f->setAtUndefined(self, 0), NULL);
   4031   terminateO(self);
   4032 
   4033 END_TEST
   4034 
   4035 
   4036 START_TEST(setAtBoolSmallJsonT)
   4037 
   4038   smallJsont* r;
   4039   smallJsont *self = allocSmallJson();
   4040 
   4041   // add elements to self
   4042   r = self->f->pushInt(self, 1);
   4043   ck_assert_ptr_ne(r, null);
   4044   r = self->f->pushInt(self, 2);
   4045   ck_assert_ptr_ne(r, null);
   4046   r = self->f->pushInt(self, 3);
   4047   ck_assert_ptr_ne(r, null);
   4048   r = self->f->pushInt(self, 4);
   4049   ck_assert_ptr_ne(r, null);
   4050 
   4051   // positive index
   4052   r       = self->f->setAtBool(self, 1, true);
   4053   ck_assert_ptr_ne(r, null);
   4054   char *s = toStringO(r);
   4055   ck_assert_str_eq(s, "[1,true,3,4]");
   4056   free(s);
   4057   // negative index
   4058   r = self->f->setAtBool(self, -1, true);
   4059   ck_assert_ptr_ne(r, null);
   4060   s = toStringO(r);
   4061   ck_assert_str_eq(s, "[1,true,3,true]");
   4062   free(s);
   4063   // index outside
   4064   ck_assert_ptr_eq(self->f->setAtBool(self, 20, true), NULL);
   4065   ck_assert_ptr_eq(self->f->setAtBool(self, -8, true), NULL);
   4066   // empty list
   4067   emptyO(self);
   4068   ck_assert_ptr_eq(self->f->setAtBool(self, 0, true), NULL);
   4069   ck_assert_ptr_eq(self->f->setAtBool(self, -1, true), NULL);
   4070   // non json array
   4071   freeO(self);
   4072   setTypeBoolO(self);
   4073   ck_assert_ptr_eq(self->f->setAtBool(self, 0, true), NULL);
   4074   terminateO(self);
   4075 
   4076 END_TEST
   4077 
   4078 
   4079 START_TEST(setAtDoubleSmallJsonT)
   4080 
   4081   smallJsont* r;
   4082   smallJsont *self = allocSmallJson();
   4083 
   4084   // add elements to self
   4085   r = self->f->pushInt(self, 1);
   4086   ck_assert_ptr_ne(r, null);
   4087   r = self->f->pushInt(self, 2);
   4088   ck_assert_ptr_ne(r, null);
   4089   r = self->f->pushInt(self, 3);
   4090   ck_assert_ptr_ne(r, null);
   4091   r = self->f->pushInt(self, 4);
   4092   ck_assert_ptr_ne(r, null);
   4093 
   4094   // positive index
   4095   r       = self->f->setAtDouble(self, 1, 12);
   4096   ck_assert_ptr_ne(r, null);
   4097   char *s = toStringO(r);
   4098   ck_assert_str_eq(s, "[1,1.200000e+01,3,4]");
   4099   free(s);
   4100   // negative index
   4101   r = self->f->setAtDouble(self, -1, 14);
   4102   ck_assert_ptr_ne(r, null);
   4103   s = toStringO(r);
   4104   ck_assert_str_eq(s, "[1,1.200000e+01,3,1.400000e+01]");
   4105   free(s);
   4106   // index outside
   4107   ck_assert_ptr_eq(self->f->setAtDouble(self, 20, 1), NULL);
   4108   ck_assert_ptr_eq(self->f->setAtDouble(self, -8, 1), NULL);
   4109   // empty list
   4110   emptyO(self);
   4111   ck_assert_ptr_eq(self->f->setAtDouble(self, 0, 1), NULL);
   4112   ck_assert_ptr_eq(self->f->setAtDouble(self, -1, 1), NULL);
   4113   // non json array
   4114   freeO(self);
   4115   setTypeBoolO(self);
   4116   ck_assert_ptr_eq(self->f->setAtDouble(self, 0, 1), NULL);
   4117   terminateO(self);
   4118 
   4119 END_TEST
   4120 
   4121 
   4122 START_TEST(setAtIntSmallJsonT)
   4123 
   4124   smallJsont* r;
   4125   smallJsont *self = allocSmallJson();
   4126 
   4127   // add elements to self
   4128   r = self->f->pushInt(self, 1);
   4129   ck_assert_ptr_ne(r, null);
   4130   r = self->f->pushInt(self, 2);
   4131   ck_assert_ptr_ne(r, null);
   4132   r = self->f->pushInt(self, 3);
   4133   ck_assert_ptr_ne(r, null);
   4134   r = self->f->pushInt(self, 4);
   4135   ck_assert_ptr_ne(r, null);
   4136 
   4137   // positive index
   4138   r       = self->f->setAtInt(self, 1, 12);
   4139   ck_assert_ptr_ne(r, null);
   4140   char *s = toStringO(r);
   4141   ck_assert_str_eq(s, "[1,12,3,4]");
   4142   free(s);
   4143   // negative index
   4144   r = self->f->setAtInt(self, -1, 14);
   4145   ck_assert_ptr_ne(r, null);
   4146   s = toStringO(r);
   4147   ck_assert_str_eq(s, "[1,12,3,14]");
   4148   free(s);
   4149   // index outside
   4150   ck_assert_ptr_eq(self->f->setAtInt(self, 20, 1), NULL);
   4151   ck_assert_ptr_eq(self->f->setAtInt(self, -8, 1), NULL);
   4152   // empty list
   4153   emptyO(self);
   4154   ck_assert_ptr_eq(self->f->setAtInt(self, 0, 1), NULL);
   4155   ck_assert_ptr_eq(self->f->setAtInt(self, -1, 1), NULL);
   4156   // non json array
   4157   freeO(self);
   4158   setTypeBoolO(self);
   4159   ck_assert_ptr_eq(self->f->setAtInt(self, 0, 1), NULL);
   4160   terminateO(self);
   4161 
   4162 END_TEST
   4163 
   4164 
   4165 START_TEST(setAtSSmallJsonT)
   4166 
   4167   smallJsont* r;
   4168   smallJsont *self = allocSmallJson();
   4169 
   4170   // add elements to self
   4171   r = self->f->pushInt(self, 1);
   4172   ck_assert_ptr_ne(r, null);
   4173   r = self->f->pushInt(self, 2);
   4174   ck_assert_ptr_ne(r, null);
   4175   r = self->f->pushInt(self, 3);
   4176   ck_assert_ptr_ne(r, null);
   4177   r = self->f->pushInt(self, 4);
   4178   ck_assert_ptr_ne(r, null);
   4179 
   4180   // positive index
   4181   r       = self->f->setAtS(self, 1, "a");
   4182   ck_assert_ptr_ne(r, null);
   4183   char *s = toStringO(r);
   4184   ck_assert_str_eq(s, "[1,\"a\",3,4]");
   4185   free(s);
   4186   // negative index
   4187   r = self->f->setAtS(self, -1, "b");
   4188   ck_assert_ptr_ne(r, null);
   4189   s = toStringO(r);
   4190   ck_assert_str_eq(s, "[1,\"a\",3,\"b\"]");
   4191   free(s);
   4192   // NULL string
   4193   r = self->f->setAtS(self, -1, NULL);
   4194   ck_assert_ptr_eq(r, null);
   4195   // index outside
   4196   ck_assert_ptr_eq(self->f->setAtS(self, 20, ""), NULL);
   4197   ck_assert_ptr_eq(self->f->setAtS(self, -8, ""), NULL);
   4198   // empty list
   4199   emptyO(self);
   4200   ck_assert_ptr_eq(self->f->setAtS(self, 0, ""), NULL);
   4201   ck_assert_ptr_eq(self->f->setAtS(self, -1, ""), NULL);
   4202   terminateO(self);
   4203 
   4204 END_TEST
   4205 
   4206 
   4207 START_TEST(setAtCharSmallJsonT)
   4208 
   4209   smallJsont* r;
   4210   smallJsont *self = allocSmallJson();
   4211 
   4212   // add elements to self
   4213   r = self->f->pushInt(self, 1);
   4214   ck_assert_ptr_ne(r, null);
   4215   r = self->f->pushInt(self, 2);
   4216   ck_assert_ptr_ne(r, null);
   4217   r = self->f->pushInt(self, 3);
   4218   ck_assert_ptr_ne(r, null);
   4219   r = self->f->pushInt(self, 4);
   4220   ck_assert_ptr_ne(r, null);
   4221 
   4222   // positive index
   4223   r       = self->f->setAtChar(self, 1, 'a');
   4224   ck_assert_ptr_ne(r, null);
   4225   char *s = toStringO(r);
   4226   ck_assert_str_eq(s, "[1,\"a\",3,4]");
   4227   free(s);
   4228   // negative index
   4229   r = self->f->setAtChar(self, -1, 'b');
   4230   ck_assert_ptr_ne(r, null);
   4231   s = toStringO(r);
   4232   ck_assert_str_eq(s, "[1,\"a\",3,\"b\"]");
   4233   free(s);
   4234   // index outside
   4235   ck_assert_ptr_eq(self->f->setAtChar(self, 20, 'a'), NULL);
   4236   ck_assert_ptr_eq(self->f->setAtChar(self, -8, 's'), NULL);
   4237   // empty list
   4238   emptyO(self);
   4239   ck_assert_ptr_eq(self->f->setAtChar(self, 0, 'a'), NULL);
   4240   ck_assert_ptr_eq(self->f->setAtChar(self, -1, 's'), NULL);
   4241   terminateO(self);
   4242 
   4243 END_TEST
   4244 
   4245 
   4246 START_TEST(setAtDictSmallJsonT)
   4247 
   4248   smallJsont* r;
   4249   smallJsont *self = allocSmallJson();
   4250   smallDictt *value;
   4251 
   4252   // add elements to self
   4253   r = self->f->pushInt(self, 1);
   4254   ck_assert_ptr_ne(r, null);
   4255   r = self->f->pushInt(self, 2);
   4256   ck_assert_ptr_ne(r, null);
   4257   r = self->f->pushInt(self, 3);
   4258   ck_assert_ptr_ne(r, null);
   4259   r = self->f->pushInt(self, 4);
   4260   ck_assert_ptr_ne(r, null);
   4261 
   4262   // positive index
   4263   value   = allocSmallDict();
   4264   r       = self->f->setAtDict(self, 1, value);
   4265   ck_assert_ptr_ne(r, null);
   4266   finishO(value);
   4267   char *s = toStringO(r);
   4268   ck_assert_str_eq(s, "[1,{},3,4]");
   4269   free(s);
   4270   // negative index
   4271   value   = allocSmallDict();
   4272   r = self->f->setAtDict(self, -1, value);
   4273   ck_assert_ptr_ne(r, null);
   4274   finishO(value);
   4275   s = toStringO(r);
   4276   ck_assert_str_eq(s, "[1,{},3,{}]");
   4277   free(s);
   4278   // index outside
   4279   value = allocSmallDict();
   4280   ck_assert_ptr_eq(self->f->setAtDict(self, 20, value), NULL);
   4281   ck_assert_ptr_eq(self->f->setAtDict(self, -8, value), NULL);
   4282   // empty list
   4283   emptyO(self);
   4284   ck_assert_ptr_eq(self->f->setAtDict(self, 0, value), NULL);
   4285   ck_assert_ptr_eq(self->f->setAtDict(self, -1, value), NULL);
   4286   terminateO(value);
   4287   // non smallDict object
   4288   value = (smallDictt*) allocSmallInt(2);
   4289   r = self->f->setAtDict(self, 0, value);
   4290   ck_assert_ptr_eq(r, null);
   4291   terminateO(value);
   4292   // NULL value
   4293   ck_assert_ptr_eq(self->f->setAtDict(self, 0, NULL), NULL);
   4294   terminateO(self);
   4295 
   4296 END_TEST
   4297 
   4298 
   4299 START_TEST(setAtArraySmallJsonT)
   4300 
   4301   smallJsont* r;
   4302   smallJsont *self = allocSmallJson();
   4303   smallArrayt *value;
   4304 
   4305   // add elements to self
   4306   r = self->f->pushInt(self, 1);
   4307   ck_assert_ptr_ne(r, null);
   4308   r = self->f->pushInt(self, 2);
   4309   ck_assert_ptr_ne(r, null);
   4310   r = self->f->pushInt(self, 3);
   4311   ck_assert_ptr_ne(r, null);
   4312   r = self->f->pushInt(self, 4);
   4313   ck_assert_ptr_ne(r, null);
   4314 
   4315   // positive index
   4316   value   = allocSmallArray();
   4317   r       = self->f->setAtArray(self, 1, value);
   4318   ck_assert_ptr_ne(r, null);
   4319   finishO(value);
   4320   char *s = toStringO(r);
   4321   ck_assert_str_eq(s, "[1,[],3,4]");
   4322   free(s);
   4323   // negative index
   4324   value   = allocSmallArray();
   4325   r = self->f->setAtArray(self, -1, value);
   4326   ck_assert_ptr_ne(r, null);
   4327   finishO(value);
   4328   s = toStringO(r);
   4329   ck_assert_str_eq(s, "[1,[],3,[]]");
   4330   free(s);
   4331   // index outside
   4332   value = allocSmallArray();
   4333   ck_assert_ptr_eq(self->f->setAtArray(self, 20, value), NULL);
   4334   ck_assert_ptr_eq(self->f->setAtArray(self, -8, value), NULL);
   4335   // empty list
   4336   emptyO(self);
   4337   ck_assert_ptr_eq(self->f->setAtArray(self, 0, value), NULL);
   4338   ck_assert_ptr_eq(self->f->setAtArray(self, -1, value), NULL);
   4339   terminateO(value);
   4340   // non smallArray object
   4341   value = (smallArrayt*) allocSmallInt(2);
   4342   r = self->f->setAtArray(self, 0, value);
   4343   ck_assert_ptr_eq(r, null);
   4344   terminateO(value);
   4345   // NULL value
   4346   ck_assert_ptr_eq(self->f->setAtArray(self, 0, NULL), NULL);
   4347   terminateO(self);
   4348 
   4349 END_TEST
   4350 
   4351 
   4352 START_TEST(setAtArraycSmallJsonT)
   4353 
   4354   smallJsont* r;
   4355   smallJsont *self = allocSmallJson();
   4356   char **value;
   4357 
   4358   // add elements to self
   4359   r = self->f->pushInt(self, 1);
   4360   ck_assert_ptr_ne(r, null);
   4361   r = self->f->pushInt(self, 2);
   4362   ck_assert_ptr_ne(r, null);
   4363   r = self->f->pushInt(self, 3);
   4364   ck_assert_ptr_ne(r, null);
   4365   r = self->f->pushInt(self, 4);
   4366   ck_assert_ptr_ne(r, null);
   4367 
   4368   // positive index
   4369   value   = listCreateS("a");
   4370   r       = self->f->setAtArrayc(self, 1, value);
   4371   ck_assert_ptr_ne(r, null);
   4372   listFreeS(value);
   4373   char *s = toStringO(r);
   4374   ck_assert_str_eq(s, "[1,[\"a\"],3,4]");
   4375   free(s);
   4376   // negative index
   4377   value   = listCreateS("b");
   4378   r = self->f->setAtArrayc(self, -1, value);
   4379   ck_assert_ptr_ne(r, null);
   4380   listFreeS(value);
   4381   s = toStringO(r);
   4382   ck_assert_str_eq(s, "[1,[\"a\"],3,[\"b\"]]");
   4383   free(s);
   4384   // index outside
   4385   value = (char**)r;
   4386   ck_assert_ptr_eq(self->f->setAtArrayc(self, 20, value), NULL);
   4387   ck_assert_ptr_eq(self->f->setAtArrayc(self, -8, value), NULL);
   4388   // empty list
   4389   emptyO(self);
   4390   ck_assert_ptr_eq(self->f->setAtArrayc(self, 0, value), NULL);
   4391   ck_assert_ptr_eq(self->f->setAtArrayc(self, -1, value), NULL);
   4392   // NULL value
   4393   ck_assert_ptr_eq(self->f->setAtArrayc(self, 0, NULL), NULL);
   4394   terminateO(self);
   4395 
   4396 END_TEST
   4397 
   4398 
   4399 START_TEST(setAtSmallBoolSmallJsonT)
   4400 
   4401   smallJsont* r;
   4402   smallJsont *self = allocSmallJson();
   4403   smallBoolt *value;
   4404 
   4405   // add elements to self
   4406   r = self->f->pushInt(self, 1);
   4407   ck_assert_ptr_ne(r, null);
   4408   r = self->f->pushInt(self, 2);
   4409   ck_assert_ptr_ne(r, null);
   4410   r = self->f->pushInt(self, 3);
   4411   ck_assert_ptr_ne(r, null);
   4412   r = self->f->pushInt(self, 4);
   4413   ck_assert_ptr_ne(r, null);
   4414 
   4415   // positive index
   4416   value   = allocSmallBool(true);
   4417   r       = self->f->setAtSmallBool(self, 1, value);
   4418   ck_assert_ptr_ne(r, null);
   4419   finishO(value);
   4420   char *s = toStringO(r);
   4421   ck_assert_str_eq(s, "[1,true,3,4]");
   4422   free(s);
   4423   // negative index
   4424   value   = allocSmallBool(true);
   4425   r = self->f->setAtSmallBool(self, -1, value);
   4426   ck_assert_ptr_ne(r, null);
   4427   finishO(value);
   4428   s = toStringO(r);
   4429   ck_assert_str_eq(s, "[1,true,3,true]");
   4430   free(s);
   4431   // empty smallBool
   4432   value = allocSmallBool(true);
   4433   freeO(value);
   4434   r = self->f->setAtSmallBool(self, -1, value);
   4435   ck_assert_ptr_ne(r, null);
   4436   finishO(value);
   4437   s = toStringO(r);
   4438   ck_assert_str_eq(s, "[1,true,3,false]");
   4439   free(s);
   4440   // index outside
   4441   value = allocSmallBool(true);
   4442   ck_assert_ptr_eq(self->f->setAtSmallBool(self, 20, value), NULL);
   4443   ck_assert_ptr_eq(self->f->setAtSmallBool(self, -8, value), NULL);
   4444   // empty list
   4445   emptyO(self);
   4446   ck_assert_ptr_eq(self->f->setAtSmallBool(self, 0, value), NULL);
   4447   ck_assert_ptr_eq(self->f->setAtSmallBool(self, -1, value), NULL);
   4448   terminateO(value);
   4449   // non smallBool object
   4450   value = (smallBoolt*) allocSmallInt(2);
   4451   r = self->f->setAtSmallBool(self, 0, value);
   4452   ck_assert_ptr_eq(r, null);
   4453   terminateO(value);
   4454   // NULL value
   4455   ck_assert_ptr_eq(self->f->setAtSmallBool(self, 0, NULL), NULL);
   4456   terminateO(self);
   4457 
   4458 END_TEST
   4459 
   4460 
   4461 START_TEST(setAtSmallBytesSmallJsonT)
   4462 
   4463   smallJsont* r;
   4464   smallJsont *self = allocSmallJson();
   4465   smallBytest *value;
   4466 
   4467   // add elements to self
   4468   r = self->f->pushInt(self, 1);
   4469   ck_assert_ptr_ne(r, null);
   4470   r = self->f->pushInt(self, 2);
   4471   ck_assert_ptr_ne(r, null);
   4472   r = self->f->pushInt(self, 3);
   4473   ck_assert_ptr_ne(r, null);
   4474   r = self->f->pushInt(self, 4);
   4475   ck_assert_ptr_ne(r, null);
   4476 
   4477   // positive index
   4478   value   = allocSmallBytes(NULL, 0);
   4479   r       = self->f->setAtSmallBytes(self, 1, value);
   4480   ck_assert_ptr_ne(r, null);
   4481   finishO(value);
   4482   char *s = toStringO(r);
   4483   ck_assert_str_eq(s, "[1,[],3,4]");
   4484   free(s);
   4485   // empty smallBytes
   4486   value   = allocSmallBytes(NULL, 0);
   4487   freeO(value);
   4488   r       = self->f->setAtSmallBytes(self, 1, value);
   4489   ck_assert_ptr_ne(r, null);
   4490   finishO(value);
   4491   s = toStringO(r);
   4492   ck_assert_str_eq(s, "[1,[],3,4]");
   4493   free(s);
   4494   // negative index
   4495   value   = allocSmallBytes(NULL, 0);
   4496   r = self->f->setAtSmallBytes(self, -1, value);
   4497   ck_assert_ptr_ne(r, null);
   4498   finishO(value);
   4499   s = toStringO(r);
   4500   ck_assert_str_eq(s, "[1,[],3,[]]");
   4501   free(s);
   4502   // index outside
   4503   value = allocSmallBytes(NULL, 0);
   4504   ck_assert_ptr_eq(self->f->setAtSmallBytes(self, 20, value), NULL);
   4505   ck_assert_ptr_eq(self->f->setAtSmallBytes(self, -5, value), NULL);
   4506   // empty list
   4507   emptyO(self);
   4508   ck_assert_ptr_eq(self->f->setAtSmallBytes(self, 0, value), NULL);
   4509   ck_assert_ptr_eq(self->f->setAtSmallBytes(self, -1, value), NULL);
   4510   terminateO(value);
   4511   // non smallBytes object
   4512   value = (smallBytest*) allocSmallInt(2);
   4513   r = self->f->setAtSmallBytes(self, 0, value);
   4514   ck_assert_ptr_eq(r, null);
   4515   terminateO(value);
   4516   // NULL value
   4517   ck_assert_ptr_eq(self->f->setAtSmallBytes(self, 0, NULL), NULL);
   4518   terminateO(self);
   4519 
   4520 END_TEST
   4521 
   4522 
   4523 START_TEST(setAtSmallDoubleSmallJsonT)
   4524 
   4525   smallJsont* r;
   4526   smallJsont *self = allocSmallJson();
   4527   smallDoublet *value;
   4528 
   4529   // add elements to self
   4530   r = self->f->pushInt(self, 1);
   4531   ck_assert_ptr_ne(r, null);
   4532   r = self->f->pushInt(self, 2);
   4533   ck_assert_ptr_ne(r, null);
   4534   r = self->f->pushInt(self, 3);
   4535   ck_assert_ptr_ne(r, null);
   4536   r = self->f->pushInt(self, 4);
   4537   ck_assert_ptr_ne(r, null);
   4538 
   4539   // positive index
   4540   value   = allocSmallDouble(5);
   4541   r       = self->f->setAtSmallDouble(self, 1, value);
   4542   ck_assert_ptr_ne(r, null);
   4543   finishO(value);
   4544   char *s = toStringO(r);
   4545   ck_assert_str_eq(s, "[1,5.000000e+00,3,4]");
   4546   free(s);
   4547   // negative index
   4548   value   = allocSmallDouble(6);
   4549   r = self->f->setAtSmallDouble(self, -1, value);
   4550   ck_assert_ptr_ne(r, null);
   4551   finishO(value);
   4552   s = toStringO(r);
   4553   ck_assert_str_eq(s, "[1,5.000000e+00,3,6.000000e+00]");
   4554   free(s);
   4555   // empty smallDouble
   4556   value   = allocSmallDouble(0);
   4557   freeO(value);
   4558   r = self->f->setAtSmallDouble(self, -1, value);
   4559   ck_assert_ptr_ne(r, null);
   4560   finishO(value);
   4561   s = toStringO(r);
   4562   ck_assert_str_eq(s, "[1,5.000000e+00,3,0.000000e+00]");
   4563   free(s);
   4564   // index outside
   4565   value = allocSmallDouble(1);
   4566   ck_assert_ptr_eq(self->f->setAtSmallDouble(self, 20, value), NULL);
   4567   ck_assert_ptr_eq(self->f->setAtSmallDouble(self, -8, value), NULL);
   4568   // empty list
   4569   emptyO(self);
   4570   ck_assert_ptr_eq(self->f->setAtSmallDouble(self, 0, value), NULL);
   4571   ck_assert_ptr_eq(self->f->setAtSmallDouble(self, -1, value), NULL);
   4572   terminateO(value);
   4573   // non smallDouble object
   4574   value = (smallDoublet*) allocSmallInt(2);
   4575   r = self->f->setAtSmallDouble(self, 0, value);
   4576   ck_assert_ptr_eq(r, null);
   4577   terminateO(value);
   4578   // NULL value
   4579   ck_assert_ptr_eq(self->f->setAtSmallDouble(self, 0, NULL), NULL);
   4580   terminateO(self);
   4581 
   4582 END_TEST
   4583 
   4584 
   4585 START_TEST(setAtSmallIntSmallJsonT)
   4586 
   4587   smallJsont* r;
   4588   smallJsont *self = allocSmallJson();
   4589   smallIntt *value;
   4590 
   4591   // add elements to self
   4592   r = self->f->pushInt(self, 1);
   4593   ck_assert_ptr_ne(r, null);
   4594   r = self->f->pushInt(self, 2);
   4595   ck_assert_ptr_ne(r, null);
   4596   r = self->f->pushInt(self, 3);
   4597   ck_assert_ptr_ne(r, null);
   4598   r = self->f->pushInt(self, 4);
   4599   ck_assert_ptr_ne(r, null);
   4600 
   4601   // positive index
   4602   value   = allocSmallInt(5);
   4603   r       = self->f->setAtSmallInt(self, 1, value);
   4604   ck_assert_ptr_ne(r, null);
   4605   finishO(value);
   4606   char *s = toStringO(r);
   4607   ck_assert_str_eq(s, "[1,5,3,4]");
   4608   free(s);
   4609   // negative index
   4610   value   = allocSmallInt(6);
   4611   r = self->f->setAtSmallInt(self, -1, value);
   4612   ck_assert_ptr_ne(r, null);
   4613   finishO(value);
   4614   s = toStringO(r);
   4615   ck_assert_str_eq(s, "[1,5,3,6]");
   4616   free(s);
   4617   // empty SmallInt
   4618   value   = allocSmallInt(0);
   4619   freeO(value);
   4620   r = self->f->setAtSmallInt(self, -1, value);
   4621   ck_assert_ptr_ne(r, null);
   4622   finishO(value);
   4623   s = toStringO(r);
   4624   ck_assert_str_eq(s, "[1,5,3,0]");
   4625   free(s);
   4626   // index outside
   4627   value = allocSmallInt(1);
   4628   ck_assert_ptr_eq(self->f->setAtSmallInt(self, 20, value), NULL);
   4629   ck_assert_ptr_eq(self->f->setAtSmallInt(self, -8, value), NULL);
   4630   // empty list
   4631   emptyO(self);
   4632   ck_assert_ptr_eq(self->f->setAtSmallInt(self, 0, value), NULL);
   4633   ck_assert_ptr_eq(self->f->setAtSmallInt(self, -1, value), NULL);
   4634   terminateO(value);
   4635   // non smallInt object
   4636   value = (smallIntt*) allocSmallBool(true);
   4637   r = self->f->setAtSmallInt(self, 0, value);
   4638   ck_assert_ptr_eq(r, null);
   4639   terminateO(value);
   4640   // NULL value
   4641   ck_assert_ptr_eq(self->f->setAtSmallInt(self, 0, NULL), NULL);
   4642   terminateO(self);
   4643 
   4644 END_TEST
   4645 
   4646 
   4647 START_TEST(setAtSmallJsonSmallJsonT)
   4648 
   4649   smallJsont* r;
   4650   smallJsont *self = allocSmallJson();
   4651   smallJsont *value;
   4652 
   4653   // add elements to self
   4654   r = self->f->pushInt(self, 1);
   4655   ck_assert_ptr_ne(r, null);
   4656   r = self->f->pushInt(self, 2);
   4657   ck_assert_ptr_ne(r, null);
   4658   r = self->f->pushInt(self, 3);
   4659   ck_assert_ptr_ne(r, null);
   4660   r = self->f->pushInt(self, 4);
   4661   ck_assert_ptr_ne(r, null);
   4662 
   4663   // positive index
   4664   value   = allocSmallJson();
   4665   r       = self->f->setAtSmallJson(self, 1, value);
   4666   ck_assert_ptr_ne(r, null);
   4667   finishO(value);
   4668   char *s = toStringO(r);
   4669   ck_assert_str_eq(s, "[1,{},3,4]");
   4670   free(s);
   4671   // negative index
   4672   value   = allocSmallJson();
   4673   r = self->f->setAtSmallJson(self, -1, value);
   4674   ck_assert_ptr_ne(r, null);
   4675   finishO(value);
   4676   s = toStringO(r);
   4677   ck_assert_str_eq(s, "[1,{},3,{}]");
   4678   free(s);
   4679   // index outside
   4680   value = allocSmallJson();
   4681   ck_assert_ptr_eq(self->f->setAtSmallJson(self, 20, value), NULL);
   4682   ck_assert_ptr_eq(self->f->setAtSmallJson(self, -8, value), NULL);
   4683   // empty list
   4684   emptyO(self);
   4685   ck_assert_ptr_eq(self->f->setAtSmallJson(self, 0, value), NULL);
   4686   ck_assert_ptr_eq(self->f->setAtSmallJson(self, -1, value), NULL);
   4687   terminateO(value);
   4688   // non smallJson object
   4689   value = (smallJsont*) allocSmallInt(2);
   4690   r = self->f->setAtSmallJson(self, 0, value);
   4691   ck_assert_ptr_eq(r, null);
   4692   terminateO(value);
   4693   // NULL value
   4694   ck_assert_ptr_eq(self->f->setAtSmallJson(self, 0, NULL), NULL);
   4695   terminateO(self);
   4696 
   4697 END_TEST
   4698 
   4699 
   4700 START_TEST(setAtSmallStringSmallJsonT)
   4701 
   4702   smallJsont* r;
   4703   smallJsont *self = allocSmallJson();
   4704   smallStringt *value;
   4705 
   4706   // add elements to self
   4707   r = self->f->pushInt(self, 1);
   4708   ck_assert_ptr_ne(r, null);
   4709   r = self->f->pushInt(self, 2);
   4710   ck_assert_ptr_ne(r, null);
   4711   r = self->f->pushInt(self, 3);
   4712   ck_assert_ptr_ne(r, null);
   4713   r = self->f->pushInt(self, 4);
   4714   ck_assert_ptr_ne(r, null);
   4715 
   4716   // positive index
   4717   initiateAllocateSmallString(&value);
   4718   r       = self->f->setAtSmallString(self, 1, value);
   4719   ck_assert_ptr_ne(r, null);
   4720   finishO(value);
   4721   char *s = toStringO(r);
   4722   ck_assert_str_eq(s, "[1,\"\",3,4]");
   4723   free(s);
   4724   // negative index
   4725   value   = allocSmallString("a");
   4726   r = self->f->setAtSmallString(self, -1, value);
   4727   ck_assert_ptr_ne(r, null);
   4728   finishO(value);
   4729   s = toStringO(r);
   4730   ck_assert_str_eq(s, "[1,\"\",3,\"a\"]");
   4731   free(s);
   4732   // index outside
   4733   value = allocSmallString("asd");
   4734   ck_assert_ptr_eq(self->f->setAtSmallString(self, 20, value), NULL);
   4735   ck_assert_ptr_eq(self->f->setAtSmallString(self, -8, value), NULL);
   4736   // empty list
   4737   emptyO(self);
   4738   ck_assert_ptr_eq(self->f->setAtSmallString(self, 0, value), NULL);
   4739   ck_assert_ptr_eq(self->f->setAtSmallString(self, -1, value), NULL);
   4740   terminateO(value);
   4741   // non smallString object
   4742   value = (smallStringt*) allocSmallInt(2);
   4743   r = self->f->setAtSmallString(self, 0, value);
   4744   ck_assert_ptr_eq(r, null);
   4745   terminateO(value);
   4746   // NULL value
   4747   ck_assert_ptr_eq(self->f->setAtSmallString(self, 0, NULL), NULL);
   4748   terminateO(self);
   4749 
   4750 END_TEST
   4751 
   4752 
   4753 START_TEST(setAtSmallContainerSmallJsonT)
   4754 
   4755   smallJsont* r;
   4756   smallJsont *self = allocSmallJson();
   4757   smallContainert *value;
   4758 
   4759   // add elements to self
   4760   r = self->f->pushInt(self, 1);
   4761   ck_assert_ptr_ne(r, null);
   4762   r = self->f->pushInt(self, 2);
   4763   ck_assert_ptr_ne(r, null);
   4764   r = self->f->pushInt(self, 3);
   4765   ck_assert_ptr_ne(r, null);
   4766   r = self->f->pushInt(self, 4);
   4767   ck_assert_ptr_ne(r, null);
   4768 
   4769   // positive index
   4770   initiateAllocateSmallContainer(&value);
   4771   r       = self->f->setAtSmallContainer(self, 1, value);
   4772   ck_assert_ptr_ne(r, null);
   4773   finishO(value);
   4774   char *s = toStringO(r);
   4775   ck_assert_str_eq(s, "[1,\"<data container>\",3,4]");
   4776   free(s);
   4777   // negative index
   4778   initiateAllocateSmallContainer(&value);
   4779   r = self->f->setAtSmallContainer(self, -1, value);
   4780   ck_assert_ptr_ne(r, null);
   4781   finishO(value);
   4782   s = toStringO(r);
   4783   ck_assert_str_eq(s, "[1,\"<data container>\",3,\"<data container>\"]");
   4784   free(s);
   4785   // index outside
   4786   initiateAllocateSmallContainer(&value);
   4787   ck_assert_ptr_eq(self->f->setAtSmallContainer(self, 20, value), NULL);
   4788   ck_assert_ptr_eq(self->f->setAtSmallContainer(self, -8, value), NULL);
   4789   // empty list
   4790   emptyO(self);
   4791   ck_assert_ptr_eq(self->f->setAtSmallContainer(self, 0, value), NULL);
   4792   ck_assert_ptr_eq(self->f->setAtSmallContainer(self, -1, value), NULL);
   4793   terminateO(value);
   4794   // non smallContainer object
   4795   value = (smallContainert*) allocSmallInt(2);
   4796   r = self->f->setAtSmallContainer(self, 0, value);
   4797   ck_assert_ptr_eq(r, null);
   4798   terminateO(value);
   4799   // NULL value
   4800   ck_assert_ptr_eq(self->f->setAtSmallContainer(self, 0, NULL), NULL);
   4801   terminateO(self);
   4802 
   4803 END_TEST
   4804 
   4805 
   4806 START_TEST(setAtNFreeSmallJsonT)
   4807 
   4808   smallJsont* r;
   4809   smallJsont *self = allocSmallJson();
   4810   baset *value;
   4811 
   4812   // add elements to self
   4813   r = self->f->pushInt(self, 1);
   4814   ck_assert_ptr_ne(r, null);
   4815   r = self->f->pushInt(self, 2);
   4816   ck_assert_ptr_ne(r, null);
   4817   r = self->f->pushInt(self, 3);
   4818   ck_assert_ptr_ne(r, null);
   4819   r = self->f->pushInt(self, 4);
   4820   ck_assert_ptr_ne(r, null);
   4821 
   4822   // positive index
   4823   value   = (baset*)allocSmallInt(123);
   4824   r       = self->f->setAtNFree(self, 1, value);
   4825   ck_assert_ptr_ne(r, null);
   4826   char *s = toStringO(r);
   4827   ck_assert_str_eq(s, "[1,123,3,4]");
   4828   free(s);
   4829   // negative index
   4830   value   = (baset*)allocSmallInt(234);
   4831   r = self->f->setAtNFree(self, -1, value);
   4832   ck_assert_ptr_ne(r, null);
   4833   s = toStringO(r);
   4834   ck_assert_str_eq(s, "[1,123,3,234]");
   4835   free(s);
   4836   // undefined object
   4837   value   = (baset*)allocUndefined();
   4838   r = self->f->setAtNFree(self, -1, value);
   4839   ck_assert_ptr_ne(r, null);
   4840   s = toStringO(r);
   4841   ck_assert_str_eq(s, "[1,123,3,null]");
   4842   free(s);
   4843   // container
   4844   createAllocateSmallContainer(c);
   4845   r = self->f->setAtNFree(self, -1, (baset*)c);
   4846   ck_assert_ptr_ne(r, null);
   4847   s = toStringO(r);
   4848   ck_assert_str_eq(s, "[1,123,3,\"<data container>\"]");
   4849   free(s);
   4850   // base object in container
   4851   createAllocateSmallInt(I);
   4852   setValG(I, 11);
   4853   I->type = "anothertype";
   4854   r = self->f->setAtNFree(self, -1, (baset*)I);
   4855   ck_assert_ptr_ne(r, null);
   4856   s = toStringO(r);
   4857   ck_assert_str_eq(s, "[1,123,3,\"<data container>\"]");
   4858   free(s);
   4859   // index outside
   4860   value = (baset*)allocSmallInt(123);
   4861   ck_assert_ptr_eq(self->f->setAtNFree(self, 20, value), NULL);
   4862   ck_assert_ptr_eq(self->f->setAtNFree(self, -8, value), NULL);
   4863   // empty list
   4864   emptyO(self);
   4865   ck_assert_ptr_eq(self->f->setAtNFree(self, 0, value), NULL);
   4866   ck_assert_ptr_eq(self->f->setAtNFree(self, -1, value), NULL);
   4867   // NULL value
   4868   ck_assert_ptr_eq(self->f->setAtNFree(self, 0, NULL), NULL);
   4869   terminateO(value);
   4870   terminateO(self);
   4871 
   4872 END_TEST
   4873 
   4874 
   4875 START_TEST(setAtNFreeUndefinedSmallJsonT)
   4876 
   4877   smallJsont* r;
   4878   smallJsont *self = allocSmallJson();
   4879   undefinedt *value = NULL;
   4880 
   4881 
   4882   // add elements to self
   4883   r = self->f->pushInt(self, 1);
   4884   ck_assert_ptr_ne(r, null);
   4885   r = self->f->pushInt(self, 2);
   4886   ck_assert_ptr_ne(r, null);
   4887   r = self->f->pushInt(self, 3);
   4888   ck_assert_ptr_ne(r, null);
   4889   r = self->f->pushInt(self, 4);
   4890   ck_assert_ptr_ne(r, null);
   4891 
   4892   // positive index
   4893   value = allocUndefined();
   4894   r       = self->f->setAtNFreeUndefined(self, 1, value);
   4895   ck_assert_ptr_ne(r, null);
   4896   char *s = toStringO(r);
   4897   ck_assert_str_eq(s, "[1,null,3,4]");
   4898   free(s);
   4899   // negative index
   4900   value = allocUndefined();
   4901   r = self->f->setAtNFreeUndefined(self, -1, value);
   4902   ck_assert_ptr_ne(r, null);
   4903   s = toStringO(r);
   4904   ck_assert_str_eq(s, "[1,null,3,null]");
   4905   free(s);
   4906   // index outside
   4907   value = allocUndefined();
   4908   ck_assert_ptr_eq(self->f->setAtNFreeUndefined(self, 20, value), NULL);
   4909   terminateO(value);
   4910   value = allocUndefined();
   4911   ck_assert_ptr_eq(self->f->setAtNFreeUndefined(self, -8, value), NULL);
   4912   terminateO(value);
   4913   // empty list
   4914   emptyO(self);
   4915   value = allocUndefined();
   4916   ck_assert_ptr_eq(self->f->setAtNFreeUndefined(self, 0, value), NULL);
   4917   terminateO(value);
   4918   value = allocUndefined();
   4919   ck_assert_ptr_eq(self->f->setAtNFreeUndefined(self, -1, value), NULL);
   4920   terminateO(value);
   4921   // non json array
   4922   freeO(self);
   4923   setTypeBoolO(self);
   4924   value = allocUndefined();
   4925   ck_assert_ptr_eq(self->f->setAtNFreeUndefined(self, 0, value), NULL);
   4926   terminateO(value);
   4927   terminateO(self);
   4928 
   4929 END_TEST
   4930 
   4931 
   4932 START_TEST(setAtNFreeSSmallJsonT)
   4933 
   4934   smallJsont* r;
   4935   smallJsont *self = allocSmallJson();
   4936 
   4937   // add elements to self
   4938   r = self->f->pushInt(self, 1);
   4939   ck_assert_ptr_ne(r, null);
   4940   r = self->f->pushInt(self, 2);
   4941   ck_assert_ptr_ne(r, null);
   4942   r = self->f->pushInt(self, 3);
   4943   ck_assert_ptr_ne(r, null);
   4944   r = self->f->pushInt(self, 4);
   4945   ck_assert_ptr_ne(r, null);
   4946 
   4947   // positive index
   4948   r       = self->f->setAtNFreeS(self, 1, strdup("a"));
   4949   ck_assert_ptr_ne(r, null);
   4950   char *s = toStringO(r);
   4951   ck_assert_str_eq(s, "[1,\"a\",3,4]");
   4952   free(s);
   4953   // negative index
   4954   r = self->f->setAtNFreeS(self, -1, strdup("b"));
   4955   ck_assert_ptr_ne(r, null);
   4956   s = toStringO(r);
   4957   ck_assert_str_eq(s, "[1,\"a\",3,\"b\"]");
   4958   free(s);
   4959   // NULL string
   4960   r = self->f->setAtNFreeS(self, -1, NULL);
   4961   ck_assert_ptr_eq(r, null);
   4962   // index outside
   4963   ck_assert_ptr_eq(self->f->setAtNFreeS(self, 20, ""), NULL);
   4964   ck_assert_ptr_eq(self->f->setAtNFreeS(self, -8, ""), NULL);
   4965   // empty list
   4966   emptyO(self);
   4967   ck_assert_ptr_eq(self->f->setAtNFreeS(self, 0, ""), NULL);
   4968   ck_assert_ptr_eq(self->f->setAtNFreeS(self, -1, ""), NULL);
   4969   // non json array
   4970   freeO(self);
   4971   setTypeBoolO(self);
   4972   ck_assert_ptr_eq(self->f->setAtNFreeS(self, 0, ""), NULL);
   4973   terminateO(self);
   4974 
   4975 END_TEST
   4976 
   4977 
   4978 START_TEST(setAtNFreeDictSmallJsonT)
   4979 
   4980   smallJsont* r;
   4981   smallJsont *self = allocSmallJson();
   4982   smallDictt *value;
   4983 
   4984   // add elements to self
   4985   r = self->f->pushInt(self, 1);
   4986   ck_assert_ptr_ne(r, null);
   4987   r = self->f->pushInt(self, 2);
   4988   ck_assert_ptr_ne(r, null);
   4989   r = self->f->pushInt(self, 3);
   4990   ck_assert_ptr_ne(r, null);
   4991   r = self->f->pushInt(self, 4);
   4992   ck_assert_ptr_ne(r, null);
   4993 
   4994   // positive index
   4995   value   = allocSmallDict();
   4996   r       = self->f->setAtNFreeDict(self, 1, value);
   4997   ck_assert_ptr_ne(r, null);
   4998   char *s = toStringO(r);
   4999   ck_assert_str_eq(s, "[1,{},3,4]");
   5000   free(s);
   5001   // negative index
   5002   value   = allocSmallDict();
   5003   r = self->f->setAtNFreeDict(self, -1, value);
   5004   ck_assert_ptr_ne(r, null);
   5005   s = toStringO(r);
   5006   ck_assert_str_eq(s, "[1,{},3,{}]");
   5007   free(s);
   5008   // index outside
   5009   value = allocSmallDict();
   5010   ck_assert_ptr_eq(self->f->setAtNFreeDict(self, 20, value), NULL);
   5011   ck_assert_ptr_eq(self->f->setAtNFreeDict(self, -8, value), NULL);
   5012   // empty list
   5013   emptyO(self);
   5014   ck_assert_ptr_eq(self->f->setAtNFreeDict(self, 0, value), NULL);
   5015   ck_assert_ptr_eq(self->f->setAtNFreeDict(self, -1, value), NULL);
   5016   terminateO(value);
   5017   // NULL value
   5018   ck_assert_ptr_eq(self->f->setAtNFreeDict(self, 0, NULL), NULL);
   5019   // non json array
   5020   freeO(self);
   5021   setTypeBoolO(self);
   5022   value = allocSmallDict();
   5023   ck_assert_ptr_eq(self->f->setAtNFreeDict(self, 0, value), NULL);
   5024   terminateO(value);
   5025   terminateO(self);
   5026 
   5027 END_TEST
   5028 
   5029 
   5030 START_TEST(setAtNFreeArraySmallJsonT)
   5031 
   5032   smallJsont* r;
   5033   smallJsont *self = allocSmallJson();
   5034   smallArrayt *value;
   5035 
   5036   // add elements to self
   5037   r = self->f->pushInt(self, 1);
   5038   ck_assert_ptr_ne(r, null);
   5039   r = self->f->pushInt(self, 2);
   5040   ck_assert_ptr_ne(r, null);
   5041   r = self->f->pushInt(self, 3);
   5042   ck_assert_ptr_ne(r, null);
   5043   r = self->f->pushInt(self, 4);
   5044   ck_assert_ptr_ne(r, null);
   5045 
   5046   // positive index
   5047   value   = allocSmallArray();
   5048   r       = self->f->setAtNFreeArray(self, 1, value);
   5049   ck_assert_ptr_ne(r, null);
   5050   char *s = toStringO(r);
   5051   ck_assert_str_eq(s, "[1,[],3,4]");
   5052   free(s);
   5053   // negative index
   5054   value   = allocSmallArray();
   5055   r = self->f->setAtNFreeArray(self, -1, value);
   5056   ck_assert_ptr_ne(r, null);
   5057   s = toStringO(r);
   5058   ck_assert_str_eq(s, "[1,[],3,[]]");
   5059   free(s);
   5060   // index outside
   5061   value = allocSmallArray();
   5062   ck_assert_ptr_eq(self->f->setAtNFreeArray(self, 20, value), NULL);
   5063   ck_assert_ptr_eq(self->f->setAtNFreeArray(self, -8, value), NULL);
   5064   // empty list
   5065   emptyO(self);
   5066   ck_assert_ptr_eq(self->f->setAtNFreeArray(self, 0, value), NULL);
   5067   ck_assert_ptr_eq(self->f->setAtNFreeArray(self, -1, value), NULL);
   5068   terminateO(value);
   5069   // NULL value
   5070   ck_assert_ptr_eq(self->f->setAtNFreeArray(self, 0, NULL), NULL);
   5071   // non json array
   5072   freeO(self);
   5073   setTypeBoolO(self);
   5074   value = allocSmallArray();
   5075   ck_assert_ptr_eq(self->f->setAtNFreeArray(self, 0, value), NULL);
   5076   terminateO(value);
   5077   terminateO(self);
   5078 
   5079 END_TEST
   5080 
   5081 
   5082 START_TEST(setAtNFreeArraycSmallJsonT)
   5083 
   5084   smallJsont* r;
   5085   smallJsont *self = allocSmallJson();
   5086   char **value;
   5087 
   5088   // add elements to self
   5089   r = self->f->pushInt(self, 1);
   5090   ck_assert_ptr_ne(r, null);
   5091   r = self->f->pushInt(self, 2);
   5092   ck_assert_ptr_ne(r, null);
   5093   r = self->f->pushInt(self, 3);
   5094   ck_assert_ptr_ne(r, null);
   5095   r = self->f->pushInt(self, 4);
   5096   ck_assert_ptr_ne(r, null);
   5097 
   5098   // positive index
   5099   value   = listCreateS("a");
   5100   r       = self->f->setAtNFreeArrayc(self, 1, value);
   5101   ck_assert_ptr_ne(r, null);
   5102   char *s = toStringO(r);
   5103   ck_assert_str_eq(s, "[1,[\"a\"],3,4]");
   5104   free(s);
   5105   // negative index
   5106   value   = listCreateS("b");
   5107   r = self->f->setAtNFreeArrayc(self, -1, value);
   5108   ck_assert_ptr_ne(r, null);
   5109   s = toStringO(r);
   5110   ck_assert_str_eq(s, "[1,[\"a\"],3,[\"b\"]]");
   5111   free(s);
   5112   // index outside
   5113   value = (char**)r;
   5114   ck_assert_ptr_eq(self->f->setAtNFreeArrayc(self, 20, value), NULL);
   5115   ck_assert_ptr_eq(self->f->setAtNFreeArrayc(self, -8, value), NULL);
   5116   // empty list
   5117   emptyO(self);
   5118   ck_assert_ptr_eq(self->f->setAtNFreeArrayc(self, 0, value), NULL);
   5119   ck_assert_ptr_eq(self->f->setAtNFreeArrayc(self, -1, value), NULL);
   5120   // NULL value
   5121   ck_assert_ptr_eq(self->f->setAtNFreeArrayc(self, 0, NULL), NULL);
   5122   // non json array
   5123   freeO(self);
   5124   setTypeBoolO(self);
   5125   value = listCreateS("b");
   5126   ck_assert_ptr_eq(self->f->setAtNFreeArrayc(self, 0, value), NULL);
   5127   listFreeS(value);
   5128   terminateO(self);
   5129 
   5130 END_TEST
   5131 
   5132 
   5133 START_TEST(setAtNFreeSmallBoolSmallJsonT)
   5134 
   5135   smallJsont* r;
   5136   smallJsont *self = allocSmallJson();
   5137   smallBoolt *value;
   5138 
   5139   // add elements to self
   5140   r = self->f->pushInt(self, 1);
   5141   ck_assert_ptr_ne(r, null);
   5142   r = self->f->pushInt(self, 2);
   5143   ck_assert_ptr_ne(r, null);
   5144   r = self->f->pushInt(self, 3);
   5145   ck_assert_ptr_ne(r, null);
   5146   r = self->f->pushInt(self, 4);
   5147   ck_assert_ptr_ne(r, null);
   5148 
   5149   // positive index
   5150   value   = allocSmallBool(true);
   5151   r       = self->f->setAtNFreeSmallBool(self, 1, value);
   5152   ck_assert_ptr_ne(r, null);
   5153   char *s = toStringO(r);
   5154   ck_assert_str_eq(s, "[1,true,3,4]");
   5155   free(s);
   5156   // negative index
   5157   value   = allocSmallBool(true);
   5158   r = self->f->setAtNFreeSmallBool(self, -1, value);
   5159   ck_assert_ptr_ne(r, null);
   5160   s = toStringO(r);
   5161   ck_assert_str_eq(s, "[1,true,3,true]");
   5162   free(s);
   5163   // index outside
   5164   value = allocSmallBool(true);
   5165   ck_assert_ptr_eq(self->f->setAtNFreeSmallBool(self, 20, value), NULL);
   5166   ck_assert_ptr_eq(self->f->setAtNFreeSmallBool(self, -8, value), NULL);
   5167   // empty list
   5168   emptyO(self);
   5169   ck_assert_ptr_eq(self->f->setAtNFreeSmallBool(self, 0, value), NULL);
   5170   ck_assert_ptr_eq(self->f->setAtNFreeSmallBool(self, -1, value), NULL);
   5171   terminateO(value);
   5172   // NULL value
   5173   ck_assert_ptr_eq(self->f->setAtNFreeSmallBool(self, 0, NULL), NULL);
   5174   // non json array
   5175   freeO(self);
   5176   setTypeBoolO(self);
   5177   value = allocSmallBool(true);
   5178   ck_assert_ptr_eq(self->f->setAtNFreeSmallBool(self, 0, value), NULL);
   5179   terminateO(value);
   5180   terminateO(self);
   5181 
   5182 END_TEST
   5183 
   5184 
   5185 START_TEST(setAtNFreeSmallBytesSmallJsonT)
   5186 
   5187   smallJsont* r;
   5188   smallJsont *self = allocSmallJson();
   5189   smallBytest *value;
   5190 
   5191   // add elements to self
   5192   r = self->f->pushInt(self, 1);
   5193   ck_assert_ptr_ne(r, null);
   5194   r = self->f->pushInt(self, 2);
   5195   ck_assert_ptr_ne(r, null);
   5196   r = self->f->pushInt(self, 3);
   5197   ck_assert_ptr_ne(r, null);
   5198   r = self->f->pushInt(self, 4);
   5199   ck_assert_ptr_ne(r, null);
   5200 
   5201   // positive index
   5202   value   = allocSmallBytes(NULL, 0);
   5203   r       = self->f->setAtNFreeSmallBytes(self, 1, value);
   5204   ck_assert_ptr_ne(r, null);
   5205   char *s = toStringO(r);
   5206   ck_assert_str_eq(s, "[1,[],3,4]");
   5207   free(s);
   5208   // negative index
   5209   value   = allocSmallBytes(NULL, 0);
   5210   r = self->f->setAtNFreeSmallBytes(self, -1, value);
   5211   ck_assert_ptr_ne(r, null);
   5212   s = toStringO(r);
   5213   ck_assert_str_eq(s, "[1,[],3,[]]");
   5214   free(s);
   5215   // index outside
   5216   value = allocSmallBytes(NULL, 0);
   5217   ck_assert_ptr_eq(self->f->setAtNFreeSmallBytes(self, 20, value), NULL);
   5218   ck_assert_ptr_eq(self->f->setAtNFreeSmallBytes(self, -5, value), NULL);
   5219   // empty list
   5220   emptyO(self);
   5221   ck_assert_ptr_eq(self->f->setAtNFreeSmallBytes(self, 0, value), NULL);
   5222   ck_assert_ptr_eq(self->f->setAtNFreeSmallBytes(self, -1, value), NULL);
   5223   terminateO(value);
   5224   // NULL value
   5225   ck_assert_ptr_eq(self->f->setAtNFreeSmallBytes(self, 0, NULL), NULL);
   5226   // non json array
   5227   freeO(self);
   5228   setTypeBoolO(self);
   5229   value = allocSmallBytes("", sizeof(""));
   5230   ck_assert_ptr_eq(self->f->setAtNFreeSmallBytes(self, 0, value), NULL);
   5231   terminateO(value);
   5232   terminateO(self);
   5233 
   5234 END_TEST
   5235 
   5236 
   5237 START_TEST(setAtNFreeSmallDoubleSmallJsonT)
   5238 
   5239   smallJsont* r;
   5240   smallJsont *self = allocSmallJson();
   5241   smallDoublet *value;
   5242 
   5243   // add elements to self
   5244   r = self->f->pushInt(self, 1);
   5245   ck_assert_ptr_ne(r, null);
   5246   r = self->f->pushInt(self, 2);
   5247   ck_assert_ptr_ne(r, null);
   5248   r = self->f->pushInt(self, 3);
   5249   ck_assert_ptr_ne(r, null);
   5250   r = self->f->pushInt(self, 4);
   5251   ck_assert_ptr_ne(r, null);
   5252 
   5253   // positive index
   5254   value   = allocSmallDouble(5);
   5255   r       = self->f->setAtNFreeSmallDouble(self, 1, value);
   5256   ck_assert_ptr_ne(r, null);
   5257   char *s = toStringO(r);
   5258   ck_assert_str_eq(s, "[1,5.000000e+00,3,4]");
   5259   free(s);
   5260   // negative index
   5261   value   = allocSmallDouble(6);
   5262   r = self->f->setAtNFreeSmallDouble(self, -1, value);
   5263   ck_assert_ptr_ne(r, null);
   5264   s = toStringO(r);
   5265   ck_assert_str_eq(s, "[1,5.000000e+00,3,6.000000e+00]");
   5266   free(s);
   5267   // index outside
   5268   value = allocSmallDouble(1);
   5269   ck_assert_ptr_eq(self->f->setAtNFreeSmallDouble(self, 20, value), NULL);
   5270   ck_assert_ptr_eq(self->f->setAtNFreeSmallDouble(self, -8, value), NULL);
   5271   // empty list
   5272   emptyO(self);
   5273   ck_assert_ptr_eq(self->f->setAtNFreeSmallDouble(self, 0, value), NULL);
   5274   ck_assert_ptr_eq(self->f->setAtNFreeSmallDouble(self, -1, value), NULL);
   5275   terminateO(value);
   5276   // NULL value
   5277   ck_assert_ptr_eq(self->f->setAtNFreeSmallDouble(self, 0, NULL), NULL);
   5278   // non json array
   5279   freeO(self);
   5280   setTypeBoolO(self);
   5281   value = allocSmallDouble(1);
   5282   ck_assert_ptr_eq(self->f->setAtNFreeSmallDouble(self, 0, value), NULL);
   5283   terminateO(value);
   5284   terminateO(self);
   5285 
   5286 END_TEST
   5287 
   5288 
   5289 START_TEST(setAtNFreeSmallIntSmallJsonT)
   5290 
   5291   smallJsont* r;
   5292   smallJsont *self = allocSmallJson();
   5293   smallIntt *value;
   5294 
   5295   // add elements to self
   5296   r = self->f->pushInt(self, 1);
   5297   ck_assert_ptr_ne(r, null);
   5298   r = self->f->pushInt(self, 2);
   5299   ck_assert_ptr_ne(r, null);
   5300   r = self->f->pushInt(self, 3);
   5301   ck_assert_ptr_ne(r, null);
   5302   r = self->f->pushInt(self, 4);
   5303   ck_assert_ptr_ne(r, null);
   5304 
   5305   // positive index
   5306   value   = allocSmallInt(5);
   5307   r       = self->f->setAtNFreeSmallInt(self, 1, value);
   5308   ck_assert_ptr_ne(r, null);
   5309   char *s = toStringO(r);
   5310   ck_assert_str_eq(s, "[1,5,3,4]");
   5311   free(s);
   5312   // negative index
   5313   value   = allocSmallInt(6);
   5314   r = self->f->setAtNFreeSmallInt(self, -1, value);
   5315   ck_assert_ptr_ne(r, null);
   5316   s = toStringO(r);
   5317   ck_assert_str_eq(s, "[1,5,3,6]");
   5318   free(s);
   5319   // index outside
   5320   value = allocSmallInt(1);
   5321   ck_assert_ptr_eq(self->f->setAtNFreeSmallInt(self, 20, value), NULL);
   5322   ck_assert_ptr_eq(self->f->setAtNFreeSmallInt(self, -8, value), NULL);
   5323   // empty list
   5324   emptyO(self);
   5325   ck_assert_ptr_eq(self->f->setAtNFreeSmallInt(self, 0, value), NULL);
   5326   ck_assert_ptr_eq(self->f->setAtNFreeSmallInt(self, -1, value), NULL);
   5327   terminateO(value);
   5328   // NULL value
   5329   ck_assert_ptr_eq(self->f->setAtNFreeSmallInt(self, 0, NULL), NULL);
   5330   // non json array
   5331   freeO(self);
   5332   setTypeBoolO(self);
   5333   value = allocSmallInt(2);
   5334   ck_assert_ptr_eq(self->f->setAtNFreeSmallInt(self, 0, value), NULL);
   5335   terminateO(value);
   5336   terminateO(self);
   5337 
   5338 END_TEST
   5339 
   5340 
   5341 START_TEST(setAtNFreeSmallJsonSmallJsonT)
   5342 
   5343   smallJsont* r;
   5344   smallJsont *self = allocSmallJson();
   5345   smallJsont *value;
   5346 
   5347   // add elements to self
   5348   r = self->f->pushInt(self, 1);
   5349   ck_assert_ptr_ne(r, null);
   5350   r = self->f->pushInt(self, 2);
   5351   ck_assert_ptr_ne(r, null);
   5352   r = self->f->pushInt(self, 3);
   5353   ck_assert_ptr_ne(r, null);
   5354   r = self->f->pushInt(self, 4);
   5355   ck_assert_ptr_ne(r, null);
   5356 
   5357   // positive index
   5358   value   = allocSmallJson();
   5359   r       = self->f->setAtNFreeSmallJson(self, 1, value);
   5360   ck_assert_ptr_ne(r, null);
   5361   char *s = toStringO(r);
   5362   ck_assert_str_eq(s, "[1,{},3,4]");
   5363   free(s);
   5364   // negative index
   5365   value   = allocSmallJson();
   5366   r = self->f->setAtNFreeSmallJson(self, -1, value);
   5367   ck_assert_ptr_ne(r, null);
   5368   s = toStringO(r);
   5369   ck_assert_str_eq(s, "[1,{},3,{}]");
   5370   free(s);
   5371   // index outside
   5372   value = allocSmallJson();
   5373   ck_assert_ptr_eq(self->f->setAtNFreeSmallJson(self, 20, value), NULL);
   5374   ck_assert_ptr_eq(self->f->setAtNFreeSmallJson(self, -8, value), NULL);
   5375   // empty list
   5376   emptyO(self);
   5377   ck_assert_ptr_eq(self->f->setAtNFreeSmallJson(self, 0, value), NULL);
   5378   ck_assert_ptr_eq(self->f->setAtNFreeSmallJson(self, -1, value), NULL);
   5379   terminateO(value);
   5380   // NULL value
   5381   ck_assert_ptr_eq(self->f->setAtNFreeSmallJson(self, 0, NULL), NULL);
   5382   // non json array
   5383   freeO(self);
   5384   setTypeBoolO(self);
   5385   value = allocSmallJson();
   5386   ck_assert_ptr_eq(self->f->setAtNFreeSmallJson(self, 0, value), NULL);
   5387   terminateO(value);
   5388   terminateO(self);
   5389 
   5390 END_TEST
   5391 
   5392 
   5393 START_TEST(setAtNFreeSmallStringSmallJsonT)
   5394 
   5395   smallJsont* r;
   5396   smallJsont *self = allocSmallJson();
   5397   smallStringt *value;
   5398 
   5399   // add elements to self
   5400   r = self->f->pushInt(self, 1);
   5401   ck_assert_ptr_ne(r, null);
   5402   r = self->f->pushInt(self, 2);
   5403   ck_assert_ptr_ne(r, null);
   5404   r = self->f->pushInt(self, 3);
   5405   ck_assert_ptr_ne(r, null);
   5406   r = self->f->pushInt(self, 4);
   5407   ck_assert_ptr_ne(r, null);
   5408 
   5409   // positive index
   5410   initiateAllocateSmallString(&value);
   5411   r       = self->f->setAtNFreeSmallString(self, 1, value);
   5412   ck_assert_ptr_ne(r, null);
   5413   char *s = toStringO(r);
   5414   ck_assert_str_eq(s, "[1,\"\",3,4]");
   5415   free(s);
   5416   // negative index
   5417   value   = allocSmallString("a");
   5418   r = self->f->setAtNFreeSmallString(self, -1, value);
   5419   ck_assert_ptr_ne(r, null);
   5420   s = toStringO(r);
   5421   ck_assert_str_eq(s, "[1,\"\",3,\"a\"]");
   5422   free(s);
   5423   // index outside
   5424   value = allocSmallString("asd");
   5425   ck_assert_ptr_eq(self->f->setAtNFreeSmallString(self, 20, value), NULL);
   5426   ck_assert_ptr_eq(self->f->setAtNFreeSmallString(self, -8, value), NULL);
   5427   // empty list
   5428   emptyO(self);
   5429   ck_assert_ptr_eq(self->f->setAtNFreeSmallString(self, 0, value), NULL);
   5430   ck_assert_ptr_eq(self->f->setAtNFreeSmallString(self, -1, value), NULL);
   5431   terminateO(value);
   5432   // NULL value
   5433   ck_assert_ptr_eq(self->f->setAtNFreeSmallString(self, 0, NULL), NULL);
   5434   // non json array
   5435   freeO(self);
   5436   setTypeBoolO(self);
   5437   value = allocSmallString("qwe");
   5438   ck_assert_ptr_eq(self->f->setAtNFreeSmallString(self, 0, value), NULL);
   5439   terminateO(value);
   5440   terminateO(self);
   5441 
   5442 END_TEST
   5443 
   5444 
   5445 START_TEST(setAtNFreeSmallContainerSmallJsonT)
   5446 
   5447   smallJsont* r;
   5448   smallJsont *self = allocSmallJson();
   5449   smallContainert *value;
   5450 
   5451   // add elements to self
   5452   r = self->f->pushInt(self, 1);
   5453   ck_assert_ptr_ne(r, null);
   5454   r = self->f->pushInt(self, 2);
   5455   ck_assert_ptr_ne(r, null);
   5456   r = self->f->pushInt(self, 3);
   5457   ck_assert_ptr_ne(r, null);
   5458   r = self->f->pushInt(self, 4);
   5459   ck_assert_ptr_ne(r, null);
   5460 
   5461   // positive index
   5462   initiateAllocateSmallContainer(&value);
   5463   r       = self->f->setAtNFreeSmallContainer(self, 1, value);
   5464   ck_assert_ptr_ne(r, null);
   5465   char *s = toStringO(r);
   5466   ck_assert_str_eq(s, "[1,\"<data container>\",3,4]");
   5467   free(s);
   5468   // negative index
   5469   initiateAllocateSmallContainer(&value);
   5470   r = self->f->setAtNFreeSmallContainer(self, -1, value);
   5471   ck_assert_ptr_ne(r, null);
   5472   s = toStringO(r);
   5473   ck_assert_str_eq(s, "[1,\"<data container>\",3,\"<data container>\"]");
   5474   free(s);
   5475   // index outside
   5476   initiateAllocateSmallContainer(&value);
   5477   ck_assert_ptr_eq(self->f->setAtNFreeSmallContainer(self, 20, value), NULL);
   5478   ck_assert_ptr_eq(self->f->setAtNFreeSmallContainer(self, -8, value), NULL);
   5479   // empty list
   5480   emptyO(self);
   5481   ck_assert_ptr_eq(self->f->setAtNFreeSmallContainer(self, 0, value), NULL);
   5482   ck_assert_ptr_eq(self->f->setAtNFreeSmallContainer(self, -1, value), NULL);
   5483   terminateO(value);
   5484   // NULL value
   5485   ck_assert_ptr_eq(self->f->setAtNFreeSmallContainer(self, 0, NULL), NULL);
   5486   // non json array
   5487   freeO(self);
   5488   setTypeBoolO(self);
   5489   initiateAllocateSmallContainer(&value);
   5490   ck_assert_ptr_eq(self->f->setAtNFreeSmallContainer(self, 0, value), NULL);
   5491   terminateO(value);
   5492   terminateO(self);
   5493 
   5494 END_TEST
   5495 
   5496 
   5497 START_TEST(setPAtDictSmallJsonT)
   5498 
   5499   smallJsont* r;
   5500   smallJsont *self = allocSmallJson();
   5501   smallDictt *value;
   5502 
   5503   // add elements to self
   5504   r = self->f->pushInt(self, 1);
   5505   ck_assert_ptr_ne(r, null);
   5506   r = self->f->pushInt(self, 2);
   5507   ck_assert_ptr_ne(r, null);
   5508   r = self->f->pushInt(self, 3);
   5509   ck_assert_ptr_ne(r, null);
   5510   r = self->f->pushInt(self, 4);
   5511   ck_assert_ptr_ne(r, null);
   5512 
   5513   // positive index
   5514   value   = allocSmallDict();
   5515   r       = self->f->setAtDict(self, 1, value);
   5516   ck_assert_ptr_ne(r, null);
   5517   value->f->setInt(value, "a", 1);
   5518   r       = self->f->setPAtDict(self, 1, value);
   5519   ck_assert_ptr_ne(r, null);
   5520   finishO(value);
   5521   char *s = toStringO(r);
   5522   ck_assert_str_eq(s, "[1,{\"a\":1},3,4]");
   5523   free(s);
   5524   // negative index
   5525   value   = allocSmallDict();
   5526   r       = self->f->setAtDict(self, -1, value);
   5527   ck_assert_ptr_ne(r, null);
   5528   value->f->setInt(value, "a", 2);
   5529   r       = self->f->setPAtDict(self, -1, value);
   5530   ck_assert_ptr_ne(r, null);
   5531   finishO(value);
   5532   s = toStringO(r);
   5533   ck_assert_str_eq(s, "[1,{\"a\":1},3,{\"a\":2}]");
   5534   free(s);
   5535   // empty smallDict
   5536   value   = allocSmallDict();
   5537   r       = self->f->setPAtDict(self, -1, value);
   5538   ck_assert_ptr_eq(r, null);
   5539   terminateO(value);
   5540   // non smallDict object
   5541   value   = (smallDictt*) allocSmallInt(2);
   5542   r       = self->f->setPAtDict(self, 0, value);
   5543   ck_assert_ptr_eq(r, null);
   5544   terminateO(value);
   5545   // index outside
   5546   value = allocSmallDict();
   5547   ck_assert_ptr_eq(self->f->setPAtDict(self, 20, value), NULL);
   5548   ck_assert_ptr_eq(self->f->setPAtDict(self, -8, value), NULL);
   5549   // empty list
   5550   emptyO(self);
   5551   ck_assert_ptr_eq(self->f->setPAtDict(self, 0, value), NULL);
   5552   ck_assert_ptr_eq(self->f->setPAtDict(self, -1, value), NULL);
   5553   terminateO(value);
   5554   // NULL value
   5555   ck_assert_ptr_eq(self->f->setPAtDict(self, 0, NULL), NULL);
   5556   terminateO(self);
   5557 
   5558 END_TEST
   5559 
   5560 
   5561 START_TEST(setPAtArraySmallJsonT)
   5562 
   5563   smallJsont* r;
   5564   smallJsont *self = allocSmallJson();
   5565   smallArrayt *value;
   5566 
   5567   // add elements to self
   5568   r = self->f->pushInt(self, 1);
   5569   ck_assert_ptr_ne(r, null);
   5570   r = self->f->pushInt(self, 2);
   5571   ck_assert_ptr_ne(r, null);
   5572   r = self->f->pushInt(self, 3);
   5573   ck_assert_ptr_ne(r, null);
   5574   r = self->f->pushInt(self, 4);
   5575   ck_assert_ptr_ne(r, null);
   5576 
   5577   // positive index
   5578   value   = allocSmallArray();
   5579   r       = self->f->setAtArray(self, 1, value);
   5580   ck_assert_ptr_ne(r, null);
   5581   value->f->pushInt(value, 1);
   5582   r       = self->f->setPAtArray(self, 1, value);
   5583   ck_assert_ptr_ne(r, null);
   5584   finishO(value);
   5585   char *s = toStringO(r);
   5586   ck_assert_str_eq(s, "[1,[1],3,4]");
   5587   free(s);
   5588   // negative index
   5589   value   = allocSmallArray();
   5590   r = self->f->setAtArray(self, -1, value);
   5591   ck_assert_ptr_ne(r, null);
   5592   value->f->pushInt(value, 2);
   5593   r       = self->f->setPAtArray(self, -1, value);
   5594   ck_assert_ptr_ne(r, null);
   5595   finishO(value);
   5596   s = toStringO(r);
   5597   ck_assert_str_eq(s, "[1,[1],3,[2]]");
   5598   free(s);
   5599   // empty smallArray
   5600   value   = allocSmallArray();
   5601   r       = self->f->setPAtArray(self, -1, value);
   5602   ck_assert_ptr_eq(r, null);
   5603   terminateO(value);
   5604   // non smallArray object
   5605   value   = (smallArrayt*) allocSmallInt(2);
   5606   r       = self->f->setPAtArray(self, 0, value);
   5607   ck_assert_ptr_eq(r, null);
   5608   terminateO(value);
   5609   // index outside
   5610   value = allocSmallArray();
   5611   ck_assert_ptr_eq(self->f->setPAtArray(self, 20, value), NULL);
   5612   ck_assert_ptr_eq(self->f->setPAtArray(self, -8, value), NULL);
   5613   // empty list
   5614   emptyO(self);
   5615   ck_assert_ptr_eq(self->f->setPAtArray(self, 0, value), NULL);
   5616   ck_assert_ptr_eq(self->f->setPAtArray(self, -1, value), NULL);
   5617   terminateO(value);
   5618   // NULL value
   5619   ck_assert_ptr_eq(self->f->setPAtArray(self, 0, NULL), NULL);
   5620   terminateO(self);
   5621 
   5622 END_TEST
   5623 
   5624 
   5625 START_TEST(setPAtSmallJsonSmallJsonT)
   5626 
   5627   smallJsont* r;
   5628   smallJsont *self = allocSmallJson();
   5629   smallJsont *value;
   5630 
   5631   // add elements to self
   5632   r = self->f->pushInt(self, 1);
   5633   ck_assert_ptr_ne(r, null);
   5634   r = self->f->pushInt(self, 2);
   5635   ck_assert_ptr_ne(r, null);
   5636   r = self->f->pushInt(self, 3);
   5637   ck_assert_ptr_ne(r, null);
   5638   r = self->f->pushInt(self, 4);
   5639   ck_assert_ptr_ne(r, null);
   5640 
   5641   // positive index
   5642   value   = allocSmallJson();
   5643   r       = self->f->setAtSmallJson(self, 1, value);
   5644   ck_assert_ptr_ne(r, null);
   5645   value->f->setInt(value, "a", 1);
   5646   r       = self->f->setPAtSmallJson(self, 1, value);
   5647   ck_assert_ptr_ne(r, null);
   5648   finishO(value);
   5649   char *s = toStringO(r);
   5650   ck_assert_str_eq(s, "[1,{\"a\":1},3,4]");
   5651   free(s);
   5652   // negative index
   5653   value   = allocSmallJson();
   5654   r = self->f->setAtSmallJson(self, -1, value);
   5655   ck_assert_ptr_ne(r, null);
   5656   value->f->setInt(value, "a", 2);
   5657   r       = self->f->setPAtSmallJson(self, -1, value);
   5658   ck_assert_ptr_ne(r, null);
   5659   finishO(value);
   5660   s = toStringO(r);
   5661   ck_assert_str_eq(s, "[1,{\"a\":1},3,{\"a\":2}]");
   5662   free(s);
   5663   // empty smallJson
   5664   value   = allocSmallJson();
   5665   r = self->f->setPAtSmallJson(self, -1, value);
   5666   ck_assert_ptr_eq(r, null);
   5667   terminateO(value);
   5668   // non smallJson object
   5669   value = (smallJsont*) allocSmallInt(2);
   5670   r = self->f->setPAtSmallJson(self, 0, value);
   5671   ck_assert_ptr_eq(r, null);
   5672   terminateO(value);
   5673   // index outside
   5674   value = allocSmallJson();
   5675   ck_assert_ptr_eq(self->f->setPAtSmallJson(self, 20, value), NULL);
   5676   ck_assert_ptr_eq(self->f->setPAtSmallJson(self, -8, value), NULL);
   5677   // empty list
   5678   emptyO(self);
   5679   ck_assert_ptr_eq(self->f->setPAtSmallJson(self, 0, value), NULL);
   5680   ck_assert_ptr_eq(self->f->setPAtSmallJson(self, -1, value), NULL);
   5681   terminateO(value);
   5682   // NULL value
   5683   ck_assert_ptr_eq(self->f->setPAtSmallJson(self, 0, NULL), NULL);
   5684   terminateO(self);
   5685 
   5686 END_TEST
   5687 
   5688 
   5689 START_TEST(setPAtSmallStringSmallJsonT)
   5690 
   5691   smallJsont* r;
   5692   smallJsont *self = allocSmallJson();
   5693   smallStringt *value;
   5694 
   5695   // add elements to self
   5696   r = self->f->pushInt(self, 1);
   5697   ck_assert_ptr_ne(r, null);
   5698   r = self->f->pushInt(self, 2);
   5699   ck_assert_ptr_ne(r, null);
   5700   r = self->f->pushInt(self, 3);
   5701   ck_assert_ptr_ne(r, null);
   5702   r = self->f->pushInt(self, 4);
   5703   ck_assert_ptr_ne(r, null);
   5704 
   5705   // positive index
   5706   initiateAllocateSmallString(&value);
   5707   r       = self->f->setAtSmallString(self, 1, value);
   5708   ck_assert_ptr_ne(r, null);
   5709   value->f->appendS(value, "1");
   5710   r       = self->f->setPAtSmallString(self, 1, value);
   5711   ck_assert_ptr_ne(r, null);
   5712   finishO(value);
   5713   char *s = toStringO(r);
   5714   ck_assert_str_eq(s, "[1,\"1\",3,4]");
   5715   free(s);
   5716   // negative index
   5717   value   = allocSmallString("a");
   5718   r = self->f->setAtSmallString(self, -1, value);
   5719   ck_assert_ptr_ne(r, null);
   5720   value->f->appendS(value, "2");
   5721   r       = self->f->setPAtSmallString(self, -1, value);
   5722   ck_assert_ptr_ne(r, null);
   5723   finishO(value);
   5724   s = toStringO(r);
   5725   ck_assert_str_eq(s, "[1,\"1\",3,\"a2\"]");
   5726   free(s);
   5727   // empty SmallString
   5728   value   = allocSmallString("");
   5729   freeO(value);
   5730   r = self->f->setPAtSmallString(self, -1, value);
   5731   ck_assert_ptr_eq(r, null);
   5732   terminateO(value);
   5733   // non smallString object
   5734   value = (smallStringt*) allocSmallInt(2);
   5735   r = self->f->setPAtSmallString(self, 0, value);
   5736   ck_assert_ptr_eq(r, null);
   5737   terminateO(value);
   5738   // index outside
   5739   value = allocSmallString("asd");
   5740   ck_assert_ptr_eq(self->f->setPAtSmallString(self, 20, value), NULL);
   5741   ck_assert_ptr_eq(self->f->setPAtSmallString(self, -8, value), NULL);
   5742   // empty list
   5743   emptyO(self);
   5744   ck_assert_ptr_eq(self->f->setPAtSmallString(self, 0, value), NULL);
   5745   ck_assert_ptr_eq(self->f->setPAtSmallString(self, -1, value), NULL);
   5746   terminateO(value);
   5747   // NULL value
   5748   ck_assert_ptr_eq(self->f->setPAtSmallString(self, 0, NULL), NULL);
   5749   terminateO(self);
   5750 
   5751 END_TEST
   5752 
   5753 
   5754 START_TEST(setPAtNFreeDictSmallJsonT)
   5755 
   5756   smallJsont* r;
   5757   smallJsont *self = allocSmallJson();
   5758   smallDictt *value;
   5759 
   5760   // add elements to self
   5761   r = self->f->pushInt(self, 1);
   5762   ck_assert_ptr_ne(r, null);
   5763   r = self->f->pushInt(self, 2);
   5764   ck_assert_ptr_ne(r, null);
   5765   r = self->f->pushInt(self, 3);
   5766   ck_assert_ptr_ne(r, null);
   5767   r = self->f->pushInt(self, 4);
   5768   ck_assert_ptr_ne(r, null);
   5769 
   5770   // positive index
   5771   value   = allocSmallDict();
   5772   r       = self->f->setAtDict(self, 1, value);
   5773   ck_assert_ptr_ne(r, null);
   5774   value->f->setInt(value, "a", 1);
   5775   r       = self->f->setPAtNFreeDict(self, 1, value);
   5776   ck_assert_ptr_ne(r, null);
   5777   char *s = toStringO(r);
   5778   ck_assert_str_eq(s, "[1,{\"a\":1},3,4]");
   5779   free(s);
   5780   // negative index
   5781   value   = allocSmallDict();
   5782   r       = self->f->setAtDict(self, -1, value);
   5783   ck_assert_ptr_ne(r, null);
   5784   value->f->setInt(value, "a", 2);
   5785   r       = self->f->setPAtNFreeDict(self, -1, value);
   5786   ck_assert_ptr_ne(r, null);
   5787   s = toStringO(r);
   5788   ck_assert_str_eq(s, "[1,{\"a\":1},3,{\"a\":2}]");
   5789   free(s);
   5790   // empty smallDict
   5791   value   = allocSmallDict();
   5792   r       = self->f->setPAtNFreeDict(self, -1, value);
   5793   ck_assert_ptr_eq(r, null);
   5794   terminateO(value);
   5795   // non smallDict object
   5796   value = (smallDictt*) allocSmallInt(2);
   5797   r = self->f->setPAtNFreeDict(self, 0, value);
   5798   ck_assert_ptr_eq(r, null);
   5799   terminateO(value);
   5800   // index outside
   5801   value = allocSmallDict();
   5802   ck_assert_ptr_eq(self->f->setPAtNFreeDict(self, 20, value), NULL);
   5803   ck_assert_ptr_eq(self->f->setPAtNFreeDict(self, -8, value), NULL);
   5804   // empty list
   5805   emptyO(self);
   5806   ck_assert_ptr_eq(self->f->setPAtNFreeDict(self, 0, value), NULL);
   5807   ck_assert_ptr_eq(self->f->setPAtNFreeDict(self, -1, value), NULL);
   5808   terminateO(value);
   5809   // NULL value
   5810   ck_assert_ptr_eq(self->f->setPAtNFreeDict(self, 0, NULL), NULL);
   5811   terminateO(self);
   5812 
   5813 END_TEST
   5814 
   5815 
   5816 START_TEST(setPAtNFreeArraySmallJsonT)
   5817 
   5818   smallJsont* r;
   5819   smallJsont *self = allocSmallJson();
   5820   smallArrayt *value;
   5821 
   5822   // add elements to self
   5823   r = self->f->pushInt(self, 1);
   5824   ck_assert_ptr_ne(r, null);
   5825   r = self->f->pushInt(self, 2);
   5826   ck_assert_ptr_ne(r, null);
   5827   r = self->f->pushInt(self, 3);
   5828   ck_assert_ptr_ne(r, null);
   5829   r = self->f->pushInt(self, 4);
   5830   ck_assert_ptr_ne(r, null);
   5831 
   5832   // positive index
   5833   value   = allocSmallArray();
   5834   r       = self->f->setAtArray(self, 1, value);
   5835   ck_assert_ptr_ne(r, null);
   5836   value->f->pushInt(value, 1);
   5837   r       = self->f->setPAtNFreeArray(self, 1, value);
   5838   ck_assert_ptr_ne(r, null);
   5839   char *s = toStringO(r);
   5840   ck_assert_str_eq(s, "[1,[1],3,4]");
   5841   free(s);
   5842   // negative index
   5843   value   = allocSmallArray();
   5844   r = self->f->setAtArray(self, -1, value);
   5845   ck_assert_ptr_ne(r, null);
   5846   value->f->pushInt(value, 2);
   5847   r       = self->f->setPAtNFreeArray(self, -1, value);
   5848   ck_assert_ptr_ne(r, null);
   5849   s = toStringO(r);
   5850   ck_assert_str_eq(s, "[1,[1],3,[2]]");
   5851   free(s);
   5852   // empty smallArray
   5853   value   = allocSmallArray();
   5854   r       = self->f->setPAtNFreeArray(self, -1, value);
   5855   ck_assert_ptr_eq(r, null);
   5856   terminateO(value);
   5857   // non smallArray object
   5858   value   = (smallArrayt*) allocSmallInt(2);
   5859   r       = self->f->setPAtNFreeArray(self, 0, value);
   5860   ck_assert_ptr_eq(r, null);
   5861   terminateO(value);
   5862   // index outside
   5863   value = allocSmallArray();
   5864   ck_assert_ptr_eq(self->f->setPAtNFreeArray(self, 20, value), NULL);
   5865   ck_assert_ptr_eq(self->f->setPAtNFreeArray(self, -8, value), NULL);
   5866   // empty list
   5867   emptyO(self);
   5868   ck_assert_ptr_eq(self->f->setPAtNFreeArray(self, 0, value), NULL);
   5869   ck_assert_ptr_eq(self->f->setPAtNFreeArray(self, -1, value), NULL);
   5870   terminateO(value);
   5871   // NULL value
   5872   ck_assert_ptr_eq(self->f->setPAtNFreeArray(self, 0, NULL), NULL);
   5873   terminateO(self);
   5874 
   5875 END_TEST
   5876 
   5877 
   5878 START_TEST(setPAtNFreeSmallJsonSmallJsonT)
   5879 
   5880   smallJsont* r;
   5881   smallJsont *self = allocSmallJson();
   5882   smallJsont *value;
   5883 
   5884   // add elements to self
   5885   r = self->f->pushInt(self, 1);
   5886   ck_assert_ptr_ne(r, null);
   5887   r = self->f->pushInt(self, 2);
   5888   ck_assert_ptr_ne(r, null);
   5889   r = self->f->pushInt(self, 3);
   5890   ck_assert_ptr_ne(r, null);
   5891   r = self->f->pushInt(self, 4);
   5892   ck_assert_ptr_ne(r, null);
   5893 
   5894   // positive index
   5895   value   = allocSmallJson();
   5896   r       = self->f->setAtSmallJson(self, 1, value);
   5897   ck_assert_ptr_ne(r, null);
   5898   value->f->setInt(value, "a", 1);
   5899   r       = self->f->setPAtNFreeSmallJson(self, 1, value);
   5900   ck_assert_ptr_ne(r, null);
   5901   char *s = toStringO(r);
   5902   ck_assert_str_eq(s, "[1,{\"a\":1},3,4]");
   5903   free(s);
   5904   // negative index
   5905   value   = allocSmallJson();
   5906   r = self->f->setAtSmallJson(self, -1, value);
   5907   ck_assert_ptr_ne(r, null);
   5908   value->f->setInt(value, "a", 2);
   5909   r       = self->f->setPAtNFreeSmallJson(self, -1, value);
   5910   ck_assert_ptr_ne(r, null);
   5911   s = toStringO(r);
   5912   ck_assert_str_eq(s, "[1,{\"a\":1},3,{\"a\":2}]");
   5913   free(s);
   5914   // empty smallJson
   5915   value   = allocSmallJson();
   5916   r = self->f->setPAtNFreeSmallJson(self, -1, value);
   5917   ck_assert_ptr_eq(r, null);
   5918   terminateO(value);
   5919   // non smallJson object
   5920   value = (smallJsont*) allocSmallInt(2);
   5921   r = self->f->setPAtNFreeSmallJson(self, 0, value);
   5922   ck_assert_ptr_eq(r, null);
   5923   terminateO(value);
   5924   // index outside
   5925   value = allocSmallJson();
   5926   ck_assert_ptr_eq(self->f->setPAtNFreeSmallJson(self, 20, value), NULL);
   5927   ck_assert_ptr_eq(self->f->setPAtNFreeSmallJson(self, -8, value), NULL);
   5928   // empty list
   5929   emptyO(self);
   5930   ck_assert_ptr_eq(self->f->setPAtNFreeSmallJson(self, 0, value), NULL);
   5931   ck_assert_ptr_eq(self->f->setPAtNFreeSmallJson(self, -1, value), NULL);
   5932   terminateO(value);
   5933   // NULL value
   5934   ck_assert_ptr_eq(self->f->setPAtNFreeSmallJson(self, 0, NULL), NULL);
   5935   terminateO(self);
   5936 
   5937 END_TEST
   5938 
   5939 
   5940 START_TEST(setPAtNFreeSmallStringSmallJsonT)
   5941 
   5942   smallJsont* r;
   5943   smallJsont *self = allocSmallJson();
   5944   smallStringt *value;
   5945 
   5946   // add elements to self
   5947   r = self->f->pushInt(self, 1);
   5948   ck_assert_ptr_ne(r, null);
   5949   r = self->f->pushInt(self, 2);
   5950   ck_assert_ptr_ne(r, null);
   5951   r = self->f->pushInt(self, 3);
   5952   ck_assert_ptr_ne(r, null);
   5953   r = self->f->pushInt(self, 4);
   5954   ck_assert_ptr_ne(r, null);
   5955 
   5956   // positive index
   5957   initiateAllocateSmallString(&value);
   5958   r       = self->f->setAtSmallString(self, 1, value);
   5959   ck_assert_ptr_ne(r, null);
   5960   value->f->appendS(value, "1");
   5961   r       = self->f->setPAtNFreeSmallString(self, 1, value);
   5962   ck_assert_ptr_ne(r, null);
   5963   char *s = toStringO(r);
   5964   ck_assert_str_eq(s, "[1,\"1\",3,4]");
   5965   free(s);
   5966   // negative index
   5967   value   = allocSmallString("a");
   5968   r = self->f->setAtSmallString(self, -1, value);
   5969   ck_assert_ptr_ne(r, null);
   5970   value->f->appendS(value, "2");
   5971   r       = self->f->setPAtNFreeSmallString(self, -1, value);
   5972   ck_assert_ptr_ne(r, null);
   5973   s = toStringO(r);
   5974   ck_assert_str_eq(s, "[1,\"1\",3,\"a2\"]");
   5975   free(s);
   5976   // empty SmallString
   5977   value   = allocSmallString("");
   5978   freeO(value);
   5979   r = self->f->setPAtNFreeSmallString(self, -1, value);
   5980   ck_assert_ptr_eq(r, null);
   5981   terminateO(value);
   5982   // non smallString object
   5983   value = (smallStringt*) allocSmallInt(2);
   5984   r = self->f->setPAtNFreeSmallString(self, 0, value);
   5985   ck_assert_ptr_eq(r, null);
   5986   terminateO(value);
   5987   // index outside
   5988   value = allocSmallString("asd");
   5989   ck_assert_ptr_eq(self->f->setPAtNFreeSmallString(self, 20, value), NULL);
   5990   ck_assert_ptr_eq(self->f->setPAtNFreeSmallString(self, -8, value), NULL);
   5991   // empty list
   5992   emptyO(self);
   5993   ck_assert_ptr_eq(self->f->setPAtNFreeSmallString(self, 0, value), NULL);
   5994   ck_assert_ptr_eq(self->f->setPAtNFreeSmallString(self, -1, value), NULL);
   5995   terminateO(value);
   5996   // NULL value
   5997   ck_assert_ptr_eq(self->f->setPAtNFreeSmallString(self, 0, NULL), NULL);
   5998   terminateO(self);
   5999 
   6000 END_TEST
   6001 
   6002 
   6003 START_TEST(pushUndefinedSmallJsonT)
   6004 
   6005   smallJsont* r;
   6006   smallJsont *self = allocSmallJson();
   6007 
   6008   // add an element to check that push adds the second element
   6009   // at the end
   6010   r = self->f->pushInt(self, 1);
   6011   ck_assert_ptr_ne(r, null);
   6012   r = self->f->pushUndefined(self);
   6013   ck_assert_ptr_ne(r, null);
   6014   ck_assert_int_eq(lenO(r), 2);
   6015   char *s = toStringO(r);
   6016   ck_assert_str_eq(s, "[1,null]");
   6017   free(s);
   6018   // non json array
   6019   freeO(self);
   6020   setTypeBoolO(self);
   6021   ck_assert_ptr_eq(self->f->pushUndefined(self), NULL);
   6022   terminateO(self);
   6023 
   6024 END_TEST
   6025 
   6026 
   6027 START_TEST(pushBoolSmallJsonT)
   6028 
   6029   smallJsont* r;
   6030   smallJsont *self = allocSmallJson();
   6031 
   6032   // add an element to check that push adds the second element
   6033   // at the end
   6034   r = self->f->pushInt(self, 1);
   6035   ck_assert_ptr_ne(r, null);
   6036   r = self->f->pushBool(self, TRUE);
   6037   ck_assert_ptr_ne(r, null);
   6038   ck_assert_int_eq(lenO(r), 2);
   6039   char *s = toStringO(r);
   6040   ck_assert_str_eq(s, "[1,true]");
   6041   free(s);
   6042   // non json array
   6043   freeO(self);
   6044   setTypeBoolO(self);
   6045   ck_assert_ptr_eq(self->f->pushBool(self, true), NULL);
   6046   terminateO(self);
   6047 
   6048 END_TEST
   6049 
   6050 
   6051 START_TEST(pushDoubleSmallJsonT)
   6052 
   6053   smallJsont* r;
   6054   smallJsont *self = allocSmallJson();
   6055 
   6056   // add an element to check that push adds the second element
   6057   // at the end
   6058   r = self->f->pushInt(self, 1);
   6059   ck_assert_ptr_ne(r, null);
   6060   r = self->f->pushDouble(self, 1.0);
   6061   ck_assert_ptr_ne(r, null);
   6062   ck_assert_int_eq(lenO(r), 2);
   6063   char *s = toStringO(r);
   6064   ck_assert_str_eq(s, "[1,1.000000e+00]");
   6065   free(s);
   6066   // non json array
   6067   freeO(self);
   6068   setTypeBoolO(self);
   6069   ck_assert_ptr_eq(self->f->pushDouble(self, 2.2), NULL);
   6070   terminateO(self);
   6071 
   6072 END_TEST
   6073 
   6074 
   6075 START_TEST(pushIntSmallJsonT)
   6076 
   6077   smallJsont* r;
   6078   smallJsont *self = allocSmallJson();
   6079 
   6080   // add an element to check that push adds the second element
   6081   // at the end
   6082   r = self->f->pushInt(self, 1);
   6083   ck_assert_ptr_ne(r, null);
   6084   r = self->f->pushInt(self, 1);
   6085   ck_assert_ptr_ne(r, null);
   6086   ck_assert_int_eq(lenO(r), 2);
   6087   char *s = toStringO(r);
   6088   ck_assert_str_eq(s, "[1,1]");
   6089   free(s);
   6090   // non json array
   6091   freeO(self);
   6092   setTypeBoolO(self);
   6093   ck_assert_ptr_eq(self->f->pushInt(self, 3), NULL);
   6094   terminateO(self);
   6095 
   6096 END_TEST
   6097 
   6098 
   6099 START_TEST(pushSSmallJsonT)
   6100 
   6101   smallJsont* r;
   6102   smallJsont *self = allocSmallJson();
   6103 
   6104   // add an element to check that push adds the second element
   6105   // at the end
   6106   r = self->f->pushInt(self, 1);
   6107   ck_assert_ptr_ne(r, null);
   6108   r = self->f->pushS(self, null);
   6109   ck_assert_ptr_eq(r, null);
   6110   ck_assert_int_eq(lenO(self), 1);
   6111   char *s = toStringO(self);
   6112   ck_assert_str_eq(s, "[1]");
   6113   free(s);
   6114   char *str = "poi";
   6115   r = self->f->pushS(self, str);
   6116   ck_assert_ptr_ne(r, null);
   6117   ck_assert_int_eq(lenO(self), 2);
   6118   s = toStringO(r);
   6119   ck_assert_str_eq(s, "[1,\"poi\"]");
   6120   free(s);
   6121   // non json array
   6122   freeO(self);
   6123   setTypeBoolO(self);
   6124   ck_assert_ptr_eq(self->f->pushS(self, "qwe"), NULL);
   6125   terminateO(self);
   6126   // json string
   6127   self = allocSmallJson();
   6128   setTopSO(self, "qwe");
   6129   r = self->f->pushS(self, "!@#");
   6130   ck_assert_ptr_ne(r, null);
   6131   s = toStringO(r);
   6132   ck_assert_str_eq(s, "qwe!@#");
   6133   free(s);
   6134   // empty string
   6135   r = self->f->pushS(self, "");
   6136   ck_assert_ptr_ne(r, null);
   6137   s = toStringO(r);
   6138   ck_assert_str_eq(s, "qwe!@#");
   6139   free(s);
   6140   // empty self
   6141   freeO(self);
   6142   setTypeStringO(self);
   6143   r = self->f->pushS(self, "asd");
   6144   ck_assert_ptr_ne(r, null);
   6145   s = toStringO(r);
   6146   ck_assert_str_eq(s, "asd");
   6147   free(s);
   6148   terminateO(self);
   6149 
   6150 END_TEST
   6151 
   6152 
   6153 START_TEST(pushCharSmallJsonT)
   6154 
   6155   smallJsont* r;
   6156   smallJsont *self = allocSmallJson();
   6157 
   6158   // add an element to check that push adds the second element
   6159   // at the end
   6160   r = self->f->pushInt(self, 1);
   6161   ck_assert_ptr_ne(r, null);
   6162   r = self->f->pushChar(self, 'a');
   6163   ck_assert_ptr_ne(r, null);
   6164   ck_assert_int_eq(lenO(r), 2);
   6165   char *s = toStringO(r);
   6166   ck_assert_str_eq(s, "[1,\"a\"]");
   6167   free(s);
   6168   // non json array
   6169   freeO(self);
   6170   setTypeBoolO(self);
   6171   ck_assert_ptr_eq(self->f->pushChar(self, 'a'), NULL);
   6172   terminateO(self);
   6173 
   6174 END_TEST
   6175 
   6176 
   6177 START_TEST(pushDictSmallJsonT)
   6178 
   6179   smallJsont* r;
   6180   smallJsont *self = allocSmallJson();
   6181   smallDictt *dict  = allocG(rtSmallDictt);
   6182 
   6183   // add an element to check that push adds the second element
   6184   // at the end
   6185   r = self->f->pushInt(self, 1);
   6186   ck_assert_ptr_ne(r, null);
   6187   // push dict
   6188   r = self->f->pushDict(self, dict);
   6189   ck_assert_ptr_ne(r, null);
   6190   ck_assert_int_eq(lenO(r), 2);
   6191   ck_assert_ptr_ne(r, null);
   6192   char *s = toStringO(r);
   6193   ck_assert_str_eq(s, "[1,{}]");
   6194   free(s);
   6195   // non json array
   6196   freeO(self);
   6197   setTypeBoolO(self);
   6198   ck_assert_ptr_eq(self->f->pushDict(self, dict), NULL);
   6199   finishO(dict);
   6200   setTypeArrayO(self);
   6201   // non smallDict object
   6202   dict = (smallDictt*) allocSmallInt(2);
   6203   r = self->f->pushDict(self, dict);
   6204   ck_assert_ptr_eq(r, null);
   6205   terminateO(dict);
   6206   // null
   6207   r = self->f->pushDict(self, null);
   6208   ck_assert_ptr_eq(r, null);
   6209   ck_assert_int_eq(lenO(self), 0);
   6210   s = toStringO(self);
   6211   ck_assert_str_eq(s, "[]");
   6212   free(s);
   6213   terminateO(self);
   6214 
   6215 END_TEST
   6216 
   6217 
   6218 START_TEST(pushArraySmallJsonT)
   6219 
   6220   smallJsont* r;
   6221   smallJsont *self  = allocSmallJson();
   6222   smallArrayt *array = allocG(rtSmallArrayt);
   6223 
   6224   // add an element to check that push adds the second element
   6225   // at the end
   6226   r = self->f->pushInt(self, 1);
   6227   ck_assert_ptr_ne(r, null);
   6228   r = self->f->pushArray(self, array);
   6229   ck_assert_ptr_ne(r, null);
   6230   ck_assert_int_eq(lenO(r), 2);
   6231   char *s = toStringO(r);
   6232   ck_assert_str_eq(s, "[1,[]]");
   6233   free(s);
   6234   // non json array
   6235   freeO(self);
   6236   setTypeBoolO(self);
   6237   ck_assert_ptr_eq(self->f->pushArray(self, array), NULL);
   6238   finishO(array);
   6239   setTypeArrayO(self);
   6240   // non smallArray object
   6241   array = (smallArrayt*) allocSmallInt(2);
   6242   r = self->f->pushArray(self, array);
   6243   ck_assert_ptr_eq(r, null);
   6244   terminateO(array);
   6245   // null
   6246   r = self->f->pushArray(self, null);
   6247   ck_assert_ptr_eq(r, null);
   6248   ck_assert_int_eq(lenO(self), 0);
   6249   s = toStringO(self);
   6250   ck_assert_str_eq(s, "[]");
   6251   free(s);
   6252   terminateO(self);
   6253 
   6254 END_TEST
   6255 
   6256 
   6257 START_TEST(pushArraycSmallJsonT)
   6258 
   6259   smallJsont* r;
   6260   smallJsont *self = allocSmallJson();
   6261   char **array      = listCreateS("a","bb");
   6262 
   6263   // add an element to check that push adds the second element
   6264   // at the end
   6265   r = self->f->pushInt(self, 1);
   6266   ck_assert_ptr_ne(r, null);
   6267 
   6268   r = self->f->pushArrayc(self, array);
   6269   ck_assert_ptr_ne(r, null);
   6270   ck_assert_int_eq(lenO(r), 2);
   6271   char *s = toStringO(r);
   6272   ck_assert_str_eq(s, "[1,[\"a\",\"bb\"]]");
   6273   free(s);
   6274   // non json array
   6275   freeO(self);
   6276   setTypeBoolO(self);
   6277   ck_assert_ptr_eq(self->f->pushArrayc(self, array), NULL);
   6278   listFreeS(array);
   6279   setTypeArrayO(self);
   6280   // null
   6281   r = self->f->pushArrayc(self, null);
   6282   ck_assert_ptr_eq(r, null);
   6283   ck_assert_int_eq(lenO(self), 0);
   6284   s = toStringO(self);
   6285   ck_assert_str_eq(s, "[]");
   6286   free(s);
   6287   terminateO(self);
   6288 
   6289 END_TEST
   6290 
   6291 
   6292 START_TEST(pushSmallBoolSmallJsonT)
   6293 
   6294   smallJsont* r;
   6295   smallJsont *self = allocSmallJson();
   6296   smallBoolt *value = allocG(TRUE);
   6297 
   6298   // add an element to check that push adds the second element
   6299   // at the end
   6300   r = self->f->pushInt(self, 1);
   6301   ck_assert_ptr_ne(r, null);
   6302   r = self->f->pushSmallBool(self, value);
   6303   ck_assert_ptr_ne(r, null);
   6304   ck_assert_int_eq(lenO(r), 2);
   6305   char *s = toStringO(r);
   6306   ck_assert_str_eq(s, "[1,true]");
   6307   free(s);
   6308   // non json array
   6309   freeO(self);
   6310   setTypeBoolO(self);
   6311   ck_assert_ptr_eq(self->f->pushSmallBool(self, value), NULL);
   6312   finishO(value);
   6313   setTypeArrayO(self);
   6314   // non smallBool object
   6315   value = (smallBoolt*) allocSmallInt(2);
   6316   r = self->f->pushSmallBool(self, value);
   6317   ck_assert_ptr_eq(r, null);
   6318   terminateO(value);
   6319   // bool object with no data
   6320   createAllocateSmallBool(b);
   6321   r = self->f->pushSmallBool(self, b);
   6322   ck_assert_ptr_ne(r, null);
   6323   ck_assert_int_eq(lenO(r), 1);
   6324   finishO(b);
   6325   s = toStringO(r);
   6326   ck_assert_str_eq(s, "[false]");
   6327   free(s);
   6328   // null
   6329   r = self->f->pushSmallBool(self, null);
   6330   ck_assert_ptr_eq(r, null);
   6331   ck_assert_int_eq(lenO(self), 1);
   6332   s = toStringO(self);
   6333   ck_assert_str_eq(s, "[false]");
   6334   free(s);
   6335   terminateO(self);
   6336 
   6337 END_TEST
   6338 
   6339 
   6340 START_TEST(pushSmallBytesSmallJsonT)
   6341 
   6342   smallJsont* r;
   6343   smallJsont *self = allocSmallJson();
   6344   createAllocateSmallBytes(value);
   6345 
   6346   // add an element to check that push adds the second element
   6347   // at the end
   6348   r = self->f->pushInt(self, 1);
   6349   ck_assert_ptr_ne(r, null);
   6350   // the smallBytes container is empty
   6351   r = self->f->pushSmallBytes(self, value);
   6352   ck_assert_ptr_ne(r, null);
   6353   ck_assert_int_eq(lenO(r), 2);
   6354   char *s = toStringO(r);
   6355   ck_assert_str_eq(s, "[1,[]]");
   6356   free(s);
   6357   // non json array
   6358   freeO(self);
   6359   setTypeBoolO(self);
   6360   ck_assert_ptr_eq(self->f->pushSmallBytes(self, value), NULL);
   6361   setTypeArrayO(self);
   6362   // reuse value
   6363   value->B = null;
   6364   char *buffer = "poi";
   6365   pushBufferO(value, buffer, strlen(buffer));
   6366   r = self->f->pushSmallBytes(self, value);
   6367   finishO(value);
   6368   ck_assert_ptr_ne(r, null);
   6369   ck_assert_int_eq(lenO(r), 1);
   6370   s = toStringO(r);
   6371   ck_assert_str_eq(s, "[[0x70,0x6f,0x69]]");
   6372   free(s);
   6373   // non smallBytes object
   6374   value = (smallBytest*) allocSmallInt(2);
   6375   r = self->f->pushSmallBytes(self, value);
   6376   ck_assert_ptr_eq(r, null);
   6377   terminateO(value);
   6378   // null
   6379   r = self->f->pushSmallBytes(self, null);
   6380   ck_assert_ptr_eq(r, null);
   6381   ck_assert_int_eq(lenO(self), 1);
   6382   s = toStringO(self);
   6383   ck_assert_str_eq(s, "[[0x70,0x6f,0x69]]");
   6384   free(s);
   6385   terminateO(self);
   6386 
   6387 END_TEST
   6388 
   6389 
   6390 START_TEST(pushSmallDoubleSmallJsonT)
   6391 
   6392   smallJsont* r;
   6393   smallJsont *self   = allocSmallJson();
   6394   smallDoublet *value = allocG(1.0);
   6395 
   6396   // add an element to check that push adds the second element
   6397   // at the end
   6398   r = self->f->pushInt(self, 1);
   6399   ck_assert_ptr_ne(r, null);
   6400   r = self->f->pushSmallDouble(self, value);
   6401   ck_assert_ptr_ne(r, null);
   6402   ck_assert_int_eq(lenO(r), 2);
   6403   char *s = toStringO(r);
   6404   ck_assert_str_eq(s, "[1,1.000000e+00]");
   6405   free(s);
   6406   // non json array
   6407   freeO(self);
   6408   setTypeBoolO(self);
   6409   ck_assert_ptr_eq(self->f->pushSmallDouble(self, value), NULL);
   6410   finishO(value);
   6411   setTypeArrayO(self);
   6412   // object with no data
   6413   createAllocateSmallDouble(b);
   6414   r = self->f->pushSmallDouble(self, b);
   6415   ck_assert_ptr_ne(r, null);
   6416   ck_assert_int_eq(lenO(r), 1);
   6417   finishO(b);
   6418   s = toStringO(r);
   6419   ck_assert_str_eq(s, "[0.000000e+00]");
   6420   free(s);
   6421   // non smallDouble object
   6422   value = (smallDoublet*) allocSmallInt(2);
   6423   r = self->f->pushSmallDouble(self, value);
   6424   ck_assert_ptr_eq(r, null);
   6425   terminateO(value);
   6426   // null
   6427   r = self->f->pushSmallDouble(self, null);
   6428   ck_assert_ptr_eq(r, null);
   6429   ck_assert_int_eq(lenO(self), 1);
   6430   s = toStringO(self);
   6431   ck_assert_str_eq(s, "[0.000000e+00]");
   6432   free(s);
   6433   terminateO(self);
   6434 
   6435 END_TEST
   6436 
   6437 
   6438 START_TEST(pushSmallIntSmallJsonT)
   6439 
   6440   smallJsont* r;
   6441   smallJsont *self = allocSmallJson();
   6442   smallIntt *value  = allocG(1);
   6443 
   6444   // add an element to check that push adds the second element
   6445   // at the end
   6446   r = self->f->pushInt(self, 1);
   6447   ck_assert_ptr_ne(r, null);
   6448   r = self->f->pushSmallInt(self, value);
   6449   ck_assert_ptr_ne(r, null);
   6450   ck_assert_int_eq(lenO(r), 2);
   6451   char *s = toStringO(r);
   6452   ck_assert_str_eq(s, "[1,1]");
   6453   free(s);
   6454   // non json array
   6455   freeO(self);
   6456   setTypeBoolO(self);
   6457   ck_assert_ptr_eq(self->f->pushSmallInt(self, value), NULL);
   6458   finishO(value);
   6459   setTypeArrayO(self);
   6460   // int object with no data
   6461   createAllocateSmallInt(b);
   6462   r = self->f->pushSmallInt(self, b);
   6463   ck_assert_ptr_ne(r, null);
   6464   ck_assert_int_eq(lenO(r), 1);
   6465   finishO(b);
   6466   s = toStringO(r);
   6467   ck_assert_str_eq(s, "[0]");
   6468   free(s);
   6469   // non smallInt object
   6470   value = (smallIntt*) allocSmallBool(true);
   6471   r = self->f->pushSmallInt(self, value);
   6472   ck_assert_ptr_eq(r, null);
   6473   terminateO(value);
   6474   // null
   6475   r = self->f->pushSmallInt(self, null);
   6476   ck_assert_ptr_eq(r, null);
   6477   ck_assert_int_eq(lenO(self), 1);
   6478   s = toStringO(self);
   6479   ck_assert_str_eq(s, "[0]");
   6480   free(s);
   6481   terminateO(self);
   6482 
   6483 END_TEST
   6484 
   6485 
   6486 START_TEST(pushSmallJsonSmallJsonT)
   6487 
   6488   smallJsont* r;
   6489   smallJsont *self = allocSmallJson();
   6490   smallJsont *value = allocG(rtSmallJsont);
   6491 
   6492   // add an element to check that push adds the second element
   6493   // at the end
   6494   r = self->f->pushInt(self, 1);
   6495   ck_assert_ptr_ne(r, null);
   6496   // the smallJson container is empty
   6497   r = self->f->pushSmallJson(self, value);
   6498   ck_assert_ptr_ne(r, null);
   6499   ck_assert_int_eq(lenO(r), 2);
   6500   char *s = toStringO(r);
   6501   ck_assert_str_eq(s, "[1,{}]");
   6502   free(s);
   6503   // non json array
   6504   freeO(self);
   6505   setTypeBoolO(self);
   6506   ck_assert_ptr_eq(self->f->pushSmallJson(self, value), NULL);
   6507   setTypeArrayO(self);
   6508   resetO(value);
   6509   parseO(value, "{}");
   6510   r = self->f->pushSmallJson(self, value);
   6511   finishO(value);
   6512   ck_assert_ptr_ne(r, null);
   6513   ck_assert_int_eq(lenO(r), 1);
   6514   s = toStringO(r);
   6515   ck_assert_str_eq(s, "[{}]");
   6516   free(s);
   6517   // non smallJson object
   6518   value = (smallJsont*) allocSmallInt(2);
   6519   r = self->f->pushSmallJson(self, value);
   6520   ck_assert_ptr_eq(r, null);
   6521   terminateO(value);
   6522   // null
   6523   r = self->f->pushSmallJson(self, null);
   6524   ck_assert_ptr_eq(r, null);
   6525   ck_assert_int_eq(lenO(self), 1);
   6526   s = toStringO(self);
   6527   ck_assert_str_eq(s, "[{}]");
   6528   free(s);
   6529   terminateO(self);
   6530 
   6531 END_TEST
   6532 
   6533 
   6534 START_TEST(pushSmallStringSmallJsonT)
   6535 
   6536   smallJsont* r;
   6537   smallJsont *self    = allocSmallJson();
   6538   createAllocateSmallString(string);
   6539 
   6540   // add an element to check that push adds the second element
   6541   // at the end
   6542   r = self->f->pushInt(self, 1);
   6543   ck_assert_ptr_ne(r, null);
   6544   r = self->f->pushSmallString(self, string);
   6545   ck_assert_ptr_ne(r, null);
   6546   ck_assert_int_eq(lenO(r), 2);
   6547   char *s = toStringO(r);
   6548   ck_assert_str_eq(s, "[1,\"\"]");
   6549   free(s);
   6550   // non json array
   6551   freeO(self);
   6552   setTypeBoolO(self);
   6553   ck_assert_ptr_eq(self->f->pushSmallString(self, string), NULL);
   6554   finishO(string);
   6555   setTypeArrayO(self);
   6556   // non smallString object
   6557   string = (smallStringt*) allocSmallInt(2);
   6558   r = self->f->pushSmallString(self, string);
   6559   ck_assert_ptr_eq(r, null);
   6560   terminateO(string);
   6561   // null
   6562   r = self->f->pushSmallString(self, null);
   6563   ck_assert_ptr_eq(r, null);
   6564   ck_assert_int_eq(lenO(self), 0);
   6565   s = toStringO(self);
   6566   ck_assert_str_eq(s, "[]");
   6567   free(s);
   6568   terminateO(self);
   6569   // json string
   6570   self   = allocSmallJson();
   6571   setTopSO(self, "qwe");
   6572   string = allocSmallString("!@#");
   6573   r = self->f->pushSmallString(self, string);
   6574   ck_assert_ptr_ne(r, null);
   6575   s = toStringO(r);
   6576   ck_assert_str_eq(s, "qwe!@#");
   6577   free(s);
   6578   // empty string
   6579   setValO(string, "");
   6580   r = self->f->pushSmallString(self, string);
   6581   ck_assert_ptr_ne(r, null);
   6582   s = toStringO(r);
   6583   ck_assert_str_eq(s, "qwe!@#");
   6584   free(s);
   6585   freeO(string);
   6586   r = self->f->pushSmallString(self, string);
   6587   ck_assert_ptr_ne(r, null);
   6588   s = toStringO(r);
   6589   ck_assert_str_eq(s, "qwe!@#");
   6590   free(s);
   6591   // empty self
   6592   freeO(self);
   6593   setTypeStringO(self);
   6594   setValO(string, "asd");
   6595   r = self->f->pushSmallString(self, string);
   6596   ck_assert_ptr_ne(r, null);
   6597   s = toStringO(r);
   6598   ck_assert_str_eq(s, "asd");
   6599   free(s);
   6600   terminateO(string);
   6601   // not smallString object
   6602   string = (smallStringt*) allocSmallInt(1);
   6603   r = self->f->pushSmallString(self, string);
   6604   ck_assert_ptr_eq(r, null);
   6605   terminateO(string);
   6606   terminateO(self);
   6607 
   6608 END_TEST
   6609 
   6610 
   6611 START_TEST(pushSmallContainerSmallJsonT)
   6612 
   6613   smallJsont* r;
   6614   smallJsont *self          = allocSmallJson();
   6615   createAllocateSmallContainer(container);
   6616 
   6617   // add an element to check that push adds the second element
   6618   // at the end
   6619   r = self->f->pushInt(self, 1);
   6620   ck_assert_ptr_ne(r, null);
   6621   r = self->f->pushSmallContainer(self, container);
   6622   ck_assert_ptr_ne(r, null);
   6623   ck_assert_int_eq(lenO(r), 2);
   6624   char *s = toStringO(r);
   6625   ck_assert_str_eq(s, "[1,\"<data container>\"]");
   6626   free(s);
   6627   // non json array
   6628   freeO(self);
   6629   setTypeBoolO(self);
   6630   ck_assert_ptr_eq(self->f->pushSmallContainer(self, container), NULL);
   6631   finishO(container);
   6632   setTypeArrayO(self);
   6633   // non smallContainer object
   6634   container = (smallContainert*) allocSmallInt(2);
   6635   r = self->f->pushSmallContainer(self, container);
   6636   ck_assert_ptr_eq(r, null);
   6637   terminateO(container);
   6638   // null
   6639   r = self->f->pushSmallContainer(self, null);
   6640   ck_assert_ptr_eq(r, null);
   6641   ck_assert_int_eq(lenO(self), 0);
   6642   s = toStringO(self);
   6643   ck_assert_str_eq(s, "[]");
   6644   free(s);
   6645   terminateO(self);
   6646 
   6647 END_TEST
   6648 
   6649 
   6650 START_TEST(pushNFreeSmallJsonT)
   6651 
   6652   smallJsont* r;
   6653   smallJsont *self = allocSmallJson();
   6654   baset *value = (baset*) allocG(2);
   6655 
   6656   // add an element to check that push adds the second element
   6657   // at the end
   6658   r = self->f->pushInt(self, 1);
   6659   ck_assert_ptr_ne(r, null);
   6660   r = self->f->pushNFree(self, value);
   6661   ck_assert_ptr_ne(r, null);
   6662   ck_assert_int_eq(lenO(r), 2);
   6663   char *s = toStringO(r);
   6664   ck_assert_str_eq(s, "[1,2]");
   6665   free(s);
   6666   // null
   6667   r = self->f->pushNFree(self, null);
   6668   ck_assert_ptr_eq(r, null);
   6669   ck_assert_int_eq(lenO(self), 2);
   6670   s = toStringO(self);
   6671   ck_assert_str_eq(s, "[1,2]");
   6672   free(s);
   6673   // non json array
   6674   freeO(self);
   6675   value = (baset*) allocSmallInt(2);
   6676   setTypeBoolO(self);
   6677   ck_assert_ptr_eq(self->f->pushNFree(self, value), NULL);
   6678   terminateO(value);
   6679   terminateO(self);
   6680 
   6681 END_TEST
   6682 
   6683 
   6684 START_TEST(pushNFreeUndefinedSmallJsonT)
   6685 
   6686   smallJsont* r;
   6687   smallJsont *self = allocSmallJson();
   6688 
   6689   // add an element to check that push adds the second element
   6690   // at the end
   6691   r = self->f->pushInt(self, 1);
   6692   ck_assert_ptr_ne(r, null);
   6693 
   6694   createAllocateUndefined(value);
   6695   r = self->f->pushNFreeUndefined(self, value);
   6696   ck_assert_ptr_ne(r, null);
   6697   ck_assert_int_eq(lenO(r), 2);
   6698   char *s = toStringO(r);
   6699   ck_assert_str_eq(s, "[1,null]");
   6700   free(s);
   6701   terminateO(self);
   6702 
   6703 END_TEST
   6704 
   6705 
   6706 START_TEST(pushNFreeSSmallJsonT)
   6707 
   6708   smallJsont* r;
   6709   smallJsont *self = allocSmallJson();
   6710 
   6711   // add an element to check that push adds the second element
   6712   // at the end
   6713   r = self->f->pushInt(self, 1);
   6714   ck_assert_ptr_ne(r, null);
   6715 
   6716   r = self->f->pushNFreeS(self, null);
   6717   ck_assert_ptr_eq(r, null);
   6718   ck_assert_int_eq(lenO(self), 1);
   6719   char *s = toStringO(self);
   6720   ck_assert_str_eq(s, "[1]");
   6721   free(s);
   6722 
   6723   char *str = strdup("poi");
   6724   r = self->f->pushNFreeS(self, str);
   6725   ck_assert_ptr_ne(r, null);
   6726   ck_assert_int_eq(lenO(self), 2);
   6727   s = toStringO(r);
   6728   ck_assert_str_eq(s, "[1,\"poi\"]");
   6729   free(s);
   6730 
   6731   terminateO(self);
   6732 
   6733 END_TEST
   6734 
   6735 
   6736 START_TEST(pushNFreeDictSmallJsonT)
   6737 
   6738   smallJsont* r;
   6739   smallJsont *self = allocSmallJson();
   6740   smallDictt *dict  = allocG(rtSmallDictt);
   6741 
   6742   // add an element to check that push adds the second element
   6743   // at the end
   6744   r = self->f->pushInt(self, 1);
   6745   ck_assert_ptr_ne(r, null);
   6746 
   6747   // push dict
   6748   r = self->f->pushNFreeDict(self, dict);
   6749   ck_assert_ptr_ne(r, null);
   6750   ck_assert_int_eq(lenO(r), 2);
   6751   ck_assert_ptr_ne(r, null);
   6752   char *s = toStringO(r);
   6753   ck_assert_str_eq(s, "[1,{}]");
   6754   free(s);
   6755   // null
   6756   r = self->f->pushNFreeDict(self, null);
   6757   ck_assert_ptr_eq(r, null);
   6758   ck_assert_int_eq(lenO(self), 2);
   6759   s = toStringO(self);
   6760   ck_assert_str_eq(s, "[1,{}]");
   6761   free(s);
   6762   terminateO(self);
   6763 
   6764 END_TEST
   6765 
   6766 
   6767 START_TEST(pushNFreeArraySmallJsonT)
   6768 
   6769   smallJsont* r;
   6770   smallJsont *self  = allocSmallJson();
   6771   smallArrayt *array = allocG(rtSmallArrayt);
   6772 
   6773   // add an element to check that push adds the second element
   6774   // at the end
   6775   r = self->f->pushInt(self, 1);
   6776   ck_assert_ptr_ne(r, null);
   6777 
   6778   r = self->f->pushNFreeArray(self, array);
   6779   ck_assert_ptr_ne(r, null);
   6780   ck_assert_int_eq(lenO(r), 2);
   6781   char *s = toStringO(r);
   6782   ck_assert_str_eq(s, "[1,[]]");
   6783   free(s);
   6784   // null
   6785   r = self->f->pushNFreeArray(self, null);
   6786   ck_assert_ptr_eq(r, null);
   6787   ck_assert_int_eq(lenO(self), 2);
   6788   s = toStringO(self);
   6789   ck_assert_str_eq(s, "[1,[]]");
   6790   free(s);
   6791   terminateO(self);
   6792 
   6793 END_TEST
   6794 
   6795 
   6796 START_TEST(pushNFreeArraycSmallJsonT)
   6797 
   6798   smallJsont* r;
   6799   smallJsont *self = allocSmallJson();
   6800   char **array      = listCreateS("a","bb");
   6801 
   6802   // add an element to check that push adds the second element
   6803   // at the end
   6804   r = self->f->pushInt(self, 1);
   6805   ck_assert_ptr_ne(r, null);
   6806 
   6807   r = self->f->pushNFreeArrayc(self, array);
   6808   ck_assert_ptr_ne(r, null);
   6809   ck_assert_int_eq(lenO(r), 2);
   6810   char *s = toStringO(r);
   6811   ck_assert_str_eq(s, "[1,[\"a\",\"bb\"]]");
   6812   free(s);
   6813   // null
   6814   r = self->f->pushNFreeArrayc(self, null);
   6815   ck_assert_ptr_eq(r, null);
   6816   ck_assert_int_eq(lenO(self), 2);
   6817   s = toStringO(self);
   6818   ck_assert_str_eq(s, "[1,[\"a\",\"bb\"]]");
   6819   free(s);
   6820   terminateO(self);
   6821 
   6822 END_TEST
   6823 
   6824 
   6825 START_TEST(pushNFreeSmallBoolSmallJsonT)
   6826 
   6827   smallJsont* r;
   6828   smallJsont *self = allocSmallJson();
   6829   smallBoolt *value = allocG(TRUE);
   6830 
   6831   // add an element to check that push adds the second element
   6832   // at the end
   6833   r = self->f->pushInt(self, 1);
   6834   ck_assert_ptr_ne(r, null);
   6835 
   6836   r = self->f->pushNFreeSmallBool(self, value);
   6837   ck_assert_ptr_ne(r, null);
   6838   ck_assert_int_eq(lenO(r), 2);
   6839   char *s = toStringO(r);
   6840   ck_assert_str_eq(s, "[1,true]");
   6841   free(s);
   6842   // bool object with no data
   6843   createAllocateSmallBool(b);
   6844   r = self->f->pushNFreeSmallBool(self, b);
   6845   ck_assert_ptr_ne(r, null);
   6846   ck_assert_int_eq(lenO(r), 3);
   6847   s = toStringO(r);
   6848   ck_assert_str_eq(s, "[1,true,false]");
   6849   free(s);
   6850   // null
   6851   r = self->f->pushNFreeSmallBool(self, null);
   6852   ck_assert_ptr_eq(r, null);
   6853   ck_assert_int_eq(lenO(self), 3);
   6854   s = toStringO(self);
   6855   ck_assert_str_eq(s, "[1,true,false]");
   6856   free(s);
   6857   terminateO(self);
   6858 
   6859 END_TEST
   6860 
   6861 
   6862 START_TEST(pushNFreeSmallBytesSmallJsonT)
   6863 
   6864   smallJsont* r;
   6865   smallJsont *self = allocSmallJson();
   6866   createAllocateSmallBytes(value);
   6867 
   6868   // add an element to check that push adds the second element
   6869   // at the end
   6870   r = self->f->pushInt(self, 1);
   6871   ck_assert_ptr_ne(r, null);
   6872 
   6873   // the smallBytes container is empty
   6874   r = self->f->pushNFreeSmallBytes(self, value);
   6875   ck_assert_ptr_ne(r, null);
   6876   ck_assert_int_eq(lenO(r), 2);
   6877   char *s = toStringO(r);
   6878   ck_assert_str_eq(s, "[1,[]]");
   6879   free(s);
   6880 
   6881   char *buffer = "poi";
   6882   value        = allocSmallBytes(buffer, strlen(buffer));
   6883   r = self->f->pushNFreeSmallBytes(self, value);
   6884   ck_assert_ptr_ne(r, null);
   6885   ck_assert_int_eq(lenO(r), 3);
   6886   s = toStringO(r);
   6887   ck_assert_str_eq(s, "[1,[],[0x70,0x6f,0x69]]");
   6888   free(s);
   6889   // null
   6890   r = self->f->pushNFreeSmallBytes(self, null);
   6891   ck_assert_ptr_eq(r, null);
   6892   ck_assert_int_eq(lenO(self), 3);
   6893   s = toStringO(self);
   6894   ck_assert_str_eq(s, "[1,[],[0x70,0x6f,0x69]]");
   6895   free(s);
   6896   terminateO(self);
   6897 
   6898 END_TEST
   6899 
   6900 
   6901 START_TEST(pushNFreeSmallDoubleSmallJsonT)
   6902 
   6903   smallJsont* r;
   6904   smallJsont *self   = allocSmallJson();
   6905   smallDoublet *value = allocG(1.0);
   6906 
   6907   // add an element to check that push adds the second element
   6908   // at the end
   6909   r = self->f->pushInt(self, 1);
   6910   ck_assert_ptr_ne(r, null);
   6911 
   6912   r = self->f->pushNFreeSmallDouble(self, value);
   6913   ck_assert_ptr_ne(r, null);
   6914   ck_assert_int_eq(lenO(r), 2);
   6915   char *s = toStringO(r);
   6916   ck_assert_str_eq(s, "[1,1.000000e+00]");
   6917   free(s);
   6918   // object with no data
   6919   createAllocateSmallDouble(b);
   6920   r = self->f->pushNFreeSmallDouble(self, b);
   6921   ck_assert_ptr_ne(r, null);
   6922   ck_assert_int_eq(lenO(r), 3);
   6923   s = toStringO(r);
   6924   ck_assert_str_eq(s, "[1,1.000000e+00,0.000000e+00]");
   6925   free(s);
   6926   // null
   6927   r = self->f->pushNFreeSmallDouble(self, null);
   6928   ck_assert_ptr_eq(r, null);
   6929   ck_assert_int_eq(lenO(self), 3);
   6930   s = toStringO(self);
   6931   ck_assert_str_eq(s, "[1,1.000000e+00,0.000000e+00]");
   6932   free(s);
   6933   terminateO(self);
   6934 
   6935 END_TEST
   6936 
   6937 
   6938 START_TEST(pushNFreeSmallIntSmallJsonT)
   6939 
   6940   smallJsont* r;
   6941   smallJsont *self = allocSmallJson();
   6942   smallIntt *value  = allocG(1);
   6943 
   6944   // add an element to check that push adds the second element
   6945   // at the end
   6946   r = self->f->pushInt(self, 1);
   6947   ck_assert_ptr_ne(r, null);
   6948 
   6949   r = self->f->pushNFreeSmallInt(self, value);
   6950   ck_assert_ptr_ne(r, null);
   6951   ck_assert_int_eq(lenO(r), 2);
   6952   char *s = toStringO(r);
   6953   ck_assert_str_eq(s, "[1,1]");
   6954   free(s);
   6955   // bool object with no data
   6956   createAllocateSmallInt(b);
   6957   r = self->f->pushNFreeSmallInt(self, b);
   6958   ck_assert_ptr_ne(r, null);
   6959   ck_assert_int_eq(lenO(r), 3);
   6960   s = toStringO(r);
   6961   ck_assert_str_eq(s, "[1,1,0]");
   6962   free(s);
   6963   // null
   6964   r = self->f->pushNFreeSmallInt(self, null);
   6965   ck_assert_ptr_eq(r, null);
   6966   ck_assert_int_eq(lenO(self), 3);
   6967   s = toStringO(self);
   6968   ck_assert_str_eq(s, "[1,1,0]");
   6969   free(s);
   6970   terminateO(self);
   6971 
   6972 END_TEST
   6973 
   6974 
   6975 START_TEST(pushNFreeSmallJsonSmallJsonT)
   6976 
   6977   smallJsont* r;
   6978   smallJsont *self = allocSmallJson();
   6979   smallJsont *value = allocG(rtSmallJsont);
   6980 
   6981   // add an element to check that push adds the second element
   6982   // at the end
   6983   r = self->f->pushInt(self, 1);
   6984   ck_assert_ptr_ne(r, null);
   6985 
   6986   // the smallJson container is empty
   6987   r = self->f->pushNFreeSmallJson(self, value);
   6988   ck_assert_ptr_ne(r, null);
   6989   ck_assert_int_eq(lenO(r), 2);
   6990   char *s = toStringO(r);
   6991   ck_assert_str_eq(s, "[1,{}]");
   6992   free(s);
   6993 
   6994   value = allocG(rtSmallJsont);
   6995   parseO(value, "{}");
   6996   r = self->f->pushNFreeSmallJson(self, value);
   6997   ck_assert_ptr_ne(r, null);
   6998   ck_assert_int_eq(lenO(r), 3);
   6999   s = toStringO(r);
   7000   ck_assert_str_eq(s, "[1,{},{}]");
   7001   free(s);
   7002   // null
   7003   r = self->f->pushNFreeSmallJson(self, null);
   7004   ck_assert_ptr_eq(r, null);
   7005   ck_assert_int_eq(lenO(self), 3);
   7006   s = toStringO(self);
   7007   ck_assert_str_eq(s, "[1,{},{}]");
   7008   free(s);
   7009   terminateO(self);
   7010 
   7011 END_TEST
   7012 
   7013 
   7014 START_TEST(pushNFreeSmallStringSmallJsonT)
   7015 
   7016   smallJsont* r;
   7017   smallJsont *self    = allocSmallJson();
   7018   createAllocateSmallString(string);
   7019 
   7020   // add an element to check that push adds the second element
   7021   // at the end
   7022   r = self->f->pushInt(self, 1);
   7023   ck_assert_ptr_ne(r, null);
   7024 
   7025   r = self->f->pushNFreeSmallString(self, string);
   7026   ck_assert_ptr_ne(r, null);
   7027   ck_assert_int_eq(lenO(r), 2);
   7028   char *s = toStringO(r);
   7029   ck_assert_str_eq(s, "[1,\"\"]");
   7030   free(s);
   7031   // null
   7032   r = self->f->pushNFreeSmallString(self, null);
   7033   ck_assert_ptr_eq(r, null);
   7034   ck_assert_int_eq(lenO(self), 2);
   7035   s = toStringO(self);
   7036   ck_assert_str_eq(s, "[1,\"\"]");
   7037   free(s);
   7038   terminateO(self);
   7039 
   7040 END_TEST
   7041 
   7042 
   7043 START_TEST(pushNFreeSmallContainerSmallJsonT)
   7044 
   7045   smallJsont* r;
   7046   smallJsont *self          = allocSmallJson();
   7047   createAllocateSmallContainer(container);
   7048 
   7049   // add an element to check that push adds the second element
   7050   // at the end
   7051   r = self->f->pushInt(self, 1);
   7052   ck_assert_ptr_ne(r, null);
   7053 
   7054   r = self->f->pushNFreeSmallContainer(self, container);
   7055   ck_assert_ptr_ne(r, null);
   7056   ck_assert_int_eq(lenO(r), 2);
   7057   char *s = toStringO(r);
   7058   ck_assert_str_eq(s, "[1,\"<data container>\"]");
   7059   free(s);
   7060   // null
   7061   r = self->f->pushNFreeSmallContainer(self, null);
   7062   ck_assert_ptr_eq(r, null);
   7063   ck_assert_int_eq(lenO(self), 2);
   7064   s = toStringO(self);
   7065   ck_assert_str_eq(s, "[1,\"<data container>\"]");
   7066   free(s);
   7067   terminateO(self);
   7068 
   7069 END_TEST
   7070 
   7071 
   7072 START_TEST(pushManySmallJsonT)
   7073 
   7074   smallJsont* r;
   7075   smallJsont *self = allocSmallJson();
   7076   smallIntt *v1 = allocG(1);
   7077   smallIntt *v2 = allocG(2);
   7078 
   7079   r = self->f->pushMany(self, v1, v2, null);
   7080   finishO(v1);
   7081   finishO(v2);
   7082   ck_assert_ptr_ne(r, null);
   7083   ck_assert_int_eq(lenO(r), 2);
   7084   char *s = toStringO(r);
   7085   ck_assert_str_eq(s, "[1,2]");
   7086   free(s);
   7087   terminateO(self);
   7088   // json string
   7089   self = allocSmallJson();
   7090   setTopSO(self, "qwe");
   7091   smallStringt *s1 = allocSmallString("123");
   7092   smallStringt *s2 = allocSmallString("456");
   7093   r = self->f->pushMany(self, s1, s2, null);
   7094   ck_assert_ptr_ne(r, null);
   7095   terminateO(s1);
   7096   terminateO(s2);
   7097   s = toStringO(r);
   7098   ck_assert_str_eq(s, "qwe123456");
   7099   free(s);
   7100   // non smallString object
   7101   s1 = allocSmallString("123");
   7102   s2 = (smallStringt*) allocSmallInt(1);
   7103   r = self->f->pushMany(self, s1, s2, null);
   7104   ck_assert_ptr_eq(r, null);
   7105   s = toStringO(self);
   7106   ck_assert_str_eq(s, "qwe123456");
   7107   free(s);
   7108   terminateO(s1);
   7109   terminateO(s2);
   7110   terminateO(self);
   7111 
   7112 END_TEST
   7113 
   7114 
   7115 START_TEST(pushManySSmallJsonT)
   7116 
   7117   smallJsont* r;
   7118   smallJsont *self = allocSmallJson();
   7119   char *v1 = "a";
   7120   char *v2 = "bb";
   7121 
   7122   r = self->f->pushManyS(self, v1, v2, null);
   7123   ck_assert_ptr_ne(r, null);
   7124   ck_assert_int_eq(lenO(r), 2);
   7125   char *s = toStringO(r);
   7126   ck_assert_str_eq(s, "[\"a\",\"bb\"]");
   7127   free(s);
   7128   terminateO(self);
   7129   // json string
   7130   self = allocSmallJson();
   7131   setTopSO(self, "qwe");
   7132   r = self->f->pushManyS(self, "123", "456", null);
   7133   ck_assert_ptr_ne(r, null);
   7134   s = toStringO(r);
   7135   ck_assert_str_eq(s, "qwe123456");
   7136   free(s);
   7137   terminateO(self);
   7138 
   7139 END_TEST
   7140 
   7141 
   7142 START_TEST(pushNFreeManySmallJsonT)
   7143 
   7144   smallJsont* r;
   7145   smallJsont *self = allocSmallJson();
   7146   smallIntt *v1 = allocG(1);
   7147   smallIntt *v2 = allocG(2);
   7148 
   7149   r = self->f->pushNFreeMany(self, v1, v2, null);
   7150   ck_assert_ptr_ne(r, null);
   7151   ck_assert_int_eq(lenO(r), 2);
   7152   char *s = toStringO(r);
   7153   ck_assert_str_eq(s, "[1,2]");
   7154   free(s);
   7155   terminateO(self);
   7156   // json string
   7157   self = allocSmallJson();
   7158   setTopSO(self, "qwe");
   7159   smallStringt *s1 = allocSmallString("123");
   7160   smallStringt *s2 = allocSmallString("456");
   7161   r = pushNFreeManyO(self, s1, s2);
   7162   ck_assert_ptr_ne(r, null);
   7163   s = toStringO(r);
   7164   ck_assert_str_eq(s, "qwe123456");
   7165   free(s);
   7166   // non smallString object
   7167   s1 = allocSmallString("123");
   7168   s2 = (smallStringt*) allocSmallInt(1);
   7169   r = pushNFreeManyO(self, s1, s2);
   7170   ck_assert_ptr_eq(r, null);
   7171   s = toStringO(self);
   7172   ck_assert_str_eq(s, "qwe123456");
   7173   free(s);
   7174   terminateO(s2);
   7175   terminateO(self);
   7176 
   7177 END_TEST
   7178 
   7179 
   7180 START_TEST(pushNFreeManySSmallJsonT)
   7181 
   7182   smallJsont* r;
   7183   smallJsont *self = allocSmallJson();
   7184   char *v1 = strdup("a");
   7185   char *v2 = strdup("bb");
   7186 
   7187   r = self->f->pushNFreeManyS(self, v1, v2, null);
   7188   ck_assert_ptr_ne(r, null);
   7189   ck_assert_int_eq(lenO(r), 2);
   7190   char *s = toStringO(r);
   7191   ck_assert_str_eq(s, "[\"a\",\"bb\"]");
   7192   free(s);
   7193   terminateO(self);
   7194   // json string
   7195   self = allocSmallJson();
   7196   setTopSO(self, "qwe");
   7197   r = pushNFreeManySO(self, strdup("123"), strdup("456"));
   7198   ck_assert_ptr_ne(r, null);
   7199   s = toStringO(r);
   7200   ck_assert_str_eq(s, "qwe123456");
   7201   free(s);
   7202   terminateO(self);
   7203 
   7204 END_TEST
   7205 
   7206 
   7207 START_TEST(popSmallJsonT)
   7208 
   7209   baset* r;
   7210   smallJsont *self = allocSmallJson();
   7211   smallJsont *r2;
   7212 
   7213   // add an element to check that the second element is poped
   7214   // at the end
   7215   r2 = self->f->pushInt(self, 1);
   7216   ck_assert_ptr_ne(r2, null);
   7217   // push a base object of unknown type
   7218   smallIntt *o    = allocSmallInt(2);
   7219   o->type         = "newType";
   7220   r2 = self->f->pushNFree(self, (baset*)o);
   7221   ck_assert_ptr_ne(r2, null);
   7222   r2 = self->f->pushUndefined(self);
   7223   ck_assert_ptr_ne(r2, null);
   7224   r2 = self->f->pushUndefined(self);
   7225   ck_assert_ptr_ne(r2, null);
   7226   delElemIndexO(self,-1);
   7227   r = self->f->pop(self);
   7228   ck_assert_ptr_ne(r, null);
   7229   ck_assert(isOUndefined(r));
   7230   terminateO(r);
   7231   r = self->f->pop(self);
   7232   ck_assert_ptr_ne(r, null);
   7233   ck_assert_str_eq(r->type, "newType");
   7234   char *s = toStringO(r);
   7235   terminateO(r);
   7236   ck_assert_str_eq(s, "2");
   7237   free(s);
   7238   ck_assert_int_eq(lenO(self), 1);
   7239   s = toStringO(self);
   7240   ck_assert_str_eq(s, "[1]");
   7241   free(s);
   7242   // empty array
   7243   r = self->f->pop(self);
   7244   ck_assert_ptr_ne(r, null);
   7245   terminateO(r);
   7246   s = toStringO(self);
   7247   ck_assert_str_eq(s, "[]");
   7248   free(s);
   7249   r = self->f->pop(self);
   7250   ck_assert_ptr_eq(r, null);
   7251   s = toStringO(self);
   7252   ck_assert_str_eq(s, "[]");
   7253   free(s);
   7254   r2 = self->f->pushUndefined(self);
   7255   ck_assert_ptr_ne(r2, null);
   7256   delElemIndexO(self,-1);
   7257   r = self->f->pop(self);
   7258   ck_assert_ptr_eq(r, null);
   7259   // non json array
   7260   freeO(self);
   7261   setTypeBoolO(self);
   7262   ck_assert_ptr_eq(self->f->pop(self), NULL);
   7263   terminateO(self);
   7264 
   7265 END_TEST
   7266 
   7267 
   7268 START_TEST(popUndefinedSmallJsonT)
   7269 
   7270   undefinedt* r;
   7271   smallJsont *self = allocSmallJson();
   7272   smallJsont *r2;
   7273   baset *r3;
   7274 
   7275   // add an element to check that the second element is poped
   7276   // at the end
   7277   r2 = self->f->pushInt(self, 1);
   7278   ck_assert_ptr_ne(r2, null);
   7279   // add second element
   7280   r2 = self->f->pushUndefined(self);
   7281   ck_assert_ptr_ne(r2, null);
   7282   // pop
   7283   r2 = self->f->pushUndefined(self);
   7284   ck_assert_ptr_ne(r2, null);
   7285   delElemIndexO(self,-1);
   7286   r = self->f->popUndefined(self);
   7287   ck_assert_ptr_ne(r, null);
   7288   char *s = toStringO(r);
   7289   terminateO(r);
   7290   ck_assert_str_eq(s, "null");
   7291   free(s);
   7292   ck_assert_int_eq(lenO(self), 1);
   7293   s = toStringO(self);
   7294   ck_assert_str_eq(s, "[1]");
   7295   free(s);
   7296   // pop element of unexpected type
   7297   r = self->f->popUndefined(self);
   7298   ck_assert_ptr_eq(r, null);
   7299   ck_assert_int_eq(lenO(self), 1);
   7300   s = toStringO(self);
   7301   ck_assert_str_eq(s, "[1]");
   7302   free(s);
   7303   // empty array
   7304   r3 = self->f->pop(self);
   7305   ck_assert_ptr_ne(r3, null);
   7306   terminateO(r3);
   7307   s = toStringO(self);
   7308   ck_assert_str_eq(s, "[]");
   7309   free(s);
   7310   r = self->f->popUndefined(self);
   7311   ck_assert_ptr_eq(r, null);
   7312   s = toStringO(self);
   7313   ck_assert_str_eq(s, "[]");
   7314   free(s);
   7315   r2 = self->f->pushUndefined(self);
   7316   ck_assert_ptr_ne(r2, null);
   7317   delElemIndexO(self,-1);
   7318   r = self->f->popUndefined(self);
   7319   ck_assert_ptr_eq(r, null);
   7320   // non json array
   7321   freeO(self);
   7322   setTypeBoolO(self);
   7323   ck_assert_ptr_eq(self->f->popUndefined(self), NULL);
   7324   terminateO(self);
   7325 
   7326 END_TEST
   7327 
   7328 
   7329 START_TEST(popBoolSmallJsonT)
   7330 
   7331   bool r;
   7332   smallJsont *self = allocSmallJson();
   7333   smallJsont *r2;
   7334   baset *r3;
   7335 
   7336   // add an element to check that the second element is poped
   7337   // at the end
   7338   r2 = self->f->pushInt(self, 1);
   7339   ck_assert_ptr_ne(r2, null);
   7340   // add second element
   7341   r2 = self->f->pushBool(self, TRUE);
   7342   ck_assert_ptr_ne(r2, null);
   7343   // pop
   7344   r = self->f->popBool(self);
   7345   ck_assert(r);
   7346   ck_assert_int_eq(lenO(self), 1);
   7347   char *s = toStringO(self);
   7348   ck_assert_str_eq(s, "[1]");
   7349   free(s);
   7350   // pop element of unexpected type
   7351   r = self->f->popBool(self);
   7352   ck_assert(!r);
   7353   ck_assert_int_eq(lenO(self), 1);
   7354   s = toStringO(self);
   7355   ck_assert_str_eq(s, "[1]");
   7356   free(s);
   7357   // empty array
   7358   r3 = self->f->pop(self);
   7359   ck_assert_ptr_ne(r3, null);
   7360   terminateO(r3);
   7361   s = toStringO(self);
   7362   ck_assert_str_eq(s, "[]");
   7363   free(s);
   7364   r = self->f->popBool(self);
   7365   ck_assert(!r);
   7366   s = toStringO(self);
   7367   ck_assert_str_eq(s, "[]");
   7368   free(s);
   7369   terminateO(self);
   7370 
   7371 END_TEST
   7372 
   7373 
   7374 START_TEST(popDoubleSmallJsonT)
   7375 
   7376   double r;
   7377   smallJsont *self = allocSmallJson();
   7378   smallJsont *r2;
   7379   baset *r3;
   7380 
   7381   // add an element to check that the second element is poped
   7382   // at the end
   7383   r2 = self->f->pushInt(self, 1);
   7384   ck_assert_ptr_ne(r2, null);
   7385   // add second element
   7386   r2 = self->f->pushDouble(self, 2.0);
   7387   ck_assert_ptr_ne(r2, null);
   7388   // pop
   7389   r = self->f->popDouble(self);
   7390   ck_assert(r==2.0);
   7391   ck_assert_int_eq(lenO(self), 1);
   7392   char *s = toStringO(self);
   7393   ck_assert_str_eq(s, "[1]");
   7394   free(s);
   7395   // pop element of unexpected type
   7396   r = self->f->popDouble(self);
   7397   ck_assert(!r);
   7398   ck_assert_int_eq(lenO(self), 1);
   7399   s = toStringO(self);
   7400   ck_assert_str_eq(s, "[1]");
   7401   free(s);
   7402   // empty array
   7403   r3 = self->f->pop(self);
   7404   ck_assert_ptr_ne(r3, null);
   7405   terminateO(r3);
   7406   s = toStringO(self);
   7407   ck_assert_str_eq(s, "[]");
   7408   free(s);
   7409   r = self->f->popDouble(self);
   7410   ck_assert(!r);
   7411   s = toStringO(self);
   7412   ck_assert_str_eq(s, "[]");
   7413   free(s);
   7414   terminateO(self);
   7415 
   7416 END_TEST
   7417 
   7418 
   7419 START_TEST(popIntSmallJsonT)
   7420 
   7421   int64_t r;
   7422   smallJsont *self = allocSmallJson();
   7423   smallJsont *r2;
   7424   baset *r3;
   7425 
   7426   // add an element to check that the second element is poped
   7427   // at the end
   7428   r2 = self->f->pushBool(self, FALSE);
   7429   ck_assert_ptr_ne(r2, null);
   7430   // add second element
   7431   r2 = self->f->pushInt(self, 2);
   7432   ck_assert_ptr_ne(r2, null);
   7433   // pop
   7434   r = self->f->popInt(self);
   7435   ck_assert_int_eq(r, 2);
   7436   ck_assert_int_eq(lenO(self), 1);
   7437   char *s = toStringO(self);
   7438   ck_assert_str_eq(s, "[false]");
   7439   free(s);
   7440   // pop element of unexpected type
   7441   r = self->f->popInt(self);
   7442   ck_assert(!r);
   7443   ck_assert_int_eq(lenO(self), 1);
   7444   s = toStringO(self);
   7445   ck_assert_str_eq(s, "[false]");
   7446   free(s);
   7447   // empty array
   7448   r3 = self->f->pop(self);
   7449   ck_assert_ptr_ne(r3, null);
   7450   terminateO(r3);
   7451   s = toStringO(self);
   7452   ck_assert_str_eq(s, "[]");
   7453   free(s);
   7454   r = self->f->popInt(self);
   7455   ck_assert(!r);
   7456   s = toStringO(self);
   7457   ck_assert_str_eq(s, "[]");
   7458   free(s);
   7459   terminateO(self);
   7460 
   7461 END_TEST
   7462 
   7463 
   7464 START_TEST(popInt32SmallJsonT)
   7465 
   7466   int32_t r;
   7467   smallJsont *self = allocSmallJson();
   7468   smallJsont *r2;
   7469   baset *r3;
   7470 
   7471   // add an element to check that the second element is poped
   7472   // at the end
   7473   r2 = self->f->pushBool(self, FALSE);
   7474   ck_assert_ptr_ne(r2, null);
   7475   // add second element
   7476   r2 = self->f->pushInt(self, 2);
   7477   ck_assert_ptr_ne(r2, null);
   7478   // pop
   7479   r = self->f->popInt32(self);
   7480   ck_assert_int_eq(r, 2);
   7481   ck_assert_int_eq(lenO(self), 1);
   7482   char *s = toStringO(self);
   7483   ck_assert_str_eq(s, "[false]");
   7484   free(s);
   7485   // pop element of unexpected type
   7486   r = self->f->popInt32(self);
   7487   ck_assert(!r);
   7488   ck_assert_int_eq(lenO(self), 1);
   7489   s = toStringO(self);
   7490   ck_assert_str_eq(s, "[false]");
   7491   free(s);
   7492   // empty array
   7493   r3 = self->f->pop(self);
   7494   ck_assert_ptr_ne(r3, null);
   7495   terminateO(r3);
   7496   s = toStringO(self);
   7497   ck_assert_str_eq(s, "[]");
   7498   free(s);
   7499   r = self->f->popInt32(self);
   7500   ck_assert(!r);
   7501   s = toStringO(self);
   7502   ck_assert_str_eq(s, "[]");
   7503   free(s);
   7504   terminateO(self);
   7505 
   7506 END_TEST
   7507 
   7508 
   7509 START_TEST(popUintSmallJsonT)
   7510 
   7511   uint64_t r;
   7512   smallJsont *self = allocSmallJson();
   7513   smallJsont *r2;
   7514   baset *r3;
   7515 
   7516   // add an element to check that the second element is poped
   7517   // at the end
   7518   r2 = self->f->pushBool(self, FALSE);
   7519   ck_assert_ptr_ne(r2, null);
   7520   // add second element
   7521   r2 = self->f->pushInt(self, 2);
   7522   ck_assert_ptr_ne(r2, null);
   7523   // pop
   7524   r = self->f->popUint(self);
   7525   ck_assert_int_eq(r, 2);
   7526   ck_assert_int_eq(lenO(self), 1);
   7527   char *s = toStringO(self);
   7528   ck_assert_str_eq(s, "[false]");
   7529   free(s);
   7530   // pop element of unexpected type
   7531   r = self->f->popUint(self);
   7532   ck_assert(!r);
   7533   ck_assert_int_eq(lenO(self), 1);
   7534   s = toStringO(self);
   7535   ck_assert_str_eq(s, "[false]");
   7536   free(s);
   7537   // empty array
   7538   r3 = self->f->pop(self);
   7539   ck_assert_ptr_ne(r3, null);
   7540   terminateO(r3);
   7541   s = toStringO(self);
   7542   ck_assert_str_eq(s, "[]");
   7543   free(s);
   7544   r = self->f->popUint(self);
   7545   ck_assert(!r);
   7546   s = toStringO(self);
   7547   ck_assert_str_eq(s, "[]");
   7548   free(s);
   7549   terminateO(self);
   7550 
   7551 END_TEST
   7552 
   7553 
   7554 START_TEST(popUint32SmallJsonT)
   7555 
   7556   uint32_t r;
   7557   smallJsont *self = allocSmallJson();
   7558   smallJsont *r2;
   7559   baset *r3;
   7560 
   7561   // add an element to check that the second element is poped
   7562   // at the end
   7563   r2 = self->f->pushBool(self, FALSE);
   7564   ck_assert_ptr_ne(r2, null);
   7565   // add second element
   7566   r2 = self->f->pushInt(self, 2);
   7567   ck_assert_ptr_ne(r2, null);
   7568   // pop
   7569   r = self->f->popUint32(self);
   7570   ck_assert_int_eq(r, 2);
   7571   ck_assert_int_eq(lenO(self), 1);
   7572   char *s = toStringO(self);
   7573   ck_assert_str_eq(s, "[false]");
   7574   free(s);
   7575   // pop element of unexpected type
   7576   r = self->f->popUint32(self);
   7577   ck_assert(!r);
   7578   ck_assert_int_eq(lenO(self), 1);
   7579   s = toStringO(self);
   7580   ck_assert_str_eq(s, "[false]");
   7581   free(s);
   7582   // empty array
   7583   r3 = self->f->pop(self);
   7584   ck_assert_ptr_ne(r3, null);
   7585   terminateO(r3);
   7586   s = toStringO(self);
   7587   ck_assert_str_eq(s, "[]");
   7588   free(s);
   7589   r = self->f->popUint32(self);
   7590   ck_assert(!r);
   7591   s = toStringO(self);
   7592   ck_assert_str_eq(s, "[]");
   7593   free(s);
   7594   terminateO(self);
   7595 
   7596 END_TEST
   7597 
   7598 
   7599 START_TEST(popSSmallJsonT)
   7600 
   7601   char* r;
   7602   smallJsont *self = allocSmallJson();
   7603   smallJsont *r2;
   7604   baset *r3;
   7605 
   7606   // add an element to check that the second element is poped
   7607   // at the end
   7608   r2 = self->f->pushInt(self, 1);
   7609   ck_assert_ptr_ne(r2, null);
   7610   // add second element
   7611   r2 = self->f->pushS(self, "bb");
   7612   ck_assert_ptr_ne(r2, null);
   7613   // pop
   7614   r = self->f->popS(self);
   7615   ck_assert_str_eq(r, "bb");
   7616   free(r);
   7617   ck_assert_int_eq(lenO(self), 1);
   7618   char *s = toStringO(self);
   7619   ck_assert_str_eq(s, "[1]");
   7620   free(s);
   7621   // pop element of unexpected type
   7622   r = self->f->popS(self);
   7623   ck_assert(!r);
   7624   ck_assert_int_eq(lenO(self), 1);
   7625   s = toStringO(self);
   7626   ck_assert_str_eq(s, "[1]");
   7627   free(s);
   7628   // empty array
   7629   r3 = self->f->pop(self);
   7630   ck_assert_ptr_ne(r3, null);
   7631   terminateO(r3);
   7632   s = toStringO(self);
   7633   ck_assert_str_eq(s, "[]");
   7634   free(s);
   7635   r = self->f->popS(self);
   7636   ck_assert(!r);
   7637   s = toStringO(self);
   7638   ck_assert_str_eq(s, "[]");
   7639   free(s);
   7640   terminateO(self);
   7641 
   7642 END_TEST
   7643 
   7644 
   7645 START_TEST(popDictSmallJsonT)
   7646 
   7647   smallDictt* r;
   7648   smallJsont *self = allocSmallJson();
   7649   smallJsont *r2;
   7650   baset *r3;
   7651 
   7652   // add an element to check that the second element is poped
   7653   // at the end
   7654   r2 = self->f->pushInt(self, 1);
   7655   ck_assert_ptr_ne(r2, null);
   7656   // add second element
   7657   createSmallDict(e);
   7658   r2 = self->f->pushDict(self, &e);
   7659   ck_assert_ptr_ne(r2, null);
   7660   // pop
   7661   r2 = self->f->pushUndefined(self);
   7662   ck_assert_ptr_ne(r2, null);
   7663   delElemIndexO(self,-1);
   7664   r = self->f->popDict(self);
   7665   ck_assert_ptr_ne(r, null);
   7666   char *s = toStringO(r);
   7667   terminateO(r);
   7668   ck_assert_str_eq(s, "{}");
   7669   free(s);
   7670   ck_assert_int_eq(lenO(self), 1);
   7671   s = toStringO(self);
   7672   ck_assert_str_eq(s, "[1]");
   7673   free(s);
   7674   // pop element of unexpected type
   7675   r = self->f->popDict(self);
   7676   ck_assert(!r);
   7677   ck_assert_int_eq(lenO(self), 1);
   7678   s = toStringO(self);
   7679   ck_assert_str_eq(s, "[1]");
   7680   free(s);
   7681   // empty array
   7682   r3 = self->f->pop(self);
   7683   ck_assert_ptr_ne(r3, null);
   7684   terminateO(r3);
   7685   s = toStringO(self);
   7686   ck_assert_str_eq(s, "[]");
   7687   free(s);
   7688   r = self->f->popDict(self);
   7689   ck_assert(!r);
   7690   s = toStringO(self);
   7691   ck_assert_str_eq(s, "[]");
   7692   free(s);
   7693   r2 = self->f->pushUndefined(self);
   7694   ck_assert_ptr_ne(r2, null);
   7695   delElemIndexO(self,-1);
   7696   r = self->f->popDict(self);
   7697   ck_assert_ptr_eq(r, null);
   7698   // non json array
   7699   freeO(self);
   7700   setTypeBoolO(self);
   7701   ck_assert_ptr_eq(self->f->popDict(self), NULL);
   7702   terminateO(self);
   7703 
   7704 END_TEST
   7705 
   7706 
   7707 START_TEST(popArraySmallJsonT)
   7708 
   7709   smallArrayt* r;
   7710   smallJsont *self = allocSmallJson();
   7711   smallJsont *r2;
   7712   baset *r3;
   7713 
   7714   // add an element to check that the second element is poped
   7715   // at the end
   7716   r2 = self->f->pushInt(self, 1);
   7717   ck_assert_ptr_ne(r2, null);
   7718   // add second element
   7719   createSmallArray(e);
   7720   r2 = self->f->pushArray(self, &e);
   7721   ck_assert_ptr_ne(r2, null);
   7722   // pop
   7723   r2 = self->f->pushUndefined(self);
   7724   ck_assert_ptr_ne(r2, null);
   7725   delElemIndexO(self,-1);
   7726   r = self->f->popArray(self);
   7727   ck_assert_ptr_ne(r, null);
   7728   char *s = toStringO(r);
   7729   terminateO(r);
   7730   ck_assert_str_eq(s, "[]");
   7731   free(s);
   7732   ck_assert_int_eq(lenO(self), 1);
   7733   s = toStringO(self);
   7734   ck_assert_str_eq(s, "[1]");
   7735   free(s);
   7736   // pop element of unexpected type
   7737   r = self->f->popArray(self);
   7738   ck_assert(!r);
   7739   ck_assert_int_eq(lenO(self), 1);
   7740   s = toStringO(self);
   7741   ck_assert_str_eq(s, "[1]");
   7742   free(s);
   7743   // empty array
   7744   r3 = self->f->pop(self);
   7745   ck_assert_ptr_ne(r3, null);
   7746   terminateO(r3);
   7747   s = toStringO(self);
   7748   ck_assert_str_eq(s, "[]");
   7749   free(s);
   7750   r = self->f->popArray(self);
   7751   ck_assert(!r);
   7752   s = toStringO(self);
   7753   ck_assert_str_eq(s, "[]");
   7754   free(s);
   7755   r2 = self->f->pushUndefined(self);
   7756   ck_assert_ptr_ne(r2, null);
   7757   delElemIndexO(self,-1);
   7758   r = self->f->popArray(self);
   7759   // non json array
   7760   freeO(self);
   7761   setTypeBoolO(self);
   7762   ck_assert_ptr_eq(self->f->popArray(self), NULL);
   7763   ck_assert_ptr_eq(r, null);
   7764   terminateO(self);
   7765 
   7766 END_TEST
   7767 
   7768 
   7769 START_TEST(popSmallBoolSmallJsonT)
   7770 
   7771   smallBoolt* r;
   7772   smallJsont *self = allocSmallJson();
   7773   smallJsont *r2;
   7774   baset *r3;
   7775 
   7776   // add an element to check that the second element is poped
   7777   // at the end
   7778   r2 = self->f->pushInt(self, 1);
   7779   ck_assert_ptr_ne(r2, null);
   7780   // add second element
   7781   createSmallBool(e);
   7782   r2 = self->f->pushSmallBool(self, &e);
   7783   ck_assert_ptr_ne(r2, null);
   7784   // pop
   7785   r2 = self->f->pushUndefined(self);
   7786   ck_assert_ptr_ne(r2, null);
   7787   delElemIndexO(self,-1);
   7788   r = self->f->popSmallBool(self);
   7789   ck_assert_ptr_ne(r, null);
   7790   char *s = toStringO(r);
   7791   terminateO(r);
   7792   ck_assert_str_eq(s, "false");
   7793   free(s);
   7794   ck_assert_int_eq(lenO(self), 1);
   7795   s = toStringO(self);
   7796   ck_assert_str_eq(s, "[1]");
   7797   free(s);
   7798   // pop element of unexpected type
   7799   r = self->f->popSmallBool(self);
   7800   ck_assert(!r);
   7801   ck_assert_int_eq(lenO(self), 1);
   7802   s = toStringO(self);
   7803   ck_assert_str_eq(s, "[1]");
   7804   free(s);
   7805   // empty array
   7806   r3 = self->f->pop(self);
   7807   ck_assert_ptr_ne(r3, null);
   7808   terminateO(r3);
   7809   s = toStringO(self);
   7810   ck_assert_str_eq(s, "[]");
   7811   free(s);
   7812   r = self->f->popSmallBool(self);
   7813   ck_assert(!r);
   7814   s = toStringO(self);
   7815   ck_assert_str_eq(s, "[]");
   7816   free(s);
   7817   r2 = self->f->pushUndefined(self);
   7818   ck_assert_ptr_ne(r2, null);
   7819   delElemIndexO(self,-1);
   7820   r = self->f->popSmallBool(self);
   7821   ck_assert_ptr_eq(r, null);
   7822   // non json array
   7823   freeO(self);
   7824   setTypeBoolO(self);
   7825   ck_assert_ptr_eq(self->f->popSmallBool(self), NULL);
   7826   terminateO(self);
   7827 
   7828 END_TEST
   7829 
   7830 
   7831 START_TEST(popSmallBytesSmallJsonT)
   7832 
   7833   smallBytest* r;
   7834   smallJsont *self = allocSmallJson();
   7835   smallJsont *r2;
   7836   baset *r3;
   7837 
   7838   // add an element to check that the second element is poped
   7839   // at the end
   7840   r2 = self->f->pushInt(self, 1);
   7841   ck_assert_ptr_ne(r2, null);
   7842   // add second element
   7843   createSmallBytes(e);
   7844   r2 = self->f->pushSmallBytes(self, &e);
   7845   ck_assert_ptr_ne(r2, null);
   7846   // pop
   7847   r2 = self->f->pushUndefined(self);
   7848   ck_assert_ptr_ne(r2, null);
   7849   delElemIndexO(self,-1);
   7850   r = self->f->popSmallBytes(self);
   7851   ck_assert_ptr_ne(r, null);
   7852   char *s = toStringO(r);
   7853   terminateO(r);
   7854   ck_assert_str_eq(s, "[]");
   7855   free(s);
   7856   ck_assert_int_eq(lenO(self), 1);
   7857   s = toStringO(self);
   7858   ck_assert_str_eq(s, "[1]");
   7859   free(s);
   7860   // pop element of unexpected type
   7861   r = self->f->popSmallBytes(self);
   7862   ck_assert(!r);
   7863   ck_assert_int_eq(lenO(self), 1);
   7864   s = toStringO(self);
   7865   ck_assert_str_eq(s, "[1]");
   7866   free(s);
   7867   // empty array
   7868   r3 = self->f->pop(self);
   7869   ck_assert_ptr_ne(r3, null);
   7870   terminateO(r3);
   7871   s = toStringO(self);
   7872   ck_assert_str_eq(s, "[]");
   7873   free(s);
   7874   r = self->f->popSmallBytes(self);
   7875   ck_assert(!r);
   7876   s = toStringO(self);
   7877   ck_assert_str_eq(s, "[]");
   7878   free(s);
   7879   r2 = self->f->pushUndefined(self);
   7880   ck_assert_ptr_ne(r2, null);
   7881   delElemIndexO(self,-1);
   7882   r = self->f->popSmallBytes(self);
   7883   ck_assert_ptr_eq(r, null);
   7884   // non json array
   7885   freeO(self);
   7886   setTypeBoolO(self);
   7887   ck_assert_ptr_eq(self->f->popSmallBytes(self), NULL);
   7888   terminateO(self);
   7889 
   7890 END_TEST
   7891 
   7892 
   7893 START_TEST(popSmallDoubleSmallJsonT)
   7894 
   7895   smallDoublet* r;
   7896   smallJsont *self = allocSmallJson();
   7897   smallJsont *r2;
   7898   baset *r3;
   7899 
   7900   // add an element to check that the second element is poped
   7901   // at the end
   7902   r2 = self->f->pushInt(self, 1);
   7903   ck_assert_ptr_ne(r2, null);
   7904   // add second element
   7905   createSmallDouble(e);
   7906   r2 = self->f->pushSmallDouble(self, &e);
   7907   ck_assert_ptr_ne(r2, null);
   7908   // pop
   7909   r2 = self->f->pushUndefined(self);
   7910   ck_assert_ptr_ne(r2, null);
   7911   delElemIndexO(self,-1);
   7912   r = self->f->popSmallDouble(self);
   7913   ck_assert_ptr_ne(r, null);
   7914   char *s = toStringO(r);
   7915   terminateO(r);
   7916   ck_assert_str_eq(s, "0.000000e+00");
   7917   free(s);
   7918   ck_assert_int_eq(lenO(self), 1);
   7919   s = toStringO(self);
   7920   ck_assert_str_eq(s, "[1]");
   7921   free(s);
   7922   // pop element of unexpected type
   7923   r = self->f->popSmallDouble(self);
   7924   ck_assert(!r);
   7925   ck_assert_int_eq(lenO(self), 1);
   7926   s = toStringO(self);
   7927   ck_assert_str_eq(s, "[1]");
   7928   free(s);
   7929   // empty array
   7930   r3 = self->f->pop(self);
   7931   ck_assert_ptr_ne(r3, null);
   7932   terminateO(r3);
   7933   s = toStringO(self);
   7934   ck_assert_str_eq(s, "[]");
   7935   free(s);
   7936   r = self->f->popSmallDouble(self);
   7937   ck_assert(!r);
   7938   s = toStringO(self);
   7939   ck_assert_str_eq(s, "[]");
   7940   free(s);
   7941   r2 = self->f->pushUndefined(self);
   7942   ck_assert_ptr_ne(r2, null);
   7943   delElemIndexO(self,-1);
   7944   r = self->f->popSmallDouble(self);
   7945   ck_assert_ptr_eq(r, null);
   7946   // non json array
   7947   freeO(self);
   7948   setTypeBoolO(self);
   7949   ck_assert_ptr_eq(self->f->popSmallDouble(self), NULL);
   7950   terminateO(self);
   7951 
   7952 END_TEST
   7953 
   7954 
   7955 START_TEST(popSmallIntSmallJsonT)
   7956 
   7957   smallIntt* r;
   7958   smallJsont *self = allocSmallJson();
   7959   smallJsont *r2;
   7960   baset *r3;
   7961 
   7962   // add an element to check that the second element is poped
   7963   // at the end
   7964   r2 = self->f->pushBool(self, TRUE);
   7965   ck_assert_ptr_ne(r2, null);
   7966   // add second element
   7967   createSmallInt(e);
   7968   r2 = self->f->pushSmallInt(self, &e);
   7969   ck_assert_ptr_ne(r2, null);
   7970   // pop
   7971   r2 = self->f->pushUndefined(self);
   7972   ck_assert_ptr_ne(r2, null);
   7973   delElemIndexO(self,-1);
   7974   r = self->f->popSmallInt(self);
   7975   ck_assert_ptr_ne(r, null);
   7976   char *s = toStringO(r);
   7977   terminateO(r);
   7978   ck_assert_str_eq(s, "0");
   7979   free(s);
   7980   ck_assert_int_eq(lenO(self), 1);
   7981   s = toStringO(self);
   7982   ck_assert_str_eq(s, "[true]");
   7983   free(s);
   7984   // pop element of unexpected type
   7985   r = self->f->popSmallInt(self);
   7986   ck_assert(!r);
   7987   ck_assert_int_eq(lenO(self), 1);
   7988   s = toStringO(self);
   7989   ck_assert_str_eq(s, "[true]");
   7990   free(s);
   7991   // empty array
   7992   r3 = self->f->pop(self);
   7993   ck_assert_ptr_ne(r3, null);
   7994   terminateO(r3);
   7995   s = toStringO(self);
   7996   ck_assert_str_eq(s, "[]");
   7997   free(s);
   7998   r = self->f->popSmallInt(self);
   7999   ck_assert(!r);
   8000   s = toStringO(self);
   8001   ck_assert_str_eq(s, "[]");
   8002   free(s);
   8003   r2 = self->f->pushUndefined(self);
   8004   ck_assert_ptr_ne(r2, null);
   8005   delElemIndexO(self,-1);
   8006   r = self->f->popSmallInt(self);
   8007   ck_assert_ptr_eq(r, null);
   8008   // non json array
   8009   freeO(self);
   8010   setTypeBoolO(self);
   8011   ck_assert_ptr_eq(self->f->popSmallInt(self), NULL);
   8012   terminateO(self);
   8013 
   8014 END_TEST
   8015 
   8016 
   8017 START_TEST(popSmallJsonSmallJsonT)
   8018 
   8019   smallJsont* r;
   8020   smallJsont *self = allocSmallJson();
   8021   smallJsont *r2;
   8022   baset *r3;
   8023 
   8024   // add an element to check that the second element is poped
   8025   // at the end
   8026   createSmallBytes(B);
   8027   r2 = self->f->pushSmallBytes(self, &B);
   8028   ck_assert_ptr_ne(r2, null);
   8029   // add second element
   8030   createSmallJson(e);
   8031   r2 = self->f->pushSmallJson(self, &e);
   8032   ck_assert_ptr_ne(r2, null);
   8033   // pop
   8034   r2 = self->f->pushUndefined(self);
   8035   ck_assert_ptr_ne(r2, null);
   8036   delElemIndexO(self,-1);
   8037   r = self->f->popSmallJson(self);
   8038   ck_assert_ptr_ne(r, null);
   8039   char *s = toStringO(r);
   8040   terminateO(r);
   8041   ck_assert_str_eq(s, "{}");
   8042   free(s);
   8043   ck_assert_int_eq(lenO(self), 1);
   8044   s = toStringO(self);
   8045   ck_assert_str_eq(s, "[[]]");
   8046   free(s);
   8047   // pop element of unexpected type
   8048   r = self->f->popSmallJson(self);
   8049   ck_assert(!r);
   8050   ck_assert_int_eq(lenO(self), 1);
   8051   s = toStringO(self);
   8052   ck_assert_str_eq(s, "[[]]");
   8053   free(s);
   8054   // empty array
   8055   r3 = self->f->pop(self);
   8056   ck_assert_ptr_ne(r3, null);
   8057   terminateO(r3);
   8058   s = toStringO(self);
   8059   ck_assert_str_eq(s, "[]");
   8060   free(s);
   8061   r = self->f->popSmallJson(self);
   8062   ck_assert(!r);
   8063   s = toStringO(self);
   8064   ck_assert_str_eq(s, "[]");
   8065   free(s);
   8066   r2 = self->f->pushUndefined(self);
   8067   ck_assert_ptr_ne(r2, null);
   8068   delElemIndexO(self,-1);
   8069   r = self->f->popSmallJson(self);
   8070   ck_assert_ptr_eq(r, null);
   8071   // non json array
   8072   freeO(self);
   8073   setTypeBoolO(self);
   8074   ck_assert_ptr_eq(self->f->popSmallJson(self), NULL);
   8075   terminateO(self);
   8076 
   8077 END_TEST
   8078 
   8079 
   8080 START_TEST(popSmallStringSmallJsonT)
   8081 
   8082   smallStringt* r;
   8083   smallJsont *self = allocSmallJson();
   8084   smallJsont *r2;
   8085   baset *r3;
   8086 
   8087   // add an element to check that the second element is poped
   8088   // at the end
   8089   r2 = self->f->pushInt(self, 1);
   8090   ck_assert_ptr_ne(r2, null);
   8091   // add second element
   8092   createSmallString(e);
   8093   r2 = self->f->pushSmallString(self, &e);
   8094   ck_assert_ptr_ne(r2, null);
   8095   // pop
   8096   r2 = self->f->pushUndefined(self);
   8097   ck_assert_ptr_ne(r2, null);
   8098   delElemIndexO(self,-1);
   8099   r = self->f->popSmallString(self);
   8100   ck_assert_ptr_ne(r, null);
   8101   char *s = toStringO(r);
   8102   terminateO(r);
   8103   ck_assert_str_eq(s, "");
   8104   free(s);
   8105   ck_assert_int_eq(lenO(self), 1);
   8106   s = toStringO(self);
   8107   ck_assert_str_eq(s, "[1]");
   8108   free(s);
   8109   // pop element of unexpected type
   8110   r = self->f->popSmallString(self);
   8111   ck_assert(!r);
   8112   ck_assert_int_eq(lenO(self), 1);
   8113   s = toStringO(self);
   8114   ck_assert_str_eq(s, "[1]");
   8115   free(s);
   8116   // empty array
   8117   r3 = self->f->pop(self);
   8118   ck_assert_ptr_ne(r3, null);
   8119   terminateO(r3);
   8120   s = toStringO(self);
   8121   ck_assert_str_eq(s, "[]");
   8122   free(s);
   8123   r = self->f->popSmallString(self);
   8124   ck_assert(!r);
   8125   s = toStringO(self);
   8126   ck_assert_str_eq(s, "[]");
   8127   free(s);
   8128   r2 = self->f->pushUndefined(self);
   8129   ck_assert_ptr_ne(r2, null);
   8130   delElemIndexO(self,-1);
   8131   r = self->f->popSmallString(self);
   8132   ck_assert_ptr_eq(r, null);
   8133   // non json array
   8134   freeO(self);
   8135   setTypeBoolO(self);
   8136   ck_assert_ptr_eq(self->f->popSmallString(self), NULL);
   8137   terminateO(self);
   8138 
   8139 END_TEST
   8140 
   8141 
   8142 START_TEST(popVoidSmallJsonT)
   8143 
   8144   void* r;
   8145   smallJsont *self = allocSmallJson();
   8146   smallJsont *r2;
   8147   baset *r3;
   8148 
   8149   // add an element to check that the second element is poped
   8150   // at the end
   8151   r2 = self->f->pushInt(self, 1);
   8152   ck_assert_ptr_ne(r2, null);
   8153   // add second element
   8154   createSmallContainer(e);
   8155   setValO(&e, &r);
   8156   r2 = self->f->pushSmallContainer(self, &e);
   8157   ck_assert_ptr_ne(r2, null);
   8158   // pop
   8159   r = self->f->popVoid(self);
   8160   ck_assert_ptr_eq(r, &r);
   8161   ck_assert_int_eq(lenO(self), 1);
   8162   char *s = toStringO(self);
   8163   ck_assert_str_eq(s, "[1]");
   8164   free(s);
   8165   // pop element of unexpected type
   8166   r = self->f->popVoid(self);
   8167   ck_assert(!r);
   8168   ck_assert_int_eq(lenO(self), 1);
   8169   s = toStringO(self);
   8170   ck_assert_str_eq(s, "[1]");
   8171   free(s);
   8172   // empty array
   8173   r3 = self->f->pop(self);
   8174   ck_assert_ptr_ne(r3, null);
   8175   terminateO(r3);
   8176   s = toStringO(self);
   8177   ck_assert_str_eq(s, "[]");
   8178   free(s);
   8179   r = self->f->popVoid(self);
   8180   ck_assert(!r);
   8181   s = toStringO(self);
   8182   ck_assert_str_eq(s, "[]");
   8183   free(s);
   8184   terminateO(self);
   8185 
   8186 END_TEST
   8187 
   8188 
   8189 START_TEST(popSmallContainerSmallJsonT)
   8190 
   8191   smallContainert* r;
   8192   smallJsont *self = allocSmallJson();
   8193   smallJsont *r2;
   8194   baset *r3;
   8195 
   8196   // add an element to check that the second element is poped
   8197   // at the end
   8198   r2 = self->f->pushInt(self, 1);
   8199   ck_assert_ptr_ne(r2, null);
   8200   // add second element
   8201   createSmallContainer(e);
   8202   r2 = self->f->pushSmallContainer(self, &e);
   8203   ck_assert_ptr_ne(r2, null);
   8204   // pop
   8205   r2 = self->f->pushUndefined(self);
   8206   ck_assert_ptr_ne(r2, null);
   8207   delElemIndexO(self,-1);
   8208   r = self->f->popSmallContainer(self);
   8209   ck_assert_ptr_ne(r, null);
   8210   char *s = toStringO(r);
   8211   terminateO(r);
   8212   ck_assert_str_eq(s, "<data smallContainer>");
   8213   free(s);
   8214   ck_assert_int_eq(lenO(self), 1);
   8215   s = toStringO(self);
   8216   ck_assert_str_eq(s, "[1]");
   8217   free(s);
   8218   // container with baset object
   8219   // push a base object of unknown type
   8220   smallIntt *o    = allocSmallInt(2);
   8221   o->type         = "newType";
   8222   r2 = self->f->pushNFree(self, (baset*)o);
   8223   ck_assert_ptr_ne(r2, null);
   8224   r = self->f->popSmallContainer(self);
   8225   ck_assert_ptr_eq(r, NULL);
   8226   ck_assert_int_eq(lenO(self), 2);
   8227   s = toStringO(self);
   8228   ck_assert_str_eq(s, "[1,\"<data container>\"]");
   8229   free(s);
   8230   r3 = self->f->pop(self);
   8231   ck_assert_ptr_ne(r3, null);
   8232   terminateO(r3);
   8233   // pop element of unexpected type
   8234   r = self->f->popSmallContainer(self);
   8235   ck_assert_ptr_eq(r, NULL);
   8236   ck_assert_int_eq(lenO(self), 1);
   8237   s = toStringO(self);
   8238   ck_assert_str_eq(s, "[1]");
   8239   free(s);
   8240   // empty array
   8241   r3 = self->f->pop(self);
   8242   ck_assert_ptr_ne(r3, null);
   8243   terminateO(r3);
   8244   s = toStringO(self);
   8245   ck_assert_str_eq(s, "[]");
   8246   free(s);
   8247   r = self->f->popSmallContainer(self);
   8248   ck_assert(!r);
   8249   s = toStringO(self);
   8250   ck_assert_str_eq(s, "[]");
   8251   free(s);
   8252   r2 = self->f->pushUndefined(self);
   8253   ck_assert_ptr_ne(r2, null);
   8254   delElemIndexO(self,-1);
   8255   r = self->f->popSmallContainer(self);
   8256   ck_assert_ptr_eq(r, null);
   8257   // non json array
   8258   freeO(self);
   8259   setTypeBoolO(self);
   8260   ck_assert_ptr_eq(self->f->popSmallContainer(self), NULL);
   8261   terminateO(self);
   8262 
   8263 END_TEST
   8264 
   8265 
   8266 START_TEST(popNumSmallJsonT)
   8267 
   8268   double r;
   8269   smallJsont *self = allocSmallJson();
   8270   smallJsont *r2;
   8271   baset *r3;
   8272 
   8273   // add an element to check that the second element is poped
   8274   // at the end
   8275   r2 = self->f->pushBool(self, TRUE);
   8276   ck_assert_ptr_ne(r2, null);
   8277   // add second element
   8278   r2 = self->f->pushInt(self, 2);
   8279   ck_assert_ptr_ne(r2, null);
   8280   r2 = self->f->pushDouble(self, 2.5);
   8281   ck_assert_ptr_ne(r2, null);
   8282   // pop
   8283   r2 = self->f->pushUndefined(self);
   8284   ck_assert_ptr_ne(r2, null);
   8285   delElemIndexO(self,-1);
   8286   r = self->f->popNum(self);
   8287   ck_assert(r==2.5);
   8288   ck_assert_int_eq(lenO(self), 2);
   8289   char *s = toStringO(self);
   8290   ck_assert_str_eq(s, "[true,2]");
   8291   free(s);
   8292   r = self->f->popNum(self);
   8293   ck_assert_int_eq(r, 2);
   8294   ck_assert_int_eq(lenO(self), 1);
   8295   s = toStringO(self);
   8296   ck_assert_str_eq(s, "[true]");
   8297   free(s);
   8298   // pop element of unexpected type
   8299   r = self->f->popNum(self);
   8300   ck_assert(!r);
   8301   ck_assert_int_eq(lenO(self), 1);
   8302   s = toStringO(self);
   8303   ck_assert_str_eq(s, "[true]");
   8304   free(s);
   8305   // empty array
   8306   r3 = self->f->pop(self);
   8307   ck_assert_ptr_ne(r3, null);
   8308   terminateO(r3);
   8309   s = toStringO(self);
   8310   ck_assert_str_eq(s, "[]");
   8311   free(s);
   8312   r = self->f->popNum(self);
   8313   ck_assert(!r);
   8314   s = toStringO(self);
   8315   ck_assert_str_eq(s, "[]");
   8316   free(s);
   8317   r2 = self->f->pushUndefined(self);
   8318   ck_assert_ptr_ne(r2, null);
   8319   delElemIndexO(self,-1);
   8320   r = self->f->popNum(self);
   8321   ck_assert(!r);
   8322   // non json array
   8323   freeO(self);
   8324   setTypeBoolO(self);
   8325   ck_assert(!self->f->popNum(self));
   8326   terminateO(self);
   8327 
   8328 END_TEST
   8329 
   8330 
   8331 START_TEST(prependSmallJsonT)
   8332 
   8333   smallJsont* r;
   8334   smallJsont *self = allocSmallJson();
   8335   baset *value = (baset*) allocG(2);
   8336 
   8337   // add an element to check that prepend adds the second element
   8338   // at the start
   8339   r = self->f->pushInt(self, 1);
   8340   ck_assert_ptr_ne(r, null);
   8341   r = self->f->prepend(self, value);
   8342   ck_assert_ptr_ne(r, null);
   8343   ck_assert_int_eq(lenO(r), 2);
   8344   finishO(value);
   8345   char *s = toStringO(r);
   8346   ck_assert_str_eq(s, "[2,1]");
   8347   free(s);
   8348   // null
   8349   r = self->f->prepend(self, null);
   8350   ck_assert_ptr_eq(r, null);
   8351   ck_assert_int_eq(lenO(self), 2);
   8352   s = toStringO(self);
   8353   ck_assert_str_eq(s, "[2,1]");
   8354   free(s);
   8355   // non json array
   8356   freeO(self);
   8357   setTypeBoolO(self);
   8358   value = (baset*) allocSmallInt(2);
   8359   ck_assert_ptr_eq(self->f->prepend(self, value), NULL);
   8360   terminateO(value);
   8361   terminateO(self);
   8362 
   8363 END_TEST
   8364 
   8365 
   8366 START_TEST(prependUndefinedSmallJsonT)
   8367 
   8368   smallJsont* r;
   8369   smallJsont *self = allocSmallJson();
   8370 
   8371   // add an element to check that push adds the second element
   8372   // at the end
   8373   r = self->f->pushInt(self, 1);
   8374   ck_assert_ptr_ne(r, null);
   8375   r = self->f->prependUndefined(self);
   8376   ck_assert_ptr_ne(r, null);
   8377   ck_assert_int_eq(lenO(r), 2);
   8378   char *s = toStringO(r);
   8379   ck_assert_str_eq(s, "[null,1]");
   8380   free(s);
   8381   // non json array
   8382   freeO(self);
   8383   setTypeBoolO(self);
   8384   ck_assert_ptr_eq(self->f->prependUndefined(self), NULL);
   8385   terminateO(self);
   8386 
   8387 END_TEST
   8388 
   8389 
   8390 START_TEST(prependBoolSmallJsonT)
   8391 
   8392   smallJsont* r;
   8393   smallJsont *self = allocSmallJson();
   8394 
   8395   // add an element to check that push adds the second element
   8396   // at the end
   8397   r = self->f->pushInt(self, 1);
   8398   ck_assert_ptr_ne(r, null);
   8399 
   8400   r = self->f->prependBool(self, TRUE);
   8401   ck_assert_ptr_ne(r, null);
   8402   ck_assert_int_eq(lenO(r), 2);
   8403   char *s = toStringO(r);
   8404   ck_assert_str_eq(s, "[true,1]");
   8405   free(s);
   8406   // non json array
   8407   freeO(self);
   8408   setTypeBoolO(self);
   8409   ck_assert_ptr_eq(self->f->prependBool(self, true), NULL);
   8410   terminateO(self);
   8411 
   8412 END_TEST
   8413 
   8414 
   8415 START_TEST(prependDoubleSmallJsonT)
   8416 
   8417   smallJsont* r;
   8418   smallJsont *self = allocSmallJson();
   8419 
   8420   // add an element to check that push adds the second element
   8421   // at the end
   8422   r = self->f->pushInt(self, 1);
   8423   ck_assert_ptr_ne(r, null);
   8424   r = self->f->prependDouble(self, 1.0);
   8425   ck_assert_ptr_ne(r, null);
   8426   ck_assert_int_eq(lenO(r), 2);
   8427   char *s = toStringO(r);
   8428   ck_assert_str_eq(s, "[1.000000e+00,1]");
   8429   free(s);
   8430   // non json array
   8431   freeO(self);
   8432   setTypeBoolO(self);
   8433   ck_assert_ptr_eq(self->f->prependDouble(self, 0), NULL);
   8434   terminateO(self);
   8435 
   8436 END_TEST
   8437 
   8438 
   8439 START_TEST(prependIntSmallJsonT)
   8440 
   8441   smallJsont* r;
   8442   smallJsont *self = allocSmallJson();
   8443 
   8444   // add an element to check that push adds the second element
   8445   // at the end
   8446   r = self->f->prependInt(self, 1);
   8447   ck_assert_ptr_ne(r, null);
   8448   r = self->f->prependInt(self, 1);
   8449   ck_assert_ptr_ne(r, null);
   8450   ck_assert_int_eq(lenO(r), 2);
   8451   char *s = toStringO(r);
   8452   ck_assert_str_eq(s, "[1,1]");
   8453   free(s);
   8454   // non json array
   8455   freeO(self);
   8456   setTypeBoolO(self);
   8457   ck_assert_ptr_eq(self->f->prependInt(self, 0), NULL);
   8458   terminateO(self);
   8459 
   8460 END_TEST
   8461 
   8462 
   8463 START_TEST(prependSSmallJsonT)
   8464 
   8465   smallJsont* r;
   8466   smallJsont *self = allocSmallJson();
   8467 
   8468   // add an element to check that push adds the second element
   8469   // at the end
   8470   r = self->f->pushInt(self, 1);
   8471   ck_assert_ptr_ne(r, null);
   8472   r = self->f->prependS(self, null);
   8473   ck_assert_ptr_eq(r, null);
   8474   ck_assert_int_eq(lenO(self), 1);
   8475   char *s = toStringO(self);
   8476   ck_assert_str_eq(s, "[1]");
   8477   free(s);
   8478   char *str = "poi";
   8479   r = self->f->prependS(self, str);
   8480   ck_assert_ptr_ne(r, null);
   8481   ck_assert_int_eq(lenO(self), 2);
   8482   s = toStringO(r);
   8483   ck_assert_str_eq(s, "[\"poi\",1]");
   8484   free(s);
   8485   // non json array
   8486   freeO(self);
   8487   setTypeBoolO(self);
   8488   ck_assert_ptr_eq(self->f->prependS(self, ""), NULL);
   8489   terminateO(self);
   8490   // json string
   8491   self = allocSmallJson();
   8492   setTopSO(self, "qwe");
   8493   r = prependSO(self, "!@#");
   8494   ck_assert_ptr_ne(r, null);
   8495   s = toStringO(r);
   8496   ck_assert_str_eq(s, "!@#qwe");
   8497   free(s);
   8498   // empty string
   8499   r = prependSO(self, "");
   8500   ck_assert_ptr_ne(r, null);
   8501   s = toStringO(r);
   8502   ck_assert_str_eq(s, "!@#qwe");
   8503   free(s);
   8504   // empty self
   8505   freeO(self);
   8506   setTypeStringO(self);
   8507   r = prependSO(self, "asd");
   8508   ck_assert_ptr_ne(r, null);
   8509   s = toStringO(r);
   8510   ck_assert_str_eq(s, "asd");
   8511   free(s);
   8512   // null parameter
   8513   r = prependSO(self, null);
   8514   ck_assert_ptr_eq(r, null);
   8515   terminateO(self);
   8516 
   8517 END_TEST
   8518 
   8519 
   8520 START_TEST(prependCharSmallJsonT)
   8521 
   8522   smallJsont* r;
   8523   smallJsont *self = allocSmallJson();
   8524 
   8525   // add an element to check that push adds the second element
   8526   // at the end
   8527   r = self->f->pushInt(self, 1);
   8528   ck_assert_ptr_ne(r, null);
   8529   r = self->f->prependChar(self, 'a');
   8530   ck_assert_ptr_ne(r, null);
   8531   ck_assert_int_eq(lenO(r), 2);
   8532   char *s = toStringO(r);
   8533   ck_assert_str_eq(s, "[\"a\",1]");
   8534   free(s);
   8535   // non json array
   8536   freeO(self);
   8537   setTypeBoolO(self);
   8538   ck_assert_ptr_eq(self->f->prependChar(self, 't'), NULL);
   8539   terminateO(self);
   8540 
   8541 END_TEST
   8542 
   8543 
   8544 START_TEST(prependDictSmallJsonT)
   8545 
   8546   smallJsont* r;
   8547   smallJsont *self = allocSmallJson();
   8548   smallDictt *dict  = allocG(rtSmallDictt);
   8549 
   8550   // add an element to check that push adds the second element
   8551   // at the end
   8552   r = self->f->pushInt(self, 1);
   8553   ck_assert_ptr_ne(r, null);
   8554   // push dict
   8555   r = self->f->prependDict(self, dict);
   8556   ck_assert_ptr_ne(r, null);
   8557   ck_assert_int_eq(lenO(r), 2);
   8558   finishO(dict);
   8559   ck_assert_ptr_ne(r, null);
   8560   char *s = toStringO(r);
   8561   ck_assert_str_eq(s, "[{},1]");
   8562   free(s);
   8563   // non smallDict object
   8564   dict = (smallDictt*) allocSmallInt(2);
   8565   r = self->f->prependDict(self, dict);
   8566   ck_assert_ptr_eq(r, null);
   8567   terminateO(dict);
   8568   // null
   8569   r = self->f->prependDict(self, null);
   8570   ck_assert_ptr_eq(r, null);
   8571   ck_assert_int_eq(lenO(self), 2);
   8572   s = toStringO(self);
   8573   ck_assert_str_eq(s, "[{},1]");
   8574   free(s);
   8575   // non json array
   8576   freeO(self);
   8577   setTypeBoolO(self);
   8578   smallDictt *value = allocSmallDict();
   8579   ck_assert_ptr_eq(self->f->prependDict(self, value), NULL);
   8580   terminateO(value);
   8581   terminateO(self);
   8582 
   8583 END_TEST
   8584 
   8585 
   8586 START_TEST(prependArraySmallJsonT)
   8587 
   8588   smallJsont* r;
   8589   smallJsont *self  = allocSmallJson();
   8590   smallArrayt *array = allocG(rtSmallArrayt);
   8591 
   8592   // add an element to check that push adds the second element
   8593   // at the end
   8594   r = self->f->pushInt(self, 1);
   8595   ck_assert_ptr_ne(r, null);
   8596   r = self->f->prependArray(self, array);
   8597   ck_assert_ptr_ne(r, null);
   8598   ck_assert_int_eq(lenO(r), 2);
   8599   finishO(array);
   8600   char *s = toStringO(r);
   8601   ck_assert_str_eq(s, "[[],1]");
   8602   free(s);
   8603   // non smallArray object
   8604   array = (smallArrayt*) allocSmallInt(2);
   8605   r = self->f->prependArray(self, array);
   8606   ck_assert_ptr_eq(r, null);
   8607   terminateO(array);
   8608   // null
   8609   r = self->f->prependArray(self, null);
   8610   ck_assert_ptr_eq(r, null);
   8611   ck_assert_int_eq(lenO(self), 2);
   8612   s = toStringO(self);
   8613   ck_assert_str_eq(s, "[[],1]");
   8614   free(s);
   8615   // non json array
   8616   freeO(self);
   8617   setTypeBoolO(self);
   8618   smallArrayt *value = allocSmallArray();
   8619   ck_assert_ptr_eq(self->f->prependArray(self, value), NULL);
   8620   terminateO(value);
   8621   terminateO(self);
   8622 
   8623 END_TEST
   8624 
   8625 
   8626 START_TEST(prependArraycSmallJsonT)
   8627 
   8628   smallJsont* r;
   8629   smallJsont *self = allocSmallJson();
   8630   char **array     = listCreateS("a","bb");
   8631 
   8632   // add an element to check that push adds the second element
   8633   // at the end
   8634   r = self->f->pushInt(self, 1);
   8635   ck_assert_ptr_ne(r, null);
   8636   r = self->f->prependArrayc(self, array);
   8637   ck_assert_ptr_ne(r, null);
   8638   ck_assert_int_eq(lenO(r), 2);
   8639   listFreeS(array);
   8640   char *s = toStringO(r);
   8641   ck_assert_str_eq(s, "[[\"a\",\"bb\"],1]");
   8642   free(s);
   8643   // null
   8644   r = self->f->prependArrayc(self, null);
   8645   ck_assert_ptr_eq(r, null);
   8646   ck_assert_int_eq(lenO(self), 2);
   8647   s = toStringO(self);
   8648   ck_assert_str_eq(s, "[[\"a\",\"bb\"],1]");
   8649   free(s);
   8650   // non json array
   8651   freeO(self);
   8652   setTypeBoolO(self);
   8653   char **value = listCreateS("a","bb");
   8654   ck_assert_ptr_eq(self->f->prependArrayc(self, value), NULL);
   8655   listFreeS(value);
   8656   terminateO(self);
   8657 
   8658 END_TEST
   8659 
   8660 
   8661 START_TEST(prependSmallBoolSmallJsonT)
   8662 
   8663   smallJsont* r;
   8664   smallJsont *self = allocSmallJson();
   8665   smallBoolt *value = allocG(TRUE);
   8666 
   8667   // add an element to check that push adds the second element
   8668   // at the end
   8669   r = self->f->pushInt(self, 1);
   8670   ck_assert_ptr_ne(r, null);
   8671   r = self->f->prependSmallBool(self, value);
   8672   ck_assert_ptr_ne(r, null);
   8673   ck_assert_int_eq(lenO(r), 2);
   8674   finishO(value);
   8675   char *s = toStringO(r);
   8676   ck_assert_str_eq(s, "[true,1]");
   8677   free(s);
   8678   // bool object with no data
   8679   createAllocateSmallBool(b);
   8680   r = self->f->prependSmallBool(self, b);
   8681   ck_assert_ptr_ne(r, null);
   8682   ck_assert_int_eq(lenO(r), 3);
   8683   finishO(b);
   8684   s = toStringO(r);
   8685   ck_assert_str_eq(s, "[false,true,1]");
   8686   free(s);
   8687   // non smallBool object
   8688   value = (smallBoolt*) allocSmallInt(2);
   8689   r = self->f->prependSmallBool(self, value);
   8690   ck_assert_ptr_eq(r, null);
   8691   terminateO(value);
   8692   // null
   8693   r = self->f->prependSmallBool(self, null);
   8694   ck_assert_ptr_eq(r, null);
   8695   ck_assert_int_eq(lenO(self), 3);
   8696   s = toStringO(self);
   8697   ck_assert_str_eq(s, "[false,true,1]");
   8698   free(s);
   8699   // non json array
   8700   freeO(self);
   8701   setTypeBoolO(self);
   8702   value = allocSmallBool(true);
   8703   ck_assert_ptr_eq(self->f->prependSmallBool(self, value), NULL);
   8704   terminateO(value);
   8705   terminateO(self);
   8706 
   8707 END_TEST
   8708 
   8709 
   8710 START_TEST(prependSmallBytesSmallJsonT)
   8711 
   8712   smallJsont* r;
   8713   smallJsont *self = allocSmallJson();
   8714   createAllocateSmallBytes(value);
   8715 
   8716   // add an element to check that push adds the second element
   8717   // at the end
   8718   r = self->f->pushInt(self, 1);
   8719   ck_assert_ptr_ne(r, null);
   8720   // the smallBytes container is empty
   8721   r = self->f->prependSmallBytes(self, value);
   8722   ck_assert_ptr_ne(r, null);
   8723   ck_assert_int_eq(lenO(r), 2);
   8724   char *s = toStringO(r);
   8725   ck_assert_str_eq(s, "[[],1]");
   8726   free(s);
   8727   //  reuse value
   8728   value->B = null;
   8729   char *buffer = "poi";
   8730   pushBufferO(value, buffer, strlen(buffer));
   8731   r = self->f->prependSmallBytes(self, value);
   8732   finishO(value);
   8733   ck_assert_ptr_ne(r, null);
   8734   ck_assert_int_eq(lenO(r), 3);
   8735   s = toStringO(r);
   8736   ck_assert_str_eq(s, "[[0x70,0x6f,0x69],[],1]");
   8737   free(s);
   8738   // non smallBytes object
   8739   value = (smallBytest*) allocSmallInt(2);
   8740   r = self->f->prependSmallBytes(self, value);
   8741   ck_assert_ptr_eq(r, null);
   8742   terminateO(value);
   8743   // null
   8744   r = self->f->prependSmallBytes(self, null);
   8745   ck_assert_ptr_eq(r, null);
   8746   ck_assert_int_eq(lenO(self), 3);
   8747   s = toStringO(self);
   8748   ck_assert_str_eq(s, "[[0x70,0x6f,0x69],[],1]");
   8749   free(s);
   8750   // non json array
   8751   freeO(self);
   8752   setTypeBoolO(self);
   8753   value = allocSmallBytes("", sizeof(""));
   8754   ck_assert_ptr_eq(self->f->prependSmallBytes(self, value), NULL);
   8755   terminateO(value);
   8756   terminateO(self);
   8757 
   8758 END_TEST
   8759 
   8760 
   8761 START_TEST(prependSmallDoubleSmallJsonT)
   8762 
   8763   smallJsont* r;
   8764   smallJsont *self   = allocSmallJson();
   8765   smallDoublet *value = allocG(1.0);
   8766 
   8767   // add an element to check that push adds the second element
   8768   // at the end
   8769   r = self->f->pushInt(self, 1);
   8770   ck_assert_ptr_ne(r, null);
   8771   r = self->f->prependSmallDouble(self, value);
   8772   ck_assert_ptr_ne(r, null);
   8773   ck_assert_int_eq(lenO(r), 2);
   8774   finishO(value);
   8775   char *s = toStringO(r);
   8776   ck_assert_str_eq(s, "[1.000000e+00,1]");
   8777   free(s);
   8778   // object with no data
   8779   createAllocateSmallDouble(b);
   8780   r = self->f->prependSmallDouble(self, b);
   8781   ck_assert_ptr_ne(r, null);
   8782   ck_assert_int_eq(lenO(r), 3);
   8783   finishO(b);
   8784   s = toStringO(r);
   8785   ck_assert_str_eq(s, "[0.000000e+00,1.000000e+00,1]");
   8786   free(s);
   8787   // non smallDouble object
   8788   value = (smallDoublet*) allocSmallInt(2);
   8789   r = self->f->prependSmallDouble(self, value);
   8790   ck_assert_ptr_eq(r, null);
   8791   terminateO(value);
   8792   // null
   8793   r = self->f->prependSmallDouble(self, null);
   8794   ck_assert_ptr_eq(r, null);
   8795   ck_assert_int_eq(lenO(self), 3);
   8796   s = toStringO(self);
   8797   ck_assert_str_eq(s, "[0.000000e+00,1.000000e+00,1]");
   8798   free(s);
   8799   // non json array
   8800   freeO(self);
   8801   setTypeBoolO(self);
   8802   value = allocSmallDouble(2);
   8803   ck_assert_ptr_eq(self->f->prependSmallDouble(self, value), NULL);
   8804   terminateO(value);
   8805   terminateO(self);
   8806 
   8807 END_TEST
   8808 
   8809 
   8810 START_TEST(prependSmallIntSmallJsonT)
   8811 
   8812   smallJsont* r;
   8813   smallJsont *self = allocSmallJson();
   8814   smallIntt *value  = allocG(1);
   8815 
   8816   // add an element to check that push adds the second element
   8817   // at the end
   8818   r = self->f->pushInt(self, 1);
   8819   ck_assert_ptr_ne(r, null);
   8820   r = self->f->prependSmallInt(self, value);
   8821   ck_assert_ptr_ne(r, null);
   8822   ck_assert_int_eq(lenO(r), 2);
   8823   finishO(value);
   8824   char *s = toStringO(r);
   8825   ck_assert_str_eq(s, "[1,1]");
   8826   free(s);
   8827   // bool object with no data
   8828   createAllocateSmallInt(b);
   8829   r = self->f->prependSmallInt(self, b);
   8830   ck_assert_ptr_ne(r, null);
   8831   ck_assert_int_eq(lenO(r), 3);
   8832   finishO(b);
   8833   s = toStringO(r);
   8834   ck_assert_str_eq(s, "[0,1,1]");
   8835   free(s);
   8836   // non smallInt object
   8837   value = (smallIntt*) allocSmallBool(true);
   8838   r = self->f->prependSmallInt(self, value);
   8839   ck_assert_ptr_eq(r, null);
   8840   terminateO(value);
   8841   // null
   8842   r = self->f->prependSmallInt(self, null);
   8843   ck_assert_ptr_eq(r, null);
   8844   ck_assert_int_eq(lenO(self), 3);
   8845   s = toStringO(self);
   8846   ck_assert_str_eq(s, "[0,1,1]");
   8847   free(s);
   8848   // non json array
   8849   freeO(self);
   8850   setTypeBoolO(self);
   8851   value = allocSmallInt(2);
   8852   ck_assert_ptr_eq(self->f->prependSmallInt(self, value), NULL);
   8853   terminateO(value);
   8854   terminateO(self);
   8855 
   8856 END_TEST
   8857 
   8858 
   8859 START_TEST(prependSmallJsonSmallJsonT)
   8860 
   8861   smallJsont* r;
   8862   smallJsont *self = allocSmallJson();
   8863   smallJsont *value = allocG(rtSmallJsont);
   8864 
   8865   // add an element to check that push adds the second element
   8866   // at the end
   8867   r = self->f->pushInt(self, 1);
   8868   ck_assert_ptr_ne(r, null);
   8869   // the smallJson container is empty
   8870   r = self->f->prependSmallJson(self, value);
   8871   ck_assert_ptr_ne(r, null);
   8872   ck_assert_int_eq(lenO(r), 2);
   8873   char *s = toStringO(r);
   8874   ck_assert_str_eq(s, "[{},1]");
   8875   free(s);
   8876   resetO(value);
   8877   parseO(value, "{}");
   8878   r = self->f->prependSmallJson(self, value);
   8879   finishO(value);
   8880   ck_assert_ptr_ne(r, null);
   8881   ck_assert_int_eq(lenO(r), 3);
   8882   s = toStringO(r);
   8883   ck_assert_str_eq(s, "[{},{},1]");
   8884   free(s);
   8885   // non smallJson object
   8886   value = (smallJsont*) allocSmallInt(2);
   8887   r = self->f->prependSmallJson(self, value);
   8888   ck_assert_ptr_eq(r, null);
   8889   terminateO(value);
   8890   // null
   8891   r = self->f->prependSmallJson(self, null);
   8892   ck_assert_ptr_eq(r, null);
   8893   ck_assert_int_eq(lenO(self), 3);
   8894   s = toStringO(self);
   8895   ck_assert_str_eq(s, "[{},{},1]");
   8896   free(s);
   8897   // non json array
   8898   freeO(self);
   8899   setTypeBoolO(self);
   8900   value = allocSmallJson();
   8901   ck_assert_ptr_eq(self->f->prependSmallJson(self, value), NULL);
   8902   terminateO(value);
   8903   terminateO(self);
   8904 
   8905 END_TEST
   8906 
   8907 
   8908 START_TEST(prependSmallStringSmallJsonT)
   8909 
   8910   smallJsont* r;
   8911   smallJsont *self    = allocSmallJson();
   8912   createAllocateSmallString(string);
   8913 
   8914   // add an element to check that push adds the second element
   8915   // at the end
   8916   r = self->f->pushInt(self, 1);
   8917   ck_assert_ptr_ne(r, null);
   8918   r = self->f->prependSmallString(self, string);
   8919   ck_assert_ptr_ne(r, null);
   8920   ck_assert_int_eq(lenO(r), 2);
   8921   finishO(string);
   8922   char *s = toStringO(r);
   8923   ck_assert_str_eq(s, "[\"\",1]");
   8924   free(s);
   8925   // non smallString object
   8926   string = (smallStringt*) allocSmallInt(2);
   8927   r = self->f->prependSmallString(self, string);
   8928   ck_assert_ptr_eq(r, null);
   8929   terminateO(string);
   8930   // null
   8931   r = self->f->prependSmallString(self, null);
   8932   ck_assert_ptr_eq(r, null);
   8933   ck_assert_int_eq(lenO(self), 2);
   8934   s = toStringO(self);
   8935   ck_assert_str_eq(s, "[\"\",1]");
   8936   free(s);
   8937   // non json array
   8938   freeO(self);
   8939   setTypeBoolO(self);
   8940   smallStringt *value = allocSmallString("");
   8941   ck_assert_ptr_eq(self->f->prependSmallString(self, value), NULL);
   8942   terminateO(value);
   8943   terminateO(self);
   8944   // json string
   8945   self   = allocSmallJson();
   8946   setTopSO(self, "qwe");
   8947   string = allocSmallString("!@#");
   8948   r = self->f->prependSmallString(self, string);
   8949   ck_assert_ptr_ne(r, null);
   8950   s = toStringO(r);
   8951   ck_assert_str_eq(s, "!@#qwe");
   8952   free(s);
   8953   // empty string
   8954   setValO(string, "");
   8955   r = self->f->prependSmallString(self, string);
   8956   ck_assert_ptr_ne(r, null);
   8957   s = toStringO(r);
   8958   ck_assert_str_eq(s, "!@#qwe");
   8959   free(s);
   8960   freeO(string);
   8961   r = self->f->prependSmallString(self, string);
   8962   ck_assert_ptr_ne(r, null);
   8963   s = toStringO(r);
   8964   ck_assert_str_eq(s, "!@#qwe");
   8965   free(s);
   8966   // empty self
   8967   freeO(self);
   8968   setTypeStringO(self);
   8969   setValO(string, "asd");
   8970   r = self->f->prependSmallString(self, string);
   8971   ck_assert_ptr_ne(r, null);
   8972   s = toStringO(r);
   8973   ck_assert_str_eq(s, "asd");
   8974   free(s);
   8975   terminateO(string);
   8976   // not smallString object
   8977   string = (smallStringt*) allocSmallInt(1);
   8978   r = self->f->prependSmallString(self, string);
   8979   ck_assert_ptr_eq(r, null);
   8980   terminateO(string);
   8981   // null parameter
   8982   r = self->f->prependSmallString(self, null);
   8983   ck_assert_ptr_eq(r, null);
   8984   terminateO(self);
   8985 
   8986 END_TEST
   8987 
   8988 
   8989 START_TEST(prependSmallContainerSmallJsonT)
   8990 
   8991   smallJsont* r;
   8992   smallJsont *self          = allocSmallJson();
   8993   createAllocateSmallContainer(container);
   8994 
   8995   // add an element to check that push adds the second element
   8996   // at the end
   8997   r = self->f->pushInt(self, 1);
   8998   ck_assert_ptr_ne(r, null);
   8999   r = self->f->prependSmallContainer(self, container);
   9000   ck_assert_ptr_ne(r, null);
   9001   ck_assert_int_eq(lenO(r), 2);
   9002   finishO(container);
   9003   char *s = toStringO(r);
   9004   ck_assert_str_eq(s, "[\"<data container>\",1]");
   9005   free(s);
   9006   // non smallContainer object
   9007   container = (smallContainert*) allocSmallInt(2);
   9008   r = self->f->prependSmallContainer(self, container);
   9009   ck_assert_ptr_eq(r, null);
   9010   terminateO(container);
   9011   // null
   9012   r = self->f->prependSmallContainer(self, null);
   9013   ck_assert_ptr_eq(r, null);
   9014   ck_assert_int_eq(lenO(self), 2);
   9015   s = toStringO(self);
   9016   ck_assert_str_eq(s, "[\"<data container>\",1]");
   9017   free(s);
   9018   // non json array
   9019   freeO(self);
   9020   setTypeBoolO(self);
   9021   smallContainert *value = allocSmallContainer(null);
   9022   ck_assert_ptr_eq(self->f->prependSmallContainer(self, value), NULL);
   9023   terminateO(value);
   9024   terminateO(self);
   9025 
   9026 END_TEST
   9027 
   9028 
   9029 START_TEST(prependNFreeSmallJsonT)
   9030 
   9031   smallJsont* r;
   9032   smallJsont *self = allocSmallJson();
   9033   baset *value = (baset*) allocG(2);
   9034 
   9035   // add an element to check that prepend adds the second element
   9036   // at the start
   9037   r = self->f->pushInt(self, 1);
   9038   ck_assert_ptr_ne(r, null);
   9039 
   9040   r = self->f->prependNFree(self, value);
   9041   ck_assert_ptr_ne(r, null);
   9042   ck_assert_int_eq(lenO(r), 2);
   9043   char *s = toStringO(r);
   9044   ck_assert_str_eq(s, "[2,1]");
   9045   free(s);
   9046   // null
   9047   r = self->f->prependNFree(self, null);
   9048   ck_assert_ptr_eq(r, null);
   9049   ck_assert_int_eq(lenO(self), 2);
   9050   s = toStringO(self);
   9051   ck_assert_str_eq(s, "[2,1]");
   9052   free(s);
   9053   terminateO(self);
   9054 
   9055 END_TEST
   9056 
   9057 
   9058 START_TEST(prependNFreeUndefinedSmallJsonT)
   9059 
   9060   smallJsont* r;
   9061   smallJsont *self = allocSmallJson();
   9062 
   9063   // add an element to check that push adds the second element
   9064   // at the end
   9065   r = self->f->pushInt(self, 1);
   9066   ck_assert_ptr_ne(r, null);
   9067 
   9068   createAllocateUndefined(value);
   9069   r = self->f->prependNFreeUndefined(self, value);
   9070   ck_assert_ptr_ne(r, null);
   9071   ck_assert_int_eq(lenO(r), 2);
   9072   char *s = toStringO(r);
   9073   ck_assert_str_eq(s, "[null,1]");
   9074   free(s);
   9075   terminateO(self);
   9076 
   9077 END_TEST
   9078 
   9079 
   9080 START_TEST(prependNFreeSSmallJsonT)
   9081 
   9082   smallJsont* r;
   9083   smallJsont *self = allocSmallJson();
   9084 
   9085   // add an element to check that push adds the second element
   9086   // at the end
   9087   r = self->f->pushInt(self, 1);
   9088   ck_assert_ptr_ne(r, null);
   9089 
   9090   r = self->f->prependNFreeS(self, null);
   9091   ck_assert_ptr_eq(r, null);
   9092   ck_assert_int_eq(lenO(self), 1);
   9093   char *s = toStringO(self);
   9094   ck_assert_str_eq(s, "[1]");
   9095   free(s);
   9096 
   9097   char *str = strdup("poi");
   9098   r = self->f->prependNFreeS(self, str);
   9099   ck_assert_ptr_ne(r, null);
   9100   ck_assert_int_eq(lenO(self), 2);
   9101   s = toStringO(r);
   9102   ck_assert_str_eq(s, "[\"poi\",1]");
   9103   free(s);
   9104 
   9105   terminateO(self);
   9106 
   9107 END_TEST
   9108 
   9109 
   9110 START_TEST(prependNFreeDictSmallJsonT)
   9111 
   9112   smallJsont* r;
   9113   smallJsont *self = allocSmallJson();
   9114   smallDictt *dict  = allocG(rtSmallDictt);
   9115 
   9116   // add an element to check that push adds the second element
   9117   // at the end
   9118   r = self->f->pushInt(self, 1);
   9119   ck_assert_ptr_ne(r, null);
   9120 
   9121   // push dict
   9122   r = self->f->prependNFreeDict(self, dict);
   9123   ck_assert_ptr_ne(r, null);
   9124   ck_assert_int_eq(lenO(r), 2);
   9125   ck_assert_ptr_ne(r, null);
   9126   char *s = toStringO(r);
   9127   ck_assert_str_eq(s, "[{},1]");
   9128   free(s);
   9129   // null
   9130   r = self->f->prependNFreeDict(self, null);
   9131   ck_assert_ptr_eq(r, null);
   9132   ck_assert_int_eq(lenO(self), 2);
   9133   s = toStringO(self);
   9134   ck_assert_str_eq(s, "[{},1]");
   9135   free(s);
   9136   terminateO(self);
   9137 
   9138 END_TEST
   9139 
   9140 
   9141 START_TEST(prependNFreeArraySmallJsonT)
   9142 
   9143   smallJsont* r;
   9144   smallJsont *self  = allocSmallJson();
   9145   smallArrayt *array = allocG(rtSmallArrayt);
   9146 
   9147   // add an element to check that push adds the second element
   9148   // at the end
   9149   r = self->f->pushInt(self, 1);
   9150   ck_assert_ptr_ne(r, null);
   9151 
   9152   r = self->f->prependNFreeArray(self, array);
   9153   ck_assert_ptr_ne(r, null);
   9154   ck_assert_int_eq(lenO(r), 2);
   9155   char *s = toStringO(r);
   9156   ck_assert_str_eq(s, "[[],1]");
   9157   free(s);
   9158   // null
   9159   r = self->f->prependNFreeArray(self, null);
   9160   ck_assert_ptr_eq(r, null);
   9161   ck_assert_int_eq(lenO(self), 2);
   9162   s = toStringO(self);
   9163   ck_assert_str_eq(s, "[[],1]");
   9164   free(s);
   9165   terminateO(self);
   9166 
   9167 END_TEST
   9168 
   9169 
   9170 START_TEST(prependNFreeArraycSmallJsonT)
   9171 
   9172   smallJsont* r;
   9173   smallJsont *self = allocSmallJson();
   9174   char **array      = listCreateS("a","bb");
   9175 
   9176   // add an element to check that push adds the second element
   9177   // at the end
   9178   r = self->f->pushInt(self, 1);
   9179   ck_assert_ptr_ne(r, null);
   9180 
   9181   r = self->f->prependNFreeArrayc(self, array);
   9182   ck_assert_ptr_ne(r, null);
   9183   ck_assert_int_eq(lenO(r), 2);
   9184   char *s = toStringO(r);
   9185   ck_assert_str_eq(s, "[[\"a\",\"bb\"],1]");
   9186   free(s);
   9187   // null
   9188   r = self->f->prependNFreeArrayc(self, null);
   9189   ck_assert_ptr_eq(r, null);
   9190   ck_assert_int_eq(lenO(self), 2);
   9191   s = toStringO(self);
   9192   ck_assert_str_eq(s, "[[\"a\",\"bb\"],1]");
   9193   free(s);
   9194   terminateO(self);
   9195 
   9196 END_TEST
   9197 
   9198 
   9199 START_TEST(prependNFreeSmallBoolSmallJsonT)
   9200 
   9201   smallJsont* r;
   9202   smallJsont *self = allocSmallJson();
   9203   smallBoolt *value = allocG(TRUE);
   9204 
   9205   // add an element to check that push adds the second element
   9206   // at the end
   9207   r = self->f->pushInt(self, 1);
   9208   ck_assert_ptr_ne(r, null);
   9209 
   9210   r = self->f->prependNFreeSmallBool(self, value);
   9211   ck_assert_ptr_ne(r, null);
   9212   ck_assert_int_eq(lenO(r), 2);
   9213   char *s = toStringO(r);
   9214   ck_assert_str_eq(s, "[true,1]");
   9215   free(s);
   9216   // bool object with no data
   9217   createAllocateSmallBool(b);
   9218   r = self->f->prependNFreeSmallBool(self, b);
   9219   ck_assert_ptr_ne(r, null);
   9220   ck_assert_int_eq(lenO(r), 3);
   9221   s = toStringO(r);
   9222   ck_assert_str_eq(s, "[false,true,1]");
   9223   free(s);
   9224   // null
   9225   r = self->f->prependNFreeSmallBool(self, null);
   9226   ck_assert_ptr_eq(r, null);
   9227   ck_assert_int_eq(lenO(self), 3);
   9228   s = toStringO(self);
   9229   ck_assert_str_eq(s, "[false,true,1]");
   9230   free(s);
   9231   terminateO(self);
   9232 
   9233 END_TEST
   9234 
   9235 
   9236 START_TEST(prependNFreeSmallBytesSmallJsonT)
   9237 
   9238   smallJsont* r;
   9239   smallJsont *self = allocSmallJson();
   9240   createAllocateSmallBytes(value);
   9241 
   9242   // add an element to check that push adds the second element
   9243   // at the end
   9244   r = self->f->pushInt(self, 1);
   9245   ck_assert_ptr_ne(r, null);
   9246 
   9247   // the smallBytes container is empty
   9248   r = self->f->prependNFreeSmallBytes(self, value);
   9249   ck_assert_ptr_ne(r, null);
   9250   ck_assert_int_eq(lenO(r), 2);
   9251   char *s = toStringO(r);
   9252   ck_assert_str_eq(s, "[[],1]");
   9253   free(s);
   9254 
   9255   char *buffer = "poi";
   9256   value        = allocSmallBytes(buffer, strlen(buffer));
   9257   r = self->f->prependNFreeSmallBytes(self, value);
   9258   ck_assert_ptr_ne(r, null);
   9259   ck_assert_int_eq(lenO(r), 3);
   9260   s = toStringO(r);
   9261   ck_assert_str_eq(s, "[[0x70,0x6f,0x69],[],1]");
   9262   free(s);
   9263   // null
   9264   r = self->f->prependNFreeSmallBytes(self, null);
   9265   ck_assert_ptr_eq(r, null);
   9266   ck_assert_int_eq(lenO(self), 3);
   9267   s = toStringO(self);
   9268   ck_assert_str_eq(s, "[[0x70,0x6f,0x69],[],1]");
   9269   free(s);
   9270   terminateO(self);
   9271 
   9272 END_TEST
   9273 
   9274 
   9275 START_TEST(prependNFreeSmallDoubleSmallJsonT)
   9276 
   9277   smallJsont* r;
   9278   smallJsont *self   = allocSmallJson();
   9279   smallDoublet *value = allocG(1.0);
   9280 
   9281   // add an element to check that push adds the second element
   9282   // at the end
   9283   r = self->f->pushInt(self, 1);
   9284   ck_assert_ptr_ne(r, null);
   9285 
   9286   r = self->f->prependNFreeSmallDouble(self, value);
   9287   ck_assert_ptr_ne(r, null);
   9288   ck_assert_int_eq(lenO(r), 2);
   9289   char *s = toStringO(r);
   9290   ck_assert_str_eq(s, "[1.000000e+00,1]");
   9291   free(s);
   9292   // object with no data
   9293   createAllocateSmallDouble(b);
   9294   r = self->f->prependNFreeSmallDouble(self, b);
   9295   ck_assert_ptr_ne(r, null);
   9296   ck_assert_int_eq(lenO(r), 3);
   9297   s = toStringO(r);
   9298   ck_assert_str_eq(s, "[0.000000e+00,1.000000e+00,1]");
   9299   free(s);
   9300   // null
   9301   r = self->f->prependNFreeSmallDouble(self, null);
   9302   ck_assert_ptr_eq(r, null);
   9303   ck_assert_int_eq(lenO(self), 3);
   9304   s = toStringO(self);
   9305   ck_assert_str_eq(s, "[0.000000e+00,1.000000e+00,1]");
   9306   free(s);
   9307   terminateO(self);
   9308 
   9309 END_TEST
   9310 
   9311 
   9312 START_TEST(prependNFreeSmallIntSmallJsonT)
   9313 
   9314   smallJsont* r;
   9315   smallJsont *self = allocSmallJson();
   9316   smallIntt *value  = allocG(1);
   9317 
   9318   // add an element to check that push adds the second element
   9319   // at the end
   9320   r = self->f->pushInt(self, 1);
   9321   ck_assert_ptr_ne(r, null);
   9322 
   9323   r = self->f->prependNFreeSmallInt(self, value);
   9324   ck_assert_ptr_ne(r, null);
   9325   ck_assert_int_eq(lenO(r), 2);
   9326   char *s = toStringO(r);
   9327   ck_assert_str_eq(s, "[1,1]");
   9328   free(s);
   9329   // bool object with no data
   9330   createAllocateSmallInt(b);
   9331   r = self->f->prependNFreeSmallInt(self, b);
   9332   ck_assert_ptr_ne(r, null);
   9333   ck_assert_int_eq(lenO(r), 3);
   9334   s = toStringO(r);
   9335   ck_assert_str_eq(s, "[0,1,1]");
   9336   free(s);
   9337   // null
   9338   r = self->f->prependNFreeSmallInt(self, null);
   9339   ck_assert_ptr_eq(r, null);
   9340   ck_assert_int_eq(lenO(self), 3);
   9341   s = toStringO(self);
   9342   ck_assert_str_eq(s, "[0,1,1]");
   9343   free(s);
   9344   terminateO(self);
   9345 
   9346 END_TEST
   9347 
   9348 
   9349 START_TEST(prependNFreeSmallJsonSmallJsonT)
   9350 
   9351   smallJsont* r;
   9352   smallJsont *self = allocSmallJson();
   9353   smallJsont *value = allocG(rtSmallJsont);
   9354 
   9355   // add an element to check that push adds the second element
   9356   // at the end
   9357   r = self->f->pushInt(self, 1);
   9358   ck_assert_ptr_ne(r, null);
   9359 
   9360   // the smallJson container is empty
   9361   r = self->f->prependNFreeSmallJson(self, value);
   9362   ck_assert_ptr_ne(r, null);
   9363   ck_assert_int_eq(lenO(r), 2);
   9364   char *s = toStringO(r);
   9365   ck_assert_str_eq(s, "[{},1]");
   9366   free(s);
   9367 
   9368   value = allocG(rtSmallJsont);
   9369   parseO(value, "{}");
   9370   r = self->f->prependNFreeSmallJson(self, value);
   9371   ck_assert_ptr_ne(r, null);
   9372   ck_assert_int_eq(lenO(r), 3);
   9373   s = toStringO(r);
   9374   ck_assert_str_eq(s, "[{},{},1]");
   9375   free(s);
   9376   // null
   9377   r = self->f->prependNFreeSmallJson(self, null);
   9378   ck_assert_ptr_eq(r, null);
   9379   ck_assert_int_eq(lenO(self), 3);
   9380   s = toStringO(self);
   9381   ck_assert_str_eq(s, "[{},{},1]");
   9382   free(s);
   9383   terminateO(self);
   9384 
   9385 END_TEST
   9386 
   9387 
   9388 START_TEST(prependNFreeSmallStringSmallJsonT)
   9389 
   9390   smallJsont* r;
   9391   smallJsont *self    = allocSmallJson();
   9392   createAllocateSmallString(string);
   9393 
   9394   // add an element to check that push adds the second element
   9395   // at the end
   9396   r = self->f->pushInt(self, 1);
   9397   ck_assert_ptr_ne(r, null);
   9398 
   9399   r = self->f->prependNFreeSmallString(self, string);
   9400   ck_assert_ptr_ne(r, null);
   9401   ck_assert_int_eq(lenO(r), 2);
   9402   char *s = toStringO(r);
   9403   ck_assert_str_eq(s, "[\"\",1]");
   9404   free(s);
   9405   // null
   9406   r = self->f->prependNFreeSmallString(self, null);
   9407   ck_assert_ptr_eq(r, null);
   9408   ck_assert_int_eq(lenO(self), 2);
   9409   s = toStringO(self);
   9410   ck_assert_str_eq(s, "[\"\",1]");
   9411   free(s);
   9412   terminateO(self);
   9413 
   9414 END_TEST
   9415 
   9416 
   9417 START_TEST(prependNFreeSmallContainerSmallJsonT)
   9418 
   9419   smallJsont* r;
   9420   smallJsont *self          = allocSmallJson();
   9421   createAllocateSmallContainer(container);
   9422 
   9423   // add an element to check that push adds the second element
   9424   // at the end
   9425   r = self->f->pushInt(self, 1);
   9426   ck_assert_ptr_ne(r, null);
   9427 
   9428   r = self->f->prependNFreeSmallContainer(self, container);
   9429   ck_assert_ptr_ne(r, null);
   9430   ck_assert_int_eq(lenO(r), 2);
   9431   char *s = toStringO(r);
   9432   ck_assert_str_eq(s, "[\"<data container>\",1]");
   9433   free(s);
   9434   // null
   9435   r = self->f->prependNFreeSmallContainer(self, null);
   9436   ck_assert_ptr_eq(r, null);
   9437   ck_assert_int_eq(lenO(self), 2);
   9438   s = toStringO(self);
   9439   ck_assert_str_eq(s, "[\"<data container>\",1]");
   9440   free(s);
   9441   terminateO(self);
   9442 
   9443 END_TEST
   9444 
   9445 
   9446 START_TEST(dequeueSmallJsonT)
   9447 
   9448   baset* r;
   9449   smallJsont *self = allocSmallJson();
   9450   smallJsont *r2;
   9451 
   9452   // add an element to check that the second element is dequeueed
   9453   // at the end
   9454   r2 = self->f->prependInt(self, 1);
   9455   ck_assert_ptr_ne(r2, null);
   9456   // prepend a base object of unknown type
   9457   smallIntt *o    = allocSmallInt(2);
   9458   o->type         = "newType";
   9459   r2 = self->f->prependNFree(self, (baset*)o);
   9460   ck_assert_ptr_ne(r2, null);
   9461   r2 = self->f->prependUndefined(self);
   9462   ck_assert_ptr_ne(r2, null);
   9463   r = self->f->dequeue(self);
   9464   ck_assert_ptr_ne(r, null);
   9465   ck_assert(isOUndefined(r));
   9466   terminateO(r);
   9467   r = self->f->dequeue(self);
   9468   ck_assert_ptr_ne(r, null);
   9469   ck_assert_str_eq(r->type, "newType");
   9470   char *s = toStringO(r);
   9471   terminateO(r);
   9472   ck_assert_str_eq(s, "2");
   9473   free(s);
   9474   ck_assert_int_eq(lenO(self), 1);
   9475   s = toStringO(self);
   9476   ck_assert_str_eq(s, "[1]");
   9477   free(s);
   9478   // empty array
   9479   r = self->f->dequeue(self);
   9480   ck_assert_ptr_ne(r, null);
   9481   terminateO(r);
   9482   s = toStringO(self);
   9483   ck_assert_str_eq(s, "[]");
   9484   free(s);
   9485   r = self->f->dequeue(self);
   9486   ck_assert_ptr_eq(r, null);
   9487   s = toStringO(self);
   9488   ck_assert_str_eq(s, "[]");
   9489   free(s);
   9490   r2 = self->f->pushUndefined(self);
   9491   ck_assert_ptr_ne(r2, null);
   9492   delElemIndexO(self,-1);
   9493   r = self->f->dequeue(self);
   9494   ck_assert_ptr_eq(r, null);
   9495   // non json array
   9496   freeO(self);
   9497   setTypeBoolO(self);
   9498   ck_assert_ptr_eq(self->f->dequeue(self), NULL);
   9499   terminateO(self);
   9500 
   9501 END_TEST
   9502 
   9503 
   9504 START_TEST(dequeueUndefinedSmallJsonT)
   9505 
   9506   undefinedt* r;
   9507   smallJsont *self = allocSmallJson();
   9508   smallJsont *r2;
   9509   baset *r3;
   9510 
   9511   // add an element to check that the second element is poped
   9512   // at the end
   9513   r2 = self->f->pushInt(self, 1);
   9514   ck_assert_ptr_ne(r2, null);
   9515   // add second element
   9516   r2 = self->f->prependUndefined(self);
   9517   ck_assert_ptr_ne(r2, null);
   9518   // pop
   9519   r = self->f->dequeueUndefined(self);
   9520   ck_assert_ptr_ne(r, null);
   9521   char *s = toStringO(r);
   9522   terminateO(r);
   9523   ck_assert_str_eq(s, "null");
   9524   free(s);
   9525   ck_assert_int_eq(lenO(self), 1);
   9526   s = toStringO(self);
   9527   ck_assert_str_eq(s, "[1]");
   9528   free(s);
   9529   // pop element of unexpected type
   9530   r = self->f->dequeueUndefined(self);
   9531   ck_assert_ptr_eq(r, null);
   9532   ck_assert_int_eq(lenO(self), 1);
   9533   s = toStringO(self);
   9534   ck_assert_str_eq(s, "[1]");
   9535   free(s);
   9536   // empty array
   9537   r3 = self->f->pop(self);
   9538   ck_assert_ptr_ne(r3, null);
   9539   terminateO(r3);
   9540   s = toStringO(self);
   9541   ck_assert_str_eq(s, "[]");
   9542   free(s);
   9543   r = self->f->dequeueUndefined(self);
   9544   ck_assert_ptr_eq(r, null);
   9545   s = toStringO(self);
   9546   ck_assert_str_eq(s, "[]");
   9547   free(s);
   9548   r2 = self->f->pushUndefined(self);
   9549   ck_assert_ptr_ne(r2, null);
   9550   delElemIndexO(self,-1);
   9551   r = self->f->dequeueUndefined(self);
   9552   ck_assert_ptr_eq(r, null);
   9553   // non json array
   9554   freeO(self);
   9555   setTypeBoolO(self);
   9556   ck_assert_ptr_eq(self->f->dequeueUndefined(self), NULL);
   9557   terminateO(self);
   9558 
   9559 END_TEST
   9560 
   9561 
   9562 START_TEST(dequeueBoolSmallJsonT)
   9563 
   9564   bool r;
   9565   smallJsont *self = allocSmallJson();
   9566   smallJsont *r2;
   9567   baset *r3;
   9568 
   9569   // add an element to check that the second element is poped
   9570   // at the end
   9571   r2 = self->f->pushInt(self, 1);
   9572   ck_assert_ptr_ne(r2, null);
   9573 
   9574   // add second element
   9575   r2 = self->f->prependBool(self, TRUE);
   9576   ck_assert_ptr_ne(r2, null);
   9577 
   9578   // pop
   9579   r = self->f->dequeueBool(self);
   9580   ck_assert(r);
   9581   ck_assert_int_eq(lenO(self), 1);
   9582   char *s = toStringO(self);
   9583   ck_assert_str_eq(s, "[1]");
   9584   free(s);
   9585 
   9586   // pop element of unexpected type
   9587   r = self->f->dequeueBool(self);
   9588   ck_assert(!r);
   9589   ck_assert_int_eq(lenO(self), 1);
   9590   s = toStringO(self);
   9591   ck_assert_str_eq(s, "[1]");
   9592   free(s);
   9593 
   9594   // empty array
   9595   r3 = self->f->pop(self);
   9596   ck_assert_ptr_ne(r3, null);
   9597   terminateO(r3);
   9598   s = toStringO(self);
   9599   ck_assert_str_eq(s, "[]");
   9600   free(s);
   9601   r = self->f->dequeueBool(self);
   9602   ck_assert(!r);
   9603   s = toStringO(self);
   9604   ck_assert_str_eq(s, "[]");
   9605   free(s);
   9606   terminateO(self);
   9607 
   9608 END_TEST
   9609 
   9610 
   9611 START_TEST(dequeueDoubleSmallJsonT)
   9612 
   9613   double r;
   9614   smallJsont *self = allocSmallJson();
   9615   smallJsont *r2;
   9616   baset *r3;
   9617 
   9618   // add an element to check that the second element is poped
   9619   // at the end
   9620   r2 = self->f->pushInt(self, 1);
   9621   ck_assert_ptr_ne(r2, null);
   9622 
   9623   // add second element
   9624   r2 = self->f->prependDouble(self, 2.0);
   9625   ck_assert_ptr_ne(r2, null);
   9626 
   9627   // pop
   9628   r = self->f->dequeueDouble(self);
   9629   ck_assert(r==2.0);
   9630   ck_assert_int_eq(lenO(self), 1);
   9631   char *s = toStringO(self);
   9632   ck_assert_str_eq(s, "[1]");
   9633   free(s);
   9634 
   9635   // pop element of unexpected type
   9636   r = self->f->dequeueDouble(self);
   9637   ck_assert(!r);
   9638   ck_assert_int_eq(lenO(self), 1);
   9639   s = toStringO(self);
   9640   ck_assert_str_eq(s, "[1]");
   9641   free(s);
   9642 
   9643   // empty array
   9644   r3 = self->f->pop(self);
   9645   ck_assert_ptr_ne(r3, null);
   9646   terminateO(r3);
   9647   s = toStringO(self);
   9648   ck_assert_str_eq(s, "[]");
   9649   free(s);
   9650   r = self->f->dequeueDouble(self);
   9651   ck_assert(!r);
   9652   s = toStringO(self);
   9653   ck_assert_str_eq(s, "[]");
   9654   free(s);
   9655   terminateO(self);
   9656 
   9657 END_TEST
   9658 
   9659 
   9660 START_TEST(dequeueIntSmallJsonT)
   9661 
   9662   int64_t r;
   9663   smallJsont *self = allocSmallJson();
   9664   smallJsont *r2;
   9665   baset *r3;
   9666 
   9667   // add an element to check that the second element is poped
   9668   // at the end
   9669   r2 = self->f->pushBool(self, FALSE);
   9670   ck_assert_ptr_ne(r2, null);
   9671 
   9672   // add second element
   9673   r2 = self->f->prependInt(self, 2);
   9674   ck_assert_ptr_ne(r2, null);
   9675 
   9676   // pop
   9677   r = self->f->dequeueInt(self);
   9678   ck_assert_int_eq(r, 2);
   9679   ck_assert_int_eq(lenO(self), 1);
   9680   char *s = toStringO(self);
   9681   ck_assert_str_eq(s, "[false]");
   9682   free(s);
   9683 
   9684   // pop element of unexpected type
   9685   r = self->f->dequeueInt(self);
   9686   ck_assert(!r);
   9687   ck_assert_int_eq(lenO(self), 1);
   9688   s = toStringO(self);
   9689   ck_assert_str_eq(s, "[false]");
   9690   free(s);
   9691 
   9692   // empty array
   9693   r3 = self->f->pop(self);
   9694   ck_assert_ptr_ne(r3, null);
   9695   terminateO(r3);
   9696   s = toStringO(self);
   9697   ck_assert_str_eq(s, "[]");
   9698   free(s);
   9699   r = self->f->dequeueInt(self);
   9700   ck_assert(!r);
   9701   s = toStringO(self);
   9702   ck_assert_str_eq(s, "[]");
   9703   free(s);
   9704   terminateO(self);
   9705 
   9706 END_TEST
   9707 
   9708 
   9709 START_TEST(dequeueInt32SmallJsonT)
   9710 
   9711   int32_t r;
   9712   smallJsont *self = allocSmallJson();
   9713   smallJsont *r2;
   9714   baset *r3;
   9715 
   9716   // add an element to check that the second element is poped
   9717   // at the end
   9718   r2 = self->f->pushBool(self, FALSE);
   9719   ck_assert_ptr_ne(r2, null);
   9720 
   9721   // add second element
   9722   r2 = self->f->prependInt(self, 2);
   9723   ck_assert_ptr_ne(r2, null);
   9724 
   9725   // pop
   9726   r = self->f->dequeueInt32(self);
   9727   ck_assert_int_eq(r, 2);
   9728   ck_assert_int_eq(lenO(self), 1);
   9729   char *s = toStringO(self);
   9730   ck_assert_str_eq(s, "[false]");
   9731   free(s);
   9732 
   9733   // pop element of unexpected type
   9734   r = self->f->dequeueInt32(self);
   9735   ck_assert(!r);
   9736   ck_assert_int_eq(lenO(self), 1);
   9737   s = toStringO(self);
   9738   ck_assert_str_eq(s, "[false]");
   9739   free(s);
   9740 
   9741   // empty array
   9742   r3 = self->f->pop(self);
   9743   ck_assert_ptr_ne(r3, null);
   9744   terminateO(r3);
   9745   s = toStringO(self);
   9746   ck_assert_str_eq(s, "[]");
   9747   free(s);
   9748   r = self->f->dequeueInt32(self);
   9749   ck_assert(!r);
   9750   s = toStringO(self);
   9751   ck_assert_str_eq(s, "[]");
   9752   free(s);
   9753   terminateO(self);
   9754 
   9755 END_TEST
   9756 
   9757 
   9758 START_TEST(dequeueUintSmallJsonT)
   9759 
   9760   uint64_t r;
   9761   smallJsont *self = allocSmallJson();
   9762   smallJsont *r2;
   9763   baset *r3;
   9764 
   9765   // add an element to check that the second element is poped
   9766   // at the end
   9767   r2 = self->f->pushBool(self, FALSE);
   9768   ck_assert_ptr_ne(r2, null);
   9769 
   9770   // add second element
   9771   r2 = self->f->prependInt(self, 2);
   9772   ck_assert_ptr_ne(r2, null);
   9773 
   9774   // pop
   9775   r = self->f->dequeueUint(self);
   9776   ck_assert_int_eq(r, 2);
   9777   ck_assert_int_eq(lenO(self), 1);
   9778   char *s = toStringO(self);
   9779   ck_assert_str_eq(s, "[false]");
   9780   free(s);
   9781 
   9782   // pop element of unexpected type
   9783   r = self->f->dequeueUint(self);
   9784   ck_assert(!r);
   9785   ck_assert_int_eq(lenO(self), 1);
   9786   s = toStringO(self);
   9787   ck_assert_str_eq(s, "[false]");
   9788   free(s);
   9789 
   9790   // empty array
   9791   r3 = self->f->pop(self);
   9792   ck_assert_ptr_ne(r3, null);
   9793   terminateO(r3);
   9794   s = toStringO(self);
   9795   ck_assert_str_eq(s, "[]");
   9796   free(s);
   9797   r = self->f->dequeueUint(self);
   9798   ck_assert(!r);
   9799   s = toStringO(self);
   9800   ck_assert_str_eq(s, "[]");
   9801   free(s);
   9802   terminateO(self);
   9803 
   9804 END_TEST
   9805 
   9806 
   9807 START_TEST(dequeueUint32SmallJsonT)
   9808 
   9809   uint32_t r;
   9810   smallJsont *self = allocSmallJson();
   9811   smallJsont *r2;
   9812   baset *r3;
   9813 
   9814   // add an element to check that the second element is poped
   9815   // at the end
   9816   r2 = self->f->pushBool(self, FALSE);
   9817   ck_assert_ptr_ne(r2, null);
   9818 
   9819   // add second element
   9820   r2 = self->f->prependInt(self, 2);
   9821   ck_assert_ptr_ne(r2, null);
   9822 
   9823   // pop
   9824   r = self->f->dequeueUint32(self);
   9825   ck_assert_int_eq(r, 2);
   9826   ck_assert_int_eq(lenO(self), 1);
   9827   char *s = toStringO(self);
   9828   ck_assert_str_eq(s, "[false]");
   9829   free(s);
   9830 
   9831   // pop element of unexpected type
   9832   r = self->f->dequeueUint32(self);
   9833   ck_assert(!r);
   9834   ck_assert_int_eq(lenO(self), 1);
   9835   s = toStringO(self);
   9836   ck_assert_str_eq(s, "[false]");
   9837   free(s);
   9838 
   9839   // empty array
   9840   r3 = self->f->pop(self);
   9841   ck_assert_ptr_ne(r3, null);
   9842   terminateO(r3);
   9843   s = toStringO(self);
   9844   ck_assert_str_eq(s, "[]");
   9845   free(s);
   9846   r = self->f->dequeueUint32(self);
   9847   ck_assert(!r);
   9848   s = toStringO(self);
   9849   ck_assert_str_eq(s, "[]");
   9850   free(s);
   9851   terminateO(self);
   9852 
   9853 END_TEST
   9854 
   9855 
   9856 START_TEST(dequeueSSmallJsonT)
   9857 
   9858   char* r;
   9859   smallJsont *self = allocSmallJson();
   9860   smallJsont *r2;
   9861   baset *r3;
   9862 
   9863   // add an element to check that the second element is poped
   9864   // at the end
   9865   r2 = self->f->pushInt(self, 1);
   9866   ck_assert_ptr_ne(r2, null);
   9867 
   9868   // add second element
   9869   r2 = self->f->prependS(self, "bb");
   9870   ck_assert_ptr_ne(r2, null);
   9871 
   9872   // pop
   9873   r = self->f->dequeueS(self);
   9874   ck_assert_str_eq(r, "bb");
   9875   free(r);
   9876   ck_assert_int_eq(lenO(self), 1);
   9877   char *s = toStringO(self);
   9878   ck_assert_str_eq(s, "[1]");
   9879   free(s);
   9880 
   9881   // pop element of unexpected type
   9882   r = self->f->dequeueS(self);
   9883   ck_assert(!r);
   9884   ck_assert_int_eq(lenO(self), 1);
   9885   s = toStringO(self);
   9886   ck_assert_str_eq(s, "[1]");
   9887   free(s);
   9888 
   9889   // empty array
   9890   r3 = self->f->pop(self);
   9891   ck_assert_ptr_ne(r3, null);
   9892   terminateO(r3);
   9893   s = toStringO(self);
   9894   ck_assert_str_eq(s, "[]");
   9895   free(s);
   9896   r = self->f->dequeueS(self);
   9897   ck_assert(!r);
   9898   s = toStringO(self);
   9899   ck_assert_str_eq(s, "[]");
   9900   free(s);
   9901   terminateO(self);
   9902 
   9903 END_TEST
   9904 
   9905 
   9906 START_TEST(dequeueDictSmallJsonT)
   9907 
   9908   smallDictt* r;
   9909   smallJsont *self = allocSmallJson();
   9910   smallJsont *r2;
   9911   baset *r3;
   9912 
   9913   // add an element to check that the second element is poped
   9914   // at the end
   9915   r2 = self->f->pushInt(self, 1);
   9916   ck_assert_ptr_ne(r2, null);
   9917   // add second element
   9918   createSmallDict(e);
   9919   r2 = self->f->prependDict(self, &e);
   9920   ck_assert_ptr_ne(r2, null);
   9921   // pop
   9922   r = self->f->dequeueDict(self);
   9923   ck_assert_ptr_ne(r, null);
   9924   char *s = toStringO(r);
   9925   terminateO(r);
   9926   ck_assert_str_eq(s, "{}");
   9927   free(s);
   9928   ck_assert_int_eq(lenO(self), 1);
   9929   s = toStringO(self);
   9930   ck_assert_str_eq(s, "[1]");
   9931   free(s);
   9932   // pop element of unexpected type
   9933   r = self->f->dequeueDict(self);
   9934   ck_assert(!r);
   9935   ck_assert_int_eq(lenO(self), 1);
   9936   s = toStringO(self);
   9937   ck_assert_str_eq(s, "[1]");
   9938   free(s);
   9939   // empty array
   9940   r3 = self->f->pop(self);
   9941   ck_assert_ptr_ne(r3, null);
   9942   terminateO(r3);
   9943   s = toStringO(self);
   9944   ck_assert_str_eq(s, "[]");
   9945   free(s);
   9946   r = self->f->dequeueDict(self);
   9947   ck_assert(!r);
   9948   s = toStringO(self);
   9949   ck_assert_str_eq(s, "[]");
   9950   free(s);
   9951   r2 = self->f->pushUndefined(self);
   9952   ck_assert_ptr_ne(r2, null);
   9953   delElemIndexO(self,-1);
   9954   r = self->f->dequeueDict(self);
   9955   ck_assert_ptr_eq(r, null);
   9956   // non json array
   9957   freeO(self);
   9958   setTypeBoolO(self);
   9959   ck_assert_ptr_eq(self->f->dequeueDict(self), NULL);
   9960   terminateO(self);
   9961 
   9962 END_TEST
   9963 
   9964 
   9965 START_TEST(dequeueArraySmallJsonT)
   9966 
   9967   smallArrayt* r;
   9968   smallJsont *self = allocSmallJson();
   9969   smallJsont *r2;
   9970   baset *r3;
   9971 
   9972   // add an element to check that the second element is poped
   9973   // at the end
   9974   r2 = self->f->pushInt(self, 1);
   9975   ck_assert_ptr_ne(r2, null);
   9976   // add second element
   9977   createSmallArray(e);
   9978   r2 = self->f->prependArray(self, &e);
   9979   ck_assert_ptr_ne(r2, null);
   9980   // pop
   9981   r = self->f->dequeueArray(self);
   9982   ck_assert_ptr_ne(r, null);
   9983   char *s = toStringO(r);
   9984   terminateO(r);
   9985   ck_assert_str_eq(s, "[]");
   9986   free(s);
   9987   ck_assert_int_eq(lenO(self), 1);
   9988   s = toStringO(self);
   9989   ck_assert_str_eq(s, "[1]");
   9990   free(s);
   9991   // pop element of unexpected type
   9992   r = self->f->dequeueArray(self);
   9993   ck_assert(!r);
   9994   ck_assert_int_eq(lenO(self), 1);
   9995   s = toStringO(self);
   9996   ck_assert_str_eq(s, "[1]");
   9997   free(s);
   9998   // empty array
   9999   r3 = self->f->pop(self);
  10000   ck_assert_ptr_ne(r3, null);
  10001   terminateO(r3);
  10002   s = toStringO(self);
  10003   ck_assert_str_eq(s, "[]");
  10004   free(s);
  10005   r = self->f->dequeueArray(self);
  10006   ck_assert(!r);
  10007   s = toStringO(self);
  10008   ck_assert_str_eq(s, "[]");
  10009   free(s);
  10010   r2 = self->f->pushUndefined(self);
  10011   ck_assert_ptr_ne(r2, null);
  10012   delElemIndexO(self,-1);
  10013   r = self->f->dequeueArray(self);
  10014   ck_assert_ptr_eq(r, null);
  10015   // non json array
  10016   freeO(self);
  10017   setTypeBoolO(self);
  10018   ck_assert_ptr_eq(self->f->dequeueArray(self), NULL);
  10019   terminateO(self);
  10020 
  10021 END_TEST
  10022 
  10023 
  10024 START_TEST(dequeueSmallBoolSmallJsonT)
  10025 
  10026   smallBoolt* r;
  10027   smallJsont *self = allocSmallJson();
  10028   smallJsont *r2;
  10029   baset *r3;
  10030 
  10031   // add an element to check that the second element is poped
  10032   // at the end
  10033   r2 = self->f->pushInt(self, 1);
  10034   ck_assert_ptr_ne(r2, null);
  10035   // add second element
  10036   createSmallBool(e);
  10037   r2 = self->f->prependSmallBool(self, &e);
  10038   ck_assert_ptr_ne(r2, null);
  10039   // pop
  10040   r = self->f->dequeueSmallBool(self);
  10041   ck_assert_ptr_ne(r, null);
  10042   char *s = toStringO(r);
  10043   terminateO(r);
  10044   ck_assert_str_eq(s, "false");
  10045   free(s);
  10046   ck_assert_int_eq(lenO(self), 1);
  10047   s = toStringO(self);
  10048   ck_assert_str_eq(s, "[1]");
  10049   free(s);
  10050   // pop element of unexpected type
  10051   r = self->f->dequeueSmallBool(self);
  10052   ck_assert(!r);
  10053   ck_assert_int_eq(lenO(self), 1);
  10054   s = toStringO(self);
  10055   ck_assert_str_eq(s, "[1]");
  10056   free(s);
  10057   // empty array
  10058   r3 = self->f->pop(self);
  10059   ck_assert_ptr_ne(r3, null);
  10060   terminateO(r3);
  10061   s = toStringO(self);
  10062   ck_assert_str_eq(s, "[]");
  10063   free(s);
  10064   r = self->f->dequeueSmallBool(self);
  10065   ck_assert(!r);
  10066   s = toStringO(self);
  10067   ck_assert_str_eq(s, "[]");
  10068   free(s);
  10069   r2 = self->f->pushUndefined(self);
  10070   ck_assert_ptr_ne(r2, null);
  10071   delElemIndexO(self,-1);
  10072   r = self->f->dequeueSmallBool(self);
  10073   ck_assert_ptr_eq(r, null);
  10074   // non json array
  10075   freeO(self);
  10076   setTypeBoolO(self);
  10077   ck_assert_ptr_eq(self->f->dequeueSmallBool(self), NULL);
  10078   terminateO(self);
  10079 
  10080 END_TEST
  10081 
  10082 
  10083 START_TEST(dequeueSmallBytesSmallJsonT)
  10084 
  10085   smallBytest* r;
  10086   smallJsont *self = allocSmallJson();
  10087   smallJsont *r2;
  10088   baset *r3;
  10089 
  10090   // add an element to check that the second element is poped
  10091   // at the end
  10092   r2 = self->f->pushInt(self, 1);
  10093   ck_assert_ptr_ne(r2, null);
  10094   // add second element
  10095   createSmallBytes(e);
  10096   r2 = self->f->prependSmallBytes(self, &e);
  10097   ck_assert_ptr_ne(r2, null);
  10098   // pop
  10099   r = self->f->dequeueSmallBytes(self);
  10100   ck_assert_ptr_ne(r, null);
  10101   char *s = toStringO(r);
  10102   terminateO(r);
  10103   ck_assert_str_eq(s, "[]");
  10104   free(s);
  10105   ck_assert_int_eq(lenO(self), 1);
  10106   s = toStringO(self);
  10107   ck_assert_str_eq(s, "[1]");
  10108   free(s);
  10109   // pop element of unexpected type
  10110   r = self->f->dequeueSmallBytes(self);
  10111   ck_assert(!r);
  10112   ck_assert_int_eq(lenO(self), 1);
  10113   s = toStringO(self);
  10114   ck_assert_str_eq(s, "[1]");
  10115   free(s);
  10116   // empty array
  10117   r3 = self->f->pop(self);
  10118   ck_assert_ptr_ne(r3, null);
  10119   terminateO(r3);
  10120   s = toStringO(self);
  10121   ck_assert_str_eq(s, "[]");
  10122   free(s);
  10123   r = self->f->dequeueSmallBytes(self);
  10124   ck_assert(!r);
  10125   s = toStringO(self);
  10126   ck_assert_str_eq(s, "[]");
  10127   free(s);
  10128   r2 = self->f->pushUndefined(self);
  10129   ck_assert_ptr_ne(r2, null);
  10130   delElemIndexO(self,-1);
  10131   r = self->f->dequeueSmallBytes(self);
  10132   ck_assert_ptr_eq(r, null);
  10133   // non json array
  10134   freeO(self);
  10135   setTypeBoolO(self);
  10136   ck_assert_ptr_eq(self->f->dequeueSmallBytes(self), NULL);
  10137   terminateO(self);
  10138 
  10139 END_TEST
  10140 
  10141 
  10142 START_TEST(dequeueSmallDoubleSmallJsonT)
  10143 
  10144   smallDoublet* r;
  10145   smallJsont *self = allocSmallJson();
  10146   smallJsont *r2;
  10147   baset *r3;
  10148 
  10149   // add an element to check that the second element is poped
  10150   // at the end
  10151   r2 = self->f->pushInt(self, 1);
  10152   ck_assert_ptr_ne(r2, null);
  10153   // add second element
  10154   createSmallDouble(e);
  10155   r2 = self->f->prependSmallDouble(self, &e);
  10156   ck_assert_ptr_ne(r2, null);
  10157   // pop
  10158   r = self->f->dequeueSmallDouble(self);
  10159   ck_assert_ptr_ne(r, null);
  10160   char *s = toStringO(r);
  10161   terminateO(r);
  10162   ck_assert_str_eq(s, "0.000000e+00");
  10163   free(s);
  10164   ck_assert_int_eq(lenO(self), 1);
  10165   s = toStringO(self);
  10166   ck_assert_str_eq(s, "[1]");
  10167   free(s);
  10168   // pop element of unexpected type
  10169   r = self->f->dequeueSmallDouble(self);
  10170   ck_assert(!r);
  10171   ck_assert_int_eq(lenO(self), 1);
  10172   s = toStringO(self);
  10173   ck_assert_str_eq(s, "[1]");
  10174   free(s);
  10175   // empty array
  10176   r3 = self->f->pop(self);
  10177   ck_assert_ptr_ne(r3, null);
  10178   terminateO(r3);
  10179   s = toStringO(self);
  10180   ck_assert_str_eq(s, "[]");
  10181   free(s);
  10182   r = self->f->dequeueSmallDouble(self);
  10183   ck_assert(!r);
  10184   s = toStringO(self);
  10185   ck_assert_str_eq(s, "[]");
  10186   free(s);
  10187   r2 = self->f->pushUndefined(self);
  10188   ck_assert_ptr_ne(r2, null);
  10189   delElemIndexO(self,-1);
  10190   r = self->f->dequeueSmallDouble(self);
  10191   ck_assert_ptr_eq(r, null);
  10192   // non json array
  10193   freeO(self);
  10194   setTypeBoolO(self);
  10195   ck_assert_ptr_eq(self->f->dequeueSmallDouble(self), NULL);
  10196   terminateO(self);
  10197 
  10198 END_TEST
  10199 
  10200 
  10201 START_TEST(dequeueSmallIntSmallJsonT)
  10202 
  10203   smallIntt* r;
  10204   smallJsont *self = allocSmallJson();
  10205   smallJsont *r2;
  10206   baset *r3;
  10207 
  10208   // add an element to check that the second element is poped
  10209   // at the end
  10210   r2 = self->f->pushBool(self, TRUE);
  10211   ck_assert_ptr_ne(r2, null);
  10212   // add second element
  10213   createSmallInt(e);
  10214   r2 = self->f->prependSmallInt(self, &e);
  10215   ck_assert_ptr_ne(r2, null);
  10216   // pop
  10217   r = self->f->dequeueSmallInt(self);
  10218   ck_assert_ptr_ne(r, null);
  10219   char *s = toStringO(r);
  10220   terminateO(r);
  10221   ck_assert_str_eq(s, "0");
  10222   free(s);
  10223   ck_assert_int_eq(lenO(self), 1);
  10224   s = toStringO(self);
  10225   ck_assert_str_eq(s, "[true]");
  10226   free(s);
  10227   // pop element of unexpected type
  10228   r = self->f->dequeueSmallInt(self);
  10229   ck_assert(!r);
  10230   ck_assert_int_eq(lenO(self), 1);
  10231   s = toStringO(self);
  10232   ck_assert_str_eq(s, "[true]");
  10233   free(s);
  10234   // empty array
  10235   r3 = self->f->pop(self);
  10236   ck_assert_ptr_ne(r3, null);
  10237   terminateO(r3);
  10238   s = toStringO(self);
  10239   ck_assert_str_eq(s, "[]");
  10240   free(s);
  10241   r = self->f->dequeueSmallInt(self);
  10242   ck_assert(!r);
  10243   s = toStringO(self);
  10244   ck_assert_str_eq(s, "[]");
  10245   free(s);
  10246   r2 = self->f->pushUndefined(self);
  10247   ck_assert_ptr_ne(r2, null);
  10248   delElemIndexO(self,-1);
  10249   r = self->f->dequeueSmallInt(self);
  10250   ck_assert_ptr_eq(r, null);
  10251   r2 = self->f->pushUndefined(self);
  10252   ck_assert_ptr_ne(r2, null);
  10253   delElemIndexO(self,-1);
  10254   r = self->f->dequeueSmallInt(self);
  10255   ck_assert_ptr_eq(r, null);
  10256   // non json array
  10257   freeO(self);
  10258   setTypeBoolO(self);
  10259   ck_assert_ptr_eq(self->f->dequeueSmallInt(self), NULL);
  10260   terminateO(self);
  10261 
  10262 END_TEST
  10263 
  10264 
  10265 START_TEST(dequeueSmallJsonSmallJsonT)
  10266 
  10267   smallJsont* r;
  10268   smallJsont *self = allocSmallJson();
  10269   smallJsont *r2;
  10270   baset *r3;
  10271 
  10272   // add an element to check that the second element is poped
  10273   // at the end
  10274   createSmallBytes(B);
  10275   r2 = self->f->pushSmallBytes(self, &B);
  10276   ck_assert_ptr_ne(r2, null);
  10277   // add second element
  10278   createSmallJson(e);
  10279   r2 = self->f->prependSmallJson(self, &e);
  10280   ck_assert_ptr_ne(r2, null);
  10281   // pop
  10282   r = self->f->dequeueSmallJson(self);
  10283   ck_assert_ptr_ne(r, null);
  10284   char *s = toStringO(r);
  10285   terminateO(r);
  10286   ck_assert_str_eq(s, "{}");
  10287   free(s);
  10288   ck_assert_int_eq(lenO(self), 1);
  10289   s = toStringO(self);
  10290   ck_assert_str_eq(s, "[[]]");
  10291   free(s);
  10292   // pop element of unexpected type
  10293   r = self->f->dequeueSmallJson(self);
  10294   ck_assert(!r);
  10295   ck_assert_int_eq(lenO(self), 1);
  10296   s = toStringO(self);
  10297   ck_assert_str_eq(s, "[[]]");
  10298   free(s);
  10299   // empty array
  10300   r3 = self->f->pop(self);
  10301   ck_assert_ptr_ne(r3, null);
  10302   terminateO(r3);
  10303   s = toStringO(self);
  10304   ck_assert_str_eq(s, "[]");
  10305   free(s);
  10306   r = self->f->dequeueSmallJson(self);
  10307   ck_assert(!r);
  10308   s = toStringO(self);
  10309   ck_assert_str_eq(s, "[]");
  10310   free(s);
  10311   r2 = self->f->pushUndefined(self);
  10312   ck_assert_ptr_ne(r2, null);
  10313   delElemIndexO(self,-1);
  10314   r = self->f->dequeueSmallJson(self);
  10315   ck_assert_ptr_eq(r, null);
  10316   // non json array
  10317   freeO(self);
  10318   setTypeBoolO(self);
  10319   ck_assert_ptr_eq(self->f->dequeueSmallJson(self), NULL);
  10320   terminateO(self);
  10321 
  10322 END_TEST
  10323 
  10324 
  10325 START_TEST(dequeueSmallStringSmallJsonT)
  10326 
  10327   smallStringt* r;
  10328   smallJsont *self = allocSmallJson();
  10329   smallJsont *r2;
  10330   baset *r3;
  10331 
  10332   // add an element to check that the second element is poped
  10333   // at the end
  10334   r2 = self->f->pushInt(self, 1);
  10335   ck_assert_ptr_ne(r2, null);
  10336   // add second element
  10337   createSmallString(e);
  10338   r2 = self->f->prependSmallString(self, &e);
  10339   ck_assert_ptr_ne(r2, null);
  10340   // pop
  10341   r = self->f->dequeueSmallString(self);
  10342   ck_assert_ptr_ne(r, null);
  10343   char *s = toStringO(r);
  10344   terminateO(r);
  10345   ck_assert_str_eq(s, "");
  10346   free(s);
  10347   ck_assert_int_eq(lenO(self), 1);
  10348   s = toStringO(self);
  10349   ck_assert_str_eq(s, "[1]");
  10350   free(s);
  10351   // pop element of unexpected type
  10352   r = self->f->dequeueSmallString(self);
  10353   ck_assert(!r);
  10354   ck_assert_int_eq(lenO(self), 1);
  10355   s = toStringO(self);
  10356   ck_assert_str_eq(s, "[1]");
  10357   free(s);
  10358   // empty array
  10359   r3 = self->f->pop(self);
  10360   ck_assert_ptr_ne(r3, null);
  10361   terminateO(r3);
  10362   s = toStringO(self);
  10363   ck_assert_str_eq(s, "[]");
  10364   free(s);
  10365   r = self->f->dequeueSmallString(self);
  10366   ck_assert(!r);
  10367   s = toStringO(self);
  10368   ck_assert_str_eq(s, "[]");
  10369   free(s);
  10370   r2 = self->f->pushUndefined(self);
  10371   ck_assert_ptr_ne(r2, null);
  10372   delElemIndexO(self,-1);
  10373   r = self->f->dequeueSmallString(self);
  10374   ck_assert_ptr_eq(r, null);
  10375   // non json array
  10376   freeO(self);
  10377   setTypeBoolO(self);
  10378   ck_assert_ptr_eq(self->f->dequeueSmallString(self), NULL);
  10379   terminateO(self);
  10380 
  10381 END_TEST
  10382 
  10383 
  10384 START_TEST(dequeueVoidSmallJsonT)
  10385 
  10386   void* r;
  10387   smallJsont *self = allocSmallJson();
  10388   smallJsont *r2;
  10389   baset *r3;
  10390 
  10391   // add an element to check that the second element is poped
  10392   // at the end
  10393   r2 = self->f->pushInt(self, 1);
  10394   ck_assert_ptr_ne(r2, null);
  10395 
  10396   // add second element
  10397   createSmallContainer(e);
  10398   setValO(&e, &r);
  10399   r2 = self->f->prependSmallContainer(self, &e);
  10400   ck_assert_ptr_ne(r2, null);
  10401 
  10402   // pop
  10403   r = self->f->dequeueVoid(self);
  10404   ck_assert_ptr_eq(r, &r);
  10405   ck_assert_int_eq(lenO(self), 1);
  10406   char *s = toStringO(self);
  10407   ck_assert_str_eq(s, "[1]");
  10408   free(s);
  10409 
  10410   // pop element of unexpected type
  10411   r = self->f->dequeueVoid(self);
  10412   ck_assert(!r);
  10413   ck_assert_int_eq(lenO(self), 1);
  10414   s = toStringO(self);
  10415   ck_assert_str_eq(s, "[1]");
  10416   free(s);
  10417 
  10418   // empty array
  10419   r3 = self->f->pop(self);
  10420   ck_assert_ptr_ne(r3, null);
  10421   terminateO(r3);
  10422   s = toStringO(self);
  10423   ck_assert_str_eq(s, "[]");
  10424   free(s);
  10425   r = self->f->dequeueVoid(self);
  10426   ck_assert(!r);
  10427   s = toStringO(self);
  10428   ck_assert_str_eq(s, "[]");
  10429   free(s);
  10430   terminateO(self);
  10431 
  10432 END_TEST
  10433 
  10434 
  10435 START_TEST(dequeueSmallContainerSmallJsonT)
  10436 
  10437   smallContainert* r;
  10438   smallJsont *self = allocSmallJson();
  10439   smallJsont *r2;
  10440   baset *r3;
  10441 
  10442   // add an element to check that the second element is poped
  10443   // at the end
  10444   r2 = self->f->pushInt(self, 1);
  10445   ck_assert_ptr_ne(r2, null);
  10446   // add second element
  10447   createSmallContainer(e);
  10448   r2 = self->f->prependSmallContainer(self, &e);
  10449   ck_assert_ptr_ne(r2, null);
  10450   // pop
  10451   r = self->f->dequeueSmallContainer(self);
  10452   ck_assert_ptr_ne(r, null);
  10453   char *s = toStringO(r);
  10454   terminateO(r);
  10455   ck_assert_str_eq(s, "<data smallContainer>");
  10456   free(s);
  10457   ck_assert_int_eq(lenO(self), 1);
  10458   s = toStringO(self);
  10459   ck_assert_str_eq(s, "[1]");
  10460   free(s);
  10461   // container with baset object
  10462   // push a base object of unknown type
  10463   smallIntt *o    = allocSmallInt(2);
  10464   o->type         = "newType";
  10465   r2 = self->f->prependNFree(self, (baset*)o);
  10466   ck_assert_ptr_ne(r2, null);
  10467   r = self->f->dequeueSmallContainer(self);
  10468   ck_assert_ptr_eq(r, NULL);
  10469   ck_assert_int_eq(lenO(self), 2);
  10470   s = toStringO(self);
  10471   ck_assert_str_eq(s, "[\"<data container>\",1]");
  10472   free(s);
  10473   r3 = self->f->dequeue(self);
  10474   ck_assert_ptr_ne(r3, null);
  10475   terminateO(r3);
  10476   // pop element of unexpected type
  10477   r = self->f->dequeueSmallContainer(self);
  10478   ck_assert_ptr_eq(r, NULL);
  10479   ck_assert_int_eq(lenO(self), 1);
  10480   s = toStringO(self);
  10481   ck_assert_str_eq(s, "[1]");
  10482   free(s);
  10483   // empty array
  10484   r3 = self->f->pop(self);
  10485   ck_assert_ptr_ne(r3, null);
  10486   terminateO(r3);
  10487   s = toStringO(self);
  10488   ck_assert_str_eq(s, "[]");
  10489   free(s);
  10490   r = self->f->dequeueSmallContainer(self);
  10491   ck_assert(!r);
  10492   s = toStringO(self);
  10493   ck_assert_str_eq(s, "[]");
  10494   free(s);
  10495   r2 = self->f->pushUndefined(self);
  10496   ck_assert_ptr_ne(r2, null);
  10497   delElemIndexO(self,-1);
  10498   r = self->f->dequeueSmallContainer(self);
  10499   ck_assert_ptr_eq(r, null);
  10500   // non json array
  10501   freeO(self);
  10502   setTypeBoolO(self);
  10503   ck_assert_ptr_eq(self->f->dequeueSmallContainer(self), NULL);
  10504   terminateO(self);
  10505 
  10506 END_TEST
  10507 
  10508 
  10509 START_TEST(dequeueNumSmallJsonT)
  10510 
  10511   double r;
  10512   smallJsont *self = allocSmallJson();
  10513   smallJsont *r2;
  10514   baset *r3;
  10515 
  10516   // add an element to check that the second element is poped
  10517   // at the end
  10518   r2 = self->f->pushBool(self, TRUE);
  10519   ck_assert_ptr_ne(r2, null);
  10520   // add second element
  10521   r2 = self->f->prependInt(self, 2);
  10522   ck_assert_ptr_ne(r2, null);
  10523   r2 = self->f->prependDouble(self, 2.5);
  10524   ck_assert_ptr_ne(r2, null);
  10525   // pop
  10526   r = self->f->dequeueNum(self);
  10527   ck_assert(r==2.5);
  10528   ck_assert_int_eq(lenO(self), 2);
  10529   char *s = toStringO(self);
  10530   ck_assert_str_eq(s, "[2,true]");
  10531   free(s);
  10532   r = self->f->dequeueNum(self);
  10533   ck_assert_int_eq(r, 2);
  10534   ck_assert_int_eq(lenO(self), 1);
  10535   s = toStringO(self);
  10536   ck_assert_str_eq(s, "[true]");
  10537   free(s);
  10538   // pop element of unexpected type
  10539   r = self->f->dequeueNum(self);
  10540   ck_assert(!r);
  10541   ck_assert_int_eq(lenO(self), 1);
  10542   s = toStringO(self);
  10543   ck_assert_str_eq(s, "[true]");
  10544   free(s);
  10545   // empty array
  10546   r3 = self->f->pop(self);
  10547   ck_assert_ptr_ne(r3, null);
  10548   terminateO(r3);
  10549   s = toStringO(self);
  10550   ck_assert_str_eq(s, "[]");
  10551   free(s);
  10552   r = self->f->dequeueNum(self);
  10553   ck_assert(!r);
  10554   s = toStringO(self);
  10555   ck_assert_str_eq(s, "[]");
  10556   free(s);
  10557   r2 = self->f->pushUndefined(self);
  10558   ck_assert_ptr_ne(r2, null);
  10559   delElemIndexO(self,-1);
  10560   r = self->f->dequeueNum(self);
  10561   ck_assert(!r);
  10562   // non json array
  10563   freeO(self);
  10564   setTypeBoolO(self);
  10565   ck_assert(!self->f->dequeueNum(self));
  10566   terminateO(self);
  10567 
  10568 END_TEST
  10569 
  10570 
  10571 START_TEST(reverseSmallJsonT)
  10572 
  10573   smallJsont* r;
  10574   smallJsont *self = allocSmallJson();
  10575   setTypeArrayO(self);
  10576 
  10577   // empty array
  10578   r = reverseO(self);
  10579   ck_assert_ptr_ne(r, NULL);
  10580   char *s = toStringO(r);
  10581   ck_assert_str_eq(s, "[]");
  10582   free(s);
  10583   // 1 element array
  10584   self->f->pushInt(self,1);
  10585   r = reverseO(self);
  10586   ck_assert_ptr_ne(r, NULL);
  10587   s = toStringO(r);
  10588   ck_assert_str_eq(s, "[1]");
  10589   free(s);
  10590   // 2 elements array
  10591   self->f->pushInt(self,2);
  10592   r = reverseO(self);
  10593   ck_assert_ptr_ne(r, NULL);
  10594   s = toStringO(r);
  10595   ck_assert_str_eq(s, "[2,1]");
  10596   free(s);
  10597   // non json array
  10598   freeO(self);
  10599   setTypeBoolO(self);
  10600   ck_assert_ptr_eq(reverseO(self), NULL);
  10601   terminateO(self);
  10602 
  10603 END_TEST
  10604 
  10605 
  10606 START_TEST(catSmallJsonT)
  10607 
  10608   smallJsont* r;
  10609   smallJsont *self = allocSmallJson();
  10610 
  10611   // cat arrays
  10612   self->f->pushInt(self,1);
  10613   createAllocateSmallArray(a);
  10614   createAllocateSmallArray(a2);
  10615   a2->f->pushInt(a2,2);
  10616   r = catO(self, a, a2);
  10617   ck_assert_ptr_ne(r, null);
  10618   char *s = toStringO(r);
  10619   ck_assert_str_eq(s, "[1,2]");
  10620   free(s);
  10621   smashManyO(a,a2);
  10622   emptyO(self);
  10623   // null parameter
  10624   r = catO(self, null);
  10625   ck_assert_ptr_ne(r, null);
  10626   s = toStringO(r);
  10627   ck_assert_str_eq(s, "[]");
  10628   free(s);
  10629   terminateO(self);
  10630   // json string
  10631   self = allocSmallJson();
  10632   setTopSO(self, "qwe");
  10633   smallStringt *s1 = allocSmallString("123");
  10634   smallStringt *s2 = allocSmallString("456");
  10635   r = catO(self, s1, s2);
  10636   ck_assert_ptr_ne(r, null);
  10637   s = toStringO(r);
  10638   ck_assert_str_eq(s, "qwe123456");
  10639   free(s);
  10640   // non smallString object
  10641   terminateO(s2);
  10642   s2 = (smallStringt*) allocSmallInt(1);
  10643   r = catO(self, s1, s2);
  10644   ck_assert_ptr_eq(r, null);
  10645   s = toStringO(self);
  10646   ck_assert_str_eq(s, "qwe123456");
  10647   free(s);
  10648   // non json array
  10649   freeO(self);
  10650   setTypeBoolO(self);
  10651   ck_assert_ptr_eq(catO(self, s1), NULL);
  10652   terminateO(s1);
  10653   terminateO(s2);
  10654   terminateO(self);
  10655 
  10656 END_TEST
  10657 
  10658 
  10659 START_TEST(mergeDictSmallJsonT)
  10660 
  10661   smallJsont* r;
  10662   smallJsont *self      = allocG(rtSmallJsont);
  10663   smallDictt *smallDict = allocSmallDict();
  10664 
  10665   r = mergeDictO(self, smallDict);
  10666   ck_assert_ptr_ne(r, null);
  10667   smallDict->f->setInt(smallDict, "a", 1);
  10668   r = mergeDictO(self, smallDict);
  10669   ck_assert_ptr_ne(r, null);
  10670   smashO(smallDict);
  10671   char *s = toStringO(r);
  10672   ck_assert_str_eq(s, "{\"a\":1}");
  10673   free(s);
  10674   // same sObject in json and smallDict
  10675   smallDict = allocSmallDict();
  10676   setsoO(smallDict, (sDictt*) getsoO(self));
  10677   r = mergeDictO(self, smallDict);
  10678   ck_assert_ptr_eq(r, null);
  10679   // non json array
  10680   freeO(self);
  10681   setTypeBoolO(self);
  10682   ck_assert_ptr_eq(mergeDictO(self, smallDict), NULL);
  10683   finishO(smallDict);
  10684   terminateO(self);
  10685 
  10686 END_TEST
  10687 
  10688 
  10689 START_TEST(mergeDictNSmashSmallJsonT)
  10690 
  10691   smallJsont* r;
  10692   smallJsont *self = allocSmallJson();
  10693   smallDictt *value = allocSmallDict();
  10694 
  10695   self->f->setS(self, "1", "2");
  10696   self->f->setS(self, "3", "4");
  10697   value->f->setS(value, "3", "#");
  10698   value->f->setInt(value, "4", 0);
  10699   r = self->f->mergeDictNSmash(self, value);
  10700   ck_assert_ptr_ne(r, null);
  10701   char *s = toStringO(r);
  10702   ck_assert_str_eq(s, "{\"1\":\"2\",\"3\":\"#\",\"4\":0}");
  10703   free(s);
  10704   // empty dict
  10705   value = allocSmallDict();
  10706   r = self->f->mergeDictNSmash(self, value);
  10707   ck_assert_ptr_eq(r, self);
  10708   // non smallDict object
  10709   createAllocateSmallInt(i);
  10710   r = self->f->mergeDictNSmash(self, (smallDictt*)i);
  10711   ck_assert_ptr_eq(r, null);
  10712   terminateO(i);
  10713   // null
  10714   r = self->f->mergeDictNSmash(self, null);
  10715   ck_assert_ptr_eq(r, null);
  10716   terminateO(self);
  10717 
  10718 END_TEST
  10719 
  10720 
  10721 START_TEST(mergeSmallJsonT)
  10722 
  10723   smallJsont* r;
  10724   smallJsont *self = allocSmallJson();
  10725   createAllocateSmallJson(json);
  10726 
  10727   // add an element to check that the second array is appended
  10728   // at the end
  10729   r = self->f->pushInt(self, 1);
  10730   ck_assert_ptr_ne(r, null);
  10731 
  10732   // append json array
  10733   json->f->pushInt(json, 2);
  10734   r = mergeO(self, json);
  10735   smashO(json);
  10736   ck_assert_ptr_ne(r, null);
  10737   char *s = toStringO(r);
  10738   ck_assert_str_eq(s, "[1,2]");
  10739   free(s);
  10740   // length 0
  10741   json = allocSmallJson();
  10742   json->f->pushInt(json, 2);
  10743   baset *o = json->f->pop(json);
  10744   terminateO(o);
  10745   r = mergeO(self, json);
  10746   smashO(json);
  10747   ck_assert_ptr_ne(r, null);
  10748   s = toStringO(r);
  10749   ck_assert_str_eq(s, "[1,2]");
  10750   free(s);
  10751   // same sArray in both self and json
  10752   json = allocSmallJson();
  10753   setsoO(json, (smallt*) getsoO(self));
  10754   r = mergeO(self, json);
  10755   ck_assert_ptr_eq(r, null);
  10756   finishO(json);
  10757   s = toStringO(self);
  10758   ck_assert_str_eq(s, "[1,2]");
  10759   free(s);
  10760   // json of type not array
  10761   json = allocSmallJson();
  10762   setTopIntO(json, 1);
  10763   r = mergeO(self, json);
  10764   ck_assert_ptr_eq(r, null);
  10765   terminateO(json);
  10766   s = toStringO(self);
  10767   ck_assert_str_eq(s, "[1,2]");
  10768   free(s);
  10769   // non smallJson object
  10770   json = (smallJsont*) allocSmallInt(2);
  10771   r = mergeO(self, json);
  10772   ck_assert_ptr_eq(r, null);
  10773   terminateO(json);
  10774   // null
  10775   r = mergeO(self, null);
  10776   ck_assert_ptr_eq(r, null);
  10777   s = toStringO(self);
  10778   ck_assert_str_eq(s, "[1,2]");
  10779   free(s);
  10780   // json empty json
  10781   freeO(self);
  10782   json = allocSmallJson();
  10783   json->f->pushInt(json, 2);
  10784   r = mergeO(self, json);
  10785   smashO(json);
  10786   ck_assert_ptr_ne(r, null);
  10787   s = toStringO(r);
  10788   ck_assert_str_eq(s, "[2]");
  10789   free(s);
  10790   freeO(self);
  10791   json = allocSmallJson();
  10792   json->f->setInt(json, "a", 1);
  10793   r = mergeO(self, json);
  10794   smashO(json);
  10795   ck_assert_ptr_ne(r, null);
  10796   s = toStringO(r);
  10797   ck_assert_str_eq(s, "{\"a\":1}");
  10798   free(s);
  10799   // same dict in self and json
  10800   json = allocSmallJson();
  10801   setsoO(json, getsoO(self));
  10802   r = mergeO(self, json);
  10803   ck_assert_ptr_eq(r, null);
  10804   finishO(json);
  10805   // non json array or dict
  10806   freeO(self);
  10807   setTypeBoolO(self);
  10808   json = allocSmallJson();
  10809   ck_assert_ptr_eq(mergeO(self, json), NULL);
  10810   terminateO(json);
  10811   terminateO(self);
  10812 
  10813 END_TEST
  10814 
  10815 
  10816 START_TEST(mergeNSmashSmallJsonT)
  10817 
  10818   smallJsont* r;
  10819   smallJsont *self = allocSmallJson();
  10820   createAllocateSmallJson(json);
  10821 
  10822   // add an element to check that the second array is appended
  10823   // at the end
  10824   r = self->f->pushInt(self, 1);
  10825   ck_assert_ptr_ne(r, null);
  10826 
  10827   // append json array
  10828   json->f->pushInt(json, 2);
  10829   r = mergeNSmashO(self, json);
  10830   ck_assert_ptr_ne(r, null);
  10831   char *s = toStringO(r);
  10832   ck_assert_str_eq(s, "[1,2]");
  10833   free(s);
  10834   // null
  10835   r = mergeNSmashO(self, null);
  10836   ck_assert_ptr_eq(r, null);
  10837   s = toStringO(self);
  10838   ck_assert_str_eq(s, "[1,2]");
  10839   free(s);
  10840   terminateO(self);
  10841 
  10842 END_TEST
  10843 
  10844 
  10845 START_TEST(appendSmallJsonT)
  10846 
  10847   smallJsont* r;
  10848   smallJsont *self   = allocG(rtSmallJsont);
  10849   smallArrayt *array = allocSmallArray();
  10850 
  10851   array->f->pushInt(array, 12);
  10852   r = appendO(self, array);
  10853   ck_assert_ptr_ne(r, null);
  10854   smashO(array);
  10855   char *s = toStringO(r);
  10856   ck_assert_str_eq(s, "[12]");
  10857   free(s);
  10858   // non smallArray array
  10859   array = (smallArrayt*) allocSmallInt(1);
  10860   r = appendO(self, array);
  10861   ck_assert_ptr_eq(r, null);
  10862   terminateO(array);
  10863   // non json array
  10864   freeO(self);
  10865   setTypeBoolO(self);
  10866   array = allocSmallArray();
  10867   ck_assert_ptr_eq(appendO(self, array), NULL);
  10868   terminateO(array);
  10869   terminateO(self);
  10870 
  10871 END_TEST
  10872 
  10873 
  10874 START_TEST(appendNSmashSmallJsonT)
  10875 
  10876   smallJsont* r;
  10877   smallJsont *self = allocSmallJson();
  10878   createAllocateSmallArray(a);
  10879 
  10880   // add an element to check that the second array is appended
  10881   // at the end
  10882   r = self->f->pushInt(self, 1);
  10883   ck_assert_ptr_ne(r, null);
  10884 
  10885   // append array
  10886   a->f->pushInt(a, 2);
  10887   r = self->f->appendNSmash(self, a);
  10888   ck_assert_ptr_ne(r, null);
  10889   char *s = toStringO(r);
  10890   ck_assert_str_eq(s, "[1,2]");
  10891   free(s);
  10892   // length 0
  10893   a = allocSmallArray();
  10894   a->f->pushInt(a, 2);
  10895   delElemO(a,0);
  10896   r = self->f->appendNSmash(self, a);
  10897   ck_assert_ptr_ne(r, null);
  10898   s = toStringO(r);
  10899   ck_assert_str_eq(s, "[1,2]");
  10900   free(s);
  10901   // same sArray in both self and a
  10902   a = allocSmallArray();
  10903   setsoO(a, (sArrayt*) getsoO(self));
  10904   r = self->f->appendNSmash(self, a);
  10905   ck_assert_ptr_eq(r, null);
  10906   finishO(a);
  10907   s = toStringO(self);
  10908   ck_assert_str_eq(s, "[1,2]");
  10909   free(s);
  10910   // null
  10911   r = self->f->appendNSmash(self, null);
  10912   ck_assert_ptr_eq(r, null);
  10913   s = toStringO(self);
  10914   ck_assert_str_eq(s, "[1,2]");
  10915   free(s);
  10916   terminateO(self);
  10917 
  10918 END_TEST
  10919 
  10920 
  10921 START_TEST(appendArraySmallJsonT)
  10922 
  10923   smallJsont* r;
  10924   smallJsont *self = allocSmallJson();
  10925   char **array;
  10926 
  10927   // add an element to check that the second array is appended
  10928   // at the end
  10929   r = self->f->pushInt(self, 1);
  10930   ck_assert_ptr_ne(r, null);
  10931 
  10932   // append array
  10933   array = null;
  10934   listPushS(&array, "2");
  10935   r = self->f->appendArray(self, array);
  10936   listFreeS(array);
  10937   ck_assert_ptr_ne(r, null);
  10938   char *s = toStringO(r);
  10939   ck_assert_str_eq(s, "[1,\"2\"]");
  10940   free(s);
  10941   // length 0
  10942   listEmptyS(array);
  10943   r = self->f->appendArray(self, array);
  10944   free(array);
  10945   ck_assert_ptr_ne(r, null);
  10946   s = toStringO(r);
  10947   ck_assert_str_eq(s, "[1,\"2\"]");
  10948   free(s);
  10949   // null
  10950   r = self->f->appendArray(self, null);
  10951   ck_assert_ptr_eq(r, null);
  10952   s = toStringO(self);
  10953   ck_assert_str_eq(s, "[1,\"2\"]");
  10954   free(s);
  10955   // empty json
  10956   freeO(self);
  10957   array = null;
  10958   listPushS(&array, "2");
  10959   r = self->f->appendArray(self, array);
  10960   listFreeS(array);
  10961   ck_assert_ptr_ne(r, null);
  10962   s = toStringO(r);
  10963   ck_assert_str_eq(s, "[\"2\"]");
  10964   free(s);
  10965   // non json array
  10966   freeO(self);
  10967   setTypeBoolO(self);
  10968   listEmptyS(array);
  10969   ck_assert_ptr_eq(self->f->appendArray(self, array), NULL);
  10970   free(array);
  10971   terminateO(self);
  10972 
  10973 END_TEST
  10974 
  10975 
  10976 START_TEST(appendNSmashArraySmallJsonT)
  10977 
  10978   smallJsont* r;
  10979   smallJsont *self = allocSmallJson();
  10980   char **array;
  10981 
  10982   // add an element to check that the second array is appended
  10983   // at the end
  10984   r = self->f->pushInt(self, 1);
  10985   ck_assert_ptr_ne(r, null);
  10986 
  10987   // append array
  10988   array = null;
  10989   listPushS(&array, "2");
  10990   r = self->f->appendNSmashArray(self, array);
  10991   ck_assert_ptr_ne(r, null);
  10992   char *s = toStringO(r);
  10993   ck_assert_str_eq(s, "[1,\"2\"]");
  10994   free(s);
  10995   // length 0
  10996   listEmptyS(array);
  10997   r = self->f->appendNSmashArray(self, array);
  10998   ck_assert_ptr_ne(r, null);
  10999   s = toStringO(r);
  11000   ck_assert_str_eq(s, "[1,\"2\"]");
  11001   free(s);
  11002   // null
  11003   r = self->f->appendNSmashArray(self, null);
  11004   ck_assert_ptr_eq(r, null);
  11005   s = toStringO(self);
  11006   ck_assert_str_eq(s, "[1,\"2\"]");
  11007   free(s);
  11008   // empty json
  11009   freeO(self);
  11010   array = null;
  11011   listPushS(&array, "2");
  11012   r = self->f->appendNSmashArray(self, array);
  11013   ck_assert_ptr_ne(r, null);
  11014   s = toStringO(r);
  11015   ck_assert_str_eq(s, "[\"2\"]");
  11016   free(s);
  11017   // non json array
  11018   freeO(self);
  11019   setTypeBoolO(self);
  11020   listEmptyS(array);
  11021   ck_assert_ptr_eq(self->f->appendNSmashArray(self, array), NULL);
  11022   free(array);
  11023   terminateO(self);
  11024 
  11025 END_TEST
  11026 
  11027 
  11028 START_TEST(shiftSmallJsonT)
  11029 
  11030   smallJsont* r;
  11031   smallJsont *self = allocSmallJson();
  11032   createAllocateSmallArray(a);
  11033 
  11034   // add an element to check that the second array is appended
  11035   // at the end
  11036   r = self->f->pushInt(self, 1);
  11037   ck_assert_ptr_ne(r, null);
  11038 
  11039   // append array
  11040   a->f->pushInt(a, 2);
  11041   r = self->f->shift(self, a);
  11042   smashO(a);
  11043   ck_assert_ptr_ne(r, null);
  11044   char *s = toStringO(r);
  11045   ck_assert_str_eq(s, "[2,1]");
  11046   free(s);
  11047   // length 0
  11048   a = allocSmallArray();
  11049   a->f->pushInt(a, 2);
  11050   delElemO(a,0);
  11051   r = self->f->shift(self, a);
  11052   smashO(a);
  11053   ck_assert_ptr_ne(r, null);
  11054   s = toStringO(r);
  11055   ck_assert_str_eq(s, "[2,1]");
  11056   free(s);
  11057   // same sArray in both self and a
  11058   a = allocSmallArray();
  11059   setsoO(a, (sArrayt*) getsoO(self));
  11060   r = self->f->shift(self, a);
  11061   ck_assert_ptr_eq(r, null);
  11062   finishO(a);
  11063   s = toStringO(self);
  11064   ck_assert_str_eq(s, "[2,1]");
  11065   free(s);
  11066   // null
  11067   r = self->f->shift(self, null);
  11068   ck_assert_ptr_eq(r, null);
  11069   s = toStringO(self);
  11070   ck_assert_str_eq(s, "[2,1]");
  11071   free(s);
  11072   terminateO(self);
  11073 
  11074 END_TEST
  11075 
  11076 
  11077 START_TEST(shiftNSmashSmallJsonT)
  11078 
  11079   smallJsont* r;
  11080   smallJsont *self = allocSmallJson();
  11081   createAllocateSmallArray(a);
  11082 
  11083   // add an element to check that the second array is appended
  11084   // at the end
  11085   r = self->f->pushInt(self, 1);
  11086   ck_assert_ptr_ne(r, null);
  11087 
  11088   // append array
  11089   a->f->pushInt(a, 2);
  11090   r = self->f->shiftNSmash(self, a);
  11091   ck_assert_ptr_ne(r, null);
  11092   char *s = toStringO(r);
  11093   ck_assert_str_eq(s, "[2,1]");
  11094   free(s);
  11095   // length 0
  11096   a = allocSmallArray();
  11097   a->f->pushInt(a, 2);
  11098   delElemO(a,0);
  11099   r = self->f->shiftNSmash(self, a);
  11100   ck_assert_ptr_ne(r, null);
  11101   s = toStringO(r);
  11102   ck_assert_str_eq(s, "[2,1]");
  11103   free(s);
  11104   // same sArray in both self and a
  11105   a = allocSmallArray();
  11106   setsoO(a, (sArrayt*) getsoO(self));
  11107   r = self->f->shiftNSmash(self, a);
  11108   ck_assert_ptr_eq(r, null);
  11109   finishO(a);
  11110   s = toStringO(self);
  11111   ck_assert_str_eq(s, "[2,1]");
  11112   free(s);
  11113   // null
  11114   r = self->f->shiftNSmash(self, null);
  11115   ck_assert_ptr_eq(r, null);
  11116   s = toStringO(self);
  11117   ck_assert_str_eq(s, "[2,1]");
  11118   free(s);
  11119   terminateO(self);
  11120 
  11121 END_TEST
  11122 
  11123 
  11124 START_TEST(shiftSmallJsonSmallJsonT)
  11125 
  11126   smallJsont* r;
  11127   smallJsont *self = allocSmallJson();
  11128   createAllocateSmallJson(json);
  11129 
  11130   // add an element to check that the second array is shifted
  11131   // at the end
  11132   r = self->f->pushInt(self, 1);
  11133   ck_assert_ptr_ne(r, null);
  11134 
  11135   // shift json array
  11136   json->f->pushInt(json, 2);
  11137   r = self->f->shiftSmallJson(self, json);
  11138   smashO(json);
  11139   ck_assert_ptr_ne(r, null);
  11140   char *s = toStringO(r);
  11141   ck_assert_str_eq(s, "[2,1]");
  11142   free(s);
  11143   // length 0
  11144   json = allocSmallJson();
  11145   json->f->pushInt(json, 2);
  11146   baset *o = json->f->pop(json);
  11147   terminateO(o);
  11148   r = self->f->shiftSmallJson(self, json);
  11149   smashO(json);
  11150   ck_assert_ptr_ne(r, null);
  11151   s = toStringO(r);
  11152   ck_assert_str_eq(s, "[2,1]");
  11153   free(s);
  11154   // same sArray in both self and json
  11155   json = allocSmallJson();
  11156   setsoO(json, (smallt*) getsoO(self));
  11157   r = self->f->shiftSmallJson(self, json);
  11158   ck_assert_ptr_eq(r, null);
  11159   finishO(json);
  11160   s = toStringO(self);
  11161   ck_assert_str_eq(s, "[2,1]");
  11162   free(s);
  11163   // json of type not array
  11164   json = allocSmallJson();
  11165   setTopIntO(json, 1);
  11166   r = self->f->shiftSmallJson(self, json);
  11167   ck_assert_ptr_eq(r, null);
  11168   terminateO(json);
  11169   s = toStringO(self);
  11170   ck_assert_str_eq(s, "[2,1]");
  11171   free(s);
  11172   // null
  11173   r = self->f->shiftSmallJson(self, null);
  11174   ck_assert_ptr_eq(r, null);
  11175   s = toStringO(self);
  11176   ck_assert_str_eq(s, "[2,1]");
  11177   free(s);
  11178   terminateO(self);
  11179 
  11180 END_TEST
  11181 
  11182 
  11183 START_TEST(shiftNSmashSmallJsonSmallJsonT)
  11184 
  11185   smallJsont* r;
  11186   smallJsont *self = allocSmallJson();
  11187   createAllocateSmallJson(json);
  11188 
  11189   // add an element to check that the second array is shifted
  11190   // at the end
  11191   r = self->f->pushInt(self, 1);
  11192   ck_assert_ptr_ne(r, null);
  11193 
  11194   // shift json array
  11195   json->f->pushInt(json, 2);
  11196   r = self->f->shiftNSmashSmallJson(self, json);
  11197   ck_assert_ptr_ne(r, null);
  11198   char *s = toStringO(r);
  11199   ck_assert_str_eq(s, "[2,1]");
  11200   free(s);
  11201   // length 0
  11202   json = allocSmallJson();
  11203   json->f->pushInt(json, 2);
  11204   baset *o = json->f->pop(json);
  11205   terminateO(o);
  11206   r = self->f->shiftNSmashSmallJson(self, json);
  11207   ck_assert_ptr_ne(r, null);
  11208   s = toStringO(r);
  11209   ck_assert_str_eq(s, "[2,1]");
  11210   free(s);
  11211   // same sArray in both self and json
  11212   json = allocSmallJson();
  11213   setsoO(json, (smallt*) getsoO(self));
  11214   r = self->f->shiftNSmashSmallJson(self, json);
  11215   ck_assert_ptr_eq(r, null);
  11216   finishO(json);
  11217   s = toStringO(self);
  11218   ck_assert_str_eq(s, "[2,1]");
  11219   free(s);
  11220   // json of type not array
  11221   json = allocSmallJson();
  11222   setTopIntO(json, 1);
  11223   r = self->f->shiftNSmashSmallJson(self, json);
  11224   ck_assert_ptr_eq(r, null);
  11225   terminateO(json);
  11226   s = toStringO(self);
  11227   ck_assert_str_eq(s, "[2,1]");
  11228   free(s);
  11229   // null
  11230   r = self->f->shiftNSmashSmallJson(self, null);
  11231   ck_assert_ptr_eq(r, null);
  11232   s = toStringO(self);
  11233   ck_assert_str_eq(s, "[2,1]");
  11234   free(s);
  11235   terminateO(self);
  11236 
  11237 END_TEST
  11238 
  11239 
  11240 START_TEST(addSmallJsonT)
  11241 
  11242   smallJsont* r;
  11243   smallJsont *self = allocSmallJson();
  11244   createAllocateSmallArray(a);
  11245 
  11246   // add an element to check that the second array is added
  11247   // at the end
  11248   r = self->f->pushInt(self, 1);
  11249   ck_assert_ptr_ne(r, null);
  11250 
  11251   // add array
  11252   a->f->pushInt(a, 2);
  11253   r = addO(self, a);
  11254   smashO(a);
  11255   ck_assert_ptr_ne(r, null);
  11256   char *s = toStringO(r);
  11257   terminateO(r);
  11258   ck_assert_str_eq(s, "[1,2]");
  11259   free(s);
  11260   // length 0
  11261   a = allocSmallArray();
  11262   a->f->pushInt(a, 2);
  11263   delElemO(a,0);
  11264   r = addO(self, a);
  11265   smashO(a);
  11266   ck_assert_ptr_ne(r, null);
  11267   s = toStringO(r);
  11268   terminateO(r);
  11269   ck_assert_str_eq(s, "[1]");
  11270   free(s);
  11271   a = allocSmallArray();
  11272   r = addO(self, a);
  11273   smashO(a);
  11274   ck_assert_ptr_ne(r, null);
  11275   s = toStringO(r);
  11276   terminateO(r);
  11277   ck_assert_str_eq(s, "[1]");
  11278   free(s);
  11279   // same sArray in both self and a
  11280   a = allocSmallArray();
  11281   setsoO(a, (sArrayt*) getsoO(self));
  11282   r = addO(self, a);
  11283   ck_assert_ptr_eq(r, null);
  11284   finishO(a);
  11285   s = toStringO(self);
  11286   ck_assert_str_eq(s, "[1]");
  11287   free(s);
  11288   // null
  11289   r = addO(self, null);
  11290   ck_assert_ptr_eq(r, null);
  11291   s = toStringO(self);
  11292   ck_assert_str_eq(s, "[1]");
  11293   free(s);
  11294   // non smallArray a
  11295   a = (smallArrayt*) allocSmallInt(1);
  11296   ck_assert_ptr_eq(addO(self, a), NULL);
  11297   terminateO(a);
  11298   // non json array
  11299   freeO(self);
  11300   setTypeBoolO(self);
  11301   a = allocSmallArray();
  11302   ck_assert_ptr_eq(addO(self, a), NULL);
  11303   terminateO(a);
  11304   terminateO(self);
  11305 
  11306 END_TEST
  11307 
  11308 
  11309 START_TEST(addJsonSmallJsonT)
  11310 
  11311   smallJsont* r;
  11312   smallJsont *self = allocSmallJson();
  11313   smallJsont *a    = allocSmallJson();
  11314 
  11315   // add an element to check that the second array is added
  11316   // at the end
  11317   r = self->f->pushInt(self, 1);
  11318   ck_assert_ptr_ne(r, null);
  11319 
  11320   // add array
  11321   a->f->pushInt(a, 2);
  11322   r = addJsonO(self, a);
  11323   smashO(a);
  11324   ck_assert_ptr_ne(r, null);
  11325   char *s = toStringO(r);
  11326   terminateO(r);
  11327   ck_assert_str_eq(s, "[1,2]");
  11328   free(s);
  11329   // length 0
  11330   a = allocSmallJson();
  11331   a->f->pushInt(a, 2);
  11332   delElemIndexO(a,0);
  11333   r = addJsonO(self, a);
  11334   smashO(a);
  11335   ck_assert_ptr_ne(r, null);
  11336   s = toStringO(r);
  11337   terminateO(r);
  11338   ck_assert_str_eq(s, "[1]");
  11339   free(s);
  11340   a = allocSmallJson();
  11341   setTypeArrayO(a);
  11342   r = addJsonO(self, a);
  11343   smashO(a);
  11344   ck_assert_ptr_ne(r, null);
  11345   s = toStringO(r);
  11346   terminateO(r);
  11347   ck_assert_str_eq(s, "[1]");
  11348   free(s);
  11349   // same sArray in both self and a
  11350   a = allocSmallJson();
  11351   setsoO(a, getsoO(self));
  11352   r = addJsonO(self, a);
  11353   ck_assert_ptr_eq(r, null);
  11354   finishO(a);
  11355   s = toStringO(self);
  11356   ck_assert_str_eq(s, "[1]");
  11357   free(s);
  11358   // non json array a
  11359   a = allocSmallJson();
  11360   r = addJsonO(self, a);
  11361   ck_assert_ptr_eq(r, null);
  11362   finishO(a);
  11363   s = toStringO(self);
  11364   ck_assert_str_eq(s, "[1]");
  11365   free(s);
  11366   // null
  11367   r = addJsonO(self, null);
  11368   ck_assert_ptr_eq(r, null);
  11369   s = toStringO(self);
  11370   ck_assert_str_eq(s, "[1]");
  11371   free(s);
  11372   // non json a
  11373   a = (smallJsont*) allocSmallInt(1);
  11374   ck_assert_ptr_eq(addJsonO(self, a), NULL);
  11375   terminateO(a);
  11376   // non json array
  11377   freeO(self);
  11378   setTypeBoolO(self);
  11379   a = allocSmallJson();
  11380   ck_assert_ptr_eq(addJsonO(self, a), NULL);
  11381   terminateO(a);
  11382   terminateO(self);
  11383 
  11384 END_TEST
  11385 
  11386 
  11387 START_TEST(sliceSmallJsonT)
  11388 
  11389   smallJsont* r;
  11390   smallJsont *self = allocSmallJson();
  11391 
  11392   //r = sliceO(self);
  11393   // slice
  11394   self->f->pushS(self, "asd");
  11395   self->f->pushInt(self, 123);
  11396   self->f->pushS(self, "sheepy");
  11397   self->f->pushInt(self, 5345);
  11398   r = sliceO(self,1,-1);
  11399   ck_assert_ptr_ne(r, null);
  11400   char *s = toStringO(r);
  11401   ck_assert_str_eq(s, "[123,\"sheepy\"]");
  11402   free(s);
  11403   terminateO(self);
  11404     // start outside
  11405   self = allocSmallJson();
  11406   self->f->pushS(self, "asd");
  11407   self->f->pushInt(self, 123);
  11408   self->f->pushS(self, "sheepy");
  11409   self->f->pushInt(self, 5345);
  11410   r = sliceO(self,20,-1);
  11411   ck_assert_ptr_eq(r, null);
  11412   s = toStringO(self);
  11413   ck_assert_str_eq(s, "[]");
  11414   free(s);
  11415   terminateO(self);
  11416     // start negative and outside
  11417   self = allocSmallJson();
  11418   self->f->pushUndefined(self);
  11419   self->f->pushInt(self, 123);
  11420   self->f->pushS(self, "sheepy");
  11421   self->f->pushInt(self, 5345);
  11422   r = sliceO(self,-20,1);
  11423   ck_assert_ptr_ne(r, null);
  11424   s = toStringO(r);
  11425   ck_assert_str_eq(s, "[null]");
  11426   free(s);
  11427   terminateO(self);
  11428     // end outside
  11429   self = allocSmallJson();
  11430   self->f->pushUndefined(self);
  11431   self->f->pushInt(self, 123);
  11432   self->f->pushS(self, "sheepy");
  11433   self->f->pushInt(self, 5345);
  11434   r = sliceO(self,2,40);
  11435   ck_assert_ptr_ne(r, null);
  11436   s = toStringO(self);
  11437   ck_assert_str_eq(s, "[\"sheepy\",5345]");
  11438   free(s);
  11439   terminateO(self);
  11440     // end negative and outside
  11441   self = allocSmallJson();
  11442   self->f->pushUndefined(self);
  11443   self->f->pushInt(self, 123);
  11444   self->f->pushS(self, "sheepy");
  11445   self->f->pushInt(self, 5345);
  11446   r = sliceO(self,2,-40);
  11447   ck_assert_ptr_eq(r, null);
  11448   s = toStringO(self);
  11449   ck_assert_str_eq(s, "[]");
  11450   free(s);
  11451   terminateO(self);
  11452     // end before start
  11453   self = allocSmallJson();
  11454   self->f->pushUndefined(self);
  11455   self->f->pushInt(self, 123);
  11456   self->f->pushS(self, "sheepy");
  11457   self->f->pushInt(self, 5345);
  11458   r = sliceO(self,3,2);
  11459   ck_assert_ptr_eq(r, null);
  11460   s = toStringO(self);
  11461   ck_assert_str_eq(s, "[]");
  11462   free(s);
  11463   terminateO(self);
  11464     // negative start last element
  11465   self = allocSmallJson();
  11466   self->f->pushUndefined(self);
  11467   self->f->pushInt(self, 123);
  11468   self->f->pushS(self, "sheepy");
  11469   self->f->pushInt(self, 5345);
  11470   r = sliceO(self,-1,0);
  11471   ck_assert_ptr_ne(r, null);
  11472   s = toStringO(r);
  11473   ck_assert_str_eq(s, "[5345]");
  11474   free(s);
  11475   terminateO(self);
  11476     // start = end
  11477   self = allocSmallJson();
  11478   self->f->pushUndefined(self);
  11479   self->f->pushInt(self, 123);
  11480   self->f->pushS(self, "sheepy");
  11481   self->f->pushInt(self, 5345);
  11482   r = sliceO(self,1,1);
  11483   ck_assert_ptr_ne(r, null);
  11484   s = toStringO(r);
  11485   ck_assert_str_eq(s, "[]");
  11486   free(s);
  11487   terminateO(self);
  11488     // empty list
  11489   initiateAllocateSmallJson(&self);
  11490   setTypeArrayO(self);
  11491   r = sliceO(self,0,0);
  11492   ck_assert_ptr_eq(r, null);
  11493   s = toStringO(self);
  11494   ck_assert_str_eq(s, "[]");
  11495   free(s);
  11496   // non json array
  11497   freeO(self);
  11498   setTypeBoolO(self);
  11499   ck_assert_ptr_eq(sliceO(self, 0, 1), NULL);
  11500   terminateO(self);
  11501   // json string
  11502   self = allocSmallJson();
  11503   // slice
  11504   setTopSO(self, "sheepy");
  11505   r = sliceO(self, 0,2);
  11506   ck_assert_ptr_ne(r, null);
  11507   ck_assert_str_eq(sjGet(self), "sh");
  11508   // negative index
  11509   freeO(self);
  11510   setTopSO(self, "sheepy");
  11511   r = sliceO(self, -2,0);
  11512   ck_assert_ptr_ne(r, null);
  11513   ck_assert_str_eq(sjGet(self), "py");
  11514   // positive and negative indexes
  11515   freeO(self);
  11516   setTopSO(self, "sheepy");
  11517   r = sliceO(self, 2,-2);
  11518   ck_assert_ptr_ne(r, null);
  11519   ck_assert_str_eq(sjGet(self), "ee");
  11520   // start = end
  11521   freeO(self);
  11522   setTopSO(self, "sheepy");
  11523   r = sliceO(self, 2,-4);
  11524   ck_assert_ptr_ne(r, null);
  11525   ck_assert_str_eq(sjGet(self), "");
  11526   // end of string
  11527   freeO(self);
  11528   setTopSO(self, "sheepy");
  11529   r = sliceO(self, 2,6);
  11530   ck_assert_ptr_ne(r, null);
  11531   ck_assert_str_eq(sjGet(self), "eepy");
  11532   // NULL string
  11533   freeO(self);
  11534   ck_assert_ptr_eq(sliceO(self, 2,-4), NULL);
  11535   // start outside string
  11536   freeO(self);
  11537   setTopSO(self, "sheepy");
  11538   ck_assert_ptr_eq(sliceO(self, 20,-4), NULL);
  11539   // end outside string
  11540   freeO(self);
  11541   setTopSO(self, "sheepy");
  11542   r = sliceO(self, 2,40);
  11543   ck_assert_ptr_ne(r, null);
  11544   ck_assert_str_eq(sjGet(self), "eepy");
  11545   freeO(self);
  11546   setTopSO(self, "sheepy");
  11547   r = sliceO(self, -22,3);
  11548   ck_assert_ptr_ne(r, null);
  11549   ck_assert_str_eq(sjGet(self), "she");
  11550   freeO(self);
  11551   setTopSO(self, "sheepy");
  11552   ck_assert_ptr_eq(sliceO(self, 2,-40), NULL);
  11553   // end before start
  11554   freeO(self);
  11555   setTopSO(self, "sheepy");
  11556   ck_assert_ptr_eq(sliceO(self, 4,2), NULL);
  11557   terminateO(self);
  11558 
  11559 END_TEST
  11560 
  11561 
  11562 START_TEST(cropSmallJsonT)
  11563 
  11564   smallJsont* r;
  11565   smallJsont *self = allocSmallJson();
  11566 
  11567   // add elements to self
  11568   r = self->f->pushInt(self, 1);
  11569   ck_assert_ptr_ne(r, null);
  11570   r = self->f->pushInt(self, 2);
  11571   ck_assert_ptr_ne(r, null);
  11572   r = self->f->pushInt(self, 3);
  11573   ck_assert_ptr_ne(r, null);
  11574   r = self->f->pushInt(self, 4);
  11575   ck_assert_ptr_ne(r, null);
  11576 
  11577   // negative index
  11578   r = cropO(self, 1, -1);
  11579   ck_assert_ptr_ne(r, null);
  11580   ck_assert_int_eq(lenO(r), 2);
  11581   char *s = toStringO(r);
  11582   terminateO(r);
  11583   ck_assert_str_eq(s, "[2,3]");
  11584   free(s);
  11585   s = toStringO(self);
  11586   ck_assert_str_eq(s, "[1,4]");
  11587   free(s);
  11588   // start outside
  11589   ck_assert_ptr_eq(cropO(self, 20, -4), NULL);
  11590   // end outside
  11591   r = cropO(self, 0, 40);
  11592   ck_assert_ptr_ne(r, null);
  11593   ck_assert_int_eq(lenO(r), 2);
  11594   s = toStringO(r);
  11595   terminateO(r);
  11596   ck_assert_str_eq(s, "[1,4]");
  11597   free(s);
  11598   s = toStringO(self);
  11599   ck_assert_str_eq(s, "[]");
  11600   free(s);
  11601   // end negative and outside
  11602   //   add elements to self
  11603   r = self->f->pushInt(self, 1);
  11604   ck_assert_ptr_ne(r, null);
  11605   r = self->f->pushInt(self, 2);
  11606   ck_assert_ptr_ne(r, null);
  11607   r = self->f->pushInt(self, 3);
  11608   ck_assert_ptr_ne(r, null);
  11609   r = self->f->pushInt(self, 4);
  11610   ck_assert_ptr_ne(r, null);
  11611   ck_assert_ptr_eq(cropO(self, 2, -40), NULL);
  11612   s = toStringO(self);
  11613   ck_assert_str_eq(s, "[1,2,3,4]");
  11614   free(s);
  11615   // end before start
  11616   ck_assert_ptr_eq(cropO(self, 3, 2), NULL);
  11617   s = toStringO(self);
  11618   ck_assert_str_eq(s, "[1,2,3,4]");
  11619   free(s);
  11620   // negative start last element
  11621   r = cropO(self, -1, 0);
  11622   ck_assert_ptr_ne(r, null);
  11623   ck_assert_int_eq(lenO(r), 1);
  11624   s = toStringO(r);
  11625   terminateO(r);
  11626   ck_assert_str_eq(s, "[4]");
  11627   free(s);
  11628   s = toStringO(self);
  11629   ck_assert_str_eq(s, "[1,2,3]");
  11630   free(s);
  11631   // negative start and outside
  11632   r = cropO(self, -10, 1);
  11633   ck_assert_ptr_ne(r, null);
  11634   ck_assert_int_eq(lenO(r), 1);
  11635   s = toStringO(r);
  11636   terminateO(r);
  11637   ck_assert_str_eq(s, "[1]");
  11638   free(s);
  11639   s = toStringO(self);
  11640   ck_assert_str_eq(s, "[2,3]");
  11641   free(s);
  11642   // start = end
  11643   r = cropO(self, 1, 1);
  11644   ck_assert_ptr_ne(r, null);
  11645   ck_assert_int_eq(lenO(r), 0);
  11646   terminateO(r);
  11647   s = toStringO(self);
  11648   ck_assert_str_eq(s, "[2,3]");
  11649   free(s);
  11650   // empty list
  11651   emptyO(self);
  11652   ck_assert_ptr_eq(cropO(self, 0, 0), NULL);
  11653   ck_assert_ptr_eq(cropO(self, -1, 0), NULL);
  11654   // non json array
  11655   freeO(self);
  11656   setTypeBoolO(self);
  11657   ck_assert_ptr_eq(cropO(self, 0, 1), NULL);
  11658   terminateO(self);
  11659   // json string
  11660   self = allocSmallJson();
  11661   setTopSO(self, "");
  11662   // crop
  11663   freeO(self);
  11664   setTopSO(self, "sheepy");
  11665   r = cropO(self, 0,2);
  11666   ck_assert_ptr_ne(r, null);
  11667   ck_assert_str_eq(sjGet(r), "sh");
  11668   ck_assert_str_eq(sjGet(self), "eepy");
  11669   terminateO(r);
  11670   // negative index
  11671   freeO(self);
  11672   setTopSO(self, "sheepy");
  11673   r = cropO(self, -2,0);
  11674   ck_assert_ptr_ne(r, null);
  11675   ck_assert_str_eq(sjGet(r), "py");
  11676   ck_assert_str_eq(sjGet(self), "shee");
  11677   terminateO(r);
  11678   // positive and negative indexes
  11679   freeO(self);
  11680   setTopSO(self, "sheepy");
  11681   r = cropO(self, 2,-2);
  11682   ck_assert_ptr_ne(r, null);
  11683   ck_assert_str_eq(sjGet(r), "ee");
  11684   ck_assert_str_eq(sjGet(self), "shpy");
  11685   terminateO(r);
  11686   // start = end
  11687   freeO(self);
  11688   setTopSO(self, "sheepy");
  11689   r = cropO(self, 2,-4);
  11690   ck_assert_ptr_ne(r, null);
  11691   ck_assert_str_eq(sjGet(r), "");
  11692   ck_assert_str_eq(sjGet(self), "sheepy");
  11693   terminateO(r);
  11694   // end of string
  11695   freeO(self);
  11696   setTopSO(self, "sheepy");
  11697   r = cropO(self, 2,6);
  11698   ck_assert_ptr_ne(r, null);
  11699   ck_assert_str_eq(sjGet(r), "eepy");
  11700   ck_assert_str_eq(sjGet(self), "sh");
  11701   terminateO(r);
  11702   // NULL string
  11703   freeO(self);
  11704   ck_assert_ptr_eq(cropO(self, 2,-4), NULL);
  11705   // start outside string
  11706   freeO(self);
  11707   setTopSO(self, "sheepy");
  11708   ck_assert_ptr_eq(cropO(self, 20,-4), NULL);
  11709   // end outside string
  11710   freeO(self);
  11711   setTopSO(self, "sheepy");
  11712   r = cropO(self, 2,40);
  11713   ck_assert_ptr_ne(r, null);
  11714   ck_assert_str_eq(sjGet(r), "eepy");
  11715   ck_assert_str_eq(sjGet(self), "sh");
  11716   terminateO(r);
  11717   freeO(self);
  11718   setTopSO(self, "sheepy");
  11719   r = cropO(self, -22,3);
  11720   ck_assert_ptr_ne(r, null);
  11721   ck_assert_str_eq(sjGet(r), "she");
  11722   ck_assert_str_eq(sjGet(self), "epy");
  11723   terminateO(r);
  11724   freeO(self);
  11725   setTopSO(self, "sheepy");
  11726   ck_assert_ptr_eq(cropO(self, 2,-40), NULL);
  11727   // end before start
  11728   ck_assert_ptr_eq(cropO(self, 4,2), NULL);
  11729   terminateO(self);
  11730 
  11731 END_TEST
  11732 
  11733 
  11734 START_TEST(cropSSmallJsonT)
  11735 
  11736   char* s;
  11737   smallJsont *self = allocSmallJson();
  11738   setTopSO(self, "");
  11739 
  11740   // crop
  11741   freeO(self);
  11742   setTopSO(self, "sheepy");
  11743   s = cropSO(self, 0,2);
  11744   ck_assert_str_eq(s, "sh");
  11745   ck_assert_str_eq(sjGet(self), "eepy");
  11746   free(s);
  11747   // negative index
  11748   freeO(self);
  11749   setTopSO(self, "sheepy");
  11750   s = cropSO(self, -2,0);
  11751   ck_assert_str_eq(s, "py");
  11752   ck_assert_str_eq(sjGet(self), "shee");
  11753   free(s);
  11754   // positive and negative indexes
  11755   freeO(self);
  11756   setTopSO(self, "sheepy");
  11757   s = cropSO(self, 2,-2);
  11758   ck_assert_str_eq(s, "ee");
  11759   ck_assert_str_eq(sjGet(self), "shpy");
  11760   free(s);
  11761   // start = end
  11762   freeO(self);
  11763   setTopSO(self, "sheepy");
  11764   s = cropSO(self, 2,-4);
  11765   ck_assert_str_eq(s, "");
  11766   ck_assert_str_eq(sjGet(self), "sheepy");
  11767   free(s);
  11768   // end of string
  11769   freeO(self);
  11770   setTopSO(self, "sheepy");
  11771   s = cropSO(self, 2,6);
  11772   ck_assert_str_eq(s, "eepy");
  11773   ck_assert_str_eq(sjGet(self), "sh");
  11774   free(s);
  11775   // empty string
  11776   freeO(self);
  11777   setTopSO(self, "");
  11778   ck_assert_ptr_eq(cropSO(self, 0,1), NULL);
  11779   // NULL string
  11780   freeO(self);
  11781   ck_assert_ptr_eq(cropSO(self, 2,-4), NULL);
  11782   // start outside string
  11783   freeO(self);
  11784   setTopSO(self, "sheepy");
  11785   ck_assert_ptr_eq(cropSO(self, 20,-4), NULL);
  11786   // end outside string
  11787   freeO(self);
  11788   setTopSO(self, "sheepy");
  11789   s = cropSO(self, 2,40);
  11790   ck_assert_str_eq(s, "eepy");
  11791   ck_assert_str_eq(sjGet(self), "sh");
  11792   free(s);
  11793   freeO(self);
  11794   setTopSO(self, "sheepy");
  11795   s = cropSO(self, -22,3);
  11796   ck_assert_str_eq(s, "she");
  11797   ck_assert_str_eq(sjGet(self), "epy");
  11798   free(s);
  11799   freeO(self);
  11800   setTopSO(self, "sheepy");
  11801   ck_assert_ptr_eq(cropSO(self, 2,-40), NULL);
  11802   // end before start
  11803   ck_assert_ptr_eq(cropSO(self, 4,2), NULL);
  11804   terminateO(self);
  11805 
  11806 END_TEST
  11807 
  11808 
  11809 START_TEST(cropSmallStringSmallJsonT)
  11810 
  11811   smallStringt* r;
  11812   smallJsont *self = allocSmallJson();
  11813   setTopSO(self, "");
  11814 
  11815   // crop
  11816   freeO(self);
  11817   setTopSO(self, "sheepy");
  11818   r = cropSmallStringO(self, 0,2);
  11819   ck_assert_ptr_ne(r, null);
  11820   ck_assert_str_eq(ssGet(r), "sh");
  11821   ck_assert_str_eq(sjGet(self), "eepy");
  11822   terminateO(r);
  11823   // negative index
  11824   freeO(self);
  11825   setTopSO(self, "sheepy");
  11826   r = cropSmallStringO(self, -2,0);
  11827   ck_assert_ptr_ne(r, null);
  11828   ck_assert_str_eq(ssGet(r), "py");
  11829   ck_assert_str_eq(sjGet(self), "shee");
  11830   terminateO(r);
  11831   // positive and negative indexes
  11832   freeO(self);
  11833   setTopSO(self, "sheepy");
  11834   r = cropSmallStringO(self, 2,-2);
  11835   ck_assert_ptr_ne(r, null);
  11836   ck_assert_str_eq(ssGet(r), "ee");
  11837   ck_assert_str_eq(sjGet(self), "shpy");
  11838   terminateO(r);
  11839   // start = end
  11840   freeO(self);
  11841   setTopSO(self, "sheepy");
  11842   r = cropSmallStringO(self, 2,-4);
  11843   ck_assert_ptr_ne(r, null);
  11844   ck_assert_str_eq(ssGet(r), "");
  11845   ck_assert_str_eq(sjGet(self), "sheepy");
  11846   terminateO(r);
  11847   // end of string
  11848   freeO(self);
  11849   setTopSO(self, "sheepy");
  11850   r = cropSmallStringO(self, 2,6);
  11851   ck_assert_ptr_ne(r, null);
  11852   ck_assert_str_eq(ssGet(r), "eepy");
  11853   ck_assert_str_eq(sjGet(self), "sh");
  11854   terminateO(r);
  11855   // NULL string
  11856   freeO(self);
  11857   ck_assert_ptr_eq(cropSmallStringO(self, 2,-4), NULL);
  11858   // start outside string
  11859   freeO(self);
  11860   setTopSO(self, "sheepy");
  11861   ck_assert_ptr_eq(cropSmallStringO(self, 20,-4), NULL);
  11862   // end outside string
  11863   freeO(self);
  11864   setTopSO(self, "sheepy");
  11865   r = cropSmallStringO(self, 2,40);
  11866   ck_assert_ptr_ne(r, null);
  11867   ck_assert_str_eq(ssGet(r), "eepy");
  11868   ck_assert_str_eq(sjGet(self), "sh");
  11869   terminateO(r);
  11870   freeO(self);
  11871   setTopSO(self, "sheepy");
  11872   r = cropSmallStringO(self, -22,3);
  11873   ck_assert_ptr_ne(r, null);
  11874   ck_assert_str_eq(ssGet(r), "she");
  11875   ck_assert_str_eq(sjGet(self), "epy");
  11876   terminateO(r);
  11877   freeO(self);
  11878   setTopSO(self, "sheepy");
  11879   ck_assert_ptr_eq(cropSmallStringO(self, 2,-40), NULL);
  11880   // end before start
  11881   ck_assert_ptr_eq(cropSmallStringO(self, 4,2), NULL);
  11882   terminateO(self);
  11883 
  11884 END_TEST
  11885 
  11886 
  11887 START_TEST(cropElemAtSmallJsonT)
  11888 
  11889   baset* r;
  11890   smallJsont *self = allocSmallJson();
  11891   smallJsont *r2;
  11892 
  11893   // add elements to self
  11894   r2 = self->f->pushInt(self, 1);
  11895   ck_assert_ptr_ne(r2, null);
  11896   r2 = self->f->pushInt(self, 2);
  11897   ck_assert_ptr_ne(r2, null);
  11898   r2 = self->f->pushInt(self, 3);
  11899   ck_assert_ptr_ne(r2, null);
  11900   r2 = self->f->pushInt(self, 4);
  11901   ck_assert_ptr_ne(r2, null);
  11902 
  11903   // positive index
  11904   r       = cropElemAtO(self,1);
  11905   ck_assert_ptr_ne(r, null);
  11906   char *s = toStringO(r);
  11907   terminateO(r);
  11908   ck_assert_str_eq(s, "2");
  11909   free(s);
  11910   s = toStringO(self);
  11911   ck_assert_str_eq(s, "[1,3,4]");
  11912   free(s);
  11913   // negative index
  11914   r = cropElemAtO(self,-1);
  11915   ck_assert_ptr_ne(r, null);
  11916   s = toStringO(r);
  11917   terminateO(r);
  11918   ck_assert_str_eq(s, "4");
  11919   free(s);
  11920   s = toStringO(self);
  11921   ck_assert_str_eq(s, "[1,3]");
  11922   free(s);
  11923   // undefined object
  11924   r2 = self->f->pushUndefined(self);
  11925   ck_assert_ptr_ne(r2, null);
  11926   r = cropElemAtO(self,2);
  11927   ck_assert_ptr_ne(r, null);
  11928   s = toStringO(r);
  11929   terminateO(r);
  11930   ck_assert_str_eq(s, "null");
  11931   free(s);
  11932   s = toStringO(self);
  11933   ck_assert_str_eq(s, "[1,3]");
  11934   free(s);
  11935   // container
  11936   createSmallContainer(c);
  11937   r2 = self->f->pushSmallContainer(self, &c);
  11938   r = cropElemAtO(self,2);
  11939   ck_assert_ptr_ne(r, null);
  11940   s = toStringO(r);
  11941   terminateO(r);
  11942   ck_assert_str_eq(s, "<data smallContainer>");
  11943   free(s);
  11944   s = toStringO(self);
  11945   ck_assert_str_eq(s, "[1,3]");
  11946   free(s);
  11947   // base object in container
  11948   createAllocateSmallInt(I);
  11949   setValG(I, 11);
  11950   I->type = "anothertype";
  11951   r2 = self->f->push(self, (baset*)I);
  11952   r = cropElemAtO(self,2);
  11953   ck_assert_ptr_ne(r, null);
  11954   ck_assert_str_eq(r->type, "anothertype");
  11955   s = toStringO(r);
  11956   terminateO(r);
  11957   ck_assert_str_eq(s, "11");
  11958   free(s);
  11959   s = toStringO(self);
  11960   ck_assert_str_eq(s, "[1,3]");
  11961   free(s);
  11962   // index outside
  11963   ck_assert_ptr_eq(cropElemAtO(self, 20), NULL);
  11964   ck_assert_ptr_eq(cropElemAtO(self, -4), NULL);
  11965   // empty list
  11966   emptyO(self);
  11967   ck_assert_ptr_eq(cropElemAtO(self, 0), NULL);
  11968   ck_assert_ptr_eq(cropElemAtO(self, -1), NULL);
  11969   r2 = self->f->pushUndefined(self);
  11970   ck_assert_ptr_ne(r2, null);
  11971   delElemIndexO(self,-1);
  11972   r = cropElemAtO(self, 0);
  11973   ck_assert_ptr_eq(r, null);
  11974   // non json array
  11975   freeO(self);
  11976   setTypeBoolO(self);
  11977   ck_assert_ptr_eq(cropElemAtO(self, 0), NULL);
  11978   terminateO(self);
  11979 
  11980 END_TEST
  11981 
  11982 
  11983 START_TEST(cropElemAtUndefinedSmallJsonT)
  11984 
  11985   undefinedt* r;
  11986   smallJsont *self = allocSmallJson();
  11987   smallJsont *r2;
  11988 
  11989   // add elements to self
  11990   r2 = self->f->pushInt(self, 1);
  11991   ck_assert_ptr_ne(r2, null);
  11992   r2 = self->f->pushUndefined(self);
  11993   ck_assert_ptr_ne(r2, null);
  11994   r2 = self->f->pushInt(self, 3);
  11995   ck_assert_ptr_ne(r2, null);
  11996   r2 = self->f->pushUndefined(self);
  11997   ck_assert_ptr_ne(r2, null);
  11998 
  11999   // positive index
  12000   r       = cropElemAtUndefinedO(self,1);
  12001   ck_assert_ptr_ne(r, null);
  12002   char *s = toStringO(r);
  12003   terminateO(r);
  12004   ck_assert_str_eq(s, "null");
  12005   free(s);
  12006   s = toStringO(self);
  12007   ck_assert_str_eq(s, "[1,3,null]");
  12008   free(s);
  12009   // negative index
  12010   r = cropElemAtUndefinedO(self,-1);
  12011   ck_assert_ptr_ne(r, null);
  12012   s = toStringO(r);
  12013   terminateO(r);
  12014   ck_assert_str_eq(s, "null");
  12015   free(s);
  12016   s = toStringO(self);
  12017   ck_assert_str_eq(s, "[1,3]");
  12018   free(s);
  12019   // wrong object type
  12020   createSmallInt(I);
  12021   setValG(&I, 11);
  12022   r2 = self->f->pushSmallInt(self, &I);
  12023   ck_assert_ptr_ne(r2, null);
  12024   r = cropElemAtUndefinedO(self,2);
  12025   ck_assert_ptr_eq(r, null);
  12026   s = toStringO(self);
  12027   ck_assert_str_eq(s, "[1,3,11]");
  12028   free(s);
  12029   // index outside
  12030   ck_assert_ptr_eq(cropElemAtUndefinedO(self, 20), NULL);
  12031   ck_assert_ptr_eq(cropElemAtUndefinedO(self, -4), NULL);
  12032   // empty list
  12033   emptyO(self);
  12034   ck_assert_ptr_eq(cropElemAtUndefinedO(self, 0), NULL);
  12035   ck_assert_ptr_eq(cropElemAtUndefinedO(self, -1), NULL);
  12036   r2 = self->f->pushUndefined(self);
  12037   ck_assert_ptr_ne(r2, null);
  12038   delElemIndexO(self,-1);
  12039   r = cropElemAtUndefinedO(self, 0);
  12040   ck_assert_ptr_eq(r, null);
  12041   // non json array
  12042   freeO(self);
  12043   setTypeBoolO(self);
  12044   ck_assert_ptr_eq(cropElemAtUndefinedO(self, 0), NULL);
  12045   terminateO(self);
  12046 
  12047 END_TEST
  12048 
  12049 
  12050 START_TEST(cropElemAtBoolSmallJsonT)
  12051 
  12052   bool r;
  12053   smallJsont *self = allocSmallJson();
  12054   smallJsont *r2;
  12055 
  12056   // add elements to self
  12057   r2 = self->f->pushInt(self, 1);
  12058   ck_assert_ptr_ne(r2, null);
  12059   r2 = self->f->pushBool(self, TRUE);
  12060   ck_assert_ptr_ne(r2, null);
  12061   r2 = self->f->pushInt(self, 3);
  12062   ck_assert_ptr_ne(r2, null);
  12063   r2 = self->f->pushBool(self, TRUE);
  12064   ck_assert_ptr_ne(r2, null);
  12065 
  12066   // positive index
  12067   r       = cropElemAtBoolO(self,1);
  12068   ck_assert(r);
  12069   char *s = toStringO(self);
  12070   ck_assert_str_eq(s, "[1,3,true]");
  12071   free(s);
  12072   // negative index
  12073   r = cropElemAtBoolO(self,-1);
  12074   ck_assert(r);
  12075   s = toStringO(self);
  12076   ck_assert_str_eq(s, "[1,3]");
  12077   free(s);
  12078   // wrong object type
  12079   createSmallInt(I);
  12080   setValG(&I, 11);
  12081   r2 = self->f->pushSmallInt(self, &I);
  12082   r = cropElemAtBoolO(self,2);
  12083   ck_assert(!r);
  12084   s = toStringO(self);
  12085   ck_assert_str_eq(s, "[1,3,11]");
  12086   free(s);
  12087   // wrong object type of another user class
  12088   //   User classes are stored in containers transparently
  12089   createAllocateSmallInt(ip);
  12090   ip->type = "anothertype";
  12091   setValG(ip, 11);
  12092   r2 = self->f->push(self, (baset*)ip);
  12093   ck_assert_ptr_ne(r2, null);
  12094   r = cropElemAtBoolO(self,3);
  12095   ck_assert(!r);
  12096   s = toStringO(self);
  12097   ck_assert_str_eq(s, "[1,3,11,\"<data container>\"]");
  12098   free(s);
  12099   // index outside
  12100   ck_assert(!cropElemAtBoolO(self, 20));
  12101   ck_assert(!cropElemAtBoolO(self, -5));
  12102   // empty list
  12103   emptyO(self);
  12104   ck_assert(!cropElemAtBoolO(self, 0));
  12105   ck_assert(!cropElemAtBoolO(self, -1));
  12106   r2 = self->f->pushUndefined(self);
  12107   ck_assert_ptr_ne(r2, null);
  12108   delElemIndexO(self,-1);
  12109   r = cropElemAtBoolO(self, 0);
  12110   ck_assert(!r);
  12111   // non json array
  12112   freeO(self);
  12113   setTypeBoolO(self);
  12114   ck_assert(!cropElemAtBoolO(self, 0));
  12115   terminateO(self);
  12116 
  12117 END_TEST
  12118 
  12119 
  12120 START_TEST(cropElemAtDoubleSmallJsonT)
  12121 
  12122   double r;
  12123   smallJsont *self = allocSmallJson();
  12124   smallJsont *r2;
  12125 
  12126   // add elements to self
  12127   r2 = self->f->pushInt(self, 1);
  12128   ck_assert_ptr_ne(r2, null);
  12129   r2 = self->f->pushDouble(self, 2);
  12130   ck_assert_ptr_ne(r2, null);
  12131   r2 = self->f->pushInt(self, 3);
  12132   ck_assert_ptr_ne(r2, null);
  12133   r2 = self->f->pushDouble(self, 4);
  12134   ck_assert_ptr_ne(r2, null);
  12135 
  12136   // positive index
  12137   r       = cropElemAtDoubleO(self,1);
  12138   ck_assert(r==2);
  12139   char *s = toStringO(self);
  12140   ck_assert_str_eq(s, "[1,3,4.000000e+00]");
  12141   free(s);
  12142   // negative index
  12143   r = cropElemAtDoubleO(self,-1);
  12144   ck_assert(r==4);
  12145   s = toStringO(self);
  12146   ck_assert_str_eq(s, "[1,3]");
  12147   free(s);
  12148   // wrong object type
  12149   createSmallInt(I);
  12150   setValG(&I, 11);
  12151   r2 = self->f->pushSmallInt(self, &I);
  12152   r = cropElemAtDoubleO(self,2);
  12153   ck_assert(!r);
  12154   s = toStringO(self);
  12155   ck_assert_str_eq(s, "[1,3,11]");
  12156   free(s);
  12157   // wrong object type of another user class
  12158   //   User classes are stored in containers transparently
  12159   createAllocateSmallInt(ip);
  12160   ip->type = "anothertype";
  12161   setValG(ip, 11);
  12162   r2 = self->f->push(self, (baset*)ip);
  12163   ck_assert_ptr_ne(r2, null);
  12164   r = cropElemAtDoubleO(self,3);
  12165   ck_assert(!r);
  12166   s = toStringO(self);
  12167   ck_assert_str_eq(s, "[1,3,11,\"<data container>\"]");
  12168   free(s);
  12169   // index outside
  12170   ck_assert(!cropElemAtDoubleO(self, 20));
  12171   ck_assert(!cropElemAtDoubleO(self, -5));
  12172   // empty list
  12173   emptyO(self);
  12174   ck_assert(!cropElemAtDoubleO(self, 0));
  12175   ck_assert(!cropElemAtDoubleO(self, -1));
  12176   r2 = self->f->pushUndefined(self);
  12177   ck_assert_ptr_ne(r2, null);
  12178   delElemIndexO(self,-1);
  12179   r = cropElemAtDoubleO(self, 0);
  12180   ck_assert(!r);
  12181   // non json array
  12182   freeO(self);
  12183   setTypeBoolO(self);
  12184   ck_assert(!cropElemAtDoubleO(self, 0));
  12185   terminateO(self);
  12186 
  12187 END_TEST
  12188 
  12189 
  12190 START_TEST(cropElemAtIntSmallJsonT)
  12191 
  12192   int64_t r;
  12193   smallJsont *self = allocSmallJson();
  12194   smallJsont *r2;
  12195 
  12196   // add elements to self
  12197   r2 = self->f->pushInt(self, 1);
  12198   ck_assert_ptr_ne(r2, null);
  12199   r2 = self->f->pushInt(self, 2);
  12200   ck_assert_ptr_ne(r2, null);
  12201   r2 = self->f->pushInt(self, 3);
  12202   ck_assert_ptr_ne(r2, null);
  12203   r2 = self->f->pushInt(self, 4);
  12204   ck_assert_ptr_ne(r2, null);
  12205 
  12206   // positive index
  12207   r       = cropElemAtIntO(self,1);
  12208   ck_assert(r==2);
  12209   char *s = toStringO(self);
  12210   ck_assert_str_eq(s, "[1,3,4]");
  12211   free(s);
  12212   // negative index
  12213   r = cropElemAtIntO(self,-1);
  12214   ck_assert(r==4);
  12215   s = toStringO(self);
  12216   ck_assert_str_eq(s, "[1,3]");
  12217   free(s);
  12218   // wrong object type
  12219   createSmallDouble(I);
  12220   setValG(&I, 11);
  12221   r2 = self->f->pushSmallDouble(self, &I);
  12222   r = cropElemAtIntO(self,2);
  12223   ck_assert(!r);
  12224   s = toStringO(self);
  12225   ck_assert_str_eq(s, "[1,3,1.100000e+01]");
  12226   free(s);
  12227   // wrong object type of another user class
  12228   //   User classes are stored in containers transparently
  12229   createAllocateSmallInt(ip);
  12230   ip->type = "anothertype";
  12231   setValG(ip, 11);
  12232   r2 = self->f->push(self, (baset*)ip);
  12233   ck_assert_ptr_ne(r2, null);
  12234   r = cropElemAtIntO(self,3);
  12235   ck_assert(!r);
  12236   s = toStringO(self);
  12237   ck_assert_str_eq(s, "[1,3,1.100000e+01,\"<data container>\"]");
  12238   free(s);
  12239   // index outside
  12240   ck_assert(!cropElemAtIntO(self, 20));
  12241   ck_assert(!cropElemAtIntO(self, -5));
  12242   // empty list
  12243   emptyO(self);
  12244   ck_assert(!cropElemAtIntO(self, 0));
  12245   ck_assert(!cropElemAtIntO(self, -1));
  12246   r2 = self->f->pushUndefined(self);
  12247   ck_assert_ptr_ne(r2, null);
  12248   delElemIndexO(self,-1);
  12249   r = cropElemAtIntO(self, 0);
  12250   ck_assert(!r);
  12251   // non json array
  12252   freeO(self);
  12253   setTypeBoolO(self);
  12254   ck_assert(!cropElemAtO(self, 0));
  12255   terminateO(self);
  12256 
  12257 END_TEST
  12258 
  12259 
  12260 START_TEST(cropElemAtInt32SmallJsonT)
  12261 
  12262   int32_t r;
  12263   smallJsont *self = allocSmallJson();
  12264   smallJsont *r2;
  12265 
  12266   // add elements to self
  12267   r2 = self->f->pushInt(self, 1);
  12268   ck_assert_ptr_ne(r2, null);
  12269   r2 = self->f->pushInt(self, 2);
  12270   ck_assert_ptr_ne(r2, null);
  12271   r2 = self->f->pushInt(self, 3);
  12272   ck_assert_ptr_ne(r2, null);
  12273   r2 = self->f->pushInt(self, 4);
  12274   ck_assert_ptr_ne(r2, null);
  12275 
  12276   // positive index
  12277   r       = cropElemAtInt32O(self,1);
  12278   ck_assert(r==2);
  12279   char *s = toStringO(self);
  12280   ck_assert_str_eq(s, "[1,3,4]");
  12281   free(s);
  12282   // negative index
  12283   r = cropElemAtInt32O(self,-1);
  12284   ck_assert(r==4);
  12285   s = toStringO(self);
  12286   ck_assert_str_eq(s, "[1,3]");
  12287   free(s);
  12288   // wrong object type
  12289   createSmallDouble(I);
  12290   setValG(&I, 11);
  12291   r2 = self->f->pushSmallDouble(self, &I);
  12292   r = cropElemAtInt32O(self,2);
  12293   ck_assert(!r);
  12294   s = toStringO(self);
  12295   ck_assert_str_eq(s, "[1,3,1.100000e+01]");
  12296   free(s);
  12297   // wrong object type of another user class
  12298   //   User classes are stored in containers transparently
  12299   createAllocateSmallInt(ip);
  12300   ip->type = "anothertype";
  12301   setValG(ip, 11);
  12302   r2 = self->f->push(self, (baset*)ip);
  12303   ck_assert_ptr_ne(r2, null);
  12304   r = cropElemAtInt32O(self,3);
  12305   ck_assert(!r);
  12306   s = toStringO(self);
  12307   ck_assert_str_eq(s, "[1,3,1.100000e+01,\"<data container>\"]");
  12308   free(s);
  12309   // index outside
  12310   ck_assert(!cropElemAtInt32O(self, 20));
  12311   ck_assert(!cropElemAtInt32O(self, -5));
  12312   // empty list
  12313   emptyO(self);
  12314   ck_assert(!cropElemAtInt32O(self, 0));
  12315   ck_assert(!cropElemAtInt32O(self, -1));
  12316   r2 = self->f->pushUndefined(self);
  12317   ck_assert_ptr_ne(r2, null);
  12318   delElemIndexO(self,-1);
  12319   r = cropElemAtInt32O(self, 0);
  12320   ck_assert(!r);
  12321   // non json array
  12322   freeO(self);
  12323   setTypeBoolO(self);
  12324   ck_assert(!cropElemAtO(self, 0));
  12325   terminateO(self);
  12326 
  12327 END_TEST
  12328 
  12329 
  12330 START_TEST(cropElemAtUintSmallJsonT)
  12331 
  12332   uint64_t r;
  12333   smallJsont *self = allocSmallJson();
  12334   smallJsont *r2;
  12335 
  12336   // add elements to self
  12337   r2 = self->f->pushInt(self, 1);
  12338   ck_assert_ptr_ne(r2, null);
  12339   r2 = self->f->pushInt(self, 2);
  12340   ck_assert_ptr_ne(r2, null);
  12341   r2 = self->f->pushInt(self, 3);
  12342   ck_assert_ptr_ne(r2, null);
  12343   r2 = self->f->pushInt(self, 4);
  12344   ck_assert_ptr_ne(r2, null);
  12345 
  12346   // positive index
  12347   r       = cropElemAtUintO(self,1);
  12348   ck_assert(r==2);
  12349   char *s = toStringO(self);
  12350   ck_assert_str_eq(s, "[1,3,4]");
  12351   free(s);
  12352   // negative index
  12353   r = cropElemAtUintO(self,-1);
  12354   ck_assert(r==4);
  12355   s = toStringO(self);
  12356   ck_assert_str_eq(s, "[1,3]");
  12357   free(s);
  12358   // wrong object type
  12359   createSmallDouble(I);
  12360   setValG(&I, 11);
  12361   r2 = self->f->pushSmallDouble(self, &I);
  12362   r = cropElemAtUintO(self,2);
  12363   ck_assert(!r);
  12364   s = toStringO(self);
  12365   ck_assert_str_eq(s, "[1,3,1.100000e+01]");
  12366   free(s);
  12367   // wrong object type of another user class
  12368   //   User classes are stored in containers transparently
  12369   createAllocateSmallInt(ip);
  12370   ip->type = "anothertype";
  12371   setValG(ip, 11);
  12372   r2 = self->f->push(self, (baset*)ip);
  12373   ck_assert_ptr_ne(r2, null);
  12374   r = cropElemAtUintO(self,3);
  12375   ck_assert(!r);
  12376   s = toStringO(self);
  12377   ck_assert_str_eq(s, "[1,3,1.100000e+01,\"<data container>\"]");
  12378   free(s);
  12379   // index outside
  12380   ck_assert(!cropElemAtUintO(self, 20));
  12381   ck_assert(!cropElemAtUintO(self, -5));
  12382   // empty list
  12383   emptyO(self);
  12384   ck_assert(!cropElemAtUintO(self, 0));
  12385   ck_assert(!cropElemAtUintO(self, -1));
  12386   r2 = self->f->pushUndefined(self);
  12387   ck_assert_ptr_ne(r2, null);
  12388   delElemIndexO(self,-1);
  12389   r = cropElemAtUintO(self, 0);
  12390   ck_assert(!r);
  12391   // non json array
  12392   freeO(self);
  12393   setTypeBoolO(self);
  12394   ck_assert(!cropElemAtUintO(self, 0));
  12395   terminateO(self);
  12396 
  12397 END_TEST
  12398 
  12399 
  12400 START_TEST(cropElemAtUint32SmallJsonT)
  12401 
  12402   uint32_t r;
  12403   smallJsont *self = allocSmallJson();
  12404   smallJsont *r2;
  12405 
  12406   // add elements to self
  12407   r2 = self->f->pushInt(self, 1);
  12408   ck_assert_ptr_ne(r2, null);
  12409   r2 = self->f->pushInt(self, 2);
  12410   ck_assert_ptr_ne(r2, null);
  12411   r2 = self->f->pushInt(self, 3);
  12412   ck_assert_ptr_ne(r2, null);
  12413   r2 = self->f->pushInt(self, 4);
  12414   ck_assert_ptr_ne(r2, null);
  12415 
  12416   // positive index
  12417   r       = cropElemAtUint32O(self,1);
  12418   ck_assert(r==2);
  12419   char *s = toStringO(self);
  12420   ck_assert_str_eq(s, "[1,3,4]");
  12421   free(s);
  12422   // negative index
  12423   r = cropElemAtUint32O(self,-1);
  12424   ck_assert(r==4);
  12425   s = toStringO(self);
  12426   ck_assert_str_eq(s, "[1,3]");
  12427   free(s);
  12428   // wrong object type
  12429   createSmallDouble(I);
  12430   setValG(&I, 11);
  12431   r2 = self->f->pushSmallDouble(self, &I);
  12432   r = cropElemAtUint32O(self,2);
  12433   ck_assert(!r);
  12434   s = toStringO(self);
  12435   ck_assert_str_eq(s, "[1,3,1.100000e+01]");
  12436   free(s);
  12437   // wrong object type of another user class
  12438   //   User classes are stored in containers transparently
  12439   createAllocateSmallInt(ip);
  12440   ip->type = "anothertype";
  12441   setValG(ip, 11);
  12442   r2 = self->f->push(self, (baset*)ip);
  12443   ck_assert_ptr_ne(r2, null);
  12444   r = cropElemAtUint32O(self,3);
  12445   ck_assert(!r);
  12446   s = toStringO(self);
  12447   ck_assert_str_eq(s, "[1,3,1.100000e+01,\"<data container>\"]");
  12448   free(s);
  12449   // index outside
  12450   ck_assert(!cropElemAtUint32O(self, 20));
  12451   ck_assert(!cropElemAtUint32O(self, -5));
  12452   // empty list
  12453   emptyO(self);
  12454   ck_assert(!cropElemAtUint32O(self, 0));
  12455   ck_assert(!cropElemAtUint32O(self, -1));
  12456   r2 = self->f->pushUndefined(self);
  12457   ck_assert_ptr_ne(r2, null);
  12458   delElemIndexO(self,-1);
  12459   r = cropElemAtUint32O(self, 0);
  12460   ck_assert(!r);
  12461   // non json array
  12462   freeO(self);
  12463   setTypeBoolO(self);
  12464   ck_assert(!cropElemAtUint32O(self, 0));
  12465   terminateO(self);
  12466 
  12467 END_TEST
  12468 
  12469 
  12470 START_TEST(cropElemAtSSmallJsonT)
  12471 
  12472   char* r;
  12473   smallJsont *self = allocSmallJson();
  12474   smallJsont *r2;
  12475 
  12476   // add elements to self
  12477   r2 = self->f->pushInt(self, 1);
  12478   ck_assert_ptr_ne(r2, null);
  12479   r2 = self->f->pushS(self, "2");
  12480   ck_assert_ptr_ne(r2, null);
  12481   r2 = self->f->pushInt(self, 3);
  12482   ck_assert_ptr_ne(r2, null);
  12483   r2 = self->f->pushS(self, "4");
  12484   ck_assert_ptr_ne(r2, null);
  12485 
  12486   // positive index
  12487   r       = cropElemAtSO(self,1);
  12488   ck_assert_ptr_ne(r, null);
  12489   ck_assert_str_eq(r, "2");
  12490   free(r);
  12491   char *s = toStringO(self);
  12492   ck_assert_str_eq(s, "[1,3,\"4\"]");
  12493   free(s);
  12494   // negative index
  12495   r = cropElemAtSO(self,-1);
  12496   ck_assert_ptr_ne(r, null);
  12497   ck_assert_str_eq(r, "4");
  12498   free(r);
  12499   s = toStringO(self);
  12500   ck_assert_str_eq(s, "[1,3]");
  12501   free(s);
  12502   // wrong object type
  12503   createSmallInt(I);
  12504   setValG(&I, 11);
  12505   r2 = self->f->pushSmallInt(self, &I);
  12506   r = cropElemAtSO(self,2);
  12507   ck_assert_ptr_eq(r, NULL);
  12508   s = toStringO(self);
  12509   ck_assert_str_eq(s, "[1,3,11]");
  12510   free(s);
  12511   // wrong object type of another user class
  12512   //   User classes are stored in containers transparently
  12513   createAllocateSmallInt(ip);
  12514   ip->type = "anothertype";
  12515   setValG(ip, 11);
  12516   r2 = self->f->push(self, (baset*)ip);
  12517   ck_assert_ptr_ne(r2, null);
  12518   r = cropElemAtSO(self,3);
  12519   ck_assert_ptr_eq(r, NULL);
  12520   s = toStringO(self);
  12521   ck_assert_str_eq(s, "[1,3,11,\"<data container>\"]");
  12522   free(s);
  12523   // index outside
  12524   ck_assert_ptr_eq(cropElemAtSO(self, 20), NULL);
  12525   ck_assert_ptr_eq(cropElemAtSO(self, -5), NULL);
  12526   // empty list
  12527   emptyO(self);
  12528   ck_assert_ptr_eq(cropElemAtSO(self, 0), NULL);
  12529   ck_assert_ptr_eq(cropElemAtSO(self, -1), NULL);
  12530   r2 = self->f->pushUndefined(self);
  12531   ck_assert_ptr_ne(r2, null);
  12532   delElemIndexO(self,-1);
  12533   r = cropElemAtSO(self, 0);
  12534   ck_assert_ptr_eq(r, null);
  12535   // non json array
  12536   freeO(self);
  12537   setTypeBoolO(self);
  12538   ck_assert_ptr_eq(cropElemAtSO(self, 0), NULL);
  12539   terminateO(self);
  12540 
  12541 END_TEST
  12542 
  12543 
  12544 START_TEST(cropElemAtCharSmallJsonT)
  12545 
  12546   char r;
  12547   smallJsont *self = allocSmallJson();
  12548   setTopSO(self, "");
  12549 
  12550   // crop
  12551   freeO(self);
  12552   setTopSO(self, "sheepy");
  12553   r = cropElemAtCharO(self, 0);
  12554   ck_assert_int_eq(r, 's');
  12555   ck_assert_str_eq(sjGet(self), "heepy");
  12556   freeO(self);
  12557   setTopSO(self, "sheepy");
  12558   r = cropElemAtCharO(self, 5);
  12559   ck_assert_int_eq(r, 'y');
  12560   ck_assert_str_eq(sjGet(self), "sheep");
  12561   // negative index
  12562   freeO(self);
  12563   setTopSO(self, "sheepy");
  12564   r = cropElemAtCharO(self, -1);
  12565   ck_assert_int_eq(r, 'y');
  12566   ck_assert_str_eq(sjGet(self), "sheep");
  12567   freeO(self);
  12568   setTopSO(self, "sheepy");
  12569   r = cropElemAtCharO(self, -6);
  12570   ck_assert_int_eq(r, 's');
  12571   ck_assert_str_eq(sjGet(self), "heepy");
  12572   // index outside string
  12573   freeO(self);
  12574   setTopSO(self, "sheepy");
  12575   r = cropElemAtCharO(self, 6);
  12576   ck_assert_int_eq(r, 0);
  12577   ck_assert_str_eq(sjGet(self), "sheepy");
  12578   freeO(self);
  12579   setTopSO(self, "sheepy");
  12580   r = cropElemAtCharO(self, -7);
  12581   ck_assert_int_eq(r, 0);
  12582   ck_assert_str_eq(sjGet(self), "sheepy");
  12583   // null string
  12584   freeO(self);
  12585   ck_assert_int_eq(cropElemAtCharO(self, 0), 0);
  12586   terminateO(self);
  12587 
  12588 END_TEST
  12589 
  12590 
  12591 START_TEST(cropElemAtDictSmallJsonT)
  12592 
  12593   smallDictt* r;
  12594   smallJsont *self = allocSmallJson();
  12595   smallJsont *r2;
  12596 
  12597   // add elements to self
  12598   r2 = self->f->pushInt(self, 1);
  12599   ck_assert_ptr_ne(r2, null);
  12600   createSmallDict(e2);
  12601   r2 = self->f->pushDict(self, &e2);
  12602   ck_assert_ptr_ne(r2, null);
  12603   r2 = self->f->pushInt(self, 3);
  12604   ck_assert_ptr_ne(r2, null);
  12605   createSmallDict(e4);
  12606   r2 = self->f->pushDict(self, &e4);
  12607   ck_assert_ptr_ne(r2, null);
  12608 
  12609   // positive index
  12610   r       = cropElemAtDictO(self,1);
  12611   ck_assert_ptr_ne(r, null);
  12612   char *s = toStringO(r);
  12613   terminateO(r);
  12614   ck_assert_str_eq(s, "{}");
  12615   free(s);
  12616   s = toStringO(self);
  12617   ck_assert_str_eq(s, "[1,3,{}]");
  12618   free(s);
  12619   // negative index
  12620   r = cropElemAtDictO(self,-1);
  12621   ck_assert_ptr_ne(r, null);
  12622   s = toStringO(r);
  12623   terminateO(r);
  12624   ck_assert_str_eq(s, "{}");
  12625   free(s);
  12626   s = toStringO(self);
  12627   ck_assert_str_eq(s, "[1,3]");
  12628   free(s);
  12629   // wrong object type
  12630   createSmallInt(I);
  12631   setValG(&I, 11);
  12632   r2 = self->f->pushSmallInt(self, &I);
  12633   r = cropElemAtDictO(self,2);
  12634   ck_assert_ptr_eq(r, NULL);
  12635   s = toStringO(self);
  12636   ck_assert_str_eq(s, "[1,3,11]");
  12637   free(s);
  12638   // wrong object type of another user class
  12639   //   User classes are stored in containers transparently
  12640   createAllocateSmallInt(ip);
  12641   ip->type = "anothertype";
  12642   setValG(ip, 11);
  12643   r2 = self->f->push(self, (baset*)ip);
  12644   ck_assert_ptr_ne(r2, null);
  12645   r = cropElemAtDictO(self,3);
  12646   ck_assert_ptr_eq(r, NULL);
  12647   s = toStringO(self);
  12648   ck_assert_str_eq(s, "[1,3,11,\"<data container>\"]");
  12649   free(s);
  12650   // index outside
  12651   ck_assert_ptr_eq(cropElemAtDictO(self, 20), NULL);
  12652   ck_assert_ptr_eq(cropElemAtDictO(self, -5), NULL);
  12653   // empty list
  12654   emptyO(self);
  12655   ck_assert_ptr_eq(cropElemAtDictO(self, 0), NULL);
  12656   ck_assert_ptr_eq(cropElemAtDictO(self, -1), NULL);
  12657   r2 = self->f->pushUndefined(self);
  12658   ck_assert_ptr_ne(r2, null);
  12659   delElemIndexO(self,-1);
  12660   r = cropElemAtDictO(self, 0);
  12661   ck_assert_ptr_eq(r, null);
  12662   // non json array
  12663   freeO(self);
  12664   setTypeBoolO(self);
  12665   ck_assert_ptr_eq(cropElemAtDictO(self, 0), NULL);
  12666   terminateO(self);
  12667 
  12668 END_TEST
  12669 
  12670 
  12671 START_TEST(cropElemAtArraySmallJsonT)
  12672 
  12673   smallArrayt* r;
  12674   smallJsont *self = allocSmallJson();
  12675   smallJsont *r2;
  12676 
  12677   // add elements to self
  12678   r2 = self->f->pushInt(self, 1);
  12679   ck_assert_ptr_ne(r2, null);
  12680   createSmallArray(e2);
  12681   r2 = self->f->pushArray(self, &e2);
  12682   ck_assert_ptr_ne(r2, null);
  12683   r2 = self->f->pushInt(self, 3);
  12684   ck_assert_ptr_ne(r2, null);
  12685   createSmallArray(e4);
  12686   r2 = self->f->pushArray(self, &e4);
  12687   ck_assert_ptr_ne(r2, null);
  12688 
  12689   // positive index
  12690   r       = cropElemAtArrayO(self,1);
  12691   ck_assert_ptr_ne(r, null);
  12692   char *s = toStringO(r);
  12693   terminateO(r);
  12694   ck_assert_str_eq(s, "[]");
  12695   free(s);
  12696   s = toStringO(self);
  12697   ck_assert_str_eq(s, "[1,3,[]]");
  12698   free(s);
  12699   // negative index
  12700   r = cropElemAtArrayO(self,-1);
  12701   ck_assert_ptr_ne(r, null);
  12702   s = toStringO(r);
  12703   terminateO(r);
  12704   ck_assert_str_eq(s, "[]");
  12705   free(s);
  12706   s = toStringO(self);
  12707   ck_assert_str_eq(s, "[1,3]");
  12708   free(s);
  12709   // wrong object type
  12710   createSmallInt(I);
  12711   setValG(&I, 11);
  12712   r2 = self->f->pushSmallInt(self, &I);
  12713   r = cropElemAtArrayO(self,2);
  12714   ck_assert_ptr_eq(r, NULL);
  12715   s = toStringO(self);
  12716   ck_assert_str_eq(s, "[1,3,11]");
  12717   free(s);
  12718   // wrong object type of another user class
  12719   //   User classes are stored in containers transparently
  12720   createAllocateSmallInt(ip);
  12721   ip->type = "anothertype";
  12722   setValG(ip, 11);
  12723   r2 = self->f->push(self, (baset*)ip);
  12724   ck_assert_ptr_ne(r2, null);
  12725   r = cropElemAtArrayO(self,3);
  12726   ck_assert_ptr_eq(r, NULL);
  12727   s = toStringO(self);
  12728   ck_assert_str_eq(s, "[1,3,11,\"<data container>\"]");
  12729   free(s);
  12730   // index outside
  12731   ck_assert_ptr_eq(cropElemAtArrayO(self, 20), NULL);
  12732   ck_assert_ptr_eq(cropElemAtArrayO(self, -5), NULL);
  12733   // empty list
  12734   emptyO(self);
  12735   ck_assert_ptr_eq(cropElemAtArrayO(self, 0), NULL);
  12736   ck_assert_ptr_eq(cropElemAtArrayO(self, -1), NULL);
  12737   r2 = self->f->pushUndefined(self);
  12738   ck_assert_ptr_ne(r2, null);
  12739   delElemIndexO(self,-1);
  12740   r = cropElemAtArrayO(self, 0);
  12741   ck_assert_ptr_eq(r, null);
  12742   // non json array
  12743   freeO(self);
  12744   setTypeBoolO(self);
  12745   ck_assert_ptr_eq(cropElemAtArrayO(self, 0), NULL);
  12746   terminateO(self);
  12747 
  12748 END_TEST
  12749 
  12750 
  12751 START_TEST(cropElemAtSmallBoolSmallJsonT)
  12752 
  12753   smallBoolt* r;
  12754   smallJsont *self = allocSmallJson();
  12755   smallJsont *r2;
  12756 
  12757   // add elements to self
  12758   r2 = self->f->pushInt(self, 1);
  12759   ck_assert_ptr_ne(r2, null);
  12760   createSmallBool(e2);
  12761   r2 = self->f->pushBool(self, true);
  12762   ck_assert_ptr_ne(r2, null);
  12763   r2 = self->f->pushInt(self, 3);
  12764   ck_assert_ptr_ne(r2, null);
  12765   createSmallBool(e4);
  12766   r2 = self->f->pushBool(self, true);
  12767   ck_assert_ptr_ne(r2, null);
  12768 
  12769   // positive index
  12770   r       = cropElemAtSmallBoolO(self,1);
  12771   ck_assert_ptr_ne(r, null);
  12772   char *s = toStringO(r);
  12773   terminateO(r);
  12774   ck_assert_str_eq(s, "true");
  12775   free(s);
  12776   s = toStringO(self);
  12777   ck_assert_str_eq(s, "[1,3,true]");
  12778   free(s);
  12779   // negative index
  12780   r = cropElemAtSmallBoolO(self,-1);
  12781   ck_assert_ptr_ne(r, null);
  12782   s = toStringO(r);
  12783   terminateO(r);
  12784   ck_assert_str_eq(s, "true");
  12785   free(s);
  12786   s = toStringO(self);
  12787   ck_assert_str_eq(s, "[1,3]");
  12788   free(s);
  12789   // wrong object type
  12790   createSmallInt(I);
  12791   setValG(&I, 11);
  12792   r2 = self->f->pushSmallInt(self, &I);
  12793   r = cropElemAtSmallBoolO(self,2);
  12794   ck_assert_ptr_eq(r, NULL);
  12795   s = toStringO(self);
  12796   ck_assert_str_eq(s, "[1,3,11]");
  12797   free(s);
  12798   // wrong object type of another user class
  12799   //   User classes are stored in containers transparently
  12800   createAllocateSmallInt(ip);
  12801   ip->type = "anothertype";
  12802   setValG(ip, 11);
  12803   r2 = self->f->push(self, (baset*)ip);
  12804   ck_assert_ptr_ne(r2, null);
  12805   r = cropElemAtSmallBoolO(self,3);
  12806   ck_assert_ptr_eq(r, NULL);
  12807   s = toStringO(self);
  12808   ck_assert_str_eq(s, "[1,3,11,\"<data container>\"]");
  12809   free(s);
  12810   // index outside
  12811   ck_assert_ptr_eq(cropElemAtSmallBoolO(self, 20), NULL);
  12812   ck_assert_ptr_eq(cropElemAtSmallBoolO(self, -5), NULL);
  12813   // empty list
  12814   emptyO(self);
  12815   ck_assert_ptr_eq(cropElemAtSmallBoolO(self, 0), NULL);
  12816   ck_assert_ptr_eq(cropElemAtSmallBoolO(self, -1), NULL);
  12817   r2 = self->f->pushUndefined(self);
  12818   ck_assert_ptr_ne(r2, null);
  12819   delElemIndexO(self,-1);
  12820   r = cropElemAtSmallBoolO(self, 0);
  12821   ck_assert_ptr_eq(r, null);
  12822   // non json array
  12823   freeO(self);
  12824   setTypeBoolO(self);
  12825   ck_assert_ptr_eq(cropElemAtSmallBoolO(self, 0), NULL);
  12826   terminateO(self);
  12827 
  12828 END_TEST
  12829 
  12830 
  12831 START_TEST(cropElemAtSmallBytesSmallJsonT)
  12832 
  12833   smallBytest* r;
  12834   smallJsont *self = allocSmallJson();
  12835   smallJsont *r2;
  12836 
  12837   // add elements to self
  12838   r2 = self->f->pushInt(self, 1);
  12839   ck_assert_ptr_ne(r2, null);
  12840   createSmallBytes(e2);
  12841   r2 = self->f->pushSmallBytes(self, &e2);
  12842   ck_assert_ptr_ne(r2, null);
  12843   r2 = self->f->pushInt(self, 3);
  12844   ck_assert_ptr_ne(r2, null);
  12845   createSmallBytes(e4);
  12846   r2 = self->f->pushSmallBytes(self, &e4);
  12847   ck_assert_ptr_ne(r2, null);
  12848 
  12849   // positive index
  12850   r       = cropElemAtSmallBytesO(self,1);
  12851   ck_assert_ptr_ne(r, null);
  12852   char *s = toStringO(r);
  12853   terminateO(r);
  12854   ck_assert_str_eq(s, "[]");
  12855   free(s);
  12856   s = toStringO(self);
  12857   ck_assert_str_eq(s, "[1,3,[]]");
  12858   free(s);
  12859   // negative index
  12860   r = cropElemAtSmallBytesO(self,-1);
  12861   ck_assert_ptr_ne(r, null);
  12862   s = toStringO(r);
  12863   terminateO(r);
  12864   ck_assert_str_eq(s, "[]");
  12865   free(s);
  12866   s = toStringO(self);
  12867   ck_assert_str_eq(s, "[1,3]");
  12868   free(s);
  12869   // wrong object type
  12870   createSmallInt(I);
  12871   setValG(&I, 11);
  12872   r2 = self->f->pushSmallInt(self, &I);
  12873   r = cropElemAtSmallBytesO(self,2);
  12874   ck_assert_ptr_eq(r, NULL);
  12875   s = toStringO(self);
  12876   ck_assert_str_eq(s, "[1,3,11]");
  12877   free(s);
  12878   // wrong object type of another user class
  12879   //   User classes are stored in containers transparently
  12880   createAllocateSmallInt(ip);
  12881   ip->type = "anothertype";
  12882   setValG(ip, 11);
  12883   r2 = self->f->push(self, (baset*)ip);
  12884   ck_assert_ptr_ne(r2, null);
  12885   r = cropElemAtSmallBytesO(self,3);
  12886   ck_assert_ptr_eq(r, NULL);
  12887   s = toStringO(self);
  12888   ck_assert_str_eq(s, "[1,3,11,\"<data container>\"]");
  12889   free(s);
  12890   // index outside
  12891   ck_assert_ptr_eq(cropElemAtSmallBytesO(self, 20), NULL);
  12892   ck_assert_ptr_eq(cropElemAtSmallBytesO(self, -5), NULL);
  12893   // empty list
  12894   emptyO(self);
  12895   ck_assert_ptr_eq(cropElemAtSmallBytesO(self, 0), NULL);
  12896   ck_assert_ptr_eq(cropElemAtSmallBytesO(self, -1), NULL);
  12897   r2 = self->f->pushUndefined(self);
  12898   ck_assert_ptr_ne(r2, null);
  12899   delElemIndexO(self,-1);
  12900   r = cropElemAtSmallBytesO(self, 0);
  12901   ck_assert_ptr_eq(r, null);
  12902   // non json array
  12903   freeO(self);
  12904   setTypeBoolO(self);
  12905   ck_assert_ptr_eq(cropElemAtSmallBytesO(self, 0), NULL);
  12906   terminateO(self);
  12907 
  12908 END_TEST
  12909 
  12910 
  12911 START_TEST(cropElemAtSmallDoubleSmallJsonT)
  12912 
  12913   smallDoublet* r;
  12914   smallJsont *self = allocSmallJson();
  12915   smallJsont *r2;
  12916 
  12917   // add elements to self
  12918   r2 = self->f->pushInt(self, 1);
  12919   ck_assert_ptr_ne(r2, null);
  12920   createSmallDouble(e2);
  12921   r2 = self->f->pushSmallDouble(self, &e2);
  12922   ck_assert_ptr_ne(r2, null);
  12923   r2 = self->f->pushInt(self, 3);
  12924   ck_assert_ptr_ne(r2, null);
  12925   createSmallDouble(e4);
  12926   r2 = self->f->pushSmallDouble(self, &e4);
  12927   ck_assert_ptr_ne(r2, null);
  12928 
  12929   // positive index
  12930   r       = cropElemAtSmallDoubleO(self,1);
  12931   ck_assert_ptr_ne(r, null);
  12932   char *s = toStringO(r);
  12933   terminateO(r);
  12934   ck_assert_str_eq(s, "0.000000e+00");
  12935   free(s);
  12936   s = toStringO(self);
  12937   ck_assert_str_eq(s, "[1,3,0.000000e+00]");
  12938   free(s);
  12939   // negative index
  12940   r = cropElemAtSmallDoubleO(self,-1);
  12941   ck_assert_ptr_ne(r, null);
  12942   s = toStringO(r);
  12943   terminateO(r);
  12944   ck_assert_str_eq(s, "0.000000e+00");
  12945   free(s);
  12946   s = toStringO(self);
  12947   ck_assert_str_eq(s, "[1,3]");
  12948   free(s);
  12949   // wrong object type
  12950   createSmallInt(I);
  12951   setValG(&I, 11);
  12952   r2 = self->f->pushSmallInt(self, &I);
  12953   r = cropElemAtSmallDoubleO(self,2);
  12954   ck_assert_ptr_eq(r, NULL);
  12955   s = toStringO(self);
  12956   ck_assert_str_eq(s, "[1,3,11]");
  12957   free(s);
  12958   // wrong object type of another user class
  12959   //   User classes are stored in containers transparently
  12960   createAllocateSmallInt(ip);
  12961   ip->type = "anothertype";
  12962   setValG(ip, 11);
  12963   r2 = self->f->push(self, (baset*)ip);
  12964   ck_assert_ptr_ne(r2, null);
  12965   r = cropElemAtSmallDoubleO(self,3);
  12966   ck_assert_ptr_eq(r, NULL);
  12967   s = toStringO(self);
  12968   ck_assert_str_eq(s, "[1,3,11,\"<data container>\"]");
  12969   free(s);
  12970   // index outside
  12971   ck_assert_ptr_eq(cropElemAtSmallDoubleO(self, 20), NULL);
  12972   ck_assert_ptr_eq(cropElemAtSmallDoubleO(self, -5), NULL);
  12973   // empty list
  12974   emptyO(self);
  12975   ck_assert_ptr_eq(cropElemAtSmallDoubleO(self, 0), NULL);
  12976   ck_assert_ptr_eq(cropElemAtSmallDoubleO(self, -1), NULL);
  12977   r2 = self->f->pushUndefined(self);
  12978   ck_assert_ptr_ne(r2, null);
  12979   delElemIndexO(self,-1);
  12980   r = cropElemAtSmallDoubleO(self, 0);
  12981   ck_assert_ptr_eq(r, null);
  12982   // non json array
  12983   freeO(self);
  12984   setTypeBoolO(self);
  12985   ck_assert_ptr_eq(cropElemAtSmallDoubleO(self, 0), NULL);
  12986   terminateO(self);
  12987 
  12988 END_TEST
  12989 
  12990 
  12991 START_TEST(cropElemAtSmallIntSmallJsonT)
  12992 
  12993   smallIntt* r;
  12994   smallJsont *self = allocSmallJson();
  12995   smallJsont *r2;
  12996 
  12997   // add elements to self
  12998   r2 = self->f->pushBool(self, true);
  12999   ck_assert_ptr_ne(r2, null);
  13000   createSmallInt(e2);
  13001   r2 = self->f->pushSmallInt(self, &e2);
  13002   ck_assert_ptr_ne(r2, null);
  13003   r2 = self->f->pushBool(self, true);
  13004   ck_assert_ptr_ne(r2, null);
  13005   createSmallInt(e4);
  13006   r2 = self->f->pushSmallInt(self, &e4);
  13007   ck_assert_ptr_ne(r2, null);
  13008 
  13009   // positive index
  13010   r       = cropElemAtSmallIntO(self,1);
  13011   ck_assert_ptr_ne(r, null);
  13012   char *s = toStringO(r);
  13013   terminateO(r);
  13014   ck_assert_str_eq(s, "0");
  13015   free(s);
  13016   s = toStringO(self);
  13017   ck_assert_str_eq(s, "[true,true,0]");
  13018   free(s);
  13019   // negative index
  13020   r = cropElemAtSmallIntO(self,-1);
  13021   ck_assert_ptr_ne(r, null);
  13022   s = toStringO(r);
  13023   terminateO(r);
  13024   ck_assert_str_eq(s, "0");
  13025   free(s);
  13026   s = toStringO(self);
  13027   ck_assert_str_eq(s, "[true,true]");
  13028   free(s);
  13029   // wrong object type
  13030   createSmallDouble(I);
  13031   setValG(&I, 11);
  13032   r2 = self->f->pushSmallDouble(self, &I);
  13033   r = cropElemAtSmallIntO(self,2);
  13034   ck_assert_ptr_eq(r, NULL);
  13035   s = toStringO(self);
  13036   ck_assert_str_eq(s, "[true,true,1.100000e+01]");
  13037   free(s);
  13038   // wrong object type of another user class
  13039   //   User classes are stored in containers transparently
  13040   createAllocateSmallInt(ip);
  13041   ip->type = "anothertype";
  13042   setValG(ip, 11);
  13043   r2 = self->f->push(self, (baset*)ip);
  13044   ck_assert_ptr_ne(r2, null);
  13045   r = cropElemAtSmallIntO(self,3);
  13046   ck_assert_ptr_eq(r, NULL);
  13047   s = toStringO(self);
  13048   ck_assert_str_eq(s, "[true,true,1.100000e+01,\"<data container>\"]");
  13049   free(s);
  13050   // index outside
  13051   ck_assert_ptr_eq(cropElemAtSmallIntO(self, 20), NULL);
  13052   ck_assert_ptr_eq(cropElemAtSmallIntO(self, -5), NULL);
  13053   // empty list
  13054   emptyO(self);
  13055   ck_assert_ptr_eq(cropElemAtSmallIntO(self, 0), NULL);
  13056   ck_assert_ptr_eq(cropElemAtSmallIntO(self, -1), NULL);
  13057   r2 = self->f->pushUndefined(self);
  13058   ck_assert_ptr_ne(r2, null);
  13059   delElemIndexO(self,-1);
  13060   r = cropElemAtSmallIntO(self, 0);
  13061   ck_assert_ptr_eq(r, null);
  13062   // non json array
  13063   freeO(self);
  13064   setTypeBoolO(self);
  13065   ck_assert_ptr_eq(cropElemAtSmallIntO(self, 0), NULL);
  13066   terminateO(self);
  13067 
  13068 END_TEST
  13069 
  13070 
  13071 START_TEST(cropElemAtSmallJsonSmallJsonT)
  13072 
  13073   smallJsont* r;
  13074   smallJsont *self = allocSmallJson();
  13075   smallJsont *r2;
  13076 
  13077   // add elements to self
  13078   r2 = self->f->pushInt(self, 1);
  13079   ck_assert_ptr_ne(r2, null);
  13080   createSmallJson(e2);
  13081   r2 = self->f->pushSmallJson(self, &e2);
  13082   ck_assert_ptr_ne(r2, null);
  13083   r2 = self->f->pushInt(self, 3);
  13084   ck_assert_ptr_ne(r2, null);
  13085   createSmallJson(e4);
  13086   r2 = self->f->pushSmallJson(self, &e4);
  13087   ck_assert_ptr_ne(r2, null);
  13088 
  13089   // positive index
  13090   r       = cropElemAtSmallJsonO(self,1);
  13091   ck_assert_ptr_ne(r, null);
  13092   char *s = toStringO(r);
  13093   terminateO(r);
  13094   ck_assert_str_eq(s, "{}");
  13095   free(s);
  13096   s = toStringO(self);
  13097   ck_assert_str_eq(s, "[1,3,{}]");
  13098   free(s);
  13099   // negative index
  13100   r = cropElemAtSmallJsonO(self,-1);
  13101   ck_assert_ptr_ne(r, null);
  13102   s = toStringO(r);
  13103   terminateO(r);
  13104   ck_assert_str_eq(s, "{}");
  13105   free(s);
  13106   s = toStringO(self);
  13107   ck_assert_str_eq(s, "[1,3]");
  13108   free(s);
  13109   // wrong object type
  13110   createSmallBytes(I);
  13111   r2 = self->f->pushSmallBytes(self, &I);
  13112   r = cropElemAtSmallJsonO(self,2);
  13113   ck_assert_ptr_eq(r, NULL);
  13114   s = toStringO(self);
  13115   ck_assert_str_eq(s, "[1,3,[]]");
  13116   free(s);
  13117   // wrong object type of another user class
  13118   //   User classes are stored in containers transparently
  13119   createAllocateSmallInt(ip);
  13120   ip->type = "anothertype";
  13121   setValG(ip, 11);
  13122   r2 = self->f->push(self, (baset*)ip);
  13123   ck_assert_ptr_ne(r2, null);
  13124   r = cropElemAtSmallJsonO(self,3);
  13125   ck_assert_ptr_eq(r, NULL);
  13126   s = toStringO(self);
  13127   ck_assert_str_eq(s, "[1,3,[],\"<data container>\"]");
  13128   free(s);
  13129   // index outside
  13130   ck_assert_ptr_eq(cropElemAtSmallJsonO(self, 20), NULL);
  13131   ck_assert_ptr_eq(cropElemAtSmallJsonO(self, -5), NULL);
  13132   // empty list
  13133   emptyO(self);
  13134   ck_assert_ptr_eq(cropElemAtSmallJsonO(self, 0), NULL);
  13135   ck_assert_ptr_eq(cropElemAtSmallJsonO(self, -1), NULL);
  13136   r2 = self->f->pushUndefined(self);
  13137   ck_assert_ptr_ne(r2, null);
  13138   delElemIndexO(self,-1);
  13139   r = cropElemAtSmallJsonO(self, 0);
  13140   ck_assert_ptr_eq(r, null);
  13141   // non json array
  13142   freeO(self);
  13143   setTypeBoolO(self);
  13144   ck_assert_ptr_eq(cropElemAtSmallJsonO(self, 0), NULL);
  13145   terminateO(self);
  13146 
  13147 END_TEST
  13148 
  13149 
  13150 START_TEST(cropElemAtSmallStringSmallJsonT)
  13151 
  13152   smallStringt* r;
  13153   smallJsont *self = allocSmallJson();
  13154   smallJsont *r2;
  13155 
  13156   // add elements to self
  13157   r2 = self->f->pushInt(self, 1);
  13158   ck_assert_ptr_ne(r2, null);
  13159   createSmallString(e2);
  13160   r2 = self->f->pushSmallString(self, &e2);
  13161   ck_assert_ptr_ne(r2, null);
  13162   r2 = self->f->pushInt(self, 3);
  13163   ck_assert_ptr_ne(r2, null);
  13164   createSmallString(e4);
  13165   r2 = self->f->pushSmallString(self, &e4);
  13166   ck_assert_ptr_ne(r2, null);
  13167 
  13168   // positive index
  13169   r       = cropElemAtSmallStringO(self,1);
  13170   ck_assert_ptr_ne(r, null);
  13171   char *s = toStringO(r);
  13172   terminateO(r);
  13173   ck_assert_str_eq(s, "");
  13174   free(s);
  13175   s = toStringO(self);
  13176   ck_assert_str_eq(s, "[1,3,\"\"]");
  13177   free(s);
  13178   // negative index
  13179   r = cropElemAtSmallStringO(self,-1);
  13180   ck_assert_ptr_ne(r, null);
  13181   s = toStringO(r);
  13182   terminateO(r);
  13183   ck_assert_str_eq(s, "");
  13184   free(s);
  13185   s = toStringO(self);
  13186   ck_assert_str_eq(s, "[1,3]");
  13187   free(s);
  13188   // wrong object type
  13189   createSmallInt(I);
  13190   setValG(&I, 11);
  13191   r2 = self->f->pushSmallInt(self, &I);
  13192   r = cropElemAtSmallStringO(self,2);
  13193   ck_assert_ptr_eq(r, NULL);
  13194   s = toStringO(self);
  13195   ck_assert_str_eq(s, "[1,3,11]");
  13196   free(s);
  13197   // wrong object type of another user class
  13198   //   User classes are stored in containers transparently
  13199   createAllocateSmallInt(ip);
  13200   ip->type = "anothertype";
  13201   setValG(ip, 11);
  13202   r2 = self->f->push(self, (baset*)ip);
  13203   ck_assert_ptr_ne(r2, null);
  13204   r = cropElemAtSmallStringO(self,3);
  13205   ck_assert_ptr_eq(r, NULL);
  13206   s = toStringO(self);
  13207   ck_assert_str_eq(s, "[1,3,11,\"<data container>\"]");
  13208   free(s);
  13209   // index outside
  13210   ck_assert_ptr_eq(cropElemAtSmallStringO(self, 20), NULL);
  13211   ck_assert_ptr_eq(cropElemAtSmallStringO(self, -5), NULL);
  13212   // empty list
  13213   emptyO(self);
  13214   ck_assert_ptr_eq(cropElemAtSmallStringO(self, 0), NULL);
  13215   ck_assert_ptr_eq(cropElemAtSmallStringO(self, -1), NULL);
  13216   r2 = self->f->pushUndefined(self);
  13217   ck_assert_ptr_ne(r2, null);
  13218   delElemIndexO(self,-1);
  13219   r = cropElemAtSmallStringO(self, 0);
  13220   ck_assert_ptr_eq(r, null);
  13221   // non json array
  13222   freeO(self);
  13223   setTypeBoolO(self);
  13224   ck_assert_ptr_eq(cropElemAtSmallStringO(self, 0), NULL);
  13225   terminateO(self);
  13226 
  13227 END_TEST
  13228 
  13229 
  13230 START_TEST(cropElemAtVoidSmallJsonT)
  13231 
  13232   void* r;
  13233   smallJsont *self = allocSmallJson();
  13234   smallJsont *r2;
  13235 
  13236   // add elements to self
  13237   r2 = self->f->pushInt(self, 1);
  13238   ck_assert_ptr_ne(r2, null);
  13239   r2 = pushVoidSmallJsonG(self, &r);
  13240   ck_assert_ptr_ne(r2, null);
  13241   r2 = self->f->pushInt(self, 3);
  13242   ck_assert_ptr_ne(r2, null);
  13243   r2 = pushVoidSmallJsonG(self, &self);
  13244   ck_assert_ptr_ne(r2, null);
  13245 
  13246   // positive index
  13247   r       = cropElemAtVoidO(self,1);
  13248   ck_assert_ptr_eq(r, &r);
  13249   char *s = toStringO(self);
  13250   ck_assert_str_eq(s, "[1,3,\"<data container>\"]");
  13251   free(s);
  13252   // negative index
  13253   r = cropElemAtVoidO(self,-1);
  13254   ck_assert_ptr_eq(r, &self);
  13255   s = toStringO(self);
  13256   ck_assert_str_eq(s, "[1,3]");
  13257   free(s);
  13258   // wrong object type
  13259   createSmallInt(I);
  13260   setValG(&I, 11);
  13261   r2 = self->f->pushSmallInt(self, &I);
  13262   r = cropElemAtVoidO(self,2);
  13263   ck_assert_ptr_eq(r, NULL);
  13264   s = toStringO(self);
  13265   ck_assert_str_eq(s, "[1,3,11]");
  13266   free(s);
  13267   // wrong object type of another user class
  13268   //   User classes are stored in containers transparently
  13269   createAllocateSmallInt(ip);
  13270   ip->type = "anothertype";
  13271   setValG(ip, 11);
  13272   r2 = self->f->push(self, (baset*)ip);
  13273   ck_assert_ptr_ne(r2, null);
  13274   r = cropElemAtVoidO(self,3);
  13275   ck_assert_ptr_eq(r, NULL);
  13276   s = toStringO(self);
  13277   ck_assert_str_eq(s, "[1,3,11,\"<data container>\"]");
  13278   free(s);
  13279   // index outside
  13280   ck_assert_ptr_eq(cropElemAtVoidO(self, 20), NULL);
  13281   ck_assert_ptr_eq(cropElemAtVoidO(self, -5), NULL);
  13282   // empty list
  13283   emptyO(self);
  13284   ck_assert_ptr_eq(cropElemAtVoidO(self, 0), NULL);
  13285   ck_assert_ptr_eq(cropElemAtVoidO(self, -1), NULL);
  13286   r2 = self->f->pushUndefined(self);
  13287   ck_assert_ptr_ne(r2, null);
  13288   delElemIndexO(self,-1);
  13289   r = cropElemAtVoidO(self, 0);
  13290   ck_assert_ptr_eq(r, null);
  13291   // non json array
  13292   freeO(self);
  13293   setTypeBoolO(self);
  13294   ck_assert_ptr_eq(cropElemAtVoidO(self, 0), NULL);
  13295   terminateO(self);
  13296 
  13297 END_TEST
  13298 
  13299 
  13300 START_TEST(cropElemAtSmallContainerSmallJsonT)
  13301 
  13302   smallContainert* r;
  13303   smallJsont *self = allocSmallJson();
  13304   smallJsont *r2;
  13305 
  13306   // add elements to self
  13307   r2 = self->f->pushInt(self, 1);
  13308   ck_assert_ptr_ne(r2, null);
  13309   createSmallContainer(e2);
  13310   r2 = self->f->pushSmallContainer(self, &e2);
  13311   ck_assert_ptr_ne(r2, null);
  13312   r2 = self->f->pushInt(self, 3);
  13313   ck_assert_ptr_ne(r2, null);
  13314   createSmallContainer(e4);
  13315   r2 = self->f->pushSmallContainer(self, &e4);
  13316   ck_assert_ptr_ne(r2, null);
  13317 
  13318   // positive index
  13319   r       = cropElemAtSmallContainerO(self,1);
  13320   ck_assert_ptr_ne(r, null);
  13321   char *s = toStringO(r);
  13322   terminateO(r);
  13323   ck_assert_str_eq(s, "<data smallContainer>");
  13324   free(s);
  13325   s = toStringO(self);
  13326   ck_assert_str_eq(s, "[1,3,\"<data container>\"]");
  13327   free(s);
  13328   // negative index
  13329   r = cropElemAtSmallContainerO(self,-1);
  13330   ck_assert_ptr_ne(r, null);
  13331   s = toStringO(r);
  13332   terminateO(r);
  13333   ck_assert_str_eq(s, "<data smallContainer>");
  13334   free(s);
  13335   s = toStringO(self);
  13336   ck_assert_str_eq(s, "[1,3]");
  13337   free(s);
  13338   // wrong object type
  13339   createSmallInt(I);
  13340   setValG(&I, 11);
  13341   r2 = self->f->pushSmallInt(self, &I);
  13342   r = cropElemAtSmallContainerO(self,2);
  13343   ck_assert_ptr_eq(r, NULL);
  13344   s = toStringO(self);
  13345   ck_assert_str_eq(s, "[1,3,11]");
  13346   free(s);
  13347   // wrong object type of another user class
  13348   //   User classes are stored in containers transparently
  13349   createAllocateSmallInt(ip);
  13350   ip->type = "anothertype";
  13351   setValG(ip, 11);
  13352   r2 = self->f->push(self, (baset*)ip);
  13353   ck_assert_ptr_ne(r2, null);
  13354   r = cropElemAtSmallContainerO(self,3);
  13355   ck_assert_ptr_eq(r, NULL);
  13356   s = toStringO(self);
  13357   ck_assert_str_eq(s, "[1,3,11,\"<data container>\"]");
  13358   free(s);
  13359   // index outside
  13360   ck_assert_ptr_eq(cropElemAtSmallContainerO(self, 20), NULL);
  13361   ck_assert_ptr_eq(cropElemAtSmallContainerO(self, -5), NULL);
  13362   // empty list
  13363   emptyO(self);
  13364   ck_assert_ptr_eq(cropElemAtSmallContainerO(self, 0), NULL);
  13365   ck_assert_ptr_eq(cropElemAtSmallContainerO(self, -1), NULL);
  13366   r2 = self->f->pushUndefined(self);
  13367   ck_assert_ptr_ne(r2, null);
  13368   delElemIndexO(self,-1);
  13369   r = cropElemAtSmallContainerO(self, 0);
  13370   ck_assert_ptr_eq(r, null);
  13371   // non json array
  13372   freeO(self);
  13373   setTypeBoolO(self);
  13374   ck_assert_ptr_eq(cropElemAtSmallContainerO(self, 0), NULL);
  13375   terminateO(self);
  13376 
  13377 END_TEST
  13378 
  13379 
  13380 START_TEST(cropElemKeySmallJsonT)
  13381 
  13382   baset* r;
  13383   smallJsont *self = allocSmallJson();
  13384   smallJsont *r2;
  13385 
  13386   r2 = self->f->setInt(self, "1", 1);
  13387   ck_assert_ptr_ne(r2, null);
  13388   r2 = self->f->setDouble(self, "2", 2.2);
  13389   ck_assert_ptr_ne(r2, null);
  13390   r2 = self->f->setS(self, "3", "2");
  13391   ck_assert_ptr_ne(r2, null);
  13392   r2 = self->f->setUndefined(self, "u");
  13393   ck_assert_ptr_ne(r2, null);
  13394   createSmallContainer(c);
  13395   r2 = self->f->setSmallContainer(self, "c", &c);
  13396   ck_assert_ptr_ne(r2, null);
  13397   createAllocateSmallInt(I);
  13398   setValG(I, 11);
  13399   I->type = "anothertype";
  13400   r2 = self->f->set(self, "b", (baset*)I);
  13401   ck_assert_ptr_ne(r2, null);
  13402   // get int
  13403   r = cropElemKeyO(self, "3");
  13404   ck_assert_ptr_ne(r, null);
  13405   char *s = toStringO(r);
  13406   terminateO(r);
  13407   ck_assert_str_eq(s, "2");
  13408   free(s);
  13409   s = toStringO(self);
  13410   ck_assert_str_eq(s, "{\"1\":1,\"2\":2.200000e+00,\"u\":null,\"c\":\"<data container>\",\"b\":\"<data container>\"}");
  13411   free(s);
  13412   // undefined object
  13413   r = cropElemKeyO(self, "u");
  13414   ck_assert_ptr_ne(r, null);
  13415   s = toStringO(r);
  13416   terminateO(r);
  13417   ck_assert_str_eq(s, "null");
  13418   free(s);
  13419   s = toStringO(self);
  13420   ck_assert_str_eq(s, "{\"1\":1,\"2\":2.200000e+00,\"c\":\"<data container>\",\"b\":\"<data container>\"}");
  13421   free(s);
  13422   // container
  13423   r = cropElemKeyO(self, "c");
  13424   ck_assert_ptr_ne(r, null);
  13425   s = toStringO(r);
  13426   terminateO(r);
  13427   ck_assert_str_eq(s, "<data smallContainer>");
  13428   free(s);
  13429   s = toStringO(self);
  13430   ck_assert_str_eq(s, "{\"1\":1,\"2\":2.200000e+00,\"b\":\"<data container>\"}");
  13431   free(s);
  13432   // base object in container
  13433   r = cropElemKeyO(self, "b");
  13434   ck_assert_ptr_ne(r, null);
  13435   s = toStringO(r);
  13436   terminateO(r);
  13437   ck_assert_str_eq(s, "11");
  13438   free(s);
  13439   s = toStringO(self);
  13440   ck_assert_str_eq(s, "{\"1\":1,\"2\":2.200000e+00}");
  13441   free(s);
  13442   // non existing key
  13443   r = cropElemKeyO(self, "qwe");
  13444   ck_assert_ptr_eq(r, null);
  13445   // null key
  13446   r = cropElemKeyO(self, null);
  13447   ck_assert_ptr_eq(r, null);
  13448 	// empty self
  13449   freeO(self);
  13450   r = cropElemKeyO(self, "1");
  13451   ck_assert_ptr_eq(r, null);
  13452   terminateO(self);
  13453 
  13454 END_TEST
  13455 
  13456 
  13457 START_TEST(cropElemKeyUndefinedSmallJsonT)
  13458 
  13459   undefinedt* r;
  13460   smallJsont *self = allocSmallJson();
  13461   smallJsont *r2;
  13462 
  13463   r2 = self->f->setInt(self, "1", 1);
  13464   ck_assert_ptr_ne(r2, null);
  13465   r2 = self->f->setDouble(self, "2", 2.2);
  13466   ck_assert_ptr_ne(r2, null);
  13467   r2 = self->f->setUndefined(self, "u");
  13468   ck_assert_ptr_ne(r2, null);
  13469   r = cropElemKeyUndefinedO(self, "u");
  13470   ck_assert_ptr_ne(r, null);
  13471   char *s = toStringO(r);
  13472   terminateO(r);
  13473   ck_assert_str_eq(s, "null");
  13474   free(s);
  13475   s = toStringO(self);
  13476   ck_assert_str_eq(s, "{\"1\":1,\"2\":2.200000e+00}");
  13477   free(s);
  13478   // wrong object type
  13479   r = cropElemKeyUndefinedO(self, "1");
  13480   ck_assert_ptr_eq(r, null);
  13481   s = toStringO(self);
  13482   ck_assert_str_eq(s, "{\"1\":1,\"2\":2.200000e+00}");
  13483   free(s);
  13484   // non existing key
  13485   r = cropElemKeyUndefinedO(self, "qwe");
  13486   ck_assert_ptr_eq(r, null);
  13487   // null key
  13488   r = cropElemKeyUndefinedO(self, null);
  13489   ck_assert_ptr_eq(r, null);
  13490 	// empty self
  13491   freeO(self);
  13492   r = cropElemKeyUndefinedO(self, "1");
  13493   ck_assert_ptr_eq(r, null);
  13494   terminateO(self);
  13495 
  13496 END_TEST
  13497 
  13498 
  13499 START_TEST(cropElemKeyBoolSmallJsonT)
  13500 
  13501   bool r;
  13502   smallJsont *self = allocSmallJson();
  13503   smallJsont *r2;
  13504 
  13505   r2 = self->f->setInt(self, "1", 1);
  13506   ck_assert_ptr_ne(r2, null);
  13507   r2 = self->f->setDouble(self, "2", 2.2);
  13508   ck_assert_ptr_ne(r2, null);
  13509   r2 = self->f->setBool(self, "b", true);
  13510   ck_assert_ptr_ne(r2, null);
  13511   createAllocateSmallInt(I);
  13512   setValG(I, 11);
  13513   I->type = "anothertype";
  13514   r2 = self->f->set(self, "B", (baset*)I);
  13515   ck_assert_ptr_ne(r2, null);
  13516   r = cropElemKeyBoolO(self, "b");
  13517   ck_assert(r);
  13518   char *s = toStringO(self);
  13519   ck_assert_str_eq(s, "{\"1\":1,\"2\":2.200000e+00,\"B\":\"<data container>\"}");
  13520   free(s);
  13521   // wrong object type
  13522   r = cropElemKeyBoolO(self, "1");
  13523   ck_assert(!r);
  13524   s = toStringO(self);
  13525   ck_assert_str_eq(s, "{\"1\":1,\"2\":2.200000e+00,\"B\":\"<data container>\"}");
  13526   free(s);
  13527   r = cropElemKeyBoolO(self, "B");
  13528   ck_assert(!r);
  13529   s = toStringO(self);
  13530   ck_assert_str_eq(s, "{\"1\":1,\"2\":2.200000e+00,\"B\":\"<data container>\"}");
  13531   free(s);
  13532   // non existing key
  13533   r = cropElemKeyBoolO(self, "qwe");
  13534   ck_assert(!r);
  13535   // null key
  13536   r = cropElemKeyBoolO(self, null);
  13537   ck_assert(!r);
  13538 	// empty self
  13539   freeO(self);
  13540   r = cropElemKeyBoolO(self, "1");
  13541   ck_assert(!r);
  13542   terminateO(self);
  13543 
  13544 END_TEST
  13545 
  13546 
  13547 START_TEST(cropElemKeyDoubleSmallJsonT)
  13548 
  13549   double r;
  13550   smallJsont *self = allocSmallJson();
  13551   smallJsont *r2;
  13552 
  13553   r2 = self->f->setInt(self, "1", 1);
  13554   ck_assert_ptr_ne(r2, null);
  13555   r2 = self->f->setDouble(self, "2", 2.2);
  13556   ck_assert_ptr_ne(r2, null);
  13557   r2 = self->f->setDouble(self, "b", 3.3);
  13558   ck_assert_ptr_ne(r2, null);
  13559   createAllocateSmallInt(I);
  13560   setValG(I, 11);
  13561   I->type = "anothertype";
  13562   r2 = self->f->set(self, "B", (baset*)I);
  13563   ck_assert_ptr_ne(r2, null);
  13564   r = cropElemKeyDoubleO(self, "b");
  13565   ck_assert(r == 3.3);
  13566   char *s = toStringO(self);
  13567   ck_assert_str_eq(s, "{\"1\":1,\"2\":2.200000e+00,\"B\":\"<data container>\"}");
  13568   free(s);
  13569   // wrong object type
  13570   r = cropElemKeyDoubleO(self, "1");
  13571   ck_assert(!r);
  13572   s = toStringO(self);
  13573   ck_assert_str_eq(s, "{\"1\":1,\"2\":2.200000e+00,\"B\":\"<data container>\"}");
  13574   free(s);
  13575   r = cropElemKeyDoubleO(self, "B");
  13576   ck_assert(!r);
  13577   s = toStringO(self);
  13578   ck_assert_str_eq(s, "{\"1\":1,\"2\":2.200000e+00,\"B\":\"<data container>\"}");
  13579   free(s);
  13580   // non existing key
  13581   r = cropElemKeyDoubleO(self, "qwe");
  13582   ck_assert(!r);
  13583   // null key
  13584   r = cropElemKeyDoubleO(self, null);
  13585   ck_assert(r == 0);
  13586 	// empty self
  13587   freeO(self);
  13588   r = cropElemKeyDoubleO(self, "1");
  13589   ck_assert(r == 0);
  13590   terminateO(self);
  13591 
  13592 END_TEST
  13593 
  13594 
  13595 START_TEST(cropElemKeyIntSmallJsonT)
  13596 
  13597   int64_t r;
  13598   smallJsont *self = allocSmallJson();
  13599   smallJsont *r2;
  13600 
  13601   r2 = self->f->setInt(self, "1", 1);
  13602   ck_assert_ptr_ne(r2, null);
  13603   r2 = self->f->setDouble(self, "2", 2.2);
  13604   ck_assert_ptr_ne(r2, null);
  13605   r2 = self->f->setInt(self, "b", 2);
  13606   ck_assert_ptr_ne(r2, null);
  13607   createAllocateSmallInt(I);
  13608   setValG(I, 11);
  13609   I->type = "anothertype";
  13610   r2 = self->f->set(self, "B", (baset*)I);
  13611   ck_assert_ptr_ne(r2, null);
  13612   r = cropElemKeyIntO(self, "b");
  13613   ck_assert_int_eq(r, 2);
  13614   char *s = toStringO(self);
  13615   ck_assert_str_eq(s, "{\"1\":1,\"2\":2.200000e+00,\"B\":\"<data container>\"}");
  13616   free(s);
  13617   // wrong object type
  13618   r = cropElemKeyIntO(self, "2");
  13619   ck_assert(!r);
  13620   s = toStringO(self);
  13621   ck_assert_str_eq(s, "{\"1\":1,\"2\":2.200000e+00,\"B\":\"<data container>\"}");
  13622   free(s);
  13623   r = cropElemKeyIntO(self, "B");
  13624   ck_assert(!r);
  13625   s = toStringO(self);
  13626   ck_assert_str_eq(s, "{\"1\":1,\"2\":2.200000e+00,\"B\":\"<data container>\"}");
  13627   free(s);
  13628   // non existing key
  13629   r = cropElemKeyIntO(self, "qwe");
  13630   ck_assert(!r);
  13631   // null key
  13632   r = cropElemKeyIntO(self, null);
  13633   ck_assert_int_eq(r, 0);
  13634 	// empty self
  13635   freeO(self);
  13636   r = cropElemKeyIntO(self, "1");
  13637   ck_assert_int_eq(r, 0);
  13638   terminateO(self);
  13639 
  13640 END_TEST
  13641 
  13642 
  13643 START_TEST(cropElemKeyInt32SmallJsonT)
  13644 
  13645   int32_t r;
  13646   smallJsont *self = allocSmallJson();
  13647   smallJsont *r2;
  13648 
  13649   r2 = self->f->setInt(self, "1", 1);
  13650   ck_assert_ptr_ne(r2, null);
  13651   r2 = self->f->setDouble(self, "2", 2.2);
  13652   ck_assert_ptr_ne(r2, null);
  13653   r2 = self->f->setInt(self, "b", 2);
  13654   ck_assert_ptr_ne(r2, null);
  13655   createAllocateSmallInt(I);
  13656   setValG(I, 11);
  13657   I->type = "anothertype";
  13658   r2 = self->f->set(self, "B", (baset*)I);
  13659   ck_assert_ptr_ne(r2, null);
  13660   r = cropElemKeyInt32O(self, "b");
  13661   ck_assert_int_eq(r, 2);
  13662   char *s = toStringO(self);
  13663   ck_assert_str_eq(s, "{\"1\":1,\"2\":2.200000e+00,\"B\":\"<data container>\"}");
  13664   free(s);
  13665   // wrong object type
  13666   r = cropElemKeyInt32O(self, "2");
  13667   ck_assert(!r);
  13668   s = toStringO(self);
  13669   ck_assert_str_eq(s, "{\"1\":1,\"2\":2.200000e+00,\"B\":\"<data container>\"}");
  13670   free(s);
  13671   r = cropElemKeyInt32O(self, "B");
  13672   ck_assert(!r);
  13673   s = toStringO(self);
  13674   ck_assert_str_eq(s, "{\"1\":1,\"2\":2.200000e+00,\"B\":\"<data container>\"}");
  13675   free(s);
  13676   // non existing key
  13677   r = cropElemKeyInt32O(self, "qwe");
  13678   ck_assert(!r);
  13679   // null key
  13680   r = cropElemKeyInt32O(self, null);
  13681   ck_assert_int_eq(r, 0);
  13682 	// empty self
  13683   freeO(self);
  13684   r = cropElemKeyInt32O(self, "1");
  13685   ck_assert_int_eq(r, 0);
  13686   terminateO(self);
  13687 
  13688 END_TEST
  13689 
  13690 
  13691 START_TEST(cropElemKeyUintSmallJsonT)
  13692 
  13693   uint64_t r;
  13694   smallJsont *self = allocSmallJson();
  13695   smallJsont *r2;
  13696 
  13697   r2 = self->f->setInt(self, "1", 1);
  13698   ck_assert_ptr_ne(r2, null);
  13699   r2 = self->f->setDouble(self, "2", 2.2);
  13700   ck_assert_ptr_ne(r2, null);
  13701   r2 = self->f->setInt(self, "b", 2);
  13702   ck_assert_ptr_ne(r2, null);
  13703   createAllocateSmallInt(I);
  13704   setValG(I, 11);
  13705   I->type = "anothertype";
  13706   r2 = self->f->set(self, "B", (baset*)I);
  13707   ck_assert_ptr_ne(r2, null);
  13708   r = cropElemKeyUintO(self, "b");
  13709   ck_assert_int_eq(r, 2);
  13710   char *s = toStringO(self);
  13711   ck_assert_str_eq(s, "{\"1\":1,\"2\":2.200000e+00,\"B\":\"<data container>\"}");
  13712   free(s);
  13713   // wrong object type
  13714   r = cropElemKeyUintO(self, "2");
  13715   ck_assert(!r);
  13716   s = toStringO(self);
  13717   ck_assert_str_eq(s, "{\"1\":1,\"2\":2.200000e+00,\"B\":\"<data container>\"}");
  13718   free(s);
  13719   r = cropElemKeyUintO(self, "B");
  13720   ck_assert(!r);
  13721   s = toStringO(self);
  13722   ck_assert_str_eq(s, "{\"1\":1,\"2\":2.200000e+00,\"B\":\"<data container>\"}");
  13723   free(s);
  13724   // non existing key
  13725   r = cropElemKeyUintO(self, "qwe");
  13726   ck_assert(!r);
  13727   // null key
  13728   r = cropElemKeyUintO(self, null);
  13729   ck_assert_int_eq(r, 0);
  13730 	// empty self
  13731   freeO(self);
  13732   r = cropElemKeyUintO(self, "1");
  13733   ck_assert_int_eq(r, 0);
  13734   terminateO(self);
  13735 
  13736 END_TEST
  13737 
  13738 
  13739 START_TEST(cropElemKeyUint32SmallJsonT)
  13740 
  13741   uint32_t r;
  13742   smallJsont *self = allocSmallJson();
  13743   smallJsont *r2;
  13744 
  13745   r2 = self->f->setInt(self, "1", 1);
  13746   ck_assert_ptr_ne(r2, null);
  13747   r2 = self->f->setDouble(self, "2", 2.2);
  13748   ck_assert_ptr_ne(r2, null);
  13749   r2 = self->f->setInt(self, "b", 2);
  13750   ck_assert_ptr_ne(r2, null);
  13751   createAllocateSmallInt(I);
  13752   setValG(I, 11);
  13753   I->type = "anothertype";
  13754   r2 = self->f->set(self, "B", (baset*)I);
  13755   ck_assert_ptr_ne(r2, null);
  13756   r = cropElemKeyUint32O(self, "b");
  13757   ck_assert_int_eq(r, 2);
  13758   char *s = toStringO(self);
  13759   ck_assert_str_eq(s, "{\"1\":1,\"2\":2.200000e+00,\"B\":\"<data container>\"}");
  13760   free(s);
  13761   // wrong object type
  13762   r = cropElemKeyUint32O(self, "2");
  13763   ck_assert(!r);
  13764   s = toStringO(self);
  13765   ck_assert_str_eq(s, "{\"1\":1,\"2\":2.200000e+00,\"B\":\"<data container>\"}");
  13766   free(s);
  13767   r = cropElemKeyUint32O(self, "B");
  13768   ck_assert(!r);
  13769   s = toStringO(self);
  13770   ck_assert_str_eq(s, "{\"1\":1,\"2\":2.200000e+00,\"B\":\"<data container>\"}");
  13771   free(s);
  13772   // non existing key
  13773   r = cropElemKeyUint32O(self, "qwe");
  13774   ck_assert(!r);
  13775   // null key
  13776   r = cropElemKeyUint32O(self, null);
  13777   ck_assert_int_eq(r, 0);
  13778 	// empty self
  13779   freeO(self);
  13780   r = cropElemKeyUint32O(self, "1");
  13781   ck_assert_int_eq(r, 0);
  13782   terminateO(self);
  13783 
  13784 END_TEST
  13785 
  13786 
  13787 START_TEST(cropElemKeySSmallJsonT)
  13788 
  13789   char* r;
  13790   smallJsont *self = allocSmallJson();
  13791   smallJsont *r2;
  13792 
  13793   r2 = self->f->setInt(self, "1", 1);
  13794   ck_assert_ptr_ne(r2, null);
  13795   r2 = self->f->setDouble(self, "2", 2.2);
  13796   ck_assert_ptr_ne(r2, null);
  13797   r2 = self->f->setS(self, "b", "qwe");
  13798   ck_assert_ptr_ne(r2, null);
  13799   createAllocateSmallInt(I);
  13800   setValG(I, 11);
  13801   I->type = "anothertype";
  13802   r2 = self->f->set(self, "B", (baset*)I);
  13803   ck_assert_ptr_ne(r2, null);
  13804   r = cropElemKeySO(self, "b");
  13805   ck_assert_str_eq(r, "qwe");
  13806   free(r);
  13807   char *s = toStringO(self);
  13808   ck_assert_str_eq(s, "{\"1\":1,\"2\":2.200000e+00,\"B\":\"<data container>\"}");
  13809   free(s);
  13810   // wrong object type
  13811   r = cropElemKeySO(self, "2");
  13812   ck_assert_ptr_eq(r, null);
  13813   s = toStringO(self);
  13814   ck_assert_str_eq(s, "{\"1\":1,\"2\":2.200000e+00,\"B\":\"<data container>\"}");
  13815   free(s);
  13816   r = cropElemKeySO(self, "B");
  13817   ck_assert_ptr_eq(r, null);
  13818   s = toStringO(self);
  13819   ck_assert_str_eq(s, "{\"1\":1,\"2\":2.200000e+00,\"B\":\"<data container>\"}");
  13820   free(s);
  13821   // non existing key
  13822   r = cropElemKeySO(self, "qwe");
  13823   ck_assert_ptr_eq(r, null);
  13824   // null key
  13825   r = cropElemKeySO(self, null);
  13826   ck_assert_ptr_eq(r, null);
  13827 	// empty self
  13828   freeO(self);
  13829   r = cropElemKeySO(self, "1");
  13830   ck_assert_ptr_eq(r, null);
  13831   terminateO(self);
  13832 
  13833 END_TEST
  13834 
  13835 
  13836 START_TEST(cropElemKeyDictSmallJsonT)
  13837 
  13838   smallDictt* r;
  13839   smallJsont *self = allocSmallJson();
  13840   smallJsont *r2;
  13841 
  13842   r2 = self->f->setInt(self, "1", 1);
  13843   ck_assert_ptr_ne(r2, null);
  13844   r2 = self->f->setDouble(self, "2", 2.2);
  13845   ck_assert_ptr_ne(r2, null);
  13846   createAllocateSmallDict(d);
  13847   r2 = self->f->setNFreeDict(self, "b", d);
  13848   ck_assert_ptr_ne(r2, null);
  13849   createAllocateSmallInt(I);
  13850   setValG(I, 11);
  13851   I->type = "anothertype";
  13852   r2 = self->f->set(self, "B", (baset*)I);
  13853   ck_assert_ptr_ne(r2, null);
  13854   r = cropElemKeyDictO(self, "b");
  13855   ck_assert_ptr_ne(r, null);
  13856   char *s = toStringO(r);
  13857   terminateO(r);
  13858   ck_assert_str_eq(s, "{}");
  13859   free(s);
  13860   s = toStringO(self);
  13861   ck_assert_str_eq(s, "{\"1\":1,\"2\":2.200000e+00,\"B\":\"<data container>\"}");
  13862   free(s);
  13863   // wrong object type
  13864   r = cropElemKeyDictO(self, "2");
  13865   ck_assert_ptr_eq(r, null);
  13866   s = toStringO(self);
  13867   ck_assert_str_eq(s, "{\"1\":1,\"2\":2.200000e+00,\"B\":\"<data container>\"}");
  13868   free(s);
  13869   r = cropElemKeyDictO(self, "B");
  13870   ck_assert_ptr_eq(r, null);
  13871   s = toStringO(self);
  13872   ck_assert_str_eq(s, "{\"1\":1,\"2\":2.200000e+00,\"B\":\"<data container>\"}");
  13873   free(s);
  13874   // non existing key
  13875   r = cropElemKeyDictO(self, "qwe");
  13876   ck_assert_ptr_eq(r, null);
  13877   // null key
  13878   r = cropElemKeyDictO(self, null);
  13879   ck_assert_ptr_eq(r, null);
  13880 	// empty self
  13881   freeO(self);
  13882   r = cropElemKeyDictO(self, "1");
  13883   ck_assert_ptr_eq(r, null);
  13884   terminateO(self);
  13885 
  13886 END_TEST
  13887 
  13888 
  13889 START_TEST(cropElemKeyArraySmallJsonT)
  13890 
  13891   smallArrayt* r;
  13892   smallJsont *self = allocSmallJson();
  13893   smallJsont *r2;
  13894 
  13895   r2 = self->f->setInt(self, "1", 1);
  13896   ck_assert_ptr_ne(r2, null);
  13897   r2 = self->f->setDouble(self, "2", 2.2);
  13898   ck_assert_ptr_ne(r2, null);
  13899   createAllocateSmallArray(d);
  13900   r2 = self->f->setNFreeArray(self, "b", d);
  13901   ck_assert_ptr_ne(r2, null);
  13902   createAllocateSmallInt(I);
  13903   setValG(I, 11);
  13904   I->type = "anothertype";
  13905   r2 = self->f->set(self, "B", (baset*)I);
  13906   ck_assert_ptr_ne(r2, null);
  13907   r = cropElemKeyArrayO(self, "b");
  13908   ck_assert_ptr_ne(r, null);
  13909   char *s = toStringO(r);
  13910   terminateO(r);
  13911   ck_assert_str_eq(s, "[]");
  13912   free(s);
  13913   s = toStringO(self);
  13914   ck_assert_str_eq(s, "{\"1\":1,\"2\":2.200000e+00,\"B\":\"<data container>\"}");
  13915   free(s);
  13916   // wrong object type
  13917   r = cropElemKeyArrayO(self, "2");
  13918   ck_assert_ptr_eq(r, null);
  13919   s = toStringO(self);
  13920   ck_assert_str_eq(s, "{\"1\":1,\"2\":2.200000e+00,\"B\":\"<data container>\"}");
  13921   free(s);
  13922   r = cropElemKeyArrayO(self, "B");
  13923   ck_assert_ptr_eq(r, null);
  13924   s = toStringO(self);
  13925   ck_assert_str_eq(s, "{\"1\":1,\"2\":2.200000e+00,\"B\":\"<data container>\"}");
  13926   free(s);
  13927   // non existing key
  13928   r = cropElemKeyArrayO(self, "qwe");
  13929   ck_assert_ptr_eq(r, null);
  13930   // null key
  13931   r = cropElemKeyArrayO(self, null);
  13932   ck_assert_ptr_eq(r, null);
  13933 	// empty self
  13934   freeO(self);
  13935   r = cropElemKeyArrayO(self, "1");
  13936   ck_assert_ptr_eq(r, null);
  13937   terminateO(self);
  13938 
  13939 END_TEST
  13940 
  13941 
  13942 START_TEST(cropElemKeySmallBoolSmallJsonT)
  13943 
  13944   smallBoolt* r;
  13945   smallJsont *self = allocSmallJson();
  13946   smallJsont *r2;
  13947 
  13948   r2 = self->f->setInt(self, "1", 1);
  13949   ck_assert_ptr_ne(r2, null);
  13950   r2 = self->f->setDouble(self, "2", 2.2);
  13951   ck_assert_ptr_ne(r2, null);
  13952   r2 = self->f->setBool(self, "b", true);
  13953   ck_assert_ptr_ne(r2, null);
  13954   createAllocateSmallInt(I);
  13955   setValG(I, 11);
  13956   I->type = "anothertype";
  13957   r2 = self->f->set(self, "B", (baset*)I);
  13958   ck_assert_ptr_ne(r2, null);
  13959   r = cropElemKeySmallBoolO(self, "b");
  13960   ck_assert_ptr_ne(r, null);
  13961   char *s = toStringO(r);
  13962   terminateO(r);
  13963   ck_assert_str_eq(s, "true");
  13964   free(s);
  13965   s = toStringO(self);
  13966   ck_assert_str_eq(s, "{\"1\":1,\"2\":2.200000e+00,\"B\":\"<data container>\"}");
  13967   free(s);
  13968   // wrong object type
  13969   r = cropElemKeySmallBoolO(self, "2");
  13970   ck_assert_ptr_eq(r, null);
  13971   s = toStringO(self);
  13972   ck_assert_str_eq(s, "{\"1\":1,\"2\":2.200000e+00,\"B\":\"<data container>\"}");
  13973   free(s);
  13974   r = cropElemKeySmallBoolO(self, "B");
  13975   ck_assert_ptr_eq(r, null);
  13976   s = toStringO(self);
  13977   ck_assert_str_eq(s, "{\"1\":1,\"2\":2.200000e+00,\"B\":\"<data container>\"}");
  13978   free(s);
  13979   // non existing key
  13980   r = cropElemKeySmallBoolO(self, "qwe");
  13981   ck_assert_ptr_eq(r, null);
  13982   // null key
  13983   r = cropElemKeySmallBoolO(self, null);
  13984   ck_assert_ptr_eq(r, null);
  13985 	// empty self
  13986   freeO(self);
  13987   r = cropElemKeySmallBoolO(self, "1");
  13988   ck_assert_ptr_eq(r, null);
  13989   terminateO(self);
  13990 
  13991 END_TEST
  13992 
  13993 
  13994 START_TEST(cropElemKeySmallBytesSmallJsonT)
  13995 
  13996   smallBytest* r;
  13997   smallJsont *self = allocSmallJson();
  13998   smallJsont *r2;
  13999 
  14000   r2 = self->f->setInt(self, "1", 1);
  14001   ck_assert_ptr_ne(r2, null);
  14002   r2 = self->f->setDouble(self, "2", 2.2);
  14003   ck_assert_ptr_ne(r2, null);
  14004   createAllocateSmallBytes(d);
  14005   r2 = self->f->setNFreeSmallBytes(self, "b", d);
  14006   ck_assert_ptr_ne(r2, null);
  14007   createAllocateSmallInt(I);
  14008   setValG(I, 11);
  14009   I->type = "anothertype";
  14010   r2 = self->f->set(self, "B", (baset*)I);
  14011   ck_assert_ptr_ne(r2, null);
  14012   r = cropElemKeySmallBytesO(self, "b");
  14013   ck_assert_ptr_ne(r, null);
  14014   char *s = toStringO(r);
  14015   terminateO(r);
  14016   ck_assert_str_eq(s, "[]");
  14017   free(s);
  14018   s = toStringO(self);
  14019   ck_assert_str_eq(s, "{\"1\":1,\"2\":2.200000e+00,\"B\":\"<data container>\"}");
  14020   free(s);
  14021   // wrong object type
  14022   r = cropElemKeySmallBytesO(self, "2");
  14023   ck_assert_ptr_eq(r, null);
  14024   s = toStringO(self);
  14025   ck_assert_str_eq(s, "{\"1\":1,\"2\":2.200000e+00,\"B\":\"<data container>\"}");
  14026   free(s);
  14027   r = cropElemKeySmallBytesO(self, "B");
  14028   ck_assert_ptr_eq(r, null);
  14029   s = toStringO(self);
  14030   ck_assert_str_eq(s, "{\"1\":1,\"2\":2.200000e+00,\"B\":\"<data container>\"}");
  14031   free(s);
  14032   // non existing key
  14033   r = cropElemKeySmallBytesO(self, "qwe");
  14034   ck_assert_ptr_eq(r, null);
  14035   // null key
  14036   r = cropElemKeySmallBytesO(self, null);
  14037   ck_assert_ptr_eq(r, null);
  14038 	// empty self
  14039   freeO(self);
  14040   r = cropElemKeySmallBytesO(self, "1");
  14041   ck_assert_ptr_eq(r, null);
  14042   terminateO(self);
  14043 
  14044 END_TEST
  14045 
  14046 
  14047 START_TEST(cropElemKeySmallDoubleSmallJsonT)
  14048 
  14049   smallDoublet* r;
  14050   smallJsont *self = allocSmallJson();
  14051   smallJsont *r2;
  14052 
  14053   r2 = self->f->setInt(self, "1", 1);
  14054   ck_assert_ptr_ne(r2, null);
  14055   r2 = self->f->setDouble(self, "2", 2.2);
  14056   ck_assert_ptr_ne(r2, null);
  14057   r2 = self->f->setDouble(self, "b", 3.3);
  14058   ck_assert_ptr_ne(r2, null);
  14059   createAllocateSmallInt(I);
  14060   setValG(I, 11);
  14061   I->type = "anothertype";
  14062   r2 = self->f->set(self, "B", (baset*)I);
  14063   ck_assert_ptr_ne(r2, null);
  14064   r = cropElemKeySmallDoubleO(self, "b");
  14065   ck_assert_ptr_ne(r, null);
  14066   char *s = toStringO(r);
  14067   terminateO(r);
  14068   ck_assert_str_eq(s, "3.300000e+00");
  14069   free(s);
  14070   s = toStringO(self);
  14071   ck_assert_str_eq(s, "{\"1\":1,\"2\":2.200000e+00,\"B\":\"<data container>\"}");
  14072   free(s);
  14073   // wrong object type
  14074   r = cropElemKeySmallDoubleO(self, "1");
  14075   ck_assert_ptr_eq(r, null);
  14076   s = toStringO(self);
  14077   ck_assert_str_eq(s, "{\"1\":1,\"2\":2.200000e+00,\"B\":\"<data container>\"}");
  14078   free(s);
  14079   r = cropElemKeySmallDoubleO(self, "B");
  14080   ck_assert_ptr_eq(r, null);
  14081   s = toStringO(self);
  14082   ck_assert_str_eq(s, "{\"1\":1,\"2\":2.200000e+00,\"B\":\"<data container>\"}");
  14083   free(s);
  14084   // non existing key
  14085   r = cropElemKeySmallDoubleO(self, "qwe");
  14086   ck_assert_ptr_eq(r, null);
  14087   // null key
  14088   r = cropElemKeySmallDoubleO(self, null);
  14089   ck_assert_ptr_eq(r, null);
  14090 	// empty self
  14091   freeO(self);
  14092   r = cropElemKeySmallDoubleO(self, "1");
  14093   ck_assert_ptr_eq(r, null);
  14094   terminateO(self);
  14095 
  14096 END_TEST
  14097 
  14098 
  14099 START_TEST(cropElemKeySmallIntSmallJsonT)
  14100 
  14101   smallIntt* r;
  14102   smallJsont *self = allocSmallJson();
  14103   smallJsont *r2;
  14104 
  14105   r2 = self->f->setInt(self, "1", 1);
  14106   ck_assert_ptr_ne(r2, null);
  14107   r2 = self->f->setDouble(self, "2", 2.2);
  14108   ck_assert_ptr_ne(r2, null);
  14109   r2 = self->f->setInt(self, "b", 2);
  14110   ck_assert_ptr_ne(r2, null);
  14111   createAllocateSmallInt(I);
  14112   setValG(I, 11);
  14113   I->type = "anothertype";
  14114   r2 = self->f->set(self, "B", (baset*)I);
  14115   ck_assert_ptr_ne(r2, null);
  14116   r = cropElemKeySmallIntO(self, "b");
  14117   ck_assert_ptr_ne(r, null);
  14118   char *s = toStringO(r);
  14119   terminateO(r);
  14120   ck_assert_str_eq(s, "2");
  14121   free(s);
  14122   s = toStringO(self);
  14123   ck_assert_str_eq(s, "{\"1\":1,\"2\":2.200000e+00,\"B\":\"<data container>\"}");
  14124   free(s);
  14125   // wrong object type
  14126   r = cropElemKeySmallIntO(self, "2");
  14127   ck_assert_ptr_eq(r, null);
  14128   s = toStringO(self);
  14129   ck_assert_str_eq(s, "{\"1\":1,\"2\":2.200000e+00,\"B\":\"<data container>\"}");
  14130   free(s);
  14131   r = cropElemKeySmallIntO(self, "B");
  14132   ck_assert_ptr_eq(r, null);
  14133   s = toStringO(self);
  14134   ck_assert_str_eq(s, "{\"1\":1,\"2\":2.200000e+00,\"B\":\"<data container>\"}");
  14135   free(s);
  14136   // non existing key
  14137   r = cropElemKeySmallIntO(self, "qwe");
  14138   ck_assert_ptr_eq(r, null);
  14139   // null key
  14140   r = cropElemKeySmallIntO(self, null);
  14141   ck_assert_ptr_eq(r, null);
  14142 	// empty self
  14143   freeO(self);
  14144   r = cropElemKeySmallIntO(self, "1");
  14145   ck_assert_ptr_eq(r, null);
  14146   terminateO(self);
  14147 
  14148 END_TEST
  14149 
  14150 
  14151 START_TEST(cropElemKeySmallJsonSmallJsonT)
  14152 
  14153   smallJsont* r;
  14154   smallJsont *self = allocSmallJson();
  14155   smallJsont *r2;
  14156 
  14157   r2 = self->f->setInt(self, "1", 1);
  14158   ck_assert_ptr_ne(r2, null);
  14159   createAllocateSmallBytes(b);
  14160   r2 = self->f->setNFreeSmallBytes(self, "2", b);
  14161   ck_assert_ptr_ne(r2, null);
  14162   createAllocateSmallJson(d);
  14163   r2 = self->f->setNFreeSmallJson(self, "b", d);
  14164   ck_assert_ptr_ne(r2, null);
  14165   createAllocateSmallInt(I);
  14166   setValG(I, 11);
  14167   I->type = "anothertype";
  14168   r2 = self->f->set(self, "B", (baset*)I);
  14169   ck_assert_ptr_ne(r2, null);
  14170   r = cropElemKeySmallJsonO(self, "b");
  14171   ck_assert_ptr_ne(r, null);
  14172   char *s = toStringO(r);
  14173   terminateO(r);
  14174   ck_assert_str_eq(s, "{}");
  14175   free(s);
  14176   s = toStringO(self);
  14177   ck_assert_str_eq(s, "{\"1\":1,\"2\":[],\"B\":\"<data container>\"}");
  14178   free(s);
  14179   // wrong object type
  14180   r = cropElemKeySmallJsonO(self, "2");
  14181   ck_assert_ptr_eq(r, null);
  14182   s = toStringO(self);
  14183   ck_assert_str_eq(s, "{\"1\":1,\"2\":[],\"B\":\"<data container>\"}");
  14184   free(s);
  14185   r = cropElemKeySmallJsonO(self, "B");
  14186   ck_assert_ptr_eq(r, null);
  14187   s = toStringO(self);
  14188   ck_assert_str_eq(s, "{\"1\":1,\"2\":[],\"B\":\"<data container>\"}");
  14189   free(s);
  14190   // non existing key
  14191   r = cropElemKeySmallJsonO(self, "qwe");
  14192   ck_assert_ptr_eq(r, null);
  14193   // null key
  14194   r = cropElemKeySmallJsonO(self, null);
  14195   ck_assert_ptr_eq(r, null);
  14196 	// empty self
  14197   freeO(self);
  14198   r = cropElemKeySmallJsonO(self, "1");
  14199   ck_assert_ptr_eq(r, null);
  14200   terminateO(self);
  14201 
  14202 END_TEST
  14203 
  14204 
  14205 START_TEST(cropElemKeySmallStringSmallJsonT)
  14206 
  14207   smallStringt* r;
  14208   smallJsont *self = allocSmallJson();
  14209   smallJsont *r2;
  14210 
  14211   r2 = self->f->setInt(self, "1", 1);
  14212   ck_assert_ptr_ne(r2, null);
  14213   r2 = self->f->setDouble(self, "2", 2.2);
  14214   ck_assert_ptr_ne(r2, null);
  14215   r2 = self->f->setS(self, "b", "qwe");
  14216   ck_assert_ptr_ne(r2, null);
  14217   createAllocateSmallInt(I);
  14218   setValG(I, 11);
  14219   I->type = "anothertype";
  14220   r2 = self->f->set(self, "B", (baset*)I);
  14221   ck_assert_ptr_ne(r2, null);
  14222   r = cropElemKeySmallStringO(self, "b");
  14223   ck_assert_ptr_ne(r, null);
  14224   char *s = toStringO(r);
  14225   terminateO(r);
  14226   ck_assert_str_eq(s, "qwe");
  14227   free(s);
  14228   s = toStringO(self);
  14229   ck_assert_str_eq(s, "{\"1\":1,\"2\":2.200000e+00,\"B\":\"<data container>\"}");
  14230   free(s);
  14231   // wrong object type
  14232   r = cropElemKeySmallStringO(self, "2");
  14233   ck_assert_ptr_eq(r, null);
  14234   s = toStringO(self);
  14235   ck_assert_str_eq(s, "{\"1\":1,\"2\":2.200000e+00,\"B\":\"<data container>\"}");
  14236   free(s);
  14237   r = cropElemKeySmallStringO(self, "B");
  14238   ck_assert_ptr_eq(r, null);
  14239   s = toStringO(self);
  14240   ck_assert_str_eq(s, "{\"1\":1,\"2\":2.200000e+00,\"B\":\"<data container>\"}");
  14241   free(s);
  14242   // non existing key
  14243   r = cropElemKeySmallStringO(self, "qwe");
  14244   ck_assert_ptr_eq(r, null);
  14245   // null key
  14246   r = cropElemKeySmallStringO(self, null);
  14247   ck_assert_ptr_eq(r, null);
  14248 	// empty self
  14249   freeO(self);
  14250   r = cropElemKeySmallStringO(self, "1");
  14251   ck_assert_ptr_eq(r, null);
  14252   terminateO(self);
  14253 
  14254 END_TEST
  14255 
  14256 
  14257 START_TEST(cropElemKeyVoidSmallJsonT)
  14258 
  14259   void* r;
  14260   smallJsont *self = allocSmallJson();
  14261   smallJsont *r2;
  14262 
  14263   r2 = self->f->setInt(self, "1", 1);
  14264   ck_assert_ptr_ne(r2, null);
  14265   r2 = self->f->setDouble(self, "2", 2.2);
  14266   ck_assert_ptr_ne(r2, null);
  14267   smallContainert *c = allocSmallContainer(&r);
  14268   r2 = self->f->setNFreeSmallContainer(self, "b", c);
  14269   ck_assert_ptr_ne(r2, null);
  14270   createAllocateSmallInt(I);
  14271   setValG(I, 11);
  14272   I->type = "anothertype";
  14273   r2 = self->f->set(self, "B", (baset*)I);
  14274   ck_assert_ptr_ne(r2, null);
  14275   r = cropElemKeyVoidO(self, "b");
  14276   ck_assert_ptr_eq(r, &r);
  14277   char *s = toStringO(self);
  14278   ck_assert_str_eq(s, "{\"1\":1,\"2\":2.200000e+00,\"B\":\"<data container>\"}");
  14279   free(s);
  14280   // wrong object type
  14281   r = cropElemKeyVoidO(self, "2");
  14282   ck_assert_ptr_eq(r, null);
  14283   s = toStringO(self);
  14284   ck_assert_str_eq(s, "{\"1\":1,\"2\":2.200000e+00,\"B\":\"<data container>\"}");
  14285   free(s);
  14286   r = cropElemKeyVoidO(self, "B");
  14287   ck_assert_ptr_eq(r, null);
  14288   s = toStringO(self);
  14289   ck_assert_str_eq(s, "{\"1\":1,\"2\":2.200000e+00,\"B\":\"<data container>\"}");
  14290   free(s);
  14291   // non existing key
  14292   r = cropElemKeyVoidO(self, "qwe");
  14293   ck_assert_ptr_eq(r, null);
  14294   // null key
  14295   r = cropElemKeyVoidO(self, null);
  14296   ck_assert_ptr_eq(r, null);
  14297 	// empty self
  14298   freeO(self);
  14299   r = cropElemKeyVoidO(self, "1");
  14300   ck_assert_ptr_eq(r, null);
  14301   terminateO(self);
  14302 
  14303 END_TEST
  14304 
  14305 
  14306 START_TEST(cropElemKeySmallContainerSmallJsonT)
  14307 
  14308   smallContainert* r;
  14309   smallJsont *self = allocSmallJson();
  14310   smallJsont *r2;
  14311 
  14312   r2 = self->f->setInt(self, "1", 1);
  14313   ck_assert_ptr_ne(r2, null);
  14314   r2 = self->f->setDouble(self, "2", 2.2);
  14315   ck_assert_ptr_ne(r2, null);
  14316   smallContainert *c = allocSmallContainer(&r);
  14317   r2 = self->f->setNFreeSmallContainer(self, "b", c);
  14318   ck_assert_ptr_ne(r2, null);
  14319   createAllocateSmallInt(I);
  14320   setValG(I, 11);
  14321   I->type = "anothertype";
  14322   r2 = self->f->set(self, "B", (baset*)I);
  14323   ck_assert_ptr_ne(r2, null);
  14324   r = cropElemKeySmallContainerO(self, "b");
  14325   ck_assert_ptr_ne(r, null);
  14326   char *s = toStringO(r);
  14327   terminateO(r);
  14328   ck_assert_str_eq(s, "<data smallContainer>");
  14329   free(s);
  14330   s = toStringO(self);
  14331   ck_assert_str_eq(s, "{\"1\":1,\"2\":2.200000e+00,\"B\":\"<data container>\"}");
  14332   free(s);
  14333   // wrong object type
  14334   r = cropElemKeySmallContainerO(self, "2");
  14335   ck_assert_ptr_eq(r, null);
  14336   s = toStringO(self);
  14337   ck_assert_str_eq(s, "{\"1\":1,\"2\":2.200000e+00,\"B\":\"<data container>\"}");
  14338   free(s);
  14339   r = cropElemKeySmallContainerO(self, "B");
  14340   ck_assert_ptr_eq(r, null);
  14341   s = toStringO(self);
  14342   ck_assert_str_eq(s, "{\"1\":1,\"2\":2.200000e+00,\"B\":\"<data container>\"}");
  14343   free(s);
  14344   // non existing key
  14345   r = cropElemKeySmallContainerO(self, "qwe");
  14346   ck_assert_ptr_eq(r, null);
  14347   // null key
  14348   r = cropElemKeySmallContainerO(self, null);
  14349   ck_assert_ptr_eq(r, null);
  14350 	// empty self
  14351   freeO(self);
  14352   r = cropElemKeySmallContainerO(self, "1");
  14353   ck_assert_ptr_eq(r, null);
  14354   terminateO(self);
  14355 
  14356 END_TEST
  14357 
  14358 
  14359 START_TEST(copySmallJsonT)
  14360 
  14361   smallJsont* r;
  14362   smallJsont *self = allocSmallJson();
  14363 
  14364   // add elements to self
  14365   r = self->f->pushInt(self, 1);
  14366   ck_assert_ptr_ne(r, null);
  14367   r = self->f->pushInt(self, 2);
  14368   ck_assert_ptr_ne(r, null);
  14369   r = self->f->pushInt(self, 3);
  14370   ck_assert_ptr_ne(r, null);
  14371   r = self->f->pushInt(self, 4);
  14372   ck_assert_ptr_ne(r, null);
  14373 
  14374   // negative index
  14375   r = copyRngO(self, 1, -1);
  14376   ck_assert_ptr_ne(r, null);
  14377   ck_assert_int_eq(lenO(r), 2);
  14378   char *s = toStringO(r);
  14379   terminateO(r);
  14380   ck_assert_str_eq(s, "[2,3]");
  14381   free(s);
  14382   s = toStringO(self);
  14383   ck_assert_str_eq(s, "[1,2,3,4]");
  14384   free(s);
  14385   // start outside
  14386   ck_assert_ptr_eq(copyRngO(self, 20, -3), NULL);
  14387   // end outside
  14388   r = copyRngO(self, 0, 40);
  14389   ck_assert_ptr_ne(r, null);
  14390   ck_assert_int_eq(lenO(r), 4);
  14391   s = toStringO(r);
  14392   terminateO(r);
  14393   ck_assert_str_eq(s, "[1,2,3,4]");
  14394   free(s);
  14395   s = toStringO(self);
  14396   ck_assert_str_eq(s, "[1,2,3,4]");
  14397   free(s);
  14398   // end negative and outside
  14399   ck_assert_ptr_eq(copyRngO(self, 2, -40), NULL);
  14400   s = toStringO(self);
  14401   ck_assert_str_eq(s, "[1,2,3,4]");
  14402   free(s);
  14403   // end before start
  14404   ck_assert_ptr_eq(copyRngO(self, 3, 2), NULL);
  14405   s = toStringO(self);
  14406   ck_assert_str_eq(s, "[1,2,3,4]");
  14407   free(s);
  14408   // negative start last element
  14409   r = copyRngO(self, -1, 0);
  14410   ck_assert_ptr_ne(r, null);
  14411   ck_assert_int_eq(lenO(r), 1);
  14412   s = toStringO(r);
  14413   terminateO(r);
  14414   ck_assert_str_eq(s, "[4]");
  14415   free(s);
  14416   s = toStringO(self);
  14417   ck_assert_str_eq(s, "[1,2,3,4]");
  14418   free(s);
  14419   // negative start and outside
  14420   r = copyRngO(self, -10, 1);
  14421   ck_assert_ptr_ne(r, null);
  14422   ck_assert_int_eq(lenO(r), 1);
  14423   s = toStringO(r);
  14424   terminateO(r);
  14425   ck_assert_str_eq(s, "[1]");
  14426   free(s);
  14427   s = toStringO(self);
  14428   ck_assert_str_eq(s, "[1,2,3,4]");
  14429   free(s);
  14430   // start = end
  14431   r = copyRngO(self, 1, 1);
  14432   ck_assert_ptr_ne(r, null);
  14433   ck_assert_int_eq(lenO(r), 0);
  14434   terminateO(r);
  14435   s = toStringO(self);
  14436   ck_assert_str_eq(s, "[1,2,3,4]");
  14437   free(s);
  14438   // empty list
  14439   emptyO(self);
  14440   ck_assert_ptr_eq(copyRngO(self, 0, 0), NULL);
  14441   ck_assert_ptr_eq(copyRngO(self, -1, 0), NULL);
  14442   // non json array
  14443   freeO(self);
  14444   setTypeBoolO(self);
  14445   ck_assert_ptr_eq(copyRngO(self, 0, 1), NULL);
  14446   terminateO(self);
  14447   // json string
  14448   self = allocSmallJson();
  14449   // copy range
  14450   setTopSO(self, "sheepy");
  14451   r = copyRngO(self, 0,2);
  14452   ck_assert_ptr_ne(r, null);
  14453   ck_assert_str_eq(sjGet(r), "sh");
  14454   ck_assert_str_eq(sjGet(self), "sheepy");
  14455   terminateO(r);
  14456   // negative index
  14457   r = copyRngO(self, -2,0);
  14458   ck_assert_ptr_ne(r, null);
  14459   ck_assert_str_eq(sjGet(r), "py");
  14460   ck_assert_str_eq(sjGet(self), "sheepy");
  14461   terminateO(r);
  14462   // positive and negative indexes
  14463   r = copyRngO(self, 2,-2);
  14464   ck_assert_ptr_ne(r, null);
  14465   ck_assert_str_eq(sjGet(r), "ee");
  14466   ck_assert_str_eq(sjGet(self), "sheepy");
  14467   terminateO(r);
  14468   // start = end
  14469   r = copyRngO(self, 2,-4);
  14470   ck_assert_ptr_ne(r, null);
  14471   ck_assert_str_eq(sjGet(r), "");
  14472   ck_assert_str_eq(sjGet(self), "sheepy");
  14473   terminateO(r);
  14474   // end of string
  14475   r = copyRngO(self, 2,6);
  14476   ck_assert_ptr_ne(r, null);
  14477   ck_assert_str_eq(sjGet(r), "eepy");
  14478   ck_assert_str_eq(sjGet(self), "sheepy");
  14479   terminateO(r);
  14480   // NULL string
  14481   freeO(self);
  14482   ck_assert_ptr_eq(copyRngO(self, 2,-4), NULL);
  14483   // start outside string
  14484   setTopSO(self, "sheepy");
  14485   ck_assert_ptr_eq(copyRngO(self, 20,-4), NULL);
  14486   // end outside string
  14487   r = copyRngO(self, 2,40);
  14488   ck_assert_ptr_ne(r, null);
  14489   ck_assert_str_eq(sjGet(r), "eepy");
  14490   ck_assert_str_eq(sjGet(self), "sheepy");
  14491   terminateO(r);
  14492   r = copyRngO(self, -22,3);
  14493   ck_assert_ptr_ne(r, null);
  14494   ck_assert_str_eq(sjGet(r), "she");
  14495   ck_assert_str_eq(sjGet(self), "sheepy");
  14496   terminateO(r);
  14497   ck_assert_ptr_eq(copyRngO(self, 2,-40), NULL);
  14498   // end before start
  14499   ck_assert_ptr_eq(copyRngO(self, 4,2), NULL);
  14500   terminateO(self);
  14501 
  14502 END_TEST
  14503 
  14504 
  14505 START_TEST(insertSmallJsonT)
  14506 
  14507   smallJsont* r;
  14508   smallJsont *self = allocSmallJson();
  14509   smallArrayt *toInsert;
  14510 
  14511   // add elements to self
  14512   r = self->f->pushInt(self, 1);
  14513   ck_assert_ptr_ne(r, null);
  14514   r = self->f->pushInt(self, 2);
  14515   ck_assert_ptr_ne(r, null);
  14516 
  14517   // positive index
  14518   toInsert = allocSmallArray();
  14519   toInsert->f->pushInt(toInsert, 3);
  14520   r        = self->f->insert(self, 1, toInsert);
  14521   smashO(toInsert);
  14522   ck_assert_ptr_ne(r, null);
  14523   char *s  = toStringO(r);
  14524   ck_assert_str_eq(s, "[1,3,2]");
  14525   free(s);
  14526   // negative index
  14527   toInsert = allocSmallArray();
  14528   toInsert->f->pushInt(toInsert, 4);
  14529   r = self->f->insert(self, -1, toInsert);
  14530   smashO(toInsert);
  14531   ck_assert_ptr_ne(r, null);
  14532   s = toStringO(r);
  14533   ck_assert_str_eq(s, "[1,3,2,4]");
  14534   free(s);
  14535   // empty list
  14536   emptyO(self);
  14537   toInsert = allocSmallArray();
  14538   toInsert->f->pushInt(toInsert, 3);
  14539   r = self->f->insert(self, 0, toInsert);
  14540   smashO(toInsert);
  14541   ck_assert_ptr_ne(r, null);
  14542   s = toStringO(r);
  14543   ck_assert_str_eq(s, "[3]");
  14544   free(s);
  14545   emptyO(self);
  14546   toInsert = allocSmallArray();
  14547   toInsert->f->pushInt(toInsert, 3);
  14548   r = self->f->insert(self, -1, toInsert);
  14549   smashO(toInsert);
  14550   ck_assert_ptr_ne(r, null);
  14551   s = toStringO(r);
  14552   ck_assert_str_eq(s, "[3]");
  14553   free(s);
  14554   // Array array length 0
  14555   toInsert = allocSmallArray();
  14556   r = self->f->insert(self, -1, toInsert);
  14557   smashO(toInsert);
  14558   ck_assert_ptr_ne(r, null);
  14559   s = toStringO(r);
  14560   ck_assert_str_eq(s, "[3]");
  14561   free(s);
  14562   // index outside
  14563   toInsert = allocSmallArray();
  14564   ck_assert_ptr_eq(self->f->insert(self, 20, toInsert), NULL);
  14565   ck_assert_ptr_eq(self->f->insert(self, -5, toInsert), NULL);
  14566   smashO(toInsert);
  14567   // non smallArray toInsert
  14568   toInsert = (smallArrayt*) allocSmallInt(1);
  14569   ck_assert_ptr_eq(self->f->insert(self, 0, toInsert), NULL);
  14570   terminateO(toInsert);
  14571   // insert NULL
  14572   ck_assert_ptr_eq(self->f->insert(self, 0, NULL), NULL);
  14573   // non json array
  14574   freeO(self);
  14575   setTypeBoolO(self);
  14576   toInsert = allocSmallArray();
  14577   ck_assert_ptr_eq(self->f->insert(self, 0, toInsert), NULL);
  14578   terminateO(toInsert);
  14579   terminateO(self);
  14580 
  14581 END_TEST
  14582 
  14583 
  14584 START_TEST(insertNSmashSmallJsonT)
  14585 
  14586   smallJsont* r;
  14587   smallJsont *self = allocSmallJson();
  14588   smallArrayt *toInsert;
  14589 
  14590   // add elements to self
  14591   r = self->f->pushInt(self, 1);
  14592   ck_assert_ptr_ne(r, null);
  14593   r = self->f->pushInt(self, 2);
  14594   ck_assert_ptr_ne(r, null);
  14595 
  14596   // positive index
  14597   toInsert = allocSmallArray();
  14598   toInsert->f->pushInt(toInsert, 3);
  14599   r        = self->f->insertNSmash(self, 1, toInsert);
  14600   ck_assert_ptr_ne(r, null);
  14601   char *s  = toStringO(r);
  14602   ck_assert_str_eq(s, "[1,3,2]");
  14603   free(s);
  14604   // negative index
  14605   toInsert = allocSmallArray();
  14606   toInsert->f->pushInt(toInsert, 4);
  14607   r = self->f->insertNSmash(self, -1, toInsert);
  14608   ck_assert_ptr_ne(r, null);
  14609   s = toStringO(r);
  14610   ck_assert_str_eq(s, "[1,3,2,4]");
  14611   free(s);
  14612   // empty list
  14613   emptyO(self);
  14614   toInsert = allocSmallArray();
  14615   toInsert->f->pushInt(toInsert, 3);
  14616   r = self->f->insertNSmash(self, 0, toInsert);
  14617   ck_assert_ptr_ne(r, null);
  14618   s = toStringO(r);
  14619   ck_assert_str_eq(s, "[3]");
  14620   free(s);
  14621   emptyO(self);
  14622   toInsert = allocSmallArray();
  14623   toInsert->f->pushInt(toInsert, 3);
  14624   r = self->f->insertNSmash(self, -1, toInsert);
  14625   ck_assert_ptr_ne(r, null);
  14626   s = toStringO(r);
  14627   ck_assert_str_eq(s, "[3]");
  14628   free(s);
  14629   // Array array length 0
  14630   toInsert = allocSmallArray();
  14631   r = self->f->insertNSmash(self, -1, toInsert);
  14632   ck_assert_ptr_ne(r, null);
  14633   s = toStringO(r);
  14634   ck_assert_str_eq(s, "[3]");
  14635   free(s);
  14636   // index outside
  14637   toInsert = allocSmallArray();
  14638   ck_assert_ptr_eq(self->f->insertNSmash(self, 20, toInsert), NULL);
  14639   ck_assert_ptr_eq(self->f->insertNSmash(self, -5, toInsert), NULL);
  14640   smashO(toInsert);
  14641   // insert NULL
  14642   ck_assert_ptr_eq(self->f->insertNSmash(self, 0, NULL), NULL);
  14643   terminateO(self);
  14644 
  14645 END_TEST
  14646 
  14647 
  14648 START_TEST(insertSmallJsonSmallJsonT)
  14649 
  14650   smallJsont* r;
  14651   smallJsont *self = allocSmallJson();
  14652   smallJsont *toInsert;
  14653 
  14654   // add elements to self
  14655   r = self->f->pushInt(self, 1);
  14656   ck_assert_ptr_ne(r, null);
  14657   r = self->f->pushInt(self, 2);
  14658   ck_assert_ptr_ne(r, null);
  14659 
  14660   // positive index
  14661   toInsert = allocSmallJson();
  14662   toInsert->f->pushInt(toInsert, 3);
  14663   r        = self->f->insertSmallJson(self, 1, toInsert);
  14664   smashO(toInsert);
  14665   ck_assert_ptr_ne(r, null);
  14666   char *s  = toStringO(r);
  14667   ck_assert_str_eq(s, "[1,3,2]");
  14668   free(s);
  14669   // negative index
  14670   toInsert = allocSmallJson();
  14671   toInsert->f->pushInt(toInsert, 4);
  14672   r = self->f->insertSmallJson(self, -1, toInsert);
  14673   smashO(toInsert);
  14674   ck_assert_ptr_ne(r, null);
  14675   s = toStringO(r);
  14676   ck_assert_str_eq(s, "[1,3,2,4]");
  14677   free(s);
  14678   // empty list
  14679   emptyO(self);
  14680   toInsert = allocSmallJson();
  14681   toInsert->f->pushInt(toInsert, 3);
  14682   r = self->f->insertSmallJson(self, 0, toInsert);
  14683   smashO(toInsert);
  14684   ck_assert_ptr_ne(r, null);
  14685   s = toStringO(r);
  14686   ck_assert_str_eq(s, "[3]");
  14687   free(s);
  14688   emptyO(self);
  14689   toInsert = allocSmallJson();
  14690   toInsert->f->pushInt(toInsert, 3);
  14691   r = self->f->insertSmallJson(self, -1, toInsert);
  14692   smashO(toInsert);
  14693   ck_assert_ptr_ne(r, null);
  14694   s = toStringO(r);
  14695   ck_assert_str_eq(s, "[3]");
  14696   free(s);
  14697   // json array length 0
  14698   toInsert = allocSmallJson();
  14699   setTypeArrayG(toInsert);
  14700   r = self->f->insertSmallJson(self, -1, toInsert);
  14701   smashO(toInsert);
  14702   ck_assert_ptr_ne(r, null);
  14703   s = toStringO(r);
  14704   ck_assert_str_eq(s, "[3]");
  14705   free(s);
  14706   // json with no type
  14707   toInsert = allocSmallJson();
  14708   r = self->f->insertSmallJson(self, -1, toInsert);
  14709   smashO(toInsert);
  14710   ck_assert_ptr_eq(r, null);
  14711   s = toStringO(self);
  14712   ck_assert_str_eq(s, "[3]");
  14713   free(s);
  14714   // non smallJson object
  14715   toInsert = (smallJsont*) allocSmallInt(2);
  14716   r = self->f->insertSmallJson(self, -1, toInsert);
  14717   ck_assert_ptr_eq(r, null);
  14718   terminateO(toInsert);
  14719   // index outside
  14720   toInsert = allocSmallJson();
  14721   ck_assert_ptr_eq(self->f->insertSmallJson(self, 20, toInsert), NULL);
  14722   ck_assert_ptr_eq(self->f->insertSmallJson(self, -5, toInsert), NULL);
  14723   smashO(toInsert);
  14724   // insert NULL
  14725   ck_assert_ptr_eq(self->f->insertSmallJson(self, 0, NULL), NULL);
  14726   terminateO(self);
  14727 
  14728 END_TEST
  14729 
  14730 
  14731 START_TEST(insertNSmashSmallJsonSmallJsonT)
  14732 
  14733   smallJsont* r;
  14734   smallJsont *self = allocSmallJson();
  14735   smallJsont *toInsert;
  14736 
  14737   // add elements to self
  14738   r = self->f->pushInt(self, 1);
  14739   ck_assert_ptr_ne(r, null);
  14740   r = self->f->pushInt(self, 2);
  14741   ck_assert_ptr_ne(r, null);
  14742 
  14743   // positive index
  14744   toInsert = allocSmallJson();
  14745   toInsert->f->pushInt(toInsert, 3);
  14746   r        = self->f->insertNSmashSmallJson(self, 1, toInsert);
  14747   ck_assert_ptr_ne(r, null);
  14748   char *s  = toStringO(r);
  14749   ck_assert_str_eq(s, "[1,3,2]");
  14750   free(s);
  14751   // negative index
  14752   toInsert = allocSmallJson();
  14753   toInsert->f->pushInt(toInsert, 4);
  14754   r = self->f->insertNSmashSmallJson(self, -1, toInsert);
  14755   ck_assert_ptr_ne(r, null);
  14756   s = toStringO(r);
  14757   ck_assert_str_eq(s, "[1,3,2,4]");
  14758   free(s);
  14759   // empty list
  14760   emptyO(self);
  14761   toInsert = allocSmallJson();
  14762   toInsert->f->pushInt(toInsert, 3);
  14763   r = self->f->insertNSmashSmallJson(self, 0, toInsert);
  14764   ck_assert_ptr_ne(r, null);
  14765   s = toStringO(r);
  14766   ck_assert_str_eq(s, "[3]");
  14767   free(s);
  14768   emptyO(self);
  14769   toInsert = allocSmallJson();
  14770   toInsert->f->pushInt(toInsert, 3);
  14771   r = self->f->insertNSmashSmallJson(self, -1, toInsert);
  14772   ck_assert_ptr_ne(r, null);
  14773   s = toStringO(r);
  14774   ck_assert_str_eq(s, "[3]");
  14775   free(s);
  14776   // json array length 0
  14777   toInsert = allocSmallJson();
  14778   setTypeArrayG(toInsert);
  14779   r = self->f->insertNSmashSmallJson(self, -1, toInsert);
  14780   ck_assert_ptr_ne(r, null);
  14781   s = toStringO(r);
  14782   ck_assert_str_eq(s, "[3]");
  14783   free(s);
  14784   // json with no type
  14785   toInsert = allocSmallJson();
  14786   r = self->f->insertNSmashSmallJson(self, -1, toInsert);
  14787   smashO(toInsert);
  14788   ck_assert_ptr_eq(r, null);
  14789   s = toStringO(self);
  14790   ck_assert_str_eq(s, "[3]");
  14791   free(s);
  14792   // index outside
  14793   toInsert = allocSmallJson();
  14794   ck_assert_ptr_eq(self->f->insertNSmashSmallJson(self, 20, toInsert), NULL);
  14795   ck_assert_ptr_eq(self->f->insertNSmashSmallJson(self, -5, toInsert), NULL);
  14796   smashO(toInsert);
  14797   // insert NULL
  14798   ck_assert_ptr_eq(self->f->insertNSmashSmallJson(self, 0, NULL), NULL);
  14799   terminateO(self);
  14800 
  14801 END_TEST
  14802 
  14803 
  14804 START_TEST(insertStringSmallJsonT)
  14805 
  14806   smallJsont* r;
  14807   smallJsont *self = allocSmallJson();
  14808   setTopSO(self, "");
  14809   smallStringt *toInsert = allocSmallString("");
  14810 
  14811   // insert
  14812   freeO(self);
  14813   setTopSO(self, "sheepy");
  14814   setValO(toInsert, "lib");
  14815   r = insertStringO(self, 0, toInsert);
  14816   ck_assert_ptr_ne(r, null);
  14817   char *s = toStringO(r);
  14818   ck_assert_str_eq(s, "libsheepy");
  14819   free(s);
  14820   // negative index
  14821   setValO(toInsert, "P");
  14822   r = insertStringO(self, -2, toInsert);
  14823   ck_assert_ptr_ne(r, null);
  14824   s = toStringO(r);
  14825   ck_assert_str_eq(s, "libsheepPy");
  14826   free(s);
  14827   // edge
  14828   freeO(self);
  14829   setTopSO(self, "qwe");
  14830   setValO(toInsert, "C");
  14831   r = insertStringO(self, 3, toInsert);
  14832   ck_assert_ptr_ne(r, null);
  14833   s = toStringO(r);
  14834   ck_assert_str_eq(s, "qweC");
  14835   free(s);
  14836   // outside string
  14837   freeO(self);
  14838   setTopSO(self, "qwe");
  14839   r = insertStringO(self, 4, toInsert);
  14840   ck_assert_ptr_eq(r, NULL);
  14841   r = insertStringO(self, -5, toInsert);
  14842   ck_assert_ptr_eq(r, NULL);
  14843   // negative index in a one char string
  14844   freeO(self);
  14845   setTopSO(self, "s");
  14846   setValO(toInsert, "S");
  14847   r = insertStringO(self, -1, toInsert);
  14848   ck_assert_ptr_ne(r, null);
  14849   s = toStringO(r);
  14850   ck_assert_str_eq(s, "sS");
  14851   free(s);
  14852   // empty string
  14853   freeO(self);
  14854   setTopSO(self, "");
  14855   setValO(toInsert, "s");
  14856   r = insertStringO(self, 0, toInsert);
  14857   ck_assert_ptr_ne(r, null);
  14858   s = toStringO(r);
  14859   ck_assert_str_eq(s, "s");
  14860   free(s);
  14861   freeO(self);
  14862   setTopSO(self, "");
  14863   r = insertStringO(self, -1, toInsert);
  14864   ck_assert_ptr_ne(r, null);
  14865   s = toStringO(r);
  14866   ck_assert_str_eq(s, "s");
  14867   free(s);
  14868   // empty insert string
  14869   freeO(self);
  14870   setTopSO(self, "a");
  14871   setValO(toInsert, "");
  14872   r = insertStringO(self, 0, toInsert);
  14873   ck_assert_ptr_ne(r, null);
  14874   s = toStringO(r);
  14875   ck_assert_str_eq(s, "a");
  14876   free(s);
  14877   freeO(toInsert);
  14878   r = insertStringO(self, 0, toInsert);
  14879   ck_assert_ptr_ne(r, null);
  14880   s = toStringO(r);
  14881   ck_assert_str_eq(s, "a");
  14882   free(s);
  14883   // non smallString toInsert
  14884   terminateO(toInsert);
  14885   toInsert = (smallStringt*) allocSmallInt(1);
  14886   r = insertStringO(self, 0, toInsert);
  14887   ck_assert_ptr_eq(r, null);
  14888   terminateO(toInsert);
  14889   toInsert = allocSmallString("");
  14890   // NULL insert string
  14891   r = insertStringO(self, 0, NULL);
  14892   ck_assert_ptr_eq(r, null);
  14893   // NULL string
  14894   freeO(self);
  14895   setValO(toInsert, "s");
  14896   r = insertStringO(self, 1, toInsert);
  14897   ck_assert_ptr_eq(r, null);
  14898   r = insertStringO(self, 0, toInsert);
  14899   ck_assert_ptr_ne(r, null);
  14900   s = toStringO(r);
  14901   ck_assert_str_eq(s, "s");
  14902   free(s);
  14903   terminateO(toInsert);
  14904   terminateO(self);
  14905 
  14906 END_TEST
  14907 
  14908 
  14909 START_TEST(insertSSmallJsonT)
  14910 
  14911   smallJsont* r;
  14912   smallJsont *self = allocSmallJson();
  14913   setTopSO(self, "");
  14914 
  14915   // insert
  14916   freeO(self);
  14917   setTopSO(self, "sheepy");
  14918   r = insertSO(self, 0, "lib");
  14919   ck_assert_ptr_ne(r, null);
  14920   char *s = toStringO(r);
  14921   ck_assert_str_eq(s, "libsheepy");
  14922   free(s);
  14923   // negative index
  14924   r = insertSO(self, -2, "P");
  14925   ck_assert_ptr_ne(r, null);
  14926   s = toStringO(r);
  14927   ck_assert_str_eq(s, "libsheepPy");
  14928   free(s);
  14929   // edge
  14930   freeO(self);
  14931   setTopSO(self, "qwe");
  14932   r = insertSO(self, 3, "C");
  14933   ck_assert_ptr_ne(r, null);
  14934   s = toStringO(r);
  14935   ck_assert_str_eq(s, "qweC");
  14936   free(s);
  14937   // outside string
  14938   freeO(self);
  14939   setTopSO(self, "qwe");
  14940   r = insertSO(self, 4, "C");
  14941   ck_assert_ptr_eq(r, NULL);
  14942   r = insertSO(self, -5, "C");
  14943   ck_assert_ptr_eq(r, NULL);
  14944   // negative index in a one char string
  14945   freeO(self);
  14946   setTopSO(self, "s");
  14947   r = insertSO(self, -1, "S");
  14948   ck_assert_ptr_ne(r, null);
  14949   s = toStringO(r);
  14950   ck_assert_str_eq(s, "sS");
  14951   free(s);
  14952   // empty string
  14953   freeO(self);
  14954   setTopSO(self, "");
  14955   r = insertSO(self, 0, "s");
  14956   ck_assert_ptr_ne(r, null);
  14957   s = toStringO(r);
  14958   ck_assert_str_eq(s, "s");
  14959   free(s);
  14960   freeO(self);
  14961   setTopSO(self, "");
  14962   r = insertSO(self, -1, "s");
  14963   ck_assert_ptr_ne(r, null);
  14964   s = toStringO(r);
  14965   ck_assert_str_eq(s, "s");
  14966   free(s);
  14967   // empty insert string
  14968   freeO(self);
  14969   setTopSO(self, "a");
  14970   r = insertSO(self, 0, "");
  14971   ck_assert_ptr_ne(r, null);
  14972   s = toStringO(r);
  14973   ck_assert_str_eq(s, "a");
  14974   free(s);
  14975   // NULL insert string
  14976   r = insertSO(self, 0, NULL);
  14977   ck_assert_ptr_ne(r, null);
  14978   s = toStringO(r);
  14979   ck_assert_str_eq(s, "a");
  14980   free(s);
  14981   // NULL string
  14982   freeO(self);
  14983   r = insertSO(self, 0, "s");
  14984   ck_assert_ptr_ne(r, null);
  14985   s = toStringO(r);
  14986   ck_assert_str_eq(s, "s");
  14987   free(s);
  14988   // non json array
  14989   freeO(self);
  14990   setTypeBoolO(self);
  14991   ck_assert_ptr_eq(insertSO(self, 0, "asd"), NULL);
  14992   terminateO(self);
  14993 
  14994 END_TEST
  14995 
  14996 
  14997 START_TEST(insertNFreeStringSmallJsonT)
  14998 
  14999   smallJsont* r;
  15000   smallJsont *self = allocSmallJson();
  15001   setTopSO(self, "");
  15002   smallStringt *toInsert = allocSmallString("");
  15003 
  15004   // insert
  15005   freeO(self);
  15006   setTopSO(self, "sheepy");
  15007   setValO(toInsert, "lib");
  15008   r = self->f->insertNFreeString(self, 0, toInsert);
  15009   ck_assert_ptr_ne(r, null);
  15010   char *s = toStringO(r);
  15011   ck_assert_str_eq(s, "libsheepy");
  15012   free(s);
  15013   // negative index
  15014   toInsert = allocSmallString("P");
  15015   r = self->f->insertNFreeString(self, -2, toInsert);
  15016   ck_assert_ptr_ne(r, null);
  15017   s = toStringO(r);
  15018   ck_assert_str_eq(s, "libsheepPy");
  15019   free(s);
  15020   // edge
  15021   freeO(self);
  15022   setTopSO(self, "qwe");
  15023   toInsert = allocSmallString("C");
  15024   r = self->f->insertNFreeString(self, 3, toInsert);
  15025   ck_assert_ptr_ne(r, null);
  15026   s = toStringO(r);
  15027   ck_assert_str_eq(s, "qweC");
  15028   free(s);
  15029   // outside string
  15030   freeO(self);
  15031   setTopSO(self, "qwe");
  15032   toInsert = allocSmallString("S");
  15033   r = self->f->insertNFreeString(self, 4, toInsert);
  15034   ck_assert_ptr_eq(r, NULL);
  15035   r = self->f->insertNFreeString(self, -5, toInsert);
  15036   ck_assert_ptr_eq(r, NULL);
  15037   // negative index in a one char string
  15038   freeO(self);
  15039   setTopSO(self, "s");
  15040   r = self->f->insertNFreeString(self, -1, toInsert);
  15041   ck_assert_ptr_ne(r, null);
  15042   s = toStringO(r);
  15043   ck_assert_str_eq(s, "sS");
  15044   free(s);
  15045   // empty string
  15046   freeO(self);
  15047   setTopSO(self, "");
  15048   toInsert = allocSmallString("s");
  15049   r = self->f->insertNFreeString(self, 0, toInsert);
  15050   ck_assert_ptr_ne(r, null);
  15051   s = toStringO(r);
  15052   ck_assert_str_eq(s, "s");
  15053   free(s);
  15054   freeO(self);
  15055   setTopSO(self, "");
  15056   toInsert = allocSmallString("s");
  15057   r = self->f->insertNFreeString(self, -1, toInsert);
  15058   ck_assert_ptr_ne(r, null);
  15059   s = toStringO(r);
  15060   ck_assert_str_eq(s, "s");
  15061   free(s);
  15062   // empty insert string
  15063   freeO(self);
  15064   setTopSO(self, "a");
  15065   toInsert = allocSmallString("");
  15066   r = self->f->insertNFreeString(self, 0, toInsert);
  15067   ck_assert_ptr_ne(r, null);
  15068   s = toStringO(r);
  15069   ck_assert_str_eq(s, "a");
  15070   free(s);
  15071   toInsert = allocSmallString("");
  15072   freeO(toInsert);
  15073   r = self->f->insertNFreeString(self, 0, toInsert);
  15074   ck_assert_ptr_ne(r, null);
  15075   s = toStringO(r);
  15076   ck_assert_str_eq(s, "a");
  15077   free(s);
  15078   // non smallString toInsert
  15079   toInsert = (smallStringt*) allocSmallInt(1);
  15080   r = self->f->insertNFreeString(self, 0, toInsert);
  15081   ck_assert_ptr_eq(r, null);
  15082   terminateO(toInsert);
  15083   toInsert = allocSmallString("s");
  15084   // NULL insert string
  15085   r = self->f->insertNFreeString(self, 0, NULL);
  15086   ck_assert_ptr_eq(r, null);
  15087   // NULL string
  15088   freeO(self);
  15089   r = self->f->insertNFreeString(self, 1, toInsert);
  15090   ck_assert_ptr_eq(r, null);
  15091   r = self->f->insertNFreeString(self, 0, toInsert);
  15092   ck_assert_ptr_ne(r, null);
  15093   s = toStringO(r);
  15094   ck_assert_str_eq(s, "s");
  15095   free(s);
  15096   terminateO(self);
  15097 
  15098 END_TEST
  15099 
  15100 
  15101 START_TEST(insertSNFreeSmallJsonT)
  15102 
  15103   smallJsont* r;
  15104   smallJsont *self = allocSmallJson();
  15105   setTopSO(self, "");
  15106 
  15107   // insert
  15108   freeO(self);
  15109   setTopSO(self, "sheepy");
  15110   r = insertSNFreeO(self, 0, strdup("lib"));
  15111   ck_assert_ptr_ne(r, null);
  15112   char *s = toStringO(r);
  15113   ck_assert_str_eq(s, "libsheepy");
  15114   free(s);
  15115   // negative index
  15116   r = insertSNFreeO(self, -2, strdup("P"));
  15117   ck_assert_ptr_ne(r, null);
  15118   s = toStringO(r);
  15119   ck_assert_str_eq(s, "libsheepPy");
  15120   free(s);
  15121   // edge
  15122   freeO(self);
  15123   setTopSO(self, "qwe");
  15124   r = insertSNFreeO(self, 3, strdup("C"));
  15125   ck_assert_ptr_ne(r, null);
  15126   s = toStringO(r);
  15127   ck_assert_str_eq(s, "qweC");
  15128   free(s);
  15129   // outside string
  15130   freeO(self);
  15131   setTopSO(self, "qwe");
  15132   r = insertSNFreeO(self, 4, "C");
  15133   ck_assert_ptr_eq(r, NULL);
  15134   r = insertSNFreeO(self, -5, "C");
  15135   ck_assert_ptr_eq(r, NULL);
  15136   // negative index in a one char string
  15137   freeO(self);
  15138   setTopSO(self, "s");
  15139   r = insertSNFreeO(self, -1, strdup("S"));
  15140   ck_assert_ptr_ne(r, null);
  15141   s = toStringO(r);
  15142   ck_assert_str_eq(s, "sS");
  15143   free(s);
  15144   // empty string
  15145   freeO(self);
  15146   setTopSO(self, "");
  15147   r = insertSNFreeO(self, 0, strdup("s"));
  15148   ck_assert_ptr_ne(r, null);
  15149   s = toStringO(r);
  15150   ck_assert_str_eq(s, "s");
  15151   free(s);
  15152   freeO(self);
  15153   setTopSO(self, "");
  15154   r = insertSNFreeO(self, -1, strdup("s"));
  15155   ck_assert_ptr_ne(r, null);
  15156   s = toStringO(r);
  15157   ck_assert_str_eq(s, "s");
  15158   free(s);
  15159   // empty insert string
  15160   freeO(self);
  15161   setTopSO(self, "a");
  15162   r = insertSNFreeO(self, 0, strdup(""));
  15163   ck_assert_ptr_ne(r, null);
  15164   s = toStringO(r);
  15165   ck_assert_str_eq(s, "a");
  15166   free(s);
  15167   // NULL insert string
  15168   r = insertSNFreeO(self, 0, NULL);
  15169   ck_assert_ptr_ne(r, null);
  15170   s = toStringO(r);
  15171   ck_assert_str_eq(s, "a");
  15172   free(s);
  15173   // NULL string
  15174   freeO(self);
  15175   r = insertSNFreeO(self, 0, strdup("s"));
  15176   ck_assert_ptr_ne(r, null);
  15177   s = toStringO(r);
  15178   ck_assert_str_eq(s, "s");
  15179   free(s);
  15180   terminateO(self);
  15181 
  15182 END_TEST
  15183 
  15184 
  15185 START_TEST(injectSmallJsonT)
  15186 
  15187   smallJsont* r;
  15188   smallJsont *self = allocSmallJson();
  15189   baset *toInject;
  15190 
  15191   // add elements to self
  15192   r = self->f->pushInt(self, 1);
  15193   ck_assert_ptr_ne(r, null);
  15194   r = self->f->pushInt(self, 2);
  15195   ck_assert_ptr_ne(r, null);
  15196   r = self->f->pushInt(self, 3);
  15197   ck_assert_ptr_ne(r, null);
  15198   r = self->f->pushInt(self, 4);
  15199   ck_assert_ptr_ne(r, null);
  15200 
  15201   // positive index
  15202   toInject = (baset*) allocSmallInt(8);
  15203   r        = self->f->inject(self, 1, toInject);
  15204   ck_assert_ptr_ne(r, null);
  15205   finishO(toInject);
  15206   char *s  = toStringO(r);
  15207   ck_assert_str_eq(s, "[1,8,2,3,4]");
  15208   free(s);
  15209   // negative index
  15210   toInject = (baset*) allocSmallInt(9);
  15211   r = self->f->inject(self,-1, toInject);
  15212   ck_assert_ptr_ne(r, null);
  15213   finishO(toInject);
  15214   s = toStringO(r);
  15215   ck_assert_str_eq(s, "[1,8,2,3,4,9]");
  15216   free(s);
  15217   // index 0
  15218   toInject = (baset*) allocSmallInt(6);
  15219   r = self->f->inject(self,0, toInject);
  15220   ck_assert_ptr_ne(r, null);
  15221   finishO(toInject);
  15222   s = toStringO(r);
  15223   ck_assert_str_eq(s, "[6,1,8,2,3,4,9]");
  15224   free(s);
  15225   // index outside
  15226   toInject = (baset*) allocSmallInt(7);
  15227   ck_assert_ptr_eq(self->f->inject(self, 20, toInject), NULL);
  15228   ck_assert_ptr_eq(self->f->inject(self, -9, toInject), NULL);
  15229   terminateO(toInject);
  15230   // empty list
  15231   emptyO(self);
  15232   toInject = (baset*) allocSmallInt(7);
  15233   ck_assert_ptr_ne(self->f->inject(self, 0, toInject), NULL);
  15234   finishO(toInject);
  15235   s = toStringO(r);
  15236   ck_assert_str_eq(s, "[7]");
  15237   free(s);
  15238   emptyO(self);
  15239   toInject = (baset*) allocSmallInt(7);
  15240   ck_assert_ptr_ne(self->f->inject(self, -1, toInject), NULL);
  15241   finishO(toInject);
  15242   s = toStringO(r);
  15243   ck_assert_str_eq(s, "[7]");
  15244   free(s);
  15245   // null toInject
  15246   ck_assert_ptr_eq(self->f->inject(self, 0, NULL), NULL);
  15247   // non json array
  15248   freeO(self);
  15249   setTypeBoolO(self);
  15250   toInject = (baset*) allocSmallInt(7);
  15251   ck_assert_ptr_eq(self->f->inject(self, 0, toInject), NULL);
  15252   terminateO(toInject);
  15253   terminateO(self);
  15254 
  15255 END_TEST
  15256 
  15257 
  15258 START_TEST(injectUndefinedSmallJsonT)
  15259 
  15260   smallJsont* r;
  15261   smallJsont *self = allocSmallJson();
  15262 
  15263   // add elements to self
  15264   r = self->f->pushInt(self, 1);
  15265   ck_assert_ptr_ne(r, null);
  15266   r = self->f->pushInt(self, 2);
  15267   ck_assert_ptr_ne(r, null);
  15268   r = self->f->pushInt(self, 3);
  15269   ck_assert_ptr_ne(r, null);
  15270   r = self->f->pushInt(self, 4);
  15271   ck_assert_ptr_ne(r, null);
  15272 
  15273   // positive index
  15274   r        = self->f->injectUndefined(self, 1);
  15275   ck_assert_ptr_ne(r, null);
  15276   char *s  = toStringO(r);
  15277   ck_assert_str_eq(s, "[1,null,2,3,4]");
  15278   free(s);
  15279   // negative index
  15280   r = self->f->injectUndefined(self,-1);
  15281   ck_assert_ptr_ne(r, null);
  15282   s = toStringO(r);
  15283   ck_assert_str_eq(s, "[1,null,2,3,4,null]");
  15284   free(s);
  15285   // index 0
  15286   r = self->f->injectUndefined(self,0);
  15287   ck_assert_ptr_ne(r, null);
  15288   s = toStringO(r);
  15289   ck_assert_str_eq(s, "[null,1,null,2,3,4,null]");
  15290   free(s);
  15291   // index outside
  15292   ck_assert_ptr_eq(self->f->injectUndefined(self, 20), NULL);
  15293   ck_assert_ptr_eq(self->f->injectUndefined(self, -9), NULL);
  15294   // empty list
  15295   emptyO(self);
  15296   ck_assert_ptr_ne(self->f->injectUndefined(self, 0), NULL);
  15297   s = toStringO(r);
  15298   ck_assert_str_eq(s, "[null]");
  15299   free(s);
  15300   emptyO(self);
  15301   ck_assert_ptr_ne(self->f->injectUndefined(self, -1), NULL);
  15302   s = toStringO(r);
  15303   ck_assert_str_eq(s, "[null]");
  15304   free(s);
  15305   terminateO(self);
  15306 
  15307 END_TEST
  15308 
  15309 
  15310 START_TEST(injectBoolSmallJsonT)
  15311 
  15312   smallJsont* r;
  15313   smallJsont *self = allocSmallJson();
  15314 
  15315   // add elements to self
  15316   r = self->f->pushInt(self, 1);
  15317   ck_assert_ptr_ne(r, null);
  15318   r = self->f->pushInt(self, 2);
  15319   ck_assert_ptr_ne(r, null);
  15320   r = self->f->pushInt(self, 3);
  15321   ck_assert_ptr_ne(r, null);
  15322   r = self->f->pushInt(self, 4);
  15323   ck_assert_ptr_ne(r, null);
  15324 
  15325   // positive index
  15326   r        = self->f->injectBool(self, 1, true);
  15327   ck_assert_ptr_ne(r, null);
  15328   char *s  = toStringO(r);
  15329   ck_assert_str_eq(s, "[1,true,2,3,4]");
  15330   free(s);
  15331   // negative index
  15332   r = self->f->injectBool(self,-1, true);
  15333   ck_assert_ptr_ne(r, null);
  15334   s = toStringO(r);
  15335   ck_assert_str_eq(s, "[1,true,2,3,4,true]");
  15336   free(s);
  15337   // index 0
  15338   r = self->f->injectBool(self,0, true);
  15339   ck_assert_ptr_ne(r, null);
  15340   s = toStringO(r);
  15341   ck_assert_str_eq(s, "[true,1,true,2,3,4,true]");
  15342   free(s);
  15343   // index outside
  15344   ck_assert_ptr_eq(self->f->injectBool(self, 20, true), NULL);
  15345   ck_assert_ptr_eq(self->f->injectBool(self, -9, true), NULL);
  15346   // empty list
  15347   emptyO(self);
  15348   ck_assert_ptr_ne(self->f->injectBool(self, 0, true), NULL);
  15349   s = toStringO(r);
  15350   ck_assert_str_eq(s, "[true]");
  15351   free(s);
  15352   emptyO(self);
  15353   ck_assert_ptr_ne(self->f->injectBool(self, -1, true), NULL);
  15354   s = toStringO(r);
  15355   ck_assert_str_eq(s, "[true]");
  15356   free(s);
  15357   // non json array
  15358   freeO(self);
  15359   setTypeBoolO(self);
  15360   ck_assert_ptr_eq(self->f->injectBool(self, 0, true), NULL);
  15361   terminateO(self);
  15362 
  15363 END_TEST
  15364 
  15365 
  15366 START_TEST(injectDoubleSmallJsonT)
  15367 
  15368   smallJsont* r;
  15369   smallJsont *self = allocSmallJson();
  15370 
  15371   // add elements to self
  15372   r = self->f->pushInt(self, 1);
  15373   ck_assert_ptr_ne(r, null);
  15374   r = self->f->pushInt(self, 2);
  15375   ck_assert_ptr_ne(r, null);
  15376   r = self->f->pushInt(self, 3);
  15377   ck_assert_ptr_ne(r, null);
  15378   r = self->f->pushInt(self, 4);
  15379   ck_assert_ptr_ne(r, null);
  15380 
  15381   // positive index
  15382   r        = self->f->injectDouble(self, 1, 7);
  15383   ck_assert_ptr_ne(r, null);
  15384   char *s  = toStringO(r);
  15385   ck_assert_str_eq(s, "[1,7.000000e+00,2,3,4]");
  15386   free(s);
  15387   // negative index
  15388   r = self->f->injectDouble(self,-1, 8);
  15389   ck_assert_ptr_ne(r, null);
  15390   s = toStringO(r);
  15391   ck_assert_str_eq(s, "[1,7.000000e+00,2,3,4,8.000000e+00]");
  15392   free(s);
  15393   // index 0
  15394   r = self->f->injectDouble(self,0, 9);
  15395   ck_assert_ptr_ne(r, null);
  15396   s = toStringO(r);
  15397   ck_assert_str_eq(s, "[9.000000e+00,1,7.000000e+00,2,3,4,8.000000e+00]");
  15398   free(s);
  15399   // index outside
  15400   ck_assert_ptr_eq(self->f->injectDouble(self, 20, 7.000000e+00), NULL);
  15401   ck_assert_ptr_eq(self->f->injectDouble(self, -9, 7.000000e+00), NULL);
  15402   // empty list
  15403   emptyO(self);
  15404   ck_assert_ptr_ne(self->f->injectDouble(self, 0, 9), NULL);
  15405   s = toStringO(r);
  15406   ck_assert_str_eq(s, "[9.000000e+00]");
  15407   free(s);
  15408   emptyO(self);
  15409   ck_assert_ptr_ne(self->f->injectDouble(self, -1, 9), NULL);
  15410   s = toStringO(r);
  15411   ck_assert_str_eq(s, "[9.000000e+00]");
  15412   free(s);
  15413   // non json array
  15414   freeO(self);
  15415   setTypeBoolO(self);
  15416   ck_assert_ptr_eq(self->f->injectDouble(self, 0, 0), NULL);
  15417   terminateO(self);
  15418 
  15419 END_TEST
  15420 
  15421 
  15422 START_TEST(injectIntSmallJsonT)
  15423 
  15424   smallJsont* r;
  15425   smallJsont *self = allocSmallJson();
  15426 
  15427   // add elements to self
  15428   r = self->f->pushInt(self, 1);
  15429   ck_assert_ptr_ne(r, null);
  15430   r = self->f->pushInt(self, 2);
  15431   ck_assert_ptr_ne(r, null);
  15432   r = self->f->pushInt(self, 3);
  15433   ck_assert_ptr_ne(r, null);
  15434   r = self->f->pushInt(self, 4);
  15435   ck_assert_ptr_ne(r, null);
  15436 
  15437   // positive index
  15438   r        = self->f->injectInt(self, 1, 5);
  15439   ck_assert_ptr_ne(r, null);
  15440   char *s  = toStringO(r);
  15441   ck_assert_str_eq(s, "[1,5,2,3,4]");
  15442   free(s);
  15443   // negative index
  15444   r = self->f->injectInt(self,-1, 6);
  15445   ck_assert_ptr_ne(r, null);
  15446   s = toStringO(r);
  15447   ck_assert_str_eq(s, "[1,5,2,3,4,6]");
  15448   free(s);
  15449   // index 0
  15450   r = self->f->injectInt(self,0, 7);
  15451   ck_assert_ptr_ne(r, null);
  15452   s = toStringO(r);
  15453   ck_assert_str_eq(s, "[7,1,5,2,3,4,6]");
  15454   free(s);
  15455   // index outside
  15456   ck_assert_ptr_eq(self->f->injectInt(self, 20, true), NULL);
  15457   ck_assert_ptr_eq(self->f->injectInt(self, -9, true), NULL);
  15458   // empty list
  15459   emptyO(self);
  15460   ck_assert_ptr_ne(self->f->injectInt(self, 0, 7), NULL);
  15461   s = toStringO(r);
  15462   ck_assert_str_eq(s, "[7]");
  15463   free(s);
  15464   emptyO(self);
  15465   ck_assert_ptr_ne(self->f->injectInt(self, -1, 7), NULL);
  15466   s = toStringO(r);
  15467   ck_assert_str_eq(s, "[7]");
  15468   free(s);
  15469   // non json array
  15470   freeO(self);
  15471   setTypeBoolO(self);
  15472   ck_assert_ptr_eq(self->f->injectInt(self, 0, 0), NULL);
  15473   terminateO(self);
  15474 
  15475 END_TEST
  15476 
  15477 
  15478 START_TEST(injectSSmallJsonT)
  15479 
  15480   smallJsont* r;
  15481   smallJsont *self = allocSmallJson();
  15482 
  15483   // add elements to self
  15484   r = self->f->pushInt(self, 1);
  15485   ck_assert_ptr_ne(r, null);
  15486   r = self->f->pushInt(self, 2);
  15487   ck_assert_ptr_ne(r, null);
  15488   r = self->f->pushInt(self, 3);
  15489   ck_assert_ptr_ne(r, null);
  15490   r = self->f->pushInt(self, 4);
  15491   ck_assert_ptr_ne(r, null);
  15492   // positive index
  15493   r        = self->f->injectS(self, 1, "5");
  15494   ck_assert_ptr_ne(r, null);
  15495   char *s  = toStringO(r);
  15496   ck_assert_str_eq(s, "[1,\"5\",2,3,4]");
  15497   free(s);
  15498   // negative index
  15499   r = self->f->injectS(self,-1, "6");
  15500   ck_assert_ptr_ne(r, null);
  15501   s = toStringO(r);
  15502   ck_assert_str_eq(s, "[1,\"5\",2,3,4,\"6\"]");
  15503   free(s);
  15504   // index 0
  15505   r = self->f->injectS(self,0, "7");
  15506   ck_assert_ptr_ne(r, null);
  15507   s = toStringO(r);
  15508   ck_assert_str_eq(s, "[\"7\",1,\"5\",2,3,4,\"6\"]");
  15509   free(s);
  15510   // null toInject
  15511   r = self->f->injectS(self,0, null);
  15512   ck_assert_ptr_eq(r, null);
  15513   s = toStringO(self);
  15514   ck_assert_str_eq(s, "[\"7\",1,\"5\",2,3,4,\"6\"]");
  15515   free(s);
  15516   // index outside
  15517   ck_assert_ptr_eq(self->f->injectS(self, 20, ""), NULL);
  15518   ck_assert_ptr_eq(self->f->injectS(self, -9, ""), NULL);
  15519   // empty list
  15520   emptyO(self);
  15521   ck_assert_ptr_ne(self->f->injectS(self, 0, "7"), NULL);
  15522   s = toStringO(self);
  15523   ck_assert_str_eq(s, "[\"7\"]");
  15524   free(s);
  15525   emptyO(self);
  15526   ck_assert_ptr_ne(self->f->injectS(self, -1, "7"), NULL);
  15527   s = toStringO(self);
  15528   ck_assert_str_eq(s, "[\"7\"]");
  15529   free(s);
  15530   // non json array
  15531   freeO(self);
  15532   setTypeBoolO(self);
  15533   ck_assert_ptr_eq(self->f->injectS(self, 0, "7"), NULL);
  15534   terminateO(self);
  15535   // json string
  15536   self = allocSmallJson();
  15537   setTopSO(self, "s");
  15538   r = self->f->injectS(self,1, "heepy");
  15539   ck_assert_ptr_ne(r, null);
  15540   s = toStringO(r);
  15541   ck_assert_str_eq(s, "sheepy");
  15542   free(s);
  15543   terminateO(self);
  15544 
  15545 END_TEST
  15546 
  15547 
  15548 START_TEST(injectCharSmallJsonT)
  15549 
  15550   smallJsont* r;
  15551   smallJsont *self = allocSmallJson();
  15552 
  15553   // add elements to self
  15554   r = self->f->pushInt(self, 1);
  15555   ck_assert_ptr_ne(r, null);
  15556   r = self->f->pushInt(self, 2);
  15557   ck_assert_ptr_ne(r, null);
  15558   r = self->f->pushInt(self, 3);
  15559   ck_assert_ptr_ne(r, null);
  15560   r = self->f->pushInt(self, 4);
  15561   ck_assert_ptr_ne(r, null);
  15562 
  15563   // positive index
  15564   r        = self->f->injectChar(self, 1, '5');
  15565   ck_assert_ptr_ne(r, null);
  15566   char *s  = toStringO(r);
  15567   ck_assert_str_eq(s, "[1,\"5\",2,3,4]");
  15568   free(s);
  15569   // negative index
  15570   r = self->f->injectChar(self,-1, '6');
  15571   ck_assert_ptr_ne(r, null);
  15572   s = toStringO(r);
  15573   ck_assert_str_eq(s, "[1,\"5\",2,3,4,\"6\"]");
  15574   free(s);
  15575   // index 0
  15576   r = self->f->injectChar(self,0, '7');
  15577   ck_assert_ptr_ne(r, null);
  15578   s = toStringO(r);
  15579   ck_assert_str_eq(s, "[\"7\",1,\"5\",2,3,4,\"6\"]");
  15580   free(s);
  15581   // index outside
  15582   ck_assert_ptr_eq(self->f->injectChar(self, 20, 'y'), NULL);
  15583   ck_assert_ptr_eq(self->f->injectChar(self, -9, 'y'), NULL);
  15584   // empty list
  15585   emptyO(self);
  15586   ck_assert_ptr_ne(self->f->injectChar(self, 0, '7'), NULL);
  15587   s = toStringO(r);
  15588   ck_assert_str_eq(s, "[\"7\"]");
  15589   free(s);
  15590   emptyO(self);
  15591   ck_assert_ptr_ne(self->f->injectChar(self, -1, '7'), NULL);
  15592   s = toStringO(r);
  15593   ck_assert_str_eq(s, "[\"7\"]");
  15594   free(s);
  15595   terminateO(self);
  15596 
  15597 END_TEST
  15598 
  15599 
  15600 START_TEST(injectDictSmallJsonT)
  15601 
  15602   smallJsont* r;
  15603   smallJsont *self = allocSmallJson();
  15604   smallDictt *toInject;
  15605 
  15606   // add elements to self
  15607   r = self->f->pushInt(self, 1);
  15608   ck_assert_ptr_ne(r, null);
  15609   r = self->f->pushInt(self, 2);
  15610   ck_assert_ptr_ne(r, null);
  15611   r = self->f->pushInt(self, 3);
  15612   ck_assert_ptr_ne(r, null);
  15613   r = self->f->pushInt(self, 4);
  15614   ck_assert_ptr_ne(r, null);
  15615 
  15616   // positive index
  15617   toInject = allocSmallDict();
  15618   r        = self->f->injectDict(self, 1, toInject);
  15619   ck_assert_ptr_ne(r, null);
  15620   finishO(toInject);
  15621   char *s  = toStringO(r);
  15622   ck_assert_str_eq(s, "[1,{},2,3,4]");
  15623   free(s);
  15624   // negative index
  15625   toInject = allocSmallDict();
  15626   r = self->f->injectDict(self,-1, toInject);
  15627   ck_assert_ptr_ne(r, null);
  15628   finishO(toInject);
  15629   s = toStringO(r);
  15630   ck_assert_str_eq(s, "[1,{},2,3,4,{}]");
  15631   free(s);
  15632   // index 0
  15633   toInject = allocSmallDict();
  15634   r = self->f->injectDict(self,0, toInject);
  15635   ck_assert_ptr_ne(r, null);
  15636   finishO(toInject);
  15637   s = toStringO(r);
  15638   ck_assert_str_eq(s, "[{},1,{},2,3,4,{}]");
  15639   free(s);
  15640   // index outside
  15641   toInject = allocSmallDict();
  15642   ck_assert_ptr_eq(self->f->injectDict(self, 20, toInject), NULL);
  15643   ck_assert_ptr_eq(self->f->injectDict(self, -9, toInject), NULL);
  15644   terminateO(toInject);
  15645   // empty list
  15646   emptyO(self);
  15647   toInject = allocSmallDict();
  15648   ck_assert_ptr_ne(self->f->injectDict(self, 0, toInject), NULL);
  15649   finishO(toInject);
  15650   s = toStringO(r);
  15651   ck_assert_str_eq(s, "[{}]");
  15652   free(s);
  15653   emptyO(self);
  15654   toInject = allocSmallDict();
  15655   ck_assert_ptr_ne(self->f->injectDict(self, -1, toInject), NULL);
  15656   finishO(toInject);
  15657   s = toStringO(r);
  15658   ck_assert_str_eq(s, "[{}]");
  15659   free(s);
  15660   // non smallDict object
  15661   toInject = (smallDictt*) allocSmallInt(2);
  15662   r = self->f->injectDict(self, 0, toInject);
  15663   ck_assert_ptr_eq(r, null);
  15664   terminateO(toInject);
  15665   // null toInsert
  15666   ck_assert_ptr_eq(self->f->injectDict(self, 0, NULL), NULL);
  15667   // non json array
  15668   freeO(self);
  15669   setTypeBoolO(self);
  15670   toInject = allocSmallDict();
  15671   ck_assert_ptr_eq(self->f->injectDict(self, 0, toInject), NULL);
  15672   terminateO(toInject);
  15673   terminateO(self);
  15674 
  15675 END_TEST
  15676 
  15677 
  15678 START_TEST(injectArraySmallJsonT)
  15679 
  15680   smallJsont* r;
  15681   smallJsont *self = allocSmallJson();
  15682   smallArrayt *toInject;
  15683 
  15684   // add elements to self
  15685   r = self->f->pushInt(self, 1);
  15686   ck_assert_ptr_ne(r, null);
  15687   r = self->f->pushInt(self, 2);
  15688   ck_assert_ptr_ne(r, null);
  15689   r = self->f->pushInt(self, 3);
  15690   ck_assert_ptr_ne(r, null);
  15691   r = self->f->pushInt(self, 4);
  15692   ck_assert_ptr_ne(r, null);
  15693 
  15694   // positive index
  15695   toInject = allocSmallArray();
  15696   r        = self->f->injectArray(self, 1, toInject);
  15697   ck_assert_ptr_ne(r, null);
  15698   finishO(toInject);
  15699   char *s  = toStringO(r);
  15700   ck_assert_str_eq(s, "[1,[],2,3,4]");
  15701   free(s);
  15702   // negative index
  15703   toInject = allocSmallArray();
  15704   r = self->f->injectArray(self,-1, toInject);
  15705   ck_assert_ptr_ne(r, null);
  15706   finishO(toInject);
  15707   s = toStringO(r);
  15708   ck_assert_str_eq(s, "[1,[],2,3,4,[]]");
  15709   free(s);
  15710   // index 0
  15711   toInject = allocSmallArray();
  15712   r = self->f->injectArray(self,0, toInject);
  15713   ck_assert_ptr_ne(r, null);
  15714   finishO(toInject);
  15715   s = toStringO(r);
  15716   ck_assert_str_eq(s, "[[],1,[],2,3,4,[]]");
  15717   free(s);
  15718   // index outside
  15719   toInject = allocSmallArray();
  15720   ck_assert_ptr_eq(self->f->injectArray(self, 20, toInject), NULL);
  15721   ck_assert_ptr_eq(self->f->injectArray(self, -9, toInject), NULL);
  15722   terminateO(toInject);
  15723   // empty list
  15724   emptyO(self);
  15725   toInject = allocSmallArray();
  15726   ck_assert_ptr_ne(self->f->injectArray(self, 0, toInject), NULL);
  15727   finishO(toInject);
  15728   s = toStringO(r);
  15729   ck_assert_str_eq(s, "[[]]");
  15730   free(s);
  15731   emptyO(self);
  15732   toInject = allocSmallArray();
  15733   ck_assert_ptr_ne(self->f->injectArray(self, -1, toInject), NULL);
  15734   finishO(toInject);
  15735   s = toStringO(r);
  15736   ck_assert_str_eq(s, "[[]]");
  15737   free(s);
  15738   // non smallArray object
  15739   toInject = (smallArrayt*) allocSmallInt(2);
  15740   r = self->f->injectArray(self, 0, toInject);
  15741   ck_assert_ptr_eq(r, null);
  15742   terminateO(toInject);
  15743   // null toInsert
  15744   ck_assert_ptr_eq(self->f->injectArray(self, 0, NULL), NULL);
  15745   // non json array
  15746   freeO(self);
  15747   setTypeBoolO(self);
  15748   toInject = allocSmallArray();
  15749   ck_assert_ptr_eq(self->f->injectArray(self, 0, toInject), NULL);
  15750   terminateO(toInject);
  15751   terminateO(self);
  15752 
  15753 END_TEST
  15754 
  15755 
  15756 START_TEST(injectArraycSmallJsonT)
  15757 
  15758   smallJsont* r;
  15759   smallJsont *self = allocSmallJson();
  15760   char **toInject;
  15761 
  15762   // add elements to self
  15763   r = self->f->pushInt(self, 1);
  15764   ck_assert_ptr_ne(r, null);
  15765   r = self->f->pushInt(self, 2);
  15766   ck_assert_ptr_ne(r, null);
  15767   r = self->f->pushInt(self, 3);
  15768   ck_assert_ptr_ne(r, null);
  15769   r = self->f->pushInt(self, 4);
  15770   ck_assert_ptr_ne(r, null);
  15771 
  15772   // positive index
  15773   toInject = listCreateS("a","b");
  15774   r        = self->f->injectArrayc(self, 1, toInject);
  15775   listFreeS(toInject);
  15776   ck_assert_ptr_ne(r, null);
  15777   char *s  = toStringO(r);
  15778   ck_assert_str_eq(s, "[1,[\"a\",\"b\"],2,3,4]");
  15779   free(s);
  15780   // negative index
  15781   toInject = listCreateS("c","d");
  15782   r = self->f->injectArrayc(self,-1, toInject);
  15783   listFreeS(toInject);
  15784   ck_assert_ptr_ne(r, null);
  15785   s = toStringO(r);
  15786   ck_assert_str_eq(s, "[1,[\"a\",\"b\"],2,3,4,[\"c\",\"d\"]]");
  15787   free(s);
  15788   // index 0
  15789   toInject = listCreateS("e","ff");
  15790   r = self->f->injectArrayc(self,0, toInject);
  15791   listFreeS(toInject);
  15792   ck_assert_ptr_ne(r, null);
  15793   s = toStringO(r);
  15794   ck_assert_str_eq(s, "[[\"e\",\"ff\"],1,[\"a\",\"b\"],2,3,4,[\"c\",\"d\"]]");
  15795   free(s);
  15796   // index outside
  15797   toInject = listCreateS("a","b");
  15798   ck_assert_ptr_eq(self->f->injectArrayc(self, 20, toInject), NULL);
  15799   ck_assert_ptr_eq(self->f->injectArrayc(self, -9, toInject), NULL);
  15800   listFreeS(toInject);
  15801   // empty list
  15802   emptyO(self);
  15803   toInject = listCreateS("a","b");
  15804   ck_assert_ptr_ne(self->f->injectArrayc(self, 0, toInject), NULL);
  15805   listFreeS(toInject);
  15806   s = toStringO(r);
  15807   ck_assert_str_eq(s, "[[\"a\",\"b\"]]");
  15808   free(s);
  15809   emptyO(self);
  15810   toInject = listCreateS("a","b");
  15811   ck_assert_ptr_ne(self->f->injectArrayc(self, -1, toInject), NULL);
  15812   listFreeS(toInject);
  15813   s = toStringO(r);
  15814   ck_assert_str_eq(s, "[[\"a\",\"b\"]]");
  15815   free(s);
  15816   // null toInsert
  15817   ck_assert_ptr_eq(self->f->injectArrayc(self, 0, NULL), NULL);
  15818   // non json array
  15819   freeO(self);
  15820   setTypeBoolO(self);
  15821   toInject = listCreateS("e","ff");
  15822   ck_assert_ptr_eq(self->f->injectArrayc(self, 0, toInject), NULL);
  15823   listFreeS(toInject);
  15824   terminateO(self);
  15825 
  15826 END_TEST
  15827 
  15828 
  15829 START_TEST(injectSmallBoolSmallJsonT)
  15830 
  15831   smallJsont* r;
  15832   smallJsont *self = allocSmallJson();
  15833   smallBoolt *toInject;
  15834 
  15835   // add elements to self
  15836   r = self->f->pushInt(self, 1);
  15837   ck_assert_ptr_ne(r, null);
  15838   r = self->f->pushInt(self, 2);
  15839   ck_assert_ptr_ne(r, null);
  15840   r = self->f->pushInt(self, 3);
  15841   ck_assert_ptr_ne(r, null);
  15842   r = self->f->pushInt(self, 4);
  15843   ck_assert_ptr_ne(r, null);
  15844 
  15845   // positive index
  15846   toInject = allocSmallBool(true);
  15847   r        = self->f->injectSmallBool(self, 1, toInject);
  15848   ck_assert_ptr_ne(r, null);
  15849   finishO(toInject);
  15850   char *s  = toStringO(r);
  15851   ck_assert_str_eq(s, "[1,true,2,3,4]");
  15852   free(s);
  15853   // negative index
  15854   toInject = allocSmallBool(true);
  15855   r = self->f->injectSmallBool(self,-1, toInject);
  15856   ck_assert_ptr_ne(r, null);
  15857   finishO(toInject);
  15858   s = toStringO(r);
  15859   ck_assert_str_eq(s, "[1,true,2,3,4,true]");
  15860   free(s);
  15861   // index 0
  15862   toInject = allocSmallBool(true);
  15863   r = self->f->injectSmallBool(self,0, toInject);
  15864   ck_assert_ptr_ne(r, null);
  15865   finishO(toInject);
  15866   s = toStringO(r);
  15867   ck_assert_str_eq(s, "[true,1,true,2,3,4,true]");
  15868   free(s);
  15869   // index outside
  15870   toInject = allocSmallBool(true);
  15871   ck_assert_ptr_eq(self->f->injectSmallBool(self, 20, toInject), NULL);
  15872   ck_assert_ptr_eq(self->f->injectSmallBool(self, -9, toInject), NULL);
  15873   terminateO(toInject);
  15874   // empty object
  15875   emptyO(self);
  15876   toInject = allocSmallBool(true);
  15877   freeO(toInject);
  15878   ck_assert_ptr_ne(self->f->injectSmallBool(self, 0, toInject), NULL);
  15879   finishO(toInject);
  15880   s = toStringO(r);
  15881   ck_assert_str_eq(s, "[false]");
  15882   free(s);
  15883   // empty list
  15884   emptyO(self);
  15885   toInject = allocSmallBool(true);
  15886   ck_assert_ptr_ne(self->f->injectSmallBool(self, 0, toInject), NULL);
  15887   finishO(toInject);
  15888   s = toStringO(r);
  15889   ck_assert_str_eq(s, "[true]");
  15890   free(s);
  15891   emptyO(self);
  15892   toInject = allocSmallBool(true);
  15893   ck_assert_ptr_ne(self->f->injectSmallBool(self, -1, toInject), NULL);
  15894   finishO(toInject);
  15895   s = toStringO(r);
  15896   ck_assert_str_eq(s, "[true]");
  15897   free(s);
  15898   // non smallBool object
  15899   toInject = (smallBoolt*) allocSmallInt(2);
  15900   r = self->f->injectSmallBool(self, 0, toInject);
  15901   ck_assert_ptr_eq(r, null);
  15902   terminateO(toInject);
  15903   // null toInsert
  15904   ck_assert_ptr_eq(self->f->injectSmallBool(self, 0, NULL), NULL);
  15905   terminateO(self);
  15906 
  15907 END_TEST
  15908 
  15909 
  15910 START_TEST(injectSmallBytesSmallJsonT)
  15911 
  15912   smallJsont* r;
  15913   smallJsont *self = allocSmallJson();
  15914   smallBytest *toInject;
  15915 
  15916   // add elements to self
  15917   r = self->f->pushInt(self, 1);
  15918   ck_assert_ptr_ne(r, null);
  15919   r = self->f->pushInt(self, 2);
  15920   ck_assert_ptr_ne(r, null);
  15921   r = self->f->pushInt(self, 3);
  15922   ck_assert_ptr_ne(r, null);
  15923   r = self->f->pushInt(self, 4);
  15924   ck_assert_ptr_ne(r, null);
  15925 
  15926   // positive index
  15927   toInject = allocSmallBytes(null, 0);
  15928   r        = self->f->injectSmallBytes(self, 1, toInject);
  15929   ck_assert_ptr_ne(r, null);
  15930   finishO(toInject);
  15931   char *s  = toStringO(r);
  15932   ck_assert_str_eq(s, "[1,[],2,3,4]");
  15933   free(s);
  15934   // negative index
  15935   toInject = allocSmallBytes(null, 0);
  15936   r = self->f->injectSmallBytes(self,-1, toInject);
  15937   ck_assert_ptr_ne(r, null);
  15938   finishO(toInject);
  15939   s = toStringO(r);
  15940   ck_assert_str_eq(s, "[1,[],2,3,4,[]]");
  15941   free(s);
  15942   // index 0
  15943   toInject = allocSmallBytes(null, 0);
  15944   r = self->f->injectSmallBytes(self,0, toInject);
  15945   ck_assert_ptr_ne(r, null);
  15946   finishO(toInject);
  15947   s = toStringO(r);
  15948   ck_assert_str_eq(s, "[[],1,[],2,3,4,[]]");
  15949   free(s);
  15950   // index outside
  15951   toInject = allocSmallBytes(null, 0);
  15952   ck_assert_ptr_eq(self->f->injectSmallBytes(self, 20, toInject), NULL);
  15953   ck_assert_ptr_eq(self->f->injectSmallBytes(self, -9, toInject), NULL);
  15954   terminateO(toInject);
  15955   // empty object
  15956   emptyO(self);
  15957   toInject = allocSmallBytes(null, 0);
  15958   freeO(toInject);
  15959   ck_assert_ptr_ne(self->f->injectSmallBytes(self, 0, toInject), NULL);
  15960   finishO(toInject);
  15961   s = toStringO(r);
  15962   ck_assert_str_eq(s, "[[]]");
  15963   free(s);
  15964   // empty list
  15965   emptyO(self);
  15966   toInject = allocSmallBytes(null, 0);
  15967   ck_assert_ptr_ne(self->f->injectSmallBytes(self, 0, toInject), NULL);
  15968   finishO(toInject);
  15969   s = toStringO(r);
  15970   ck_assert_str_eq(s, "[[]]");
  15971   free(s);
  15972   emptyO(self);
  15973   toInject = allocSmallBytes(null, 0);
  15974   ck_assert_ptr_ne(self->f->injectSmallBytes(self, -1, toInject), NULL);
  15975   finishO(toInject);
  15976   s = toStringO(r);
  15977   ck_assert_str_eq(s, "[[]]");
  15978   free(s);
  15979   // non smallBytes object
  15980   toInject = (smallBytest*) allocSmallInt(2);
  15981   r = self->f->injectSmallBytes(self, 0, toInject);
  15982   ck_assert_ptr_eq(r, null);
  15983   terminateO(toInject);
  15984   // null toInsert
  15985   ck_assert_ptr_eq(self->f->injectSmallBytes(self, 0, NULL), NULL);
  15986   terminateO(self);
  15987 
  15988 END_TEST
  15989 
  15990 
  15991 START_TEST(injectSmallDoubleSmallJsonT)
  15992 
  15993   smallJsont* r;
  15994   smallJsont *self = allocSmallJson();
  15995   smallDoublet *toInject;
  15996 
  15997   // add elements to self
  15998   r = self->f->pushInt(self, 1);
  15999   ck_assert_ptr_ne(r, null);
  16000   r = self->f->pushInt(self, 2);
  16001   ck_assert_ptr_ne(r, null);
  16002   r = self->f->pushInt(self, 3);
  16003   ck_assert_ptr_ne(r, null);
  16004   r = self->f->pushInt(self, 4);
  16005   ck_assert_ptr_ne(r, null);
  16006 
  16007   // positive index
  16008   toInject = allocSmallDouble(2);
  16009   r        = self->f->injectSmallDouble(self, 1, toInject);
  16010   ck_assert_ptr_ne(r, null);
  16011   finishO(toInject);
  16012   char *s  = toStringO(r);
  16013   ck_assert_str_eq(s, "[1,2.000000e+00,2,3,4]");
  16014   free(s);
  16015   // negative index
  16016   toInject = allocSmallDouble(3);
  16017   r = self->f->injectSmallDouble(self,-1, toInject);
  16018   ck_assert_ptr_ne(r, null);
  16019   finishO(toInject);
  16020   s = toStringO(r);
  16021   ck_assert_str_eq(s, "[1,2.000000e+00,2,3,4,3.000000e+00]");
  16022   free(s);
  16023   // index 0
  16024   toInject = allocSmallDouble(1);
  16025   r = self->f->injectSmallDouble(self,0, toInject);
  16026   ck_assert_ptr_ne(r, null);
  16027   finishO(toInject);
  16028   s = toStringO(r);
  16029   ck_assert_str_eq(s, "[1.000000e+00,1,2.000000e+00,2,3,4,3.000000e+00]");
  16030   free(s);
  16031   // index outside
  16032   toInject = allocSmallDouble(1);
  16033   ck_assert_ptr_eq(self->f->injectSmallDouble(self, 20, toInject), NULL);
  16034   ck_assert_ptr_eq(self->f->injectSmallDouble(self, -9, toInject), NULL);
  16035   terminateO(toInject);
  16036   // empty object
  16037   emptyO(self);
  16038   toInject = allocSmallDouble(1);
  16039   freeO(toInject);
  16040   ck_assert_ptr_ne(self->f->injectSmallDouble(self, 0, toInject), NULL);
  16041   finishO(toInject);
  16042   s = toStringO(r);
  16043   ck_assert_str_eq(s, "[0.000000e+00]");
  16044   free(s);
  16045   // empty list
  16046   emptyO(self);
  16047   toInject = allocSmallDouble(1);
  16048   ck_assert_ptr_ne(self->f->injectSmallDouble(self, 0, toInject), NULL);
  16049   finishO(toInject);
  16050   s = toStringO(r);
  16051   ck_assert_str_eq(s, "[1.000000e+00]");
  16052   free(s);
  16053   emptyO(self);
  16054   toInject = allocSmallDouble(1);
  16055   ck_assert_ptr_ne(self->f->injectSmallDouble(self, -1, toInject), NULL);
  16056   finishO(toInject);
  16057   s = toStringO(r);
  16058   ck_assert_str_eq(s, "[1.000000e+00]");
  16059   free(s);
  16060   // non smallDouble object
  16061   toInject = (smallDoublet*) allocSmallInt(2);
  16062   r = self->f->injectSmallDouble(self, 0, toInject);
  16063   ck_assert_ptr_eq(r, null);
  16064   terminateO(toInject);
  16065   // null toInsert
  16066   ck_assert_ptr_eq(self->f->injectSmallDouble(self, 0, NULL), NULL);
  16067   terminateO(self);
  16068 
  16069 END_TEST
  16070 
  16071 
  16072 START_TEST(injectSmallIntSmallJsonT)
  16073 
  16074   smallJsont* r;
  16075   smallJsont *self = allocSmallJson();
  16076   smallIntt *toInject;
  16077 
  16078   // add elements to self
  16079   r = self->f->pushInt(self, 1);
  16080   ck_assert_ptr_ne(r, null);
  16081   r = self->f->pushInt(self, 2);
  16082   ck_assert_ptr_ne(r, null);
  16083   r = self->f->pushInt(self, 3);
  16084   ck_assert_ptr_ne(r, null);
  16085   r = self->f->pushInt(self, 4);
  16086   ck_assert_ptr_ne(r, null);
  16087 
  16088   // positive index
  16089   toInject = allocSmallInt(10);
  16090   r        = self->f->injectSmallInt(self, 1, toInject);
  16091   ck_assert_ptr_ne(r, null);
  16092   finishO(toInject);
  16093   char *s  = toStringO(r);
  16094   ck_assert_str_eq(s, "[1,10,2,3,4]");
  16095   free(s);
  16096   // negative index
  16097   toInject = allocSmallInt(11);
  16098   r = self->f->injectSmallInt(self,-1, toInject);
  16099   ck_assert_ptr_ne(r, null);
  16100   finishO(toInject);
  16101   s = toStringO(r);
  16102   ck_assert_str_eq(s, "[1,10,2,3,4,11]");
  16103   free(s);
  16104   // index 0
  16105   toInject = allocSmallInt(12);
  16106   r = self->f->injectSmallInt(self,0, toInject);
  16107   ck_assert_ptr_ne(r, null);
  16108   finishO(toInject);
  16109   s = toStringO(r);
  16110   ck_assert_str_eq(s, "[12,1,10,2,3,4,11]");
  16111   free(s);
  16112   // index outside
  16113   toInject = allocSmallInt(10);
  16114   ck_assert_ptr_eq(self->f->injectSmallInt(self, 20, toInject), NULL);
  16115   ck_assert_ptr_eq(self->f->injectSmallInt(self, -9, toInject), NULL);
  16116   terminateO(toInject);
  16117   // empty object
  16118   emptyO(self);
  16119   toInject = allocSmallInt(10);
  16120   freeO(toInject);
  16121   ck_assert_ptr_ne(self->f->injectSmallInt(self, 0, toInject), NULL);
  16122   finishO(toInject);
  16123   s = toStringO(r);
  16124   ck_assert_str_eq(s, "[0]");
  16125   free(s);
  16126   // empty list
  16127   emptyO(self);
  16128   toInject = allocSmallInt(10);
  16129   ck_assert_ptr_ne(self->f->injectSmallInt(self, 0, toInject), NULL);
  16130   finishO(toInject);
  16131   s = toStringO(r);
  16132   ck_assert_str_eq(s, "[10]");
  16133   free(s);
  16134   emptyO(self);
  16135   toInject = allocSmallInt(10);
  16136   ck_assert_ptr_ne(self->f->injectSmallInt(self, -1, toInject), NULL);
  16137   finishO(toInject);
  16138   s = toStringO(r);
  16139   ck_assert_str_eq(s, "[10]");
  16140   free(s);
  16141   // non smallInt object
  16142   toInject = (smallIntt*) allocSmallBool(true);
  16143   r = self->f->injectSmallInt(self, 0, toInject);
  16144   ck_assert_ptr_eq(r, null);
  16145   terminateO(toInject);
  16146   // null toInsert
  16147   ck_assert_ptr_eq(self->f->injectSmallInt(self, 0, NULL), NULL);
  16148   terminateO(self);
  16149 
  16150 END_TEST
  16151 
  16152 
  16153 START_TEST(injectSmallJsonSmallJsonT)
  16154 
  16155   smallJsont* r;
  16156   smallJsont *self = allocSmallJson();
  16157   smallJsont *toInject;
  16158 
  16159   // add elements to self
  16160   r = self->f->pushInt(self, 1);
  16161   ck_assert_ptr_ne(r, null);
  16162   r = self->f->pushInt(self, 2);
  16163   ck_assert_ptr_ne(r, null);
  16164   r = self->f->pushInt(self, 3);
  16165   ck_assert_ptr_ne(r, null);
  16166   r = self->f->pushInt(self, 4);
  16167   ck_assert_ptr_ne(r, null);
  16168 
  16169   // positive index
  16170   toInject = allocSmallJson();
  16171   r        = self->f->injectSmallJson(self, 1, toInject);
  16172   ck_assert_ptr_ne(r, null);
  16173   finishO(toInject);
  16174   char *s  = toStringO(r);
  16175   ck_assert_str_eq(s, "[1,{},2,3,4]");
  16176   free(s);
  16177   // negative index
  16178   toInject = allocSmallJson();
  16179   r = self->f->injectSmallJson(self,-1, toInject);
  16180   ck_assert_ptr_ne(r, null);
  16181   finishO(toInject);
  16182   s = toStringO(r);
  16183   ck_assert_str_eq(s, "[1,{},2,3,4,{}]");
  16184   free(s);
  16185   // index 0
  16186   toInject = allocSmallJson();
  16187   toInject->f->setS(toInject, "key", "value");
  16188   r = self->f->injectSmallJson(self,0, toInject);
  16189   ck_assert_ptr_ne(r, null);
  16190   finishO(toInject);
  16191   s = toStringO(r);
  16192   ck_assert_str_eq(s, "[{\"key\":\"value\"},1,{},2,3,4,{}]");
  16193   free(s);
  16194   // index outside
  16195   toInject = allocSmallJson();
  16196   ck_assert_ptr_eq(self->f->injectSmallJson(self, 20, toInject), NULL);
  16197   ck_assert_ptr_eq(self->f->injectSmallJson(self, -9, toInject), NULL);
  16198   terminateO(toInject);
  16199   // empty object
  16200   emptyO(self);
  16201   toInject = allocSmallJson();
  16202   freeO(toInject);
  16203   ck_assert_ptr_ne(self->f->injectSmallJson(self, 0, toInject), NULL);
  16204   finishO(toInject);
  16205   s = toStringO(r);
  16206   ck_assert_str_eq(s, "[{}]");
  16207   free(s);
  16208   // empty list
  16209   emptyO(self);
  16210   toInject = allocSmallJson();
  16211   ck_assert_ptr_ne(self->f->injectSmallJson(self, 0, toInject), NULL);
  16212   finishO(toInject);
  16213   s = toStringO(r);
  16214   ck_assert_str_eq(s, "[{}]");
  16215   free(s);
  16216   emptyO(self);
  16217   toInject = allocSmallJson();
  16218   ck_assert_ptr_ne(self->f->injectSmallJson(self, -1, toInject), NULL);
  16219   finishO(toInject);
  16220   s = toStringO(r);
  16221   ck_assert_str_eq(s, "[{}]");
  16222   free(s);
  16223   // non smallJson object
  16224   toInject = (smallJsont*) allocSmallInt(2);
  16225   r = self->f->injectSmallJson(self, 0, toInject);
  16226   ck_assert_ptr_eq(r, null);
  16227   terminateO(toInject);
  16228   // null toInsert
  16229   ck_assert_ptr_eq(self->f->injectSmallJson(self, 0, NULL), NULL);
  16230   terminateO(self);
  16231 
  16232 END_TEST
  16233 
  16234 
  16235 START_TEST(injectSmallStringSmallJsonT)
  16236 
  16237   smallJsont* r;
  16238   smallJsont *self = allocSmallJson();
  16239   smallStringt *toInject;
  16240 
  16241   // add elements to self
  16242   r = self->f->pushInt(self, 1);
  16243   ck_assert_ptr_ne(r, null);
  16244   r = self->f->pushInt(self, 2);
  16245   ck_assert_ptr_ne(r, null);
  16246   r = self->f->pushInt(self, 3);
  16247   ck_assert_ptr_ne(r, null);
  16248   r = self->f->pushInt(self, 4);
  16249   ck_assert_ptr_ne(r, null);
  16250 
  16251   // positive index
  16252   toInject = allocSmallString("1");
  16253   r        = self->f->injectSmallString(self, 1, toInject);
  16254   ck_assert_ptr_ne(r, null);
  16255   finishO(toInject);
  16256   char *s  = toStringO(r);
  16257   ck_assert_str_eq(s, "[1,\"1\",2,3,4]");
  16258   free(s);
  16259   // negative index
  16260   toInject = allocSmallString("2");
  16261   r = self->f->injectSmallString(self,-1, toInject);
  16262   ck_assert_ptr_ne(r, null);
  16263   finishO(toInject);
  16264   s = toStringO(r);
  16265   ck_assert_str_eq(s, "[1,\"1\",2,3,4,\"2\"]");
  16266   free(s);
  16267   // index 0
  16268   toInject = allocSmallString("3");
  16269   r = self->f->injectSmallString(self,0, toInject);
  16270   ck_assert_ptr_ne(r, null);
  16271   finishO(toInject);
  16272   s = toStringO(r);
  16273   ck_assert_str_eq(s, "[\"3\",1,\"1\",2,3,4,\"2\"]");
  16274   free(s);
  16275   // index outside
  16276   toInject = allocSmallString("1");
  16277   ck_assert_ptr_eq(self->f->injectSmallString(self, 20, toInject), NULL);
  16278   ck_assert_ptr_eq(self->f->injectSmallString(self, -9, toInject), NULL);
  16279   terminateO(toInject);
  16280   // empty object
  16281   emptyO(self);
  16282   toInject = allocSmallString("1");
  16283   freeO(toInject);
  16284   r = self->f->injectSmallString(self, 0, toInject);
  16285   ck_assert_ptr_ne(r, NULL);
  16286   finishO(toInject);
  16287   s = toStringO(r);
  16288   ck_assert_str_eq(s, "[\"\"]");
  16289   free(s);
  16290   // empty list
  16291   emptyO(self);
  16292   toInject = allocSmallString("1");
  16293   r = self->f->injectSmallString(self, 0, toInject);
  16294   ck_assert_ptr_ne(r, NULL);
  16295   finishO(toInject);
  16296   s = toStringO(r);
  16297   ck_assert_str_eq(s, "[\"1\"]");
  16298   free(s);
  16299   emptyO(self);
  16300   toInject = allocSmallString("1");
  16301   r = self->f->injectSmallString(self, -1, toInject);
  16302   ck_assert_ptr_ne(r, NULL);
  16303   finishO(toInject);
  16304   s = toStringO(r);
  16305   ck_assert_str_eq(s, "[\"1\"]");
  16306   free(s);
  16307   // non smallString object
  16308   toInject = (smallStringt*) allocSmallInt(2);
  16309   r = self->f->injectSmallString(self, 0, toInject);
  16310   ck_assert_ptr_eq(r, null);
  16311   terminateO(toInject);
  16312   // null toInsert
  16313   ck_assert_ptr_eq(self->f->injectSmallString(self, 0, NULL), NULL);
  16314   terminateO(self);
  16315   // json string
  16316   self = allocSmallJson();
  16317   setTopSO(self, "s");
  16318   toInject = allocSmallString("heepy");
  16319   r = self->f->injectSmallString(self, 1, toInject);
  16320   ck_assert_ptr_ne(r, NULL);
  16321   terminateO(toInject);
  16322   s = toStringO(r);
  16323   ck_assert_str_eq(s, "sheepy");
  16324   free(s);
  16325   terminateO(self);
  16326 
  16327 
  16328 END_TEST
  16329 
  16330 
  16331 START_TEST(injectSmallContainerSmallJsonT)
  16332 
  16333   smallJsont* r;
  16334   smallJsont *self = allocSmallJson();
  16335   smallContainert *toInject;
  16336 
  16337   // add elements to self
  16338   r = self->f->pushInt(self, 1);
  16339   ck_assert_ptr_ne(r, null);
  16340   r = self->f->pushInt(self, 2);
  16341   ck_assert_ptr_ne(r, null);
  16342   r = self->f->pushInt(self, 3);
  16343   ck_assert_ptr_ne(r, null);
  16344   r = self->f->pushInt(self, 4);
  16345   ck_assert_ptr_ne(r, null);
  16346 
  16347   // positive index
  16348   toInject = allocSmallContainer(NULL);
  16349   r        = self->f->injectSmallContainer(self, 1, toInject);
  16350   ck_assert_ptr_ne(r, null);
  16351   finishO(toInject);
  16352   char *s  = toStringO(r);
  16353   ck_assert_str_eq(s, "[1,\"<data container>\",2,3,4]");
  16354   free(s);
  16355   // negative index
  16356   toInject = allocSmallContainer(NULL);
  16357   r = self->f->injectSmallContainer(self,-1, toInject);
  16358   ck_assert_ptr_ne(r, null);
  16359   finishO(toInject);
  16360   s = toStringO(r);
  16361   ck_assert_str_eq(s, "[1,\"<data container>\",2,3,4,\"<data container>\"]");
  16362   free(s);
  16363   // index 0
  16364   toInject = allocSmallContainer(NULL);
  16365   r = self->f->injectSmallContainer(self,0, toInject);
  16366   ck_assert_ptr_ne(r, null);
  16367   finishO(toInject);
  16368   s = toStringO(r);
  16369   ck_assert_str_eq(s, "[\"<data container>\",1,\"<data container>\",2,3,4,\"<data container>\"]");
  16370   free(s);
  16371   // index outside
  16372   toInject = allocSmallContainer(NULL);
  16373   ck_assert_ptr_eq(self->f->injectSmallContainer(self, 20, toInject), NULL);
  16374   ck_assert_ptr_eq(self->f->injectSmallContainer(self, -9, toInject), NULL);
  16375   terminateO(toInject);
  16376   // empty object
  16377   emptyO(self);
  16378   toInject = allocSmallContainer(NULL);
  16379   freeO(toInject);
  16380   ck_assert_ptr_ne(self->f->injectSmallContainer(self, 0, toInject), NULL);
  16381   finishO(toInject);
  16382   s = toStringO(r);
  16383   ck_assert_str_eq(s, "[\"<data container>\"]");
  16384   free(s);
  16385   // empty list
  16386   emptyO(self);
  16387   toInject = allocSmallContainer(NULL);
  16388   ck_assert_ptr_ne(self->f->injectSmallContainer(self, 0, toInject), NULL);
  16389   finishO(toInject);
  16390   s = toStringO(r);
  16391   ck_assert_str_eq(s, "[\"<data container>\"]");
  16392   free(s);
  16393   emptyO(self);
  16394   toInject = allocSmallContainer(NULL);
  16395   ck_assert_ptr_ne(self->f->injectSmallContainer(self, -1, toInject), NULL);
  16396   finishO(toInject);
  16397   s = toStringO(r);
  16398   ck_assert_str_eq(s, "[\"<data container>\"]");
  16399   free(s);
  16400   // non smallContainer object
  16401   toInject = (smallContainert*) allocSmallInt(2);
  16402   r = self->f->injectSmallContainer(self, 0, toInject);
  16403   ck_assert_ptr_eq(r, null);
  16404   terminateO(toInject);
  16405   // null toInsert
  16406   ck_assert_ptr_eq(self->f->injectSmallContainer(self, 0, NULL), NULL);
  16407   terminateO(self);
  16408 
  16409 END_TEST
  16410 
  16411 
  16412 START_TEST(injectNFreeSmallJsonT)
  16413 
  16414   smallJsont* r;
  16415   smallJsont *self = allocSmallJson();
  16416   baset *toInject;
  16417 
  16418   // add elements to self
  16419   r = self->f->pushInt(self, 1);
  16420   ck_assert_ptr_ne(r, null);
  16421   r = self->f->pushInt(self, 2);
  16422   ck_assert_ptr_ne(r, null);
  16423   r = self->f->pushInt(self, 3);
  16424   ck_assert_ptr_ne(r, null);
  16425   r = self->f->pushInt(self, 4);
  16426   ck_assert_ptr_ne(r, null);
  16427 
  16428   // positive index
  16429   toInject = (baset*) allocSmallInt(8);
  16430   r        = self->f->injectNFree(self, 1, toInject);
  16431   ck_assert_ptr_ne(r, null);
  16432   char *s  = toStringO(r);
  16433   ck_assert_str_eq(s, "[1,8,2,3,4]");
  16434   free(s);
  16435   // negative index
  16436   toInject = (baset*) allocSmallInt(9);
  16437   r = self->f->injectNFree(self,-1, toInject);
  16438   ck_assert_ptr_ne(r, null);
  16439   s = toStringO(r);
  16440   ck_assert_str_eq(s, "[1,8,2,3,4,9]");
  16441   free(s);
  16442   // index 0
  16443   toInject = (baset*) allocSmallInt(6);
  16444   r = self->f->injectNFree(self,0, toInject);
  16445   ck_assert_ptr_ne(r, null);
  16446   s = toStringO(r);
  16447   ck_assert_str_eq(s, "[6,1,8,2,3,4,9]");
  16448   free(s);
  16449   // index outside
  16450   toInject = (baset*) allocSmallInt(7);
  16451   ck_assert_ptr_eq(self->f->injectNFree(self, 20, toInject), NULL);
  16452   ck_assert_ptr_eq(self->f->injectNFree(self, -9, toInject), NULL);
  16453   terminateO(toInject);
  16454   // empty list
  16455   emptyO(self);
  16456   toInject = (baset*) allocSmallInt(7);
  16457   ck_assert_ptr_ne(self->f->injectNFree(self, 0, toInject), NULL);
  16458   s = toStringO(r);
  16459   ck_assert_str_eq(s, "[7]");
  16460   free(s);
  16461   emptyO(self);
  16462   toInject = (baset*) allocSmallInt(7);
  16463   ck_assert_ptr_ne(self->f->injectNFree(self, -1, toInject), NULL);
  16464   s = toStringO(r);
  16465   ck_assert_str_eq(s, "[7]");
  16466   free(s);
  16467   // null toInsert
  16468   ck_assert_ptr_eq(self->f->injectNFree(self, 0, NULL), NULL);
  16469   // non json array
  16470   freeO(self);
  16471   setTypeBoolO(self);
  16472   toInject = (baset*) allocSmallInt(7);
  16473   ck_assert_ptr_eq(self->f->injectNFree(self, 0, toInject), NULL);
  16474   terminateO(toInject);
  16475   terminateO(self);
  16476 
  16477 END_TEST
  16478 
  16479 
  16480 START_TEST(injectNFreeUndefinedSmallJsonT)
  16481 
  16482   smallJsont* r;
  16483   smallJsont *self = allocSmallJson();
  16484   undefinedt *value = NULL;
  16485 
  16486 
  16487   // add elements to self
  16488   r = self->f->pushInt(self, 1);
  16489   ck_assert_ptr_ne(r, null);
  16490   r = self->f->pushInt(self, 2);
  16491   ck_assert_ptr_ne(r, null);
  16492   r = self->f->pushInt(self, 3);
  16493   ck_assert_ptr_ne(r, null);
  16494   r = self->f->pushInt(self, 4);
  16495   ck_assert_ptr_ne(r, null);
  16496 
  16497   // positive index
  16498   value = allocUndefined();
  16499   r        = self->f->injectNFreeUndefined(self, 1, value);
  16500   ck_assert_ptr_ne(r, null);
  16501   char *s  = toStringO(r);
  16502   ck_assert_str_eq(s, "[1,null,2,3,4]");
  16503   free(s);
  16504   // negative index
  16505   value = allocUndefined();
  16506   r = self->f->injectNFreeUndefined(self,-1, value);
  16507   ck_assert_ptr_ne(r, null);
  16508   s = toStringO(r);
  16509   ck_assert_str_eq(s, "[1,null,2,3,4,null]");
  16510   free(s);
  16511   // index 0
  16512   value = allocUndefined();
  16513   r = self->f->injectNFreeUndefined(self,0, value);
  16514   ck_assert_ptr_ne(r, null);
  16515   s = toStringO(r);
  16516   ck_assert_str_eq(s, "[null,1,null,2,3,4,null]");
  16517   free(s);
  16518   // index outside
  16519   value = allocUndefined();
  16520   ck_assert_ptr_eq(self->f->injectNFreeUndefined(self, 20, value), NULL);
  16521   terminateO(value);
  16522 
  16523   value = allocUndefined();
  16524   ck_assert_ptr_eq(self->f->injectNFreeUndefined(self, -9, value), NULL);
  16525   terminateO(value);
  16526 
  16527   // empty list
  16528   emptyO(self);
  16529   value = allocUndefined();
  16530   ck_assert_ptr_ne(self->f->injectNFreeUndefined(self, 0, value), NULL);
  16531   s = toStringO(r);
  16532   ck_assert_str_eq(s, "[null]");
  16533   free(s);
  16534   emptyO(self);
  16535   value = allocUndefined();
  16536   ck_assert_ptr_ne(self->f->injectNFreeUndefined(self, -1, value), NULL);
  16537   s = toStringO(r);
  16538   ck_assert_str_eq(s, "[null]");
  16539   free(s);
  16540   terminateO(self);
  16541 
  16542 END_TEST
  16543 
  16544 
  16545 START_TEST(injectNFreeSSmallJsonT)
  16546 
  16547   smallJsont* r;
  16548   smallJsont *self = allocSmallJson();
  16549 
  16550   // add elements to self
  16551   r = self->f->pushInt(self, 1);
  16552   ck_assert_ptr_ne(r, null);
  16553   r = self->f->pushInt(self, 2);
  16554   ck_assert_ptr_ne(r, null);
  16555   r = self->f->pushInt(self, 3);
  16556   ck_assert_ptr_ne(r, null);
  16557   r = self->f->pushInt(self, 4);
  16558   ck_assert_ptr_ne(r, null);
  16559 
  16560   // positive index
  16561   r        = self->f->injectNFreeS(self, 1, strdup("5"));
  16562   ck_assert_ptr_ne(r, null);
  16563   char *s  = toStringO(r);
  16564   ck_assert_str_eq(s, "[1,\"5\",2,3,4]");
  16565   free(s);
  16566   // negative index
  16567   r = self->f->injectNFreeS(self,-1, strdup("6"));
  16568   ck_assert_ptr_ne(r, null);
  16569   s = toStringO(r);
  16570   ck_assert_str_eq(s, "[1,\"5\",2,3,4,\"6\"]");
  16571   free(s);
  16572   // index 0
  16573   r = self->f->injectNFreeS(self,0, strdup("7"));
  16574   ck_assert_ptr_ne(r, null);
  16575   s = toStringO(r);
  16576   ck_assert_str_eq(s, "[\"7\",1,\"5\",2,3,4,\"6\"]");
  16577   free(s);
  16578   // index outside
  16579   ck_assert_ptr_eq(self->f->injectNFreeS(self, 20, ""), NULL);
  16580   ck_assert_ptr_eq(self->f->injectNFreeS(self, -9, ""), NULL);
  16581   // empty list
  16582   emptyO(self);
  16583   r = self->f->injectNFreeS(self, 0, strdup("7"));
  16584   ck_assert_ptr_ne(r, NULL);
  16585   s = toStringO(r);
  16586   ck_assert_str_eq(s, "[\"7\"]");
  16587   free(s);
  16588   emptyO(self);
  16589   r = self->f->injectNFreeS(self, -1, strdup("7"));
  16590   ck_assert_ptr_ne(r, NULL);
  16591   s = toStringO(r);
  16592   ck_assert_str_eq(s, "[\"7\"]");
  16593   free(s);
  16594   // null
  16595   ck_assert_ptr_eq(self->f->injectNFreeS(self, -1, null), NULL);
  16596   terminateO(self);
  16597 
  16598 END_TEST
  16599 
  16600 
  16601 START_TEST(injectNFreeDictSmallJsonT)
  16602 
  16603   smallJsont* r;
  16604   smallJsont *self = allocSmallJson();
  16605   smallDictt *toInject;
  16606 
  16607   // add elements to self
  16608   r = self->f->pushInt(self, 1);
  16609   ck_assert_ptr_ne(r, null);
  16610   r = self->f->pushInt(self, 2);
  16611   ck_assert_ptr_ne(r, null);
  16612   r = self->f->pushInt(self, 3);
  16613   ck_assert_ptr_ne(r, null);
  16614   r = self->f->pushInt(self, 4);
  16615   ck_assert_ptr_ne(r, null);
  16616 
  16617   // positive index
  16618   toInject = allocSmallDict();
  16619   r        = self->f->injectNFreeDict(self, 1, toInject);
  16620   ck_assert_ptr_ne(r, null);
  16621   char *s  = toStringO(r);
  16622   ck_assert_str_eq(s, "[1,{},2,3,4]");
  16623   free(s);
  16624   // negative index
  16625   toInject = allocSmallDict();
  16626   r = self->f->injectNFreeDict(self,-1, toInject);
  16627   ck_assert_ptr_ne(r, null);
  16628   s = toStringO(r);
  16629   ck_assert_str_eq(s, "[1,{},2,3,4,{}]");
  16630   free(s);
  16631   // index 0
  16632   toInject = allocSmallDict();
  16633   r = self->f->injectNFreeDict(self,0, toInject);
  16634   ck_assert_ptr_ne(r, null);
  16635   s = toStringO(r);
  16636   ck_assert_str_eq(s, "[{},1,{},2,3,4,{}]");
  16637   free(s);
  16638   // index outside
  16639   toInject = allocSmallDict();
  16640   ck_assert_ptr_eq(self->f->injectNFreeDict(self, 20, toInject), NULL);
  16641   ck_assert_ptr_eq(self->f->injectNFreeDict(self, -9, toInject), NULL);
  16642   terminateO(toInject);
  16643   // empty list
  16644   emptyO(self);
  16645   toInject = allocSmallDict();
  16646   ck_assert_ptr_ne(self->f->injectNFreeDict(self, 0, toInject), NULL);
  16647   s = toStringO(r);
  16648   ck_assert_str_eq(s, "[{}]");
  16649   free(s);
  16650   emptyO(self);
  16651   toInject = allocSmallDict();
  16652   ck_assert_ptr_ne(self->f->injectNFreeDict(self, -1, toInject), NULL);
  16653   s = toStringO(r);
  16654   ck_assert_str_eq(s, "[{}]");
  16655   free(s);
  16656   // null toInsert
  16657   ck_assert_ptr_eq(self->f->injectNFreeDict(self, 0, NULL), NULL);
  16658   terminateO(self);
  16659 
  16660 END_TEST
  16661 
  16662 
  16663 START_TEST(injectNFreeArraySmallJsonT)
  16664 
  16665   smallJsont* r;
  16666   smallJsont *self = allocSmallJson();
  16667   smallArrayt *toInject;
  16668 
  16669   // add elements to self
  16670   r = self->f->pushInt(self, 1);
  16671   ck_assert_ptr_ne(r, null);
  16672   r = self->f->pushInt(self, 2);
  16673   ck_assert_ptr_ne(r, null);
  16674   r = self->f->pushInt(self, 3);
  16675   ck_assert_ptr_ne(r, null);
  16676   r = self->f->pushInt(self, 4);
  16677   ck_assert_ptr_ne(r, null);
  16678 
  16679   // positive index
  16680   toInject = allocSmallArray();
  16681   r        = self->f->injectNFreeArray(self, 1, toInject);
  16682   ck_assert_ptr_ne(r, null);
  16683   char *s  = toStringO(r);
  16684   ck_assert_str_eq(s, "[1,[],2,3,4]");
  16685   free(s);
  16686   // negative index
  16687   toInject = allocSmallArray();
  16688   r = self->f->injectNFreeArray(self,-1, toInject);
  16689   ck_assert_ptr_ne(r, null);
  16690   s = toStringO(r);
  16691   ck_assert_str_eq(s, "[1,[],2,3,4,[]]");
  16692   free(s);
  16693   // index 0
  16694   toInject = allocSmallArray();
  16695   r = self->f->injectNFreeArray(self,0, toInject);
  16696   ck_assert_ptr_ne(r, null);
  16697   s = toStringO(r);
  16698   ck_assert_str_eq(s, "[[],1,[],2,3,4,[]]");
  16699   free(s);
  16700   // index outside
  16701   toInject = allocSmallArray();
  16702   ck_assert_ptr_eq(self->f->injectNFreeArray(self, 20, toInject), NULL);
  16703   ck_assert_ptr_eq(self->f->injectNFreeArray(self, -9, toInject), NULL);
  16704   terminateO(toInject);
  16705   // empty list
  16706   emptyO(self);
  16707   toInject = allocSmallArray();
  16708   ck_assert_ptr_ne(self->f->injectNFreeArray(self, 0, toInject), NULL);
  16709   s = toStringO(r);
  16710   ck_assert_str_eq(s, "[[]]");
  16711   free(s);
  16712   emptyO(self);
  16713   toInject = allocSmallArray();
  16714   ck_assert_ptr_ne(self->f->injectNFreeArray(self, -1, toInject), NULL);
  16715   s = toStringO(r);
  16716   ck_assert_str_eq(s, "[[]]");
  16717   free(s);
  16718   // null toInsert
  16719   ck_assert_ptr_eq(self->f->injectNFreeArray(self, 0, NULL), NULL);
  16720   terminateO(self);
  16721 
  16722 END_TEST
  16723 
  16724 
  16725 START_TEST(injectNFreeArraycSmallJsonT)
  16726 
  16727   smallJsont* r;
  16728   smallJsont *self = allocSmallJson();
  16729   char **toInject;
  16730 
  16731   // add elements to self
  16732   r = self->f->pushInt(self, 1);
  16733   ck_assert_ptr_ne(r, null);
  16734   r = self->f->pushInt(self, 2);
  16735   ck_assert_ptr_ne(r, null);
  16736   r = self->f->pushInt(self, 3);
  16737   ck_assert_ptr_ne(r, null);
  16738   r = self->f->pushInt(self, 4);
  16739   ck_assert_ptr_ne(r, null);
  16740 
  16741   // positive index
  16742   toInject = listCreateS("a","b");
  16743   r        = self->f->injectNFreeArrayc(self, 1, toInject);
  16744   ck_assert_ptr_ne(r, null);
  16745   char *s  = toStringO(r);
  16746   ck_assert_str_eq(s, "[1,[\"a\",\"b\"],2,3,4]");
  16747   free(s);
  16748   // negative index
  16749   toInject = listCreateS("c","d");
  16750   r = self->f->injectNFreeArrayc(self,-1, toInject);
  16751   ck_assert_ptr_ne(r, null);
  16752   s = toStringO(r);
  16753   ck_assert_str_eq(s, "[1,[\"a\",\"b\"],2,3,4,[\"c\",\"d\"]]");
  16754   free(s);
  16755   // index 0
  16756   toInject = listCreateS("e","ff");
  16757   r = self->f->injectNFreeArrayc(self,0, toInject);
  16758   ck_assert_ptr_ne(r, null);
  16759   s = toStringO(r);
  16760   ck_assert_str_eq(s, "[[\"e\",\"ff\"],1,[\"a\",\"b\"],2,3,4,[\"c\",\"d\"]]");
  16761   free(s);
  16762   // index outside
  16763   toInject = listCreateS("a","b");
  16764   ck_assert_ptr_eq(self->f->injectNFreeArrayc(self, 20, toInject), NULL);
  16765   ck_assert_ptr_eq(self->f->injectNFreeArrayc(self, -9, toInject), NULL);
  16766   listFreeS(toInject);
  16767   // empty list
  16768   emptyO(self);
  16769   toInject = listCreateS("a","b");
  16770   ck_assert_ptr_ne(self->f->injectNFreeArrayc(self, 0, toInject), NULL);
  16771   s = toStringO(r);
  16772   ck_assert_str_eq(s, "[[\"a\",\"b\"]]");
  16773   free(s);
  16774   emptyO(self);
  16775   toInject = listCreateS("a","b");
  16776   ck_assert_ptr_ne(self->f->injectNFreeArrayc(self, -1, toInject), NULL);
  16777   s = toStringO(r);
  16778   ck_assert_str_eq(s, "[[\"a\",\"b\"]]");
  16779   free(s);
  16780   // null toInsert
  16781   ck_assert_ptr_eq(self->f->injectNFreeArrayc(self, 0, NULL), NULL);
  16782   terminateO(self);
  16783 
  16784 END_TEST
  16785 
  16786 
  16787 START_TEST(injectNFreeSmallBoolSmallJsonT)
  16788 
  16789   smallJsont* r;
  16790   smallJsont *self = allocSmallJson();
  16791   smallBoolt *toInject;
  16792 
  16793   // add elements to self
  16794   r = self->f->pushInt(self, 1);
  16795   ck_assert_ptr_ne(r, null);
  16796   r = self->f->pushInt(self, 2);
  16797   ck_assert_ptr_ne(r, null);
  16798   r = self->f->pushInt(self, 3);
  16799   ck_assert_ptr_ne(r, null);
  16800   r = self->f->pushInt(self, 4);
  16801   ck_assert_ptr_ne(r, null);
  16802 
  16803   // positive index
  16804   toInject = allocSmallBool(true);
  16805   r        = self->f->injectNFreeSmallBool(self, 1, toInject);
  16806   ck_assert_ptr_ne(r, null);
  16807   char *s  = toStringO(r);
  16808   ck_assert_str_eq(s, "[1,true,2,3,4]");
  16809   free(s);
  16810   // negative index
  16811   toInject = allocSmallBool(true);
  16812   r = self->f->injectNFreeSmallBool(self,-1, toInject);
  16813   ck_assert_ptr_ne(r, null);
  16814   s = toStringO(r);
  16815   ck_assert_str_eq(s, "[1,true,2,3,4,true]");
  16816   free(s);
  16817   // index 0
  16818   toInject = allocSmallBool(true);
  16819   r = self->f->injectNFreeSmallBool(self,0, toInject);
  16820   ck_assert_ptr_ne(r, null);
  16821   s = toStringO(r);
  16822   ck_assert_str_eq(s, "[true,1,true,2,3,4,true]");
  16823   free(s);
  16824   // index outside
  16825   toInject = allocSmallBool(true);
  16826   ck_assert_ptr_eq(self->f->injectNFreeSmallBool(self, 20, toInject), NULL);
  16827   ck_assert_ptr_eq(self->f->injectNFreeSmallBool(self, -9, toInject), NULL);
  16828   terminateO(toInject);
  16829   // empty object
  16830   emptyO(self);
  16831   toInject = allocSmallBool(true);
  16832   freeO(toInject);
  16833   ck_assert_ptr_ne(self->f->injectNFreeSmallBool(self, 0, toInject), NULL);
  16834   s = toStringO(r);
  16835   ck_assert_str_eq(s, "[false]");
  16836   free(s);
  16837   // empty list
  16838   emptyO(self);
  16839   toInject = allocSmallBool(true);
  16840   ck_assert_ptr_ne(self->f->injectNFreeSmallBool(self, 0, toInject), NULL);
  16841   s = toStringO(r);
  16842   ck_assert_str_eq(s, "[true]");
  16843   free(s);
  16844   emptyO(self);
  16845   toInject = allocSmallBool(true);
  16846   ck_assert_ptr_ne(self->f->injectNFreeSmallBool(self, -1, toInject), NULL);
  16847   s = toStringO(r);
  16848   ck_assert_str_eq(s, "[true]");
  16849   free(s);
  16850   // null toInsert
  16851   ck_assert_ptr_eq(self->f->injectNFreeSmallBool(self, 0, NULL), NULL);
  16852   terminateO(self);
  16853 
  16854 END_TEST
  16855 
  16856 
  16857 START_TEST(injectNFreeSmallBytesSmallJsonT)
  16858 
  16859   smallJsont* r;
  16860   smallJsont *self = allocSmallJson();
  16861   smallBytest *toInject;
  16862 
  16863   // add elements to self
  16864   r = self->f->pushInt(self, 1);
  16865   ck_assert_ptr_ne(r, null);
  16866   r = self->f->pushInt(self, 2);
  16867   ck_assert_ptr_ne(r, null);
  16868   r = self->f->pushInt(self, 3);
  16869   ck_assert_ptr_ne(r, null);
  16870   r = self->f->pushInt(self, 4);
  16871   ck_assert_ptr_ne(r, null);
  16872 
  16873   // positive index
  16874   toInject = allocSmallBytes(null, 0);
  16875   r        = self->f->injectNFreeSmallBytes(self, 1, toInject);
  16876   ck_assert_ptr_ne(r, null);
  16877   char *s  = toStringO(r);
  16878   ck_assert_str_eq(s, "[1,[],2,3,4]");
  16879   free(s);
  16880   // negative index
  16881   toInject = allocSmallBytes(null, 0);
  16882   r = self->f->injectNFreeSmallBytes(self,-1, toInject);
  16883   ck_assert_ptr_ne(r, null);
  16884   s = toStringO(r);
  16885   ck_assert_str_eq(s, "[1,[],2,3,4,[]]");
  16886   free(s);
  16887   // index 0
  16888   toInject = allocSmallBytes(null, 0);
  16889   r = self->f->injectNFreeSmallBytes(self,0, toInject);
  16890   ck_assert_ptr_ne(r, null);
  16891   s = toStringO(r);
  16892   ck_assert_str_eq(s, "[[],1,[],2,3,4,[]]");
  16893   free(s);
  16894   // index outside
  16895   toInject = allocSmallBytes(null, 0);
  16896   ck_assert_ptr_eq(self->f->injectNFreeSmallBytes(self, 20, toInject), NULL);
  16897   ck_assert_ptr_eq(self->f->injectNFreeSmallBytes(self, -9, toInject), NULL);
  16898   terminateO(toInject);
  16899   // empty object
  16900   emptyO(self);
  16901   toInject = allocSmallBytes(null, 0);
  16902   freeO(toInject);
  16903   ck_assert_ptr_ne(self->f->injectNFreeSmallBytes(self, 0, toInject), NULL);
  16904   s = toStringO(r);
  16905   ck_assert_str_eq(s, "[[]]");
  16906   free(s);
  16907   // empty list
  16908   emptyO(self);
  16909   toInject = allocSmallBytes(null, 0);
  16910   ck_assert_ptr_ne(self->f->injectNFreeSmallBytes(self, 0, toInject), NULL);
  16911   s = toStringO(r);
  16912   ck_assert_str_eq(s, "[[]]");
  16913   free(s);
  16914   emptyO(self);
  16915   toInject = allocSmallBytes(null, 0);
  16916   ck_assert_ptr_ne(self->f->injectNFreeSmallBytes(self, -1, toInject), NULL);
  16917   s = toStringO(r);
  16918   ck_assert_str_eq(s, "[[]]");
  16919   free(s);
  16920   // null toInsert
  16921   ck_assert_ptr_eq(self->f->injectNFreeSmallBytes(self, 0, NULL), NULL);
  16922   terminateO(self);
  16923 
  16924 END_TEST
  16925 
  16926 
  16927 START_TEST(injectNFreeSmallDoubleSmallJsonT)
  16928 
  16929   smallJsont* r;
  16930   smallJsont *self = allocSmallJson();
  16931   smallDoublet *toInject;
  16932 
  16933   // add elements to self
  16934   r = self->f->pushInt(self, 1);
  16935   ck_assert_ptr_ne(r, null);
  16936   r = self->f->pushInt(self, 2);
  16937   ck_assert_ptr_ne(r, null);
  16938   r = self->f->pushInt(self, 3);
  16939   ck_assert_ptr_ne(r, null);
  16940   r = self->f->pushInt(self, 4);
  16941   ck_assert_ptr_ne(r, null);
  16942 
  16943   // positive index
  16944   toInject = allocSmallDouble(2);
  16945   r        = self->f->injectNFreeSmallDouble(self, 1, toInject);
  16946   ck_assert_ptr_ne(r, null);
  16947   char *s  = toStringO(r);
  16948   ck_assert_str_eq(s, "[1,2.000000e+00,2,3,4]");
  16949   free(s);
  16950   // negative index
  16951   toInject = allocSmallDouble(3);
  16952   r = self->f->injectNFreeSmallDouble(self,-1, toInject);
  16953   ck_assert_ptr_ne(r, null);
  16954   s = toStringO(r);
  16955   ck_assert_str_eq(s, "[1,2.000000e+00,2,3,4,3.000000e+00]");
  16956   free(s);
  16957   // index 0
  16958   toInject = allocSmallDouble(1);
  16959   r = self->f->injectNFreeSmallDouble(self,0, toInject);
  16960   ck_assert_ptr_ne(r, null);
  16961   s = toStringO(r);
  16962   ck_assert_str_eq(s, "[1.000000e+00,1,2.000000e+00,2,3,4,3.000000e+00]");
  16963   free(s);
  16964   // index outside
  16965   toInject = allocSmallDouble(1);
  16966   ck_assert_ptr_eq(self->f->injectNFreeSmallDouble(self, 20, toInject), NULL);
  16967   ck_assert_ptr_eq(self->f->injectNFreeSmallDouble(self, -9, toInject), NULL);
  16968   terminateO(toInject);
  16969   // empty object
  16970   emptyO(self);
  16971   toInject = allocSmallDouble(1);
  16972   freeO(toInject);
  16973   ck_assert_ptr_ne(self->f->injectNFreeSmallDouble(self, 0, toInject), NULL);
  16974   s = toStringO(r);
  16975   ck_assert_str_eq(s, "[0.000000e+00]");
  16976   free(s);
  16977   // empty list
  16978   emptyO(self);
  16979   toInject = allocSmallDouble(1);
  16980   ck_assert_ptr_ne(self->f->injectNFreeSmallDouble(self, 0, toInject), NULL);
  16981   s = toStringO(r);
  16982   ck_assert_str_eq(s, "[1.000000e+00]");
  16983   free(s);
  16984   emptyO(self);
  16985   toInject = allocSmallDouble(1);
  16986   ck_assert_ptr_ne(self->f->injectNFreeSmallDouble(self, -1, toInject), NULL);
  16987   s = toStringO(r);
  16988   ck_assert_str_eq(s, "[1.000000e+00]");
  16989   free(s);
  16990   // null toInsert
  16991   ck_assert_ptr_eq(self->f->injectNFreeSmallDouble(self, 0, NULL), NULL);
  16992   terminateO(self);
  16993 
  16994 END_TEST
  16995 
  16996 
  16997 START_TEST(injectNFreeSmallIntSmallJsonT)
  16998 
  16999   smallJsont* r;
  17000   smallJsont *self = allocSmallJson();
  17001   smallIntt *toInject;
  17002 
  17003   // add elements to self
  17004   r = self->f->pushInt(self, 1);
  17005   ck_assert_ptr_ne(r, null);
  17006   r = self->f->pushInt(self, 2);
  17007   ck_assert_ptr_ne(r, null);
  17008   r = self->f->pushInt(self, 3);
  17009   ck_assert_ptr_ne(r, null);
  17010   r = self->f->pushInt(self, 4);
  17011   ck_assert_ptr_ne(r, null);
  17012 
  17013   // positive index
  17014   toInject = allocSmallInt(10);
  17015   r        = self->f->injectNFreeSmallInt(self, 1, toInject);
  17016   ck_assert_ptr_ne(r, null);
  17017   char *s  = toStringO(r);
  17018   ck_assert_str_eq(s, "[1,10,2,3,4]");
  17019   free(s);
  17020   // negative index
  17021   toInject = allocSmallInt(11);
  17022   r = self->f->injectNFreeSmallInt(self,-1, toInject);
  17023   ck_assert_ptr_ne(r, null);
  17024   s = toStringO(r);
  17025   ck_assert_str_eq(s, "[1,10,2,3,4,11]");
  17026   free(s);
  17027   // index 0
  17028   toInject = allocSmallInt(12);
  17029   r = self->f->injectNFreeSmallInt(self,0, toInject);
  17030   ck_assert_ptr_ne(r, null);
  17031   s = toStringO(r);
  17032   ck_assert_str_eq(s, "[12,1,10,2,3,4,11]");
  17033   free(s);
  17034   // index outside
  17035   toInject = allocSmallInt(10);
  17036   ck_assert_ptr_eq(self->f->injectNFreeSmallInt(self, 20, toInject), NULL);
  17037   ck_assert_ptr_eq(self->f->injectNFreeSmallInt(self, -9, toInject), NULL);
  17038   terminateO(toInject);
  17039   // empty object
  17040   emptyO(self);
  17041   toInject = allocSmallInt(10);
  17042   freeO(toInject);
  17043   ck_assert_ptr_ne(self->f->injectNFreeSmallInt(self, 0, toInject), NULL);
  17044   s = toStringO(r);
  17045   ck_assert_str_eq(s, "[0]");
  17046   free(s);
  17047   // empty list
  17048   emptyO(self);
  17049   toInject = allocSmallInt(10);
  17050   ck_assert_ptr_ne(self->f->injectNFreeSmallInt(self, 0, toInject), NULL);
  17051   s = toStringO(r);
  17052   ck_assert_str_eq(s, "[10]");
  17053   free(s);
  17054   emptyO(self);
  17055   toInject = allocSmallInt(10);
  17056   ck_assert_ptr_ne(self->f->injectNFreeSmallInt(self, -1, toInject), NULL);
  17057   s = toStringO(r);
  17058   ck_assert_str_eq(s, "[10]");
  17059   free(s);
  17060   // null toInsert
  17061   ck_assert_ptr_eq(self->f->injectNFreeSmallInt(self, 0, NULL), NULL);
  17062   terminateO(self);
  17063 
  17064 END_TEST
  17065 
  17066 
  17067 START_TEST(injectNFreeSmallJsonSmallJsonT)
  17068 
  17069   smallJsont* r;
  17070   smallJsont *self = allocSmallJson();
  17071   smallJsont *toInject;
  17072 
  17073   // add elements to self
  17074   r = self->f->pushInt(self, 1);
  17075   ck_assert_ptr_ne(r, null);
  17076   r = self->f->pushInt(self, 2);
  17077   ck_assert_ptr_ne(r, null);
  17078   r = self->f->pushInt(self, 3);
  17079   ck_assert_ptr_ne(r, null);
  17080   r = self->f->pushInt(self, 4);
  17081   ck_assert_ptr_ne(r, null);
  17082 
  17083   // positive index
  17084   toInject = allocSmallJson();
  17085   r        = self->f->injectNFreeSmallJson(self, 1, toInject);
  17086   ck_assert_ptr_ne(r, null);
  17087   char *s  = toStringO(r);
  17088   ck_assert_str_eq(s, "[1,{},2,3,4]");
  17089   free(s);
  17090   // negative index
  17091   toInject = allocSmallJson();
  17092   r = self->f->injectNFreeSmallJson(self,-1, toInject);
  17093   ck_assert_ptr_ne(r, null);
  17094   s = toStringO(r);
  17095   ck_assert_str_eq(s, "[1,{},2,3,4,{}]");
  17096   free(s);
  17097   // index 0
  17098   toInject = allocSmallJson();
  17099   toInject->f->setS(toInject, "key", "value");
  17100   r = self->f->injectNFreeSmallJson(self,0, toInject);
  17101   ck_assert_ptr_ne(r, null);
  17102   s = toStringO(r);
  17103   ck_assert_str_eq(s, "[{\"key\":\"value\"},1,{},2,3,4,{}]");
  17104   free(s);
  17105   // index outside
  17106   toInject = allocSmallJson();
  17107   ck_assert_ptr_eq(self->f->injectNFreeSmallJson(self, 20, toInject), NULL);
  17108   ck_assert_ptr_eq(self->f->injectNFreeSmallJson(self, -9, toInject), NULL);
  17109   terminateO(toInject);
  17110   // empty object
  17111   emptyO(self);
  17112   toInject = allocSmallJson();
  17113   freeO(toInject);
  17114   ck_assert_ptr_ne(self->f->injectNFreeSmallJson(self, 0, toInject), NULL);
  17115   s = toStringO(r);
  17116   ck_assert_str_eq(s, "[{}]");
  17117   free(s);
  17118   // empty list
  17119   emptyO(self);
  17120   toInject = allocSmallJson();
  17121   ck_assert_ptr_ne(self->f->injectNFreeSmallJson(self, 0, toInject), NULL);
  17122   s = toStringO(r);
  17123   ck_assert_str_eq(s, "[{}]");
  17124   free(s);
  17125   emptyO(self);
  17126   toInject = allocSmallJson();
  17127   ck_assert_ptr_ne(self->f->injectNFreeSmallJson(self, -1, toInject), NULL);
  17128   s = toStringO(r);
  17129   ck_assert_str_eq(s, "[{}]");
  17130   free(s);
  17131   // null toInsert
  17132   ck_assert_ptr_eq(self->f->injectNFreeSmallJson(self, 0, NULL), NULL);
  17133   terminateO(self);
  17134 
  17135 END_TEST
  17136 
  17137 
  17138 START_TEST(injectNFreeSmallStringSmallJsonT)
  17139 
  17140   smallJsont* r;
  17141   smallJsont *self = allocSmallJson();
  17142   smallStringt *toInject;
  17143 
  17144   // add elements to self
  17145   r = self->f->pushInt(self, 1);
  17146   ck_assert_ptr_ne(r, null);
  17147   r = self->f->pushInt(self, 2);
  17148   ck_assert_ptr_ne(r, null);
  17149   r = self->f->pushInt(self, 3);
  17150   ck_assert_ptr_ne(r, null);
  17151   r = self->f->pushInt(self, 4);
  17152   ck_assert_ptr_ne(r, null);
  17153 
  17154   // positive index
  17155   toInject = allocSmallString("1");
  17156   r        = self->f->injectNFreeSmallString(self, 1, toInject);
  17157   ck_assert_ptr_ne(r, null);
  17158   char *s  = toStringO(r);
  17159   ck_assert_str_eq(s, "[1,\"1\",2,3,4]");
  17160   free(s);
  17161   // negative index
  17162   toInject = allocSmallString("2");
  17163   r = self->f->injectNFreeSmallString(self,-1, toInject);
  17164   ck_assert_ptr_ne(r, null);
  17165   s = toStringO(r);
  17166   ck_assert_str_eq(s, "[1,\"1\",2,3,4,\"2\"]");
  17167   free(s);
  17168   // index 0
  17169   toInject = allocSmallString("3");
  17170   r = self->f->injectNFreeSmallString(self,0, toInject);
  17171   ck_assert_ptr_ne(r, null);
  17172   s = toStringO(r);
  17173   ck_assert_str_eq(s, "[\"3\",1,\"1\",2,3,4,\"2\"]");
  17174   free(s);
  17175   // index outside
  17176   toInject = allocSmallString("1");
  17177   ck_assert_ptr_eq(self->f->injectNFreeSmallString(self, 20, toInject), NULL);
  17178   ck_assert_ptr_eq(self->f->injectNFreeSmallString(self, -9, toInject), NULL);
  17179   terminateO(toInject);
  17180   // empty object
  17181   emptyO(self);
  17182   toInject = allocSmallString("1");
  17183   freeO(toInject);
  17184   ck_assert_ptr_ne(self->f->injectNFreeSmallString(self, 0, toInject), NULL);
  17185   s = toStringO(r);
  17186   ck_assert_str_eq(s, "[\"\"]");
  17187   free(s);
  17188   // empty list
  17189   emptyO(self);
  17190   toInject = allocSmallString("1");
  17191   ck_assert_ptr_ne(self->f->injectNFreeSmallString(self, 0, toInject), NULL);
  17192   s = toStringO(r);
  17193   ck_assert_str_eq(s, "[\"1\"]");
  17194   free(s);
  17195   emptyO(self);
  17196   toInject = allocSmallString("1");
  17197   ck_assert_ptr_ne(self->f->injectNFreeSmallString(self, -1, toInject), NULL);
  17198   s = toStringO(r);
  17199   ck_assert_str_eq(s, "[\"1\"]");
  17200   free(s);
  17201   // null toInsert
  17202   ck_assert_ptr_eq(self->f->injectNFreeSmallString(self, 0, NULL), NULL);
  17203   terminateO(self);
  17204 
  17205 END_TEST
  17206 
  17207 
  17208 START_TEST(injectNFreeSmallContainerSmallJsonT)
  17209 
  17210   smallJsont* r;
  17211   smallJsont *self = allocSmallJson();
  17212   smallContainert *toInject;
  17213 
  17214   // add elements to self
  17215   r = self->f->pushInt(self, 1);
  17216   ck_assert_ptr_ne(r, null);
  17217   r = self->f->pushInt(self, 2);
  17218   ck_assert_ptr_ne(r, null);
  17219   r = self->f->pushInt(self, 3);
  17220   ck_assert_ptr_ne(r, null);
  17221   r = self->f->pushInt(self, 4);
  17222   ck_assert_ptr_ne(r, null);
  17223 
  17224   // positive index
  17225   toInject = allocSmallContainer(NULL);
  17226   r        = self->f->injectNFreeSmallContainer(self, 1, toInject);
  17227   ck_assert_ptr_ne(r, null);
  17228   char *s  = toStringO(r);
  17229   ck_assert_str_eq(s, "[1,\"<data container>\",2,3,4]");
  17230   free(s);
  17231   // negative index
  17232   toInject = allocSmallContainer(NULL);
  17233   r = self->f->injectNFreeSmallContainer(self,-1, toInject);
  17234   ck_assert_ptr_ne(r, null);
  17235   s = toStringO(r);
  17236   ck_assert_str_eq(s, "[1,\"<data container>\",2,3,4,\"<data container>\"]");
  17237   free(s);
  17238   // index 0
  17239   toInject = allocSmallContainer(NULL);
  17240   r = self->f->injectNFreeSmallContainer(self,0, toInject);
  17241   ck_assert_ptr_ne(r, null);
  17242   s = toStringO(r);
  17243   ck_assert_str_eq(s, "[\"<data container>\",1,\"<data container>\",2,3,4,\"<data container>\"]");
  17244   free(s);
  17245   // index outside
  17246   toInject = allocSmallContainer(NULL);
  17247   ck_assert_ptr_eq(self->f->injectNFreeSmallContainer(self, 20, toInject), NULL);
  17248   ck_assert_ptr_eq(self->f->injectNFreeSmallContainer(self, -9, toInject), NULL);
  17249   terminateO(toInject);
  17250   // empty object
  17251   emptyO(self);
  17252   toInject = allocSmallContainer(NULL);
  17253   freeO(toInject);
  17254   ck_assert_ptr_ne(self->f->injectNFreeSmallContainer(self, 0, toInject), NULL);
  17255   s = toStringO(r);
  17256   ck_assert_str_eq(s, "[\"<data container>\"]");
  17257   free(s);
  17258   // empty list
  17259   emptyO(self);
  17260   toInject = allocSmallContainer(NULL);
  17261   ck_assert_ptr_ne(self->f->injectNFreeSmallContainer(self, 0, toInject), NULL);
  17262   s = toStringO(r);
  17263   ck_assert_str_eq(s, "[\"<data container>\"]");
  17264   free(s);
  17265   emptyO(self);
  17266   toInject = allocSmallContainer(NULL);
  17267   ck_assert_ptr_ne(self->f->injectNFreeSmallContainer(self, -1, toInject), NULL);
  17268   s = toStringO(r);
  17269   ck_assert_str_eq(s, "[\"<data container>\"]");
  17270   free(s);
  17271   // null toInsert
  17272   ck_assert_ptr_eq(self->f->injectNFreeSmallContainer(self, 0, NULL), NULL);
  17273   terminateO(self);
  17274 
  17275 END_TEST
  17276 
  17277 
  17278 START_TEST(uniqSmallJsonT)
  17279 
  17280   smallJsont* r;
  17281   smallJsont *self = allocSmallJson();
  17282 
  17283   // empty array
  17284   r       = self->f->uniq(self);
  17285   ck_assert_ptr_eq(r, NULL);
  17286   setTypeArrayO(self);
  17287   r       = self->f->uniq(self);
  17288   ck_assert_ptr_eq(r, NULL);
  17289   // one element
  17290   self->f->pushUndefined(self);
  17291   r       = self->f->uniq(self);
  17292   ck_assert_ptr_eq(r, self);
  17293   // uniq elements
  17294   self->f->pushUndefined(self);
  17295   self->f->pushBool(self, true);
  17296   self->f->pushNFreeDict(self, allocSmallDict());
  17297   self->f->pushDouble(self, 1);
  17298   self->f->pushInt(self, 2);
  17299   self->f->pushS(self, "");
  17300   self->f->pushNFreeArray(self, allocSmallArray());
  17301   self->f->pushNFreeSmallBytes(self, allocSmallBytes("qwe",4));
  17302   self->f->pushUndefined(self);
  17303   self->f->pushBool(self, true);
  17304   self->f->pushNFreeDict(self, allocSmallDict());
  17305   self->f->pushDouble(self, 1);
  17306   self->f->pushInt(self, 2);
  17307   self->f->pushS(self, "");
  17308   self->f->pushNFreeArray(self, allocSmallArray());
  17309   self->f->pushNFreeSmallBytes(self, allocSmallBytes("qwe",4));
  17310   r       = self->f->uniq(self);
  17311   ck_assert_ptr_ne(r, NULL);
  17312   char *s = toStringO(r);
  17313   ck_assert_str_eq(s, "[null,true,{},1.000000e+00,2,\"\",[],[0x71,0x77,0x65,0x00]]");
  17314   free(s);
  17315   terminateO(self);
  17316 
  17317 END_TEST
  17318 
  17319 
  17320 START_TEST(sortSmallJsonT)
  17321 
  17322   smallJsont* r;
  17323   smallJsont *self = allocSmallJson();
  17324 
  17325   // sort undefined
  17326   self->f->pushInt(self, 0);
  17327   self->f->pushUndefined(self);
  17328   self->f->pushUndefined(self);
  17329   self->f->pushUndefined(self);
  17330   self->f->pushUndefined(self);
  17331   r = sortO(self);
  17332   ck_assert_ptr_ne(r, null);
  17333   char *s = toStringO(r);
  17334   ck_assert_str_eq(s, "[null,null,null,null,0]");
  17335   free(s);
  17336   // sort bool
  17337   emptyO(self);
  17338   self->f->pushBool(self, false);
  17339   self->f->pushBool(self, true);
  17340   r = sortO(self);
  17341   ck_assert_ptr_ne(r, null);
  17342   s = toStringO(r);
  17343   ck_assert_str_eq(s, "[false,true]");
  17344   free(s);
  17345   // sort container
  17346   emptyO(self);
  17347   pushVoidSmallJsonG(self, &r);
  17348   pushVoidSmallJsonG(self, &r);
  17349   r = sortO(self);
  17350   ck_assert_ptr_ne(r, null);
  17351   s = toStringO(r);
  17352   ck_assert_str_eq(s, "[\"<data container>\",\"<data container>\"]");
  17353   free(s);
  17354   // sort dict
  17355   emptyO(self);
  17356   smallDictt *d[4];
  17357   arange(i,d) d[i] = allocSmallDict();
  17358   d[0]->f->setInt(d[0], "a", 1);
  17359   d[1]->f->setInt(d[1], "a", 0);
  17360   d[3]->f->setInt(d[3], "a", 0);
  17361   d[3]->f->setInt(d[3], "b", 0);
  17362   arange(i,d) self->f->pushNFreeDict(self, d[i]);
  17363   r = sortO(self);
  17364   ck_assert_ptr_ne(r, null);
  17365   s = toStringO(r);
  17366   ck_assert_str_eq(s, "[{},{\"a\":0},{\"a\":1},{\"a\":0,\"b\":0}]");
  17367   free(s);
  17368   // sort double
  17369   emptyO(self);
  17370   self->f->pushDouble(self, 0);
  17371   self->f->pushDouble(self, 0);
  17372   self->f->pushDouble(self, 1);
  17373   self->f->pushDouble(self, -1);
  17374   r = sortO(self);
  17375   ck_assert_ptr_ne(r, null);
  17376   s = toStringO(r);
  17377   ck_assert_str_eq(s, "[-1.000000e+00,0.000000e+00,0.000000e+00,1.000000e+00]");
  17378   free(s);
  17379   // sort Int
  17380   emptyO(self);
  17381   self->f->pushInt(self, 0);
  17382   self->f->pushInt(self, 0);
  17383   self->f->pushInt(self, 1);
  17384   self->f->pushInt(self, -1);
  17385   r = sortO(self);
  17386   ck_assert_ptr_ne(r, null);
  17387   s = toStringO(r);
  17388   ck_assert_str_eq(s, "[-1,0,0,1]");
  17389   free(s);
  17390   // sort strings
  17391   emptyO(self);
  17392   self->f->pushS(self, "bb");
  17393   self->f->pushS(self, "a");
  17394   r = sortO(self);
  17395   ck_assert_ptr_ne(r, null);
  17396   s = toStringO(r);
  17397   ck_assert_str_eq(s, "[\"a\",\"bb\"]");
  17398   free(s);
  17399   // sort Array
  17400   emptyO(self);
  17401   smallArrayt *a[4];
  17402   arange(i,a) a[i] = allocSmallArray();
  17403   a[0]->f->pushInt(a[0], 1);
  17404   a[1]->f->pushInt(a[1], 0);
  17405   a[3]->f->pushInt(a[3], 0);
  17406   a[3]->f->pushInt(a[3], 0);
  17407   arange(i,a) self->f->pushNFreeArray(self, a[i]);
  17408   r = sortO(self);
  17409   ck_assert_ptr_ne(r, null);
  17410   s = toStringO(r);
  17411   ck_assert_str_eq(s, "[[],[0],[1],[0,0]]");
  17412   free(s);
  17413   // sort bytes
  17414   emptyO(self);
  17415   smallBytest *B[4];
  17416   range(i,3) B[i] = allocSmallBytes("12345678", i);
  17417   B[3] = allocSmallBytes("0", 1);
  17418   arange(i,B) self->f->pushNFreeSmallBytes(self, B[i]);
  17419   r = sortO(self);
  17420   ck_assert_ptr_ne(r, null);
  17421   s = toStringO(r);
  17422   ck_assert_str_eq(s, "[[],[0x30],[0x31],[0x31,0x32]]");
  17423   free(s);
  17424   // TODO add element and remove some elements
  17425   emptyO(self);
  17426   self->f->pushInt(self, 0);
  17427   self->f->pushInt(self, 0);
  17428   self->f->pushInt(self, 1);
  17429   self->f->pushInt(self, -1);
  17430   smallIntt *i1 = self->f->getAtSmallInt(self, 1);
  17431   smallIntt *i2 = self->f->getAtSmallInt(self, 2);
  17432   removeO(self, 1, 3);
  17433   terminateO(i1);
  17434   terminateO(i2);
  17435   r = sortO(self);
  17436   ck_assert_ptr_ne(r, null);
  17437   s = toStringO(r);
  17438   ck_assert_str_eq(s, "[-1,0]");
  17439   free(s);
  17440   // length 0
  17441   emptyO(self);
  17442   r = sortO(self);
  17443   ck_assert_ptr_eq(r, null);
  17444   // non json array
  17445   freeO(self);
  17446   setTypeBoolO(self);
  17447   ck_assert_ptr_eq(sortO(self), NULL);
  17448   terminateO(self);
  17449 
  17450 END_TEST
  17451 
  17452 
  17453 START_TEST(icSortSmallJsonT)
  17454 
  17455   smallJsont* r;
  17456   smallJsont *self = allocSmallJson();
  17457 
  17458   // sort undefined
  17459   self->f->pushInt(self, 0);
  17460   self->f->pushUndefined(self);
  17461   self->f->pushUndefined(self);
  17462   self->f->pushUndefined(self);
  17463   self->f->pushUndefined(self);
  17464   r = icSortO(self);
  17465   ck_assert_ptr_ne(r, null);
  17466   char *s = toStringO(r);
  17467   ck_assert_str_eq(s, "[null,null,null,null,0]");
  17468   free(s);
  17469   // sort bool
  17470   emptyO(self);
  17471   self->f->pushBool(self, false);
  17472   self->f->pushBool(self, true);
  17473   r = icSortO(self);
  17474   ck_assert_ptr_ne(r, null);
  17475   s = toStringO(r);
  17476   ck_assert_str_eq(s, "[false,true]");
  17477   free(s);
  17478   // sort container
  17479   emptyO(self);
  17480   pushVoidSmallJsonG(self, &r);
  17481   pushVoidSmallJsonG(self, &r);
  17482   r = icSortO(self);
  17483   ck_assert_ptr_ne(r, null);
  17484   s = toStringO(r);
  17485   ck_assert_str_eq(s, "[\"<data container>\",\"<data container>\"]");
  17486   free(s);
  17487   // sort dict
  17488   emptyO(self);
  17489   smallDictt *d[4];
  17490   arange(i,d) d[i] = allocSmallDict();
  17491   d[0]->f->setInt(d[0], "a", 1);
  17492   d[1]->f->setInt(d[1], "A", 0);
  17493   d[3]->f->setInt(d[3], "a", 0);
  17494   d[3]->f->setInt(d[3], "b", 0);
  17495   arange(i,d) self->f->pushNFreeDict(self, d[i]);
  17496   r = icSortO(self);
  17497   ck_assert_ptr_ne(r, null);
  17498   s = toStringO(r);
  17499   ck_assert_str_eq(s, "[{},{\"A\":0},{\"a\":1},{\"a\":0,\"b\":0}]");
  17500   free(s);
  17501   // sort double
  17502   emptyO(self);
  17503   self->f->pushDouble(self, 0);
  17504   self->f->pushDouble(self, 0);
  17505   self->f->pushDouble(self, 1);
  17506   self->f->pushDouble(self, -1);
  17507   r = icSortO(self);
  17508   ck_assert_ptr_ne(r, null);
  17509   s = toStringO(r);
  17510   ck_assert_str_eq(s, "[-1.000000e+00,0.000000e+00,0.000000e+00,1.000000e+00]");
  17511   free(s);
  17512   // sort Int
  17513   emptyO(self);
  17514   self->f->pushInt(self, 0);
  17515   self->f->pushInt(self, 0);
  17516   self->f->pushInt(self, 1);
  17517   self->f->pushInt(self, -1);
  17518   r = icSortO(self);
  17519   ck_assert_ptr_ne(r, null);
  17520   s = toStringO(r);
  17521   ck_assert_str_eq(s, "[-1,0,0,1]");
  17522   free(s);
  17523   // sort strings
  17524   emptyO(self);
  17525   self->f->pushS(self, "bb");
  17526   self->f->pushS(self, "B");
  17527   r = icSortO(self);
  17528   ck_assert_ptr_ne(r, null);
  17529   s = toStringO(r);
  17530   ck_assert_str_eq(s, "[\"B\",\"bb\"]");
  17531   free(s);
  17532   // sort Array
  17533   emptyO(self);
  17534   smallArrayt *a[4];
  17535   arange(i,a) a[i] = allocSmallArray();
  17536   a[0]->f->pushInt(a[0], 1);
  17537   a[1]->f->pushInt(a[1], 0);
  17538   a[3]->f->pushInt(a[3], 0);
  17539   a[3]->f->pushInt(a[3], 0);
  17540   arange(i,a) self->f->pushNFreeArray(self, a[i]);
  17541   r = icSortO(self);
  17542   ck_assert_ptr_ne(r, null);
  17543   s = toStringO(r);
  17544   ck_assert_str_eq(s, "[[],[0],[1],[0,0]]");
  17545   free(s);
  17546   // sort bytes
  17547   emptyO(self);
  17548   smallBytest *B[4];
  17549   range(i,3) B[i] = allocSmallBytes("12345678", i);
  17550   B[3] = allocSmallBytes("0", 1);
  17551   arange(i,B) self->f->pushNFreeSmallBytes(self, B[i]);
  17552   r = icSortO(self);
  17553   ck_assert_ptr_ne(r, null);
  17554   s = toStringO(r);
  17555   ck_assert_str_eq(s, "[[],[0x30],[0x31],[0x31,0x32]]");
  17556   free(s);
  17557   // TODO add element and remove some elements
  17558   emptyO(self);
  17559   self->f->pushInt(self, 0);
  17560   self->f->pushInt(self, 0);
  17561   self->f->pushInt(self, 1);
  17562   self->f->pushInt(self, -1);
  17563   smallIntt *i1 = self->f->getAtSmallInt(self, 1);
  17564   smallIntt *i2 = self->f->getAtSmallInt(self, 2);
  17565   removeO(self, 1, 3);
  17566   terminateO(i1);
  17567   terminateO(i2);
  17568   r = icSortO(self);
  17569   ck_assert_ptr_ne(r, null);
  17570   s = toStringO(r);
  17571   ck_assert_str_eq(s, "[-1,0]");
  17572   free(s);
  17573   // length 0
  17574   emptyO(self);
  17575   r = icSortO(self);
  17576   ck_assert_ptr_eq(r, null);
  17577   // non json array
  17578   freeO(self);
  17579   setTypeBoolO(self);
  17580   ck_assert_ptr_eq(icSortO(self), NULL);
  17581   terminateO(self);
  17582 
  17583 END_TEST
  17584 
  17585 
  17586 int sortFOCmp(const void *A, const void *B) {
  17587   cast(smallDictt*, a, A);
  17588   cast(smallDictt*, b, B);
  17589 
  17590   if (lenO(a) < lenO(b))
  17591     return -1;
  17592   else if (lenO(a) == lenO(b)) {
  17593     var As = toStringO(a);
  17594     var Bs = toStringO(b);
  17595     int r = strcmp(As,Bs);
  17596     freeManyS(As,Bs);
  17597     return r;
  17598   }
  17599   else
  17600     return 1;
  17601 }
  17602 
  17603 START_TEST(sortFSmallJsonT)
  17604 
  17605   smallJsont* r;
  17606   smallJsont *self = allocSmallJson();
  17607 
  17608   // sort dict
  17609   smallDictt *d[4];
  17610   arange(i,d) d[i] = allocSmallDict();
  17611   d[0]->f->setInt(d[0], "a", 1);
  17612   d[1]->f->setInt(d[1], "a", 0);
  17613   d[3]->f->setInt(d[3], "a", 0);
  17614   d[3]->f->setInt(d[3], "b", 0);
  17615   arange(i,d) self->f->pushNFreeDict(self, d[i]);
  17616   r = sortFO(self, sortFOCmp);
  17617   ck_assert_ptr_ne(r, null);
  17618   char *s = toStringO(r);
  17619   ck_assert_str_eq(s, "[{},{\"a\":0},{\"a\":1},{\"a\":0,\"b\":0}]");
  17620   free(s);
  17621   // no compare function
  17622   r = sortFO(self, NULL);
  17623   ck_assert_ptr_eq(r, null);
  17624   // empty array
  17625   emptyO(self);
  17626   r = sortFO(self, sortFOCmp);
  17627   ck_assert_ptr_eq(r, null);
  17628   // non json array
  17629   freeO(self);
  17630   setTypeBoolO(self);
  17631   ck_assert_ptr_eq(sortFO(self, sortFOCmp), NULL);
  17632   terminateO(self);
  17633 
  17634 END_TEST
  17635 
  17636 
  17637 START_TEST(icUniqSmallJsonT)
  17638 
  17639   smallJsont* r;
  17640   smallJsont *self = allocSmallJson();
  17641 
  17642   // empty array
  17643   r       = self->f->icUniq(self);
  17644   ck_assert_ptr_eq(r, NULL);
  17645   setTypeArrayO(self);
  17646   r       = self->f->icUniq(self);
  17647   ck_assert_ptr_eq(r, NULL);
  17648   // one element
  17649   self->f->pushUndefined(self);
  17650   r       = self->f->icUniq(self);
  17651   ck_assert_ptr_eq(r, self);
  17652   // uniq elements
  17653   self->f->pushUndefined(self);
  17654   self->f->pushBool(self, true);
  17655   self->f->pushNFreeDict(self, allocSmallDict());
  17656   self->f->pushDouble(self, 1);
  17657   self->f->pushInt(self, 2);
  17658   self->f->pushS(self, "ASD");
  17659   self->f->pushNFreeArray(self, allocSmallArray());
  17660   self->f->pushNFreeSmallBytes(self, allocSmallBytes("qwe",4));
  17661   self->f->pushUndefined(self);
  17662   self->f->pushBool(self, true);
  17663   self->f->pushNFreeDict(self, allocSmallDict());
  17664   self->f->pushDouble(self, 1);
  17665   self->f->pushInt(self, 2);
  17666   self->f->pushS(self, "asd");
  17667   self->f->pushNFreeArray(self, allocSmallArray());
  17668   self->f->pushNFreeSmallBytes(self, allocSmallBytes("qwe",4));
  17669   r       = self->f->icUniq(self);
  17670   ck_assert_ptr_ne(r, NULL);
  17671   char *s = toStringO(r);
  17672   ck_assert_str_eq(s, "[null,true,{},1.000000e+00,2,\"ASD\",[],[0x71,0x77,0x65,0x00]]");
  17673   free(s);
  17674   terminateO(self);
  17675 
  17676 END_TEST
  17677 
  17678 
  17679 START_TEST(uniqCharSmallJsonT)
  17680 
  17681   smallJsont* r;
  17682   smallJsont *self = allocSmallJson();
  17683   setTopSO(self, "");
  17684 
  17685   // uniquify
  17686   freeO(self);
  17687   setTopSO(self, "/qwd///");
  17688   r = uniqCharO(self, '/');
  17689   ck_assert_ptr_ne(r, null);
  17690   char *s = toStringO(r);
  17691   ck_assert_str_eq(s, "/qwd/");
  17692   free(s);
  17693   // short string
  17694   freeO(self);
  17695   setTopSO(self, "?");
  17696   r = uniqCharO(self, '/');
  17697   ck_assert_ptr_ne(r, null);
  17698   s = toStringO(r);
  17699   ck_assert_str_eq(s, "?");
  17700   free(s);
  17701   // NULL
  17702   freeO(self);
  17703   ck_assert_ptr_eq(uniqCharO(self, '/'), NULL);
  17704   terminateO(self);
  17705 
  17706 END_TEST
  17707 
  17708 
  17709 START_TEST(icUniqCharSmallJsonT)
  17710 
  17711   smallJsont* r;
  17712   smallJsont *self = allocSmallJson();
  17713   setTopSO(self, "");
  17714 
  17715   // uniquify
  17716   freeO(self);
  17717   setTopSO(self, "/qQwd///");
  17718   r = icUniqCharO(self, 'q');
  17719   ck_assert_ptr_ne(r, null);
  17720   char *s = toStringO(r);
  17721   ck_assert_str_eq(s, "/qwd///");
  17722   free(s);
  17723   // short string
  17724   freeO(self);
  17725   setTopSO(self, "?");
  17726   r = icUniqCharO(self, '/');
  17727   ck_assert_ptr_ne(r, null);
  17728   s = toStringO(r);
  17729   ck_assert_str_eq(s, "?");
  17730   free(s);
  17731   // NULL
  17732   freeO(self);
  17733   ck_assert_ptr_eq(icUniqCharO(self, '/'), NULL);
  17734   terminateO(self);
  17735 
  17736 END_TEST
  17737 
  17738 
  17739 START_TEST(hasSmallJsonT)
  17740 
  17741   bool r;
  17742   smallJsont *self = allocSmallJson();
  17743   baset *value = (baset*)allocSmallInt(1);
  17744 
  17745   // has
  17746   self->f->pushInt(self, 1);
  17747   r = hasO(self, value);
  17748   ck_assert(r);
  17749   // not has
  17750   emptyO(self);
  17751   r = hasO(self, value);
  17752   ck_assert(!r);
  17753   // NULL value
  17754   r = hasO(self, NULL);
  17755   ck_assert(!r);
  17756   terminateO(self);
  17757   terminateO(value);
  17758 
  17759 END_TEST
  17760 
  17761 
  17762 START_TEST(hasUndefinedSmallJsonT)
  17763 
  17764   bool r;
  17765   smallJsont *self = allocSmallJson();
  17766   undefinedt *value = allocUndefined();
  17767 
  17768   // has
  17769   self->f->pushUndefined(self);
  17770   r = hasUndefinedO(self, value);
  17771   ck_assert(r);
  17772   // not has
  17773   emptyO(self);
  17774   r = hasUndefinedO(self, value);
  17775   ck_assert(!r);
  17776   // non undefined object
  17777   terminateO(value);
  17778   value = (undefinedt*) allocSmallInt(2);
  17779   r = hasUndefinedO(self, value);
  17780   ck_assert(!r);
  17781   // NULL value
  17782   r = hasUndefinedO(self, NULL);
  17783   ck_assert(!r);
  17784   terminateO(self);
  17785   terminateO(value);
  17786 
  17787 END_TEST
  17788 
  17789 
  17790 START_TEST(hasBoolSmallJsonT)
  17791 
  17792   bool r;
  17793   smallJsont *self = allocSmallJson();
  17794   bool value = true;
  17795 
  17796   // has
  17797   self->f->pushBool(self, true);
  17798   r = hasBoolO(self, value);
  17799   ck_assert(r);
  17800   // not has
  17801   emptyO(self);
  17802   r = hasBoolO(self, value);
  17803   ck_assert(!r);
  17804   terminateO(self);
  17805 
  17806 END_TEST
  17807 
  17808 
  17809 START_TEST(hasDoubleSmallJsonT)
  17810 
  17811   bool r;
  17812   smallJsont *self = allocSmallJson();
  17813   double value = 2;
  17814 
  17815   // has
  17816   self->f->pushDouble(self, 2);
  17817   r = hasDoubleO(self, value);
  17818   ck_assert(r);
  17819   // not has
  17820   emptyO(self);
  17821   r = hasDoubleO(self, value);
  17822   ck_assert(!r);
  17823   terminateO(self);
  17824 
  17825 END_TEST
  17826 
  17827 
  17828 START_TEST(hasIntSmallJsonT)
  17829 
  17830   bool r;
  17831   smallJsont *self = allocSmallJson();
  17832   int64_t value = 1000;
  17833 
  17834   // has
  17835   self->f->pushInt(self, 1000);
  17836   r = hasIntO(self, value);
  17837   ck_assert(r);
  17838   // not has
  17839   emptyO(self);
  17840   r = hasIntO(self, value);
  17841   ck_assert(!r);
  17842   terminateO(self);
  17843 
  17844 END_TEST
  17845 
  17846 
  17847 START_TEST(hasSSmallJsonT)
  17848 
  17849   bool r;
  17850   smallJsont *self = allocSmallJson();
  17851   const char *value = "asd";
  17852 
  17853   // has
  17854   self->f->pushS(self, "asd");
  17855   r = hasSO(self, value);
  17856   ck_assert(r);
  17857   // not has
  17858   emptyO(self);
  17859   r = hasSO(self, value);
  17860   ck_assert(!r);
  17861   // NULL value
  17862   r = hasSO(self, NULL);
  17863   ck_assert(!r);
  17864   terminateO(self);
  17865   // json dict
  17866   self = allocSmallJson();
  17867   self->f->setInt(self, "u", 0);
  17868   ck_assert(!hasSO(self, "qwe"));
  17869   ck_assert(hasSO(self, "u"));
  17870   terminateO(self);
  17871 
  17872 END_TEST
  17873 
  17874 
  17875 START_TEST(hasCharSmallJsonT)
  17876 
  17877   bool r;
  17878   smallJsont *self = allocSmallJson();
  17879   char value = 'a';
  17880 
  17881   // has
  17882   self->f->pushS(self, "a");
  17883   r = hasCharO(self, value);
  17884   ck_assert(r);
  17885   // not has
  17886   emptyO(self);
  17887   r = hasCharO(self, value);
  17888   ck_assert(!r);
  17889   terminateO(self);
  17890 
  17891 END_TEST
  17892 
  17893 
  17894 START_TEST(hasDictSmallJsonT)
  17895 
  17896   bool r;
  17897   smallJsont *self = allocSmallJson();
  17898   smallDictt *value = allocSmallDict();
  17899 
  17900   // has
  17901   self->f->pushNFreeDict(self, allocSmallDict());
  17902   r = hasDictO(self, value);
  17903   ck_assert(r);
  17904   // not has
  17905   emptyO(self);
  17906   r = hasDictO(self, value);
  17907   ck_assert(!r);
  17908   // non smallDict object
  17909   terminateO(value);
  17910   value = (smallDictt*) allocSmallInt(2);
  17911   r = hasDictO(self, value);
  17912   ck_assert(!r);
  17913   // NULL value
  17914   r = hasDictO(self, NULL);
  17915   ck_assert(!r);
  17916   terminateO(self);
  17917   terminateO(value);
  17918 
  17919 END_TEST
  17920 
  17921 
  17922 START_TEST(hasArraySmallJsonT)
  17923 
  17924   bool r;
  17925   smallJsont *self = allocSmallJson();
  17926   smallArrayt *value = allocSmallArray();
  17927 
  17928   // has
  17929   self->f->pushNFreeArray(self, allocSmallArray());
  17930   r = hasArrayO(self, value);
  17931   ck_assert(r);
  17932   // not has
  17933   emptyO(self);
  17934   r = hasArrayO(self, value);
  17935   ck_assert(!r);
  17936   // non smallArray object
  17937   terminateO(value);
  17938   value = (smallArrayt*) allocSmallInt(2);
  17939   r = hasArrayO(self, value);
  17940   ck_assert(!r);
  17941   // NULL value
  17942   r = hasArrayO(self, NULL);
  17943   ck_assert(!r);
  17944   terminateO(self);
  17945   terminateO(value);
  17946 
  17947 END_TEST
  17948 
  17949 
  17950 START_TEST(hasArraycSmallJsonT)
  17951 
  17952   bool r;
  17953   smallJsont *self = allocSmallJson();
  17954   char **value = listCreateS("a","bb");
  17955 
  17956   // has
  17957   self->f->pushNFreeArrayc(self, listCreateS("a","bb"));
  17958   r = hasArraycO(self, value);
  17959   ck_assert(r);
  17960   // not has
  17961   emptyO(self);
  17962   r = hasArraycO(self, value);
  17963   ck_assert(!r);
  17964   // NULL value
  17965   r = hasArraycO(self, NULL);
  17966   ck_assert(!r);
  17967   terminateO(self);
  17968   listFreeS(value);
  17969 
  17970 END_TEST
  17971 
  17972 
  17973 START_TEST(hasSmallBoolSmallJsonT)
  17974 
  17975   bool r;
  17976   smallJsont *self = allocSmallJson();
  17977   smallBoolt *value = allocSmallBool(true);
  17978 
  17979   // has
  17980   self->f->pushBool(self, true);
  17981   r = hasSmallBoolO(self, value);
  17982   ck_assert(r);
  17983   // not has
  17984   emptyO(self);
  17985   r = hasSmallBoolO(self, value);
  17986   ck_assert(!r);
  17987   // non smallBool object
  17988   terminateO(value);
  17989   value = (smallBoolt*) allocSmallInt(2);
  17990   r = hasSmallBoolO(self, value);
  17991   ck_assert(!r);
  17992   // NULL value
  17993   r = hasSmallBoolO(self, NULL);
  17994   ck_assert(!r);
  17995   terminateO(self);
  17996   terminateO(value);
  17997 
  17998 END_TEST
  17999 
  18000 
  18001 START_TEST(hasSmallBytesSmallJsonT)
  18002 
  18003   bool r;
  18004   smallJsont *self  = allocSmallJson();
  18005   createAllocateSmallBytes(value);
  18006   pushBufferO(value, &self, 8);
  18007 
  18008   // has
  18009   createAllocateSmallBytes(elem);
  18010   pushBufferO(elem, &self, 8);
  18011   self->f->pushNFreeSmallBytes(self, elem);
  18012   r = hasSmallBytesO(self, value);
  18013   ck_assert(r);
  18014   // not has
  18015   emptyO(self);
  18016   r = hasSmallBytesO(self, value);
  18017   ck_assert(!r);
  18018   // non smallBytes object
  18019   terminateO(value);
  18020   value = (smallBytest*) allocSmallInt(2);
  18021   r = hasSmallBytesO(self, value);
  18022   ck_assert(!r);
  18023   // NULL value
  18024   r = hasSmallBytesO(self, NULL);
  18025   ck_assert(!r);
  18026   terminateO(self);
  18027   terminateO(value);
  18028 
  18029 END_TEST
  18030 
  18031 
  18032 START_TEST(hasSmallDoubleSmallJsonT)
  18033 
  18034   bool r;
  18035   smallJsont *self   = allocSmallJson();
  18036   smallDoublet *value = allocSmallDouble(2);
  18037 
  18038   // has
  18039   self->f->pushDouble(self, 2);
  18040   r = hasSmallDoubleO(self, value);
  18041   ck_assert(r);
  18042   // not has
  18043   emptyO(self);
  18044   r = hasSmallDoubleO(self, value);
  18045   ck_assert(!r);
  18046   // non smallDouble object
  18047   terminateO(value);
  18048   value = (smallDoublet*) allocSmallInt(2);
  18049   r = hasSmallDoubleO(self, value);
  18050   ck_assert(!r);
  18051   // NULL value
  18052   r = hasSmallDoubleO(self, NULL);
  18053   ck_assert(!r);
  18054   terminateO(self);
  18055   terminateO(value);
  18056 
  18057 END_TEST
  18058 
  18059 
  18060 START_TEST(hasSmallIntSmallJsonT)
  18061 
  18062   bool r;
  18063   smallJsont *self = allocSmallJson();
  18064   smallIntt *value  = allocSmallInt(12);
  18065 
  18066   // has
  18067   self->f->pushInt(self, 12);
  18068   r = hasSmallIntO(self, value);
  18069   ck_assert(r);
  18070   // not has
  18071   emptyO(self);
  18072   r = hasSmallIntO(self, value);
  18073   ck_assert(!r);
  18074   // non smallInt object
  18075   terminateO(value);
  18076   value = (smallIntt*) allocSmallBool(true);
  18077   r = hasSmallIntO(self, value);
  18078   ck_assert(!r);
  18079   // NULL value
  18080   r = hasSmallIntO(self, NULL);
  18081   ck_assert(!r);
  18082   terminateO(self);
  18083   terminateO(value);
  18084 
  18085 END_TEST
  18086 
  18087 
  18088 START_TEST(hasSmallJsonSmallJsonT)
  18089 
  18090   bool r;
  18091   smallJsont *self = allocSmallJson();
  18092   smallJsont *value = allocSmallJson();
  18093   value->f->pushInt(value, 1);
  18094 
  18095   // has
  18096   createAllocateSmallJson(elem);
  18097   elem->f->pushInt(elem, 1);
  18098   self->f->pushNFreeSmallJson(self, elem);
  18099   r = self->f->hasSmallJson(self, value);
  18100   ck_assert(r);
  18101   // not has
  18102   emptyO(self);
  18103   r = self->f->hasSmallJson(self, value);
  18104   ck_assert(!r);
  18105   // non smallJson object
  18106   terminateO(value);
  18107   value = (smallJsont*) allocSmallInt(2);
  18108   r = self->f->hasSmallJson(self, value);
  18109   ck_assert(!r);
  18110   // NULL value
  18111   r = self->f->hasSmallJson(self, NULL);
  18112   ck_assert(!r);
  18113   terminateO(self);
  18114   terminateO(value);
  18115 
  18116 END_TEST
  18117 
  18118 
  18119 START_TEST(hasSmallStringSmallJsonT)
  18120 
  18121   bool r;
  18122   smallJsont *self   = allocSmallJson();
  18123   smallStringt *value = allocSmallString("qwe");
  18124 
  18125   // has
  18126   self->f->pushS(self, "qwe");
  18127   r = self->f->hasSmallString(self, value);
  18128   ck_assert(r);
  18129   // not has
  18130   emptyO(self);
  18131   r = self->f->hasSmallString(self, value);
  18132   ck_assert(!r);
  18133   // non smallString object
  18134   terminateO(value);
  18135   value = (smallStringt*) allocSmallInt(2);
  18136   r = self->f->hasSmallString(self, value);
  18137   ck_assert(!r);
  18138   // NULL value
  18139   r = self->f->hasSmallString(self, NULL);
  18140   ck_assert(!r);
  18141   terminateO(self);
  18142   terminateO(value);
  18143 
  18144 END_TEST
  18145 
  18146 
  18147 START_TEST(hasSmallContainerSmallJsonT)
  18148 
  18149   bool r;
  18150   smallJsont *self = allocSmallJson();
  18151   createAllocateSmallContainer(value);
  18152 
  18153   // has
  18154   createAllocateSmallContainer(elem);
  18155   self->f->pushNFreeSmallContainer(self, elem);
  18156   r = hasSmallContainerO(self, value);
  18157   ck_assert(!r);
  18158   // not has
  18159   emptyO(self);
  18160   r = hasSmallContainerO(self, value);
  18161   ck_assert(!r);
  18162   // non smallContainer object
  18163   terminateO(value);
  18164   value = (smallContainert*) allocSmallInt(2);
  18165   r = self->f->hasSmallContainer(self, value);
  18166   ck_assert(!r);
  18167   // NULL value
  18168   r = hasSmallContainerO(self, NULL);
  18169   ck_assert(!r);
  18170   terminateO(self);
  18171   terminateO(value);
  18172 
  18173 END_TEST
  18174 
  18175 
  18176 START_TEST(findSmallJsonT)
  18177 
  18178   smallJsont* r;
  18179   smallJsont *self = allocSmallJson();
  18180   setTopSO(self, "");
  18181 
  18182   // find string in the middle
  18183   freeO(self);
  18184   setTopSO(self, "sheepy");
  18185   r =  findO(self, "ee");
  18186   ck_assert_ptr_ne(r, null);
  18187   ck_assert_str_eq(sjGet(r), "eepy");
  18188   terminateO(r);
  18189   // find non existing string
  18190   ck_assert_ptr_eq(findO(self, "$"), NULL);
  18191   // find NULL
  18192   ck_assert_ptr_eq(findO(self, NULL), NULL);
  18193   // empty string
  18194   freeO(self);
  18195   setTopSO(self, "");
  18196   ck_assert_ptr_eq(findO(self, "$"), NULL);
  18197   // NULL string
  18198   freeO(self);
  18199   ck_assert_ptr_eq(findO(self, "$"), NULL);
  18200   terminateO(self);
  18201 
  18202 END_TEST
  18203 
  18204 
  18205 START_TEST(findCharSmallJsonT)
  18206 
  18207   smallJsont* r;
  18208   smallJsont *self = allocSmallJson();
  18209   setTopSO(self, "");
  18210 
  18211   // find string in the middle
  18212   freeO(self);
  18213   setTopSO(self, "sheepy");
  18214   r = findCharO(self, 'e');
  18215   ck_assert_ptr_ne(r, null);
  18216   ck_assert_str_eq(sjGet(r), "eepy");
  18217   terminateO(r);
  18218   // find non existing string
  18219   ck_assert_ptr_eq(findCharO(self, '$'), NULL);
  18220   // find 0
  18221   r = findCharO(self, 0);
  18222   ck_assert_ptr_ne(r, null);
  18223   ck_assert_str_eq(sjGet(r), "");
  18224   terminateO(r);
  18225   // empty string
  18226   freeO(self);
  18227   setTopSO(self, "");
  18228   ck_assert_ptr_eq(findCharO(self, '$'), NULL);
  18229   // NULL string
  18230   freeO(self);
  18231   ck_assert_ptr_eq(findCharO(self, '$'), NULL);
  18232   terminateO(self);
  18233 
  18234 END_TEST
  18235 
  18236 
  18237 START_TEST(findSmallStringSmallJsonT)
  18238 
  18239   smallJsont* r;
  18240   smallJsont *self = allocSmallJson();
  18241   setTopSO(self, "");
  18242   smallStringt *needle = allocSmallString("ee");
  18243 
  18244   // find string in the middle
  18245   freeO(self);
  18246   setTopSO(self, "sheepy");
  18247   r = self->f->findSmallString(self, needle);
  18248   ck_assert_ptr_ne(r, null);
  18249   ck_assert_str_eq(sjGet(r), "eepy");
  18250   terminateO(r);
  18251   // find non existing string
  18252   setValO(needle, "$");
  18253   ck_assert_ptr_eq(self->f->findSmallString(self, needle), NULL);
  18254   // non smallString object
  18255   terminateO(needle);
  18256   needle = (smallStringt*) allocSmallInt(1);
  18257   ck_assert_ptr_eq(self->f->findSmallString(self, needle), NULL);
  18258   terminateO(needle);
  18259   // find NULL
  18260   ck_assert_ptr_eq(self->f->findSmallString(self, NULL), NULL);
  18261   // empty string
  18262   freeO(self);
  18263   setTopSO(self, "");
  18264   needle = allocSmallString("$");
  18265   ck_assert_ptr_eq(self->f->findSmallString(self, needle), NULL);
  18266   // NULL string
  18267   freeO(self);
  18268   ck_assert_ptr_eq(self->f->findSmallString(self, needle), NULL);
  18269   terminateO(needle);
  18270   terminateO(self);
  18271 
  18272 END_TEST
  18273 
  18274 
  18275 START_TEST(findJsonSmallJsonT)
  18276 
  18277   smallJsont* r;
  18278   smallJsont *self = allocSmallJson();
  18279   setTopSO(self, "");
  18280   smallJsont *needle = allocSmallJson();
  18281 
  18282   // find string in the middle
  18283   freeO(self);
  18284   setTopSO(self, "sheepy");
  18285   setTopSO(needle, "ee");
  18286   r = self->f->findJson(self, needle);
  18287   ck_assert_ptr_ne(r, null);
  18288   ck_assert_str_eq(sjGet(r), "eepy");
  18289   terminateO(r);
  18290   // find non existing string
  18291   freeO(needle);
  18292   setTopSO(needle, "$");
  18293   ck_assert_ptr_eq(self->f->findJson(self, needle), NULL);
  18294   // non json string
  18295   freeO(needle);
  18296   ck_assert_ptr_eq(self->f->findJson(self, needle), NULL);
  18297   // non json object
  18298   terminateO(needle);
  18299   needle = (smallJsont*) allocSmallInt(1);
  18300   ck_assert_ptr_eq(self->f->findJson(self, needle), NULL);
  18301   terminateO(needle);
  18302   // find NULL
  18303   ck_assert_ptr_eq(self->f->findJson(self, NULL), NULL);
  18304   // empty string
  18305   freeO(self);
  18306   setTopSO(self, "");
  18307   needle = allocSmallJson();
  18308   setTopSO(needle, "$");
  18309   ck_assert_ptr_eq(self->f->findJson(self, needle), NULL);
  18310   // NULL string
  18311   freeO(self);
  18312   ck_assert_ptr_eq(self->f->findJson(self, needle), NULL);
  18313   terminateO(needle);
  18314   terminateO(self);
  18315 
  18316 END_TEST
  18317 
  18318 
  18319 START_TEST(indexOfSmallJsonT)
  18320 
  18321   ssize_t r;
  18322   smallJsont *self = allocSmallJson();
  18323   baset *value = (baset*)allocSmallInt(1);
  18324 
  18325   // index
  18326   self->f->pushInt(self, 2);
  18327   self->f->pushInt(self, 0);
  18328   delElemIndexO(self, 1);
  18329   self->f->pushInt(self, 1);
  18330   r = indexOfO(self, value);
  18331   ck_assert_int_eq(r, 2);
  18332   // not index
  18333   smallIntt *v = (smallIntt*) value;
  18334   setValO(v, 0);
  18335   r = indexOfO(self, value);
  18336   ck_assert_int_eq(r, -1);
  18337   // NULL value
  18338   r = indexOfO(self, NULL);
  18339   ck_assert_int_eq(r, -1);
  18340   terminateO(self);
  18341   terminateO(value);
  18342 
  18343 END_TEST
  18344 
  18345 
  18346 START_TEST(indexOfUndefinedSmallJsonT)
  18347 
  18348   ssize_t r;
  18349   smallJsont *self = allocSmallJson();
  18350   undefinedt *value = allocUndefined();
  18351 
  18352   // indexOf
  18353   self->f->pushInt(self, 1);
  18354   self->f->pushUndefined(self);
  18355   delElemIndexO(self, 1);
  18356   self->f->pushUndefined(self);
  18357   r = indexOfUndefinedO(self, value);
  18358   ck_assert_int_eq(r, 2);
  18359   // not indexOf
  18360   delElemIndexO(self, 2);
  18361   r = indexOfUndefinedO(self, value);
  18362   ck_assert_int_eq(r, -1);
  18363   // non undefined object
  18364   terminateO(value);
  18365   value = (undefinedt*) allocSmallInt(2);
  18366   r = indexOfUndefinedO(self, value);
  18367   ck_assert_int_eq(r, -1);
  18368   // NULL value
  18369   r = indexOfUndefinedO(self, NULL);
  18370   ck_assert_int_eq(r, -1);
  18371   terminateO(self);
  18372   terminateO(value);
  18373 
  18374 END_TEST
  18375 
  18376 
  18377 START_TEST(indexOfBoolSmallJsonT)
  18378 
  18379   ssize_t r;
  18380   smallJsont *self = allocSmallJson();
  18381   bool value = true;
  18382 
  18383   // indexOf
  18384   self->f->pushInt(self, 1);
  18385   self->f->pushUndefined(self);
  18386   delElemIndexO(self, 1);
  18387   self->f->pushBool(self, true);
  18388   r = indexOfBoolO(self, value);
  18389   ck_assert_int_eq(r, 2);
  18390   // not indexOf
  18391   delElemIndexO(self, 2);
  18392   r = indexOfBoolO(self, value);
  18393   ck_assert_int_eq(r, -1);
  18394   terminateO(self);
  18395 
  18396 END_TEST
  18397 
  18398 
  18399 START_TEST(indexOfDoubleSmallJsonT)
  18400 
  18401   ssize_t r;
  18402   smallJsont *self = allocSmallJson();
  18403   double value = 2;
  18404 
  18405   // indexOf
  18406   self->f->pushInt(self, 1);
  18407   self->f->pushUndefined(self);
  18408   delElemIndexO(self, 1);
  18409   self->f->pushDouble(self, 2);
  18410   r = indexOfDoubleO(self, value);
  18411   ck_assert_int_eq(r, 2);
  18412   // not indexOf
  18413   delElemIndexO(self, 2);
  18414   r = indexOfDoubleO(self, value);
  18415   ck_assert_int_eq(r, -1);
  18416   terminateO(self);
  18417 
  18418 END_TEST
  18419 
  18420 
  18421 START_TEST(indexOfIntSmallJsonT)
  18422 
  18423   ssize_t r;
  18424   smallJsont *self = allocSmallJson();
  18425   int64_t value = 1000;
  18426 
  18427   // indexOf
  18428   self->f->pushUndefined(self);
  18429   self->f->pushUndefined(self);
  18430   delElemIndexO(self, 1);
  18431   self->f->pushInt(self, 1000);
  18432   r = indexOfIntO(self, value);
  18433   ck_assert_int_eq(r, 2);
  18434   // not indexOf
  18435   delElemIndexO(self, 2);
  18436   r = indexOfIntO(self, value);
  18437   ck_assert_int_eq(r, -1);
  18438   terminateO(self);
  18439 
  18440 END_TEST
  18441 
  18442 
  18443 START_TEST(indexOfSSmallJsonT)
  18444 
  18445   ssize_t r;
  18446   smallJsont *self = allocSmallJson();
  18447   const char *value = "asd";
  18448 
  18449   // indexOf
  18450   self->f->pushUndefined(self);
  18451   self->f->pushUndefined(self);
  18452   delElemIndexO(self, 1);
  18453   self->f->pushS(self, "asd");
  18454   r = indexOfSO(self, value);
  18455   ck_assert_int_eq(r, 2);
  18456   // not indexOf
  18457   delElemIndexO(self, 2);
  18458   r = indexOfSO(self, value);
  18459   ck_assert_int_eq(r, -1);
  18460   // NULL value
  18461   r = indexOfSO(self, NULL);
  18462   ck_assert_int_eq(r, -1);
  18463   terminateO(self);
  18464   // json string
  18465   self = allocSmallJson();
  18466   // indexOf string in the middle
  18467   setTopSO(self, "sheepy");
  18468   ck_assert_int_eq(indexOfSO(self, "ee"), 2);
  18469   // indexOf non existing string
  18470   ck_assert_int_eq(indexOfSO(self, "$"), -1);
  18471   terminateO(self);
  18472 
  18473 END_TEST
  18474 
  18475 
  18476 START_TEST(indexOfCharSmallJsonT)
  18477 
  18478   ssize_t r;
  18479   smallJsont *self = allocSmallJson();
  18480   char value = 'a';
  18481 
  18482   // indexOf
  18483   self->f->pushUndefined(self);
  18484   self->f->pushUndefined(self);
  18485   delElemIndexO(self, 1);
  18486   self->f->pushS(self, "a");
  18487   r = indexOfCharO(self, value);
  18488   ck_assert_int_eq(r, 2);
  18489   // not indexOf
  18490   delElemIndexO(self, 2);
  18491   r = indexOfCharO(self, value);
  18492   ck_assert_int_eq(r, -1);
  18493   terminateO(self);
  18494 
  18495 END_TEST
  18496 
  18497 
  18498 START_TEST(indexOfDictSmallJsonT)
  18499 
  18500   ssize_t r;
  18501   smallJsont *self = allocSmallJson();
  18502   smallDictt *value = allocSmallDict();
  18503 
  18504   // indexOf
  18505   createAllocateSmallDict(elem);
  18506   elem->f->setInt(elem, "a", 1);
  18507   self->f->pushNFreeDict(self, elem);
  18508   self->f->pushUndefined(self);
  18509   delElemIndexO(self, 1);
  18510   self->f->pushNFreeDict(self, allocSmallDict());
  18511   r = indexOfDictO(self, value);
  18512   ck_assert_int_eq(r, 2);
  18513   // not indexOf
  18514   delElemIndexO(self, 2);
  18515   r = indexOfDictO(self, value);
  18516   ck_assert_int_eq(r, -1);
  18517   // non smallDict object
  18518   terminateO(value);
  18519   value = (smallDictt*) allocSmallInt(2);
  18520   r = indexOfDictO(self, value);
  18521   ck_assert_int_eq(r, -1);
  18522   // NULL value
  18523   r = indexOfDictO(self, NULL);
  18524   ck_assert_int_eq(r, -1);
  18525   terminateO(self);
  18526   terminateO(value);
  18527 
  18528 END_TEST
  18529 
  18530 
  18531 START_TEST(indexOfArraySmallJsonT)
  18532 
  18533   ssize_t r;
  18534   smallJsont *self = allocSmallJson();
  18535   smallArrayt *value = allocSmallArray();
  18536 
  18537   // indexOf
  18538   createAllocateSmallArray(elem);
  18539   elem->f->pushInt(elem, 1);
  18540   self->f->pushNFreeArray(self, elem);
  18541   self->f->pushUndefined(self);
  18542   delElemIndexO(self, 1);
  18543   self->f->pushNFreeArray(self, allocSmallArray());
  18544   r = indexOfArrayO(self, value);
  18545   ck_assert_int_eq(r, 2);
  18546   // non smallArray object
  18547   terminateO(value);
  18548   value = (smallArrayt*) allocSmallInt(2);
  18549   r = indexOfArrayO(self, value);
  18550   ck_assert_int_eq(r, -1);
  18551   // not indexOf
  18552   emptyO(self);
  18553   r = indexOfArrayO(self, value);
  18554   ck_assert_int_eq(r, -1);
  18555   // NULL value
  18556   r = indexOfArrayO(self, NULL);
  18557   ck_assert_int_eq(r, -1);
  18558   terminateO(self);
  18559   terminateO(value);
  18560 
  18561 END_TEST
  18562 
  18563 
  18564 START_TEST(indexOfArraycSmallJsonT)
  18565 
  18566   ssize_t r;
  18567   smallJsont *self = allocSmallJson();
  18568   char **value = listCreateS("a","bb");
  18569 
  18570   // indexOf
  18571   char **elem = listCreateS("!!","@@@");
  18572   self->f->pushNFreeArrayc(self, elem);
  18573   self->f->pushUndefined(self);
  18574   delElemIndexO(self, 1);
  18575   self->f->pushNFreeArrayc(self, listCreateS("a","bb"));
  18576   r = indexOfArraycO(self, value);
  18577   ck_assert_int_eq(r, 2);
  18578   // not indexOf
  18579   delElemIndexO(self, 2);
  18580   r = indexOfArraycO(self, value);
  18581   ck_assert_int_eq(r, -1);
  18582   // NULL value
  18583   r = indexOfArraycO(self, NULL);
  18584   ck_assert_int_eq(r, -1);
  18585   terminateO(self);
  18586   listFreeS(value);
  18587 
  18588 END_TEST
  18589 
  18590 
  18591 START_TEST(indexOfSmallBoolSmallJsonT)
  18592 
  18593   ssize_t r;
  18594   smallJsont *self = allocSmallJson();
  18595   smallBoolt *value = allocSmallBool(true);
  18596 
  18597   // indexOf
  18598   self->f->pushUndefined(self);
  18599   self->f->pushUndefined(self);
  18600   delElemIndexO(self, 1);
  18601   self->f->pushBool(self, true);
  18602   r = indexOfSmallBoolO(self, value);
  18603   ck_assert_int_eq(r, 2);
  18604   // not indexOf
  18605   delElemIndexO(self, 2);
  18606   r = indexOfSmallBoolO(self, value);
  18607   ck_assert_int_eq(r, -1);
  18608   // non smallBool object
  18609   terminateO(value);
  18610   value = (smallBoolt*) allocSmallInt(2);
  18611   r = indexOfSmallBoolO(self, value);
  18612   ck_assert_int_eq(r, -1);
  18613   // NULL value
  18614   r = indexOfSmallBoolO(self, NULL);
  18615   ck_assert_int_eq(r, -1);
  18616   terminateO(self);
  18617   terminateO(value);
  18618 
  18619 END_TEST
  18620 
  18621 
  18622 START_TEST(indexOfSmallBytesSmallJsonT)
  18623 
  18624   ssize_t r;
  18625   smallJsont *self = allocSmallJson();
  18626   createAllocateSmallBytes(value);
  18627   pushBufferO(value, &self, 8);
  18628 
  18629   // indexOf
  18630   self->f->pushUndefined(self);
  18631   self->f->pushUndefined(self);
  18632   delElemIndexO(self, 1);
  18633   createAllocateSmallBytes(elem);
  18634   pushBufferO(elem, &self, 8);
  18635   self->f->pushNFreeSmallBytes(self, elem);
  18636   r = indexOfSmallBytesO(self, value);
  18637   ck_assert_int_eq(r, 2);
  18638   // not indexOf
  18639   delElemIndexO(self, 2);
  18640   r = indexOfSmallBytesO(self, value);
  18641   ck_assert_int_eq(r, -1);
  18642   // non smallBytes object
  18643   terminateO(value);
  18644   value = (smallBytest*) allocSmallInt(2);
  18645   r = indexOfSmallBytesO(self, value);
  18646   ck_assert_int_eq(r, -1);
  18647   // NULL value
  18648   r = indexOfSmallBytesO(self, NULL);
  18649   ck_assert_int_eq(r, -1);
  18650   terminateO(self);
  18651   terminateO(value);
  18652 
  18653 END_TEST
  18654 
  18655 
  18656 START_TEST(indexOfSmallDoubleSmallJsonT)
  18657 
  18658   ssize_t r;
  18659   smallJsont *self = allocSmallJson();
  18660   smallDoublet *value = allocSmallDouble(2);
  18661 
  18662   // indexOf
  18663   self->f->pushUndefined(self);
  18664   self->f->pushUndefined(self);
  18665   delElemIndexO(self, 1);
  18666   self->f->pushDouble(self, 2);
  18667   r = indexOfSmallDoubleO(self, value);
  18668   ck_assert_int_eq(r, 2);
  18669   // not indexOf
  18670   delElemIndexO(self, 2);
  18671   r = indexOfSmallDoubleO(self, value);
  18672   ck_assert_int_eq(r, -1);
  18673   // non smallDouble object
  18674   terminateO(value);
  18675   value = (smallDoublet*) allocSmallInt(2);
  18676   r = indexOfSmallDoubleO(self, value);
  18677   ck_assert_int_eq(r, -1);
  18678   // NULL value
  18679   r = indexOfSmallDoubleO(self, NULL);
  18680   ck_assert_int_eq(r, -1);
  18681   terminateO(self);
  18682   terminateO(value);
  18683 
  18684 END_TEST
  18685 
  18686 
  18687 START_TEST(indexOfSmallIntSmallJsonT)
  18688 
  18689   ssize_t r;
  18690   smallJsont *self = allocSmallJson();
  18691   smallIntt *value  = allocSmallInt(12);
  18692 
  18693   // indexOf
  18694   self->f->pushUndefined(self);
  18695   self->f->pushUndefined(self);
  18696   delElemIndexO(self, 1);
  18697   self->f->pushInt(self, 12);
  18698   r = indexOfSmallIntO(self, value);
  18699   ck_assert_int_eq(r, 2);
  18700   // not indexOf
  18701   delElemIndexO(self, 2);
  18702   r = indexOfSmallIntO(self, value);
  18703   ck_assert_int_eq(r, -1);
  18704   // non smallInt object
  18705   terminateO(value);
  18706   value = (smallIntt*) allocSmallBool(true);
  18707   r = indexOfSmallIntO(self, value);
  18708   ck_assert_int_eq(r, -1);
  18709   // NULL value
  18710   r = indexOfSmallIntO(self, NULL);
  18711   ck_assert_int_eq(r, -1);
  18712   terminateO(self);
  18713   terminateO(value);
  18714 
  18715 END_TEST
  18716 
  18717 
  18718 START_TEST(indexOfSmallJsonSmallJsonT)
  18719 
  18720   ssize_t r;
  18721   smallJsont *self = allocSmallJson();
  18722   smallJsont *value = allocSmallJson();
  18723 
  18724   // indexOf json undefined
  18725   createUndefined(u);
  18726   setTopO(value, (baset*)&u);
  18727   self->f->pushUndefined(self);
  18728   r = self->f->indexOfSmallJson(self, value);
  18729   ck_assert_int_eq(r, 0);
  18730   freeO(value);
  18731   // indexOf json bool
  18732   smallBoolt *b = allocSmallBool(true);
  18733   setTopNFreeSmallBoolO(value, b);
  18734   self->f->pushBool(self, true);
  18735   r = self->f->indexOfSmallJson(self, value);
  18736   ck_assert_int_eq(r, 1);
  18737   freeO(value);
  18738   // indexOf json double
  18739   smallDoublet *d = allocSmallDouble(1);
  18740   setTopNFreeSmallDoubleO(value, d);
  18741   self->f->pushDouble(self, 1);
  18742   r = self->f->indexOfSmallJson(self, value);
  18743   ck_assert_int_eq(r, 2);
  18744   freeO(value);
  18745   // indexOf json int
  18746   smallIntt *i = allocSmallInt(1);
  18747   setTopNFreeSmallIntO(value, i);
  18748   self->f->pushInt(self, 1);
  18749   r = self->f->indexOfSmallJson(self, value);
  18750   ck_assert_int_eq(r, 3);
  18751   freeO(value);
  18752   // indexOf json string
  18753   smallStringt *s = allocSmallString("asd");
  18754   setTopNFreeSmallStringO(value, s);
  18755   self->f->pushS(self, "asd");
  18756   r = self->f->indexOfSmallJson(self, value);
  18757   ck_assert_int_eq(r, 4);
  18758   freeO(value);
  18759   // indexOf json dict
  18760   smallDictt *D = allocSmallDict();
  18761   setTopNFreeDictO(value, D);
  18762   self->f->pushNFreeDict(self, allocSmallDict());
  18763   r = self->f->indexOfSmallJson(self, value);
  18764   ck_assert_int_eq(r, 5);
  18765   freeO(value);
  18766   // indexOf json array
  18767   value->f->pushInt(value, 1);
  18768   delElemIndexO(self, 1);
  18769   createAllocateSmallJson(elem);
  18770   elem->f->pushInt(elem, 1);
  18771   self->f->pushNFreeSmallJson(self, elem);
  18772   r = self->f->indexOfSmallJson(self, value);
  18773   ck_assert_int_eq(r, 6);
  18774   // not indexOf
  18775   delElemIndexO(self, 6);
  18776   r = self->f->indexOfSmallJson(self, value);
  18777   ck_assert_int_eq(r, -1);
  18778   // empty json object
  18779   freeO(value);
  18780   r = self->f->indexOfSmallJson(self, value);
  18781   ck_assert_int_eq(r, -1);
  18782   // non smallJson object
  18783   terminateO(value);
  18784   value = (smallJsont*) allocSmallInt(2);
  18785   r = self->f->indexOfSmallJson(self, value);
  18786   ck_assert_int_eq(r, -1);
  18787   // NULL value
  18788   r = self->f->indexOfSmallJson(self, NULL);
  18789   ck_assert_int_eq(r, -1);
  18790   terminateO(self);
  18791   terminateO(value);
  18792 
  18793 END_TEST
  18794 
  18795 
  18796 START_TEST(indexOfSmallStringSmallJsonT)
  18797 
  18798   ssize_t r;
  18799   smallJsont *self = allocSmallJson();
  18800   smallStringt *value = allocSmallString("qwe");
  18801 
  18802   // indexOf
  18803   self->f->pushUndefined(self);
  18804   self->f->pushUndefined(self);
  18805   delElemIndexO(self, 1);
  18806   self->f->pushS(self, "qwe");
  18807   r = self->f->indexOfSmallString(self, value);
  18808   ck_assert_int_eq(r, 2);
  18809   // not indexOf
  18810   delElemIndexO(self, 2);
  18811   r = self->f->indexOfSmallString(self, value);
  18812   ck_assert_int_eq(r, -1);
  18813   // empty string
  18814   freeO(value);
  18815   r = self->f->indexOfSmallString(self, value);
  18816   ck_assert_int_eq(r, -1);
  18817   // non smallString object
  18818   terminateO(value);
  18819   value = (smallStringt*) allocSmallInt(2);
  18820   r = self->f->indexOfSmallString(self, value);
  18821   ck_assert_int_eq(r, -1);
  18822   // NULL value
  18823   r = self->f->indexOfSmallString(self, NULL);
  18824   ck_assert_int_eq(r, -1);
  18825   terminateO(self);
  18826   terminateO(value);
  18827   // json string
  18828   self = allocSmallJson();
  18829   smallStringt *needle = allocSmallString("ee");
  18830   // indexOf string in the middle
  18831   setTopSO(self, "sheepy");
  18832   ck_assert_int_eq(self->f->indexOfSmallString(self, needle), 2);
  18833   // indexOf non existing string
  18834   setValO(needle, "$");
  18835   ck_assert_int_eq(self->f->indexOfSmallString(self, needle), -1);
  18836   // non smallString object
  18837   terminateO(needle);
  18838   needle = (smallStringt*) allocSmallInt(1);
  18839   ck_assert_int_eq(self->f->indexOfSmallString(self, needle), -1);
  18840   terminateO(needle);
  18841   // indexOf NULL
  18842   ck_assert_int_eq(self->f->indexOfSmallString(self, NULL), -1);
  18843   // empty string
  18844   freeO(self);
  18845   setTopSO(self, "");
  18846   needle = allocSmallString("$");
  18847   ck_assert_int_eq(self->f->indexOfSmallString(self, needle), -1);
  18848   terminateO(needle);
  18849   terminateO(self);
  18850 
  18851 END_TEST
  18852 
  18853 
  18854 START_TEST(indexOfSmallContainerSmallJsonT)
  18855 
  18856   ssize_t r;
  18857   smallJsont *self = allocSmallJson();
  18858   createAllocateSmallContainer(value);
  18859 
  18860   // indexOf
  18861   self->f->pushUndefined(self);
  18862   self->f->pushUndefined(self);
  18863   delElemIndexO(self, 1);
  18864   createAllocateSmallContainer(elem);
  18865   self->f->pushNFreeSmallContainer(self, elem);
  18866   r = self->f->indexOfSmallContainer(self, value);
  18867   ck_assert_int_eq(r, -1);
  18868   // not indexOf
  18869   delElemIndexO(self, 2);
  18870   r = self->f->indexOfSmallContainer(self, value);
  18871   ck_assert_int_eq(r, -1);
  18872   // non smallContainer object
  18873   terminateO(value);
  18874   value = (smallContainert*) allocSmallInt(2);
  18875   r = self->f->indexOfSmallContainer(self, value);
  18876   ck_assert_int_eq(r, -1);
  18877   // NULL value
  18878   r = self->f->indexOfSmallContainer(self, NULL);
  18879   ck_assert_int_eq(r, -1);
  18880   terminateO(self);
  18881   terminateO(value);
  18882 
  18883 END_TEST
  18884 
  18885 
  18886 START_TEST(binarySearchSmallJsonT)
  18887 
  18888   ssize_t r;
  18889   smallJsont *self = allocSmallJson();
  18890   baset *value = (baset*)allocSmallString("4");
  18891 
  18892   // index not trimmed (an element is NULL)
  18893   self->f->pushS(self, "0");
  18894   self->f->pushS(self, "1");
  18895   self->f->pushS(self, "2");
  18896   delElemIndexO(self, 2);
  18897   self->f->pushS(self, "3");
  18898   self->f->pushS(self, "4");
  18899   self->f->pushS(self, "5");
  18900   r = binarySearchO(self, value);
  18901   ck_assert_int_eq(r, -1);
  18902   // index
  18903   trimO(self);
  18904   r = binarySearchO(self, value);
  18905   ck_assert_int_eq(r, 3);
  18906   smallStringt *v = (smallStringt*) value;
  18907   // index in the lower half of the array
  18908   setValO(v, "1");
  18909   r = binarySearchO(self, value);
  18910   ck_assert_int_eq(r, 1);
  18911   // not index
  18912   setValO(v, "asd");
  18913   r = binarySearchO(self, value);
  18914   ck_assert_int_eq(r, -1);
  18915   // NULL value
  18916   r = binarySearchO(self, NULL);
  18917   ck_assert_int_eq(r, -1);
  18918   // empty array
  18919   emptyO(self);
  18920   r = binarySearchO(self, value);
  18921   ck_assert_int_eq(r, -1);
  18922   terminateO(self);
  18923   terminateO(value);
  18924 
  18925 END_TEST
  18926 
  18927 
  18928 START_TEST(binarySearchUndefinedSmallJsonT)
  18929 
  18930   ssize_t r;
  18931   smallJsont *self = allocSmallJson();
  18932   undefinedt *undefined = (undefinedt*) 1234;
  18933 
  18934   r = binarySearchUndefinedO(self, undefined);
  18935   ck_assert_int_eq(r, -1);
  18936   terminateO(self);
  18937 
  18938 END_TEST
  18939 
  18940 
  18941 START_TEST(binarySearchBoolSmallJsonT)
  18942 
  18943   ssize_t r;
  18944   smallJsont *self = allocSmallJson();
  18945   bool value = true;
  18946 
  18947   // index not trimmed (an element is NULL)
  18948   self->f->pushUndefined(self);
  18949   self->f->pushBool(self, false);
  18950   self->f->pushUndefined(self);
  18951   delElemIndexO(self, 2);
  18952   self->f->pushBool(self, true);
  18953   self->f->pushS(self, "4");
  18954   self->f->pushS(self, "5");
  18955   r = binarySearchBoolO(self, value);
  18956   ck_assert_int_eq(r, -1);
  18957   // index
  18958   trimO(self);
  18959   r = binarySearchBoolO(self, value);
  18960   ck_assert_int_eq(r, 2);
  18961   // index in the lower half of the array
  18962   value = false;
  18963   r = binarySearchBoolO(self, value);
  18964   ck_assert_int_eq(r, 1);
  18965   // not index
  18966   delElemIndexO(self, 1);
  18967   trimO(self);
  18968   r = binarySearchBoolO(self, value);
  18969   ck_assert_int_eq(r, -1);
  18970   // empty array
  18971   emptyO(self);
  18972   r = binarySearchBoolO(self, value);
  18973   ck_assert_int_eq(r, -1);
  18974   terminateO(self);
  18975 
  18976 END_TEST
  18977 
  18978 
  18979 START_TEST(binarySearchDoubleSmallJsonT)
  18980 
  18981   ssize_t r;
  18982   smallJsont *self = allocSmallJson();
  18983   double value = 2;
  18984 
  18985   // index not trimmed (an element is NULL)
  18986   self->f->pushUndefined(self);
  18987   self->f->pushDouble(self, 1);
  18988   self->f->pushUndefined(self);
  18989   delElemIndexO(self, 2);
  18990   self->f->pushDouble(self, 2);
  18991   self->f->pushS(self, "4");
  18992   self->f->pushS(self, "5");
  18993   r = binarySearchDoubleO(self, value);
  18994   ck_assert_int_eq(r, -1);
  18995   // index
  18996   trimO(self);
  18997   r = binarySearchDoubleO(self, value);
  18998   ck_assert_int_eq(r, 2);
  18999   // index in the lower half of the array
  19000   value = 1;
  19001   r = binarySearchDoubleO(self, value);
  19002   ck_assert_int_eq(r, 1);
  19003   // not index
  19004   delElemIndexO(self, 1);
  19005   trimO(self);
  19006   r = binarySearchDoubleO(self, value);
  19007   ck_assert_int_eq(r, -1);
  19008   // empty array
  19009   emptyO(self);
  19010   r = binarySearchDoubleO(self, value);
  19011   ck_assert_int_eq(r, -1);
  19012   terminateO(self);
  19013 
  19014 END_TEST
  19015 
  19016 
  19017 START_TEST(binarySearchIntSmallJsonT)
  19018 
  19019   ssize_t r;
  19020   smallJsont *self = allocSmallJson();
  19021   int64_t value = 2;
  19022 
  19023   // index not trimmed (an element is NULL)
  19024   self->f->pushUndefined(self);
  19025   self->f->pushInt(self, 1);
  19026   self->f->pushUndefined(self);
  19027   delElemIndexO(self, 2);
  19028   self->f->pushInt(self, 2);
  19029   self->f->pushS(self, "4");
  19030   self->f->pushS(self, "5");
  19031   r = binarySearchIntO(self, value);
  19032   ck_assert_int_eq(r, -1);
  19033   // index
  19034   trimO(self);
  19035   r = binarySearchIntO(self, value);
  19036   ck_assert_int_eq(r, 2);
  19037   // index in the lower half of the array
  19038   value = 1;
  19039   r = binarySearchIntO(self, value);
  19040   ck_assert_int_eq(r, 1);
  19041   // not index
  19042   delElemIndexO(self, 1);
  19043   trimO(self);
  19044   r = binarySearchIntO(self, value);
  19045   ck_assert_int_eq(r, -1);
  19046   // empty array
  19047   emptyO(self);
  19048   r = binarySearchIntO(self, value);
  19049   ck_assert_int_eq(r, -1);
  19050   terminateO(self);
  19051 
  19052 END_TEST
  19053 
  19054 
  19055 START_TEST(binarySearchSSmallJsonT)
  19056 
  19057   ssize_t r;
  19058   smallJsont *self = allocSmallJson();
  19059   const char *value = "4";
  19060 
  19061   // index not trimmed (an element is NULL)
  19062   self->f->pushS(self, "0");
  19063   self->f->pushS(self, "1");
  19064   self->f->pushS(self, "2");
  19065   delElemIndexO(self, 2);
  19066   self->f->pushS(self, "3");
  19067   self->f->pushS(self, "4");
  19068   self->f->pushS(self, "5");
  19069   r = binarySearchSO(self, value);
  19070   ck_assert_int_eq(r, -1);
  19071   // index
  19072   trimO(self);
  19073   r = binarySearchSO(self, value);
  19074   ck_assert_int_eq(r, 3);
  19075   // index in the lower half of the array
  19076   value = "1";
  19077   r = binarySearchSO(self, value);
  19078   ck_assert_int_eq(r, 1);
  19079   // not index
  19080   value = "asd";
  19081   r = binarySearchSO(self, value);
  19082   ck_assert_int_eq(r, -1);
  19083   // NULL value
  19084   r = binarySearchSO(self, NULL);
  19085   ck_assert_int_eq(r, -1);
  19086   // empty array
  19087   emptyO(self);
  19088   r = binarySearchSO(self, value);
  19089   ck_assert_int_eq(r, -1);
  19090   terminateO(self);
  19091 
  19092 END_TEST
  19093 
  19094 
  19095 START_TEST(binarySearchCharSmallJsonT)
  19096 
  19097   ssize_t r;
  19098   smallJsont *self = allocSmallJson();
  19099   char value = '4';
  19100 
  19101   // index not trimmed (an element is NULL)
  19102   self->f->pushS(self, "0");
  19103   self->f->pushS(self, "1");
  19104   self->f->pushS(self, "2");
  19105   delElemIndexO(self, 2);
  19106   self->f->pushS(self, "3");
  19107   self->f->pushS(self, "4");
  19108   self->f->pushS(self, "5");
  19109   r = binarySearchCharO(self, value);
  19110   ck_assert_int_eq(r, -1);
  19111   // index
  19112   trimO(self);
  19113   r = binarySearchCharO(self, value);
  19114   ck_assert_int_eq(r, 3);
  19115   // index in the lower half of the array
  19116   value = '1';
  19117   r = binarySearchCharO(self, value);
  19118   ck_assert_int_eq(r, 1);
  19119   // not index
  19120   value = 'a';
  19121   r = binarySearchCharO(self, value);
  19122   ck_assert_int_eq(r, -1);
  19123   // empty array
  19124   emptyO(self);
  19125   r = binarySearchCharO(self, value);
  19126   ck_assert_int_eq(r, -1);
  19127   terminateO(self);
  19128 
  19129 END_TEST
  19130 
  19131 
  19132 START_TEST(binarySearchDictSmallJsonT)
  19133 
  19134   ssize_t r;
  19135   smallJsont *self = allocSmallJson();
  19136   smallDictt *value = allocSmallDict();
  19137   value->f->setInt(value, "b", 2);
  19138 
  19139   // index not trimmed (an element is NULL)
  19140   createAllocateSmallDict(elem);
  19141   elem->f->setInt(elem, "a", 1);
  19142   self->f->pushUndefined(self);
  19143   self->f->pushDict(self, elem);
  19144   resetO(elem);
  19145   self->f->pushUndefined(self);
  19146   delElemIndexO(self, 2);
  19147   elem->f->setInt(elem, "b", 2);
  19148   self->f->pushNFreeDict(self, elem);
  19149   self->f->pushS(self, "4");
  19150   self->f->pushS(self, "5");
  19151   r = binarySearchDictO(self, value);
  19152   ck_assert_int_eq(r, -1);
  19153   // index
  19154   trimO(self);
  19155   r = binarySearchDictO(self, value);
  19156   ck_assert_int_eq(r, 2);
  19157   // index in the lower half of the array
  19158   freeO(value);
  19159   value->f->setInt(value, "a", 1);
  19160   r = binarySearchDictO(self, value);
  19161   ck_assert_int_eq(r, 1);
  19162   // not index
  19163   freeO(value);
  19164   r = binarySearchDictO(self, value);
  19165   ck_assert_int_eq(r, -1);
  19166   // non smallDict object
  19167   terminateO(value);
  19168   value = (smallDictt*) allocSmallInt(2);
  19169   r = binarySearchDictO(self, value);
  19170   ck_assert_int_eq(r, -1);
  19171   // NULL value
  19172   r = binarySearchDictO(self, NULL);
  19173   ck_assert_int_eq(r, -1);
  19174   // empty array
  19175   emptyO(self);
  19176   r = binarySearchDictO(self, value);
  19177   ck_assert_int_eq(r, -1);
  19178   terminateO(self);
  19179   terminateO(value);
  19180 
  19181 END_TEST
  19182 
  19183 
  19184 START_TEST(binarySearchArraySmallJsonT)
  19185 
  19186   ssize_t r;
  19187   smallJsont *self  = allocSmallJson();
  19188   smallArrayt *value = allocSmallArray();
  19189   value->f->pushInt(value, 2);
  19190 
  19191   // index not trimmed (an element is NULL)
  19192   createAllocateSmallArray(elem);
  19193   elem->f->pushInt(elem, 1);
  19194   self->f->pushUndefined(self);
  19195   self->f->pushArray(self, elem);
  19196   resetO(elem);
  19197   self->f->pushUndefined(self);
  19198   delElemIndexO(self, 2);
  19199   elem->f->pushInt(elem, 2);
  19200   self->f->pushNFreeArray(self, elem);
  19201   self->f->pushS(self, "4");
  19202   self->f->pushS(self, "5");
  19203   r = binarySearchArrayO(self, value);
  19204   ck_assert_int_eq(r, -1);
  19205   // index
  19206   trimO(self);
  19207   r = binarySearchArrayO(self, value);
  19208   ck_assert_int_eq(r, 2);
  19209   // index in the lower half of the array
  19210   freeO(value);
  19211   value->f->pushInt(value, 1);
  19212   r = binarySearchArrayO(self, value);
  19213   ck_assert_int_eq(r, 1);
  19214   // not index
  19215   freeO(value);
  19216   r = binarySearchArrayO(self, value);
  19217   ck_assert_int_eq(r, -1);
  19218   // non smallArray object
  19219   terminateO(value);
  19220   value = (smallArrayt*) allocSmallInt(2);
  19221   r = binarySearchArrayO(self, value);
  19222   ck_assert_int_eq(r, -1);
  19223   // NULL value
  19224   r = binarySearchArrayO(self, NULL);
  19225   ck_assert_int_eq(r, -1);
  19226   // empty array
  19227   emptyO(self);
  19228   r = binarySearchArrayO(self, value);
  19229   ck_assert_int_eq(r, -1);
  19230   terminateO(self);
  19231   terminateO(value);
  19232 
  19233 END_TEST
  19234 
  19235 
  19236 START_TEST(binarySearchArraycSmallJsonT)
  19237 
  19238   ssize_t r;
  19239   smallJsont *self = allocSmallJson();
  19240   char **value      = listCreateS("b");
  19241 
  19242   // index not trimmed (an element is NULL)
  19243   char **elem = listCreateS("a");
  19244   self->f->pushUndefined(self);
  19245   self->f->pushNFreeArrayc(self, elem);
  19246   self->f->pushUndefined(self);
  19247   delElemIndexO(self, 2);
  19248   elem = listCreateS("b");
  19249   self->f->pushNFreeArrayc(self, elem);
  19250   self->f->pushS(self, "4");
  19251   self->f->pushS(self, "5");
  19252   r = binarySearchArraycO(self, value);
  19253   ck_assert_int_eq(r, -1);
  19254   // index
  19255   trimO(self);
  19256   r = binarySearchArraycO(self, value);
  19257   ck_assert_int_eq(r, 2);
  19258   // index in the lower half of the array
  19259   free(value[0]);
  19260   value[0] = strdup("a");
  19261   r = binarySearchArraycO(self, value);
  19262   ck_assert_int_eq(r, 1);
  19263   // not index
  19264   free(value[0]);
  19265   value[0] = strdup("asd");
  19266   r = binarySearchArraycO(self, value);
  19267   ck_assert_int_eq(r, -1);
  19268   // NULL value
  19269   r = binarySearchArraycO(self, NULL);
  19270   ck_assert_int_eq(r, -1);
  19271   // empty array
  19272   emptyO(self);
  19273   r = binarySearchArraycO(self, value);
  19274   ck_assert_int_eq(r, -1);
  19275   terminateO(self);
  19276   listFreeS(value);
  19277 
  19278 END_TEST
  19279 
  19280 
  19281 START_TEST(binarySearchSmallBoolSmallJsonT)
  19282 
  19283   ssize_t r;
  19284   smallJsont *self = allocSmallJson();
  19285   smallBoolt *value = allocSmallBool(true);
  19286 
  19287   // index not trimmed (an element is NULL)
  19288   self->f->pushUndefined(self);
  19289   self->f->pushBool(self, false);
  19290   self->f->pushUndefined(self);
  19291   delElemIndexO(self, 2);
  19292   self->f->pushBool(self, true);
  19293   self->f->pushS(self, "4");
  19294   self->f->pushS(self, "5");
  19295   r = binarySearchSmallBoolO(self, value);
  19296   ck_assert_int_eq(r, -1);
  19297   // index
  19298   trimO(self);
  19299   r = binarySearchSmallBoolO(self, value);
  19300   ck_assert_int_eq(r, 2);
  19301   // index in the lower half of the array
  19302   setValO(value, false);
  19303   r = binarySearchSmallBoolO(self, value);
  19304   ck_assert_int_eq(r, 1);
  19305   // not index
  19306   delElemIndexO(self, 1);
  19307   trimO(self);
  19308   r = binarySearchSmallBoolO(self, value);
  19309   ck_assert_int_eq(r, -1);
  19310   // non smallBool object
  19311   terminateO(value);
  19312   value = (smallBoolt*) allocSmallInt(2);
  19313   r = binarySearchSmallBoolO(self, value);
  19314   ck_assert_int_eq(r, -1);
  19315   // NULL value
  19316   r = binarySearchArraycO(self, NULL);
  19317   ck_assert_int_eq(r, -1);
  19318   // empty array
  19319   emptyO(self);
  19320   r = binarySearchSmallBoolO(self, value);
  19321   ck_assert_int_eq(r, -1);
  19322   terminateO(self);
  19323   terminateO(value);
  19324 
  19325 END_TEST
  19326 
  19327 
  19328 START_TEST(binarySearchSmallBytesSmallJsonT)
  19329 
  19330   ssize_t r;
  19331   smallJsont *self = allocSmallJson();
  19332   createAllocateSmallBytes(value);
  19333   pushBufferO(value, "bbc", 4);
  19334 
  19335   // index not trimmed (an element is NULL)
  19336   createAllocateSmallBytes(elem);
  19337   pushBufferO(elem, "abc", 4);
  19338   self->f->pushUndefined(self);
  19339   self->f->pushNFreeSmallBytes(self, elem);
  19340   self->f->pushUndefined(self);
  19341   delElemIndexO(self, 2);
  19342   elem = allocSmallBytes("bbc", 4);
  19343   self->f->pushNFreeSmallBytes(self, elem);
  19344   self->f->pushS(self, "4");
  19345   self->f->pushS(self, "5");
  19346   r = binarySearchSmallBytesO(self, value);
  19347   ck_assert_int_eq(r, -1);
  19348   // index
  19349   trimO(self);
  19350   r = binarySearchSmallBytesO(self, value);
  19351   ck_assert_int_eq(r, 2);
  19352   // index in the lower half of the array
  19353   freeO(value);
  19354   pushBufferO(value, "abc", 4);
  19355   r = binarySearchSmallBytesO(self, value);
  19356   ck_assert_int_eq(r, 1);
  19357   // not index
  19358   freeO(value);
  19359   pushBufferO(value, "###", 4);
  19360   r = binarySearchSmallBytesO(self, value);
  19361   ck_assert_int_eq(r, -1);
  19362   // non smallBytes object
  19363   terminateO(value);
  19364   value = (smallBytest*) allocSmallInt(2);
  19365   r = binarySearchSmallBytesO(self, value);
  19366   ck_assert_int_eq(r, -1);
  19367   // NULL value
  19368   r = binarySearchSmallBytesO(self, NULL);
  19369   ck_assert_int_eq(r, -1);
  19370   // empty array
  19371   emptyO(self);
  19372   r = binarySearchSmallBytesO(self, value);
  19373   ck_assert_int_eq(r, -1);
  19374   terminateO(self);
  19375   terminateO(value);
  19376 
  19377 END_TEST
  19378 
  19379 
  19380 START_TEST(binarySearchSmallDoubleSmallJsonT)
  19381 
  19382   ssize_t r;
  19383   smallJsont *self   = allocSmallJson();
  19384   smallDoublet *value = allocSmallDouble(2);
  19385 
  19386   // index not trimmed (an element is NULL)
  19387   self->f->pushUndefined(self);
  19388   self->f->pushDouble(self, 1);
  19389   self->f->pushUndefined(self);
  19390   delElemIndexO(self, 2);
  19391   self->f->pushDouble(self, 2);
  19392   self->f->pushS(self, "4");
  19393   self->f->pushS(self, "5");
  19394   r = binarySearchSmallDoubleO(self, value);
  19395   ck_assert_int_eq(r, -1);
  19396   // index
  19397   trimO(self);
  19398   r = binarySearchSmallDoubleO(self, value);
  19399   ck_assert_int_eq(r, 2);
  19400   // index in the lower half of the array
  19401   setValO(value, 1);
  19402   r = binarySearchSmallDoubleO(self, value);
  19403   ck_assert_int_eq(r, 1);
  19404   // not index
  19405   delElemIndexO(self, 1);
  19406   trimO(self);
  19407   r = binarySearchSmallDoubleO(self, value);
  19408   ck_assert_int_eq(r, -1);
  19409   // non smallDouble object
  19410   terminateO(value);
  19411   value = (smallDoublet*) allocSmallInt(2);
  19412   r = binarySearchSmallDoubleO(self, value);
  19413   ck_assert_int_eq(r, -1);
  19414   // NULL value
  19415   r = binarySearchArraycO(self, NULL);
  19416   ck_assert_int_eq(r, -1);
  19417   // empty array
  19418   emptyO(self);
  19419   r = binarySearchSmallDoubleO(self, value);
  19420   ck_assert_int_eq(r, -1);
  19421   terminateO(self);
  19422   terminateO(value);
  19423 
  19424 END_TEST
  19425 
  19426 
  19427 START_TEST(binarySearchSmallIntSmallJsonT)
  19428 
  19429   ssize_t r;
  19430   smallJsont *self = allocSmallJson();
  19431   smallIntt *value  = allocSmallInt(2);
  19432 
  19433   // index not trimmed (an element is NULL)
  19434   self->f->pushUndefined(self);
  19435   self->f->pushInt(self, 1);
  19436   self->f->pushUndefined(self);
  19437   delElemIndexO(self, 2);
  19438   self->f->pushInt(self, 2);
  19439   self->f->pushS(self, "4");
  19440   self->f->pushS(self, "5");
  19441   r = binarySearchSmallIntO(self, value);
  19442   ck_assert_int_eq(r, -1);
  19443   // index
  19444   trimO(self);
  19445   r = binarySearchSmallIntO(self, value);
  19446   ck_assert_int_eq(r, 2);
  19447   // index in the lower half of the array
  19448   setValO(value, 1);
  19449   r = binarySearchSmallIntO(self, value);
  19450   ck_assert_int_eq(r, 1);
  19451   // not index
  19452   delElemIndexO(self, 1);
  19453   trimO(self);
  19454   r = binarySearchSmallIntO(self, value);
  19455   ck_assert_int_eq(r, -1);
  19456   // non smallInt object
  19457   terminateO(value);
  19458   value = (smallIntt*) allocSmallBool(true);
  19459   r = binarySearchSmallIntO(self, value);
  19460   ck_assert_int_eq(r, -1);
  19461   // NULL value
  19462   r = binarySearchArraycO(self, NULL);
  19463   ck_assert_int_eq(r, -1);
  19464   // empty array
  19465   emptyO(self);
  19466   r = binarySearchSmallIntO(self, value);
  19467   ck_assert_int_eq(r, -1);
  19468   terminateO(self);
  19469   terminateO(value);
  19470 
  19471 END_TEST
  19472 
  19473 
  19474 START_TEST(binarySearchSmallJsonSmallJsonT)
  19475 
  19476   ssize_t r;
  19477   smallJsont *self = allocSmallJson();
  19478   smallJsont *value = allocSmallJson();
  19479   value->f->pushInt(value, 2);
  19480 
  19481   // index not trimmed (an element is NULL)
  19482   self->f->pushUndefined(self);
  19483   createAllocateSmallArray(elem);
  19484   elem->f->pushInt(elem, 1);
  19485   self->f->pushArray(self, elem);
  19486   resetO(elem);
  19487   self->f->pushUndefined(self);
  19488   delElemIndexO(self, 2);
  19489   elem->f->pushInt(elem, 2);
  19490   self->f->pushNFreeArray(self, elem);
  19491   self->f->pushS(self, "4");
  19492   self->f->pushS(self, "5");
  19493   r = self->f->binarySearchSmallJson(self, value);
  19494   ck_assert_int_eq(r, -1);
  19495   // index
  19496   trimO(self);
  19497   r = self->f->binarySearchSmallJson(self, value);
  19498   ck_assert_int_eq(r, 2);
  19499   // index in the lower half of the array
  19500   freeO(value);
  19501   value->f->pushInt(value, 1);
  19502   r = self->f->binarySearchSmallJson(self, value);
  19503   ck_assert_int_eq(r, 1);
  19504   // not index (json array)
  19505   delElemIndexO(self, 1);
  19506   trimO(self);
  19507   r = self->f->binarySearchSmallJson(self, value);
  19508   ck_assert_int_eq(r, -1);
  19509   // not index json undefined
  19510   createUndefined(u);
  19511   freeO(value);
  19512   setTopO(value, (baset*)&u);
  19513   r = self->f->binarySearchSmallJson(self, value);
  19514   ck_assert_int_eq(r, -1);
  19515   // not index json bool
  19516   createSmallBool(b);
  19517   freeO(value);
  19518   setTopO(value, (baset*)&b);
  19519   r = self->f->binarySearchSmallJson(self, value);
  19520   ck_assert_int_eq(r, -1);
  19521   // not index json double
  19522   createSmallDouble(d);
  19523   freeO(value);
  19524   setTopO(value, (baset*)&d);
  19525   r = self->f->binarySearchSmallJson(self, value);
  19526   ck_assert_int_eq(r, -1);
  19527   // not index json int
  19528   createSmallInt(i);
  19529   freeO(value);
  19530   setTopO(value, (baset*)&i);
  19531   r = self->f->binarySearchSmallJson(self, value);
  19532   ck_assert_int_eq(r, -1);
  19533   // not index json string
  19534   createSmallString(s);
  19535   freeO(value);
  19536   setTopO(value, (baset*)&s);
  19537   r = self->f->binarySearchSmallJson(self, value);
  19538   ck_assert_int_eq(r, -1);
  19539   // not index json dict
  19540   createSmallDict(D);
  19541   freeO(value);
  19542   setTopO(value, (baset*)&D);
  19543   r = self->f->binarySearchSmallJson(self, value);
  19544   ck_assert_int_eq(r, -1);
  19545   // empty json object
  19546   freeO(value);
  19547   r = self->f->binarySearchSmallJson(self, value);
  19548   ck_assert_int_eq(r, -1);
  19549   // non smallJson object
  19550   terminateO(value);
  19551   value = (smallJsont*) allocSmallInt(2);
  19552   r = self->f->binarySearchSmallJson(self, value);
  19553   ck_assert_int_eq(r, -1);
  19554   // NULL value
  19555   r = self->f->binarySearchSmallJson(self, NULL);
  19556   ck_assert_int_eq(r, -1);
  19557   // empty array
  19558   emptyO(self);
  19559   r = self->f->binarySearchSmallJson(self, value);
  19560   ck_assert_int_eq(r, -1);
  19561   terminateO(self);
  19562   terminateO(value);
  19563 
  19564 END_TEST
  19565 
  19566 
  19567 START_TEST(binarySearchSmallStringSmallJsonT)
  19568 
  19569   ssize_t r;
  19570   smallJsont *self   = allocSmallJson();
  19571   smallStringt *value = allocSmallString("4");
  19572 
  19573   // index not trimmed (an element is NULL)
  19574   self->f->pushS(self, "0");
  19575   self->f->pushS(self, "1");
  19576   self->f->pushS(self, "2");
  19577   delElemIndexO(self, 2);
  19578   self->f->pushS(self, "3");
  19579   self->f->pushS(self, "4");
  19580   self->f->pushS(self, "5");
  19581   r = binarySearchSmallStringO(self, value);
  19582   ck_assert_int_eq(r, -1);
  19583   // index
  19584   trimO(self);
  19585   r = binarySearchSmallStringO(self, value);
  19586   ck_assert_int_eq(r, 3);
  19587   // index in the lower half of the array
  19588   setValO(value, "1");
  19589   r = binarySearchSmallStringO(self, value);
  19590   ck_assert_int_eq(r, 1);
  19591   // not index
  19592   setValO(value, "asd");
  19593   r = binarySearchSmallStringO(self, value);
  19594   ck_assert_int_eq(r, -1);
  19595   // non smallString object
  19596   terminateO(value);
  19597   value = (smallStringt*) allocSmallInt(2);
  19598   r = binarySearchSmallStringO(self, value);
  19599   ck_assert_int_eq(r, -1);
  19600   // NULL value
  19601   r = binarySearchSmallStringO(self, NULL);
  19602   ck_assert_int_eq(r, -1);
  19603   // empty array
  19604   emptyO(self);
  19605   r = binarySearchSmallStringO(self, value);
  19606   ck_assert_int_eq(r, -1);
  19607   terminateO(self);
  19608   terminateO(value);
  19609 
  19610 END_TEST
  19611 
  19612 
  19613 START_TEST(binarySearchSmallContainerSmallJsonT)
  19614 
  19615   ssize_t r;
  19616   smallJsont *self = allocSmallJson();
  19617   createAllocateSmallContainer(value);
  19618 
  19619   r = self->f->binarySearchSmallContainer(self, value);
  19620   ck_assert_int_eq(r, -1);
  19621   terminateO(self);
  19622   terminateO(value);
  19623 
  19624 END_TEST
  19625 
  19626 
  19627 START_TEST(icHasSmallJsonT)
  19628 
  19629   bool r;
  19630   smallJsont *self = allocSmallJson();
  19631   baset *value = (baset*)allocSmallString("a");
  19632 
  19633   // has
  19634   self->f->pushS(self, "A");
  19635   r = icHasO(self, value);
  19636   ck_assert(r);
  19637   // not has
  19638   emptyO(self);
  19639   r = icHasO(self, value);
  19640   ck_assert(!r);
  19641   // NULL value
  19642   r = icHasO(self, NULL);
  19643   ck_assert(!r);
  19644   terminateO(self);
  19645   terminateO(value);
  19646 
  19647 END_TEST
  19648 
  19649 
  19650 START_TEST(icHasSSmallJsonT)
  19651 
  19652   bool r;
  19653   smallJsont *self = allocSmallJson();
  19654   const char *value = "ASD";
  19655 
  19656   // has
  19657   self->f->pushS(self, "asd");
  19658   r = icHasSO(self, value);
  19659   ck_assert(r);
  19660   // not has
  19661   emptyO(self);
  19662   r = icHasSO(self, value);
  19663   ck_assert(!r);
  19664   // NULL value
  19665   r = icHasSO(self, NULL);
  19666   ck_assert(!r);
  19667   terminateO(self);
  19668   // json dict
  19669   self = allocSmallJson();
  19670   self->f->setInt(self, "u", 0);
  19671   ck_assert(!icHasSO(self, "U"));
  19672   ck_assert(icHasSO(self, "u"));
  19673   terminateO(self);
  19674 
  19675 END_TEST
  19676 
  19677 
  19678 START_TEST(icHasCharSmallJsonT)
  19679 
  19680   bool r;
  19681   smallJsont *self = allocSmallJson();
  19682   char value = 'A';
  19683 
  19684   // has
  19685   self->f->pushS(self, "a");
  19686   r = icHasCharO(self, value);
  19687   ck_assert(r);
  19688   // not has
  19689   emptyO(self);
  19690   r = icHasCharO(self, value);
  19691   ck_assert(!r);
  19692   terminateO(self);
  19693 
  19694 END_TEST
  19695 
  19696 
  19697 START_TEST(icHasDictSmallJsonT)
  19698 
  19699   bool r;
  19700   smallJsont *self = allocSmallJson();
  19701   smallDictt *value = allocSmallDict();
  19702   value->f->setInt(value, "A", 1);
  19703 
  19704   // has
  19705   createAllocateSmallDict(d);
  19706   d->f->setInt(d, "a", 1);
  19707   self->f->pushNFreeDict(self, d);
  19708   r = icHasDictO(self, value);
  19709   ck_assert(r);
  19710   // not has
  19711   emptyO(self);
  19712   r = icHasDictO(self, value);
  19713   ck_assert(!r);
  19714   // NULL value
  19715   r = icHasDictO(self, NULL);
  19716   ck_assert(!r);
  19717   terminateO(self);
  19718   terminateO(value);
  19719 
  19720 END_TEST
  19721 
  19722 
  19723 START_TEST(icHasArraySmallJsonT)
  19724 
  19725   bool r;
  19726   smallJsont *self = allocSmallJson();
  19727   smallArrayt *value = allocSmallArray();
  19728   value->f->pushS(value, "A");
  19729 
  19730   // has
  19731   createAllocateSmallArray(a);
  19732   a->f->pushS(a, "a");
  19733   self->f->pushNFreeArray(self, a);
  19734   r = icHasArrayO(self, value);
  19735   ck_assert(r);
  19736   // not has
  19737   emptyO(self);
  19738   r = icHasArrayO(self, value);
  19739   ck_assert(!r);
  19740   // NULL value
  19741   r = icHasArrayO(self, NULL);
  19742   ck_assert(!r);
  19743   terminateO(self);
  19744   terminateO(value);
  19745 
  19746 END_TEST
  19747 
  19748 
  19749 START_TEST(icHasArraycSmallJsonT)
  19750 
  19751   bool r;
  19752   smallJsont *self = allocSmallJson();
  19753   char **value = listCreateS("A","BB");
  19754 
  19755   // has
  19756   self->f->pushNFreeArrayc(self, listCreateS("a","bb"));
  19757   r = icHasArraycO(self, value);
  19758   ck_assert(r);
  19759   // not has
  19760   emptyO(self);
  19761   r = icHasArraycO(self, value);
  19762   ck_assert(!r);
  19763   // NULL value
  19764   r = icHasArraycO(self, NULL);
  19765   ck_assert(!r);
  19766   terminateO(self);
  19767   listFreeS(value);
  19768 
  19769 END_TEST
  19770 
  19771 
  19772 START_TEST(icHasSmallStringSmallJsonT)
  19773 
  19774   bool r;
  19775   smallJsont *self   = allocSmallJson();
  19776   smallStringt *value = allocSmallString("QWE");
  19777 
  19778   // has
  19779   self->f->pushS(self, "qwe");
  19780   r = self->f->icHasSmallString(self, value);
  19781   ck_assert(r);
  19782   // not has
  19783   emptyO(self);
  19784   r = self->f->icHasSmallString(self, value);
  19785   ck_assert(!r);
  19786   // NULL value
  19787   r = self->f->icHasSmallString(self, NULL);
  19788   ck_assert(!r);
  19789   terminateO(self);
  19790   terminateO(value);
  19791 
  19792 END_TEST
  19793 
  19794 
  19795 START_TEST(icFindSmallJsonT)
  19796 
  19797   smallJsont* r;
  19798   smallJsont *self = allocSmallJson();
  19799   setTopSO(self, "");
  19800 
  19801   // icFind string in the middle
  19802   freeO(self);
  19803   setTopSO(self, "sheepy");
  19804   r =  icFindO(self, "EE");
  19805   ck_assert_ptr_ne(r, null);
  19806   ck_assert_str_eq(sjGet(r), "eepy");
  19807   terminateO(r);
  19808   // find non existing string
  19809   ck_assert_ptr_eq(icFindO(self, "$"), NULL);
  19810   // find NULL
  19811   ck_assert_ptr_eq(icFindO(self, NULL), NULL);
  19812   // empty string
  19813   freeO(self);
  19814   setTopSO(self, "");
  19815   ck_assert_ptr_eq(icFindO(self, "$"), NULL);
  19816   // NULL string
  19817   freeO(self);
  19818   ck_assert_ptr_eq(icFindO(self, "$"), NULL);
  19819   terminateO(self);
  19820 
  19821 END_TEST
  19822 
  19823 
  19824 START_TEST(icFindCharSmallJsonT)
  19825 
  19826   smallJsont* r;
  19827   smallJsont *self = allocSmallJson();
  19828   setTopSO(self, "");
  19829 
  19830   // find string in the middle
  19831   freeO(self);
  19832   setTopSO(self, "sheepy");
  19833   r = icFindCharO(self, 'E');
  19834   ck_assert_ptr_ne(r, null);
  19835   ck_assert_str_eq(sjGet(r), "eepy");
  19836   terminateO(r);
  19837   // find non existing string
  19838   ck_assert_ptr_eq(icFindCharO(self, '$'), NULL);
  19839   // find 0
  19840   r = icFindCharO(self, 0);
  19841   ck_assert_ptr_ne(r, null);
  19842   ck_assert_str_eq(sjGet(r), "");
  19843   terminateO(r);
  19844   // empty string
  19845   freeO(self);
  19846   setTopSO(self, "");
  19847   ck_assert_ptr_eq(icFindCharO(self, '$'), NULL);
  19848   ck_assert_ptr_eq(icFindCharO(self, 0), NULL);
  19849   // NULL string
  19850   freeO(self);
  19851   ck_assert_ptr_eq(icFindCharO(self, '$'), NULL);
  19852   ck_assert_ptr_eq(icFindCharO(self, 0), NULL);
  19853   terminateO(self);
  19854 
  19855 END_TEST
  19856 
  19857 
  19858 START_TEST(icFindSmallStringSmallJsonT)
  19859 
  19860   smallJsont* r;
  19861   smallJsont *self = allocSmallJson();
  19862   setTopSO(self, "");
  19863   smallStringt *needle = allocSmallString("EE");
  19864 
  19865   // find string in the middle
  19866   freeO(self);
  19867   setTopSO(self, "sheepy");
  19868   r = self->f->icFindSmallString(self, needle);
  19869   ck_assert_ptr_ne(r, null);
  19870   ck_assert_str_eq(sjGet(r), "eepy");
  19871   terminateO(r);
  19872   // find non existing string
  19873   setValO(needle, "$");
  19874   ck_assert_ptr_eq(self->f->icFindSmallString(self, needle), NULL);
  19875   // non smallString object
  19876   terminateO(needle);
  19877   needle = (smallStringt*) allocSmallInt(1);
  19878   ck_assert_ptr_eq(self->f->icFindSmallString(self, needle), NULL);
  19879   terminateO(needle);
  19880   // find NULL
  19881   ck_assert_ptr_eq(self->f->icFindSmallString(self, NULL), NULL);
  19882   // empty string
  19883   freeO(self);
  19884   setTopSO(self, "");
  19885   needle = allocSmallString("$");
  19886   ck_assert_ptr_eq(self->f->icFindSmallString(self, needle), NULL);
  19887   // NULL string
  19888   freeO(self);
  19889   ck_assert_ptr_eq(self->f->icFindSmallString(self, needle), NULL);
  19890   terminateO(needle);
  19891   terminateO(self);
  19892 
  19893 END_TEST
  19894 
  19895 
  19896 START_TEST(icFindJsonSmallJsonT)
  19897 
  19898   smallJsont* r;
  19899   smallJsont *self = allocSmallJson();
  19900   setTopSO(self, "");
  19901   smallJsont *needle = allocSmallJson();
  19902 
  19903   // find string in the middle
  19904   freeO(self);
  19905   setTopSO(self, "sheepy");
  19906   setTopSO(needle, "EE");
  19907   r = self->f->icFindJson(self, needle);
  19908   ck_assert_ptr_ne(r, null);
  19909   ck_assert_str_eq(sjGet(r), "eepy");
  19910   terminateO(r);
  19911   // find non existing string
  19912   freeO(needle);
  19913   setTopSO(needle, "$");
  19914   ck_assert_ptr_eq(self->f->icFindJson(self, needle), NULL);
  19915   // non json string
  19916   freeO(needle);
  19917   ck_assert_ptr_eq(self->f->icFindJson(self, needle), NULL);
  19918   // non json object
  19919   terminateO(needle);
  19920   needle = (smallJsont*) allocSmallInt(1);
  19921   ck_assert_ptr_eq(self->f->icFindJson(self, needle), NULL);
  19922   terminateO(needle);
  19923   // find NULL
  19924   ck_assert_ptr_eq(self->f->icFindJson(self, NULL), NULL);
  19925   // empty string
  19926   freeO(self);
  19927   setTopSO(self, "");
  19928   needle = allocSmallJson();
  19929   setTopSO(needle, "$");
  19930   ck_assert_ptr_eq(self->f->icFindJson(self, needle), NULL);
  19931   // NULL string
  19932   freeO(self);
  19933   ck_assert_ptr_eq(self->f->icFindJson(self, needle), NULL);
  19934   terminateO(needle);
  19935   terminateO(self);
  19936 
  19937 END_TEST
  19938 
  19939 
  19940 START_TEST(icIndexOfSmallJsonT)
  19941 
  19942   ssize_t r;
  19943   smallJsont *self = allocSmallJson();
  19944   baset *value = (baset*)allocSmallString("A");
  19945 
  19946   // index
  19947   self->f->pushS(self, "2");
  19948   self->f->pushS(self, "3");
  19949   delElemIndexO(self, 1);
  19950   self->f->pushS(self, "a");
  19951   r = icIndexOfO(self, value);
  19952   ck_assert_int_eq(r, 2);
  19953   // not index
  19954   smallStringt *v = (smallStringt*) value;
  19955   setValO(v, "3");
  19956   r = icIndexOfO(self, value);
  19957   ck_assert_int_eq(r, -1);
  19958   // NULL value
  19959   r = icIndexOfO(self, NULL);
  19960   ck_assert_int_eq(r, -1);
  19961   terminateO(self);
  19962   terminateO(value);
  19963 
  19964 END_TEST
  19965 
  19966 
  19967 START_TEST(icIndexOfSSmallJsonT)
  19968 
  19969   ssize_t r;
  19970   smallJsont *self = allocSmallJson();
  19971   const char *value = "ASD";
  19972 
  19973   // indexOf
  19974   self->f->pushUndefined(self);
  19975   self->f->pushUndefined(self);
  19976   delElemIndexO(self, 1);
  19977   self->f->pushS(self, "asd");
  19978   r = icIndexOfSO(self, value);
  19979   ck_assert_int_eq(r, 2);
  19980   // not indexOf
  19981   delElemIndexO(self, 2);
  19982   r = icIndexOfSO(self, value);
  19983   ck_assert_int_eq(r, -1);
  19984   // NULL value
  19985   r = icIndexOfSO(self, NULL);
  19986   ck_assert_int_eq(r, -1);
  19987   terminateO(self);
  19988   // json string
  19989   self = allocSmallJson();
  19990   // indexOf string in the middle
  19991   setTopSO(self, "sheepy");
  19992   ck_assert_int_eq(icIndexOfSO(self, "EE"), 2);
  19993   // indexOf non existing string
  19994   ck_assert_int_eq(icIndexOfSO(self, "$"), -1);
  19995   terminateO(self);
  19996 
  19997 END_TEST
  19998 
  19999 
  20000 START_TEST(icIndexOfCharSmallJsonT)
  20001 
  20002   ssize_t r;
  20003   smallJsont *self = allocSmallJson();
  20004   char value = 'A';
  20005 
  20006   // indexOf
  20007   self->f->pushUndefined(self);
  20008   self->f->pushUndefined(self);
  20009   delElemIndexO(self, 1);
  20010   self->f->pushS(self, "a");
  20011   r = icIndexOfCharO(self, value);
  20012   ck_assert_int_eq(r, 2);
  20013   // not indexOf
  20014   delElemIndexO(self, 2);
  20015   r = icIndexOfCharO(self, value);
  20016   ck_assert_int_eq(r, -1);
  20017   terminateO(self);
  20018 
  20019 END_TEST
  20020 
  20021 
  20022 START_TEST(icIndexOfDictSmallJsonT)
  20023 
  20024   ssize_t r;
  20025   smallJsont *self = allocSmallJson();
  20026   smallDictt *value = allocSmallDict();
  20027   value->f->setInt(value, "B", 1);
  20028 
  20029   // indexOf
  20030   createAllocateSmallDict(elem);
  20031   elem->f->setInt(elem, "a", 1);
  20032   self->f->pushDict(self, elem);
  20033   resetO(elem);
  20034   self->f->pushUndefined(self);
  20035   delElemIndexO(self, 1);
  20036   elem->f->setInt(elem, "b", 1);
  20037   self->f->pushNFreeDict(self, elem);
  20038   r = icIndexOfDictO(self, value);
  20039   ck_assert_int_eq(r, 2);
  20040   // not indexOf
  20041   delElemIndexO(self, 2);
  20042   r = icIndexOfDictO(self, value);
  20043   ck_assert_int_eq(r, -1);
  20044   // non smallDict object
  20045   terminateO(value);
  20046   value = (smallDictt*) allocSmallInt(2);
  20047   r = icIndexOfDictO(self, value);
  20048   ck_assert_int_eq(r, -1);
  20049   // NULL value
  20050   r = icIndexOfDictO(self, NULL);
  20051   ck_assert_int_eq(r, -1);
  20052   terminateO(self);
  20053   terminateO(value);
  20054 
  20055 END_TEST
  20056 
  20057 
  20058 START_TEST(icIndexOfArraySmallJsonT)
  20059 
  20060   ssize_t r;
  20061   smallJsont *self = allocSmallJson();
  20062   smallArrayt *value = allocSmallArray();
  20063   value->f->pushS(value, "A");
  20064 
  20065   // indexOf
  20066   createAllocateSmallArray(elem);
  20067   elem->f->pushInt(elem, 1);
  20068   self->f->pushArray(self, elem);
  20069   resetO(elem);
  20070   self->f->pushUndefined(self);
  20071   delElemIndexO(self, 1);
  20072   elem->f->pushS(elem, "a");
  20073   self->f->pushNFreeArray(self, elem);
  20074   r = icIndexOfArrayO(self, value);
  20075   ck_assert_int_eq(r, 2);
  20076   // value not found
  20077   terminateO(value);
  20078   value = allocSmallArray();
  20079   r = icIndexOfArrayO(self, value);
  20080   ck_assert_int_eq(r, -1);
  20081   // non smallArray object
  20082   terminateO(value);
  20083   value = (smallArrayt*) allocSmallInt(2);
  20084   r = icIndexOfArrayO(self, value);
  20085   ck_assert_int_eq(r, -1);
  20086   // not indexOf
  20087   emptyO(self);
  20088   r = icIndexOfArrayO(self, value);
  20089   ck_assert_int_eq(r, -1);
  20090   // NULL value
  20091   r = icIndexOfArrayO(self, NULL);
  20092   ck_assert_int_eq(r, -1);
  20093   terminateO(self);
  20094   terminateO(value);
  20095 
  20096 END_TEST
  20097 
  20098 
  20099 START_TEST(icIndexOfArraycSmallJsonT)
  20100 
  20101   ssize_t r;
  20102   smallJsont *self = allocSmallJson();
  20103   char **value = listCreateS("A","BB");
  20104 
  20105   // indexOf
  20106   char **elem = listCreateS("!!","@@@");
  20107   self->f->pushNFreeArrayc(self, elem);
  20108   self->f->pushUndefined(self);
  20109   delElemIndexO(self, 1);
  20110   self->f->pushNFreeArrayc(self, listCreateS("a","bb"));
  20111   r = icIndexOfArraycO(self, value);
  20112   ck_assert_int_eq(r, 2);
  20113   // not indexOf
  20114   delElemIndexO(self, 2);
  20115   r = icIndexOfArraycO(self, value);
  20116   ck_assert_int_eq(r, -1);
  20117   // NULL value
  20118   r = icIndexOfArraycO(self, NULL);
  20119   ck_assert_int_eq(r, -1);
  20120   terminateO(self);
  20121   listFreeS(value);
  20122 
  20123 END_TEST
  20124 
  20125 
  20126 START_TEST(icIndexOfSmallStringSmallJsonT)
  20127 
  20128   ssize_t r;
  20129   smallJsont *self = allocSmallJson();
  20130   smallStringt *value = allocSmallString("QWE");
  20131 
  20132   // indexOf
  20133   self->f->pushUndefined(self);
  20134   self->f->pushUndefined(self);
  20135   delElemIndexO(self, 1);
  20136   self->f->pushS(self, "qwe");
  20137   r = self->f->icIndexOfSmallString(self, value);
  20138   ck_assert_int_eq(r, 2);
  20139   // not indexOf
  20140   delElemIndexO(self, 2);
  20141   r = self->f->icIndexOfSmallString(self, value);
  20142   ck_assert_int_eq(r, -1);
  20143   // empty string
  20144   freeO(value);
  20145   r = self->f->icIndexOfSmallString(self, value);
  20146   ck_assert_int_eq(r, -1);
  20147   // non smallString object
  20148   terminateO(value);
  20149   value = (smallStringt*) allocSmallInt(2);
  20150   r = self->f->icIndexOfSmallString(self, value);
  20151   ck_assert_int_eq(r, -1);
  20152   // NULL value
  20153   r = self->f->icIndexOfSmallString(self, NULL);
  20154   ck_assert_int_eq(r, -1);
  20155   terminateO(self);
  20156   terminateO(value);
  20157   // json string
  20158   self = allocSmallJson();
  20159   smallStringt *needle = allocSmallString("EE");
  20160   // indexOf string in the middle
  20161   setTopSO(self, "sheepy");
  20162   ck_assert_int_eq(self->f->icIndexOfSmallString(self, needle), 2);
  20163   // indexOf non existing string
  20164   setValO(needle, "$");
  20165   ck_assert_int_eq(self->f->icIndexOfSmallString(self, needle), -1);
  20166   // non smallString object
  20167   terminateO(needle);
  20168   needle = (smallStringt*) allocSmallInt(1);
  20169   ck_assert_int_eq(self->f->icIndexOfSmallString(self, needle), -1);
  20170   terminateO(needle);
  20171   // empty string
  20172   freeO(self);
  20173   setTopSO(self, "");
  20174   needle = allocSmallString("$");
  20175   ck_assert_int_eq(self->f->icIndexOfSmallString(self, needle), -1);
  20176   terminateO(needle);
  20177   terminateO(self);
  20178 
  20179 END_TEST
  20180 
  20181 
  20182 START_TEST(icBinarySearchSmallJsonT)
  20183 
  20184   ssize_t r;
  20185   smallJsont *self = allocSmallJson();
  20186   baset *value = (baset*)allocSmallString("E");
  20187 
  20188   // index not trimmed (an element is NULL)
  20189   self->f->pushS(self, "a");
  20190   self->f->pushS(self, "b");
  20191   self->f->pushS(self, "c");
  20192   delElemIndexO(self, 2);
  20193   self->f->pushS(self, "d");
  20194   self->f->pushS(self, "e");
  20195   self->f->pushS(self, "f");
  20196   r = icBinarySearchO(self, value);
  20197   ck_assert_int_eq(r, -1);
  20198   // index
  20199   trimO(self);
  20200   r = icBinarySearchO(self, value);
  20201   ck_assert_int_eq(r, 3);
  20202   smallStringt *v = (smallStringt*) value;
  20203   // index in the lower half of the array
  20204   setValO(v, "B");
  20205   r = icBinarySearchO(self, value);
  20206   ck_assert_int_eq(r, 1);
  20207   // not index
  20208   setValO(v, "asd");
  20209   r = icBinarySearchO(self, value);
  20210   ck_assert_int_eq(r, -1);
  20211   // NULL value
  20212   r = icBinarySearchO(self, NULL);
  20213   ck_assert_int_eq(r, -1);
  20214   // empty array
  20215   emptyO(self);
  20216   r = icBinarySearchO(self, value);
  20217   ck_assert_int_eq(r, -1);
  20218   terminateO(self);
  20219   terminateO(value);
  20220 
  20221 END_TEST
  20222 
  20223 
  20224 START_TEST(icBinarySearchSSmallJsonT)
  20225 
  20226   ssize_t r;
  20227   smallJsont *self = allocSmallJson();
  20228   const char *value = "E";
  20229 
  20230   // index not trimmed (an element is NULL)
  20231   self->f->pushS(self, "a");
  20232   self->f->pushS(self, "b");
  20233   self->f->pushS(self, "c");
  20234   delElemIndexO(self, 2);
  20235   self->f->pushS(self, "d");
  20236   self->f->pushS(self, "e");
  20237   self->f->pushS(self, "f");
  20238   r = icBinarySearchSO(self, value);
  20239   ck_assert_int_eq(r, -1);
  20240   // index
  20241   trimO(self);
  20242   r = icBinarySearchSO(self, value);
  20243   ck_assert_int_eq(r, 3);
  20244   // index in the lower half of the array
  20245   value = "B";
  20246   r = icBinarySearchSO(self, value);
  20247   ck_assert_int_eq(r, 1);
  20248   // not index
  20249   value = "asd";
  20250   r = icBinarySearchSO(self, value);
  20251   ck_assert_int_eq(r, -1);
  20252   // NULL value
  20253   r = icBinarySearchSO(self, NULL);
  20254   ck_assert_int_eq(r, -1);
  20255   // empty array
  20256   emptyO(self);
  20257   r = icBinarySearchSO(self, value);
  20258   ck_assert_int_eq(r, -1);
  20259   terminateO(self);
  20260 
  20261 END_TEST
  20262 
  20263 
  20264 START_TEST(icBinarySearchCharSmallJsonT)
  20265 
  20266   ssize_t r;
  20267   smallJsont *self = allocSmallJson();
  20268   char value = 'E';
  20269 
  20270   // index not trimmed (an element is NULL)
  20271   self->f->pushS(self, "a");
  20272   self->f->pushS(self, "b");
  20273   self->f->pushS(self, "c");
  20274   delElemIndexO(self, 2);
  20275   self->f->pushS(self, "d");
  20276   self->f->pushS(self, "e");
  20277   self->f->pushS(self, "f");
  20278   r = icBinarySearchCharO(self, value);
  20279   ck_assert_int_eq(r, -1);
  20280   // index
  20281   trimO(self);
  20282   r = icBinarySearchCharO(self, value);
  20283   ck_assert_int_eq(r, 3);
  20284   // index in the lower half of the array
  20285   value = 'B';
  20286   r = icBinarySearchCharO(self, value);
  20287   ck_assert_int_eq(r, 1);
  20288   // not index
  20289   value = '1';
  20290   r = icBinarySearchCharO(self, value);
  20291   ck_assert_int_eq(r, -1);
  20292   // empty array
  20293   emptyO(self);
  20294   r = icBinarySearchCharO(self, value);
  20295   ck_assert_int_eq(r, -1);
  20296   terminateO(self);
  20297 
  20298 END_TEST
  20299 
  20300 
  20301 START_TEST(icBinarySearchDictSmallJsonT)
  20302 
  20303   ssize_t r;
  20304   smallJsont *self = allocSmallJson();
  20305   smallDictt *value = allocSmallDict();
  20306   value->f->setInt(value, "B", 2);
  20307 
  20308   // index not trimmed (an element is NULL)
  20309   createAllocateSmallDict(elem);
  20310   elem->f->setInt(elem, "a", 1);
  20311   self->f->pushUndefined(self);
  20312   self->f->pushDict(self, elem);
  20313   resetO(elem);
  20314   self->f->pushUndefined(self);
  20315   delElemIndexO(self, 2);
  20316   elem->f->setInt(elem, "b", 2);
  20317   self->f->pushNFreeDict(self, elem);
  20318   self->f->pushS(self, "4");
  20319   self->f->pushS(self, "5");
  20320   r = icBinarySearchDictO(self, value);
  20321   ck_assert_int_eq(r, -1);
  20322   // index
  20323   trimO(self);
  20324   r = icBinarySearchDictO(self, value);
  20325   ck_assert_int_eq(r, 2);
  20326   // index in the lower half of the array
  20327   freeO(value);
  20328   value->f->setInt(value, "A", 1);
  20329   r = icBinarySearchDictO(self, value);
  20330   ck_assert_int_eq(r, 1);
  20331   // not index
  20332   freeO(value);
  20333   r = icBinarySearchDictO(self, value);
  20334   ck_assert_int_eq(r, -1);
  20335   // non smallDict object
  20336   terminateO(value);
  20337   value = (smallDictt*) allocSmallInt(2);
  20338   r = icBinarySearchDictO(self, value);
  20339   ck_assert_int_eq(r, -1);
  20340   // NULL value
  20341   r = icBinarySearchDictO(self, NULL);
  20342   ck_assert_int_eq(r, -1);
  20343   // empty array
  20344   emptyO(self);
  20345   r = icBinarySearchDictO(self, value);
  20346   ck_assert_int_eq(r, -1);
  20347   terminateO(self);
  20348   terminateO(value);
  20349 
  20350 END_TEST
  20351 
  20352 
  20353 START_TEST(icBinarySearchArraySmallJsonT)
  20354 
  20355   ssize_t r;
  20356   smallJsont *self  = allocSmallJson();
  20357   smallArrayt *value = allocSmallArray();
  20358   value->f->pushS(value, "B");
  20359 
  20360   // index not trimmed (an element is NULL)
  20361   createAllocateSmallArray(elem);
  20362   elem->f->pushS(elem, "a");
  20363   self->f->pushUndefined(self);
  20364   self->f->pushArray(self, elem);
  20365   resetO(elem);
  20366   self->f->pushUndefined(self);
  20367   delElemIndexO(self, 2);
  20368   elem->f->pushS(elem, "b");
  20369   self->f->pushNFreeArray(self, elem);
  20370   self->f->pushS(self, "4");
  20371   self->f->pushS(self, "5");
  20372   r = icBinarySearchArrayO(self, value);
  20373   ck_assert_int_eq(r, -1);
  20374   // index
  20375   trimO(self);
  20376   r = icBinarySearchArrayO(self, value);
  20377   ck_assert_int_eq(r, 2);
  20378   // index in the lower half of the array
  20379   freeO(value);
  20380   value->f->pushS(value, "A");
  20381   r = icBinarySearchArrayO(self, value);
  20382   ck_assert_int_eq(r, 1);
  20383   // not index
  20384   freeO(value);
  20385   r = icBinarySearchArrayO(self, value);
  20386   ck_assert_int_eq(r, -1);
  20387   // non smallArray object
  20388   terminateO(value);
  20389   value = (smallArrayt*) allocSmallInt(2);
  20390   r = icBinarySearchArrayO(self, value);
  20391   ck_assert_int_eq(r, -1);
  20392   // NULL value
  20393   r = icBinarySearchArrayO(self, NULL);
  20394   ck_assert_int_eq(r, -1);
  20395   // empty array
  20396   emptyO(self);
  20397   r = icBinarySearchArrayO(self, value);
  20398   ck_assert_int_eq(r, -1);
  20399   terminateO(self);
  20400   terminateO(value);
  20401 
  20402 END_TEST
  20403 
  20404 
  20405 START_TEST(icBinarySearchArraycSmallJsonT)
  20406 
  20407   ssize_t r;
  20408   smallJsont *self = allocSmallJson();
  20409   char **value      = listCreateS("B");
  20410 
  20411   // index not trimmed (an element is NULL)
  20412   char **elem = listCreateS("a");
  20413   self->f->pushUndefined(self);
  20414   self->f->pushNFreeArrayc(self, elem);
  20415   self->f->pushUndefined(self);
  20416   delElemIndexO(self, 2);
  20417   elem = listCreateS("b");
  20418   self->f->pushNFreeArrayc(self, elem);
  20419   self->f->pushS(self, "4");
  20420   self->f->pushS(self, "5");
  20421   r = icBinarySearchArraycO(self, value);
  20422   ck_assert_int_eq(r, -1);
  20423   // index
  20424   trimO(self);
  20425   r = icBinarySearchArraycO(self, value);
  20426   ck_assert_int_eq(r, 2);
  20427   // index in the lower half of the array
  20428   free(value[0]);
  20429   value[0] = strdup("A");
  20430   r = icBinarySearchArraycO(self, value);
  20431   ck_assert_int_eq(r, 1);
  20432   // not index
  20433   free(value[0]);
  20434   value[0] = strdup("asd");
  20435   r = icBinarySearchArraycO(self, value);
  20436   ck_assert_int_eq(r, -1);
  20437   // NULL value
  20438   r = icBinarySearchArraycO(self, NULL);
  20439   ck_assert_int_eq(r, -1);
  20440   // empty array
  20441   emptyO(self);
  20442   r = icBinarySearchArraycO(self, value);
  20443   ck_assert_int_eq(r, -1);
  20444   terminateO(self);
  20445   listFreeS(value);
  20446 
  20447 END_TEST
  20448 
  20449 
  20450 START_TEST(icBinarySearchSmallStringSmallJsonT)
  20451 
  20452   ssize_t r;
  20453   smallJsont *self   = allocSmallJson();
  20454   smallStringt *value = allocSmallString("E");
  20455 
  20456   // index not trimmed (an element is NULL)
  20457   self->f->pushS(self, "a");
  20458   self->f->pushS(self, "b");
  20459   self->f->pushS(self, "c");
  20460   delElemIndexO(self, 2);
  20461   self->f->pushS(self, "d");
  20462   self->f->pushS(self, "e");
  20463   self->f->pushS(self, "f");
  20464   r = icBinarySearchSmallStringO(self, value);
  20465   ck_assert_int_eq(r, -1);
  20466   // index
  20467   trimO(self);
  20468   r = icBinarySearchSmallStringO(self, value);
  20469   ck_assert_int_eq(r, 3);
  20470   // index in the lower half of the array
  20471   setValO(value, "B");
  20472   r = icBinarySearchSmallStringO(self, value);
  20473   ck_assert_int_eq(r, 1);
  20474   // not index
  20475   setValO(value, "asd");
  20476   r = icBinarySearchSmallStringO(self, value);
  20477   ck_assert_int_eq(r, -1);
  20478   // empty value
  20479   freeO(value);
  20480   r = icBinarySearchSmallStringO(self, value);
  20481   ck_assert_int_eq(r, -1);
  20482   // non smallString object
  20483   terminateO(value);
  20484   value = (smallStringt*) allocSmallInt(2);
  20485   r = icBinarySearchSmallStringO(self, value);
  20486   ck_assert_int_eq(r, -1);
  20487   // NULL value
  20488   r = icBinarySearchSmallStringO(self, NULL);
  20489   ck_assert_int_eq(r, -1);
  20490   // empty array
  20491   emptyO(self);
  20492   r = icBinarySearchSmallStringO(self, value);
  20493   ck_assert_int_eq(r, -1);
  20494   terminateO(self);
  20495   terminateO(value);
  20496 
  20497 END_TEST
  20498 
  20499 
  20500 START_TEST(keyBySmallJsonT)
  20501 
  20502   char* r;
  20503   smallJsont *self = allocSmallJson();
  20504   baset *value;
  20505 
  20506   smallJsont *r2 = self->f->setInt(self, "1", 1);
  20507   ck_assert_ptr_ne(r2, null);
  20508   value = (baset*) allocSmallInt(1);
  20509   r = keyByO(self, value);
  20510   ck_assert_str_eq(r, "1");
  20511   // non existing object
  20512   smallIntt *i = allocSmallInt(2);
  20513   r = keyByO(self, (baset*)i);
  20514   terminateO(i);
  20515   ck_assert_ptr_eq(r, null);
  20516   // null value
  20517   r = keyByO(self, null);
  20518   ck_assert_ptr_eq(r, null);
  20519   // empty self
  20520   freeO(self);
  20521   r = keyByO(self, value);
  20522   ck_assert_ptr_eq(r, null);
  20523   terminateO(self);
  20524   terminateO(value);
  20525 
  20526 END_TEST
  20527 
  20528 
  20529 START_TEST(keyByUndefinedSmallJsonT)
  20530 
  20531   char* r;
  20532   smallJsont *self = allocSmallJson();
  20533   undefinedt *value;
  20534 
  20535   smallJsont *r2 = self->f->setUndefined(self, "1");
  20536   ck_assert_ptr_ne(r2, null);
  20537   value = allocUndefined();
  20538   r = keyByUndefinedO(self, value);
  20539   ck_assert_str_eq(r, "1");
  20540   // non existing object
  20541   r2 = self->f->setInt(self, "1", 1);
  20542   ck_assert_ptr_ne(r2, null);
  20543   r = keyByUndefinedO(self, value);
  20544   ck_assert_ptr_eq(r, null);
  20545   // non undefined object
  20546   smallIntt *i = allocSmallInt(2);
  20547   r = keyByUndefinedO(self, (undefinedt*)i);
  20548   terminateO(i);
  20549   ck_assert_ptr_eq(r, null);
  20550   // null value
  20551   r = keyByUndefinedO(self, null);
  20552   ck_assert_ptr_eq(r, null);
  20553   // empty self
  20554   freeO(self);
  20555   r = keyByUndefinedO(self, value);
  20556   ck_assert_ptr_eq(r, null);
  20557   terminateO(self);
  20558   terminateO(value);
  20559 
  20560 END_TEST
  20561 
  20562 
  20563 START_TEST(keyByBoolSmallJsonT)
  20564 
  20565   char* r;
  20566   smallJsont *self = allocSmallJson();
  20567 
  20568   smallJsont *r2 = self->f->setBool(self, "1", true);
  20569   ck_assert_ptr_ne(r2, null);
  20570   r = keyByBoolO(self, true);
  20571   ck_assert_str_eq(r, "1");
  20572   // non existing object
  20573   r2 = self->f->setInt(self, "1", 1);
  20574   ck_assert_ptr_ne(r2, null);
  20575   r = keyByBoolO(self, true);
  20576   ck_assert_ptr_eq(r, null);
  20577   // empty self
  20578   freeO(self);
  20579   r = keyByBoolO(self, true);
  20580   ck_assert_ptr_eq(r, null);
  20581   setTypeDictO(self);
  20582   r = keyByBoolO(self, true);
  20583   ck_assert_ptr_eq(r, null);
  20584   terminateO(self);
  20585 
  20586 END_TEST
  20587 
  20588 
  20589 START_TEST(keyByDoubleSmallJsonT)
  20590 
  20591   char* r;
  20592   smallJsont *self = allocSmallJson();
  20593 
  20594   smallJsont *r2 = self->f->setDouble(self, "1", 2.2);
  20595   ck_assert_ptr_ne(r2, null);
  20596   r = keyByDoubleO(self, 2.2);
  20597   ck_assert_str_eq(r, "1");
  20598   // non existing object
  20599   r2 = self->f->setInt(self, "1", 1);
  20600   ck_assert_ptr_ne(r2, null);
  20601   r = keyByDoubleO(self, 2.2);
  20602   ck_assert_ptr_eq(r, null);
  20603   // empty self
  20604   freeO(self);
  20605   r = keyByDoubleO(self, 2.2);
  20606   ck_assert_ptr_eq(r, null);
  20607   setTypeDictO(self);
  20608   r = keyByDoubleO(self, 2.2);
  20609   ck_assert_ptr_eq(r, null);
  20610   terminateO(self);
  20611 
  20612 END_TEST
  20613 
  20614 
  20615 START_TEST(keyByIntSmallJsonT)
  20616 
  20617   char* r;
  20618   smallJsont *self = allocSmallJson();
  20619 
  20620   smallJsont *r2 = self->f->setInt(self, "1", 2);
  20621   ck_assert_ptr_ne(r2, null);
  20622   r = keyByIntO(self, 2);
  20623   ck_assert_str_eq(r, "1");
  20624   // non existing object
  20625   r2 = self->f->setInt(self, "1", 1);
  20626   ck_assert_ptr_ne(r2, null);
  20627   r = keyByIntO(self, 2);
  20628   ck_assert_ptr_eq(r, null);
  20629   // empty self
  20630   freeO(self);
  20631   r = keyByIntO(self, 2);
  20632   ck_assert_ptr_eq(r, null);
  20633   setTypeDictO(self);
  20634   r = keyByIntO(self, 0);
  20635   ck_assert_ptr_eq(r, null);
  20636   terminateO(self);
  20637 
  20638 END_TEST
  20639 
  20640 
  20641 START_TEST(keyBySSmallJsonT)
  20642 
  20643   char* r;
  20644   smallJsont *self = allocSmallJson();
  20645 
  20646   smallJsont *r2 = self->f->setS(self, "1", "qwe");
  20647   ck_assert_ptr_ne(r2, null);
  20648   r = keyBySO(self, "qwe");
  20649   ck_assert_str_eq(r, "1");
  20650   // non existing object
  20651   r2 = self->f->setInt(self, "1", 1);
  20652   ck_assert_ptr_ne(r2, null);
  20653   r = keyBySO(self, "qwe");
  20654   ck_assert_ptr_eq(r, null);
  20655   // null value
  20656   r = keyBySO(self, null);
  20657   ck_assert_ptr_eq(r, null);
  20658   // empty self
  20659   freeO(self);
  20660   r = keyBySO(self, "qwe");
  20661   ck_assert_ptr_eq(r, null);
  20662   setTypeDictO(self);
  20663   r = keyBySO(self, "");
  20664   ck_assert_ptr_eq(r, null);
  20665   terminateO(self);
  20666 
  20667 END_TEST
  20668 
  20669 
  20670 START_TEST(keyByCharSmallJsonT)
  20671 
  20672   char* r;
  20673   smallJsont *self = allocSmallJson();
  20674 
  20675   smallJsont *r2 = self->f->setS(self, "1", "q");
  20676   ck_assert_ptr_ne(r2, null);
  20677   r = keyByCharO(self, 'q');
  20678   ck_assert_str_eq(r, "1");
  20679   // non existing object
  20680   r2 = self->f->setInt(self, "1", 1);
  20681   ck_assert_ptr_ne(r2, null);
  20682   r = keyByCharO(self, 'q');
  20683   ck_assert_ptr_eq(r, null);
  20684   // empty self
  20685   freeO(self);
  20686   r = keyByCharO(self, 'q');
  20687   ck_assert_ptr_eq(r, null);
  20688   setTypeDictO(self);
  20689   r = keyByCharO(self, 'a');
  20690   ck_assert_ptr_eq(r, null);
  20691   terminateO(self);
  20692 
  20693 END_TEST
  20694 
  20695 
  20696 START_TEST(keyByDictSmallJsonT)
  20697 
  20698   char* r;
  20699   smallJsont *self = allocSmallJson();
  20700   smallDictt *dict = allocSmallDict();
  20701 
  20702   createAllocateSmallDict(d);
  20703   d->f->setS(d, "another", "dict");
  20704   smallJsont *r2 = self->f->setNFreeDict(self, "d", d);
  20705   ck_assert_ptr_ne(r2, null);
  20706   r2 = self->f->setNFreeDict(self, "1", dict);
  20707   ck_assert_ptr_ne(r2, null);
  20708   dict = allocSmallDict();
  20709   r = keyByDictO(self, dict);
  20710   ck_assert_str_eq(r, "1");
  20711   // non existing object
  20712   r2 = self->f->setInt(self, "1", 1);
  20713   ck_assert_ptr_ne(r2, null);
  20714   r = keyByDictO(self, dict);
  20715   ck_assert_ptr_eq(r, null);
  20716   // non smallDict object
  20717   smallIntt *i = allocSmallInt(2);
  20718   r = keyByDictO(self, (smallDictt*)i);
  20719   terminateO(i);
  20720   ck_assert_ptr_eq(r, null);
  20721   // null value
  20722   r = keyByDictO(self, null);
  20723   ck_assert_ptr_eq(r, null);
  20724   // empty self
  20725   freeO(self);
  20726   r = keyByDictO(self, dict);
  20727   ck_assert_ptr_eq(r, null);
  20728   setTypeDictO(self);
  20729   r = keyByDictO(self, dict);
  20730   ck_assert_ptr_eq(r, null);
  20731   terminateO(self);
  20732   terminateO(dict);
  20733 
  20734 END_TEST
  20735 
  20736 
  20737 START_TEST(keyByArraySmallJsonT)
  20738 
  20739   char* r;
  20740   smallJsont *self   = allocSmallJson();
  20741   smallArrayt *array = allocSmallArray();
  20742 
  20743   createAllocateSmallArray(d);
  20744   d->f->pushS(d, "another array");
  20745   smallJsont *r2 = self->f->setNFreeArray(self, "d", d);
  20746   ck_assert_ptr_ne(r2, null);
  20747   r2 = self->f->setNFreeArray(self, "1", array);
  20748   ck_assert_ptr_ne(r2, null);
  20749   array = allocSmallArray();
  20750   r = keyByArrayO(self, array);
  20751   ck_assert_str_eq(r, "1");
  20752   // non existing object
  20753   r2 = self->f->setInt(self, "1", 1);
  20754   ck_assert_ptr_ne(r2, null);
  20755   r = keyByArrayO(self, array);
  20756   ck_assert_ptr_eq(r, null);
  20757   // non smallArray object
  20758   smallIntt *i = allocSmallInt(2);
  20759   r = keyByArrayO(self, (smallArrayt*)i);
  20760   terminateO(i);
  20761   ck_assert_ptr_eq(r, null);
  20762   // null value
  20763   r = keyByArrayO(self, null);
  20764   ck_assert_ptr_eq(r, null);
  20765   // empty self
  20766   freeO(self);
  20767   r = keyByArrayO(self, array);
  20768   ck_assert_ptr_eq(r, null);
  20769   setTypeDictO(self);
  20770   r = keyByArrayO(self, array);
  20771   ck_assert_ptr_eq(r, null);
  20772   terminateO(self);
  20773   terminateO(array);
  20774 
  20775 END_TEST
  20776 
  20777 
  20778 START_TEST(keyByArraycSmallJsonT)
  20779 
  20780   char* r;
  20781   smallJsont *self = allocSmallJson();
  20782   char **array     = listCreateS("a","b");
  20783 
  20784   char **d = listCreateS("asd", "zxcv");
  20785   smallJsont *r2 = self->f->setNFreeArrayc(self, "d", d);
  20786   ck_assert_ptr_ne(r2, null);
  20787   r2 = self->f->setArrayc(self, "1", array);
  20788   ck_assert_ptr_ne(r2, null);
  20789   r = keyByArraycO(self, array);
  20790   ck_assert_ptr_ne(r, NULL);
  20791   ck_assert_str_eq(r, "1");
  20792   // non existing object
  20793   r2 = self->f->setInt(self, "1", 1);
  20794   ck_assert_ptr_ne(r2, null);
  20795   r = keyByArraycO(self, array);
  20796   ck_assert_ptr_eq(r, null);
  20797   // null value
  20798   r = keyByArraycO(self, null);
  20799   ck_assert_ptr_eq(r, null);
  20800   // empty self
  20801   freeO(self);
  20802   r = keyByArraycO(self, array);
  20803   ck_assert_ptr_eq(r, null);
  20804   setTypeDictO(self);
  20805   r = keyByArraycO(self, array);
  20806   ck_assert_ptr_eq(r, null);
  20807   terminateO(self);
  20808   listFreeS(array);
  20809 
  20810 END_TEST
  20811 
  20812 
  20813 START_TEST(keyBySmallBoolSmallJsonT)
  20814 
  20815   char* r;
  20816   smallJsont *self  = allocSmallJson();
  20817   smallBoolt *value = allocSmallBool(true);
  20818 
  20819   createAllocateSmallBool(d);
  20820   setValO(d, false);
  20821   smallJsont *r2 = self->f->setNFreeSmallBool(self, "d", d);
  20822   ck_assert_ptr_ne(r2, null);
  20823   r2 = self->f->setNFreeSmallBool(self, "1", value);
  20824   ck_assert_ptr_ne(r2, null);
  20825   value = allocSmallBool(true);
  20826   r = keyBySmallBoolO(self, value);
  20827   ck_assert_str_eq(r, "1");
  20828   // non existing object
  20829   r2 = self->f->setInt(self, "1", 1);
  20830   ck_assert_ptr_ne(r2, null);
  20831   r = keyBySmallBoolO(self, value);
  20832   ck_assert_ptr_eq(r, null);
  20833   // non smallBool object
  20834   smallIntt *i = allocSmallInt(2);
  20835   r = keyBySmallBoolO(self, (smallBoolt*)i);
  20836   terminateO(i);
  20837   ck_assert_ptr_eq(r, null);
  20838   // null value
  20839   r = keyBySmallBoolO(self, null);
  20840   ck_assert_ptr_eq(r, null);
  20841   // empty self
  20842   freeO(self);
  20843   r = keyBySmallBoolO(self, value);
  20844   ck_assert_ptr_eq(r, null);
  20845   setTypeDictO(self);
  20846   r = keyBySmallBoolO(self, value);
  20847   ck_assert_ptr_eq(r, null);
  20848   terminateO(self);
  20849   terminateO(value);
  20850 
  20851 END_TEST
  20852 
  20853 
  20854 START_TEST(keyBySmallBytesSmallJsonT)
  20855 
  20856   char* r;
  20857   smallJsont *self   = allocSmallJson();
  20858   smallBytest *value = allocSmallBytes("qwe", sizeof("qwe"));
  20859 
  20860   smallBytest *d = allocSmallBytes("asd", sizeof("asd"));
  20861   smallJsont *r2 = self->f->setNFreeSmallBytes(self, "d", d);
  20862   ck_assert_ptr_ne(r2, null);
  20863   r2 = self->f->setNFreeSmallBytes(self, "1", value);
  20864   ck_assert_ptr_ne(r2, null);
  20865   value = allocSmallBytes("qwe", sizeof("qwe"));
  20866   r = keyBySmallBytesO(self, value);
  20867   ck_assert_str_eq(r, "1");
  20868   // non existing object
  20869   r2 = self->f->setInt(self, "1", 1);
  20870   ck_assert_ptr_ne(r2, null);
  20871   r = keyBySmallBytesO(self, value);
  20872   ck_assert_ptr_eq(r, null);
  20873   // empty value
  20874   freeO(value);
  20875   r = keyBySmallBytesO(self, value);
  20876   ck_assert_ptr_eq(r, null);
  20877   // non smallBytes object
  20878   smallIntt *i = allocSmallInt(2);
  20879   r = keyBySmallBytesO(self, (smallBytest*)i);
  20880   terminateO(i);
  20881   ck_assert_ptr_eq(r, null);
  20882   // null value
  20883   r = keyBySmallBytesO(self, null);
  20884   ck_assert_ptr_eq(r, null);
  20885   // empty self
  20886   freeO(self);
  20887   r = keyBySmallBytesO(self, value);
  20888   ck_assert_ptr_eq(r, null);
  20889   setTypeDictO(self);
  20890   r = keyBySmallBytesO(self, value);
  20891   ck_assert_ptr_eq(r, null);
  20892   terminateO(self);
  20893   terminateO(value);
  20894 
  20895 END_TEST
  20896 
  20897 
  20898 START_TEST(keyBySmallDoubleSmallJsonT)
  20899 
  20900   char* r;
  20901   smallJsont *self    = allocSmallJson();
  20902   smallDoublet *value = allocSmallDouble(2.2);
  20903 
  20904   createAllocateSmallDouble(d);
  20905   smallJsont *r2 = self->f->setNFreeSmallDouble(self, "d", d);
  20906   ck_assert_ptr_ne(r2, null);
  20907   r2 = self->f->setNFreeSmallDouble(self, "1", value);
  20908   ck_assert_ptr_ne(r2, null);
  20909   value = allocSmallDouble(2.2);
  20910   r = keyBySmallDoubleO(self, value);
  20911   ck_assert_str_eq(r, "1");
  20912   // non existing object
  20913   r2 = self->f->setInt(self, "1", 1);
  20914   ck_assert_ptr_ne(r2, null);
  20915   r = keyBySmallDoubleO(self, value);
  20916   ck_assert_ptr_eq(r, null);
  20917   // non smallDouble object
  20918   smallIntt *i = allocSmallInt(2);
  20919   r = keyBySmallDoubleO(self, (smallDoublet*)i);
  20920   terminateO(i);
  20921   ck_assert_ptr_eq(r, null);
  20922   // null value
  20923   r = keyBySmallDoubleO(self, null);
  20924   ck_assert_ptr_eq(r, null);
  20925   // empty self
  20926   freeO(self);
  20927   r = keyBySmallDoubleO(self, value);
  20928   ck_assert_ptr_eq(r, null);
  20929   setTypeDictO(self);
  20930   r = keyBySmallDoubleO(self, value);
  20931   ck_assert_ptr_eq(r, null);
  20932   terminateO(self);
  20933   terminateO(value);
  20934 
  20935 END_TEST
  20936 
  20937 
  20938 START_TEST(keyBySmallIntSmallJsonT)
  20939 
  20940   char* r;
  20941   smallJsont *self = allocSmallJson();
  20942   smallIntt *value = allocSmallInt(2);
  20943 
  20944   createAllocateSmallInt(d);
  20945   smallJsont *r2 = self->f->setNFreeSmallInt(self, "d", d);
  20946   ck_assert_ptr_ne(r2, null);
  20947   r2 = self->f->setNFreeSmallInt(self, "1", value);
  20948   ck_assert_ptr_ne(r2, null);
  20949   value = allocSmallInt(2);
  20950   r = keyBySmallIntO(self, value);
  20951   ck_assert_str_eq(r, "1");
  20952   // non existing object
  20953   r2 = self->f->setInt(self, "1", 1);
  20954   ck_assert_ptr_ne(r2, null);
  20955   r = keyBySmallIntO(self, value);
  20956   ck_assert_ptr_eq(r, null);
  20957   // non smallInt object
  20958   smallBoolt *i = allocSmallBool(false);
  20959   r = keyBySmallIntO(self, (smallIntt*)i);
  20960   terminateO(i);
  20961   ck_assert_ptr_eq(r, null);
  20962   // null value
  20963   r = keyBySmallIntO(self, null);
  20964   ck_assert_ptr_eq(r, null);
  20965   // empty self
  20966   freeO(self);
  20967   r = keyBySmallIntO(self, value);
  20968   ck_assert_ptr_eq(r, null);
  20969   setTypeDictO(self);
  20970   r = keyBySmallIntO(self, value);
  20971   ck_assert_ptr_eq(r, null);
  20972   terminateO(self);
  20973   terminateO(value);
  20974 
  20975 END_TEST
  20976 
  20977 
  20978 START_TEST(keyBySmallJsonSmallJsonT)
  20979 
  20980   char* r;
  20981   smallJsont *self  = allocSmallJson();
  20982   smallJsont *value = allocSmallJson();
  20983 
  20984   // undefined
  20985   createUndefined(u);
  20986   setTopO(value, (baset*)&u);
  20987   self->f->setUndefined(self, "1");
  20988   r = self->f->keyBySmallJson(self, value);
  20989   ck_assert_str_eq(r, "1");
  20990   freeO(value);
  20991   // bool
  20992   setTopBoolO(value, true);
  20993   self->f->setBool(self, "b", true);
  20994   r = self->f->keyBySmallJson(self, value);
  20995   ck_assert_str_eq(r, "b");
  20996   freeO(value);
  20997   // double
  20998   setTopDoubleO(value, 2.2);
  20999   self->f->setDouble(self, "db", 2.2);
  21000   r = self->f->keyBySmallJson(self, value);
  21001   ck_assert_str_eq(r, "db");
  21002   freeO(value);
  21003   // int
  21004   setTopIntO(value, 2);
  21005   self->f->setInt(self, "i", 2);
  21006   r = self->f->keyBySmallJson(self, value);
  21007   ck_assert_str_eq(r, "i");
  21008   freeO(value);
  21009   // string
  21010   setTopSO(value, "qwe");
  21011   self->f->setS(self, "s", "qwe");
  21012   r = self->f->keyBySmallJson(self, value);
  21013   ck_assert_str_eq(r, "s");
  21014   freeO(value);
  21015   // dict
  21016   smallDictt *D = allocSmallDict();
  21017   setTopNFreeDictO(value, D);
  21018   self->f->setNFreeDict(self, "d", allocSmallDict());
  21019   r = self->f->keyBySmallJson(self, value);
  21020   ck_assert_str_eq(r, "d");
  21021   freeO(value);
  21022   // array
  21023   smallArrayt *a = allocSmallArray();
  21024   setTopNFreeArrayO(value, a);
  21025   self->f->setNFreeArray(self, "a", allocSmallArray());
  21026   r = self->f->keyBySmallJson(self, value);
  21027   ck_assert_str_eq(r, "a");
  21028   freeO(value);
  21029   // empty value
  21030   r = self->f->keyBySmallJson(self, value);
  21031   ck_assert_ptr_eq(r, null);
  21032   // non smallJson object
  21033   smallIntt *i = allocSmallInt(2);
  21034   r = self->f->keyBySmallJson(self, (smallJsont*)i);
  21035   terminateO(i);
  21036   ck_assert_ptr_eq(r, null);
  21037   // null value
  21038   r = self->f->keyBySmallJson(self, null);
  21039   ck_assert_ptr_eq(r, null);
  21040   // empty self
  21041   freeO(self);
  21042   r = self->f->keyBySmallJson(self, value);
  21043   ck_assert_ptr_eq(r, null);
  21044   setTypeDictO(self);
  21045   r = self->f->keyBySmallJson(self, value);
  21046   ck_assert_ptr_eq(r, null);
  21047   terminateO(self);
  21048   terminateO(value);
  21049 
  21050 END_TEST
  21051 
  21052 
  21053 START_TEST(keyBySmallStringSmallJsonT)
  21054 
  21055   char* r;
  21056   smallJsont *self    = allocSmallJson();
  21057   smallStringt *value = allocSmallString("qwe");
  21058 
  21059   createAllocateSmallString(d);
  21060   smallJsont *r2 = self->f->setNFreeSmallString(self, "d", d);
  21061   ck_assert_ptr_ne(r2, null);
  21062   r2 = self->f->setNFreeSmallString(self, "1", value);
  21063   ck_assert_ptr_ne(r2, null);
  21064   value = allocSmallString("qwe");
  21065   r = keyBySmallStringO(self, value);
  21066   ck_assert_str_eq(r, "1");
  21067   // non existing object
  21068   r2 = self->f->setInt(self, "1", 1);
  21069   ck_assert_ptr_ne(r2, null);
  21070   r = keyBySmallStringO(self, value);
  21071   ck_assert_ptr_eq(r, null);
  21072   // empty value
  21073   freeO(value);
  21074   r = keyBySmallStringO(self, value);
  21075   ck_assert_ptr_eq(r, null);
  21076   // non smallString object
  21077   smallIntt *i = allocSmallInt(2);
  21078   r = keyBySmallStringO(self, (smallStringt*)i);
  21079   terminateO(i);
  21080   ck_assert_ptr_eq(r, null);
  21081   // null value
  21082   r = keyBySmallStringO(self, null);
  21083   ck_assert_ptr_eq(r, null);
  21084   // empty self
  21085   freeO(self);
  21086   r = keyBySmallStringO(self, value);
  21087   ck_assert_ptr_eq(r, null);
  21088   setTypeDictO(self);
  21089   r = keyBySmallStringO(self, value);
  21090   ck_assert_ptr_eq(r, null);
  21091   terminateO(self);
  21092   terminateO(value);
  21093 
  21094 END_TEST
  21095 
  21096 
  21097 START_TEST(keyBySmallContainerSmallJsonT)
  21098 
  21099   char* r;
  21100   smallJsont *self       = allocSmallJson();
  21101   smallContainert *value = allocSmallContainer(null);
  21102 
  21103   createAllocateSmallString(d);
  21104   smallJsont *r2 = self->f->setNFreeSmallString(self, "d", d);
  21105   ck_assert_ptr_ne(r2, null);
  21106   r = keyBySmallContainerO(self, value);
  21107   ck_assert_ptr_eq(r, null);
  21108   // non smallContainer object
  21109   smallIntt *i = allocSmallInt(2);
  21110   r = keyBySmallContainerO(self, (smallContainert*)i);
  21111   terminateO(i);
  21112   ck_assert_ptr_eq(r, null);
  21113   // null value
  21114   r = keyBySmallContainerO(self, null);
  21115   ck_assert_ptr_eq(r, null);
  21116   // empty self
  21117   freeO(self);
  21118   r = keyBySmallContainerO(self, value);
  21119   ck_assert_ptr_eq(r, null);
  21120   setTypeDictO(self);
  21121   r = keyBySmallContainerO(self, value);
  21122   ck_assert_ptr_eq(r, null);
  21123   terminateO(self);
  21124   terminateO(value);
  21125 
  21126 END_TEST
  21127 
  21128 
  21129 START_TEST(icKeyBySmallJsonT)
  21130 
  21131   char* r;
  21132   smallJsont *self = allocSmallJson();
  21133   baset *value;
  21134 
  21135   smallJsont *r2 = self->f->setS(self, "1", "QQ");
  21136   ck_assert_ptr_ne(r2, null);
  21137   value = (baset*) allocSmallString("qq");
  21138   r = icKeyByO(self, value);
  21139   ck_assert_str_eq(r, "1");
  21140   // non existing object
  21141   smallIntt *i = allocSmallInt(2);
  21142   r = icKeyByO(self, (baset*)i);
  21143   terminateO(i);
  21144   ck_assert_ptr_eq(r, null);
  21145   // null value
  21146   r = icKeyByO(self, null);
  21147   ck_assert_ptr_eq(r, null);
  21148   // empty self
  21149   freeO(self);
  21150   r = icKeyByO(self, value);
  21151   ck_assert_ptr_eq(r, null);
  21152   terminateO(self);
  21153   terminateO(value);
  21154 
  21155 END_TEST
  21156 
  21157 
  21158 START_TEST(icKeyBySSmallJsonT)
  21159 
  21160   char* r;
  21161   smallJsont *self = allocSmallJson();
  21162 
  21163   smallJsont *r2 = self->f->setS(self, "1", "qwe");
  21164   ck_assert_ptr_ne(r2, null);
  21165   r = icKeyBySO(self, "QWE");
  21166   ck_assert_str_eq(r, "1");
  21167   // non existing object
  21168   r2 = self->f->setInt(self, "1", 1);
  21169   ck_assert_ptr_ne(r2, null);
  21170   r = icKeyBySO(self, "qwe");
  21171   ck_assert_ptr_eq(r, null);
  21172   // null value
  21173   r = icKeyBySO(self, null);
  21174   ck_assert_ptr_eq(r, null);
  21175   // empty self
  21176   freeO(self);
  21177   r = icKeyBySO(self, "qwe");
  21178   ck_assert_ptr_eq(r, null);
  21179   terminateO(self);
  21180 
  21181 END_TEST
  21182 
  21183 
  21184 START_TEST(icKeyByCharSmallJsonT)
  21185 
  21186   char* r;
  21187   smallJsont *self = allocSmallJson();
  21188 
  21189   smallJsont *r2 = self->f->setS(self, "1", "q");
  21190   ck_assert_ptr_ne(r2, null);
  21191   r = icKeyByCharO(self, 'Q');
  21192   ck_assert_str_eq(r, "1");
  21193   // non existing object
  21194   r2 = self->f->setInt(self, "1", 1);
  21195   ck_assert_ptr_ne(r2, null);
  21196   r = icKeyByCharO(self, 'q');
  21197   ck_assert_ptr_eq(r, null);
  21198   // empty self
  21199   freeO(self);
  21200   r = icKeyByCharO(self, 'q');
  21201   ck_assert_ptr_eq(r, null);
  21202   terminateO(self);
  21203 
  21204 END_TEST
  21205 
  21206 
  21207 START_TEST(icKeyByDictSmallJsonT)
  21208 
  21209   char* r;
  21210   smallJsont *self = allocSmallJson();
  21211   smallDictt *dict = allocSmallDict();
  21212 
  21213   createAllocateSmallDict(d);
  21214   d->f->setS(d, "another", "dict");
  21215   smallJsont *r2 = self->f->setNFreeDict(self, "d", d);
  21216   ck_assert_ptr_ne(r2, null);
  21217   dict->f->setS(dict, "asd", "asd");
  21218   r2 = self->f->setNFreeDict(self, "1", dict);
  21219   ck_assert_ptr_ne(r2, null);
  21220   dict = allocSmallDict();
  21221   dict->f->setS(dict, "ASD", "asd");
  21222   r = icKeyByDictO(self, dict);
  21223   ck_assert_str_eq(r, "1");
  21224   // non existing object
  21225   r2 = self->f->setInt(self, "1", 1);
  21226   ck_assert_ptr_ne(r2, null);
  21227   r = icKeyByDictO(self, dict);
  21228   ck_assert_ptr_eq(r, null);
  21229   // non smallDict object
  21230   smallIntt *i = allocSmallInt(2);
  21231   r = icKeyByDictO(self, (smallDictt*)i);
  21232   terminateO(i);
  21233   ck_assert_ptr_eq(r, null);
  21234   // null value
  21235   r = icKeyByDictO(self, null);
  21236   ck_assert_ptr_eq(r, null);
  21237   // empty self
  21238   freeO(self);
  21239   r = icKeyByDictO(self, dict);
  21240   ck_assert_ptr_eq(r, null);
  21241   terminateO(self);
  21242   terminateO(dict);
  21243 
  21244 END_TEST
  21245 
  21246 
  21247 START_TEST(icKeyByArraySmallJsonT)
  21248 
  21249   char* r;
  21250   smallJsont *self   = allocSmallJson();
  21251   smallArrayt *array = allocSmallArray();
  21252 
  21253   createAllocateSmallArray(d);
  21254   d->f->pushS(d, "another array");
  21255   smallJsont *r2 = self->f->setNFreeArray(self, "d", d);
  21256   ck_assert_ptr_ne(r2, null);
  21257   array->f->pushS(array, "the array");
  21258   r2 = self->f->setNFreeArray(self, "1", array);
  21259   ck_assert_ptr_ne(r2, null);
  21260   array = allocSmallArray();
  21261   array->f->pushS(array, "The array");
  21262   r = icKeyByArrayO(self, array);
  21263   ck_assert_str_eq(r, "1");
  21264   // non existing object
  21265   r2 = self->f->setInt(self, "1", 1);
  21266   ck_assert_ptr_ne(r2, null);
  21267   r = icKeyByArrayO(self, array);
  21268   ck_assert_ptr_eq(r, null);
  21269   // non smallArray object
  21270   smallIntt *i = allocSmallInt(2);
  21271   r = icKeyByArrayO(self, (smallArrayt*)i);
  21272   terminateO(i);
  21273   ck_assert_ptr_eq(r, null);
  21274   // null value
  21275   r = icKeyByArrayO(self, null);
  21276   ck_assert_ptr_eq(r, null);
  21277   // empty self
  21278   freeO(self);
  21279   r = icKeyByArrayO(self, array);
  21280   ck_assert_ptr_eq(r, null);
  21281   terminateO(self);
  21282   terminateO(array);
  21283 
  21284 END_TEST
  21285 
  21286 
  21287 START_TEST(icKeyByArraycSmallJsonT)
  21288 
  21289   char* r;
  21290   smallJsont *self = allocSmallJson();
  21291   char **array     = listCreateS("a","b");
  21292 
  21293   char **d = listCreateS("asd", "zxcv");
  21294   smallJsont *r2 = self->f->setNFreeArrayc(self, "d", d);
  21295   ck_assert_ptr_ne(r2, null);
  21296   r2 = self->f->setArrayc(self, "1", array);
  21297   ck_assert_ptr_ne(r2, null);
  21298   iUpperS(&array[0]);
  21299   r = icKeyByArraycO(self, array);
  21300   ck_assert_ptr_ne(r, NULL);
  21301   ck_assert_str_eq(r, "1");
  21302   // non existing object
  21303   r2 = self->f->setInt(self, "1", 1);
  21304   ck_assert_ptr_ne(r2, null);
  21305   r = icKeyByArraycO(self, array);
  21306   ck_assert_ptr_eq(r, null);
  21307   // null value
  21308   r = icKeyByArraycO(self, null);
  21309   ck_assert_ptr_eq(r, null);
  21310   // empty self
  21311   freeO(self);
  21312   r = icKeyByArraycO(self, array);
  21313   ck_assert_ptr_eq(r, null);
  21314   terminateO(self);
  21315   listFreeS(array);
  21316 
  21317 END_TEST
  21318 
  21319 
  21320 START_TEST(icKeyBySmallStringSmallJsonT)
  21321 
  21322   char* r;
  21323   smallJsont *self    = allocSmallJson();
  21324   smallStringt *value = allocSmallString("qwe");
  21325 
  21326   createAllocateSmallString(d);
  21327   smallJsont *r2 = self->f->setNFreeSmallString(self, "d", d);
  21328   ck_assert_ptr_ne(r2, null);
  21329   r2 = self->f->setNFreeSmallString(self, "1", value);
  21330   ck_assert_ptr_ne(r2, null);
  21331   value = allocSmallString("QWE");
  21332   r = icKeyBySmallStringO(self, value);
  21333   ck_assert_str_eq(r, "1");
  21334   // non existing object
  21335   r2 = self->f->setInt(self, "1", 1);
  21336   ck_assert_ptr_ne(r2, null);
  21337   r = icKeyBySmallStringO(self, value);
  21338   ck_assert_ptr_eq(r, null);
  21339   // empty value
  21340   freeO(value);
  21341   r = icKeyBySmallStringO(self, value);
  21342   ck_assert_ptr_eq(r, null);
  21343   // non smallString object
  21344   smallIntt *i = allocSmallInt(2);
  21345   r = icKeyBySmallStringO(self, (smallStringt*)i);
  21346   terminateO(i);
  21347   ck_assert_ptr_eq(r, null);
  21348   // null value
  21349   r = icKeyBySmallStringO(self, null);
  21350   ck_assert_ptr_eq(r, null);
  21351   // empty self
  21352   freeO(self);
  21353   r = icKeyBySmallStringO(self, value);
  21354   ck_assert_ptr_eq(r, null);
  21355   setTypeDictO(self);
  21356   r = icKeyBySmallStringO(self, value);
  21357   ck_assert_ptr_eq(r, null);
  21358   terminateO(self);
  21359   terminateO(value);
  21360 
  21361 END_TEST
  21362 
  21363 
  21364 START_TEST(replaceSmallJsonT)
  21365 
  21366   smallJsont* r;
  21367   smallJsont *self = allocSmallJson();
  21368   setTopSO(self, "#ee#ee#ad");
  21369 
  21370   // replace string, multiple character new delimeter
  21371   r = replaceO(self, "#","^^", 0);
  21372   ck_assert_ptr_ne(r, null);
  21373   char *s = toStringO(r);
  21374   ck_assert_str_eq(s, "^^ee^^ee^^ad");
  21375   free(s);
  21376   // replace string, multiple character old delimeter
  21377   freeO(self);
  21378   setTopSO(self, "AA##ee##ee#");
  21379   r = replaceO(self, "##","|", 0);
  21380   ck_assert_ptr_ne(r, null);
  21381   s = toStringO(r);
  21382   ck_assert_str_eq(s, "AA|ee|ee#");
  21383   free(s);
  21384   // replace one time at the start of string
  21385   freeO(self);
  21386   setTopSO(self, "#ee#ee#ad");
  21387   r = replaceO(self, "#","^^",1);
  21388   ck_assert_ptr_ne(r, null);
  21389   s = toStringO(r);
  21390   ck_assert_str_eq(s, "^^ee#ee#ad");
  21391   free(s);
  21392   // replace one time
  21393   freeO(self);
  21394   setTopSO(self, "AA##ee##ee#");
  21395   r = replaceO(self, "##","|",1);
  21396   ck_assert_ptr_ne(r, null);
  21397   s = toStringO(r);
  21398   ck_assert_str_eq(s, "AA|ee##ee#");
  21399   free(s);
  21400   // NULL new delimiter, one time: same as empty delimiter
  21401   freeO(self);
  21402   setTopSO(self, "AA##ee##ee#");
  21403   r = replaceO(self, "##",NULL,1);
  21404   ck_assert_ptr_ne(r, null);
  21405   s = toStringO(r);
  21406   ck_assert_str_eq(s, "AAee##ee#");
  21407   free(s);
  21408   // empty string
  21409   freeO(self);
  21410   setTopSO(self, "");
  21411   r = replaceO(self, "##",NULL,1);
  21412   ck_assert_ptr_ne(r, null);
  21413   s = toStringO(r);
  21414   ck_assert_str_eq(s, "");
  21415   free(s);
  21416   // empty old delimiter
  21417   freeO(self);
  21418   setTopSO(self, "qwe");
  21419   ck_assert_ptr_eq(replaceO(self, "","|",1), NULL);
  21420   // NULL old delimiter
  21421   ck_assert_ptr_eq(replaceO(self, NULL,"|",1), NULL);
  21422   // empty old delimiter
  21423   ck_assert_ptr_eq(replaceO(self, "","|",1), NULL);
  21424   // NULL string
  21425   freeO(self);
  21426   ck_assert_ptr_eq(replaceO(self, "##","|",1), NULL);
  21427   terminateO(self);
  21428 
  21429 END_TEST
  21430 
  21431 
  21432 START_TEST(replaceCharSSmallJsonT)
  21433 
  21434   smallJsont* r;
  21435   smallJsont *self = allocSmallJson();
  21436   setTopSO(self, "");
  21437 
  21438   // replace string, multiple character new delimeter
  21439   freeO(self);
  21440   setTopSO(self, "#ee#ee#ad");
  21441   r = replaceCharSO(self, '#',"^^", 0);
  21442   ck_assert_ptr_ne(r, null);
  21443   char *s = toStringO(r);
  21444   ck_assert_str_eq(s, "^^ee^^ee^^ad");
  21445   free(s);
  21446   // replace one time at the start of string
  21447   freeO(self);
  21448   setTopSO(self, "#ee#ee#ad");
  21449   r = replaceCharSO(self, '#',"^^",1);
  21450   ck_assert_ptr_ne(r, null);
  21451   s = toStringO(r);
  21452   ck_assert_str_eq(s, "^^ee#ee#ad");
  21453   free(s);
  21454   // replace one time
  21455   freeO(self);
  21456   setTopSO(self, "AA##ee##ee#");
  21457   r = replaceCharSO(self, '#',"|",1);
  21458   ck_assert_ptr_ne(r, null);
  21459   s = toStringO(r);
  21460   ck_assert_str_eq(s, "AA|#ee##ee#");
  21461   free(s);
  21462   // NULL new delimiter, one time: same as empty delimiter
  21463   freeO(self);
  21464   setTopSO(self, "AA#ee##ee#");
  21465   r = replaceCharSO(self, '#',NULL,1);
  21466   ck_assert_ptr_ne(r, null);
  21467   s = toStringO(r);
  21468   ck_assert_str_eq(s, "AAee##ee#");
  21469   free(s);
  21470   // empty string
  21471   freeO(self);
  21472   setTopSO(self, "");
  21473   r = replaceCharSO(self, '#',NULL,1);
  21474   ck_assert_ptr_ne(r, null);
  21475   s = toStringO(r);
  21476   ck_assert_str_eq(s, "");
  21477   free(s);
  21478   // empty old delimiter
  21479   freeO(self);
  21480   setTopSO(self, "qwe");
  21481   ck_assert_ptr_eq(replaceCharSO(self, 0,"|",1), NULL);
  21482   // NULL string
  21483   freeO(self);
  21484   ck_assert_ptr_eq(replaceCharSO(self, '#',"|",1), NULL);
  21485   terminateO(self);
  21486 
  21487 END_TEST
  21488 
  21489 
  21490 START_TEST(replaceSCharSmallJsonT)
  21491 
  21492   smallJsont* r;
  21493   smallJsont *self = allocSmallJson();
  21494   setTopSO(self, "");
  21495 
  21496   // replace string, multiple character new delimeter
  21497   freeO(self);
  21498   setTopSO(self, "#ee#ee#ad");
  21499   r = replaceSCharO(self, "#",'^',0);
  21500   ck_assert_ptr_ne(r, null);
  21501   char *s = toStringO(r);
  21502   ck_assert_str_eq(s, "^ee^ee^ad");
  21503   free(s);
  21504   // replace string, multiple character old delimeter
  21505   freeO(self);
  21506   setTopSO(self, "AA##ee##ee#");
  21507   r = replaceSCharO(self, "##",'|',0);
  21508   ck_assert_ptr_ne(r, null);
  21509   s = toStringO(r);
  21510   ck_assert_str_eq(s, "AA|ee|ee#");
  21511   free(s);
  21512   // replace string empty char, multiple character old delimeter
  21513   freeO(self);
  21514   setTopSO(self, "AA##ee##ee#");
  21515   r = replaceSCharO(self, "##", 0,0);
  21516   ck_assert_ptr_ne(r, null);
  21517   s = toStringO(r);
  21518   ck_assert_str_eq(s, "AAeeee#");
  21519   free(s);
  21520   // replace one time at the start of string
  21521   freeO(self);
  21522   setTopSO(self, "#ee#ee#ad");
  21523   r = replaceSCharO(self, "#",'^',1);
  21524   ck_assert_ptr_ne(r, null);
  21525   s = toStringO(r);
  21526   ck_assert_str_eq(s, "^ee#ee#ad");
  21527   free(s);
  21528   // replace one time
  21529   freeO(self);
  21530   setTopSO(self, "AA##ee##ee#");
  21531   r = replaceSCharO(self, "##",'|',1);
  21532   ck_assert_ptr_ne(r, null);
  21533   s = toStringO(r);
  21534   ck_assert_str_eq(s, "AA|ee##ee#");
  21535   free(s);
  21536   // empty string
  21537   freeO(self);
  21538   setTopSO(self, "");
  21539   r = replaceSCharO(self, "##",0,1);
  21540   ck_assert_ptr_ne(r, null);
  21541   s = toStringO(r);
  21542   ck_assert_str_eq(s, "");
  21543   free(s);
  21544   // empty old delimiter
  21545   freeO(self);
  21546   setTopSO(self, "qwe");
  21547   ck_assert_ptr_eq(replaceSCharO(self, "",'|',1), NULL);
  21548   // NULL old delimiter
  21549   ck_assert_ptr_eq(replaceSCharO(self, NULL,'|',1), NULL);
  21550   // NULL string
  21551   freeO(self);
  21552   ck_assert_ptr_eq(replaceSCharO(self, "##",'|',1), NULL);
  21553   terminateO(self);
  21554 
  21555 END_TEST
  21556 
  21557 
  21558 START_TEST(replaceCharCharSmallJsonT)
  21559 
  21560   smallJsont* r;
  21561   smallJsont *self = allocSmallJson();
  21562   setTopSO(self, "");
  21563 
  21564   // replace string, multiple character new delimeter
  21565   freeO(self);
  21566   setTopSO(self, "#ee#ee#ad");
  21567   r = replaceCharCharO(self, '#','^', 0);
  21568   ck_assert_ptr_ne(r, null);
  21569   char *s = toStringO(r);
  21570   ck_assert_str_eq(s, "^ee^ee^ad");
  21571   free(s);
  21572   // replace one time at the start of string
  21573   freeO(self);
  21574   setTopSO(self, "#ee#ee#ad");
  21575   r = replaceCharCharO(self, '#','^',1);
  21576   ck_assert_ptr_ne(r, null);
  21577   s = toStringO(r);
  21578   ck_assert_str_eq(s, "^ee#ee#ad");
  21579   free(s);
  21580   // replace one time
  21581   freeO(self);
  21582   setTopSO(self, "AA#ee##ee#");
  21583   r = replaceCharCharO(self, '#','|',1);
  21584   ck_assert_ptr_ne(r, null);
  21585   s = toStringO(r);
  21586   ck_assert_str_eq(s, "AA|ee##ee#");
  21587   free(s);
  21588   // empty string
  21589   freeO(self);
  21590   setTopSO(self, "");
  21591   r = replaceCharCharO(self, '#','^',1);
  21592   ck_assert_ptr_ne(r, null);
  21593   s = toStringO(r);
  21594   ck_assert_str_eq(s, "");
  21595   free(s);
  21596   // empty old delimiter
  21597   freeO(self);
  21598   setTopSO(self, "qwe");
  21599   ck_assert_ptr_eq(replaceCharCharO(self, 0,'|',1), NULL);
  21600   // NULL string
  21601   freeO(self);
  21602   ck_assert_ptr_eq(replaceCharCharO(self, '#','|',1), NULL);
  21603   terminateO(self);
  21604 
  21605 END_TEST
  21606 
  21607 
  21608 START_TEST(replaceSmallStringSmallStringSmallJsonT)
  21609 
  21610   smallJsont* r;
  21611   smallJsont *self = allocSmallJson();
  21612   setTopSO(self, "#ee#ee#ad");
  21613   smallStringt *olds = allocSmallString("");
  21614   smallStringt *news = allocSmallString("");
  21615 
  21616   // replace string, multiple character new delimeter
  21617   setValO(olds, "#");
  21618   setValO(news, "^^");
  21619   r = replaceSmallStringSmallStringO(self, olds, news, 0);
  21620   ck_assert_ptr_ne(r, null);
  21621   char *s = toStringO(r);
  21622   ck_assert_str_eq(s, "^^ee^^ee^^ad");
  21623   free(s);
  21624   // replace string, multiple character old delimeter
  21625   freeO(self);
  21626   setTopSO(self, "AA##ee##ee#");
  21627   setValO(olds, "##");
  21628   setValO(news, "|");
  21629   r = replaceSmallStringSmallStringO(self, olds, news, 0);
  21630   ck_assert_ptr_ne(r, null);
  21631   s = toStringO(r);
  21632   ck_assert_str_eq(s, "AA|ee|ee#");
  21633   free(s);
  21634   // replace one time at the start of string
  21635   freeO(self);
  21636   setTopSO(self, "#ee#ee#ad");
  21637   setValO(olds, "#");
  21638   setValO(news, "^^");
  21639   r = replaceSmallStringSmallStringO(self, olds, news,1);
  21640   ck_assert_ptr_ne(r, null);
  21641   s = toStringO(r);
  21642   ck_assert_str_eq(s, "^^ee#ee#ad");
  21643   free(s);
  21644   // replace one time
  21645   freeO(self);
  21646   setTopSO(self, "AA##ee##ee#");
  21647   setValO(olds, "##");
  21648   setValO(news, "|");
  21649   r = replaceSmallStringSmallStringO(self, olds, news,1);
  21650   ck_assert_ptr_ne(r, null);
  21651   s = toStringO(r);
  21652   ck_assert_str_eq(s, "AA|ee##ee#");
  21653   free(s);
  21654   // NULL new delimiter, one time: same as empty delimiter
  21655   freeO(self);
  21656   setTopSO(self, "AA##ee##ee#");
  21657   setValO(olds, "##");
  21658   r = replaceSmallStringSmallStringO(self, olds, NULL,1);
  21659   ck_assert_ptr_ne(r, null);
  21660   s = toStringO(r);
  21661   ck_assert_str_eq(s, "AAee##ee#");
  21662   free(s);
  21663   // non smallString object
  21664   terminateO(olds);
  21665   olds = (smallStringt*) allocSmallInt(1);
  21666   r = replaceSmallStringSmallStringO(self, olds, news,1);
  21667   ck_assert_ptr_eq(r, null);
  21668   terminateO(olds);
  21669   terminateO(news);
  21670   olds = allocSmallString("");
  21671   news = (smallStringt*) allocSmallInt(1);
  21672   r = replaceSmallStringSmallStringO(self, olds, news,1);
  21673   ck_assert_ptr_eq(r, null);
  21674   terminateO(news);
  21675   news = allocSmallString("");
  21676   // empty string
  21677   freeO(self);
  21678   setTopSO(self, "");
  21679   setValO(olds, "##");
  21680   r = replaceSmallStringSmallStringO(self, olds, NULL,1);
  21681   ck_assert_ptr_ne(r, null);
  21682   s = toStringO(r);
  21683   ck_assert_str_eq(s, "");
  21684   free(s);
  21685   // empty old delimiter
  21686   freeO(self);
  21687   setTopSO(self, "qwe");
  21688   setValO(olds, "");
  21689   setValO(news, "|");
  21690   ck_assert_ptr_eq(replaceSmallStringSmallStringO(self, olds, news,1), NULL);
  21691   // NULL old delimiter
  21692   ck_assert_ptr_eq(replaceSmallStringSmallStringO(self, NULL, news,1), NULL);
  21693   // NULL string
  21694   freeO(self);
  21695   ck_assert_ptr_eq(replaceSmallStringSmallStringO(self, olds, news,1), NULL);
  21696   terminateO(olds);
  21697   terminateO(news);
  21698   terminateO(self);
  21699 
  21700 END_TEST
  21701 
  21702 
  21703 START_TEST(replaceSmallStringSSmallJsonT)
  21704 
  21705   smallJsont* r;
  21706   smallJsont *self = allocSmallJson();
  21707   setTopSO(self, "#ee#ee#ad");
  21708   smallStringt *olds = allocSmallString("");
  21709   const char *news;
  21710 
  21711   // replace string, multiple character new delimeter
  21712   setValO(olds, "#");
  21713   news = "^^";
  21714   r = replaceSmallStringSO(self, olds, news, 0);
  21715   ck_assert_ptr_ne(r, null);
  21716   char *s = toStringO(r);
  21717   ck_assert_str_eq(s, "^^ee^^ee^^ad");
  21718   free(s);
  21719   // replace string, multiple character old delimeter
  21720   freeO(self);
  21721   setTopSO(self, "AA##ee##ee#");
  21722   setValO(olds, "##");
  21723   news = "|";
  21724   r = replaceSmallStringSO(self, olds, news, 0);
  21725   ck_assert_ptr_ne(r, null);
  21726   s = toStringO(r);
  21727   ck_assert_str_eq(s, "AA|ee|ee#");
  21728   free(s);
  21729   // replace one time at the start of string
  21730   freeO(self);
  21731   setTopSO(self, "#ee#ee#ad");
  21732   setValO(olds, "#");
  21733   news = "^^";
  21734   r = replaceSmallStringSO(self, olds, news,1);
  21735   ck_assert_ptr_ne(r, null);
  21736   s = toStringO(r);
  21737   ck_assert_str_eq(s, "^^ee#ee#ad");
  21738   free(s);
  21739   // replace one time
  21740   freeO(self);
  21741   setTopSO(self, "AA##ee##ee#");
  21742   setValO(olds, "##");
  21743   news = "|";
  21744   r = replaceSmallStringSO(self, olds, news,1);
  21745   ck_assert_ptr_ne(r, null);
  21746   s = toStringO(r);
  21747   ck_assert_str_eq(s, "AA|ee##ee#");
  21748   free(s);
  21749   // NULL new delimiter, one time: same as empty delimiter
  21750   freeO(self);
  21751   setTopSO(self, "AA##ee##ee#");
  21752   setValO(olds, "##");
  21753   r = replaceSmallStringSO(self, olds, NULL,1);
  21754   ck_assert_ptr_ne(r, null);
  21755   s = toStringO(r);
  21756   ck_assert_str_eq(s, "AAee##ee#");
  21757   free(s);
  21758   // non smallString object
  21759   terminateO(olds);
  21760   olds = (smallStringt*) allocSmallInt(1);
  21761   r = replaceSmallStringSO(self, olds, news,1);
  21762   ck_assert_ptr_eq(r, null);
  21763   terminateO(olds);
  21764   olds = allocSmallString("");
  21765   // empty string
  21766   freeO(self);
  21767   setTopSO(self, "");
  21768   setValO(olds, "##");
  21769   r = replaceSmallStringSO(self, olds, NULL,1);
  21770   ck_assert_ptr_ne(r, null);
  21771   s = toStringO(r);
  21772   ck_assert_str_eq(s, "");
  21773   free(s);
  21774   // empty old delimiter
  21775   freeO(self);
  21776   setTopSO(self, "qwe");
  21777   setValO(olds, "");
  21778   news = "|";
  21779   ck_assert_ptr_eq(replaceSmallStringSO(self, olds, news,1), NULL);
  21780   // NULL old delimiter
  21781   ck_assert_ptr_eq(replaceSmallStringSO(self, NULL, news,1), NULL);
  21782   // NULL string
  21783   freeO(self);
  21784   ck_assert_ptr_eq(replaceSmallStringSO(self, olds, news,1), NULL);
  21785   terminateO(olds);
  21786   terminateO(self);
  21787 
  21788 END_TEST
  21789 
  21790 
  21791 START_TEST(replaceSmallStringCharSmallJsonT)
  21792 
  21793   smallJsont* r;
  21794   smallJsont *self = allocSmallJson();
  21795   setTopSO(self, "#ee#ee#ad");
  21796   smallStringt *olds = allocSmallString("");
  21797   char news;
  21798 
  21799   // replace string, multiple character new delimeter
  21800   setValO(olds, "#");
  21801   news = '^';
  21802   r = replaceSmallStringCharO(self, olds, news, 0);
  21803   ck_assert_ptr_ne(r, null);
  21804   char *s = toStringO(r);
  21805   ck_assert_str_eq(s, "^ee^ee^ad");
  21806   free(s);
  21807   // replace string, multiple character old delimeter
  21808   freeO(self);
  21809   setTopSO(self, "AA##ee##ee#");
  21810   setValO(olds, "##");
  21811   news = '|';
  21812   r = replaceSmallStringCharO(self, olds, news, 0);
  21813   ck_assert_ptr_ne(r, null);
  21814   s = toStringO(r);
  21815   ck_assert_str_eq(s, "AA|ee|ee#");
  21816   free(s);
  21817   // replace one time at the start of string
  21818   freeO(self);
  21819   setTopSO(self, "#ee#ee#ad");
  21820   setValO(olds, "#");
  21821   news = '^';
  21822   r = replaceSmallStringCharO(self, olds, news,1);
  21823   ck_assert_ptr_ne(r, null);
  21824   s = toStringO(r);
  21825   ck_assert_str_eq(s, "^ee#ee#ad");
  21826   free(s);
  21827   // replace one time
  21828   freeO(self);
  21829   setTopSO(self, "AA##ee##ee#");
  21830   setValO(olds, "##");
  21831   news = '|';
  21832   r = replaceSmallStringCharO(self, olds, news,1);
  21833   ck_assert_ptr_ne(r, null);
  21834   s = toStringO(r);
  21835   ck_assert_str_eq(s, "AA|ee##ee#");
  21836   free(s);
  21837   // non smallString object
  21838   terminateO(olds);
  21839   olds = (smallStringt*) allocSmallInt(1);
  21840   r = replaceSmallStringCharO(self, olds, news,1);
  21841   ck_assert_ptr_eq(r, null);
  21842   terminateO(olds);
  21843   olds = allocSmallString("");
  21844   // empty string
  21845   freeO(self);
  21846   setTopSO(self, "");
  21847   setValO(olds, "##");
  21848   r = replaceSmallStringCharO(self, olds, news,1);
  21849   ck_assert_ptr_ne(r, null);
  21850   s = toStringO(r);
  21851   ck_assert_str_eq(s, "");
  21852   free(s);
  21853   // empty old delimiter
  21854   freeO(self);
  21855   setTopSO(self, "qwe");
  21856   setValO(olds, "");
  21857   news = '|';
  21858   ck_assert_ptr_eq(replaceSmallStringCharO(self, olds, news,1), NULL);
  21859   // NULL old delimiter
  21860   ck_assert_ptr_eq(replaceSmallStringCharO(self, NULL, news,1), NULL);
  21861   // NULL string
  21862   freeO(self);
  21863   ck_assert_ptr_eq(replaceSmallStringCharO(self, olds, news,1), NULL);
  21864   terminateO(olds);
  21865   terminateO(self);
  21866 
  21867 END_TEST
  21868 
  21869 
  21870 START_TEST(replaceSSmallStringSmallJsonT)
  21871 
  21872   smallJsont* r;
  21873   smallJsont *self = allocSmallJson();
  21874   setTopSO(self, "#ee#ee#ad");
  21875   const char *olds;
  21876   smallStringt *news = allocSmallString("");
  21877 
  21878   // replace string, multiple character new delimeter
  21879   olds = "#";
  21880   setValO(news, "^^");
  21881   r = replaceSSmallStringO(self, olds, news, 0);
  21882   ck_assert_ptr_ne(r, null);
  21883   char *s = toStringO(r);
  21884   ck_assert_str_eq(s, "^^ee^^ee^^ad");
  21885   free(s);
  21886   // replace string, multiple character old delimeter
  21887   freeO(self);
  21888   setTopSO(self, "AA##ee##ee#");
  21889   olds = "##";
  21890   setValO(news, "|");
  21891   r = replaceSSmallStringO(self, olds, news, 0);
  21892   ck_assert_ptr_ne(r, null);
  21893   s = toStringO(r);
  21894   ck_assert_str_eq(s, "AA|ee|ee#");
  21895   free(s);
  21896   // replace one time at the start of string
  21897   freeO(self);
  21898   setTopSO(self, "#ee#ee#ad");
  21899   olds = "#";
  21900   setValO(news, "^^");
  21901   r = replaceSSmallStringO(self, olds, news,1);
  21902   ck_assert_ptr_ne(r, null);
  21903   s = toStringO(r);
  21904   ck_assert_str_eq(s, "^^ee#ee#ad");
  21905   free(s);
  21906   // replace one time
  21907   freeO(self);
  21908   setTopSO(self, "AA##ee##ee#");
  21909   olds = "##";
  21910   setValO(news, "|");
  21911   r = replaceSSmallStringO(self, olds, news,1);
  21912   ck_assert_ptr_ne(r, null);
  21913   s = toStringO(r);
  21914   ck_assert_str_eq(s, "AA|ee##ee#");
  21915   free(s);
  21916   // NULL new delimiter, one time: same as empty delimiter
  21917   freeO(self);
  21918   setTopSO(self, "AA##ee##ee#");
  21919   olds = "##";
  21920   r = replaceSSmallStringO(self, olds, NULL,1);
  21921   ck_assert_ptr_ne(r, null);
  21922   s = toStringO(r);
  21923   ck_assert_str_eq(s, "AAee##ee#");
  21924   free(s);
  21925   // non smallString object
  21926   terminateO(news);
  21927   news = (smallStringt*) allocSmallInt(1);
  21928   r = replaceSSmallStringO(self, olds, news,1);
  21929   ck_assert_ptr_eq(r, null);
  21930   terminateO(news);
  21931   news = allocSmallString("");
  21932   // empty string
  21933   freeO(self);
  21934   setTopSO(self, "");
  21935   olds = "##";
  21936   r = replaceSSmallStringO(self, olds, NULL,1);
  21937   ck_assert_ptr_ne(r, null);
  21938   s = toStringO(r);
  21939   ck_assert_str_eq(s, "");
  21940   free(s);
  21941   // empty old delimiter
  21942   freeO(self);
  21943   setTopSO(self, "qwe");
  21944   olds = "";
  21945   setValO(news, "|");
  21946   ck_assert_ptr_eq(replaceSSmallStringO(self, olds, news,1), NULL);
  21947   // NULL old delimiter
  21948   ck_assert_ptr_eq(replaceSSmallStringO(self, NULL, news,1), NULL);
  21949   // NULL string
  21950   freeO(self);
  21951   ck_assert_ptr_eq(replaceSSmallStringO(self, olds, news,1), NULL);
  21952   terminateO(news);
  21953   terminateO(self);
  21954 
  21955 END_TEST
  21956 
  21957 
  21958 START_TEST(replaceCharSmallStringSmallJsonT)
  21959 
  21960   smallJsont* r;
  21961   smallJsont *self = allocSmallJson();
  21962   setTopSO(self, "#ee#ee#ad");
  21963   char olds;
  21964   smallStringt *news = allocSmallString("");
  21965 
  21966   // replace string, multiple character new delimeter
  21967   olds = '#';
  21968   setValO(news, "^^");
  21969   r = replaceCharSmallStringO(self, olds, news, 0);
  21970   ck_assert_ptr_ne(r, null);
  21971   char *s = toStringO(r);
  21972   ck_assert_str_eq(s, "^^ee^^ee^^ad");
  21973   free(s);
  21974   // replace string, multiple character old delimeter
  21975   freeO(self);
  21976   setTopSO(self, "AA#ee#ee");
  21977   olds = '#';
  21978   setValO(news, "|");
  21979   r = replaceCharSmallStringO(self, olds, news, 0);
  21980   ck_assert_ptr_ne(r, null);
  21981   s = toStringO(r);
  21982   ck_assert_str_eq(s, "AA|ee|ee");
  21983   free(s);
  21984   // replace one time at the start of string
  21985   freeO(self);
  21986   setTopSO(self, "#ee#ee#ad");
  21987   olds = '#';
  21988   setValO(news, "^^");
  21989   r = replaceCharSmallStringO(self, olds, news,1);
  21990   ck_assert_ptr_ne(r, null);
  21991   s = toStringO(r);
  21992   ck_assert_str_eq(s, "^^ee#ee#ad");
  21993   free(s);
  21994   // replace one time
  21995   freeO(self);
  21996   setTopSO(self, "AA#ee##ee#");
  21997   olds = '#';
  21998   setValO(news, "|");
  21999   r = replaceCharSmallStringO(self, olds, news,1);
  22000   ck_assert_ptr_ne(r, null);
  22001   s = toStringO(r);
  22002   ck_assert_str_eq(s, "AA|ee##ee#");
  22003   free(s);
  22004   // NULL new delimiter, one time: same as empty delimiter
  22005   freeO(self);
  22006   setTopSO(self, "AA#ee##ee#");
  22007   olds = '#';
  22008   r = replaceCharSmallStringO(self, olds, NULL,1);
  22009   ck_assert_ptr_ne(r, null);
  22010   s = toStringO(r);
  22011   ck_assert_str_eq(s, "AAee##ee#");
  22012   free(s);
  22013   // non smallString object
  22014   terminateO(news);
  22015   news = (smallStringt*) allocSmallInt(1);
  22016   r = replaceCharSmallStringO(self, olds, news,1);
  22017   ck_assert_ptr_eq(r, null);
  22018   terminateO(news);
  22019   news = allocSmallString("");
  22020   // empty string
  22021   freeO(self);
  22022   setTopSO(self, "");
  22023   olds = '#';
  22024   r = replaceCharSmallStringO(self, olds, NULL,1);
  22025   ck_assert_ptr_ne(r, null);
  22026   s = toStringO(r);
  22027   ck_assert_str_eq(s, "");
  22028   free(s);
  22029   // NULL string
  22030   freeO(self);
  22031   setValO(news, "|");
  22032   ck_assert_ptr_eq(replaceCharSmallStringO(self, olds, news,1), NULL);
  22033   terminateO(news);
  22034   terminateO(self);
  22035 
  22036 END_TEST
  22037 
  22038 
  22039 START_TEST(replaceJsonJsonSmallJsonT)
  22040 
  22041   smallJsont* r;
  22042   smallJsont *self = allocSmallJson();
  22043   setTopSO(self, "#ee#ee#ad");
  22044   smallJsont *olds = allocSmallJson();
  22045   smallJsont *news = allocSmallJson();
  22046 
  22047   // replace string, multiple character new delimeter
  22048   freeO(olds);
  22049   freeO(news);
  22050   setTopSO(olds, "#");
  22051   setTopSO(news, "^^");
  22052   r = replaceJsonJsonO(self, olds, news, 0);
  22053   ck_assert_ptr_ne(r, null);
  22054   char *s = toStringO(r);
  22055   ck_assert_str_eq(s, "^^ee^^ee^^ad");
  22056   free(s);
  22057   // replace string, multiple character old delimeter
  22058   freeO(self);
  22059   setTopSO(self, "AA##ee##ee#");
  22060   freeO(olds);
  22061   freeO(news);
  22062   setTopSO(olds, "##");
  22063   setTopSO(news, "|");
  22064   r = replaceJsonJsonO(self, olds, news, 0);
  22065   ck_assert_ptr_ne(r, null);
  22066   s = toStringO(r);
  22067   ck_assert_str_eq(s, "AA|ee|ee#");
  22068   free(s);
  22069   // replace one time at the start of string
  22070   freeO(self);
  22071   setTopSO(self, "#ee#ee#ad");
  22072   freeO(olds);
  22073   freeO(news);
  22074   setTopSO(olds, "#");
  22075   setTopSO(news, "^^");
  22076   r = replaceJsonJsonO(self, olds, news,1);
  22077   ck_assert_ptr_ne(r, null);
  22078   s = toStringO(r);
  22079   ck_assert_str_eq(s, "^^ee#ee#ad");
  22080   free(s);
  22081   // replace one time
  22082   freeO(self);
  22083   setTopSO(self, "AA##ee##ee#");
  22084   freeO(olds);
  22085   freeO(news);
  22086   setTopSO(olds, "##");
  22087   setTopSO(news, "|");
  22088   r = replaceJsonJsonO(self, olds, news,1);
  22089   ck_assert_ptr_ne(r, null);
  22090   s = toStringO(r);
  22091   ck_assert_str_eq(s, "AA|ee##ee#");
  22092   free(s);
  22093   // NULL new delimiter, one time: same as empty delimiter
  22094   freeO(self);
  22095   setTopSO(self, "AA##ee##ee#");
  22096   freeO(olds);
  22097   setTopSO(olds, "##");
  22098   r = replaceJsonJsonO(self, olds, NULL,1);
  22099   ck_assert_ptr_ne(r, null);
  22100   s = toStringO(r);
  22101   ck_assert_str_eq(s, "AAee##ee#");
  22102   free(s);
  22103   // non json string
  22104   freeO(olds);
  22105   setTopIntO(olds, 1);
  22106   r = replaceJsonJsonO(self, olds, news,1);
  22107   ck_assert_ptr_eq(r, null);
  22108   freeO(olds);
  22109   freeO(news);
  22110   setTopSO(olds, "e");
  22111   setTopIntO(news, 1);
  22112   r = replaceJsonJsonO(self, olds, news,1);
  22113   ck_assert_ptr_eq(r, null);
  22114   // non json object
  22115   terminateO(olds);
  22116   olds = (smallJsont*) allocSmallInt(1);
  22117   r = replaceJsonJsonO(self, olds, news,1);
  22118   ck_assert_ptr_eq(r, null);
  22119   terminateO(olds);
  22120   terminateO(news);
  22121   olds = allocSmallJson();
  22122   news = (smallJsont*) allocSmallInt(1);
  22123   r = replaceJsonJsonO(self, olds, news,1);
  22124   ck_assert_ptr_eq(r, null);
  22125   terminateO(news);
  22126   news = allocSmallJson();
  22127   // empty string
  22128   freeO(self);
  22129   setTopSO(self, "");
  22130   freeO(olds);
  22131   setTopSO(olds, "##");
  22132   r = replaceJsonJsonO(self, olds, NULL,1);
  22133   ck_assert_ptr_ne(r, null);
  22134   s = toStringO(r);
  22135   ck_assert_str_eq(s, "");
  22136   free(s);
  22137   // empty old delimiter
  22138   freeO(self);
  22139   setTopSO(self, "qwe");
  22140   freeO(olds);
  22141   freeO(news);
  22142   setTopSO(olds, "");
  22143   setTopSO(news, "|");
  22144   ck_assert_ptr_eq(replaceJsonJsonO(self, olds, news,1), NULL);
  22145   // NULL old delimiter
  22146   ck_assert_ptr_eq(replaceJsonJsonO(self, NULL, news,1), NULL);
  22147   // NULL string
  22148   freeO(self);
  22149   ck_assert_ptr_eq(replaceJsonJsonO(self, olds, news,1), NULL);
  22150   terminateO(olds);
  22151   terminateO(news);
  22152   terminateO(self);
  22153 
  22154 END_TEST
  22155 
  22156 
  22157 START_TEST(replaceJsonSmallStringSmallJsonT)
  22158 
  22159   smallJsont* r;
  22160   smallJsont *self = allocSmallJson();
  22161   setTopSO(self, "#ee#ee#ad");
  22162   smallJsont *olds   = allocSmallJson();
  22163   smallStringt *news = allocSmallString("");
  22164 
  22165   // replace string, multiple character new delimeter
  22166   freeO(olds);
  22167   setTopSO(olds, "#");
  22168   setValO(news, "^^");
  22169   r = replaceJsonSmallStringO(self, olds, news, 0);
  22170   ck_assert_ptr_ne(r, null);
  22171   char *s = toStringO(r);
  22172   ck_assert_str_eq(s, "^^ee^^ee^^ad");
  22173   free(s);
  22174   // replace string, multiple character old delimeter
  22175   freeO(self);
  22176   setTopSO(self, "AA##ee##ee#");
  22177   freeO(olds);
  22178   setTopSO(olds, "##");
  22179   setValO(news, "|");
  22180   r = replaceJsonSmallStringO(self, olds, news, 0);
  22181   ck_assert_ptr_ne(r, null);
  22182   s = toStringO(r);
  22183   ck_assert_str_eq(s, "AA|ee|ee#");
  22184   free(s);
  22185   // replace one time at the start of string
  22186   freeO(self);
  22187   setTopSO(self, "#ee#ee#ad");
  22188   freeO(olds);
  22189   setTopSO(olds, "#");
  22190   setValO(news, "^^");
  22191   r = replaceJsonSmallStringO(self, olds, news,1);
  22192   ck_assert_ptr_ne(r, null);
  22193   s = toStringO(r);
  22194   ck_assert_str_eq(s, "^^ee#ee#ad");
  22195   free(s);
  22196   // replace one time
  22197   freeO(self);
  22198   setTopSO(self, "AA##ee##ee#");
  22199   freeO(olds);
  22200   setTopSO(olds, "##");
  22201   setValO(news, "|");
  22202   r = replaceJsonSmallStringO(self, olds, news,1);
  22203   ck_assert_ptr_ne(r, null);
  22204   s = toStringO(r);
  22205   ck_assert_str_eq(s, "AA|ee##ee#");
  22206   free(s);
  22207   // NULL new delimiter, one time: same as empty delimiter
  22208   freeO(self);
  22209   setTopSO(self, "AA##ee##ee#");
  22210   freeO(olds);
  22211   setTopSO(olds, "##");
  22212   r = replaceJsonSmallStringO(self, olds, NULL,1);
  22213   ck_assert_ptr_ne(r, null);
  22214   s = toStringO(r);
  22215   ck_assert_str_eq(s, "AAee##ee#");
  22216   free(s);
  22217   // non json string
  22218   freeO(olds);
  22219   setTopIntO(olds, 1);
  22220   r = replaceJsonSmallStringO(self, olds, news,1);
  22221   ck_assert_ptr_eq(r, null);
  22222   // non json object
  22223   terminateO(olds);
  22224   olds = (smallJsont*) allocSmallInt(1);
  22225   r = replaceJsonSmallStringO(self, olds, news,1);
  22226   ck_assert_ptr_eq(r, null);
  22227   terminateO(olds);
  22228   terminateO(news);
  22229   olds = allocSmallJson();
  22230   news = (smallStringt*) allocSmallInt(1);
  22231   r = replaceJsonSmallStringO(self, olds, news,1);
  22232   ck_assert_ptr_eq(r, null);
  22233   terminateO(news);
  22234   news = allocSmallString("");
  22235   // empty string
  22236   freeO(self);
  22237   setTopSO(self, "");
  22238   freeO(olds);
  22239   setTopSO(olds, "##");
  22240   r = replaceJsonSmallStringO(self, olds, NULL,1);
  22241   ck_assert_ptr_ne(r, null);
  22242   s = toStringO(r);
  22243   ck_assert_str_eq(s, "");
  22244   free(s);
  22245   // empty old delimiter
  22246   freeO(self);
  22247   setTopSO(self, "qwe");
  22248   freeO(olds);
  22249   setTopSO(olds, "");
  22250   setValO(news, "|");
  22251   ck_assert_ptr_eq(replaceJsonSmallStringO(self, olds, news,1), NULL);
  22252   // NULL old delimiter
  22253   ck_assert_ptr_eq(replaceJsonSmallStringO(self, NULL, news,1), NULL);
  22254   // NULL string
  22255   freeO(self);
  22256   ck_assert_ptr_eq(replaceJsonSmallStringO(self, olds, news,1), NULL);
  22257   terminateO(olds);
  22258   terminateO(news);
  22259   terminateO(self);
  22260 
  22261 END_TEST
  22262 
  22263 
  22264 START_TEST(replaceJsonSSmallJsonT)
  22265 
  22266   smallJsont* r;
  22267   smallJsont *self = allocSmallJson();
  22268   setTopSO(self, "#ee#ee#ad");
  22269   smallJsont *olds   = allocSmallJson();
  22270   const char *news;
  22271 
  22272   // replace string, multiple character new delimeter
  22273   freeO(olds);
  22274   setTopSO(olds, "#");
  22275   news = "^^";
  22276   r = replaceJsonSO(self, olds, news, 0);
  22277   ck_assert_ptr_ne(r, null);
  22278   char *s = toStringO(r);
  22279   ck_assert_str_eq(s, "^^ee^^ee^^ad");
  22280   free(s);
  22281   // replace string, multiple character old delimeter
  22282   freeO(self);
  22283   setTopSO(self, "AA##ee##ee#");
  22284   freeO(olds);
  22285   setTopSO(olds, "##");
  22286   news = "|";
  22287   r = replaceJsonSO(self, olds, news, 0);
  22288   ck_assert_ptr_ne(r, null);
  22289   s = toStringO(r);
  22290   ck_assert_str_eq(s, "AA|ee|ee#");
  22291   free(s);
  22292   // replace one time at the start of string
  22293   freeO(self);
  22294   setTopSO(self, "#ee#ee#ad");
  22295   freeO(olds);
  22296   setTopSO(olds, "#");
  22297   news = "^^";
  22298   r = replaceJsonSO(self, olds, news,1);
  22299   ck_assert_ptr_ne(r, null);
  22300   s = toStringO(r);
  22301   ck_assert_str_eq(s, "^^ee#ee#ad");
  22302   free(s);
  22303   // replace one time
  22304   freeO(self);
  22305   setTopSO(self, "AA##ee##ee#");
  22306   freeO(olds);
  22307   setTopSO(olds, "##");
  22308   news = "|";
  22309   r = replaceJsonSO(self, olds, news,1);
  22310   ck_assert_ptr_ne(r, null);
  22311   s = toStringO(r);
  22312   ck_assert_str_eq(s, "AA|ee##ee#");
  22313   free(s);
  22314   // NULL new delimiter, one time: same as empty delimiter
  22315   freeO(self);
  22316   setTopSO(self, "AA##ee##ee#");
  22317   freeO(olds);
  22318   setTopSO(olds, "##");
  22319   r = replaceJsonSO(self, olds, NULL,1);
  22320   ck_assert_ptr_ne(r, null);
  22321   s = toStringO(r);
  22322   ck_assert_str_eq(s, "AAee##ee#");
  22323   free(s);
  22324   // non json string
  22325   freeO(olds);
  22326   setTopIntO(olds, 1);
  22327   r = replaceJsonSO(self, olds, news,1);
  22328   ck_assert_ptr_eq(r, null);
  22329   // non json object
  22330   terminateO(olds);
  22331   olds = (smallJsont*) allocSmallInt(1);
  22332   r = replaceJsonSO(self, olds, news,1);
  22333   ck_assert_ptr_eq(r, null);
  22334   terminateO(olds);
  22335   // empty string
  22336   olds = allocSmallJson();
  22337   freeO(self);
  22338   setTopSO(self, "");
  22339   setTopSO(olds, "##");
  22340   r = replaceJsonSO(self, olds, NULL,1);
  22341   ck_assert_ptr_ne(r, null);
  22342   s = toStringO(r);
  22343   ck_assert_str_eq(s, "");
  22344   free(s);
  22345   // empty old delimiter
  22346   freeO(self);
  22347   setTopSO(self, "qwe");
  22348   freeO(olds);
  22349   setTopSO(olds, "");
  22350   news = "|";
  22351   ck_assert_ptr_eq(replaceJsonSO(self, olds, news,1), NULL);
  22352   // NULL old delimiter
  22353   ck_assert_ptr_eq(replaceJsonSO(self, NULL, news,1), NULL);
  22354   // NULL string
  22355   freeO(self);
  22356   ck_assert_ptr_eq(replaceJsonSO(self, olds, news,1), NULL);
  22357   terminateO(olds);
  22358   terminateO(self);
  22359 
  22360 END_TEST
  22361 
  22362 
  22363 START_TEST(replaceJsonCharSmallJsonT)
  22364 
  22365   smallJsont* r;
  22366   smallJsont *self = allocSmallJson();
  22367   setTopSO(self, "#ee#ee#ad");
  22368   smallJsont *olds   = allocSmallJson();
  22369   char news;
  22370 
  22371   // replace string, multiple character new delimeter
  22372   freeO(olds);
  22373   setTopSO(olds, "#");
  22374   news = '^';
  22375   r = replaceJsonCharO(self, olds, news, 0);
  22376   ck_assert_ptr_ne(r, null);
  22377   char *s = toStringO(r);
  22378   ck_assert_str_eq(s, "^ee^ee^ad");
  22379   free(s);
  22380   // replace string, multiple character old delimeter
  22381   freeO(self);
  22382   setTopSO(self, "AA##ee##ee#");
  22383   freeO(olds);
  22384   setTopSO(olds, "##");
  22385   news = '|';
  22386   r = replaceJsonCharO(self, olds, news, 0);
  22387   ck_assert_ptr_ne(r, null);
  22388   s = toStringO(r);
  22389   ck_assert_str_eq(s, "AA|ee|ee#");
  22390   free(s);
  22391   // replace one time at the start of string
  22392   freeO(self);
  22393   setTopSO(self, "#ee#ee#ad");
  22394   freeO(olds);
  22395   setTopSO(olds, "#");
  22396   news = '^';
  22397   r = replaceJsonCharO(self, olds, news,1);
  22398   ck_assert_ptr_ne(r, null);
  22399   s = toStringO(r);
  22400   ck_assert_str_eq(s, "^ee#ee#ad");
  22401   free(s);
  22402   // replace one time
  22403   freeO(self);
  22404   setTopSO(self, "AA##ee##ee#");
  22405   freeO(olds);
  22406   setTopSO(olds, "##");
  22407   news = '|';
  22408   r = replaceJsonCharO(self, olds, news,1);
  22409   ck_assert_ptr_ne(r, null);
  22410   s = toStringO(r);
  22411   ck_assert_str_eq(s, "AA|ee##ee#");
  22412   free(s);
  22413   // non json string
  22414   freeO(self);
  22415   setTopSO(self, "AA##ee##ee#");
  22416   freeO(olds);
  22417   setTopIntO(olds, 1);
  22418   r = replaceJsonCharO(self, olds, news,1);
  22419   ck_assert_ptr_eq(r, null);
  22420   // non json object
  22421   terminateO(olds);
  22422   olds = (smallJsont*) allocSmallInt(1);
  22423   r = replaceJsonCharO(self, olds, news,1);
  22424   ck_assert_ptr_eq(r, null);
  22425   terminateO(olds);
  22426   // empty string
  22427   olds = allocSmallJson();
  22428   freeO(self);
  22429   setTopSO(self, "");
  22430   setTopSO(olds, "##");
  22431   r = replaceJsonCharO(self, olds, news,1);
  22432   ck_assert_ptr_ne(r, null);
  22433   s = toStringO(r);
  22434   ck_assert_str_eq(s, "");
  22435   free(s);
  22436   // empty old delimiter
  22437   freeO(self);
  22438   setTopSO(self, "qwe");
  22439   freeO(olds);
  22440   setTopSO(olds, "");
  22441   news = '|';
  22442   ck_assert_ptr_eq(replaceJsonCharO(self, olds, news,1), NULL);
  22443   // NULL old delimiter
  22444   ck_assert_ptr_eq(replaceJsonCharO(self, NULL, news,1), NULL);
  22445   // NULL string
  22446   freeO(self);
  22447   ck_assert_ptr_eq(replaceJsonCharO(self, olds, news,1), NULL);
  22448   terminateO(olds);
  22449   terminateO(self);
  22450 
  22451 END_TEST
  22452 
  22453 
  22454 START_TEST(replaceSmallStringJsonSmallJsonT)
  22455 
  22456   smallJsont* r;
  22457   smallJsont *self = allocSmallJson();
  22458   setTopSO(self, "#ee#ee#ad");
  22459   smallStringt *olds = allocSmallString("");
  22460   smallJsont *news   = allocSmallJson();
  22461 
  22462   // replace string, multiple character new delimeter
  22463   freeO(news);
  22464   setValO(olds, "#");
  22465   setTopSO(news, "^^");
  22466   r = self->f->replaceSmallStringJson(self, olds, news, 0);
  22467   ck_assert_ptr_ne(r, null);
  22468   char *s = toStringO(r);
  22469   ck_assert_str_eq(s, "^^ee^^ee^^ad");
  22470   free(s);
  22471   // replace string, multiple character old delimeter
  22472   freeO(self);
  22473   setTopSO(self, "AA##ee##ee#");
  22474   freeO(news);
  22475   setValO(olds, "##");
  22476   setTopSO(news, "|");
  22477   r = self->f->replaceSmallStringJson(self, olds, news, 0);
  22478   ck_assert_ptr_ne(r, null);
  22479   s = toStringO(r);
  22480   ck_assert_str_eq(s, "AA|ee|ee#");
  22481   free(s);
  22482   // replace one time at the start of string
  22483   freeO(self);
  22484   setTopSO(self, "#ee#ee#ad");
  22485   freeO(news);
  22486   setValO(olds, "#");
  22487   setTopSO(news, "^^");
  22488   r = self->f->replaceSmallStringJson(self, olds, news,1);
  22489   ck_assert_ptr_ne(r, null);
  22490   s = toStringO(r);
  22491   ck_assert_str_eq(s, "^^ee#ee#ad");
  22492   free(s);
  22493   // replace one time
  22494   freeO(self);
  22495   setTopSO(self, "AA##ee##ee#");
  22496   freeO(news);
  22497   setValO(olds, "##");
  22498   setTopSO(news, "|");
  22499   r = self->f->replaceSmallStringJson(self, olds, news,1);
  22500   ck_assert_ptr_ne(r, null);
  22501   s = toStringO(r);
  22502   ck_assert_str_eq(s, "AA|ee##ee#");
  22503   free(s);
  22504   // NULL new delimiter, one time: same as empty delimiter
  22505   freeO(self);
  22506   setTopSO(self, "AA##ee##ee#");
  22507   setValO(olds, "##");
  22508   r = self->f->replaceSmallStringJson(self, olds, NULL,1);
  22509   ck_assert_ptr_ne(r, null);
  22510   s = toStringO(r);
  22511   ck_assert_str_eq(s, "AAee##ee#");
  22512   free(s);
  22513   // non json string
  22514   freeO(news);
  22515   setTopIntO(news, 1);
  22516   r = self->f->replaceSmallStringJson(self, olds, news,1);
  22517   ck_assert_ptr_eq(r, null);
  22518   // non json object
  22519   terminateO(olds);
  22520   olds = (smallStringt*) allocSmallInt(1);
  22521   r = self->f->replaceSmallStringJson(self, olds, news,1);
  22522   ck_assert_ptr_eq(r, null);
  22523   terminateO(olds);
  22524   terminateO(news);
  22525   olds = allocSmallString("");
  22526   news = (smallJsont*) allocSmallInt(1);
  22527   r = self->f->replaceSmallStringJson(self, olds, news,1);
  22528   ck_assert_ptr_eq(r, null);
  22529   terminateO(news);
  22530   news = allocSmallJson();
  22531   // empty string
  22532   freeO(self);
  22533   setTopSO(self, "");
  22534   setValO(olds, "##");
  22535   r = self->f->replaceSmallStringJson(self, olds, NULL,1);
  22536   ck_assert_ptr_ne(r, null);
  22537   s = toStringO(r);
  22538   ck_assert_str_eq(s, "");
  22539   free(s);
  22540   // empty old delimiter
  22541   freeO(self);
  22542   setTopSO(self, "qwe");
  22543   freeO(news);
  22544   setValO(olds, "");
  22545   setTopSO(news, "|");
  22546   ck_assert_ptr_eq(self->f->replaceSmallStringJson(self, olds, news,1), NULL);
  22547   // NULL old delimiter
  22548   ck_assert_ptr_eq(self->f->replaceSmallStringJson(self, NULL, news,1), NULL);
  22549   // NULL string
  22550   freeO(self);
  22551   ck_assert_ptr_eq(self->f->replaceSmallStringJson(self, olds, news,1), NULL);
  22552   terminateO(olds);
  22553   terminateO(news);
  22554   terminateO(self);
  22555 
  22556 END_TEST
  22557 
  22558 
  22559 START_TEST(replaceSJsonSmallJsonT)
  22560 
  22561   smallJsont* r;
  22562   smallJsont *self = allocSmallJson();
  22563   setTopSO(self, "#ee#ee#ad");
  22564   const char *olds;
  22565   smallJsont *news   = allocSmallJson();
  22566 
  22567   // replace string, multiple character new delimeter
  22568   freeO(news);
  22569   olds = "#";
  22570   setTopSO(news, "^^");
  22571   r = replaceSJsonO(self, olds, news, 0);
  22572   ck_assert_ptr_ne(r, null);
  22573   char *s = toStringO(r);
  22574   ck_assert_str_eq(s, "^^ee^^ee^^ad");
  22575   free(s);
  22576   // replace string, multiple character old delimeter
  22577   freeO(self);
  22578   setTopSO(self, "AA##ee##ee#");
  22579   freeO(news);
  22580   olds = "##";
  22581   setTopSO(news, "|");
  22582   r = replaceSJsonO(self, olds, news, 0);
  22583   ck_assert_ptr_ne(r, null);
  22584   s = toStringO(r);
  22585   ck_assert_str_eq(s, "AA|ee|ee#");
  22586   free(s);
  22587   // replace one time at the start of string
  22588   freeO(self);
  22589   setTopSO(self, "#ee#ee#ad");
  22590   freeO(news);
  22591   olds = "#";
  22592   setTopSO(news, "^^");
  22593   r = replaceSJsonO(self, olds, news,1);
  22594   ck_assert_ptr_ne(r, null);
  22595   s = toStringO(r);
  22596   ck_assert_str_eq(s, "^^ee#ee#ad");
  22597   free(s);
  22598   // replace one time
  22599   freeO(self);
  22600   setTopSO(self, "AA##ee##ee#");
  22601   freeO(news);
  22602   olds = "##";
  22603   setTopSO(news, "|");
  22604   r = replaceSJsonO(self, olds, news,1);
  22605   ck_assert_ptr_ne(r, null);
  22606   s = toStringO(r);
  22607   ck_assert_str_eq(s, "AA|ee##ee#");
  22608   free(s);
  22609   // NULL new delimiter, one time: same as empty delimiter
  22610   freeO(self);
  22611   setTopSO(self, "AA##ee##ee#");
  22612   olds = "##";
  22613   r = replaceSJsonO(self, olds, NULL,1);
  22614   ck_assert_ptr_ne(r, null);
  22615   s = toStringO(r);
  22616   ck_assert_str_eq(s, "AAee##ee#");
  22617   free(s);
  22618   // non json string
  22619   freeO(news);
  22620   olds = "e";
  22621   setTopIntO(news, 1);
  22622   r = replaceSJsonO(self, olds, news,1);
  22623   ck_assert_ptr_eq(r, null);
  22624   // non json object
  22625   terminateO(news);
  22626   news = (smallJsont*) allocSmallInt(1);
  22627   r = replaceSJsonO(self, olds, news,1);
  22628   ck_assert_ptr_eq(r, null);
  22629   terminateO(news);
  22630   news = allocSmallJson();
  22631   // empty string
  22632   freeO(self);
  22633   setTopSO(self, "");
  22634   olds = "##";
  22635   r = replaceSJsonO(self, olds, NULL,1);
  22636   ck_assert_ptr_ne(r, null);
  22637   s = toStringO(r);
  22638   ck_assert_str_eq(s, "");
  22639   free(s);
  22640   // empty old delimiter
  22641   freeO(self);
  22642   setTopSO(self, "qwe");
  22643   freeO(news);
  22644   olds = "";
  22645   setTopSO(news, "|");
  22646   ck_assert_ptr_eq(replaceSJsonO(self, olds, news,1), NULL);
  22647   // NULL old delimiter
  22648   ck_assert_ptr_eq(replaceSJsonO(self, NULL, news,1), NULL);
  22649   // NULL string
  22650   freeO(self);
  22651   ck_assert_ptr_eq(replaceSJsonO(self, olds, news,1), NULL);
  22652   terminateO(news);
  22653   terminateO(self);
  22654 
  22655 END_TEST
  22656 
  22657 
  22658 START_TEST(replaceCharJsonSmallJsonT)
  22659 
  22660   smallJsont* r;
  22661   smallJsont *self = allocSmallJson();
  22662   setTopSO(self, "#ee#ee#ad");
  22663   char olds;
  22664   smallJsont *news   = allocSmallJson();
  22665 
  22666   // replace string, multiple character new delimeter
  22667   freeO(news);
  22668   olds = '#';
  22669   setTopSO(news, "^^");
  22670   r = replaceCharJsonO(self, olds, news, 0);
  22671   ck_assert_ptr_ne(r, null);
  22672   char *s = toStringO(r);
  22673   ck_assert_str_eq(s, "^^ee^^ee^^ad");
  22674   free(s);
  22675   // replace string, multiple character old delimeter
  22676   freeO(self);
  22677   setTopSO(self, "AA#ee#ee");
  22678   freeO(news);
  22679   olds = '#';
  22680   setTopSO(news, "|");
  22681   r = replaceCharJsonO(self, olds, news, 0);
  22682   ck_assert_ptr_ne(r, null);
  22683   s = toStringO(r);
  22684   ck_assert_str_eq(s, "AA|ee|ee");
  22685   free(s);
  22686   // replace one time at the start of string
  22687   freeO(self);
  22688   setTopSO(self, "#ee#ee#ad");
  22689   freeO(news);
  22690   olds = '#';
  22691   setTopSO(news, "^^");
  22692   r = replaceCharJsonO(self, olds, news,1);
  22693   ck_assert_ptr_ne(r, null);
  22694   s = toStringO(r);
  22695   ck_assert_str_eq(s, "^^ee#ee#ad");
  22696   free(s);
  22697   // replace one time
  22698   freeO(self);
  22699   setTopSO(self, "AA#ee##ee#");
  22700   freeO(news);
  22701   olds = '#';
  22702   setTopSO(news, "|");
  22703   r = replaceCharJsonO(self, olds, news,1);
  22704   ck_assert_ptr_ne(r, null);
  22705   s = toStringO(r);
  22706   ck_assert_str_eq(s, "AA|ee##ee#");
  22707   free(s);
  22708   // NULL new delimiter, one time: same as empty delimiter
  22709   freeO(self);
  22710   setTopSO(self, "AA#ee##ee#");
  22711   olds = '#';
  22712   r = replaceCharJsonO(self, olds, NULL,1);
  22713   ck_assert_ptr_ne(r, null);
  22714   s = toStringO(r);
  22715   ck_assert_str_eq(s, "AAee##ee#");
  22716   free(s);
  22717   // non json string
  22718   freeO(news);
  22719   olds = 'e';
  22720   setTopIntO(news, 1);
  22721   r = replaceCharJsonO(self, olds, news,1);
  22722   ck_assert_ptr_eq(r, null);
  22723   // non json object
  22724   terminateO(news);
  22725   news = (smallJsont*) allocSmallInt(1);
  22726   r = replaceCharJsonO(self, olds, news,1);
  22727   ck_assert_ptr_eq(r, null);
  22728   terminateO(news);
  22729   news = allocSmallJson();
  22730   // empty string
  22731   freeO(self);
  22732   setTopSO(self, "");
  22733   olds = '#';
  22734   r = replaceCharJsonO(self, olds, NULL,1);
  22735   ck_assert_ptr_ne(r, null);
  22736   s = toStringO(r);
  22737   ck_assert_str_eq(s, "");
  22738   free(s);
  22739   // NULL string
  22740   freeO(self);
  22741   freeO(news);
  22742   setTopSO(news, "|");
  22743   ck_assert_ptr_eq(replaceCharJsonO(self, olds, news,1), NULL);
  22744   terminateO(news);
  22745   terminateO(self);
  22746 
  22747 END_TEST
  22748 
  22749 
  22750 START_TEST(replaceManySmallJsonT)
  22751 
  22752   smallJsont* r;
  22753   smallJsont *self = allocSmallJson();
  22754   setTopSO(self, "");
  22755 
  22756   // replace string, multiple character new delimeter
  22757   freeO(self);
  22758   setTopSO(self, "#ee#ee#ad");
  22759   r = replaceManyO(self, "#","^^","ad","AD");
  22760   ck_assert_ptr_ne(r, null);
  22761   char *s = toStringO(r);
  22762   ck_assert_str_eq(s, "^^ee^^ee^^AD");
  22763   free(s);
  22764   // replace string, empty new delimeter
  22765   freeO(self);
  22766   setTopSO(self, "#ee#ee#ad");
  22767   r = replaceManyO(self, "#","","ad","AD");
  22768   ck_assert_ptr_ne(r, null);
  22769   s = toStringO(r);
  22770   ck_assert_str_eq(s, "eeeeAD");
  22771   free(s);
  22772   // not enough olds:news pairs
  22773   freeO(self);
  22774   setTopSO(self, "#ee#ee#ad");
  22775   r = replaceManyO(self, "#","","ad");
  22776   ck_assert_ptr_ne(r, null);
  22777   s = toStringO(r);
  22778   ck_assert_str_eq(s, "eeeead");
  22779   free(s);
  22780   // NULL new delimiter: same as only 2 parameters or not enough olds:news pairs
  22781   freeO(self);
  22782   setTopSO(self, "AA##ee##ee#");
  22783   r = replaceManyO(self, "##",NULL);
  22784   ck_assert_ptr_eq(r, null);
  22785   // empty string
  22786   freeO(self);
  22787   setTopSO(self, "");
  22788   r = replaceManyO(self, "##", "");
  22789   ck_assert_ptr_ne(r, null);
  22790   s = toStringO(r);
  22791   ck_assert_str_eq(s, "");
  22792   free(s);
  22793   // empty string many pairs
  22794   freeO(self);
  22795   setTopSO(self, "");
  22796   r = replaceManyO(self, "##", "", "$$", "");
  22797   ck_assert_ptr_ne(r, null);
  22798   s = toStringO(r);
  22799   ck_assert_str_eq(s, "");
  22800   free(s);
  22801   // empty string many pairs empty olds
  22802   freeO(self);
  22803   setTopSO(self, "");
  22804   r = replaceManyO(self, "##", "", "", "");
  22805   ck_assert_ptr_ne(r, null);
  22806   s = toStringO(r);
  22807   ck_assert_str_eq(s, "");
  22808   free(s);
  22809   // empty string and NULL old delimiter
  22810   freeO(self);
  22811   setTopSO(self, "");
  22812   r = replaceManyO(self, NULL,"|");
  22813   ck_assert_ptr_ne(r, null);
  22814   s = toStringO(r);
  22815   ck_assert_str_eq(s, "");
  22816   free(s);
  22817   // empty string and NULL old delimiter not first - same as replace empty string
  22818   freeO(self);
  22819   setTopSO(self, "");
  22820   r = replaceManyO(self,"##","|", NULL,"|");
  22821   ck_assert_ptr_ne(r, null);
  22822   s = toStringO(r);
  22823   ck_assert_str_eq(s, "");
  22824   free(s);
  22825   // empty old delimiter
  22826   freeO(self);
  22827   setTopSO(self, "AA##ee##ee#");
  22828   ck_assert_ptr_eq(replaceManyO(self, "","|", "AA", "BB"), NULL);
  22829   // empty old delimiter not first
  22830   ck_assert_ptr_eq(replaceManyO(self, "##","|", "", "BB"), NULL);
  22831   // NULL string
  22832   freeO(self);
  22833   ck_assert_ptr_eq(replaceManyO(self, "##","|"), NULL);
  22834   terminateO(self);
  22835 
  22836 END_TEST
  22837 
  22838 
  22839 START_TEST(icReplaceSmallJsonT)
  22840 
  22841   smallJsont* r;
  22842   smallJsont *self = allocSmallJson();
  22843   setTopSO(self, "BeebeeBad");
  22844 
  22845   // replace string, multiple character new delimeter
  22846   r = icReplaceO(self, "b","^^", 0);
  22847   ck_assert_ptr_ne(r, null);
  22848   char *s = toStringO(r);
  22849   ck_assert_str_eq(s, "^^ee^^ee^^ad");
  22850   free(s);
  22851   // replace string, multiple character old delimeter
  22852   freeO(self);
  22853   setTopSO(self, "AA##ee##ee#");
  22854   r = icReplaceO(self, "##","|", 0);
  22855   ck_assert_ptr_ne(r, null);
  22856   s = toStringO(r);
  22857   ck_assert_str_eq(s, "AA|ee|ee#");
  22858   free(s);
  22859   // replace one time at the start of string
  22860   freeO(self);
  22861   setTopSO(self, "#ee#ee#ad");
  22862   r = icReplaceO(self, "#","^^",1);
  22863   ck_assert_ptr_ne(r, null);
  22864   s = toStringO(r);
  22865   ck_assert_str_eq(s, "^^ee#ee#ad");
  22866   free(s);
  22867   // replace one time
  22868   freeO(self);
  22869   setTopSO(self, "AA##ee##ee#");
  22870   r = icReplaceO(self, "##","|",1);
  22871   ck_assert_ptr_ne(r, null);
  22872   s = toStringO(r);
  22873   ck_assert_str_eq(s, "AA|ee##ee#");
  22874   free(s);
  22875   // NULL new delimiter, one time: same as empty delimiter
  22876   freeO(self);
  22877   setTopSO(self, "AA##ee##ee#");
  22878   r = icReplaceO(self, "##",NULL,1);
  22879   ck_assert_ptr_ne(r, null);
  22880   s = toStringO(r);
  22881   ck_assert_str_eq(s, "AAee##ee#");
  22882   free(s);
  22883   // empty string
  22884   freeO(self);
  22885   setTopSO(self, "");
  22886   r = icReplaceO(self, "##",NULL,1);
  22887   ck_assert_ptr_ne(r, null);
  22888   s = toStringO(r);
  22889   ck_assert_str_eq(s, "");
  22890   free(s);
  22891   // empty old delimiter
  22892   freeO(self);
  22893   setTopSO(self, "qwe");
  22894   ck_assert_ptr_eq(icReplaceO(self, "","|",1), NULL);
  22895   // NULL old delimiter
  22896   ck_assert_ptr_eq(icReplaceO(self, NULL,"|",1), NULL);
  22897   // empty old delimiter
  22898   ck_assert_ptr_eq(icReplaceO(self, "","|",1), NULL);
  22899   // NULL string
  22900   freeO(self);
  22901   ck_assert_ptr_eq(icReplaceO(self, "##","|",1), NULL);
  22902   terminateO(self);
  22903 
  22904 END_TEST
  22905 
  22906 
  22907 START_TEST(icReplaceCharSSmallJsonT)
  22908 
  22909   smallJsont* r;
  22910   smallJsont *self = allocSmallJson();
  22911   setTopSO(self, "");
  22912 
  22913   // replace string, multiple character new delimeter
  22914   freeO(self);
  22915   setTopSO(self, "BeebeeBad");
  22916   r = icReplaceCharSO(self, 'B',"^^", 0);
  22917   ck_assert_ptr_ne(r, null);
  22918   char *s = toStringO(r);
  22919   ck_assert_str_eq(s, "^^ee^^ee^^ad");
  22920   free(s);
  22921   // replace one time at the start of string
  22922   freeO(self);
  22923   setTopSO(self, "#ee#ee#ad");
  22924   r = icReplaceCharSO(self, '#',"^^",1);
  22925   ck_assert_ptr_ne(r, null);
  22926   s = toStringO(r);
  22927   ck_assert_str_eq(s, "^^ee#ee#ad");
  22928   free(s);
  22929   // replace one time
  22930   freeO(self);
  22931   setTopSO(self, "AA##ee##ee#");
  22932   r = icReplaceCharSO(self, '#',"|",1);
  22933   ck_assert_ptr_ne(r, null);
  22934   s = toStringO(r);
  22935   ck_assert_str_eq(s, "AA|#ee##ee#");
  22936   free(s);
  22937   // NULL new delimiter, one time: same as empty delimiter
  22938   freeO(self);
  22939   setTopSO(self, "AA#ee##ee#");
  22940   r = icReplaceCharSO(self, '#',NULL,1);
  22941   ck_assert_ptr_ne(r, null);
  22942   s = toStringO(r);
  22943   ck_assert_str_eq(s, "AAee##ee#");
  22944   free(s);
  22945   // empty string
  22946   freeO(self);
  22947   setTopSO(self, "");
  22948   r = icReplaceCharSO(self, '#',NULL,1);
  22949   ck_assert_ptr_ne(r, null);
  22950   s = toStringO(r);
  22951   ck_assert_str_eq(s, "");
  22952   free(s);
  22953   // empty old delimiter
  22954   freeO(self);
  22955   setTopSO(self, "qwe");
  22956   ck_assert_ptr_eq(icReplaceCharSO(self, 0,"|",1), NULL);
  22957   // NULL string
  22958   freeO(self);
  22959   ck_assert_ptr_eq(icReplaceCharSO(self, '#',"|",1), NULL);
  22960   terminateO(self);
  22961 
  22962 END_TEST
  22963 
  22964 
  22965 START_TEST(icReplaceSCharSmallJsonT)
  22966 
  22967   smallJsont* r;
  22968   smallJsont *self = allocSmallJson();
  22969   setTopSO(self, "");
  22970 
  22971   // replace string, multiple character new delimeter
  22972   freeO(self);
  22973   setTopSO(self, "BeebeeBad");
  22974   r = icReplaceSCharO(self, "b",'^',0);
  22975   ck_assert_ptr_ne(r, null);
  22976   char *s = toStringO(r);
  22977   ck_assert_str_eq(s, "^ee^ee^ad");
  22978   free(s);
  22979   // replace string, multiple character old delimeter
  22980   freeO(self);
  22981   setTopSO(self, "AA##ee##ee#");
  22982   r = icReplaceSCharO(self, "##",'|',0);
  22983   ck_assert_ptr_ne(r, null);
  22984   s = toStringO(r);
  22985   ck_assert_str_eq(s, "AA|ee|ee#");
  22986   free(s);
  22987   // replace string empty char, multiple character old delimeter
  22988   freeO(self);
  22989   setTopSO(self, "AA##ee##ee#");
  22990   r = icReplaceSCharO(self, "##", 0,0);
  22991   ck_assert_ptr_ne(r, null);
  22992   s = toStringO(r);
  22993   ck_assert_str_eq(s, "AAeeee#");
  22994   free(s);
  22995   // replace one time at the start of string
  22996   freeO(self);
  22997   setTopSO(self, "#ee#ee#ad");
  22998   r = icReplaceSCharO(self, "#",'^',1);
  22999   ck_assert_ptr_ne(r, null);
  23000   s = toStringO(r);
  23001   ck_assert_str_eq(s, "^ee#ee#ad");
  23002   free(s);
  23003   // replace one time
  23004   freeO(self);
  23005   setTopSO(self, "AA##ee##ee#");
  23006   r = icReplaceSCharO(self, "##",'|',1);
  23007   ck_assert_ptr_ne(r, null);
  23008   s = toStringO(r);
  23009   ck_assert_str_eq(s, "AA|ee##ee#");
  23010   free(s);
  23011   // empty string
  23012   freeO(self);
  23013   setTopSO(self, "");
  23014   r = icReplaceSCharO(self, "##",0,1);
  23015   ck_assert_ptr_ne(r, null);
  23016   s = toStringO(r);
  23017   ck_assert_str_eq(s, "");
  23018   free(s);
  23019   // empty old delimiter
  23020   freeO(self);
  23021   setTopSO(self, "qwe");
  23022   ck_assert_ptr_eq(icReplaceSCharO(self, "",'|',1), NULL);
  23023   // NULL old delimiter
  23024   ck_assert_ptr_eq(icReplaceSCharO(self, NULL,'|',1), NULL);
  23025   // NULL string
  23026   freeO(self);
  23027   ck_assert_ptr_eq(icReplaceSCharO(self, "##",'|',1), NULL);
  23028   terminateO(self);
  23029 
  23030 END_TEST
  23031 
  23032 
  23033 START_TEST(icReplaceCharCharSmallJsonT)
  23034 
  23035   smallJsont* r;
  23036   smallJsont *self = allocSmallJson();
  23037   setTopSO(self, "");
  23038 
  23039   // replace string, multiple character new delimeter
  23040   freeO(self);
  23041   setTopSO(self, "beeBeebad");
  23042   r = icReplaceCharCharO(self, 'b','^', 0);
  23043   ck_assert_ptr_ne(r, null);
  23044   char *s = toStringO(r);
  23045   ck_assert_str_eq(s, "^ee^ee^ad");
  23046   free(s);
  23047   // replace one time at the start of string
  23048   freeO(self);
  23049   setTopSO(self, "#ee#ee#ad");
  23050   r = icReplaceCharCharO(self, '#','^',1);
  23051   ck_assert_ptr_ne(r, null);
  23052   s = toStringO(r);
  23053   ck_assert_str_eq(s, "^ee#ee#ad");
  23054   free(s);
  23055   // replace one time
  23056   freeO(self);
  23057   setTopSO(self, "AA#ee##ee#");
  23058   r = icReplaceCharCharO(self, '#','|',1);
  23059   ck_assert_ptr_ne(r, null);
  23060   s = toStringO(r);
  23061   ck_assert_str_eq(s, "AA|ee##ee#");
  23062   free(s);
  23063   // empty string
  23064   freeO(self);
  23065   setTopSO(self, "");
  23066   r = icReplaceCharCharO(self, '#','^',1);
  23067   ck_assert_ptr_ne(r, null);
  23068   s = toStringO(r);
  23069   ck_assert_str_eq(s, "");
  23070   free(s);
  23071   // empty old delimiter
  23072   freeO(self);
  23073   setTopSO(self, "qwe");
  23074   ck_assert_ptr_eq(icReplaceCharCharO(self, 0,'|',1), NULL);
  23075   // NULL string
  23076   freeO(self);
  23077   ck_assert_ptr_eq(icReplaceCharCharO(self, '#','|',1), NULL);
  23078   terminateO(self);
  23079 
  23080 END_TEST
  23081 
  23082 
  23083 START_TEST(icReplaceSmallStringSmallStringSmallJsonT)
  23084 
  23085   smallJsont* r;
  23086   smallJsont *self = allocSmallJson();
  23087   setTopSO(self, "beebeebad");
  23088   smallStringt *olds = allocSmallString("");
  23089   smallStringt *news = allocSmallString("");
  23090 
  23091   // replace string, multiple character new delimeter
  23092   setValO(olds, "B");
  23093   setValO(news, "^^");
  23094   r = icReplaceSmallStringSmallStringO(self, olds, news, 0);
  23095   ck_assert_ptr_ne(r, null);
  23096   char *s = toStringO(r);
  23097   ck_assert_str_eq(s, "^^ee^^ee^^ad");
  23098   free(s);
  23099   // replace string, multiple character old delimeter
  23100   freeO(self);
  23101   setTopSO(self, "AA##ee##ee#");
  23102   setValO(olds, "##");
  23103   setValO(news, "|");
  23104   r = icReplaceSmallStringSmallStringO(self, olds, news, 0);
  23105   ck_assert_ptr_ne(r, null);
  23106   s = toStringO(r);
  23107   ck_assert_str_eq(s, "AA|ee|ee#");
  23108   free(s);
  23109   // replace one time at the start of string
  23110   freeO(self);
  23111   setTopSO(self, "#ee#ee#ad");
  23112   setValO(olds, "#");
  23113   setValO(news, "^^");
  23114   r = icReplaceSmallStringSmallStringO(self, olds, news,1);
  23115   ck_assert_ptr_ne(r, null);
  23116   s = toStringO(r);
  23117   ck_assert_str_eq(s, "^^ee#ee#ad");
  23118   free(s);
  23119   // replace one time
  23120   freeO(self);
  23121   setTopSO(self, "AA##ee##ee#");
  23122   setValO(olds, "##");
  23123   setValO(news, "|");
  23124   r = icReplaceSmallStringSmallStringO(self, olds, news,1);
  23125   ck_assert_ptr_ne(r, null);
  23126   s = toStringO(r);
  23127   ck_assert_str_eq(s, "AA|ee##ee#");
  23128   free(s);
  23129   // NULL new delimiter, one time: same as empty delimiter
  23130   freeO(self);
  23131   setTopSO(self, "AA##ee##ee#");
  23132   setValO(olds, "##");
  23133   r = icReplaceSmallStringSmallStringO(self, olds, NULL,1);
  23134   ck_assert_ptr_ne(r, null);
  23135   s = toStringO(r);
  23136   ck_assert_str_eq(s, "AAee##ee#");
  23137   free(s);
  23138   // non smallString object
  23139   terminateO(olds);
  23140   olds = (smallStringt*) allocSmallInt(1);
  23141   r = icReplaceSmallStringSmallStringO(self, olds, news,1);
  23142   ck_assert_ptr_eq(r, null);
  23143   terminateO(olds);
  23144   terminateO(news);
  23145   olds = allocSmallString("");
  23146   news = (smallStringt*) allocSmallInt(1);
  23147   r = icReplaceSmallStringSmallStringO(self, olds, news,1);
  23148   ck_assert_ptr_eq(r, null);
  23149   terminateO(news);
  23150   news = allocSmallString("");
  23151   // empty string
  23152   freeO(self);
  23153   setTopSO(self, "");
  23154   setValO(olds, "##");
  23155   r = icReplaceSmallStringSmallStringO(self, olds, NULL,1);
  23156   ck_assert_ptr_ne(r, null);
  23157   s = toStringO(r);
  23158   ck_assert_str_eq(s, "");
  23159   free(s);
  23160   // empty old delimiter
  23161   freeO(self);
  23162   setTopSO(self, "qwe");
  23163   setValO(olds, "");
  23164   setValO(news, "|");
  23165   ck_assert_ptr_eq(icReplaceSmallStringSmallStringO(self, olds, news,1), NULL);
  23166   // NULL old delimiter
  23167   ck_assert_ptr_eq(icReplaceSmallStringSmallStringO(self, NULL, news,1), NULL);
  23168   // NULL string
  23169   freeO(self);
  23170   ck_assert_ptr_eq(icReplaceSmallStringSmallStringO(self, olds, news,1), NULL);
  23171   terminateO(olds);
  23172   terminateO(news);
  23173   terminateO(self);
  23174 
  23175 END_TEST
  23176 
  23177 
  23178 START_TEST(icReplaceSmallStringSSmallJsonT)
  23179 
  23180   smallJsont* r;
  23181   smallJsont *self = allocSmallJson();
  23182   setTopSO(self, "beebeebad");
  23183   smallStringt *olds = allocSmallString("");
  23184   const char *news;
  23185 
  23186   // replace string, multiple character new delimeter
  23187   setValO(olds, "B");
  23188   news = "^^";
  23189   r = icReplaceSmallStringSO(self, olds, news, 0);
  23190   ck_assert_ptr_ne(r, null);
  23191   char *s = toStringO(r);
  23192   ck_assert_str_eq(s, "^^ee^^ee^^ad");
  23193   free(s);
  23194   // replace string, multiple character old delimeter
  23195   freeO(self);
  23196   setTopSO(self, "AA##ee##ee#");
  23197   setValO(olds, "##");
  23198   news = "|";
  23199   r = icReplaceSmallStringSO(self, olds, news, 0);
  23200   ck_assert_ptr_ne(r, null);
  23201   s = toStringO(r);
  23202   ck_assert_str_eq(s, "AA|ee|ee#");
  23203   free(s);
  23204   // replace one time at the start of string
  23205   freeO(self);
  23206   setTopSO(self, "#ee#ee#ad");
  23207   setValO(olds, "#");
  23208   news = "^^";
  23209   r = icReplaceSmallStringSO(self, olds, news,1);
  23210   ck_assert_ptr_ne(r, null);
  23211   s = toStringO(r);
  23212   ck_assert_str_eq(s, "^^ee#ee#ad");
  23213   free(s);
  23214   // replace one time
  23215   freeO(self);
  23216   setTopSO(self, "AA##ee##ee#");
  23217   setValO(olds, "##");
  23218   news = "|";
  23219   r = icReplaceSmallStringSO(self, olds, news,1);
  23220   ck_assert_ptr_ne(r, null);
  23221   s = toStringO(r);
  23222   ck_assert_str_eq(s, "AA|ee##ee#");
  23223   free(s);
  23224   // NULL new delimiter, one time: same as empty delimiter
  23225   freeO(self);
  23226   setTopSO(self, "AA##ee##ee#");
  23227   setValO(olds, "##");
  23228   r = icReplaceSmallStringSO(self, olds, NULL,1);
  23229   ck_assert_ptr_ne(r, null);
  23230   s = toStringO(r);
  23231   ck_assert_str_eq(s, "AAee##ee#");
  23232   free(s);
  23233   // non smallString object
  23234   terminateO(olds);
  23235   olds = (smallStringt*) allocSmallInt(1);
  23236   r = icReplaceSmallStringSO(self, olds, news,1);
  23237   ck_assert_ptr_eq(r, null);
  23238   terminateO(olds);
  23239   olds = allocSmallString("");
  23240   // empty string
  23241   freeO(self);
  23242   setTopSO(self, "");
  23243   setValO(olds, "##");
  23244   r = icReplaceSmallStringSO(self, olds, NULL,1);
  23245   ck_assert_ptr_ne(r, null);
  23246   s = toStringO(r);
  23247   ck_assert_str_eq(s, "");
  23248   free(s);
  23249   // empty old delimiter
  23250   freeO(self);
  23251   setTopSO(self, "qwe");
  23252   setValO(olds, "");
  23253   news = "|";
  23254   ck_assert_ptr_eq(icReplaceSmallStringSO(self, olds, news,1), NULL);
  23255   // NULL old delimiter
  23256   ck_assert_ptr_eq(icReplaceSmallStringSO(self, NULL, news,1), NULL);
  23257   // NULL string
  23258   freeO(self);
  23259   ck_assert_ptr_eq(icReplaceSmallStringSO(self, olds, news,1), NULL);
  23260   terminateO(olds);
  23261   terminateO(self);
  23262 
  23263 END_TEST
  23264 
  23265 
  23266 START_TEST(icReplaceSmallStringCharSmallJsonT)
  23267 
  23268   smallJsont* r;
  23269   smallJsont *self = allocSmallJson();
  23270   setTopSO(self, "beebeebad");
  23271   smallStringt *olds = allocSmallString("");
  23272   char news;
  23273 
  23274   // replace string, multiple character new delimeter
  23275   setValO(olds, "B");
  23276   news = '^';
  23277   r = icReplaceSmallStringCharO(self, olds, news, 0);
  23278   ck_assert_ptr_ne(r, null);
  23279   char *s = toStringO(r);
  23280   ck_assert_str_eq(s, "^ee^ee^ad");
  23281   free(s);
  23282   // replace string, multiple character old delimeter
  23283   freeO(self);
  23284   setTopSO(self, "AA##ee##ee#");
  23285   setValO(olds, "##");
  23286   news = '|';
  23287   r = icReplaceSmallStringCharO(self, olds, news, 0);
  23288   ck_assert_ptr_ne(r, null);
  23289   s = toStringO(r);
  23290   ck_assert_str_eq(s, "AA|ee|ee#");
  23291   free(s);
  23292   // replace one time at the start of string
  23293   freeO(self);
  23294   setTopSO(self, "#ee#ee#ad");
  23295   setValO(olds, "#");
  23296   news = '^';
  23297   r = icReplaceSmallStringCharO(self, olds, news,1);
  23298   ck_assert_ptr_ne(r, null);
  23299   s = toStringO(r);
  23300   ck_assert_str_eq(s, "^ee#ee#ad");
  23301   free(s);
  23302   // replace one time
  23303   freeO(self);
  23304   setTopSO(self, "AA##ee##ee#");
  23305   setValO(olds, "##");
  23306   news = '|';
  23307   r = icReplaceSmallStringCharO(self, olds, news,1);
  23308   ck_assert_ptr_ne(r, null);
  23309   s = toStringO(r);
  23310   ck_assert_str_eq(s, "AA|ee##ee#");
  23311   free(s);
  23312   // non smallString object
  23313   terminateO(olds);
  23314   olds = (smallStringt*) allocSmallInt(1);
  23315   r = icReplaceSmallStringCharO(self, olds, news,1);
  23316   ck_assert_ptr_eq(r, null);
  23317   terminateO(olds);
  23318   olds = allocSmallString("");
  23319   // empty string
  23320   freeO(self);
  23321   setTopSO(self, "");
  23322   setValO(olds, "##");
  23323   r = icReplaceSmallStringCharO(self, olds, news,1);
  23324   ck_assert_ptr_ne(r, null);
  23325   s = toStringO(r);
  23326   ck_assert_str_eq(s, "");
  23327   free(s);
  23328   // empty old delimiter
  23329   freeO(self);
  23330   setTopSO(self, "qwe");
  23331   setValO(olds, "");
  23332   news = '|';
  23333   ck_assert_ptr_eq(icReplaceSmallStringCharO(self, olds, news,1), NULL);
  23334   // NULL old delimiter
  23335   ck_assert_ptr_eq(icReplaceSmallStringCharO(self, NULL, news,1), NULL);
  23336   // NULL string
  23337   freeO(self);
  23338   ck_assert_ptr_eq(icReplaceSmallStringCharO(self, olds, news,1), NULL);
  23339   terminateO(olds);
  23340   terminateO(self);
  23341 
  23342 END_TEST
  23343 
  23344 
  23345 START_TEST(icReplaceSSmallStringSmallJsonT)
  23346 
  23347   smallJsont* r;
  23348   smallJsont *self = allocSmallJson();
  23349   setTopSO(self, "beebeebad");
  23350   const char *olds;
  23351   smallStringt *news = allocSmallString("");
  23352 
  23353   // replace string, multiple character new delimeter
  23354   olds = "B";
  23355   setValO(news, "^^");
  23356   r = icReplaceSSmallStringO(self, olds, news, 0);
  23357   ck_assert_ptr_ne(r, null);
  23358   char *s = toStringO(r);
  23359   ck_assert_str_eq(s, "^^ee^^ee^^ad");
  23360   free(s);
  23361   // replace string, multiple character old delimeter
  23362   freeO(self);
  23363   setTopSO(self, "AA##ee##ee#");
  23364   olds = "##";
  23365   setValO(news, "|");
  23366   r = icReplaceSSmallStringO(self, olds, news, 0);
  23367   ck_assert_ptr_ne(r, null);
  23368   s = toStringO(r);
  23369   ck_assert_str_eq(s, "AA|ee|ee#");
  23370   free(s);
  23371   // replace one time at the start of string
  23372   freeO(self);
  23373   setTopSO(self, "#ee#ee#ad");
  23374   olds = "#";
  23375   setValO(news, "^^");
  23376   r = icReplaceSSmallStringO(self, olds, news,1);
  23377   ck_assert_ptr_ne(r, null);
  23378   s = toStringO(r);
  23379   ck_assert_str_eq(s, "^^ee#ee#ad");
  23380   free(s);
  23381   // replace one time
  23382   freeO(self);
  23383   setTopSO(self, "AA##ee##ee#");
  23384   olds = "##";
  23385   setValO(news, "|");
  23386   r = icReplaceSSmallStringO(self, olds, news,1);
  23387   ck_assert_ptr_ne(r, null);
  23388   s = toStringO(r);
  23389   ck_assert_str_eq(s, "AA|ee##ee#");
  23390   free(s);
  23391   // NULL new delimiter, one time: same as empty delimiter
  23392   freeO(self);
  23393   setTopSO(self, "AA##ee##ee#");
  23394   olds = "##";
  23395   r = icReplaceSSmallStringO(self, olds, NULL,1);
  23396   ck_assert_ptr_ne(r, null);
  23397   s = toStringO(r);
  23398   ck_assert_str_eq(s, "AAee##ee#");
  23399   free(s);
  23400   // non smallString object
  23401   terminateO(news);
  23402   news = (smallStringt*) allocSmallInt(1);
  23403   r = icReplaceSSmallStringO(self, olds, news,1);
  23404   ck_assert_ptr_eq(r, null);
  23405   terminateO(news);
  23406   news = allocSmallString("");
  23407   // empty string
  23408   freeO(self);
  23409   setTopSO(self, "");
  23410   olds = "##";
  23411   r = icReplaceSSmallStringO(self, olds, NULL,1);
  23412   ck_assert_ptr_ne(r, null);
  23413   s = toStringO(r);
  23414   ck_assert_str_eq(s, "");
  23415   free(s);
  23416   // empty old delimiter
  23417   freeO(self);
  23418   setTopSO(self, "qwe");
  23419   olds = "";
  23420   setValO(news, "|");
  23421   ck_assert_ptr_eq(icReplaceSSmallStringO(self, olds, news,1), NULL);
  23422   // NULL old delimiter
  23423   ck_assert_ptr_eq(icReplaceSSmallStringO(self, NULL, news,1), NULL);
  23424   // NULL string
  23425   freeO(self);
  23426   ck_assert_ptr_eq(icReplaceSSmallStringO(self, olds, news,1), NULL);
  23427   terminateO(news);
  23428   terminateO(self);
  23429 
  23430 END_TEST
  23431 
  23432 
  23433 START_TEST(icReplaceCharSmallStringSmallJsonT)
  23434 
  23435   smallJsont* r;
  23436   smallJsont *self = allocSmallJson();
  23437   setTopSO(self, "beebeebad");
  23438   char olds;
  23439   smallStringt *news = allocSmallString("");
  23440 
  23441   // replace string, multiple character new delimeter
  23442   olds = 'B';
  23443   setValO(news, "^^");
  23444   r = icReplaceCharSmallStringO(self, olds, news, 0);
  23445   ck_assert_ptr_ne(r, null);
  23446   char *s = toStringO(r);
  23447   ck_assert_str_eq(s, "^^ee^^ee^^ad");
  23448   free(s);
  23449   // replace string, multiple character old delimeter
  23450   freeO(self);
  23451   setTopSO(self, "AA#ee#ee");
  23452   olds = '#';
  23453   setValO(news, "|");
  23454   r = icReplaceCharSmallStringO(self, olds, news, 0);
  23455   ck_assert_ptr_ne(r, null);
  23456   s = toStringO(r);
  23457   ck_assert_str_eq(s, "AA|ee|ee");
  23458   free(s);
  23459   // replace one time at the start of string
  23460   freeO(self);
  23461   setTopSO(self, "#ee#ee#ad");
  23462   olds = '#';
  23463   setValO(news, "^^");
  23464   r = icReplaceCharSmallStringO(self, olds, news,1);
  23465   ck_assert_ptr_ne(r, null);
  23466   s = toStringO(r);
  23467   ck_assert_str_eq(s, "^^ee#ee#ad");
  23468   free(s);
  23469   // replace one time
  23470   freeO(self);
  23471   setTopSO(self, "AA#ee##ee#");
  23472   olds = '#';
  23473   setValO(news, "|");
  23474   r = icReplaceCharSmallStringO(self, olds, news,1);
  23475   ck_assert_ptr_ne(r, null);
  23476   s = toStringO(r);
  23477   ck_assert_str_eq(s, "AA|ee##ee#");
  23478   free(s);
  23479   // NULL new delimiter, one time: same as empty delimiter
  23480   freeO(self);
  23481   setTopSO(self, "AA#ee##ee#");
  23482   olds = '#';
  23483   r = icReplaceCharSmallStringO(self, olds, NULL,1);
  23484   ck_assert_ptr_ne(r, null);
  23485   s = toStringO(r);
  23486   ck_assert_str_eq(s, "AAee##ee#");
  23487   free(s);
  23488   // non smallString object
  23489   terminateO(news);
  23490   news = (smallStringt*) allocSmallInt(1);
  23491   r = icReplaceCharSmallStringO(self, olds, news,1);
  23492   ck_assert_ptr_eq(r, null);
  23493   terminateO(news);
  23494   news = allocSmallString("");
  23495   // empty string
  23496   freeO(self);
  23497   setTopSO(self, "");
  23498   olds = '#';
  23499   r = icReplaceCharSmallStringO(self, olds, NULL,1);
  23500   ck_assert_ptr_ne(r, null);
  23501   s = toStringO(r);
  23502   ck_assert_str_eq(s, "");
  23503   free(s);
  23504   // NULL string
  23505   freeO(self);
  23506   setValO(news, "|");
  23507   ck_assert_ptr_eq(icReplaceCharSmallStringO(self, olds, news,1), NULL);
  23508   terminateO(news);
  23509   terminateO(self);
  23510 
  23511 END_TEST
  23512 
  23513 
  23514 START_TEST(icReplaceJsonJsonSmallJsonT)
  23515 
  23516   smallJsont* r;
  23517   smallJsont *self = allocSmallJson();
  23518   setTopSO(self, "BeebeeBad");
  23519   smallJsont *olds = allocSmallJson();
  23520   smallJsont *news = allocSmallJson();
  23521 
  23522   // replace string, multiple character new delimeter
  23523   freeO(olds);
  23524   freeO(news);
  23525   setTopSO(olds, "B");
  23526   setTopSO(news, "^^");
  23527   r = icReplaceJsonJsonO(self, olds, news, 0);
  23528   ck_assert_ptr_ne(r, null);
  23529   char *s = toStringO(r);
  23530   ck_assert_str_eq(s, "^^ee^^ee^^ad");
  23531   free(s);
  23532   // replace string, multiple character old delimeter
  23533   freeO(self);
  23534   setTopSO(self, "AA##ee##ee#");
  23535   freeO(olds);
  23536   freeO(news);
  23537   setTopSO(olds, "##");
  23538   setTopSO(news, "|");
  23539   r = icReplaceJsonJsonO(self, olds, news, 0);
  23540   ck_assert_ptr_ne(r, null);
  23541   s = toStringO(r);
  23542   ck_assert_str_eq(s, "AA|ee|ee#");
  23543   free(s);
  23544   // replace one time at the start of string
  23545   freeO(self);
  23546   setTopSO(self, "#ee#ee#ad");
  23547   freeO(olds);
  23548   freeO(news);
  23549   setTopSO(olds, "#");
  23550   setTopSO(news, "^^");
  23551   r = icReplaceJsonJsonO(self, olds, news,1);
  23552   ck_assert_ptr_ne(r, null);
  23553   s = toStringO(r);
  23554   ck_assert_str_eq(s, "^^ee#ee#ad");
  23555   free(s);
  23556   // replace one time
  23557   freeO(self);
  23558   setTopSO(self, "AA##ee##ee#");
  23559   freeO(olds);
  23560   freeO(news);
  23561   setTopSO(olds, "##");
  23562   setTopSO(news, "|");
  23563   r = icReplaceJsonJsonO(self, olds, news,1);
  23564   ck_assert_ptr_ne(r, null);
  23565   s = toStringO(r);
  23566   ck_assert_str_eq(s, "AA|ee##ee#");
  23567   free(s);
  23568   // NULL new delimiter, one time: same as empty delimiter
  23569   freeO(self);
  23570   setTopSO(self, "AA##ee##ee#");
  23571   freeO(olds);
  23572   setTopSO(olds, "##");
  23573   r = icReplaceJsonJsonO(self, olds, NULL,1);
  23574   ck_assert_ptr_ne(r, null);
  23575   s = toStringO(r);
  23576   ck_assert_str_eq(s, "AAee##ee#");
  23577   free(s);
  23578   // non json string
  23579   freeO(olds);
  23580   setTopIntO(olds, 1);
  23581   r = icReplaceJsonJsonO(self, olds, news,1);
  23582   ck_assert_ptr_eq(r, null);
  23583   freeO(olds);
  23584   freeO(news);
  23585   setTopSO(olds, "e");
  23586   setTopIntO(news, 1);
  23587   r = icReplaceJsonJsonO(self, olds, news,1);
  23588   ck_assert_ptr_eq(r, null);
  23589   // non json object
  23590   terminateO(olds);
  23591   olds = (smallJsont*) allocSmallInt(1);
  23592   r = icReplaceJsonJsonO(self, olds, news,1);
  23593   ck_assert_ptr_eq(r, null);
  23594   terminateO(olds);
  23595   terminateO(news);
  23596   olds = allocSmallJson();
  23597   news = (smallJsont*) allocSmallInt(1);
  23598   r = icReplaceJsonJsonO(self, olds, news,1);
  23599   ck_assert_ptr_eq(r, null);
  23600   terminateO(news);
  23601   news = allocSmallJson();
  23602   // empty string
  23603   freeO(self);
  23604   setTopSO(self, "");
  23605   freeO(olds);
  23606   setTopSO(olds, "##");
  23607   r = icReplaceJsonJsonO(self, olds, NULL,1);
  23608   ck_assert_ptr_ne(r, null);
  23609   s = toStringO(r);
  23610   ck_assert_str_eq(s, "");
  23611   free(s);
  23612   // empty old delimiter
  23613   freeO(self);
  23614   setTopSO(self, "qwe");
  23615   freeO(olds);
  23616   freeO(news);
  23617   setTopSO(olds, "");
  23618   setTopSO(news, "|");
  23619   ck_assert_ptr_eq(icReplaceJsonJsonO(self, olds, news,1), NULL);
  23620   // NULL old delimiter
  23621   ck_assert_ptr_eq(icReplaceJsonJsonO(self, NULL, news,1), NULL);
  23622   // NULL string
  23623   freeO(self);
  23624   ck_assert_ptr_eq(icReplaceJsonJsonO(self, olds, news,1), NULL);
  23625   terminateO(olds);
  23626   terminateO(news);
  23627   terminateO(self);
  23628 
  23629 END_TEST
  23630 
  23631 
  23632 START_TEST(icReplaceJsonSmallStringSmallJsonT)
  23633 
  23634   smallJsont* r;
  23635   smallJsont *self = allocSmallJson();
  23636   setTopSO(self, "BeebeeBad");
  23637   smallJsont *olds   = allocSmallJson();
  23638   smallStringt *news = allocSmallString("");
  23639 
  23640   // replace string, multiple character new delimeter
  23641   freeO(olds);
  23642   setTopSO(olds, "B");
  23643   setValO(news, "^^");
  23644   r = icReplaceJsonSmallStringO(self, olds, news, 0);
  23645   ck_assert_ptr_ne(r, null);
  23646   char *s = toStringO(r);
  23647   ck_assert_str_eq(s, "^^ee^^ee^^ad");
  23648   free(s);
  23649   // replace string, multiple character old delimeter
  23650   freeO(self);
  23651   setTopSO(self, "AA##ee##ee#");
  23652   freeO(olds);
  23653   setTopSO(olds, "##");
  23654   setValO(news, "|");
  23655   r = icReplaceJsonSmallStringO(self, olds, news, 0);
  23656   ck_assert_ptr_ne(r, null);
  23657   s = toStringO(r);
  23658   ck_assert_str_eq(s, "AA|ee|ee#");
  23659   free(s);
  23660   // replace one time at the start of string
  23661   freeO(self);
  23662   setTopSO(self, "#ee#ee#ad");
  23663   freeO(olds);
  23664   setTopSO(olds, "#");
  23665   setValO(news, "^^");
  23666   r = icReplaceJsonSmallStringO(self, olds, news,1);
  23667   ck_assert_ptr_ne(r, null);
  23668   s = toStringO(r);
  23669   ck_assert_str_eq(s, "^^ee#ee#ad");
  23670   free(s);
  23671   // replace one time
  23672   freeO(self);
  23673   setTopSO(self, "AA##ee##ee#");
  23674   freeO(olds);
  23675   setTopSO(olds, "##");
  23676   setValO(news, "|");
  23677   r = icReplaceJsonSmallStringO(self, olds, news,1);
  23678   ck_assert_ptr_ne(r, null);
  23679   s = toStringO(r);
  23680   ck_assert_str_eq(s, "AA|ee##ee#");
  23681   free(s);
  23682   // NULL new delimiter, one time: same as empty delimiter
  23683   freeO(self);
  23684   setTopSO(self, "AA##ee##ee#");
  23685   freeO(olds);
  23686   setTopSO(olds, "##");
  23687   r = icReplaceJsonSmallStringO(self, olds, NULL,1);
  23688   ck_assert_ptr_ne(r, null);
  23689   s = toStringO(r);
  23690   ck_assert_str_eq(s, "AAee##ee#");
  23691   free(s);
  23692   // non json string
  23693   freeO(olds);
  23694   setTopIntO(olds, 1);
  23695   r = icReplaceJsonSmallStringO(self, olds, news,1);
  23696   ck_assert_ptr_eq(r, null);
  23697   // non json object
  23698   terminateO(olds);
  23699   olds = (smallJsont*) allocSmallInt(1);
  23700   r = icReplaceJsonSmallStringO(self, olds, news,1);
  23701   ck_assert_ptr_eq(r, null);
  23702   terminateO(olds);
  23703   terminateO(news);
  23704   olds = allocSmallJson();
  23705   news = (smallStringt*) allocSmallInt(1);
  23706   r = icReplaceJsonSmallStringO(self, olds, news,1);
  23707   ck_assert_ptr_eq(r, null);
  23708   terminateO(news);
  23709   news = allocSmallString("");
  23710   // empty string
  23711   freeO(self);
  23712   setTopSO(self, "");
  23713   freeO(olds);
  23714   setTopSO(olds, "##");
  23715   r = icReplaceJsonSmallStringO(self, olds, NULL,1);
  23716   ck_assert_ptr_ne(r, null);
  23717   s = toStringO(r);
  23718   ck_assert_str_eq(s, "");
  23719   free(s);
  23720   // empty old delimiter
  23721   freeO(self);
  23722   setTopSO(self, "qwe");
  23723   freeO(olds);
  23724   setTopSO(olds, "");
  23725   setValO(news, "|");
  23726   ck_assert_ptr_eq(icReplaceJsonSmallStringO(self, olds, news,1), NULL);
  23727   // NULL old delimiter
  23728   ck_assert_ptr_eq(icReplaceJsonSmallStringO(self, NULL, news,1), NULL);
  23729   // NULL string
  23730   freeO(self);
  23731   ck_assert_ptr_eq(icReplaceJsonSmallStringO(self, olds, news,1), NULL);
  23732   terminateO(olds);
  23733   terminateO(news);
  23734   terminateO(self);
  23735 
  23736 END_TEST
  23737 
  23738 
  23739 START_TEST(icReplaceJsonSSmallJsonT)
  23740 
  23741   smallJsont* r;
  23742   smallJsont *self = allocSmallJson();
  23743   setTopSO(self, "BeebeeBad");
  23744   smallJsont *olds   = allocSmallJson();
  23745   const char *news;
  23746 
  23747   // replace string, multiple character new delimeter
  23748   freeO(olds);
  23749   setTopSO(olds, "b");
  23750   news = "^^";
  23751   r = icReplaceJsonSO(self, olds, news, 0);
  23752   ck_assert_ptr_ne(r, null);
  23753   char *s = toStringO(r);
  23754   ck_assert_str_eq(s, "^^ee^^ee^^ad");
  23755   free(s);
  23756   // replace string, multiple character old delimeter
  23757   freeO(self);
  23758   setTopSO(self, "AA##ee##ee#");
  23759   freeO(olds);
  23760   setTopSO(olds, "##");
  23761   news = "|";
  23762   r = icReplaceJsonSO(self, olds, news, 0);
  23763   ck_assert_ptr_ne(r, null);
  23764   s = toStringO(r);
  23765   ck_assert_str_eq(s, "AA|ee|ee#");
  23766   free(s);
  23767   // replace one time at the start of string
  23768   freeO(self);
  23769   setTopSO(self, "#ee#ee#ad");
  23770   freeO(olds);
  23771   setTopSO(olds, "#");
  23772   news = "^^";
  23773   r = icReplaceJsonSO(self, olds, news,1);
  23774   ck_assert_ptr_ne(r, null);
  23775   s = toStringO(r);
  23776   ck_assert_str_eq(s, "^^ee#ee#ad");
  23777   free(s);
  23778   // replace one time
  23779   freeO(self);
  23780   setTopSO(self, "AA##ee##ee#");
  23781   freeO(olds);
  23782   setTopSO(olds, "##");
  23783   news = "|";
  23784   r = icReplaceJsonSO(self, olds, news,1);
  23785   ck_assert_ptr_ne(r, null);
  23786   s = toStringO(r);
  23787   ck_assert_str_eq(s, "AA|ee##ee#");
  23788   free(s);
  23789   // NULL new delimiter, one time: same as empty delimiter
  23790   freeO(self);
  23791   setTopSO(self, "AA##ee##ee#");
  23792   freeO(olds);
  23793   setTopSO(olds, "##");
  23794   r = icReplaceJsonSO(self, olds, NULL,1);
  23795   ck_assert_ptr_ne(r, null);
  23796   s = toStringO(r);
  23797   ck_assert_str_eq(s, "AAee##ee#");
  23798   free(s);
  23799   // non json string
  23800   freeO(olds);
  23801   setTopIntO(olds, 1);
  23802   r = icReplaceJsonSO(self, olds, news,1);
  23803   ck_assert_ptr_eq(r, null);
  23804   // non json object
  23805   terminateO(olds);
  23806   olds = (smallJsont*) allocSmallInt(1);
  23807   r = icReplaceJsonSO(self, olds, news,1);
  23808   ck_assert_ptr_eq(r, null);
  23809   terminateO(olds);
  23810   // empty string
  23811   olds = allocSmallJson();
  23812   freeO(self);
  23813   setTopSO(self, "");
  23814   setTopSO(olds, "##");
  23815   r = icReplaceJsonSO(self, olds, NULL,1);
  23816   ck_assert_ptr_ne(r, null);
  23817   s = toStringO(r);
  23818   ck_assert_str_eq(s, "");
  23819   free(s);
  23820   // empty old delimiter
  23821   freeO(self);
  23822   setTopSO(self, "qwe");
  23823   freeO(olds);
  23824   setTopSO(olds, "");
  23825   news = "|";
  23826   ck_assert_ptr_eq(icReplaceJsonSO(self, olds, news,1), NULL);
  23827   // NULL old delimiter
  23828   ck_assert_ptr_eq(icReplaceJsonSO(self, NULL, news,1), NULL);
  23829   // NULL string
  23830   freeO(self);
  23831   ck_assert_ptr_eq(icReplaceJsonSO(self, olds, news,1), NULL);
  23832   terminateO(olds);
  23833   terminateO(self);
  23834 
  23835 END_TEST
  23836 
  23837 
  23838 START_TEST(icReplaceJsonCharSmallJsonT)
  23839 
  23840   smallJsont* r;
  23841   smallJsont *self = allocSmallJson();
  23842   setTopSO(self, "beeBeebad");
  23843   smallJsont *olds   = allocSmallJson();
  23844   char news;
  23845 
  23846   // replace string, multiple character new delimeter
  23847   freeO(olds);
  23848   setTopSO(olds, "B");
  23849   news = '^';
  23850   r = icReplaceJsonCharO(self, olds, news, 0);
  23851   ck_assert_ptr_ne(r, null);
  23852   char *s = toStringO(r);
  23853   ck_assert_str_eq(s, "^ee^ee^ad");
  23854   free(s);
  23855   // replace string, multiple character old delimeter
  23856   freeO(self);
  23857   setTopSO(self, "AA##ee##ee#");
  23858   freeO(olds);
  23859   setTopSO(olds, "##");
  23860   news = '|';
  23861   r = icReplaceJsonCharO(self, olds, news, 0);
  23862   ck_assert_ptr_ne(r, null);
  23863   s = toStringO(r);
  23864   ck_assert_str_eq(s, "AA|ee|ee#");
  23865   free(s);
  23866   // replace one time at the start of string
  23867   freeO(self);
  23868   setTopSO(self, "#ee#ee#ad");
  23869   freeO(olds);
  23870   setTopSO(olds, "#");
  23871   news = '^';
  23872   r = icReplaceJsonCharO(self, olds, news,1);
  23873   ck_assert_ptr_ne(r, null);
  23874   s = toStringO(r);
  23875   ck_assert_str_eq(s, "^ee#ee#ad");
  23876   free(s);
  23877   // replace one time
  23878   freeO(self);
  23879   setTopSO(self, "AA##ee##ee#");
  23880   freeO(olds);
  23881   setTopSO(olds, "##");
  23882   news = '|';
  23883   r = icReplaceJsonCharO(self, olds, news,1);
  23884   ck_assert_ptr_ne(r, null);
  23885   s = toStringO(r);
  23886   ck_assert_str_eq(s, "AA|ee##ee#");
  23887   free(s);
  23888   // non json string
  23889   freeO(self);
  23890   setTopSO(self, "AA##ee##ee#");
  23891   freeO(olds);
  23892   setTopIntO(olds, 1);
  23893   r = icReplaceJsonCharO(self, olds, news,1);
  23894   ck_assert_ptr_eq(r, null);
  23895   // non json object
  23896   terminateO(olds);
  23897   olds = (smallJsont*) allocSmallInt(1);
  23898   r = icReplaceJsonCharO(self, olds, news,1);
  23899   ck_assert_ptr_eq(r, null);
  23900   terminateO(olds);
  23901   // empty string
  23902   olds = allocSmallJson();
  23903   freeO(self);
  23904   setTopSO(self, "");
  23905   setTopSO(olds, "##");
  23906   r = icReplaceJsonCharO(self, olds, news,1);
  23907   ck_assert_ptr_ne(r, null);
  23908   s = toStringO(r);
  23909   ck_assert_str_eq(s, "");
  23910   free(s);
  23911   // empty old delimiter
  23912   freeO(self);
  23913   setTopSO(self, "qwe");
  23914   freeO(olds);
  23915   setTopSO(olds, "");
  23916   news = '|';
  23917   ck_assert_ptr_eq(icReplaceJsonCharO(self, olds, news,1), NULL);
  23918   // NULL old delimiter
  23919   ck_assert_ptr_eq(icReplaceJsonCharO(self, NULL, news,1), NULL);
  23920   // NULL string
  23921   freeO(self);
  23922   ck_assert_ptr_eq(icReplaceJsonCharO(self, olds, news,1), NULL);
  23923   terminateO(olds);
  23924   terminateO(self);
  23925 
  23926 END_TEST
  23927 
  23928 
  23929 START_TEST(icReplaceSmallStringJsonSmallJsonT)
  23930 
  23931   smallJsont* r;
  23932   smallJsont *self = allocSmallJson();
  23933   setTopSO(self, "BeeBeeBad");
  23934   smallStringt *olds = allocSmallString("");
  23935   smallJsont *news   = allocSmallJson();
  23936 
  23937   // replace string, multiple character new delimeter
  23938   freeO(news);
  23939   setValO(olds, "b");
  23940   setTopSO(news, "^^");
  23941   r = self->f->icReplaceSmallStringJson(self, olds, news, 0);
  23942   ck_assert_ptr_ne(r, null);
  23943   char *s = toStringO(r);
  23944   ck_assert_str_eq(s, "^^ee^^ee^^ad");
  23945   free(s);
  23946   // replace string, multiple character old delimeter
  23947   freeO(self);
  23948   setTopSO(self, "AA##ee##ee#");
  23949   freeO(news);
  23950   setValO(olds, "##");
  23951   setTopSO(news, "|");
  23952   r = self->f->icReplaceSmallStringJson(self, olds, news, 0);
  23953   ck_assert_ptr_ne(r, null);
  23954   s = toStringO(r);
  23955   ck_assert_str_eq(s, "AA|ee|ee#");
  23956   free(s);
  23957   // replace one time at the start of string
  23958   freeO(self);
  23959   setTopSO(self, "#ee#ee#ad");
  23960   freeO(news);
  23961   setValO(olds, "#");
  23962   setTopSO(news, "^^");
  23963   r = self->f->icReplaceSmallStringJson(self, olds, news,1);
  23964   ck_assert_ptr_ne(r, null);
  23965   s = toStringO(r);
  23966   ck_assert_str_eq(s, "^^ee#ee#ad");
  23967   free(s);
  23968   // replace one time
  23969   freeO(self);
  23970   setTopSO(self, "AA##ee##ee#");
  23971   freeO(news);
  23972   setValO(olds, "##");
  23973   setTopSO(news, "|");
  23974   r = self->f->icReplaceSmallStringJson(self, olds, news,1);
  23975   ck_assert_ptr_ne(r, null);
  23976   s = toStringO(r);
  23977   ck_assert_str_eq(s, "AA|ee##ee#");
  23978   free(s);
  23979   // NULL new delimiter, one time: same as empty delimiter
  23980   freeO(self);
  23981   setTopSO(self, "AA##ee##ee#");
  23982   setValO(olds, "##");
  23983   r = self->f->icReplaceSmallStringJson(self, olds, NULL,1);
  23984   ck_assert_ptr_ne(r, null);
  23985   s = toStringO(r);
  23986   ck_assert_str_eq(s, "AAee##ee#");
  23987   free(s);
  23988   // non json string
  23989   freeO(news);
  23990   setTopIntO(news, 1);
  23991   r = self->f->icReplaceSmallStringJson(self, olds, news,1);
  23992   ck_assert_ptr_eq(r, null);
  23993   // non json object
  23994   terminateO(olds);
  23995   olds = (smallStringt*) allocSmallInt(1);
  23996   r = self->f->icReplaceSmallStringJson(self, olds, news,1);
  23997   ck_assert_ptr_eq(r, null);
  23998   terminateO(olds);
  23999   terminateO(news);
  24000   olds = allocSmallString("");
  24001   news = (smallJsont*) allocSmallInt(1);
  24002   r = self->f->icReplaceSmallStringJson(self, olds, news,1);
  24003   ck_assert_ptr_eq(r, null);
  24004   terminateO(news);
  24005   news = allocSmallJson();
  24006   // empty string
  24007   freeO(self);
  24008   setTopSO(self, "");
  24009   setValO(olds, "##");
  24010   r = self->f->icReplaceSmallStringJson(self, olds, NULL,1);
  24011   ck_assert_ptr_ne(r, null);
  24012   s = toStringO(r);
  24013   ck_assert_str_eq(s, "");
  24014   free(s);
  24015   // empty old delimiter
  24016   freeO(self);
  24017   setTopSO(self, "qwe");
  24018   freeO(news);
  24019   setValO(olds, "");
  24020   setTopSO(news, "|");
  24021   ck_assert_ptr_eq(self->f->icReplaceSmallStringJson(self, olds, news,1), NULL);
  24022   // NULL old delimiter
  24023   ck_assert_ptr_eq(self->f->icReplaceSmallStringJson(self, NULL, news,1), NULL);
  24024   // NULL string
  24025   freeO(self);
  24026   ck_assert_ptr_eq(self->f->icReplaceSmallStringJson(self, olds, news,1), NULL);
  24027   terminateO(olds);
  24028   terminateO(news);
  24029   terminateO(self);
  24030 
  24031 END_TEST
  24032 
  24033 
  24034 START_TEST(icReplaceSJsonSmallJsonT)
  24035 
  24036   smallJsont* r;
  24037   smallJsont *self = allocSmallJson();
  24038   setTopSO(self, "beebeebad");
  24039   const char *olds;
  24040   smallJsont *news   = allocSmallJson();
  24041 
  24042   // replace string, multiple character new delimeter
  24043   freeO(news);
  24044   olds = "B";
  24045   setTopSO(news, "^^");
  24046   r = icReplaceSJsonO(self, olds, news, 0);
  24047   ck_assert_ptr_ne(r, null);
  24048   char *s = toStringO(r);
  24049   ck_assert_str_eq(s, "^^ee^^ee^^ad");
  24050   free(s);
  24051   // replace string, multiple character old delimeter
  24052   freeO(self);
  24053   setTopSO(self, "AA##ee##ee#");
  24054   freeO(news);
  24055   olds = "##";
  24056   setTopSO(news, "|");
  24057   r = icReplaceSJsonO(self, olds, news, 0);
  24058   ck_assert_ptr_ne(r, null);
  24059   s = toStringO(r);
  24060   ck_assert_str_eq(s, "AA|ee|ee#");
  24061   free(s);
  24062   // replace one time at the start of string
  24063   freeO(self);
  24064   setTopSO(self, "#ee#ee#ad");
  24065   freeO(news);
  24066   olds = "#";
  24067   setTopSO(news, "^^");
  24068   r = icReplaceSJsonO(self, olds, news,1);
  24069   ck_assert_ptr_ne(r, null);
  24070   s = toStringO(r);
  24071   ck_assert_str_eq(s, "^^ee#ee#ad");
  24072   free(s);
  24073   // replace one time
  24074   freeO(self);
  24075   setTopSO(self, "AA##ee##ee#");
  24076   freeO(news);
  24077   olds = "##";
  24078   setTopSO(news, "|");
  24079   r = icReplaceSJsonO(self, olds, news,1);
  24080   ck_assert_ptr_ne(r, null);
  24081   s = toStringO(r);
  24082   ck_assert_str_eq(s, "AA|ee##ee#");
  24083   free(s);
  24084   // NULL new delimiter, one time: same as empty delimiter
  24085   freeO(self);
  24086   setTopSO(self, "AA##ee##ee#");
  24087   olds = "##";
  24088   r = icReplaceSJsonO(self, olds, NULL,1);
  24089   ck_assert_ptr_ne(r, null);
  24090   s = toStringO(r);
  24091   ck_assert_str_eq(s, "AAee##ee#");
  24092   free(s);
  24093   // non json string
  24094   freeO(news);
  24095   olds = "e";
  24096   setTopIntO(news, 1);
  24097   r = icReplaceSJsonO(self, olds, news,1);
  24098   ck_assert_ptr_eq(r, null);
  24099   // non json object
  24100   terminateO(news);
  24101   news = (smallJsont*) allocSmallInt(1);
  24102   r = icReplaceSJsonO(self, olds, news,1);
  24103   ck_assert_ptr_eq(r, null);
  24104   terminateO(news);
  24105   news = allocSmallJson();
  24106   // empty string
  24107   freeO(self);
  24108   setTopSO(self, "");
  24109   olds = "##";
  24110   r = icReplaceSJsonO(self, olds, NULL,1);
  24111   ck_assert_ptr_ne(r, null);
  24112   s = toStringO(r);
  24113   ck_assert_str_eq(s, "");
  24114   free(s);
  24115   // empty old delimiter
  24116   freeO(self);
  24117   setTopSO(self, "qwe");
  24118   freeO(news);
  24119   olds = "";
  24120   setTopSO(news, "|");
  24121   ck_assert_ptr_eq(icReplaceSJsonO(self, olds, news,1), NULL);
  24122   // NULL old delimiter
  24123   ck_assert_ptr_eq(icReplaceSJsonO(self, NULL, news,1), NULL);
  24124   // NULL string
  24125   freeO(self);
  24126   ck_assert_ptr_eq(icReplaceSJsonO(self, olds, news,1), NULL);
  24127   terminateO(news);
  24128   terminateO(self);
  24129 
  24130 END_TEST
  24131 
  24132 
  24133 START_TEST(icReplaceCharJsonSmallJsonT)
  24134 
  24135   smallJsont* r;
  24136   smallJsont *self = allocSmallJson();
  24137   setTopSO(self, "beebeebad");
  24138   char olds;
  24139   smallJsont *news   = allocSmallJson();
  24140 
  24141   // replace string, multiple character new delimeter
  24142   freeO(news);
  24143   olds = 'B';
  24144   setTopSO(news, "^^");
  24145   r = icReplaceCharJsonO(self, olds, news, 0);
  24146   ck_assert_ptr_ne(r, null);
  24147   char *s = toStringO(r);
  24148   ck_assert_str_eq(s, "^^ee^^ee^^ad");
  24149   free(s);
  24150   // replace string, multiple character old delimeter
  24151   freeO(self);
  24152   setTopSO(self, "AA#ee#ee");
  24153   freeO(news);
  24154   olds = '#';
  24155   setTopSO(news, "|");
  24156   r = icReplaceCharJsonO(self, olds, news, 0);
  24157   ck_assert_ptr_ne(r, null);
  24158   s = toStringO(r);
  24159   ck_assert_str_eq(s, "AA|ee|ee");
  24160   free(s);
  24161   // replace one time at the start of string
  24162   freeO(self);
  24163   setTopSO(self, "#ee#ee#ad");
  24164   freeO(news);
  24165   olds = '#';
  24166   setTopSO(news, "^^");
  24167   r = icReplaceCharJsonO(self, olds, news,1);
  24168   ck_assert_ptr_ne(r, null);
  24169   s = toStringO(r);
  24170   ck_assert_str_eq(s, "^^ee#ee#ad");
  24171   free(s);
  24172   // replace one time
  24173   freeO(self);
  24174   setTopSO(self, "AA#ee##ee#");
  24175   freeO(news);
  24176   olds = '#';
  24177   setTopSO(news, "|");
  24178   r = icReplaceCharJsonO(self, olds, news,1);
  24179   ck_assert_ptr_ne(r, null);
  24180   s = toStringO(r);
  24181   ck_assert_str_eq(s, "AA|ee##ee#");
  24182   free(s);
  24183   // NULL new delimiter, one time: same as empty delimiter
  24184   freeO(self);
  24185   setTopSO(self, "AA#ee##ee#");
  24186   olds = '#';
  24187   r = icReplaceCharJsonO(self, olds, NULL,1);
  24188   ck_assert_ptr_ne(r, null);
  24189   s = toStringO(r);
  24190   ck_assert_str_eq(s, "AAee##ee#");
  24191   free(s);
  24192   // non json string
  24193   freeO(news);
  24194   olds = 'e';
  24195   setTopIntO(news, 1);
  24196   r = icReplaceCharJsonO(self, olds, news,1);
  24197   ck_assert_ptr_eq(r, null);
  24198   // non json object
  24199   terminateO(news);
  24200   news = (smallJsont*) allocSmallInt(1);
  24201   r = icReplaceCharJsonO(self, olds, news,1);
  24202   ck_assert_ptr_eq(r, null);
  24203   terminateO(news);
  24204   news = allocSmallJson();
  24205   // empty string
  24206   freeO(self);
  24207   setTopSO(self, "");
  24208   olds = '#';
  24209   r = icReplaceCharJsonO(self, olds, NULL,1);
  24210   ck_assert_ptr_ne(r, null);
  24211   s = toStringO(r);
  24212   ck_assert_str_eq(s, "");
  24213   free(s);
  24214   // NULL string
  24215   freeO(self);
  24216   freeO(news);
  24217   setTopSO(news, "|");
  24218   ck_assert_ptr_eq(icReplaceCharJsonO(self, olds, news,1), NULL);
  24219   terminateO(news);
  24220   terminateO(self);
  24221 
  24222 END_TEST
  24223 
  24224 
  24225 START_TEST(icReplaceManySmallJsonT)
  24226 
  24227   smallJsont* r;
  24228   smallJsont *self = allocSmallJson();
  24229   setTopSO(self, "");
  24230 
  24231   // replace string, multiple character new delimeter
  24232   freeO(self);
  24233   setTopSO(self, "beebeebad");
  24234   r = icReplaceManyO(self, "B","^^","aD","AD");
  24235   ck_assert_ptr_ne(r, null);
  24236   char *s = toStringO(r);
  24237   ck_assert_str_eq(s, "^^ee^^ee^^AD");
  24238   free(s);
  24239   // replace string, empty new delimeter
  24240   freeO(self);
  24241   setTopSO(self, "#ee#ee#ad");
  24242   r = icReplaceManyO(self, "#","","ad","AD");
  24243   ck_assert_ptr_ne(r, null);
  24244   s = toStringO(r);
  24245   ck_assert_str_eq(s, "eeeeAD");
  24246   free(s);
  24247   // not enough olds:news pairs
  24248   freeO(self);
  24249   setTopSO(self, "#ee#ee#ad");
  24250   r = icReplaceManyO(self, "#","","ad");
  24251   ck_assert_ptr_ne(r, null);
  24252   s = toStringO(r);
  24253   ck_assert_str_eq(s, "eeeead");
  24254   free(s);
  24255   // NULL new delimiter: same as only 2 parameters or not enough olds:news pairs
  24256   freeO(self);
  24257   setTopSO(self, "AA##ee##ee#");
  24258   r = icReplaceManyO(self, "##",NULL);
  24259   ck_assert_ptr_eq(r, null);
  24260   // empty string
  24261   freeO(self);
  24262   setTopSO(self, "");
  24263   r = icReplaceManyO(self, "##", "");
  24264   ck_assert_ptr_ne(r, null);
  24265   s = toStringO(r);
  24266   ck_assert_str_eq(s, "");
  24267   free(s);
  24268   // empty string many pairs
  24269   freeO(self);
  24270   setTopSO(self, "");
  24271   r = icReplaceManyO(self, "##", "", "$$", "");
  24272   ck_assert_ptr_ne(r, null);
  24273   s = toStringO(r);
  24274   ck_assert_str_eq(s, "");
  24275   free(s);
  24276   // empty string many pairs empty olds
  24277   freeO(self);
  24278   setTopSO(self, "");
  24279   r = icReplaceManyO(self, "##", "", "", "");
  24280   ck_assert_ptr_ne(r, null);
  24281   s = toStringO(r);
  24282   ck_assert_str_eq(s, "");
  24283   free(s);
  24284   // empty string and NULL old delimiter
  24285   freeO(self);
  24286   setTopSO(self, "");
  24287   r = icReplaceManyO(self, NULL,"|");
  24288   ck_assert_ptr_ne(r, null);
  24289   s = toStringO(r);
  24290   ck_assert_str_eq(s, "");
  24291   free(s);
  24292   // empty string and NULL old delimiter not first - same as replace empty string
  24293   freeO(self);
  24294   setTopSO(self, "");
  24295   r = icReplaceManyO(self,"##","|", NULL,"|");
  24296   ck_assert_ptr_ne(r, null);
  24297   s = toStringO(r);
  24298   ck_assert_str_eq(s, "");
  24299   free(s);
  24300   // empty old delimiter
  24301   freeO(self);
  24302   setTopSO(self, "AA##ee##ee#");
  24303   ck_assert_ptr_eq(icReplaceManyO(self, "","|", "AA", "BB"), NULL);
  24304   // empty old delimiter not first
  24305   ck_assert_ptr_eq(icReplaceManyO(self, "##","|", "", "BB"), NULL);
  24306   // NULL string
  24307   freeO(self);
  24308   ck_assert_ptr_eq(icReplaceManyO(self, "##","|"), NULL);
  24309   terminateO(self);
  24310 
  24311 END_TEST
  24312 
  24313 
  24314 START_TEST(equalSmallJsonSmallArrayT)
  24315 
  24316   bool r;
  24317   smallJsont *self   = allocG(rtSmallJsont);
  24318   smallArrayt *array = allocSmallArray();
  24319 
  24320   // empty arrays
  24321   setTypeArrayO(self);
  24322   r = self->f->equalSmallArray(self, array);
  24323   ck_assert(r);
  24324   // empty self, non empty array
  24325   array->f->pushInt(array, 1);
  24326   r = self->f->equalSmallArray(self, array);
  24327   ck_assert(!r);
  24328   // non empty self, empty array
  24329   emptyO(array);
  24330   self->f->pushInt(self, 1);
  24331   r = self->f->equalSmallArray(self, array);
  24332   ck_assert(!r);
  24333   // different lengths
  24334   array->f->pushInt(array, 1);
  24335   self->f->pushInt(self, 1);
  24336   r = self->f->equalSmallArray(self, array);
  24337   ck_assert(!r);
  24338   // equal arrays
  24339   array->f->pushInt(array, 1);
  24340   r = self->f->equalSmallArray(self, array);
  24341   ck_assert(r);
  24342   // different int value
  24343   array->f->setAtInt(array, 1, 2);
  24344   r = self->f->equalSmallArray(self, array);
  24345   ck_assert(!r);
  24346   // array same length with a null element in self
  24347   smallIntt *i = self->f->getAtSmallInt(self, 1);
  24348   removeElemIndexO(self, 1);
  24349   terminateO(i);
  24350   r = self->f->equalSmallArray(self, array);
  24351   ck_assert(!r);
  24352   // array same length with a null element in both arrays
  24353   i = array->f->getAtSmallInt(array, 1);
  24354   removeElemO(array, 1);
  24355   terminateO(i);
  24356   r = self->f->equalSmallArray(self, array);
  24357   ck_assert(r);
  24358   // elements of different types
  24359   self->f->setAtBool(self, 1, true);
  24360   array->f->setAtInt(array, 1, 1);
  24361   r = self->f->equalSmallArray(self, array);
  24362   ck_assert(!r);
  24363   // compare bool
  24364   array->f->setAtBool(array, 1, true);
  24365   r = self->f->equalSmallArray(self, array);
  24366   ck_assert(r);
  24367   array->f->setAtBool(array, 1, false);
  24368   r = self->f->equalSmallArray(self, array);
  24369   ck_assert(!r);
  24370   // compare dict
  24371   createSmallDict(d1);
  24372   createSmallDict(d2);
  24373   self->f->setAtDict(self, 1, &d1);
  24374   array->f->setAtDict(array, 1, &d2);
  24375   r = self->f->equalSmallArray(self, array);
  24376   ck_assert(r);
  24377     // reuse dict container, the data is in self already
  24378   resetO(&d1);
  24379   (&d1)->f->setInt(&d1, "a", 1);
  24380   self->f->setAtDict(self, 1, &d1);
  24381   r = self->f->equalSmallArray(self, array);
  24382   ck_assert(!r);
  24383   // compare double
  24384   self->f->setAtDouble(self, 1, 0);
  24385   array->f->setAtDouble(array, 1, 0);
  24386   r = self->f->equalSmallArray(self, array);
  24387   ck_assert(r);
  24388   array->f->setAtDouble(array, 1, 10.5);
  24389   r = self->f->equalSmallArray(self, array);
  24390   ck_assert(!r);
  24391   // compare string
  24392   self->f->setAtS(self, 1, "");
  24393   array->f->setAtS(array, 1, "");
  24394   r = self->f->equalSmallArray(self, array);
  24395   ck_assert(r);
  24396   array->f->setAtS(array, 1, "NO");
  24397   r = self->f->equalSmallArray(self, array);
  24398   ck_assert(!r);
  24399   // compare array elements
  24400   createSmallArray(a1);
  24401   createSmallArray(a2);
  24402   self->f->setAtArray(self, 1, &a1);
  24403   array->f->setAtArray(array, 1, &a2);
  24404   r = self->f->equalSmallArray(self, array);
  24405   ck_assert(r);
  24406     // reuse Array container, the data is in self already
  24407   resetO(&a1);
  24408   (&a1)->f->pushInt(&a1, 1);
  24409   self->f->setAtArray(self, 1, &a1);
  24410   r = self->f->equalSmallArray(self, array);
  24411   ck_assert(!r);
  24412   // compare bytes
  24413   createSmallBytes(b1);
  24414   createSmallBytes(b2);
  24415   self->f->setAtSmallBytes(self, 1, &b1);
  24416   array->f->setAtSmallBytes(array, 1, &b2);
  24417   r = self->f->equalSmallArray(self, array);
  24418   ck_assert(r);
  24419     // reuse SmallBytes container, the data is in self already
  24420   b1.B = null;
  24421   pushBufferO(&b1, &self, 2);
  24422   self->f->setAtSmallBytes(self, 1, &b1);
  24423   r = self->f->equalSmallArray(self, array);
  24424   ck_assert(!r);
  24425     // compare data in both smallBytes elements
  24426   b2.B = null;
  24427   pushBufferO(&b2, (char*)(&self) + 4, 2);
  24428   array->f->setAtSmallBytes(array, 1, &b2);
  24429   r = self->f->equalSmallArray(self, array);
  24430   ck_assert(!r);
  24431   // non smallArray object
  24432   terminateO(array);
  24433   array = (smallArrayt*) allocSmallInt(2);
  24434   r = self->f->equalSmallArray(self, array);
  24435   ck_assert(!r);
  24436   // NULL array
  24437   r = self->f->equalSmallArray(self, NULL);
  24438   ck_assert(!r);
  24439   // non json array
  24440   freeO(self);
  24441   setTypeDictO(self);
  24442   ck_assert(!self->f->equalSmallArray(self, array));
  24443   // non smallArray array
  24444   freeO(self);
  24445   setTypeArrayO(self);
  24446   terminateO(array);
  24447   array = (smallArrayt*) allocSmallInt(2);
  24448   r = self->f->equalSmallArray(self, array);
  24449   ck_assert(!r);
  24450   terminateO(array);
  24451   terminateO(self);
  24452 
  24453 END_TEST
  24454 
  24455 
  24456 START_TEST(equalSmallJsonArrayT)
  24457 
  24458   bool r;
  24459   smallJsont *self = allocG(rtSmallJsont);
  24460   char ** p2 = NULL;
  24461 
  24462   // empty arrays
  24463   setTypeArrayO(self);
  24464   r = self->f->equalArray(self, NULL);
  24465   ck_assert(r);
  24466   // empty self, non empty array
  24467   p2 = listCreateS("a");
  24468   r = self->f->equalArray(self, p2);
  24469   ck_assert(!r);
  24470   // non empty self, empty array
  24471   self->f->pushInt(self, 1);
  24472   listFreeS(p2);
  24473   listEmptyS(p2);
  24474   r = self->f->equalArray(self, p2);
  24475   ck_assert(!r);
  24476   // different lengths
  24477   listPushS(&p2, "a");
  24478   self->f->pushInt(self, 2);
  24479   r = self->f->equalArray(self, p2);
  24480   ck_assert(!r);
  24481   // equal arrays
  24482   emptyO(self);
  24483   self->f->pushS(self, "a");
  24484   r = self->f->equalArray(self, p2);
  24485   ck_assert(r);
  24486   // not string type in self
  24487   self->f->setAtInt(self, 0, 0);
  24488   r = self->f->equalArray(self, p2);
  24489   ck_assert(!r);
  24490   // array same length with a null element in self
  24491   smallIntt *i = self->f->getAtSmallInt(self, 0);
  24492   terminateO(i);
  24493   removeElemIndexO(self, 0);
  24494   r = self->f->equalArray(self, p2);
  24495   ck_assert(!r);
  24496   // different strings
  24497   self->f->setAtS(self, 0, "bb");
  24498   r = self->f->equalArray(self, p2);
  24499   ck_assert(!r);
  24500   // non json array
  24501   freeO(self);
  24502   setTypeBoolO(self);
  24503   ck_assert(!self->f->equalArray(self, p2));
  24504   listFreeS(p2);
  24505   terminateO(self);
  24506 
  24507 END_TEST
  24508 
  24509 
  24510 START_TEST(equalSmallJsonBaseT)
  24511 
  24512   bool r;
  24513   smallJsont *self = allocSmallJson();
  24514   baset* p2;
  24515 
  24516   // json bool
  24517   setTopBoolO(self, false);
  24518   p2 = (baset*) allocSmallBool(false);
  24519   r = self->f->equalBase(self, p2);
  24520   ck_assert(r);
  24521   freeO(self);
  24522   setTopBoolO(self, true);
  24523   r = self->f->equalBase(self, p2);
  24524   ck_assert(!r);
  24525   terminateO(p2);
  24526   p2 = (baset*) allocSmallBool(true);
  24527   r = self->f->equalBase(self, p2);
  24528   ck_assert(r);
  24529   //  non equal
  24530   terminateO(p2);
  24531   p2 = (baset*) allocSmallString("true ");
  24532   r = self->f->equalBase(self, p2);
  24533   ck_assert(!r);
  24534   // json double
  24535   freeO(self);
  24536   setTopDoubleO(self, 2.2);
  24537   terminateO(p2);
  24538   p2 = (baset*) allocSmallString("2.2");
  24539   r = self->f->equalBase(self, p2);
  24540   ck_assert(r);
  24541   freeO(self);
  24542   setTopDoubleO(self, 2);
  24543   r = self->f->equalBase(self, p2);
  24544   ck_assert(!r);
  24545   terminateO(p2);
  24546   //  p2 is an int so not equal to double (int)2 != (double)2
  24547   //  TODO is this reasonable?
  24548   p2 = (baset*) allocSmallInt(2);
  24549   r = self->f->equalBase(self, p2);
  24550   ck_assert(!r);
  24551   terminateO(p2);
  24552   p2 = (baset*) allocSmallString("asd");
  24553   r = self->f->equalBase(self, p2);
  24554   ck_assert(!r);
  24555   // json int
  24556   freeO(self);
  24557   setTopIntO(self, 2);
  24558   terminateO(p2);
  24559   p2 = (baset*) allocSmallString("2");
  24560   r = self->f->equalBase(self, p2);
  24561   ck_assert(r);
  24562   terminateO(p2);
  24563   p2 = (baset*) allocSmallString("3");
  24564   r = self->f->equalBase(self, p2);
  24565   ck_assert(!r);
  24566   terminateO(p2);
  24567   p2 = (baset*) allocSmallDouble(2);
  24568   r = self->f->equalBase(self, p2);
  24569   ck_assert(!r);
  24570   terminateO(p2);
  24571   p2 = (baset*) allocSmallString("asd");
  24572   r = self->f->equalBase(self, p2);
  24573   ck_assert(!r);
  24574   // json string
  24575   freeO(self);
  24576   setTopSO(self, "12");
  24577   terminateO(p2);
  24578   p2 = (baset*) allocSmallInt(12);
  24579   r = self->f->equalBase(self, p2);
  24580   ck_assert(r);
  24581   // empty self
  24582   freeO(self);
  24583   r = self->f->equalBase(self, p2);
  24584   ck_assert(!r);
  24585   // json dict
  24586   freeO(self);
  24587   setTypeDictO(self);
  24588   terminateO(p2);
  24589   p2 = (baset*) allocSmallInt(12);
  24590   r = self->f->equalBase(self, p2);
  24591   ck_assert(!r);
  24592   terminateO(p2);
  24593   p2 = (baset*) allocSmallDict();
  24594   r = self->f->equalBase(self, p2);
  24595   ck_assert(!r);
  24596   // json array
  24597   freeO(self);
  24598   setTypeArrayO(self);
  24599   terminateO(p2);
  24600   p2 = (baset*) allocSmallInt(12);
  24601   r = self->f->equalBase(self, p2);
  24602   ck_assert(!r);
  24603   self->f->pushInt(self, 1);
  24604   r = self->f->equalBase(self, p2);
  24605   ck_assert(!r);
  24606   terminateO(p2);
  24607   p2 = (baset*) allocSmallArray();
  24608   r = self->f->equalBase(self, p2);
  24609   ck_assert(!r);
  24610   // null object
  24611   freeO(self);
  24612   setTopSO(self, "qwe");
  24613   r = self->f->equalBase(self, null);
  24614   ck_assert(!r);
  24615   terminateO(p2);
  24616   terminateO(self);
  24617 
  24618 END_TEST
  24619 
  24620 
  24621 START_TEST(equalSmallJsonChaT)
  24622 
  24623   bool r;
  24624   smallJsont *self = allocSmallJson();
  24625   setTopSO(self, "");
  24626 
  24627   r = equalChaO(self,'q');
  24628   ck_assert(!r);
  24629   freeO(self);
  24630   setTopSO(self, "q");
  24631   r = equalChaO(self,'q');
  24632   ck_assert(r);
  24633   // empty strings
  24634   freeO(self);
  24635   r = equalChaO(self, ' ');
  24636   ck_assert(!r);
  24637   // json int
  24638   freeO(self);
  24639   setTopIntO(self, 1);
  24640   r = equalChaO(self,'1');
  24641   ck_assert(r);
  24642   r = equalChaO(self,'2');
  24643   ck_assert(!r);
  24644   r = equalChaO(self,'q');
  24645   ck_assert(!r);
  24646   // non json string or int
  24647   freeO(self);
  24648   setTypeBoolO(self);
  24649   r = equalChaO(self,'2');
  24650   ck_assert(!r);
  24651   terminateO(self);
  24652 
  24653 END_TEST
  24654 
  24655 
  24656 START_TEST(equalSmallJsonCharT)
  24657 
  24658   bool r;
  24659   smallJsont *self = allocSmallJson();
  24660   setTopSO(self, "");
  24661 
  24662   r = equalCharO(self,"qwe");
  24663   ck_assert(!r);
  24664   freeO(self);
  24665   setTopSO(self, "qwe");
  24666   r = equalCharO(self,"qwe");
  24667   ck_assert(r);
  24668   // empty strings
  24669   freeO(self);
  24670   r = equalCharO(self, "");
  24671   ck_assert(!r);
  24672   // json bool
  24673   freeO(self);
  24674   setTypeBoolO(self);
  24675   r = equalCharO(self, "false");
  24676   ck_assert(r);
  24677   r = equalCharO(self, "true");
  24678   ck_assert(!r);
  24679   freeO(self);
  24680   setTopBoolO(self, true);
  24681   r = equalCharO(self, "false");
  24682   ck_assert(!r);
  24683   r = equalCharO(self, "true");
  24684   ck_assert(r);
  24685   r = equalCharO(self, " true");
  24686   ck_assert(!r);
  24687   // json double
  24688   freeO(self);
  24689   setTopDoubleO(self, 2.2);
  24690   r = equalCharO(self, "2.2");
  24691   ck_assert(r);
  24692   freeO(self);
  24693   setTopDoubleO(self, 2);
  24694   r = equalCharO(self, "2.2");
  24695   ck_assert(!r);
  24696   //  value is an int so not equal to double (int)2 != (double)2
  24697   //  TODO is this reasonable?
  24698   r = equalCharO(self, "2");
  24699   ck_assert(!r);
  24700   r = equalCharO(self, "asd");
  24701   ck_assert(!r);
  24702   // json int
  24703   freeO(self);
  24704   setTopIntO(self, 2);
  24705   r = equalCharO(self, "2");
  24706   ck_assert(r);
  24707   r = equalCharO(self, "3");
  24708   ck_assert(!r);
  24709   r = equalCharO(self, "2.0");
  24710   ck_assert(!r);
  24711   r = equalCharO(self, "asd");
  24712   ck_assert(!r);
  24713   // null object
  24714   freeO(self);
  24715   setTopSO(self, "qwe");
  24716   r = equalCharO(self, null);
  24717   ck_assert(!r);
  24718   terminateO(self);
  24719 
  24720 END_TEST
  24721 
  24722 
  24723 START_TEST(equalSmallJsonBoolT)
  24724 
  24725   bool r;
  24726   smallJsont* self = allocG(rtSmallJsont);
  24727 
  24728   // empty json
  24729   r = equalBoolO(self, false);
  24730   ck_assert(!r);
  24731   // json bool
  24732   freeO(self);
  24733   setTypeBoolO(self);
  24734   r = equalBoolO(self, false);
  24735   ck_assert(r);
  24736   // json double
  24737   freeO(self);
  24738   setTopDoubleO(self, 1);
  24739   r = equalBoolO(self, true);
  24740   ck_assert(r);
  24741   // json int
  24742   freeO(self);
  24743   setTopIntO(self, 1);
  24744   r = equalBoolO(self, true);
  24745   ck_assert(r);
  24746   // json string
  24747   freeO(self);
  24748   setTopSO(self, "TRUE");
  24749   r = equalBoolO(self, true);
  24750   ck_assert(r);
  24751   freeO(self);
  24752   setTopSO(self, "FALSE");
  24753   r = equalBoolO(self, true);
  24754   ck_assert(!r);
  24755   freeO(self);
  24756   setTopSO(self, "FALSE ");
  24757   r = equalBoolO(self, false);
  24758   ck_assert(!r);
  24759   terminateO(self);
  24760 
  24761 END_TEST
  24762 
  24763 
  24764 START_TEST(equalSmallJsonDoubleT)
  24765 
  24766   bool r;
  24767   smallJsont* self = allocG(rtSmallJsont);
  24768 
  24769   // empty json
  24770   r = equalDoubleO(self, 0);
  24771   ck_assert(!r);
  24772   // json bool
  24773   freeO(self);
  24774   setTypeBoolO(self);
  24775   r = equalDoubleO(self, 0);
  24776   ck_assert(r);
  24777   // json double
  24778   freeO(self);
  24779   setTopDoubleO(self, 1.2);
  24780   r = equalDoubleO(self, 1.2);
  24781   ck_assert(r);
  24782   // json int
  24783   freeO(self);
  24784   setTopIntO(self, 1);
  24785   r = equalDoubleO(self, 1);
  24786   ck_assert(r);
  24787   // json string
  24788   freeO(self);
  24789   setTopSO(self, "1.0");
  24790   r = equalDoubleO(self, 1);
  24791   ck_assert(r);
  24792   freeO(self);
  24793   setTopSO(self, "1");
  24794   r = equalDoubleO(self, 1);
  24795   ck_assert(!r);
  24796   freeO(self);
  24797   setTopSO(self, "qwe");
  24798   r = equalDoubleO(self, 0);
  24799   ck_assert(!r);
  24800   terminateO(self);
  24801 
  24802 END_TEST
  24803 
  24804 
  24805 START_TEST(equalSmallJsonInt64T)
  24806 
  24807   bool r;
  24808   smallJsont* self = allocG(rtSmallJsont);
  24809 
  24810   // empty json
  24811   r = equalInt64O(self, 0);
  24812   ck_assert(!r);
  24813   // json bool
  24814   freeO(self);
  24815   setTypeBoolO(self);
  24816   r = equalInt64O(self, 0);
  24817   ck_assert(r);
  24818   // json double
  24819   freeO(self);
  24820   setTopDoubleO(self, 2);
  24821   r = equalInt64O(self, 2);
  24822   ck_assert(r);
  24823   // json int
  24824   freeO(self);
  24825   setTopIntO(self, 2);
  24826   r = equalInt64O(self, 2);
  24827   ck_assert(r);
  24828   // json string
  24829   freeO(self);
  24830   setTopSO(self, "3");
  24831   r = equalInt64O(self, 3);
  24832   ck_assert(r);
  24833   freeO(self);
  24834   setTopSO(self, "1.0");
  24835   r = equalInt64O(self, 1);
  24836   ck_assert(!r);
  24837   freeO(self);
  24838   setTopSO(self, "qwe");
  24839   r = equalInt64O(self, 0);
  24840   ck_assert(!r);
  24841   terminateO(self);
  24842 
  24843 END_TEST
  24844 
  24845 
  24846 START_TEST(equalSmallJsonInt32T)
  24847 
  24848   bool r;
  24849   smallJsont* self = allocG(rtSmallJsont);
  24850 
  24851   // empty json
  24852   r = equalInt32O(self, 0);
  24853   ck_assert(!r);
  24854   // json bool
  24855   freeO(self);
  24856   setTypeBoolO(self);
  24857   r = equalInt32O(self, 0);
  24858   ck_assert(r);
  24859   // json double
  24860   freeO(self);
  24861   setTopDoubleO(self, 2);
  24862   r = equalInt32O(self, 2);
  24863   ck_assert(r);
  24864   // json int
  24865   freeO(self);
  24866   setTopIntO(self, 2);
  24867   r = equalInt32O(self, 2);
  24868   ck_assert(r);
  24869   // json string
  24870   freeO(self);
  24871   setTopSO(self, "3");
  24872   r = equalInt32O(self, 3);
  24873   ck_assert(r);
  24874   freeO(self);
  24875   setTopSO(self, "1.0");
  24876   r = equalInt32O(self, 1);
  24877   ck_assert(!r);
  24878   freeO(self);
  24879   setTopSO(self, "qwe");
  24880   r = equalInt32O(self, 0);
  24881   ck_assert(!r);
  24882   terminateO(self);
  24883 
  24884 END_TEST
  24885 
  24886 
  24887 START_TEST(equalSmallJsonUint32T)
  24888 
  24889   bool r;
  24890   smallJsont* self = allocG(rtSmallJsont);
  24891 
  24892   // empty json
  24893   r = equalUint32O(self, 0);
  24894   ck_assert(!r);
  24895   // json bool
  24896   freeO(self);
  24897   setTypeBoolO(self);
  24898   r = equalUint32O(self, 0);
  24899   ck_assert(r);
  24900   // json double
  24901   freeO(self);
  24902   setTopDoubleO(self, 2);
  24903   r = equalUint32O(self, 2);
  24904   ck_assert(r);
  24905   // json int
  24906   freeO(self);
  24907   setTopIntO(self, 2);
  24908   r = equalUint32O(self, 2);
  24909   ck_assert(r);
  24910   // json string
  24911   freeO(self);
  24912   setTopSO(self, "3");
  24913   r = equalUint32O(self, 3);
  24914   ck_assert(r);
  24915   freeO(self);
  24916   setTopSO(self, "1.0");
  24917   r = equalUint32O(self, 1);
  24918   ck_assert(!r);
  24919   freeO(self);
  24920   setTopSO(self, "qwe");
  24921   r = equalUint32O(self, 0);
  24922   ck_assert(!r);
  24923   terminateO(self);
  24924 
  24925 END_TEST
  24926 
  24927 
  24928 START_TEST(equalSmallJsonUint64T)
  24929 
  24930   bool r;
  24931   smallJsont* self = allocG(rtSmallJsont);
  24932 
  24933   // empty json
  24934   r = equalUint64O(self, 0);
  24935   ck_assert(!r);
  24936   // json bool
  24937   freeO(self);
  24938   setTypeBoolO(self);
  24939   r = equalUint64O(self, 0);
  24940   ck_assert(r);
  24941   // json double
  24942   freeO(self);
  24943   setTopDoubleO(self, 2);
  24944   r = equalUint64O(self, 2);
  24945   ck_assert(r);
  24946   // json int
  24947   freeO(self);
  24948   setTopIntO(self, 2);
  24949   r = equalUint64O(self, 2);
  24950   ck_assert(r);
  24951   // json string
  24952   freeO(self);
  24953   setTopSO(self, "3");
  24954   r = equalUint64O(self, 3);
  24955   ck_assert(r);
  24956   freeO(self);
  24957   setTopSO(self, "1.0");
  24958   r = equalUint64O(self, 1);
  24959   ck_assert(!r);
  24960   freeO(self);
  24961   setTopSO(self, "qwe");
  24962   r = equalUint64O(self, 0);
  24963   ck_assert(!r);
  24964   terminateO(self);
  24965 
  24966 END_TEST
  24967 
  24968 
  24969 START_TEST(equalSmallJsonSmallBoolT)
  24970 
  24971   bool r;
  24972   smallJsont* self = allocG(rtSmallJsont);
  24973   smallBoolt* p2   = allocSmallBool(false);
  24974 
  24975   // empty json
  24976   r = equalSmallBoolO(self, p2);
  24977   ck_assert(!r);
  24978   // not equal
  24979   setTopBoolO(self, true);
  24980   r = equalSmallBoolO(self, p2);
  24981   ck_assert(!r);
  24982   // equal
  24983   setValO(p2, true);
  24984   r = equalSmallBoolO(self, p2);
  24985   ck_assert(r);
  24986   // empty smallBool
  24987   freeO(p2);
  24988   r = equalSmallBoolO(self, p2);
  24989   ck_assert(!r);
  24990   // non smallBool
  24991   terminateO(p2);
  24992   p2 = (smallBoolt*) allocSmallInt(0);
  24993   r = equalSmallBoolO(self, p2);
  24994   ck_assert(!r);
  24995   // null
  24996   r = equalSmallBoolO(self, null);
  24997   ck_assert(!r);
  24998   terminateO(p2);
  24999   terminateO(self);
  25000 
  25001 END_TEST
  25002 
  25003 
  25004 START_TEST(equalSmallJsonSmallBytesT)
  25005 
  25006   bool r;
  25007   smallJsont* self = allocG(rtSmallJsont);
  25008   smallBytest* p2  = allocSmallBytes("true", strlen("true"));
  25009 
  25010   // empty json
  25011   ck_assert(!self->f->equalSmallBytes(self, p2));
  25012   // json bool
  25013   setTopBoolO(self, true);
  25014   ck_assert(!self->f->equalSmallBytes(self, p2));
  25015   freeO(p2);
  25016   pushBufferO(p2, "true", sizeof("true"));
  25017   ck_assert(self->f->equalSmallBytes(self, p2));
  25018   freeO(self);
  25019   setTopBoolO(self, false);
  25020   ck_assert(!self->f->equalSmallBytes(self, p2));
  25021   freeO(p2);
  25022   pushBufferO(p2, "false", sizeof("false"));
  25023   ck_assert(self->f->equalSmallBytes(self, p2));
  25024   freeO(self);
  25025   setTopBoolO(self, true);
  25026   ck_assert(!self->f->equalSmallBytes(self, p2));
  25027   freeO(p2);
  25028   pushBufferO(p2, "False", sizeof("False"));
  25029   ck_assert(!self->f->equalSmallBytes(self, p2));
  25030   // json double
  25031   freeO(self);
  25032   setTopDoubleO(self, 2.2);
  25033   freeO(p2);
  25034   pushBufferO(p2, "2.2", strlen("2.2"));
  25035   r = self->f->equalSmallBytes(self, p2);
  25036   ck_assert(!r);
  25037   freeO(p2);
  25038   pushBufferO(p2, "2.2", sizeof("2.2"));
  25039   r = self->f->equalSmallBytes(self, p2);
  25040   ck_assert(r);
  25041   freeO(self);
  25042   setTopDoubleO(self, 2);
  25043   r = self->f->equalSmallBytes(self, p2);
  25044   ck_assert(!r);
  25045   freeO(p2);
  25046   pushBufferO(p2, "2", sizeof("2"));
  25047   r = self->f->equalSmallBytes(self, p2);
  25048   ck_assert(!r);
  25049   freeO(p2);
  25050   pushBufferO(p2, "asd", sizeof("asd"));
  25051   r = self->f->equalSmallBytes(self, p2);
  25052   ck_assert(!r);
  25053   // json int
  25054   freeO(self);
  25055   setTopIntO(self, 2);
  25056   freeO(p2);
  25057   pushBufferO(p2, "2", strlen("2"));
  25058   r = self->f->equalSmallBytes(self, p2);
  25059   ck_assert(!r);
  25060   freeO(p2);
  25061   pushBufferO(p2, "2", sizeof("2"));
  25062   r = self->f->equalSmallBytes(self, p2);
  25063   ck_assert(r);
  25064   freeO(p2);
  25065   pushBufferO(p2, "3", sizeof("3"));
  25066   r = self->f->equalSmallBytes(self, p2);
  25067   ck_assert(!r);
  25068   freeO(p2);
  25069   pushBufferO(p2, "2.0", sizeof("2.0"));
  25070   r = self->f->equalSmallBytes(self, p2);
  25071   ck_assert(!r);
  25072   freeO(p2);
  25073   pushBufferO(p2, "asd", sizeof("asd"));
  25074   r = self->f->equalSmallBytes(self, p2);
  25075   ck_assert(!r);
  25076   // json string
  25077   freeO(self);
  25078   setTopSO(self, "qweert");
  25079   r = self->f->equalSmallBytes(self, p2);
  25080   ck_assert(!r);
  25081   freeO(self);
  25082   setTopSO(self, "asd");
  25083   r = self->f->equalSmallBytes(self, p2);
  25084   ck_assert(r);
  25085   // empty smallBytes
  25086   freeO(p2);
  25087   ck_assert(!self->f->equalSmallBytes(self, p2));
  25088   // non smallBytes
  25089   terminateO(p2);
  25090   p2 = (smallBytest*) allocSmallInt(0);
  25091   ck_assert(!self->f->equalSmallBytes(self, p2));
  25092   // null
  25093   ck_assert(!self->f->equalSmallBytes(self, null));
  25094   terminateO(p2);
  25095   terminateO(self);
  25096 
  25097 END_TEST
  25098 
  25099 
  25100 START_TEST(equalSmallJsonSmallDoubleT)
  25101 
  25102   bool r;
  25103   smallJsont* self = allocG(rtSmallJsont);
  25104   smallDoublet* p2 = allocSmallDouble(0);
  25105 
  25106   // empty json
  25107   r = equalSmallDoubleO(self, p2);
  25108   ck_assert(!r);
  25109   // json bool
  25110   freeO(self);
  25111   setTypeBoolO(self);
  25112   r = equalSmallDoubleO(self, p2);
  25113   ck_assert(r);
  25114   // json double
  25115   freeO(self);
  25116   setTopDoubleO(self, 1.2);
  25117   setValO(p2, 1.2);
  25118   r = equalSmallDoubleO(self, p2);
  25119   ck_assert(r);
  25120   // json int
  25121   freeO(self);
  25122   setTopIntO(self, 1);
  25123   setValO(p2, 1);
  25124   r = equalSmallDoubleO(self, p2);
  25125   ck_assert(r);
  25126   // json string
  25127   freeO(self);
  25128   setTopSO(self, "1.0");
  25129   r = equalSmallDoubleO(self, p2);
  25130   ck_assert(r);
  25131   freeO(self);
  25132   setTopSO(self, "1");
  25133   r = equalSmallDoubleO(self, p2);
  25134   ck_assert(!r);
  25135   freeO(self);
  25136   setTopSO(self, "qwe");
  25137   r = equalSmallDoubleO(self, p2);
  25138   ck_assert(!r);
  25139   // empty smallDouble
  25140   freeO(p2);
  25141   ck_assert(!equalSmallDoubleO(self, p2));
  25142   // non smallDouble
  25143   terminateO(p2);
  25144   p2 = (smallDoublet*) allocSmallInt(0);
  25145   ck_assert(!equalSmallDoubleO(self, p2));
  25146   // null
  25147   ck_assert(!equalSmallDoubleO(self, null));
  25148   terminateO(p2);
  25149   terminateO(self);
  25150 
  25151 END_TEST
  25152 
  25153 
  25154 START_TEST(equalSmallJsonSmallIntT)
  25155 
  25156   bool r;
  25157   smallJsont* self = allocG(rtSmallJsont);
  25158   smallIntt* p2    = allocSmallInt(0);
  25159 
  25160   // empty json
  25161   r = equalSmallIntO(self, p2);
  25162   ck_assert(!r);
  25163   // json bool
  25164   freeO(self);
  25165   setTypeBoolO(self);
  25166   r = equalSmallIntO(self, p2);
  25167   ck_assert(r);
  25168   // json double
  25169   freeO(self);
  25170   setTopDoubleO(self, 2);
  25171   setValO(p2, 2);
  25172   r = equalSmallIntO(self, p2);
  25173   ck_assert(r);
  25174   // json int
  25175   freeO(self);
  25176   setTopIntO(self, 2);
  25177   r = equalSmallIntO(self, p2);
  25178   ck_assert(r);
  25179   // json string
  25180   freeO(self);
  25181   setTopSO(self, "3");
  25182   setValO(p2, 3);
  25183   r = equalSmallIntO(self, p2);
  25184   ck_assert(r);
  25185   freeO(self);
  25186   setTopSO(self, "1.0");
  25187   setValO(p2, 1);
  25188   r = equalSmallIntO(self, p2);
  25189   ck_assert(!r);
  25190   freeO(self);
  25191   setTopSO(self, "qwe");
  25192   r = equalSmallIntO(self, p2);
  25193   ck_assert(!r);
  25194   // empty smallInt
  25195   freeO(p2);
  25196   ck_assert(!equalSmallIntO(self, p2));
  25197   // non smallInt
  25198   terminateO(p2);
  25199   p2 = (smallIntt*) allocSmallBool(false);
  25200   ck_assert(!equalSmallIntO(self, p2));
  25201   // null
  25202   ck_assert(!equalSmallIntO(self, null));
  25203   terminateO(p2);
  25204   terminateO(self);
  25205 
  25206 END_TEST
  25207 
  25208 
  25209 START_TEST(equalSmallJsonSmallJsonT)
  25210 
  25211   bool r;
  25212   smallJsont* self = allocG(rtSmallJsont);
  25213   smallJsont* p2   = allocSmallJson();
  25214 
  25215   // empty json
  25216   r = equalSmallJsonO(self, p2);
  25217   ck_assert(!r);
  25218   // undefined
  25219   setTypeUndefinedO(p2);
  25220   ck_assert(!equalSmallJsonO(self, p2));
  25221   setTypeUndefinedO(self);
  25222   ck_assert(equalSmallJsonO(self, p2));
  25223   // bool
  25224   freeO(self);
  25225   freeO(p2);
  25226   setTopBoolO(self, true);
  25227   setTopBoolO(p2, true);
  25228   ck_assert(equalSmallJsonO(self, p2));
  25229   // double
  25230   freeO(self);
  25231   freeO(p2);
  25232   setTopDoubleO(self, 2.3);
  25233   setTopDoubleO(p2, 2.3);
  25234   ck_assert(equalSmallJsonO(self, p2));
  25235   // int
  25236   freeO(self);
  25237   freeO(p2);
  25238   setTopIntO(self, 2);
  25239   setTopIntO(p2, 2);
  25240   ck_assert(equalSmallJsonO(self, p2));
  25241   // string
  25242   freeO(self);
  25243   freeO(p2);
  25244   setTopSO(self, "");
  25245   setTopSO(p2, "");
  25246   ck_assert(equalSmallJsonO(self, p2));
  25247   // dict
  25248   freeO(self);
  25249   freeO(p2);
  25250   setTypeDictO(self);
  25251   setTypeDictO(p2);
  25252   ck_assert(equalSmallJsonO(self, p2));
  25253   // array
  25254   freeO(self);
  25255   freeO(p2);
  25256   setTypeArrayO(self);
  25257   setTypeArrayO(p2);
  25258   ck_assert(equalSmallJsonO(self, p2));
  25259   // empty smallJson
  25260   freeO(p2);
  25261   ck_assert(!equalSmallJsonO(self, p2));
  25262   // non smallJson
  25263   terminateO(p2);
  25264   p2 = (smallJsont*) allocSmallBool(false);
  25265   ck_assert(!equalSmallJsonO(self, p2));
  25266   // null
  25267   ck_assert(!equalSmallJsonO(self, null));
  25268   terminateO(p2);
  25269   terminateO(self);
  25270 
  25271 END_TEST
  25272 
  25273 
  25274 START_TEST(equalSmallJsonSmallStringT)
  25275 
  25276   bool r;
  25277   smallJsont* self = allocG(rtSmallJsont);
  25278   smallStringt* p2 = allocSmallString("");
  25279 
  25280   // empty json
  25281   r = equalSmallStringO(self, p2);
  25282   ck_assert(!r);
  25283   // json bool
  25284   setTypeBoolO(self);
  25285   setValO(p2, "false");
  25286   r = equalSmallStringO(self, p2);
  25287   ck_assert(r);
  25288   setValO(p2, "true");
  25289   r = equalSmallStringO(self, p2);
  25290   ck_assert(!r);
  25291   freeO(self);
  25292   setTopBoolO(self, true);
  25293   setValO(p2, "false");
  25294   r = equalSmallStringO(self, p2);
  25295   ck_assert(!r);
  25296   setValO(p2, "true");
  25297   r = equalSmallStringO(self, p2);
  25298   ck_assert(r);
  25299   setValO(p2, " true");
  25300   r = equalSmallStringO(self, p2);
  25301   ck_assert(!r);
  25302   // json double
  25303   freeO(self);
  25304   setTopDoubleO(self, 2.2);
  25305   setValO(p2, "2.2");
  25306   r = equalSmallStringO(self, p2);
  25307   ck_assert(r);
  25308   freeO(self);
  25309   setTopDoubleO(self, 2);
  25310   r = equalSmallStringO(self, p2);
  25311   ck_assert(!r);
  25312   setValO(p2, "2");
  25313   r = equalSmallStringO(self, p2);
  25314   ck_assert(!r);
  25315   setValO(p2, "asd");
  25316   r = equalSmallStringO(self, p2);
  25317   ck_assert(!r);
  25318   // json int
  25319   freeO(self);
  25320   setTopIntO(self, 2);
  25321   setValO(p2, "2");
  25322   r = equalSmallStringO(self, p2);
  25323   ck_assert(r);
  25324   setValO(p2, "3");
  25325   r = equalSmallStringO(self, p2);
  25326   ck_assert(!r);
  25327   setValO(p2, "2.0");
  25328   r = equalSmallStringO(self, p2);
  25329   ck_assert(!r);
  25330   setValO(p2, "asd");
  25331   r = equalSmallStringO(self, p2);
  25332   ck_assert(!r);
  25333   // json string
  25334   freeO(self);
  25335   setTopSO(self, "");
  25336   r = equalSmallStringO(self, p2);
  25337   ck_assert(!r);
  25338   freeO(self);
  25339   setTopSO(self, "asd");
  25340   r = equalSmallStringO(self, p2);
  25341   ck_assert(r);
  25342   // empty strings
  25343   freeO(self);
  25344   setValO(p2, "");
  25345   r = equalSmallStringO(self, p2);
  25346   ck_assert(!r);
  25347   // empty smallString
  25348   freeO(p2);
  25349   ck_assert(!equalSmallStringO(self, p2));
  25350   // non smallString
  25351   terminateO(p2);
  25352   p2 = (smallStringt*) allocSmallBool(false);
  25353   ck_assert(!equalSmallStringO(self, p2));
  25354   // null
  25355   ck_assert(!equalSmallStringO(self, null));
  25356   terminateO(p2);
  25357   terminateO(self);
  25358 
  25359 END_TEST
  25360 
  25361 
  25362 START_TEST(equalSmallJsonSmallDictT)
  25363 
  25364   bool r;
  25365   smallJsont* self = allocG(rtSmallJsont);
  25366   smallDictt* p2   = allocSmallDict();
  25367 
  25368   // empty json
  25369   r = self->f->equalSmallDict(self, p2);
  25370   ck_assert(!r);
  25371   setTypeDictO(self);
  25372   r = self->f->equalSmallDict(self, p2);
  25373   ck_assert(!r);
  25374   // equal
  25375   self->f->setInt(self, "a", 1);
  25376   self->f->setInt(self, "b", 2);
  25377   self->f->setInt(self, "c", 3);
  25378   p2->f->setInt(p2, "b", 2);
  25379   p2->f->setInt(p2, "a", 1);
  25380   p2->f->setInt(p2, "c", 3);
  25381   r = self->f->equalSmallDict(self, p2);
  25382   ck_assert(r);
  25383   // non equal
  25384   p2->f->setInt(p2, "b", 1);
  25385   r = self->f->equalSmallDict(self, p2);
  25386   ck_assert(!r);
  25387   p2->f->del(p2, "b");
  25388   r = self->f->equalSmallDict(self, p2);
  25389   ck_assert(!r);
  25390   // empty smallDict
  25391   freeO(p2);
  25392   ck_assert(!self->f->equalSmallDict(self, p2));
  25393   // non smallDict
  25394   terminateO(p2);
  25395   p2 = (smallDictt*) allocSmallBool(false);
  25396   ck_assert(!self->f->equalSmallDict(self, p2));
  25397   // null
  25398   ck_assert(!self->f->equalSmallDict(self, null));
  25399   terminateO(p2);
  25400   terminateO(self);
  25401 
  25402 END_TEST
  25403 
  25404 
  25405 START_TEST(icEqualSmallJsonSmallArrayT)
  25406 
  25407   bool r;
  25408   smallJsont *self   = allocG(rtSmallJsont);
  25409   smallArrayt *array = allocSmallArray();
  25410 
  25411   // empty arrays
  25412   setTypeArrayO(self);
  25413   r = self->f->icEqualSmallArray(self, array);
  25414   ck_assert(r);
  25415   // empty self, non empty array
  25416   array->f->pushInt(array, 1);
  25417   r = self->f->icEqualSmallArray(self, array);
  25418   ck_assert(!r);
  25419   // non empty self, empty array
  25420   emptyO(array);
  25421   self->f->pushInt(self, 1);
  25422   r = self->f->icEqualSmallArray(self, array);
  25423   ck_assert(!r);
  25424   // different lengths
  25425   array->f->pushInt(array, 1);
  25426   self->f->pushS(self, "a");
  25427   r = self->f->icEqualSmallArray(self, array);
  25428   ck_assert(!r);
  25429   // equal arrays
  25430   array->f->pushS(array, "A");
  25431   r = self->f->icEqualSmallArray(self, array);
  25432   ck_assert(r);
  25433   // different int value
  25434   self->f->setAtInt(self, 1, 1);
  25435   array->f->setAtInt(array, 1, 2);
  25436   r = self->f->icEqualSmallArray(self, array);
  25437   ck_assert(!r);
  25438   // array same length with a null element in self
  25439   smallIntt *i = self->f->getAtSmallInt(self, 1);
  25440   removeElemIndexO(self, 1);
  25441   terminateO(i);
  25442   r = self->f->icEqualSmallArray(self, array);
  25443   ck_assert(!r);
  25444   // array same length with a null element in both arrays
  25445   i = array->f->getAtSmallInt(array, 1);
  25446   removeElemO(array, 1);
  25447   terminateO(i);
  25448   r = self->f->icEqualSmallArray(self, array);
  25449   ck_assert(r);
  25450   // elements of different types
  25451   self->f->setAtBool(self, 1, true);
  25452   array->f->setAtInt(array, 1, 1);
  25453   r = self->f->icEqualSmallArray(self, array);
  25454   ck_assert(!r);
  25455   // compare bool
  25456   array->f->setAtBool(array, 1, true);
  25457   r = self->f->icEqualSmallArray(self, array);
  25458   ck_assert(r);
  25459   array->f->setAtBool(array, 1, false);
  25460   r = self->f->icEqualSmallArray(self, array);
  25461   ck_assert(!r);
  25462   // compare dict
  25463   createSmallDict(d1);
  25464   createSmallDict(d2);
  25465   self->f->setAtDict(self, 1, &d1);
  25466   array->f->setAtDict(array, 1, &d2);
  25467   r = self->f->icEqualSmallArray(self, array);
  25468   ck_assert(r);
  25469     // reuse dict container, the data is in self already
  25470   resetO(&d1);
  25471   (&d1)->f->setInt(&d1, "a", 1);
  25472   self->f->setAtDict(self, 1, &d1);
  25473   r = self->f->icEqualSmallArray(self, array);
  25474   ck_assert(!r);
  25475   // compare double
  25476   self->f->setAtDouble(self, 1, 0);
  25477   array->f->setAtDouble(array, 1, 0);
  25478   r = self->f->icEqualSmallArray(self, array);
  25479   ck_assert(r);
  25480   array->f->setAtDouble(array, 1, 10.5);
  25481   r = self->f->icEqualSmallArray(self, array);
  25482   ck_assert(!r);
  25483   // compare string
  25484   self->f->setAtS(self, 1, "");
  25485   array->f->setAtS(array, 1, "");
  25486   r = self->f->icEqualSmallArray(self, array);
  25487   ck_assert(r);
  25488   array->f->setAtS(array, 1, "NO");
  25489   r = self->f->icEqualSmallArray(self, array);
  25490   ck_assert(!r);
  25491   // compare array elements
  25492   createSmallArray(a1);
  25493   createSmallArray(a2);
  25494   self->f->setAtArray(self, 1, &a1);
  25495   array->f->setAtArray(array, 1, &a2);
  25496   r = self->f->icEqualSmallArray(self, array);
  25497   ck_assert(r);
  25498     // reuse Array container, the data is in self already
  25499   resetO(&a1);
  25500   (&a1)->f->pushInt(&a1, 1);
  25501   self->f->setAtArray(self, 1, &a1);
  25502   r = self->f->icEqualSmallArray(self, array);
  25503   ck_assert(!r);
  25504   // compare bytes
  25505   createSmallBytes(b1);
  25506   createSmallBytes(b2);
  25507   self->f->setAtSmallBytes(self, 1, &b1);
  25508   array->f->setAtSmallBytes(array, 1, &b2);
  25509   r = self->f->icEqualSmallArray(self, array);
  25510   ck_assert(r);
  25511     // reuse SmallBytes container, the data is in self already
  25512   b1.B = null;
  25513   pushBufferO(&b1, &self, 2);
  25514   self->f->setAtSmallBytes(self, 1, &b1);
  25515   r = self->f->icEqualSmallArray(self, array);
  25516   ck_assert(!r);
  25517     // compare data in both smallBytes elements
  25518   b2.B = null;
  25519   pushBufferO(&b2, (char*)(&self) + 4, 2);
  25520   array->f->setAtSmallBytes(array, 1, &b2);
  25521   r = self->f->icEqualSmallArray(self, array);
  25522   ck_assert(!r);
  25523   // non smallArray object
  25524   terminateO(array);
  25525   array = (smallArrayt*) allocSmallInt(2);
  25526   r = self->f->icEqualSmallArray(self, array);
  25527   ck_assert(!r);
  25528   // NULL array
  25529   r = self->f->icEqualSmallArray(self, NULL);
  25530   ck_assert(!r);
  25531   // non json array
  25532   freeO(self);
  25533   setTypeDictO(self);
  25534   ck_assert(!self->f->icEqualSmallArray(self, array));
  25535   // non smallArray array
  25536   freeO(self);
  25537   setTypeArrayO(self);
  25538   terminateO(array);
  25539   array = (smallArrayt*) allocSmallInt(2);
  25540   r = self->f->icEqualSmallArray(self, array);
  25541   ck_assert(!r);
  25542   terminateO(array);
  25543   terminateO(self);
  25544 
  25545 END_TEST
  25546 
  25547 
  25548 START_TEST(icEqualSmallJsonArrayT)
  25549 
  25550   bool r;
  25551   smallJsont *self = allocG(rtSmallJsont);
  25552   char ** p2       = NULL;
  25553 
  25554   // empty arrays
  25555   setTypeArrayO(self);
  25556   r = self->f->icEqualArray(self, NULL);
  25557   ck_assert(r);
  25558   // empty self, non empty array
  25559   p2 = listCreateS("a");
  25560   r = self->f->icEqualArray(self, p2);
  25561   ck_assert(!r);
  25562   // non empty self, empty array
  25563   self->f->pushInt(self, 1);
  25564   listFreeS(p2);
  25565   listEmptyS(p2);
  25566   r = self->f->icEqualArray(self, p2);
  25567   ck_assert(!r);
  25568   // different lengths
  25569   listPushS(&p2, "a");
  25570   self->f->pushInt(self, 2);
  25571   r = self->f->icEqualArray(self, p2);
  25572   ck_assert(!r);
  25573   // equal arrays
  25574   emptyO(self);
  25575   self->f->pushS(self, "A");
  25576   r = self->f->icEqualArray(self, p2);
  25577   ck_assert(r);
  25578   // not string type in self
  25579   self->f->setAtInt(self, 0, 0);
  25580   r = self->f->icEqualArray(self, p2);
  25581   ck_assert(!r);
  25582   // array same length with a null element in self
  25583   smallIntt *i = self->f->getAtSmallInt(self, 0);
  25584   terminateO(i);
  25585   removeElemIndexO(self, 0);
  25586   r = self->f->icEqualArray(self, p2);
  25587   ck_assert(!r);
  25588   // different strings
  25589   self->f->setAtS(self, 0, "bb");
  25590   r = self->f->icEqualArray(self, p2);
  25591   ck_assert(!r);
  25592   // non json array
  25593   freeO(self);
  25594   setTypeBoolO(self);
  25595   ck_assert(!self->f->icEqualArray(self, p2));
  25596   listFreeS(p2);
  25597   terminateO(self);
  25598 
  25599 END_TEST
  25600 
  25601 
  25602 START_TEST(icEqualSmallJsonBaseT)
  25603 
  25604   bool r;
  25605   smallJsont *self = allocG(rtSmallJsont);
  25606   baset* p2;
  25607 
  25608   // json bool
  25609   setTopBoolO(self, false);
  25610   p2 = (baset*) allocSmallBool(false);
  25611   r = self->f->icEqualBase(self, p2);
  25612   ck_assert(r);
  25613   freeO(self);
  25614   setTopBoolO(self, true);
  25615   r = self->f->icEqualBase(self, p2);
  25616   ck_assert(!r);
  25617   terminateO(p2);
  25618   p2 = (baset*) allocSmallBool(true);
  25619   r = self->f->icEqualBase(self, p2);
  25620   ck_assert(r);
  25621   //  non equal
  25622   terminateO(p2);
  25623   p2 = (baset*) allocSmallString("true ");
  25624   r = self->f->icEqualBase(self, p2);
  25625   ck_assert(!r);
  25626   // json double
  25627   freeO(self);
  25628   setTopDoubleO(self, 2.2);
  25629   terminateO(p2);
  25630   p2 = (baset*) allocSmallString("2.2");
  25631   r = self->f->icEqualBase(self, p2);
  25632   ck_assert(r);
  25633   freeO(self);
  25634   setTopDoubleO(self, 2);
  25635   r = self->f->icEqualBase(self, p2);
  25636   ck_assert(!r);
  25637   terminateO(p2);
  25638   //  p2 is an int so not equal to double (int)2 != (double)2
  25639   //  TODO is this reasonable?
  25640   p2 = (baset*) allocSmallInt(2);
  25641   r = self->f->icEqualBase(self, p2);
  25642   ck_assert(!r);
  25643   terminateO(p2);
  25644   p2 = (baset*) allocSmallString("asd");
  25645   r = self->f->icEqualBase(self, p2);
  25646   ck_assert(!r);
  25647   // json int
  25648   freeO(self);
  25649   setTopIntO(self, 2);
  25650   terminateO(p2);
  25651   p2 = (baset*) allocSmallString("2");
  25652   r = self->f->icEqualBase(self, p2);
  25653   ck_assert(r);
  25654   terminateO(p2);
  25655   p2 = (baset*) allocSmallString("3");
  25656   r = self->f->icEqualBase(self, p2);
  25657   ck_assert(!r);
  25658   terminateO(p2);
  25659   p2 = (baset*) allocSmallDouble(2);
  25660   r = self->f->icEqualBase(self, p2);
  25661   ck_assert(!r);
  25662   terminateO(p2);
  25663   p2 = (baset*) allocSmallString("asd");
  25664   r = self->f->icEqualBase(self, p2);
  25665   ck_assert(!r);
  25666   // json string
  25667   freeO(self);
  25668   setTopSO(self, "asd");
  25669   terminateO(p2);
  25670   p2 = (baset*) allocSmallString("ASD");
  25671   r = self->f->icEqualBase(self, p2);
  25672   ck_assert(r);
  25673   // empty self
  25674   freeO(self);
  25675   r = self->f->icEqualBase(self, p2);
  25676   ck_assert(!r);
  25677   //  non smallString p2
  25678   setTopSO(self, "asd");
  25679   terminateO(p2);
  25680   p2 = (baset*) allocSmallBool(false);
  25681   r = self->f->icEqualBase(self, p2);
  25682   ck_assert(!r);
  25683   // json dict
  25684   freeO(self);
  25685   setTypeDictO(self);
  25686   self->f->setS(self, "1", "a");
  25687   terminateO(p2);
  25688   p2 = (baset*) allocSmallInt(12);
  25689   r = self->f->icEqualBase(self, p2);
  25690   ck_assert(!r);
  25691   terminateO(p2);
  25692   smallDictt *d = allocSmallDict();
  25693   d->f->setS(d, "1", "A");
  25694   p2 = (baset*) d;
  25695   r = self->f->icEqualBase(self, p2);
  25696   ck_assert(r);
  25697   // json array
  25698   freeO(self);
  25699   setTypeArrayO(self);
  25700   self->f->pushS(self, "a");
  25701   terminateO(p2);
  25702   p2 = (baset*) allocSmallInt(12);
  25703   r = self->f->icEqualBase(self, p2);
  25704   ck_assert(!r);
  25705   r = self->f->icEqualBase(self, p2);
  25706   ck_assert(!r);
  25707   terminateO(p2);
  25708   smallArrayt *a = allocSmallArray();
  25709   a->f->pushS(a, "A");
  25710   p2 = (baset*) a;
  25711   r = self->f->icEqualBase(self, p2);
  25712   ck_assert(r);
  25713   // null object
  25714   freeO(self);
  25715   setTopSO(self, "qwe");
  25716   r = self->f->icEqualBase(self, null);
  25717   ck_assert(!r);
  25718   terminateO(p2);
  25719   terminateO(self);
  25720 
  25721 END_TEST
  25722 
  25723 
  25724 START_TEST(icEqualSmallJsonSmallDictT)
  25725 
  25726   bool r;
  25727   smallJsont* self = allocG(rtSmallJsont);
  25728   smallDictt* p2   = allocSmallDict();
  25729 
  25730   // empty json
  25731   r = self->f->icEqualSmallDict(self, p2);
  25732   ck_assert(!r);
  25733   setTypeDictO(self);
  25734   r = self->f->icEqualSmallDict(self, p2);
  25735   ck_assert(!r);
  25736   // equal
  25737   self->f->setS(self, "a", "a");
  25738   self->f->setInt(self, "b", 2);
  25739   self->f->setInt(self, "c", 3);
  25740   p2->f->setInt(p2, "b", 2);
  25741   p2->f->setS(p2, "a", "A");
  25742   p2->f->setInt(p2, "c", 3);
  25743   r = self->f->icEqualSmallDict(self, p2);
  25744   ck_assert(r);
  25745   // non equal
  25746   p2->f->setInt(p2, "b", 1);
  25747   r = self->f->icEqualSmallDict(self, p2);
  25748   ck_assert(!r);
  25749   p2->f->del(p2, "b");
  25750   r = self->f->icEqualSmallDict(self, p2);
  25751   ck_assert(!r);
  25752   // empty smallDict
  25753   freeO(p2);
  25754   ck_assert(!self->f->icEqualSmallDict(self, p2));
  25755   // non smallDict
  25756   terminateO(p2);
  25757   p2 = (smallDictt*) allocSmallBool(false);
  25758   ck_assert(!self->f->icEqualSmallDict(self, p2));
  25759   // null
  25760   ck_assert(!self->f->icEqualSmallDict(self, null));
  25761   terminateO(p2);
  25762   terminateO(self);
  25763 
  25764 END_TEST
  25765 
  25766 
  25767 START_TEST(icEqualSmallJsonSmallJsonT)
  25768 
  25769   bool r;
  25770   smallJsont *self = allocG(rtSmallJsont);
  25771   smallJsont *string = allocSmallJson();
  25772 
  25773   // empty json
  25774   setTopSO(string, "qwe");
  25775   r = icEqualSmallJsonO(self, string);
  25776   ck_assert(!r);
  25777   // equal
  25778   setTopSO(self, "QWE");
  25779   r = icEqualSmallJsonO(self, string);
  25780   ck_assert(r);
  25781   // different length
  25782   freeO(self);
  25783   setTopSO(self, "QWE ");
  25784   r = icEqualSmallJsonO(self, string);
  25785   ck_assert(!r);
  25786   // non json string
  25787   terminateO(string);
  25788   string = (smallJsont*) allocSmallBool(true);
  25789   r = icEqualSmallJsonO(self, string);
  25790   ck_assert(!r);
  25791   // null
  25792   r = icEqualSmallJsonO(self, null);
  25793   ck_assert(!r);
  25794   terminateO(string);
  25795   terminateO(self);
  25796 
  25797 END_TEST
  25798 
  25799 
  25800 START_TEST(icEqualSmallJsonSmallStringT)
  25801 
  25802   bool r;
  25803   smallJsont *self     = allocG(rtSmallJsont);
  25804   smallStringt *string = allocSmallString("qwe");
  25805 
  25806   // empty json
  25807   r = icEqualSmallStringO(self, string);
  25808   ck_assert(!r);
  25809   // equal
  25810   setTopSO(self, "QWE");
  25811   r = icEqualSmallStringO(self, string);
  25812   ck_assert(r);
  25813   // different length
  25814   freeO(self);
  25815   setTopSO(self, "QWE ");
  25816   r = icEqualSmallStringO(self, string);
  25817   ck_assert(!r);
  25818   // empty string
  25819   freeO(string);
  25820   r = icEqualSmallStringO(self, string);
  25821   ck_assert(!r);
  25822   // non json string
  25823   terminateO(string);
  25824   string = (smallStringt*) allocSmallBool(true);
  25825   r = icEqualSmallStringO(self, string);
  25826   ck_assert(!r);
  25827   // null
  25828   r = icEqualSmallStringO(self, null);
  25829   ck_assert(!r);
  25830   terminateO(string);
  25831   terminateO(self);
  25832 
  25833 END_TEST
  25834 
  25835 
  25836 START_TEST(icEqualSSmallJsonT)
  25837 
  25838   bool r;
  25839   smallJsont *self = allocG(rtSmallJsont);
  25840 
  25841   // empty json
  25842   r = icEqualSO(self, "qwe");
  25843   ck_assert(!r);
  25844   // equal
  25845   setTopSO(self, "QWE");
  25846   r = icEqualSO(self, "qwe");
  25847   ck_assert(r);
  25848   // different length
  25849   r = icEqualSO(self, "qwe ");
  25850   ck_assert(!r);
  25851   // null
  25852   r = icEqualSO(self, null);
  25853   ck_assert(!r);
  25854   terminateO(self);
  25855 
  25856 END_TEST
  25857 
  25858 
  25859 START_TEST(icEqualCharSmallJsonT)
  25860 
  25861   bool r;
  25862   smallJsont *self = allocG(rtSmallJsont);
  25863   setTopSO(self, "");
  25864 
  25865   r = icEqualCharO(self,'q');
  25866   ck_assert(!r);
  25867   freeO(self);
  25868   setTopSO(self, "q");
  25869   r = icEqualCharO(self,'Q');
  25870   ck_assert(r);
  25871   // empty strings
  25872   freeO(self);
  25873   r = icEqualCharO(self, ' ');
  25874   ck_assert(!r);
  25875   // json int
  25876   freeO(self);
  25877   setTopIntO(self, 1);
  25878   r = icEqualCharO(self,'1');
  25879   ck_assert(r);
  25880   r = icEqualCharO(self,'2');
  25881   ck_assert(!r);
  25882   r = icEqualCharO(self,'q');
  25883   ck_assert(!r);
  25884   // non json string or int
  25885   freeO(self);
  25886   setTypeBoolO(self);
  25887   r = icEqualCharO(self,'2');
  25888   ck_assert(!r);
  25889   terminateO(self);
  25890 
  25891 END_TEST
  25892 
  25893 
  25894 START_TEST(equalISSmallJsonT)
  25895 
  25896   smallJsont *self = allocSmallJson();
  25897   setTopSO(self, "Ashee|");
  25898 
  25899   // identical strings
  25900   ck_assert(equalISO(self, "shee", 1));
  25901   freeO(self);
  25902   setTopSO(self, "Ashee");
  25903   ck_assert(equalISO(self, "shee", -4));
  25904   // string at index shorter than string2
  25905   ck_assert(!equalISO(self, "shee", 2));
  25906   // empty string
  25907   freeO(self);
  25908   setTopSO(self, "");
  25909   ck_assert(!equalISO(self, "shee", 0));
  25910   ck_assert(equalISO(self, "", 0));
  25911   freeO(self);
  25912   setTopSO(self, "Ashee");
  25913   ck_assert(!equalISO(self, "", 0));
  25914   // index mismatch
  25915   ck_assert(!equalISO(self, "shee", 0));
  25916   // index outside
  25917   ck_assert(!equalISO(self, "shee", 10));
  25918   ck_assert(!equalISO(self, "shee", -10));
  25919   // different strings
  25920   ck_assert(!equalISO(self, "SH",0));
  25921   // empty self
  25922   freeO(self);
  25923   ck_assert(!equalISO(self, "SH",0));
  25924   // NULL string
  25925   freeO(self);
  25926   setTopSO(self, "Ashee");
  25927   ck_assert(!equalISO(self, NULL, 0));
  25928   terminateO(self);
  25929 
  25930 END_TEST
  25931 
  25932 
  25933 START_TEST(equalICharSmallJsonT)
  25934 
  25935   smallJsont *self = allocSmallJson();
  25936   setTopSO(self, "Ashee");
  25937 
  25938   // identical strings
  25939   ck_assert(equalICharO(self, 's', 1));
  25940   ck_assert(equalICharO(self, 's', -4));
  25941   ck_assert(!equalICharO(self, 's', 2));
  25942   // empty string
  25943   freeO(self);
  25944   setTopSO(self, "");
  25945   ck_assert(!equalICharO(self, 's', 0));
  25946   ck_assert(equalICharO(self, 0, 0));
  25947   freeO(self);
  25948   setTopSO(self, "Ashee");
  25949   ck_assert(!equalICharO(self, 0, 0));
  25950   // index mismatch
  25951   ck_assert(!equalICharO(self, 's', 0));
  25952   // index outside
  25953   ck_assert(!equalICharO(self, 's', 10));
  25954   ck_assert(!equalICharO(self, 's', -10));
  25955   // different strings
  25956   freeO(self);
  25957   setTopSO(self, "shee");
  25958   ck_assert(!equalICharO(self, 'S',0));
  25959   // NULL string
  25960   ck_assert(!equalICharO(self, 0, 0));
  25961   // empty self
  25962   freeO(self);
  25963   ck_assert(!equalICharO(self, 'S',0));
  25964   terminateO(self);
  25965 
  25966 END_TEST
  25967 
  25968 
  25969 START_TEST(equalIJsonSmallJsonT)
  25970 
  25971   smallJsont *self = allocSmallJson();
  25972   setTopSO(self, "Ashee|");
  25973   smallJsont *string = allocSmallJson();
  25974 
  25975   // identical strings
  25976   setTopSO(string, "shee");
  25977   ck_assert(equalIJsonO(self, string, 1));
  25978   freeO(self);
  25979   setTopSO(self, "Ashee");
  25980   ck_assert(equalIJsonO(self, string, -4));
  25981   // string at index shorter than string2
  25982   ck_assert(!equalIJsonO(self, string, 2));
  25983   // empty string
  25984   freeO(self);
  25985   setTopSO(self, "");
  25986   ck_assert(!equalIJsonO(self, string, 0));
  25987   freeO(string);
  25988   setTopSO(string, "");
  25989   ck_assert(equalIJsonO(self, string, 0));
  25990   freeO(self);
  25991   setTopSO(self, "Ashee");
  25992   ck_assert(!equalIJsonO(self, string, 0));
  25993   // index mismatch
  25994   freeO(string);
  25995   setTopSO(string, "shee");
  25996   ck_assert(!equalIJsonO(self, string, 0));
  25997   // index outside
  25998   ck_assert(!equalIJsonO(self, string, 10));
  25999   ck_assert(!equalIJsonO(self, string, -10));
  26000   // different strings
  26001   freeO(string);
  26002   setTopSO(string, "SH");
  26003   ck_assert(!equalIJsonO(self, string,0));
  26004   // non json string
  26005   freeO(string);
  26006   setTopIntO(string, 1);
  26007   ck_assert(!equalIJsonO(self, string,0));
  26008   // non json object
  26009   terminateO(string);
  26010   string = (smallJsont*) allocSmallInt(2);
  26011   ck_assert(!equalIJsonO(self, string,0));
  26012   // empty self
  26013   terminateO(string);
  26014   string = allocSmallJson();
  26015   setTopSO(string, "SH");
  26016   freeO(self);
  26017   ck_assert(!equalIJsonO(self, string,0));
  26018   // NULL string
  26019   freeO(self);
  26020   setTopSO(self, "Ashee");
  26021   ck_assert(!equalIJsonO(self, NULL, 0));
  26022   terminateO(string);
  26023   terminateO(self);
  26024 
  26025 END_TEST
  26026 
  26027 
  26028 START_TEST(equalISmallStringSmallJsonT)
  26029 
  26030   smallJsont *self = allocSmallJson();
  26031   setTopSO(self, "Ashee|");
  26032   smallStringt *string = allocSmallString("shee");
  26033 
  26034   // identical strings
  26035   ck_assert(equalISmallStringO(self, string, 1));
  26036   freeO(self);
  26037   setTopSO(self, "Ashee");
  26038   ck_assert(equalISmallStringO(self, string, -4));
  26039   // string at index shorter than string2
  26040   ck_assert(!equalISmallStringO(self, string, 2));
  26041   // empty string
  26042   freeO(self);
  26043   setTopSO(self, "");
  26044   ck_assert(!equalISmallStringO(self, string, 0));
  26045   setValO(string, "");
  26046   ck_assert(equalISmallStringO(self, string, 0));
  26047   freeO(self);
  26048   setTopSO(self, "Ashee");
  26049   ck_assert(!equalISmallStringO(self, string, 0));
  26050   // index mismatch
  26051   freeO(string);
  26052   setValO(string, "shee");
  26053   ck_assert(!equalISmallStringO(self, string, 0));
  26054   // index outside
  26055   ck_assert(!equalISmallStringO(self, string, 10));
  26056   ck_assert(!equalISmallStringO(self, string, -10));
  26057   // different strings
  26058   setValO(string, "SH");
  26059   ck_assert(!equalISmallStringO(self, string,0));
  26060   // non smallString object
  26061   terminateO(string);
  26062   string = (smallStringt*) allocSmallInt(2);
  26063   ck_assert(!equalISmallStringO(self, string,0));
  26064   // empty self
  26065   terminateO(string);
  26066   string = allocSmallString("SH");
  26067   freeO(self);
  26068   ck_assert(!equalISmallStringO(self, string,0));
  26069   // NULL string
  26070   freeO(self);
  26071   setTopSO(self, "Ashee");
  26072   ck_assert(!equalISmallStringO(self, NULL, 0));
  26073   terminateO(string);
  26074   terminateO(self);
  26075 
  26076 END_TEST
  26077 
  26078 
  26079 START_TEST(startsWithSSmallJsonT)
  26080 
  26081   smallJsont *self = allocSmallJson();
  26082   setTopSO(self, "shee");
  26083 
  26084   // identical strings
  26085   ck_assert(startsWithSO(self, "shee"));
  26086   freeO(self);
  26087   setTopSO(self, "sheepy");
  26088   ck_assert(startsWithSO(self, "shee"));
  26089   // different strings
  26090   freeO(self);
  26091   setTopSO(self, "shee");
  26092   ck_assert(!startsWithSO(self, "SH"));
  26093   ck_assert(!startsWithSO(self, "sheep"));
  26094   freeO(self);
  26095   setTopSO(self, "-shee");
  26096   ck_assert(!startsWithSO(self, "shee"));
  26097   // NULL string
  26098   ck_assert(!startsWithSO(self, NULL));
  26099   // empty self
  26100   freeO(self);
  26101   ck_assert(!startsWithSO(self, "shee"));
  26102   terminateO(self);
  26103 
  26104 END_TEST
  26105 
  26106 
  26107 START_TEST(startsWithCharSmallJsonT)
  26108 
  26109   smallJsont *self = allocSmallJson();
  26110   setTopSO(self, "shee");
  26111 
  26112   // identical strings
  26113   ck_assert(startsWithCharO(self, 's'));
  26114   freeO(self);
  26115   setTopSO(self, "sheepy");
  26116   ck_assert(startsWithCharO(self, 's'));
  26117   freeO(self);
  26118   setTopSO(self, "");
  26119   ck_assert(startsWithCharO(self, 0));
  26120   // different strings
  26121   freeO(self);
  26122   setTopSO(self, "shee");
  26123   ck_assert(!startsWithCharO(self, 'S'));
  26124   freeO(self);
  26125   setTopSO(self, "-shee");
  26126   ck_assert(!startsWithCharO(self, 's'));
  26127   freeO(self);
  26128   setTopSO(self, "");
  26129   ck_assert(!startsWithCharO(self, '0'));
  26130   // NULL string
  26131   freeO(self);
  26132   setTopSO(self, "shee");
  26133   ck_assert(!startsWithCharO(self, 0));
  26134   // empty self
  26135   freeO(self);
  26136   ck_assert(!startsWithCharO(self, '0'));
  26137   terminateO(self);
  26138 
  26139 END_TEST
  26140 
  26141 
  26142 START_TEST(startsWithSmallStringSmallJsonT)
  26143 
  26144   smallJsont *self = allocSmallJson();
  26145   setTopSO(self, "shee");
  26146   smallStringt *string = allocSmallString("shee");
  26147 
  26148   // identical strings
  26149   ck_assert(startsWithSmallStringO(self, string));
  26150   freeO(self);
  26151   setTopSO(self, "sheepy");
  26152   ck_assert(startsWithSmallStringO(self, string));
  26153   // different strings
  26154   freeO(self);
  26155   setTopSO(self, "shee");
  26156   setValO(string, "SH");
  26157   ck_assert(!startsWithSmallStringO(self, string));
  26158   setValO(string, "sheep");
  26159   ck_assert(!startsWithSmallStringO(self, string));
  26160   freeO(self);
  26161   setTopSO(self, "-shee");
  26162   setValO(string, "shee");
  26163   ck_assert(!startsWithSmallStringO(self, string));
  26164   // non smallString object
  26165   terminateO(string);
  26166   string = (smallStringt*) allocSmallInt(1);
  26167   ck_assert(!startsWithSmallStringO(self, string));
  26168   terminateO(string);
  26169   string = allocSmallString("shee");
  26170   // NULL string
  26171   ck_assert(!startsWithSmallStringO(self, NULL));
  26172   // empty self
  26173   freeO(self);
  26174   ck_assert(!startsWithSmallStringO(self, string));
  26175   terminateO(string);
  26176   terminateO(self);
  26177 
  26178 END_TEST
  26179 
  26180 
  26181 START_TEST(startsWithJsonSmallJsonT)
  26182 
  26183   smallJsont *self = allocSmallJson();
  26184   setTopSO(self, "shee");
  26185   smallJsont *string = allocSmallJson();
  26186 
  26187   // identical strings
  26188   setTopSO(string, "shee");
  26189   ck_assert(startsWithJsonO(self, string));
  26190   freeO(self);
  26191   setTopSO(self, "sheepy");
  26192   ck_assert(startsWithJsonO(self, string));
  26193   // different strings
  26194   freeO(self);
  26195   setTopSO(self, "shee");
  26196   freeO(string);
  26197   setTopSO(string, "SH");
  26198   ck_assert(!startsWithJsonO(self, string));
  26199   freeO(string);
  26200   setTopSO(string, "sheep");
  26201   ck_assert(!startsWithJsonO(self, string));
  26202   freeO(self);
  26203   setTopSO(self, "-shee");
  26204   freeO(string);
  26205   setTopSO(string, "shee");
  26206   ck_assert(!startsWithJsonO(self, string));
  26207   // non json string
  26208   freeO(string);
  26209   setTopIntO(string, 1);
  26210   ck_assert(!startsWithJsonO(self, string));
  26211   // non json object
  26212   terminateO(string);
  26213   string = (smallJsont*) allocSmallInt(1);
  26214   ck_assert(!startsWithJsonO(self, string));
  26215   terminateO(string);
  26216   string = allocSmallJson();
  26217   // NULL string
  26218   ck_assert(!startsWithJsonO(self, NULL));
  26219   // empty self
  26220   freeO(self);
  26221   setTopSO(string, "shee");
  26222   ck_assert(!startsWithJsonO(self, string));
  26223   terminateO(string);
  26224   terminateO(self);
  26225 
  26226 END_TEST
  26227 
  26228 
  26229 START_TEST(endsWithSSmallJsonT)
  26230 
  26231   smallJsont *self = allocSmallJson();
  26232   setTopSO(self, "shee");
  26233 
  26234   // identical strings
  26235   ck_assert(endsWithSO(self, "shee"));
  26236   freeO(self);
  26237   setTopSO(self, "sheepy");
  26238   ck_assert(endsWithSO(self, "eepy"));
  26239   // different strings
  26240   freeO(self);
  26241   setTopSO(self, "shee");
  26242   ck_assert(!endsWithSO(self, "SH"));
  26243   ck_assert(!endsWithSO(self, "sheep"));
  26244   freeO(self);
  26245   setTopSO(self, "shee-");
  26246   ck_assert(!endsWithSO(self, "shee"));
  26247   // NULL string
  26248   ck_assert(!endsWithSO(self, NULL));
  26249   // empty self
  26250   freeO(self);
  26251   ck_assert(!endsWithSO(self, "shee"));
  26252   terminateO(self);
  26253 
  26254 END_TEST
  26255 
  26256 
  26257 START_TEST(endsWithCharSmallJsonT)
  26258 
  26259   smallJsont *self = allocSmallJson();
  26260   setTopSO(self, "shee");
  26261 
  26262   // identical strings
  26263   ck_assert(endsWithCharO(self, 'e'));
  26264   freeO(self);
  26265   setTopSO(self, "sheepy");
  26266   ck_assert(endsWithCharO(self, 'y'));
  26267   freeO(self);
  26268   setTopSO(self, "");
  26269   ck_assert(endsWithCharO(self, 0));
  26270   // different strings
  26271   freeO(self);
  26272   setTopSO(self, "shee");
  26273   ck_assert(!endsWithCharO(self, 'E'));
  26274   ck_assert(!endsWithCharO(self, 'p'));
  26275   freeO(self);
  26276   setTopSO(self, "shee-");
  26277   ck_assert(!endsWithCharO(self, 'e'));
  26278   freeO(self);
  26279   setTopSO(self, "");
  26280   ck_assert(!endsWithCharO(self, '0'));
  26281   // NULL string
  26282   freeO(self);
  26283   setTopSO(self, "a");
  26284   ck_assert(!endsWithCharO(self, 0));
  26285   // empty self
  26286   freeO(self);
  26287   ck_assert(!endsWithCharO(self, '0'));
  26288   terminateO(self);
  26289 
  26290 END_TEST
  26291 
  26292 
  26293 START_TEST(endsWithSmallStringSmallJsonT)
  26294 
  26295   smallJsont *self = allocSmallJson();
  26296   setTopSO(self, "shee");
  26297   smallStringt *string = allocSmallString("shee");
  26298 
  26299   // identical strings
  26300   ck_assert(endsWithSmallStringO(self, string));
  26301   freeO(self);
  26302   setTopSO(self, "sheepy");
  26303   setValO(string, "eepy");
  26304   ck_assert(endsWithSmallStringO(self, string));
  26305   // different strings
  26306   freeO(self);
  26307   setTopSO(self, "shee");
  26308   ck_assert(!endsWithSmallStringO(self, string));
  26309   setValO(string, "sheep");
  26310   ck_assert(!endsWithSmallStringO(self, string));
  26311   freeO(self);
  26312   setTopSO(self, "shee-");
  26313   setValO(string, "shee");
  26314   ck_assert(!endsWithSmallStringO(self, string));
  26315   // non smallString object
  26316   terminateO(string);
  26317   string = (smallStringt*) allocSmallInt(1);
  26318   ck_assert(!endsWithSmallStringO(self, string));
  26319   terminateO(string);
  26320   string = allocSmallString("shee");
  26321   // NULL string
  26322   ck_assert(!endsWithSmallStringO(self, NULL));
  26323   // empty self
  26324   freeO(self);
  26325   ck_assert(!endsWithSmallStringO(self, string));
  26326   terminateO(string);
  26327   terminateO(self);
  26328 
  26329 END_TEST
  26330 
  26331 
  26332 START_TEST(endsWithJsonSmallJsonT)
  26333 
  26334   smallJsont *self = allocSmallJson();
  26335   setTopSO(self, "shee");
  26336   smallJsont *string = allocSmallJson();
  26337 
  26338   // identical strings
  26339   setTopSO(string, "shee");
  26340   ck_assert(endsWithJsonO(self, string));
  26341   freeO(self);
  26342   setTopSO(self, "sheepy");
  26343   freeO(string);
  26344   setTopSO(string, "eepy");
  26345   ck_assert(endsWithJsonO(self, string));
  26346   // different strings
  26347   freeO(self);
  26348   setTopSO(self, "shee");
  26349   freeO(string);
  26350   setTopSO(string, "SH");
  26351   ck_assert(!endsWithJsonO(self, string));
  26352   freeO(string);
  26353   setTopSO(string, "sheep");
  26354   ck_assert(!endsWithJsonO(self, string));
  26355   freeO(self);
  26356   setTopSO(self, "shee-");
  26357   freeO(string);
  26358   setTopSO(string, "shee");
  26359   ck_assert(!endsWithJsonO(self, string));
  26360   // non json string
  26361   freeO(string);
  26362   setTopIntO(string, 1);
  26363   ck_assert(!endsWithJsonO(self, string));
  26364   // non json object
  26365   terminateO(string);
  26366   string = (smallJsont*) allocSmallInt(1);
  26367   ck_assert(!endsWithJsonO(self, string));
  26368   terminateO(string);
  26369   string = allocSmallJson();
  26370   setTopSO(string, "shee");
  26371   // NULL string
  26372   ck_assert(!endsWithJsonO(self, NULL));
  26373   // empty self
  26374   freeO(self);
  26375   ck_assert(!endsWithJsonO(self, string));
  26376   terminateO(string);
  26377   terminateO(self);
  26378 
  26379 END_TEST
  26380 
  26381 
  26382 START_TEST(countSSmallJsonT)
  26383 
  26384   smallJsont *self = allocSmallJson();
  26385   setTopSO(self, "sheepy");
  26386 
  26387   // positive count
  26388   ck_assert_int_eq(countSO(self, "shee"), 1);
  26389   freeO(self);
  26390   setTopSO(self, "aaa aaa");
  26391   ck_assert_int_eq(countSO(self, "a"), 6);
  26392   ck_assert_int_eq(countSO(self, "aa"), 2);
  26393   // 0 count
  26394   freeO(self);
  26395   setTopSO(self, "shee");
  26396   ck_assert_int_eq(countSO(self, "SH"), 0);
  26397   ck_assert_int_eq(countSO(self, "sheepy"), 0);
  26398   freeO(self);
  26399   setTopSO(self, "aaa aaa");
  26400   ck_assert_int_eq(countSO(self, "ab"), 0);
  26401   // empty string
  26402   ck_assert_int_eq(countSO(self, ""), -1);
  26403   // NULL string
  26404   ck_assert_int_eq(countSO(self, NULL), -1);
  26405   // empty self
  26406   freeO(self);
  26407   ck_assert_int_eq(countSO(self, "ab"), -1);
  26408   terminateO(self);
  26409 
  26410 END_TEST
  26411 
  26412 
  26413 START_TEST(countCharSmallJsonT)
  26414 
  26415   smallJsont *self = allocSmallJson();
  26416   setTopSO(self, "shee");
  26417 
  26418   // positive count
  26419   ck_assert_int_eq(countCharO(self, 's'), 1);
  26420   freeO(self);
  26421   setTopSO(self, "aaa aaa");
  26422   ck_assert_int_eq(countCharO(self, 'a'), 6);
  26423   // 0 count
  26424   freeO(self);
  26425   setTopSO(self, "shee");
  26426   ck_assert_int_eq(countCharO(self, 'S'), 0);
  26427   ck_assert_int_eq(countCharO(self, 'y'), 0);
  26428   freeO(self);
  26429   setTopSO(self, "aaa aaa");
  26430   ck_assert_int_eq(countCharO(self, 'b'), 0);
  26431   // empty string
  26432   freeO(self);
  26433   setTopSO(self, "");
  26434   ck_assert_int_eq(countCharO(self, 'a'), 0);
  26435   ck_assert_int_eq(countCharO(self, 0), -1);
  26436   // NULL string
  26437   freeO(self);
  26438   setTopSO(self, "a");
  26439   ck_assert_int_eq(countCharO(self, 0), -1);
  26440   // empty self
  26441   freeO(self);
  26442   ck_assert_int_eq(countCharO(self, 'a'), -1);
  26443   terminateO(self);
  26444 
  26445 END_TEST
  26446 
  26447 
  26448 START_TEST(countSmallStringSmallJsonT)
  26449 
  26450   smallJsont *self = allocSmallJson();
  26451   setTopSO(self, "sheepy");
  26452   smallStringt *string = allocSmallString("shee");
  26453 
  26454   // positive count
  26455   ck_assert_int_eq(countSmallStringO(self, string), 1);
  26456   freeO(self);
  26457   setTopSO(self, "aaa aaa");
  26458   setValO(string, "a");
  26459   ck_assert_int_eq(countSmallStringO(self, string), 6);
  26460   setValO(string, "aa");
  26461   ck_assert_int_eq(countSmallStringO(self, string), 2);
  26462   // 0 count
  26463   freeO(self);
  26464   setTopSO(self, "shee");
  26465   setValO(string, "SH");
  26466   ck_assert_int_eq(countSmallStringO(self, string), 0);
  26467   setValO(string, "sheepy");
  26468   ck_assert_int_eq(countSmallStringO(self, string), 0);
  26469   freeO(self);
  26470   setTopSO(self, "aaa aaa");
  26471   setValO(string, "ab");
  26472   ck_assert_int_eq(countSmallStringO(self, string), 0);
  26473   // non json object
  26474   terminateO(string);
  26475   string = (smallStringt*) allocSmallInt(1);
  26476   ck_assert_int_eq(countSmallStringO(self, string), -1);
  26477   terminateO(string);
  26478   string = allocSmallString("");
  26479   // empty string
  26480   ck_assert_int_eq(countSmallStringO(self, string), -1);
  26481   freeO(string);
  26482   ck_assert_int_eq(countSmallStringO(self, string), -1);
  26483   // NULL string
  26484   ck_assert_int_eq(countSmallStringO(self, NULL), -1);
  26485   // empty self
  26486   freeO(self);
  26487   setValO(string, "ab");
  26488   ck_assert_int_eq(countSmallStringO(self, string), -1);
  26489   terminateO(string);
  26490   terminateO(self);
  26491 
  26492 END_TEST
  26493 
  26494 
  26495 START_TEST(countJsonSmallJsonT)
  26496 
  26497   smallJsont *self = allocSmallJson();
  26498   setTopSO(self, "sheepy");
  26499   smallJsont *string = allocSmallJson();
  26500 
  26501   // positive count
  26502   setTopSO(string, "shee");
  26503   ck_assert_int_eq(countJsonO(self, string), 1);
  26504   freeO(self);
  26505   setTopSO(self, "aaa aaa");
  26506   freeO(string);
  26507   setTopSO(string, "a");
  26508   ck_assert_int_eq(countJsonO(self, string), 6);
  26509   freeO(string);
  26510   setTopSO(string, "aa");
  26511   ck_assert_int_eq(countJsonO(self, string), 2);
  26512   // 0 count
  26513   freeO(self);
  26514   setTopSO(self, "shee");
  26515   freeO(string);
  26516   setTopSO(string, "SH");
  26517   ck_assert_int_eq(countJsonO(self, string), 0);
  26518   freeO(string);
  26519   setTopSO(string, "sheepy");
  26520   ck_assert_int_eq(countJsonO(self, string), 0);
  26521   freeO(self);
  26522   setTopSO(self, "aaa aaa");
  26523   freeO(string);
  26524   setTopSO(string, "ab");
  26525   ck_assert_int_eq(countJsonO(self, string), 0);
  26526   // non json string
  26527   freeO(string);
  26528   setTopIntO(string, -1);
  26529   ck_assert_int_eq(countJsonO(self, string), -1);
  26530   // non json object
  26531   terminateO(string);
  26532   string = (smallJsont*) allocSmallInt(1);
  26533   ck_assert_int_eq(countJsonO(self, string), -1);
  26534   terminateO(string);
  26535   string = allocSmallJson();
  26536   // empty string
  26537   setTopSO(string, "");
  26538   ck_assert_int_eq(countJsonO(self, string), -1);
  26539   // NULL string
  26540   ck_assert_int_eq(countJsonO(self, NULL), -1);
  26541   // empty self
  26542   freeO(self);
  26543   freeO(string);
  26544   setTopSO(string, "ab");
  26545   ck_assert_int_eq(countJsonO(self, string), -1);
  26546   terminateO(string);
  26547   terminateO(self);
  26548 
  26549 END_TEST
  26550 
  26551 
  26552 START_TEST(icStartsWithSSmallJsonT)
  26553 
  26554   smallJsont *self = allocSmallJson();
  26555   setTopSO(self, "shee");
  26556 
  26557   // identical strings
  26558   ck_assert(icStartsWithSO(self, "shee"));
  26559   freeO(self);
  26560   setTopSO(self, "sheepy");
  26561   ck_assert(icStartsWithSO(self, "shee"));
  26562   // different strings
  26563   freeO(self);
  26564   setTopSO(self, "shee");
  26565   ck_assert(icStartsWithSO(self, "SH"));
  26566   ck_assert(!icStartsWithSO(self, "sheep"));
  26567   freeO(self);
  26568   setTopSO(self, "-shee");
  26569   ck_assert(!icStartsWithSO(self, "shee"));
  26570   // NULL string
  26571   ck_assert(!icStartsWithSO(self, NULL));
  26572   // empty self
  26573   freeO(self);
  26574   ck_assert(!icStartsWithSO(self, "shee"));
  26575   terminateO(self);
  26576 
  26577 END_TEST
  26578 
  26579 
  26580 START_TEST(icStartsWithCharSmallJsonT)
  26581 
  26582   smallJsont *self = allocSmallJson();
  26583   setTopSO(self, "shee");
  26584 
  26585   // identical strings
  26586   ck_assert(icStartsWithCharO(self, 's'));
  26587   freeO(self);
  26588   setTopSO(self, "sheepy");
  26589   ck_assert(icStartsWithCharO(self, 's'));
  26590   freeO(self);
  26591   setTopSO(self, "");
  26592   ck_assert(icStartsWithCharO(self, 0));
  26593   // different strings
  26594   freeO(self);
  26595   setTopSO(self, "shee");
  26596   ck_assert(icStartsWithCharO(self, 'S'));
  26597   freeO(self);
  26598   setTopSO(self, "-shee");
  26599   ck_assert(!icStartsWithCharO(self, 's'));
  26600   freeO(self);
  26601   setTopSO(self, "");
  26602   ck_assert(!icStartsWithCharO(self, '0'));
  26603   // NULL string
  26604   freeO(self);
  26605   setTopSO(self, "shee");
  26606   ck_assert(!icStartsWithCharO(self, 0));
  26607   // empty self
  26608   freeO(self);
  26609   ck_assert(!icStartsWithCharO(self, '0'));
  26610   terminateO(self);
  26611 
  26612 END_TEST
  26613 
  26614 
  26615 START_TEST(icStartsWithSmallStringSmallJsonT)
  26616 
  26617   smallJsont *self = allocSmallJson();
  26618   setTopSO(self, "shee");
  26619   smallStringt *string = allocSmallString("shee");
  26620 
  26621   // identical strings
  26622   ck_assert(icStartsWithSmallStringO(self, string));
  26623   freeO(self);
  26624   setTopSO(self, "sheepy");
  26625   ck_assert(icStartsWithSmallStringO(self, string));
  26626   // different strings
  26627   freeO(self);
  26628   setTopSO(self, "shee");
  26629   setValO(string, "SH");
  26630   ck_assert(icStartsWithSmallStringO(self, string));
  26631   setValO(string, "sheep");
  26632   ck_assert(!icStartsWithSmallStringO(self, string));
  26633   freeO(self);
  26634   setTopSO(self, "-shee");
  26635   setValO(string, "shee");
  26636   ck_assert(!icStartsWithSmallStringO(self, string));
  26637   // non smallString object
  26638   terminateO(string);
  26639   string = (smallStringt*) allocSmallInt(1);
  26640   ck_assert(!icStartsWithSmallStringO(self, string));
  26641   terminateO(string);
  26642   string = allocSmallString("shee");
  26643   // NULL string
  26644   ck_assert(!icStartsWithSmallStringO(self, NULL));
  26645   // empty self
  26646   freeO(self);
  26647   ck_assert(!icStartsWithSmallStringO(self, string));
  26648   terminateO(string);
  26649   terminateO(self);
  26650 
  26651 END_TEST
  26652 
  26653 
  26654 START_TEST(icStartsWithJsonSmallJsonT)
  26655 
  26656   smallJsont *self = allocSmallJson();
  26657   setTopSO(self, "shee");
  26658   smallJsont *string = allocSmallJson();
  26659 
  26660   // identical strings
  26661   setTopSO(string, "shee");
  26662   ck_assert(icStartsWithJsonO(self, string));
  26663   freeO(self);
  26664   setTopSO(self, "sheepy");
  26665   ck_assert(icStartsWithJsonO(self, string));
  26666   // different strings
  26667   freeO(self);
  26668   setTopSO(self, "shee");
  26669   freeO(string);
  26670   setTopSO(string, "SH");
  26671   ck_assert(icStartsWithJsonO(self, string));
  26672   freeO(string);
  26673   setTopSO(string, "sheep");
  26674   ck_assert(!icStartsWithJsonO(self, string));
  26675   freeO(self);
  26676   setTopSO(self, "-shee");
  26677   freeO(string);
  26678   setTopSO(string, "shee");
  26679   ck_assert(!icStartsWithJsonO(self, string));
  26680   // non json string
  26681   freeO(string);
  26682   setTopIntO(string, 1);
  26683   ck_assert(!icStartsWithJsonO(self, string));
  26684   // non json object
  26685   terminateO(string);
  26686   string = (smallJsont*) allocSmallInt(1);
  26687   ck_assert(!icStartsWithJsonO(self, string));
  26688   terminateO(string);
  26689   string = allocSmallJson();
  26690   // NULL string
  26691   ck_assert(!icStartsWithJsonO(self, NULL));
  26692   // empty self
  26693   freeO(self);
  26694   setTopSO(string, "shee");
  26695   ck_assert(!icStartsWithJsonO(self, string));
  26696   terminateO(string);
  26697   terminateO(self);
  26698 
  26699 END_TEST
  26700 
  26701 
  26702 START_TEST(icEndsWithSSmallJsonT)
  26703 
  26704   smallJsont *self = allocSmallJson();
  26705   setTopSO(self, "shee");
  26706 
  26707   // identical strings
  26708   ck_assert(icEndsWithSO(self, "shee"));
  26709   freeO(self);
  26710   setTopSO(self, "sheepy");
  26711   ck_assert(icEndsWithSO(self, "EEPY"));
  26712   // different strings
  26713   freeO(self);
  26714   setTopSO(self, "shee");
  26715   ck_assert(!icEndsWithSO(self, "SH"));
  26716   ck_assert(!icEndsWithSO(self, "sheep"));
  26717   freeO(self);
  26718   setTopSO(self, "shee-");
  26719   ck_assert(!icEndsWithSO(self, "shee"));
  26720   // NULL string
  26721   ck_assert(!icEndsWithSO(self, NULL));
  26722   // empty self
  26723   freeO(self);
  26724   ck_assert(!icEndsWithSO(self, "shee"));
  26725   terminateO(self);
  26726 
  26727 END_TEST
  26728 
  26729 
  26730 START_TEST(icEndsWithCharSmallJsonT)
  26731 
  26732   smallJsont *self = allocSmallJson();
  26733   setTopSO(self, "shee");
  26734 
  26735   // identical strings
  26736   ck_assert(icEndsWithCharO(self, 'e'));
  26737   freeO(self);
  26738   setTopSO(self, "sheepy");
  26739   ck_assert(icEndsWithCharO(self, 'y'));
  26740   freeO(self);
  26741   setTopSO(self, "");
  26742   ck_assert(icEndsWithCharO(self, 0));
  26743   // different strings
  26744   freeO(self);
  26745   setTopSO(self, "shee");
  26746   ck_assert(icEndsWithCharO(self, 'E'));
  26747   ck_assert(!icEndsWithCharO(self, 'p'));
  26748   freeO(self);
  26749   setTopSO(self, "shee-");
  26750   ck_assert(!icEndsWithCharO(self, 'e'));
  26751   freeO(self);
  26752   setTopSO(self, "");
  26753   ck_assert(!icEndsWithCharO(self, '0'));
  26754   // NULL string
  26755   freeO(self);
  26756   setTopSO(self, "a");
  26757   ck_assert(!icEndsWithCharO(self, 0));
  26758   // empty self
  26759   freeO(self);
  26760   ck_assert(!icEndsWithCharO(self, '0'));
  26761   terminateO(self);
  26762 
  26763 END_TEST
  26764 
  26765 
  26766 START_TEST(icEndsWithSmallStringSmallJsonT)
  26767 
  26768   smallJsont *self = allocSmallJson();
  26769   setTopSO(self, "shee");
  26770   smallStringt *string = allocSmallString("shee");
  26771 
  26772   // identical strings
  26773   ck_assert(icEndsWithSmallStringO(self, string));
  26774   freeO(self);
  26775   setTopSO(self, "sheepy");
  26776   setValO(string, "EEPY");
  26777   ck_assert(icEndsWithSmallStringO(self, string));
  26778   // different strings
  26779   freeO(self);
  26780   setTopSO(self, "shee");
  26781   ck_assert(!icEndsWithSmallStringO(self, string));
  26782   setValO(string, "sheep");
  26783   ck_assert(!icEndsWithSmallStringO(self, string));
  26784   freeO(self);
  26785   setTopSO(self, "shee-");
  26786   setValO(string, "shee");
  26787   ck_assert(!icEndsWithSmallStringO(self, string));
  26788   // non smallString object
  26789   terminateO(string);
  26790   string = (smallStringt*) allocSmallInt(1);
  26791   ck_assert(!icEndsWithSmallStringO(self, string));
  26792   terminateO(string);
  26793   string = allocSmallString("shee");
  26794   // NULL string
  26795   ck_assert(!icEndsWithSmallStringO(self, NULL));
  26796   // empty self
  26797   freeO(self);
  26798   ck_assert(!icEndsWithSmallStringO(self, string));
  26799   terminateO(string);
  26800   terminateO(self);
  26801 
  26802 END_TEST
  26803 
  26804 
  26805 START_TEST(icEndsWithJsonSmallJsonT)
  26806 
  26807   smallJsont *self = allocSmallJson();
  26808   setTopSO(self, "shee");
  26809   smallJsont *string = allocSmallJson();
  26810 
  26811   // identical strings
  26812   setTopSO(string, "shee");
  26813   ck_assert(icEndsWithJsonO(self, string));
  26814   freeO(self);
  26815   setTopSO(self, "sheepy");
  26816   freeO(string);
  26817   setTopSO(string, "EEPY");
  26818   ck_assert(icEndsWithJsonO(self, string));
  26819   // different strings
  26820   freeO(self);
  26821   setTopSO(self, "shee");
  26822   freeO(string);
  26823   setTopSO(string, "SH");
  26824   ck_assert(!icEndsWithJsonO(self, string));
  26825   freeO(string);
  26826   setTopSO(string, "sheep");
  26827   ck_assert(!icEndsWithJsonO(self, string));
  26828   freeO(self);
  26829   setTopSO(self, "shee-");
  26830   freeO(string);
  26831   setTopSO(string, "shee");
  26832   ck_assert(!icEndsWithJsonO(self, string));
  26833   // non json string
  26834   freeO(string);
  26835   setTopIntO(string, 1);
  26836   ck_assert(!icEndsWithJsonO(self, string));
  26837   // non json object
  26838   terminateO(string);
  26839   string = (smallJsont*) allocSmallInt(1);
  26840   ck_assert(!icEndsWithJsonO(self, string));
  26841   terminateO(string);
  26842   string = allocSmallJson();
  26843   setTopSO(string, "shee");
  26844   // NULL string
  26845   ck_assert(!icEndsWithJsonO(self, NULL));
  26846   // empty self
  26847   freeO(self);
  26848   ck_assert(!icEndsWithJsonO(self, string));
  26849   terminateO(string);
  26850   terminateO(self);
  26851 
  26852 END_TEST
  26853 
  26854 
  26855 START_TEST(icCountSSmallJsonT)
  26856 
  26857   smallJsont *self = allocSmallJson();
  26858   setTopSO(self, "sheepy");
  26859 
  26860   // positive count
  26861   ck_assert_int_eq(icCountSO(self, "shee"), 1);
  26862   freeO(self);
  26863   setTopSO(self, "aaa aaa");
  26864   ck_assert_int_eq(icCountSO(self, "a"), 6);
  26865   ck_assert_int_eq(icCountSO(self, "Aa"), 2);
  26866   // 0 icCount
  26867   freeO(self);
  26868   setTopSO(self, "shee");
  26869   ck_assert_int_eq(icCountSO(self, "SH"), 1);
  26870   ck_assert_int_eq(icCountSO(self, "sheepy"), 0);
  26871   freeO(self);
  26872   setTopSO(self, "aaa aaa");
  26873   ck_assert_int_eq(icCountSO(self, "ab"), 0);
  26874   // empty string
  26875   ck_assert_int_eq(icCountSO(self, ""), -1);
  26876   // NULL string
  26877   ck_assert_int_eq(icCountSO(self, NULL), -1);
  26878   // empty self
  26879   freeO(self);
  26880   ck_assert_int_eq(icCountSO(self, "ab"), -1);
  26881   terminateO(self);
  26882 
  26883 END_TEST
  26884 
  26885 
  26886 START_TEST(icCountCharSmallJsonT)
  26887 
  26888   smallJsont *self = allocSmallJson();
  26889   setTopSO(self, "shee");
  26890 
  26891   // positive count
  26892   ck_assert_int_eq(icCountCharO(self, 's'), 1);
  26893   freeO(self);
  26894   setTopSO(self, "aaa aaa");
  26895   ck_assert_int_eq(icCountCharO(self, 'a'), 6);
  26896   // 0 icCount
  26897   freeO(self);
  26898   setTopSO(self, "shee");
  26899   ck_assert_int_eq(icCountCharO(self, 'S'), 1);
  26900   ck_assert_int_eq(icCountCharO(self, 'y'), 0);
  26901   freeO(self);
  26902   setTopSO(self, "aaa aaa");
  26903   ck_assert_int_eq(icCountCharO(self, 'b'), 0);
  26904   // empty string
  26905   freeO(self);
  26906   setTopSO(self, "");
  26907   ck_assert_int_eq(icCountCharO(self, 'a'), 0);
  26908   ck_assert_int_eq(icCountCharO(self, 0), -1);
  26909   // NULL string
  26910   freeO(self);
  26911   setTopSO(self, "a");
  26912   ck_assert_int_eq(icCountCharO(self, 0), -1);
  26913   // empty self
  26914   freeO(self);
  26915   ck_assert_int_eq(icCountCharO(self, 'a'), -1);
  26916   terminateO(self);
  26917 
  26918 END_TEST
  26919 
  26920 
  26921 START_TEST(icCountSmallStringSmallJsonT)
  26922 
  26923   smallJsont *self = allocSmallJson();
  26924   setTopSO(self, "sheepy");
  26925   smallStringt *string = allocSmallString("shee");
  26926 
  26927   // positive count
  26928   ck_assert_int_eq(icCountSmallStringO(self, string), 1);
  26929   freeO(self);
  26930   setTopSO(self, "aaa aaa");
  26931   setValO(string, "a");
  26932   ck_assert_int_eq(icCountSmallStringO(self, string), 6);
  26933   setValO(string, "aa");
  26934   ck_assert_int_eq(icCountSmallStringO(self, string), 2);
  26935   // 0 icCount
  26936   freeO(self);
  26937   setTopSO(self, "shee");
  26938   setValO(string, "SH");
  26939   ck_assert_int_eq(icCountSmallStringO(self, string), 1);
  26940   setValO(string, "sheepy");
  26941   ck_assert_int_eq(icCountSmallStringO(self, string), 0);
  26942   freeO(self);
  26943   setTopSO(self, "aaa aaa");
  26944   setValO(string, "ab");
  26945   ck_assert_int_eq(icCountSmallStringO(self, string), 0);
  26946   // non json object
  26947   terminateO(string);
  26948   string = (smallStringt*) allocSmallInt(1);
  26949   ck_assert_int_eq(icCountSmallStringO(self, string), -1);
  26950   terminateO(string);
  26951   string = allocSmallString("");
  26952   // empty string
  26953   ck_assert_int_eq(icCountSmallStringO(self, string), -1);
  26954   freeO(string);
  26955   ck_assert_int_eq(icCountSmallStringO(self, string), -1);
  26956   // NULL string
  26957   ck_assert_int_eq(icCountSmallStringO(self, NULL), -1);
  26958   // empty self
  26959   freeO(self);
  26960   setValO(string, "ab");
  26961   ck_assert_int_eq(icCountSmallStringO(self, string), -1);
  26962   terminateO(string);
  26963   terminateO(self);
  26964 
  26965 END_TEST
  26966 
  26967 
  26968 START_TEST(icCountJsonSmallJsonT)
  26969 
  26970   smallJsont *self = allocSmallJson();
  26971   setTopSO(self, "sheepy");
  26972   smallJsont *string = allocSmallJson();
  26973 
  26974   // positive count
  26975   setTopSO(string, "shee");
  26976   ck_assert_int_eq(icCountJsonO(self, string), 1);
  26977   freeO(self);
  26978   setTopSO(self, "aaa aaa");
  26979   freeO(string);
  26980   setTopSO(string, "a");
  26981   ck_assert_int_eq(icCountJsonO(self, string), 6);
  26982   freeO(string);
  26983   setTopSO(string, "aa");
  26984   ck_assert_int_eq(icCountJsonO(self, string), 2);
  26985   // 0 icCount
  26986   freeO(self);
  26987   setTopSO(self, "shee");
  26988   freeO(string);
  26989   setTopSO(string, "SH");
  26990   ck_assert_int_eq(icCountJsonO(self, string), 1);
  26991   freeO(string);
  26992   setTopSO(string, "sheepy");
  26993   ck_assert_int_eq(icCountJsonO(self, string), 0);
  26994   freeO(self);
  26995   setTopSO(self, "aaa aaa");
  26996   freeO(string);
  26997   setTopSO(string, "ab");
  26998   ck_assert_int_eq(icCountJsonO(self, string), 0);
  26999   // non json string
  27000   freeO(string);
  27001   setTopIntO(string, -1);
  27002   ck_assert_int_eq(icCountJsonO(self, string), -1);
  27003   // non json object
  27004   terminateO(string);
  27005   string = (smallJsont*) allocSmallInt(1);
  27006   ck_assert_int_eq(icCountJsonO(self, string), -1);
  27007   terminateO(string);
  27008   string = allocSmallJson();
  27009   // empty string
  27010   setTopSO(string, "");
  27011   ck_assert_int_eq(icCountJsonO(self, string), -1);
  27012   // NULL string
  27013   ck_assert_int_eq(icCountJsonO(self, NULL), -1);
  27014   // empty self
  27015   freeO(self);
  27016   freeO(string);
  27017   setTopSO(string, "ab");
  27018   ck_assert_int_eq(icCountJsonO(self, string), -1);
  27019   terminateO(string);
  27020   terminateO(self);
  27021 
  27022 END_TEST
  27023 
  27024 
  27025 START_TEST(isNumberSmallJsonT)
  27026 
  27027   smallJsont *self = allocSmallJson();
  27028   setTopSO(self, "");
  27029 
  27030   // number
  27031   freeO(self);
  27032   setTopSO(self, "-12.3");
  27033   ck_assert(isNumberO(self));
  27034   freeO(self);
  27035   setTopSO(self, "-123");
  27036   ck_assert(isNumberO(self));
  27037   freeO(self);
  27038   setTopSO(self, "123");
  27039   ck_assert(isNumberO(self));
  27040   freeO(self);
  27041   setTopSO(self, "1e23");
  27042   ck_assert(isNumberO(self));
  27043   freeO(self);
  27044   setTopSO(self, "12E-3");
  27045   ck_assert(isNumberO(self));
  27046   freeO(self);
  27047   setTopSO(self, ".123");
  27048   ck_assert(isNumberO(self));
  27049   freeO(self);
  27050   setTopSO(self, "-.123");
  27051   ck_assert(isNumberO(self));
  27052   freeO(self);
  27053   setTopSO(self, "1E+32");
  27054   ck_assert(isNumberO(self));
  27055   // not a number
  27056   freeO(self);
  27057   setTopSO(self, ".12e3");
  27058   ck_assert(!isNumberO(self));
  27059   freeO(self);
  27060   setTopSO(self, "-.12e3");
  27061   ck_assert(!isNumberO(self));
  27062   freeO(self);
  27063   setTopSO(self, "-1-23");
  27064   ck_assert(!isNumberO(self));
  27065   freeO(self);
  27066   setTopSO(self, "123-");
  27067   ck_assert(!isNumberO(self));
  27068   freeO(self);
  27069   setTopSO(self, "-");
  27070   ck_assert(!isNumberO(self));
  27071   freeO(self);
  27072   setTopSO(self, "-123.");
  27073   ck_assert(!isNumberO(self));
  27074   freeO(self);
  27075   setTopSO(self, "-1.2.3");
  27076   ck_assert(!isNumberO(self));
  27077   freeO(self);
  27078   setTopSO(self, "1-2.3");
  27079   ck_assert(!isNumberO(self));
  27080   freeO(self);
  27081   setTopSO(self, "12..3");
  27082   ck_assert(!isNumberO(self));
  27083   freeO(self);
  27084   setTopSO(self, ".12.3");
  27085   ck_assert(!isNumberO(self));
  27086   freeO(self);
  27087   setTopSO(self, ".");
  27088   ck_assert(!isNumberO(self));
  27089   freeO(self);
  27090   setTopSO(self, "E12");
  27091   ck_assert(!isNumberO(self));
  27092   freeO(self);
  27093   setTopSO(self, "E1E2");
  27094   ck_assert(!isNumberO(self));
  27095   freeO(self);
  27096   setTopSO(self, "E1.2");
  27097   ck_assert(!isNumberO(self));
  27098   freeO(self);
  27099   setTopSO(self, "1E");
  27100   ck_assert(!isNumberO(self));
  27101   freeO(self);
  27102   setTopSO(self, "1E2.3");
  27103   ck_assert(!isNumberO(self));
  27104   freeO(self);
  27105   setTopSO(self, "1-");
  27106   ck_assert(!isNumberO(self));
  27107   freeO(self);
  27108   setTopSO(self, "1E-");
  27109   ck_assert(!isNumberO(self));
  27110   freeO(self);
  27111   setTopSO(self, "lib123sheepy");
  27112   ck_assert(!isNumberO(self));
  27113   // string without number
  27114   freeO(self);
  27115   setTopSO(self, "s");
  27116   ck_assert(!isNumberO(self));
  27117   // empty string
  27118   freeO(self);
  27119   setTopSO(self, "");
  27120   ck_assert(!isNumberO(self));
  27121   // NULL string
  27122   freeO(self);
  27123   ck_assert(!isNumberO(self));
  27124   terminateO(self);
  27125 
  27126 END_TEST
  27127 
  27128 
  27129 START_TEST(isIntSmallJsonT)
  27130 
  27131   smallJsont *self = allocSmallJson();
  27132   setTopSO(self, "");
  27133 
  27134   // integer
  27135   freeO(self);
  27136   setTopSO(self, "-123");
  27137   ck_assert(isIntO(self));
  27138   freeO(self);
  27139   setTopSO(self, "123");
  27140   ck_assert(isIntO(self));
  27141   // not a integer
  27142   freeO(self);
  27143   setTopSO(self, "1e23");
  27144   ck_assert(!isIntO(self));
  27145   freeO(self);
  27146   setTopSO(self, "12E-3");
  27147   ck_assert(!isIntO(self));
  27148   freeO(self);
  27149   setTopSO(self, "-12.3");
  27150   ck_assert(!isIntO(self));
  27151   freeO(self);
  27152   setTopSO(self, "-1-23");
  27153   ck_assert(!isIntO(self));
  27154   freeO(self);
  27155   setTopSO(self, "123-");
  27156   ck_assert(!isIntO(self));
  27157   freeO(self);
  27158   setTopSO(self, "-");
  27159   ck_assert(!isIntO(self));
  27160   freeO(self);
  27161   setTopSO(self, "-123.");
  27162   ck_assert(!isIntO(self));
  27163   freeO(self);
  27164   setTopSO(self, ".123");
  27165   ck_assert(!isIntO(self));
  27166   freeO(self);
  27167   setTopSO(self, "-1.2.3");
  27168   ck_assert(!isIntO(self));
  27169   freeO(self);
  27170   setTopSO(self, "1-2.3");
  27171   ck_assert(!isIntO(self));
  27172   freeO(self);
  27173   setTopSO(self, "12..3");
  27174   ck_assert(!isIntO(self));
  27175   freeO(self);
  27176   setTopSO(self, ".");
  27177   ck_assert(!isIntO(self));
  27178   freeO(self);
  27179   setTopSO(self, "1E");
  27180   ck_assert(!isIntO(self));
  27181   freeO(self);
  27182   setTopSO(self, "1-");
  27183   ck_assert(!isIntO(self));
  27184   freeO(self);
  27185   setTopSO(self, "1E-");
  27186   ck_assert(!isIntO(self));
  27187   freeO(self);
  27188   setTopSO(self, "lib123sheepy");
  27189   ck_assert(!isIntO(self));
  27190   // string without number
  27191   freeO(self);
  27192   setTopSO(self, "s");
  27193   ck_assert(!isIntO(self));
  27194   // empty string
  27195   freeO(self);
  27196   setTopSO(self, "");
  27197   ck_assert(!isIntO(self));
  27198   // NULL string
  27199   freeO(self);
  27200   ck_assert(!isIntO(self));
  27201   terminateO(self);
  27202 
  27203 END_TEST
  27204 
  27205 
  27206 START_TEST(parseIntSmallJsonT)
  27207 
  27208   smallJsont *self = allocSmallJson();
  27209   setTopSO(self, "");
  27210 
  27211   // number
  27212   freeO(self);
  27213   setTopSO(self, "123sheepy");
  27214   ck_assert_int_eq(parseIntO(self), 123);
  27215   freeO(self);
  27216   setTopSO(self, "lib123sheepy");
  27217   ck_assert_int_eq(parseIntO(self), 123);
  27218   freeO(self);
  27219   setTopSO(self, "-123");
  27220   ck_assert_int_eq(parseIntO(self), -123);
  27221   // out of range - TODO check stderr
  27222   freeO(self);
  27223   setTopSO(self, "999999999999999999999999999999999999999");
  27224   parseIntO(self);
  27225   // string without number
  27226   freeO(self);
  27227   setTopSO(self, "sheepy");
  27228   ck_assert_int_eq(parseIntO(self), 0);
  27229   // NULL string
  27230   freeO(self);
  27231   ck_assert_int_eq(parseIntO(self), 0);
  27232   terminateO(self);
  27233 
  27234 END_TEST
  27235 
  27236 
  27237 START_TEST(parseDoubleSmallJsonT)
  27238 
  27239   smallJsont *self = allocSmallJson();
  27240   setTopSO(self, "");
  27241 
  27242   // number
  27243   freeO(self);
  27244   setTopSO(self, "123.2sheepy");
  27245   ck_assert_int_eq(parseDoubleO(self), 123);
  27246   freeO(self);
  27247   setTopSO(self, "lib123sheepy");
  27248   ck_assert_int_eq(parseDoubleO(self), 123);
  27249   freeO(self);
  27250   setTopSO(self, "-123");
  27251   ck_assert_int_eq(parseDoubleO(self), -123);
  27252   // out of range - TODO check stderr
  27253   freeO(self);
  27254   setTopSO(self, "999999999999999999999999999999999999999");
  27255   parseDoubleO(self);
  27256   // string without number
  27257   freeO(self);
  27258   setTopSO(self, "sheepy");
  27259   ck_assert_int_eq(parseDoubleO(self), 0);
  27260   // NULL string
  27261   freeO(self);
  27262   ck_assert_int_eq(parseDoubleO(self), 0);
  27263   terminateO(self);
  27264 
  27265 END_TEST
  27266 
  27267 
  27268 START_TEST(intToSmallJsonT)
  27269 
  27270   smallJsont* r;
  27271   smallJsont *self = allocSmallJson();
  27272   setTopSO(self, "");
  27273 
  27274   // number
  27275   r = intToO(self, 123);
  27276   ck_assert_ptr_ne(r, null);
  27277   char *s = toStringO(r);
  27278   ck_assert_str_eq(s, "123");
  27279   free(s);
  27280   r = intToO(self, -465464123);
  27281   ck_assert_ptr_ne(r, null);
  27282   s = toStringO(r);
  27283   ck_assert_str_eq(s, "-465464123");
  27284   free(s);
  27285   terminateO(self);
  27286 
  27287 END_TEST
  27288 
  27289 
  27290 START_TEST(doubleToSmallJsonT)
  27291 
  27292   smallJsont* r;
  27293   smallJsont *self = allocSmallJson();
  27294   setTopSO(self, "");
  27295 
  27296   // number
  27297   r = doubleToO(self, 123.4);
  27298   ck_assert_ptr_ne(r, null);
  27299   char *s = toStringO(r);
  27300   ck_assert_str_eq(s, "1.234000e+02");
  27301   free(s);
  27302   r = doubleToO(self, -4652445e5);
  27303   ck_assert_ptr_ne(r, null);
  27304   s = toStringO(r);
  27305   ck_assert_str_eq(s, "-4.652445e+11");
  27306   free(s);
  27307   terminateO(self);
  27308 
  27309 END_TEST
  27310 
  27311 
  27312 START_TEST(upperSmallJsonT)
  27313 
  27314   smallJsont* r;
  27315   smallJsont *self = allocSmallJson();
  27316   setTopSO(self, "sheepy");
  27317 
  27318   // string
  27319   r = upperO(self);
  27320   ck_assert_ptr_ne(r, null);
  27321   char *s = toStringO(r);
  27322   ck_assert_str_eq(s, "SHEEPY");
  27323   free(s);
  27324   // NULL string
  27325   freeO(self);
  27326   ck_assert_ptr_eq(upperO(self), NULL);
  27327   terminateO(self);
  27328 
  27329 END_TEST
  27330 
  27331 
  27332 START_TEST(lowerSmallJsonT)
  27333 
  27334   smallJsont* r;
  27335   smallJsont *self = allocSmallJson();
  27336   setTopSO(self, "SHeePY");
  27337 
  27338   // string
  27339   r = lowerO(self);
  27340   ck_assert_ptr_ne(r, null);
  27341   char *s = toStringO(r);
  27342   ck_assert_str_eq(s, "sheepy");
  27343   free(s);
  27344   // NULL string
  27345   freeO(self);
  27346   ck_assert_ptr_eq(lowerO(self), NULL);
  27347   terminateO(self);
  27348 
  27349 END_TEST
  27350 
  27351 
  27352 START_TEST(trimSmallJsonT)
  27353 
  27354   smallJsont* r;
  27355   smallJsont *self = allocSmallJson();
  27356   setTopSO(self, "");
  27357 
  27358   // no spaces
  27359   freeO(self);
  27360   setTopSO(self, "SHeePY");
  27361   r = trimO(self);
  27362   ck_assert_ptr_ne(r, null);
  27363   char *s = toStringO(r);
  27364   ck_assert_str_eq(s, "SHeePY");
  27365   free(s);
  27366   // heading spaces
  27367   freeO(self);
  27368   setTopSO(self, "  SHeePY");
  27369   r = trimO(self);
  27370   ck_assert_ptr_ne(r, null);
  27371   s = toStringO(r);
  27372   ck_assert_str_eq(s, "SHeePY");
  27373   free(s);
  27374   // trailing spaces
  27375   freeO(self);
  27376   setTopSO(self, "SHeePY	");
  27377   r = trimO(self);
  27378   ck_assert_ptr_ne(r, null);
  27379   s = toStringO(r);
  27380   ck_assert_str_eq(s, "SHeePY");
  27381   free(s);
  27382   // string with spaces in the middle
  27383   freeO(self);
  27384   setTopSO(self, "	SHe ePY	");
  27385   r = trimO(self);
  27386   ck_assert_ptr_ne(r, null);
  27387   s = toStringO(r);
  27388   ck_assert_str_eq(s, "SHe ePY");
  27389   free(s);
  27390   // all spaces
  27391   freeO(self);
  27392   setTopSO(self, "	 	");
  27393   r = trimO(self);
  27394   ck_assert_ptr_ne(r, null);
  27395   s = toStringO(r);
  27396   ck_assert_str_eq(s, "");
  27397   free(s);
  27398   // empty string
  27399   freeO(self);
  27400   setTopSO(self, "");
  27401   r = trimO(self);
  27402   ck_assert_ptr_ne(r, null);
  27403   s = toStringO(r);
  27404   ck_assert_str_eq(s, "");
  27405   free(s);
  27406   // NULL string
  27407   freeO(self);
  27408   ck_assert_ptr_eq(trimO(self), NULL);
  27409   // json dict
  27410   freeO(self);
  27411   // empty self
  27412   setTypeDictO(self);
  27413   r = trimO(self);
  27414   ck_assert_ptr_ne(r, null);
  27415   self->f->setS(self, "1", "2");
  27416   self->f->setS(self, "3", "4");
  27417   self->f->delElem(self, "3");
  27418   r = trimO(self);
  27419   ck_assert_ptr_ne(r, null);
  27420   ck_assert_int_eq(lenO(self), 1);
  27421   s = toStringO(r);
  27422   ck_assert_str_eq(s, "{\"1\":\"2\"}");
  27423   free(s);
  27424   self->f->delElem(self, "1");
  27425   r = trimO(self);
  27426   ck_assert_ptr_ne(r, null);
  27427   ck_assert_int_eq(lenO(self), 0);
  27428   s = toStringO(r);
  27429   ck_assert_str_eq(s, "{}");
  27430   free(s);
  27431   // json array
  27432   freeO(self);
  27433   self->f->pushS(self, "qwe");
  27434   self->f->pushUndefined(self);
  27435   self->f->pushInt(self, 123);
  27436   ck_assert_uint_eq(lenO(self), 3);
  27437   delElemIndexO(self, 0);
  27438   delElemIndexO(self, 1);
  27439   r = trimO(self);
  27440   ck_assert_uint_eq(lenO(self), 1);
  27441   ck_assert_ptr_ne(r, null);
  27442   s = toStringO(r);
  27443   ck_assert_str_eq(s, "[123]");
  27444   free(s);
  27445   terminateO(self);
  27446 
  27447 END_TEST
  27448 
  27449 
  27450 START_TEST(lTrimSmallJsonT)
  27451 
  27452   smallJsont* r;
  27453   smallJsont *self = allocSmallJson();
  27454   setTopSO(self, "");
  27455 
  27456   // no spaces
  27457   freeO(self);
  27458   setTopSO(self, "SHeePY");
  27459   r = lTrimO(self);
  27460   ck_assert_ptr_ne(r, null);
  27461   char *s = toStringO(r);
  27462   ck_assert_str_eq(s, "SHeePY");
  27463   free(s);
  27464   // heading spaces
  27465   freeO(self);
  27466   setTopSO(self, "  SHeePY");
  27467   r = lTrimO(self);
  27468   ck_assert_ptr_ne(r, null);
  27469   s = toStringO(r);
  27470   ck_assert_str_eq(s, "SHeePY");
  27471   free(s);
  27472   // trailing spaces
  27473   freeO(self);
  27474   setTopSO(self, "SHeePY	");
  27475   r = lTrimO(self);
  27476   ck_assert_ptr_ne(r, null);
  27477   s = toStringO(r);
  27478   ck_assert_str_eq(s, "SHeePY	");
  27479   free(s);
  27480   // string with spaces in the middle
  27481   freeO(self);
  27482   setTopSO(self, "	SHe ePY	");
  27483   r = lTrimO(self);
  27484   ck_assert_ptr_ne(r, null);
  27485   s = toStringO(r);
  27486   ck_assert_str_eq(s, "SHe ePY	");
  27487   free(s);
  27488   // all spaces
  27489   freeO(self);
  27490   setTopSO(self, "	 	");
  27491   r = lTrimO(self);
  27492   ck_assert_ptr_ne(r, null);
  27493   s = toStringO(r);
  27494   ck_assert_str_eq(s, "");
  27495   free(s);
  27496   freeO(self);
  27497   setTopSO(self, "");
  27498   r = lTrimO(self);
  27499   ck_assert_ptr_ne(r, null);
  27500   s = toStringO(r);
  27501   ck_assert_str_eq(s, "");
  27502   free(s);
  27503   // NULL string
  27504   freeO(self);
  27505   ck_assert_ptr_eq(lTrimO(self), NULL);
  27506   terminateO(self);
  27507 
  27508 END_TEST
  27509 
  27510 
  27511 START_TEST(rTrimSmallJsonT)
  27512 
  27513   smallJsont* r;
  27514   smallJsont *self = allocSmallJson();
  27515   setTopSO(self, "");
  27516 
  27517   // no spaces
  27518   freeO(self);
  27519   setTopSO(self, "SHeePY");
  27520   r = rTrimO(self);
  27521   ck_assert_ptr_ne(r, null);
  27522   char *s = toStringO(r);
  27523   ck_assert_str_eq(s, "SHeePY");
  27524   free(s);
  27525   // heading spaces
  27526   freeO(self);
  27527   setTopSO(self, "  SHeePY");
  27528   r = rTrimO(self);
  27529   ck_assert_ptr_ne(r, null);
  27530   s = toStringO(r);
  27531   ck_assert_str_eq(s, "  SHeePY");
  27532   free(s);
  27533   // trailing spaces
  27534   freeO(self);
  27535   setTopSO(self, "SHeePY	");
  27536   r = rTrimO(self);
  27537   ck_assert_ptr_ne(r, null);
  27538   s = toStringO(r);
  27539   ck_assert_str_eq(s, "SHeePY");
  27540   free(s);
  27541   // string with spaces in the middle
  27542   freeO(self);
  27543   setTopSO(self, "	SHe ePY	");
  27544   r = rTrimO(self);
  27545   ck_assert_ptr_ne(r, null);
  27546   s = toStringO(r);
  27547   ck_assert_str_eq(s, "	SHe ePY");
  27548   free(s);
  27549   // all spaces
  27550   freeO(self);
  27551   setTopSO(self, "	 	");
  27552   r = rTrimO(self);
  27553   ck_assert_ptr_ne(r, null);
  27554   s = toStringO(r);
  27555   ck_assert_str_eq(s, "");
  27556   free(s);
  27557   // empty string
  27558   freeO(self);
  27559   setTopSO(self, "");
  27560   r = rTrimO(self);
  27561   ck_assert_ptr_ne(r, null);
  27562   s = toStringO(r);
  27563   ck_assert_str_eq(s, "");
  27564   free(s);
  27565   // NULL string
  27566   freeO(self);
  27567   ck_assert_ptr_eq(rTrimO(self), NULL);
  27568   terminateO(self);
  27569 
  27570 END_TEST
  27571 
  27572 
  27573 START_TEST(keysSmallJsonT)
  27574 
  27575   char** r;
  27576   smallJsont *self = allocG(rtSmallJsont);
  27577 
  27578   self->f->setS(self, "1", "2");
  27579   self->f->setS(self, "3", "4");
  27580   r = keysO(self);
  27581   ck_assert_ptr_ne(r, null);
  27582   char *s = toStringListSGF(r);
  27583   ck_assert_str_eq(s, "[\"1\",\"3\"]");
  27584   free(s);
  27585   listFreeS(r);
  27586   // empty self
  27587   freeO(self);
  27588   r = keysO(self);
  27589   ck_assert_ptr_eq(r, null);
  27590   setTypeDictO(self);
  27591   r = keysO(self);
  27592   ck_assert_ptr_eq(r, null);
  27593   terminateO(self);
  27594 
  27595 END_TEST
  27596 
  27597 
  27598 START_TEST(keysSmallStringSmallJsonT)
  27599 
  27600   smallArrayt* r;
  27601   smallJsont *self = allocSmallJson();
  27602 
  27603   self->f->setS(self, "1", "2");
  27604   self->f->setS(self, "3", "4");
  27605   r = keysSmallStringO(self);
  27606   ck_assert_ptr_ne(r, null);
  27607   char *s = toStringO(r);
  27608   ck_assert_str_eq(s, "[\"1\",\"3\"]");
  27609   free(s);
  27610   terminateO(r);
  27611   // empty self
  27612   freeO(self);
  27613   r = keysSmallStringO(self);
  27614   ck_assert_ptr_ne(r, null);
  27615   s = toStringO(r);
  27616   ck_assert_str_eq(s, "[]");
  27617   free(s);
  27618   terminateO(r);
  27619   terminateO(self);
  27620 
  27621 END_TEST
  27622 
  27623 
  27624 START_TEST(valuesSmallJsonT)
  27625 
  27626   smallArrayt* r;
  27627   smallJsont *self = allocG(rtSmallJsont);
  27628 
  27629   // empty json
  27630   r = valuesO(self);
  27631   ck_assert_ptr_eq(r, null);
  27632   setTypeDictO(self);
  27633   r = valuesO(self);
  27634   ck_assert_ptr_eq(r, null);
  27635   // values
  27636   self->f->setUndefined(self, "qwe");
  27637   self->f->setS(self, "123", "sheepy");
  27638   r = valuesO(self);
  27639   ck_assert_ptr_ne(r, null);
  27640   char *s  = toStringO(r);
  27641   ck_assert_str_eq(s, "[null,\"sheepy\"]");
  27642   free(s);
  27643   smashO(r);
  27644   terminateO(self);
  27645 
  27646 END_TEST
  27647 
  27648 
  27649 START_TEST(compactSmallJsonT)
  27650 
  27651   smallJsont* r;
  27652   smallJsont *self = allocSmallJson();
  27653 
  27654   r = compactO(self);
  27655   ck_assert_ptr_eq(r, NULL);
  27656   // add and remove elements
  27657   self->f->pushUndefined(self);
  27658   //  null element
  27659   self->f->pushUndefined(self);
  27660   delElemIndexO(self, 1);
  27661   self->f->pushBool(self, true);
  27662   createSmallContainer(c);
  27663   self->f->pushSmallContainer(self, &c);
  27664   //  empty dict
  27665   createSmallDict(d);
  27666   self->f->pushDict(self, &d);
  27667   resetO(&d);
  27668   (&d)->f->setInt(&d, "a", 1);
  27669   self->f->pushDict(self, &d);
  27670   self->f->pushDouble(self, 2);
  27671   self->f->pushInt(self, 5);
  27672   self->f->pushS(self, "   ");
  27673   self->f->pushS(self, "asd");
  27674   //  empty Array
  27675   createSmallArray(a);
  27676   self->f->pushArray(self, &a);
  27677   resetO(&a);
  27678   (&a)->f->pushInt(&a, 1);
  27679   self->f->pushArray(self, &a);
  27680   //  empty bytes
  27681   createSmallBytes(b);
  27682   self->f->pushSmallBytes(self, &b);
  27683   smallBytest *B = allocSmallBytes("asd", 4);
  27684   self->f->pushNFreeSmallBytes(self, B);
  27685   r = compactO(self);
  27686   ck_assert_ptr_ne(r, NULL);
  27687   ck_assert_int_eq(lenO(r), 8);
  27688   char *s = toStringO(r);
  27689   ck_assert_str_eq(s, "[true,\"<data container>\",{\"a\":1},2.000000e+00,5,\"asd\",[1],[0x61,0x73,0x64,0x00]]");
  27690   free(s);
  27691   // array with blank elements becomes empty after compact
  27692   // self->topA should not be null
  27693   // self->topA should an empty sArray to avoid issues with the setP function
  27694   self->f->free(self);
  27695   self->f->pushS(self, "  ");
  27696   self->f->pushS(self, "");
  27697   r = compactO(self);
  27698   ck_assert_ptr_ne(r, NULL);
  27699   ck_assert_ptr_ne(r->topA, NULL);
  27700   ck_assert_int_eq(lenO(r), 0);
  27701   s = toStringO(r);
  27702   ck_assert_str_eq(s, "[]");
  27703   free(s);
  27704   // empty array
  27705   emptyO(self);
  27706   r = compactO(self);
  27707   ck_assert_ptr_eq(r, NULL);
  27708   terminateO(self);
  27709 
  27710 END_TEST
  27711 
  27712 
  27713 START_TEST(isEmptySmallJsonT)
  27714 
  27715   bool r;
  27716   smallJsont *self = allocSmallJson();
  27717 
  27718   r = isEmptyO(self);
  27719   ck_assert(r);
  27720   self->f->setInt(self, "a", 1);
  27721   r = isEmptyO(self);
  27722   ck_assert(!r);
  27723   self->f->delElem(self, "a");
  27724   r = isEmptyO(self);
  27725   ck_assert(r);
  27726   terminateO(self);
  27727 
  27728 END_TEST
  27729 
  27730 
  27731 START_TEST(isBlankSmallJsonT)
  27732 
  27733   bool r;
  27734   smallJsont *self = allocSmallJson();
  27735 
  27736   // json dict
  27737   setTypeDictO(self);
  27738   r = isBlankO(self);
  27739   ck_assert(r);
  27740   // json string
  27741   freeO(self);
  27742   setTopSO(self, " ");
  27743   r = isBlankO(self);
  27744   ck_assert(r);
  27745   // json array
  27746   freeO(self);
  27747   // bool
  27748   self->f->pushBool(self, true);
  27749   r = isBlankO(self);
  27750   ck_assert(!r);
  27751   // container
  27752   emptyO(self);
  27753   createSmallContainer(c);
  27754   self->f->pushSmallContainer(self, &c);
  27755   r = isBlankO(self);
  27756   ck_assert(!r);
  27757   // blank dict
  27758   emptyO(self);
  27759   createSmallDict(d);
  27760   self->f->pushDict(self, &d);
  27761   r = isBlankO(self);
  27762   ck_assert(r);
  27763   // dict
  27764   emptyO(self);
  27765   resetO(&d);
  27766   (&d)->f->setInt(&d, "a", 1);
  27767   self->f->pushDict(self, &d);
  27768   r = isBlankO(self);
  27769   ck_assert(!r);
  27770   // double
  27771   emptyO(self);
  27772   self->f->pushDouble(self, 0);
  27773   r = isBlankO(self);
  27774   ck_assert(!r);
  27775   // int
  27776   emptyO(self);
  27777   self->f->pushInt(self, 0);
  27778   r = isBlankO(self);
  27779   ck_assert(!r);
  27780   // blank string
  27781   emptyO(self);
  27782   self->f->pushS(self, "   ");
  27783   r = isBlankO(self);
  27784   ck_assert(r);
  27785   // string
  27786   emptyO(self);
  27787   self->f->pushS(self, "asd");
  27788   r = isBlankO(self);
  27789   ck_assert(!r);
  27790   // blank dict
  27791   emptyO(self);
  27792   createSmallArray(a);
  27793   self->f->pushArray(self, &a);
  27794   r = isBlankO(self);
  27795   ck_assert(r);
  27796   // dict
  27797   emptyO(self);
  27798   resetO(&a);
  27799   (&a)->f->pushInt(&a, 1);
  27800   self->f->pushArray(self, &a);
  27801   r = isBlankO(self);
  27802   ck_assert(!r);
  27803   // blank Bytes
  27804   emptyO(self);
  27805   createSmallBytes(b);
  27806   self->f->pushSmallBytes(self, &b);
  27807   r = isBlankO(self);
  27808   ck_assert(r);
  27809   // Bytes
  27810   emptyO(self);
  27811   smallBytest *B = allocSmallBytes("asd", 4);
  27812   self->f->pushNFreeSmallBytes(self, B);
  27813   r = isBlankO(self);
  27814   ck_assert(!r);
  27815   // empty array
  27816   emptyO(self);
  27817   r = isBlankO(self);
  27818   ck_assert(r);
  27819   terminateO(self);
  27820 
  27821 END_TEST
  27822 
  27823 
  27824 bool fef(void *closure UNUSED, baset *e) {
  27825   bool r = true;
  27826   if   (isOUndefined(e)) r = true;
  27827   elif (isOSmallInt(e)) r = false;
  27828   else {
  27829     static u16 c;
  27830     r = !c;
  27831     c++;
  27832   }
  27833   return r;
  27834 }
  27835 
  27836 START_TEST(forEachSmallJsonFT)
  27837 
  27838   smallJsont *self = allocSmallJson();
  27839 
  27840   // empty array
  27841   // direct return
  27842   self->f->forEach(self, NULL, fef);
  27843   setTypeArrayO(self);
  27844   self->f->forEach(self, NULL, fef);
  27845   // array with elements
  27846   self->f->pushUndefined(self);
  27847   self->f->pushBool(self, true);
  27848   //  base class
  27849   createAllocateSmallInt(i);
  27850   i->type = "userclass";
  27851   self->f->push(self, (baset*)i);
  27852   createAllocateSmallInt(j);
  27853   j->type = "userclass";
  27854   self->f->push(self, (baset*)j);
  27855   delElemIndexO(self, 1);
  27856   self->f->pushInt(self, 2);
  27857   self->f->forEach(self, NULL, fef);
  27858   self->f->del(self, 2, 4);
  27859   self->f->forEach(self, NULL, fef);
  27860   terminateO(self);
  27861 
  27862 END_TEST
  27863 
  27864 
  27865 bool ef(void *closure UNUSED, u64 i UNUSED, baset *e) {
  27866   bool r = true;
  27867   if   (isOUndefined(e)) r = true;
  27868   elif (isOSmallInt(e)) r = false;
  27869   else {
  27870     static u16 c;
  27871     r = !c;
  27872     c++;
  27873   }
  27874   return r;
  27875 }
  27876 
  27877 START_TEST(enumerateSmallJsonFT)
  27878 
  27879   smallJsont *self = allocSmallJson();
  27880 
  27881   // empty array
  27882   // direct return
  27883   self->f->enumerate(self, NULL, ef);
  27884   setTypeArrayO(self);
  27885   self->f->enumerate(self, NULL, ef);
  27886   // enumerate elements
  27887   self->f->pushUndefined(self);
  27888   self->f->pushBool(self, true);
  27889   //  base class
  27890   createAllocateSmallInt(i);
  27891   i->type = "userclass";
  27892   self->f->push(self, (baset*)i);
  27893   createAllocateSmallInt(j);
  27894   j->type = "userclass";
  27895   self->f->push(self, (baset*)j);
  27896   delElemIndexO(self, 1);
  27897   self->f->pushInt(self, 2);
  27898   self->f->enumerate(self, NULL, ef);
  27899   self->f->del(self, 2, 4);
  27900   self->f->enumerate(self, NULL, ef);
  27901   terminateO(self);
  27902 
  27903 END_TEST
  27904 
  27905 
  27906 bool enumerateElement(void *closure, char *key UNUSED, baset *element UNUSED) {
  27907   int *c = closure;
  27908   (*c)++;
  27909   return *c != 2 ? true : false;
  27910 }
  27911 
  27912 START_TEST(enumerateDictSmallJsonT)
  27913 
  27914   smallJsont *self = allocSmallJson();
  27915   int closure      = 0;
  27916 
  27917   self->f->enumerateDict(self, &closure, enumerateElement);
  27918   self->f->setInt(self, "a", 1);
  27919   self->f->setInt(self, "b", 2);
  27920   self->f->setInt(self, "c", 3);
  27921   self->f->delElem(self, "a");
  27922   self->f->enumerateDict(self, &closure, enumerateElement);
  27923   ck_assert_int_eq(closure, 2);
  27924   // baset object in container
  27925   closure = -2;
  27926   smallIntt *i = allocSmallInt(2);
  27927   i->type = "randomClass";
  27928   self->f->set(self, "d", (baset*)i);
  27929   i = allocSmallInt(3);
  27930   i->type = "randomClass";
  27931   self->f->set(self, "e", (baset*)i);
  27932   self->f->enumerateDict(self, &closure, enumerateElement);
  27933   ck_assert_int_eq(closure, 2);
  27934   terminateO(self);
  27935 
  27936 END_TEST
  27937 
  27938 
  27939 START_TEST(joinSmallJsonT)
  27940 
  27941   smallStringt* r;
  27942   smallJsont *self = allocSmallJson();
  27943 
  27944   // join non string objects
  27945   self->f->pushUndefined(self);
  27946   self->f->pushInt(self, 123);
  27947   r = joinO(self, ";");
  27948   ck_assert_ptr_ne(r, NULL);
  27949   char *s = toStringO(r);
  27950   terminateO(r);
  27951   ck_assert_str_eq(s, "null;123");
  27952   free(s);
  27953   // join strings
  27954   emptyO(self);
  27955   self->f->pushS(self, "a");
  27956   self->f->pushS(self, "b");
  27957   self->f->pushS(self, "c");
  27958   self->f->pushS(self, "d");
  27959   delElemIndexO(self, 1);
  27960   r = joinO(self, ";");
  27961   ck_assert_ptr_ne(r, NULL);
  27962   s = toStringO(r);
  27963   terminateO(r);
  27964   ck_assert_str_eq(s, "a;c;d");
  27965   free(s);
  27966   // null delimiter
  27967   r = joinO(self, NULL);
  27968   ck_assert_ptr_eq(r, NULL);
  27969   // empty array
  27970   emptyO(self);
  27971   r = joinO(self, ";");
  27972   ck_assert_ptr_eq(r, NULL);
  27973   freeO(self);
  27974   r = joinO(self, ";");
  27975   ck_assert_ptr_eq(r, NULL);
  27976   terminateO(self);
  27977 
  27978 END_TEST
  27979 
  27980 
  27981 START_TEST(joinCharSmallJsonT)
  27982 
  27983   smallStringt* r;
  27984   smallJsont *self = allocSmallJson();
  27985 
  27986   // join non string objects
  27987   self->f->pushUndefined(self);
  27988   self->f->pushInt(self, 123);
  27989   r = joinCharO(self, ';');
  27990   ck_assert_ptr_ne(r, NULL);
  27991   char *s = toStringO(r);
  27992   terminateO(r);
  27993   ck_assert_str_eq(s, "null;123");
  27994   free(s);
  27995   // join strings
  27996   emptyO(self);
  27997   self->f->pushS(self, "a");
  27998   self->f->pushS(self, "b");
  27999   self->f->pushS(self, "c");
  28000   self->f->pushS(self, "d");
  28001   delElemIndexO(self, 1);
  28002   r = joinCharO(self, ';');
  28003   ck_assert_ptr_ne(r, NULL);
  28004   s = toStringO(r);
  28005   terminateO(r);
  28006   ck_assert_str_eq(s, "a;c;d");
  28007   free(s);
  28008   // empty array
  28009   emptyO(self);
  28010   r = joinCharO(self, ';');
  28011   ck_assert_ptr_eq(r, NULL);
  28012   terminateO(self);
  28013 
  28014 END_TEST
  28015 
  28016 
  28017 START_TEST(joinSmallJsonSmallJsonT)
  28018 
  28019   smallStringt* r;
  28020   smallJsont *self = allocSmallJson();
  28021   smallJsont* delim = allocSmallJson();
  28022 
  28023   // join non string objects
  28024   setTopSO(delim, ";");
  28025   self->f->pushUndefined(self);
  28026   self->f->pushInt(self, 123);
  28027   r = self->f->joinSmallJson(self, delim);
  28028   ck_assert_ptr_ne(r, NULL);
  28029   char *s = toStringO(r);
  28030   terminateO(r);
  28031   ck_assert_str_eq(s, "null;123");
  28032   free(s);
  28033   // join strings
  28034   emptyO(self);
  28035   self->f->pushS(self, "a");
  28036   self->f->pushS(self, "b");
  28037   self->f->pushS(self, "c");
  28038   self->f->pushS(self, "d");
  28039   delElemIndexO(self, 1);
  28040   r = self->f->joinSmallJson(self, delim);
  28041   ck_assert_ptr_ne(r, NULL);
  28042   s = toStringO(r);
  28043   terminateO(r);
  28044   ck_assert_str_eq(s, "a;c;d");
  28045   free(s);
  28046   // delimiter not a string
  28047   freeO(delim);
  28048   setTopIntO(delim, 1);
  28049   r = self->f->joinSmallJson(self, delim);
  28050   ck_assert_ptr_eq(r, NULL);
  28051   // non smallJson object
  28052   terminateO(delim);
  28053   delim = (smallJsont*) allocSmallInt(2);
  28054   r = self->f->joinSmallJson(self, delim);
  28055   ck_assert_ptr_eq(r, NULL);
  28056   // null delimiter
  28057   r = self->f->joinSmallJson(self, NULL);
  28058   ck_assert_ptr_eq(r, NULL);
  28059   // empty array
  28060   emptyO(self);
  28061   freeO(delim);
  28062   setTopSO(delim, ";");
  28063   r = self->f->joinSmallJson(self, delim);
  28064   ck_assert_ptr_eq(r, NULL);
  28065   terminateO(self);
  28066   terminateO(delim);
  28067 
  28068 END_TEST
  28069 
  28070 
  28071 START_TEST(joinSmallStringSmallJsonT)
  28072 
  28073   smallStringt* r;
  28074   smallJsont *self   = allocSmallJson();
  28075   smallStringt* delim = allocSmallString(";");
  28076 
  28077   // join non string objects
  28078   self->f->pushUndefined(self);
  28079   self->f->pushInt(self, 123);
  28080   r = joinSmallStringO(self, delim);
  28081   ck_assert_ptr_ne(r, NULL);
  28082   char *s = toStringO(r);
  28083   terminateO(r);
  28084   ck_assert_str_eq(s, "null;123");
  28085   free(s);
  28086   // join strings
  28087   emptyO(self);
  28088   self->f->pushS(self, "a");
  28089   self->f->pushS(self, "b");
  28090   self->f->pushS(self, "c");
  28091   self->f->pushS(self, "d");
  28092   delElemIndexO(self, 1);
  28093   r = joinSmallStringO(self, delim);
  28094   ck_assert_ptr_ne(r, NULL);
  28095   s = toStringO(r);
  28096   terminateO(r);
  28097   ck_assert_str_eq(s, "a;c;d");
  28098   free(s);
  28099   // delimiter with no string
  28100   freeO(delim);
  28101   r = joinSmallStringO(self, delim);
  28102   ck_assert_ptr_eq(r, NULL);
  28103   // non smallString delim
  28104   terminateO(delim);
  28105   delim = (smallStringt*) allocSmallInt(0);
  28106   r = joinSmallStringO(self, delim);
  28107   ck_assert_ptr_eq(r, NULL);
  28108   terminateO(delim);
  28109   // null delimiter
  28110   r = joinSmallStringO(self, NULL);
  28111   ck_assert_ptr_eq(r, NULL);
  28112   // empty array
  28113   emptyO(self);
  28114   delim = allocSmallString(";");
  28115   r = joinSmallStringO(self, delim);
  28116   ck_assert_ptr_eq(r, NULL);
  28117   terminateO(self);
  28118   terminateO(delim);
  28119 
  28120 END_TEST
  28121 
  28122 
  28123 START_TEST(joinSSmallJsonT)
  28124 
  28125   char* r;
  28126   smallJsont *self = allocSmallJson();
  28127 
  28128   // join non string objects
  28129   self->f->pushUndefined(self);
  28130   self->f->pushInt(self, 123);
  28131   r = self->f->joinS(self, ";");
  28132   ck_assert_ptr_ne(r, NULL);
  28133   ck_assert_str_eq(r, "null;123");
  28134   free(r);
  28135   // join strings
  28136   emptyO(self);
  28137   self->f->pushS(self, "a");
  28138   self->f->pushS(self, "b");
  28139   self->f->pushS(self, "c");
  28140   self->f->pushS(self, "d");
  28141   delElemIndexO(self, 1);
  28142   r = self->f->joinS(self, ";");
  28143   ck_assert_ptr_ne(r, NULL);
  28144   ck_assert_str_eq(r, "a;c;d");
  28145   free(r);
  28146   // null delimiter
  28147   r = self->f->joinS(self, NULL);
  28148   ck_assert_ptr_eq(r, NULL);
  28149   // empty array
  28150   emptyO(self);
  28151   r = self->f->joinS(self, ";");
  28152   ck_assert_ptr_eq(r, NULL);
  28153   terminateO(self);
  28154 
  28155 END_TEST
  28156 
  28157 
  28158 START_TEST(joinCharSSmallJsonT)
  28159 
  28160   char* r;
  28161   smallJsont *self = allocSmallJson();
  28162 
  28163   // join non string objects
  28164   self->f->pushUndefined(self);
  28165   self->f->pushInt(self, 123);
  28166   r = joinCharSO(self, ';');
  28167   ck_assert_ptr_ne(r, NULL);
  28168   ck_assert_str_eq(r, "null;123");
  28169   free(r);
  28170   // join strings
  28171   emptyO(self);
  28172   self->f->pushS(self, "a");
  28173   self->f->pushS(self, "b");
  28174   self->f->pushS(self, "c");
  28175   self->f->pushS(self, "d");
  28176   delElemIndexO(self, 1);
  28177   r = joinCharSO(self, ';');
  28178   ck_assert_ptr_ne(r, NULL);
  28179   ck_assert_str_eq(r, "a;c;d");
  28180   free(r);
  28181   // empty array
  28182   emptyO(self);
  28183   r = joinCharSO(self, ';');
  28184   ck_assert_ptr_eq(r, NULL);
  28185   terminateO(self);
  28186 
  28187 END_TEST
  28188 
  28189 
  28190 START_TEST(joinSmallJsonSSmallJsonT)
  28191 
  28192   char* r;
  28193   smallJsont *self = allocSmallJson();
  28194   smallJsont* delim = allocSmallJson();
  28195 
  28196   // join non string objects
  28197   setTopSO(delim, ";");
  28198   self->f->pushUndefined(self);
  28199   self->f->pushInt(self, 123);
  28200   r = joinSmallJsonSO(self, delim);
  28201   ck_assert_ptr_ne(r, NULL);
  28202   ck_assert_str_eq(r, "null;123");
  28203   free(r);
  28204   // join strings
  28205   emptyO(self);
  28206   self->f->pushS(self, "a");
  28207   self->f->pushS(self, "b");
  28208   self->f->pushS(self, "c");
  28209   self->f->pushS(self, "d");
  28210   delElemIndexO(self, 1);
  28211   r = joinSmallJsonSO(self, delim);
  28212   ck_assert_ptr_ne(r, NULL);
  28213   ck_assert_str_eq(r, "a;c;d");
  28214   free(r);
  28215   // delimiter not a string
  28216   freeO(delim);
  28217   setTopIntO(delim, 1);
  28218   r = joinSmallJsonSO(self, delim);
  28219   ck_assert_ptr_eq(r, NULL);
  28220   // non smallJson object
  28221   terminateO(delim);
  28222   delim = (smallJsont*) allocSmallInt(2);
  28223   r = joinSmallJsonSO(self, delim);
  28224   ck_assert_ptr_eq(r, NULL);
  28225   // null delimiter
  28226   r = joinSmallJsonSO(self, NULL);
  28227   ck_assert_ptr_eq(r, NULL);
  28228   // empty array
  28229   emptyO(self);
  28230   freeO(delim);
  28231   setTopSO(delim, ";");
  28232   r = joinSmallJsonSO(self, delim);
  28233   ck_assert_ptr_eq(r, NULL);
  28234   terminateO(self);
  28235   terminateO(delim);
  28236 
  28237 END_TEST
  28238 
  28239 
  28240 START_TEST(joinSmallStringSSmallJsonT)
  28241 
  28242   char* r;
  28243   smallJsont *self   = allocSmallJson();
  28244   smallStringt* delim = allocSmallString(";");
  28245 
  28246   // join non string objects
  28247   self->f->pushUndefined(self);
  28248   self->f->pushInt(self, 123);
  28249   r = joinSmallStringSO(self, delim);
  28250   ck_assert_ptr_ne(r, NULL);
  28251   ck_assert_str_eq(r, "null;123");
  28252   free(r);
  28253   // join strings
  28254   emptyO(self);
  28255   self->f->pushS(self, "a");
  28256   self->f->pushS(self, "b");
  28257   self->f->pushS(self, "c");
  28258   self->f->pushS(self, "d");
  28259   delElemIndexO(self, 1);
  28260   r = joinSmallStringSO(self, delim);
  28261   ck_assert_ptr_ne(r, NULL);
  28262   ck_assert_str_eq(r, "a;c;d");
  28263   free(r);
  28264   // delimiter with no string
  28265   freeO(delim);
  28266   r = joinSmallStringSO(self, delim);
  28267   ck_assert_ptr_eq(r, NULL);
  28268   // non smallString delim
  28269   terminateO(delim);
  28270   delim = (smallStringt*) allocSmallInt(0);
  28271   r = joinSmallStringSO(self, delim);
  28272   ck_assert_ptr_eq(r, NULL);
  28273   terminateO(delim);
  28274   // null delimiter
  28275   r = joinSmallStringSO(self, NULL);
  28276   ck_assert_ptr_eq(r, NULL);
  28277   // empty array
  28278   emptyO(self);
  28279   delim = allocSmallString(";");
  28280   r = joinSmallStringSO(self, delim);
  28281   ck_assert_ptr_eq(r, NULL);
  28282   terminateO(self);
  28283   terminateO(delim);
  28284 
  28285 END_TEST
  28286 
  28287 
  28288 START_TEST(splitSmallJsonT)
  28289 
  28290   smallJsont* r;
  28291   smallJsont *self = allocSmallJson();
  28292   setTopSO(self, "");
  28293 
  28294   // string
  28295   freeO(self);
  28296   setTopSO(self, "one/two");
  28297   r = splitO(self, "/");
  28298   ck_assert_ptr_ne(r, null);
  28299   char *s = toStringO(r);
  28300   ck_assert_str_eq(s, "[\"one\",\"two\"]");
  28301   free(s);
  28302   terminateO(r);
  28303   // delimiter on the edge
  28304   freeO(self);
  28305   setTopSO(self, "/one");
  28306   r = splitO(self, "/");
  28307   ck_assert_ptr_ne(r, null);
  28308   s = toStringO(r);
  28309   ck_assert_str_eq(s, "[\"\",\"one\"]");
  28310   free(s);
  28311   terminateO(r);
  28312   freeO(self);
  28313   setTopSO(self, "one/");
  28314   r = splitO(self, "/");
  28315   ck_assert_ptr_ne(r, null);
  28316   s = toStringO(r);
  28317   ck_assert_str_eq(s, "[\"one\",\"\"]");
  28318   free(s);
  28319   terminateO(r);
  28320   // delimiter not found
  28321   freeO(self);
  28322   setTopSO(self, "one/two");
  28323   r = splitO(self, "||");
  28324   ck_assert_ptr_ne(r, null);
  28325   s = toStringO(r);
  28326   ck_assert_str_eq(s, "[\"one/two\"]");
  28327   free(s);
  28328   terminateO(r);
  28329   // split with several delimiters after each other
  28330   freeO(self);
  28331   setTopSO(self, "one/two  three ");
  28332   r = splitO(self, " ");
  28333   ck_assert_ptr_ne(r, null);
  28334   s = toStringO(r);
  28335   ck_assert_str_eq(s, "[\"one/two\",\"\",\"three\",\"\"]");
  28336   free(s);
  28337   terminateO(r);
  28338   // multiple character delimiter
  28339   freeO(self);
  28340   setTopSO(self, "AAe three extract");
  28341   r = splitO(self, "e ");
  28342   ck_assert_ptr_ne(r, null);
  28343   s = toStringO(r);
  28344   ck_assert_str_eq(s, "[\"AA\",\"thre\",\"extract\"]");
  28345   free(s);
  28346   terminateO(r);
  28347   // empty delimiter
  28348   freeO(self);
  28349   setTopSO(self, "AAd");
  28350   r = splitO(self, "");
  28351   ck_assert_ptr_ne(r, null);
  28352   s = toStringO(r);
  28353   ck_assert_str_eq(s, "[\"AAd\"]");
  28354   free(s);
  28355   terminateO(r);
  28356   // empty string
  28357   emptyO(self);
  28358   r = splitO(self, "$");
  28359   ck_assert_ptr_ne(r, null);
  28360   s = toStringO(r);
  28361   ck_assert_str_eq(s, "[\"\"]");
  28362   free(s);
  28363   terminateO(r);
  28364   // NULL list
  28365   freeO(self);
  28366   ck_assert_ptr_eq(splitO(self, ";"), NULL);
  28367   // NULL delimiter
  28368   freeO(self);
  28369   setTopSO(self, "test");
  28370   ck_assert_ptr_eq(splitO(self, NULL), NULL);
  28371   terminateO(self);
  28372 
  28373 END_TEST
  28374 
  28375 
  28376 START_TEST(splitCharSmallJsonT)
  28377 
  28378   smallJsont* r;
  28379   smallJsont *self = allocSmallJson();
  28380   setTopSO(self, "");
  28381 
  28382   // string
  28383   freeO(self);
  28384   setTopSO(self, "one/two");
  28385   r = splitCharO(self, '/');
  28386   ck_assert_ptr_ne(r, null);
  28387   char *s = toStringO(r);
  28388   ck_assert_str_eq(s, "[\"one\",\"two\"]");
  28389   free(s);
  28390   terminateO(r);
  28391   // delimiter on the edge
  28392   freeO(self);
  28393   setTopSO(self, "/one");
  28394   r = splitCharO(self, '/');
  28395   ck_assert_ptr_ne(r, null);
  28396   s = toStringO(r);
  28397   ck_assert_str_eq(s, "[\"\",\"one\"]");
  28398   free(s);
  28399   terminateO(r);
  28400   freeO(self);
  28401   setTopSO(self, "one/");
  28402   r = splitCharO(self, '/');
  28403   ck_assert_ptr_ne(r, null);
  28404   s = toStringO(r);
  28405   ck_assert_str_eq(s, "[\"one\",\"\"]");
  28406   free(s);
  28407   terminateO(r);
  28408   // delimiter not found
  28409   freeO(self);
  28410   setTopSO(self, "one/two");
  28411   r = splitCharO(self, '|');
  28412   ck_assert_ptr_ne(r, null);
  28413   s = toStringO(r);
  28414   ck_assert_str_eq(s, "[\"one/two\"]");
  28415   free(s);
  28416   terminateO(r);
  28417   // split with several delimiters after each other
  28418   freeO(self);
  28419   setTopSO(self, "one/two  three ");
  28420   r = splitCharO(self, ' ');
  28421   ck_assert_ptr_ne(r, null);
  28422   s = toStringO(r);
  28423   ck_assert_str_eq(s, "[\"one/two\",\"\",\"three\",\"\"]");
  28424   free(s);
  28425   terminateO(r);
  28426   // empty string
  28427   emptyO(self);
  28428   r = splitCharO(self, '$');
  28429   ck_assert_ptr_ne(r, null);
  28430   s = toStringO(r);
  28431   ck_assert_str_eq(s, "[\"\"]");
  28432   free(s);
  28433   terminateO(r);
  28434   // NULL list
  28435   freeO(self);
  28436   ck_assert_ptr_eq(splitCharO(self, ';'), NULL);
  28437   terminateO(self);
  28438 
  28439 END_TEST
  28440 
  28441 
  28442 START_TEST(splitSmallJsonSmallJsonT)
  28443 
  28444   smallJsont* r;
  28445   smallJsont *self = allocSmallJson();
  28446   setTopSO(self, "");
  28447   smallJsont *delim  = allocSmallJson();
  28448 
  28449   // string
  28450   freeO(self);
  28451   setTopSO(self, "one/two");
  28452   setTopSO(delim, "/");
  28453   r = self->f->splitSmallJson(self, delim);
  28454   ck_assert_ptr_ne(r, null);
  28455   char *s = toStringO(r);
  28456   ck_assert_str_eq(s, "[\"one\",\"two\"]");
  28457   free(s);
  28458   terminateO(r);
  28459   // delimiter on the edge
  28460   freeO(self);
  28461   setTopSO(self, "/one");
  28462   r = self->f->splitSmallJson(self, delim);
  28463   ck_assert_ptr_ne(r, null);
  28464   s = toStringO(r);
  28465   ck_assert_str_eq(s, "[\"\",\"one\"]");
  28466   free(s);
  28467   terminateO(r);
  28468   freeO(self);
  28469   setTopSO(self, "one/");
  28470   r = self->f->splitSmallJson(self, delim);
  28471   ck_assert_ptr_ne(r, null);
  28472   s = toStringO(r);
  28473   ck_assert_str_eq(s, "[\"one\",\"\"]");
  28474   free(s);
  28475   terminateO(r);
  28476   // delimiter not found
  28477   freeO(self);
  28478   setTopSO(self, "one/two");
  28479   freeO(delim);
  28480   setTopSO(delim, "||");
  28481   r = self->f->splitSmallJson(self, delim);
  28482   ck_assert_ptr_ne(r, null);
  28483   s = toStringO(r);
  28484   ck_assert_str_eq(s, "[\"one/two\"]");
  28485   free(s);
  28486   terminateO(r);
  28487   // split with several delimiters after each other
  28488   freeO(self);
  28489   setTopSO(self, "one/two  three ");
  28490   freeO(delim);
  28491   setTopSO(delim, " ");
  28492   r = self->f->splitSmallJson(self, delim);
  28493   ck_assert_ptr_ne(r, null);
  28494   s = toStringO(r);
  28495   ck_assert_str_eq(s, "[\"one/two\",\"\",\"three\",\"\"]");
  28496   free(s);
  28497   terminateO(r);
  28498   // multiple character delimiter
  28499   freeO(self);
  28500   setTopSO(self, "AAe three extract");
  28501   freeO(delim);
  28502   setTopSO(delim, "e ");
  28503   r = self->f->splitSmallJson(self, delim);
  28504   ck_assert_ptr_ne(r, null);
  28505   s = toStringO(r);
  28506   ck_assert_str_eq(s, "[\"AA\",\"thre\",\"extract\"]");
  28507   free(s);
  28508   terminateO(r);
  28509   // empty delimiter
  28510   freeO(self);
  28511   setTopSO(self, "AAd");
  28512   freeO(delim);
  28513   setTopSO(delim, "");
  28514   r = self->f->splitSmallJson(self, delim);
  28515   ck_assert_ptr_ne(r, null);
  28516   s = toStringO(r);
  28517   ck_assert_str_eq(s, "[\"AAd\"]");
  28518   free(s);
  28519   terminateO(r);
  28520   // empty string
  28521   emptyO(self);
  28522   freeO(delim);
  28523   setTopSO(delim, "$");
  28524   r = self->f->splitSmallJson(self, delim);
  28525   ck_assert_ptr_ne(r, null);
  28526   s = toStringO(r);
  28527   ck_assert_str_eq(s, "[\"\"]");
  28528   free(s);
  28529   terminateO(r);
  28530   // non json string delimiter
  28531   freeO(delim);
  28532   ck_assert_ptr_eq(self->f->splitSmallJson(self, delim), NULL);
  28533   // non json object delimiter
  28534   terminateO(delim);
  28535   delim = (smallJsont*) allocSmallInt(1);
  28536   ck_assert_ptr_eq(self->f->splitSmallJson(self, delim), NULL);
  28537   terminateO(delim);
  28538   delim  = allocSmallJson();
  28539   // NULL list
  28540   freeO(self);
  28541   freeO(delim);
  28542   setTopSO(delim, ";");
  28543   ck_assert_ptr_eq(self->f->splitSmallJson(self, delim), NULL);
  28544   // NULL delimiter
  28545   freeO(self);
  28546   setTopSO(self, "test");
  28547   ck_assert_ptr_eq(self->f->splitSmallJson(self, NULL), NULL);
  28548   terminateO(delim);
  28549   terminateO(self);
  28550 
  28551 END_TEST
  28552 
  28553 
  28554 START_TEST(splitSmallStringSmallJsonT)
  28555 
  28556   smallJsont* r;
  28557   smallJsont *self = allocSmallJson();
  28558   setTopSO(self, "");
  28559   smallStringt *delim = allocSmallString("/");
  28560 
  28561   // string
  28562   freeO(self);
  28563   setTopSO(self, "one/two");
  28564   r = self->f->splitSmallString(self, delim);
  28565   ck_assert_ptr_ne(r, null);
  28566   char *s = toStringO(r);
  28567   ck_assert_str_eq(s, "[\"one\",\"two\"]");
  28568   free(s);
  28569   terminateO(r);
  28570   // delimiter on the edge
  28571   freeO(self);
  28572   setTopSO(self, "/one");
  28573   r = self->f->splitSmallString(self, delim);
  28574   ck_assert_ptr_ne(r, null);
  28575   s = toStringO(r);
  28576   ck_assert_str_eq(s, "[\"\",\"one\"]");
  28577   free(s);
  28578   terminateO(r);
  28579   freeO(self);
  28580   setTopSO(self, "one/");
  28581   r = self->f->splitSmallString(self, delim);
  28582   ck_assert_ptr_ne(r, null);
  28583   s = toStringO(r);
  28584   ck_assert_str_eq(s, "[\"one\",\"\"]");
  28585   free(s);
  28586   terminateO(r);
  28587   // delimiter not found
  28588   freeO(self);
  28589   setTopSO(self, "one/two");
  28590   setValO(delim, "||");
  28591   r = self->f->splitSmallString(self, delim);
  28592   ck_assert_ptr_ne(r, null);
  28593   s = toStringO(r);
  28594   ck_assert_str_eq(s, "[\"one/two\"]");
  28595   free(s);
  28596   terminateO(r);
  28597   // split with several delimiters after each other
  28598   freeO(self);
  28599   setTopSO(self, "one/two  three ");
  28600   setValO(delim, " ");
  28601   r = self->f->splitSmallString(self, delim);
  28602   ck_assert_ptr_ne(r, null);
  28603   s = toStringO(r);
  28604   ck_assert_str_eq(s, "[\"one/two\",\"\",\"three\",\"\"]");
  28605   free(s);
  28606   terminateO(r);
  28607   // multiple character delimiter
  28608   freeO(self);
  28609   setTopSO(self, "AAe three extract");
  28610   setValO(delim, "e ");
  28611   r = self->f->splitSmallString(self, delim);
  28612   ck_assert_ptr_ne(r, null);
  28613   s = toStringO(r);
  28614   ck_assert_str_eq(s, "[\"AA\",\"thre\",\"extract\"]");
  28615   free(s);
  28616   terminateO(r);
  28617   // empty delimiter
  28618   freeO(self);
  28619   setTopSO(self, "AAd");
  28620   setValO(delim, "");
  28621   r = self->f->splitSmallString(self, delim);
  28622   ck_assert_ptr_ne(r, null);
  28623   s = toStringO(r);
  28624   ck_assert_str_eq(s, "[\"AAd\"]");
  28625   free(s);
  28626   terminateO(r);
  28627   // empty string
  28628   emptyO(self);
  28629   setValO(delim, "$");
  28630   r = self->f->splitSmallString(self, delim);
  28631   ck_assert_ptr_ne(r, null);
  28632   s = toStringO(r);
  28633   ck_assert_str_eq(s, "[\"\"]");
  28634   free(s);
  28635   terminateO(r);
  28636   // null string delimiter
  28637   freeO(delim);
  28638   ck_assert_ptr_eq(self->f->splitSmallString(self, delim), NULL);
  28639   // non json object delimiter
  28640   terminateO(delim);
  28641   delim = (smallStringt*) allocSmallInt(1);
  28642   ck_assert_ptr_eq(self->f->splitSmallString(self, delim), NULL);
  28643   terminateO(delim);
  28644   // NULL list
  28645   freeO(self);
  28646   delim  = allocSmallString(";");
  28647   ck_assert_ptr_eq(self->f->splitSmallString(self, delim), NULL);
  28648   // NULL delimiter
  28649   freeO(self);
  28650   setTopSO(self, "test");
  28651   ck_assert_ptr_eq(self->f->splitSmallString(self, NULL), NULL);
  28652   terminateO(delim);
  28653   terminateO(self);
  28654 
  28655 END_TEST
  28656 
  28657 
  28658 START_TEST(splitSSmallJsonT)
  28659 
  28660   char** r;
  28661   smallJsont *self = allocSmallJson();
  28662   setTopSO(self, "");
  28663 
  28664   // string
  28665   freeO(self);
  28666   setTopSO(self, "one/two");
  28667   r = splitSO(self, "/");
  28668   ck_assert_uint_eq(listLengthS(r),2);
  28669   ck_assert_str_eq(r[0], "one");
  28670   ck_assert_str_eq(r[1], "two");
  28671   listFreeS(r);
  28672   // delimiter on the edge
  28673   freeO(self);
  28674   setTopSO(self, "/one");
  28675   r = splitSO(self, "/");
  28676   ck_assert_uint_eq(listLengthS(r),2);
  28677   ck_assert_str_eq(r[0], "");
  28678   ck_assert_str_eq(r[1], "one");
  28679   listFreeS(r);
  28680   freeO(self);
  28681   setTopSO(self, "one/");
  28682   r = splitSO(self, "/");
  28683   ck_assert_uint_eq(listLengthS(r),2);
  28684   ck_assert_str_eq(r[0], "one");
  28685   ck_assert_str_eq(r[1], "");
  28686   listFreeS(r);
  28687   // delimiter not found
  28688   freeO(self);
  28689   setTopSO(self, "one/two");
  28690   r = splitSO(self, "||");
  28691   ck_assert_uint_eq(listLengthS(r),1);
  28692   ck_assert_str_eq(r[0], "one/two");
  28693   listFreeS(r);
  28694   // split with several delimiters after each other
  28695   freeO(self);
  28696   setTopSO(self, "one/two  three ");
  28697   r = splitSO(self, " ");
  28698   ck_assert_uint_eq(listLengthS(r),4);
  28699   ck_assert_str_eq(r[0], "one/two");
  28700   ck_assert_str_eq(r[1], "");
  28701   ck_assert_str_eq(r[2], "three");
  28702   ck_assert_str_eq(r[3], "");
  28703   listFreeS(r);
  28704   // multiple character delimiter
  28705   freeO(self);
  28706   setTopSO(self, "AAe three extract");
  28707   r = splitSO(self, "e ");
  28708   ck_assert_uint_eq(listLengthS(r),3);
  28709   ck_assert_str_eq(r[0], "AA");
  28710   ck_assert_str_eq(r[1], "thre");
  28711   ck_assert_str_eq(r[2], "extract");
  28712   listFreeS(r);
  28713   // empty delimiter
  28714   freeO(self);
  28715   setTopSO(self, "AAd");
  28716   r = splitSO(self, "");
  28717   ck_assert_uint_eq(listLengthS(r),1);
  28718   ck_assert_str_eq(r[0], "AAd");
  28719   listFreeS(r);
  28720   // empty string
  28721   emptyO(self);
  28722   r = splitSO(self, "$");
  28723   ck_assert_uint_eq(listLengthS(r),1);
  28724   ck_assert_str_eq(r[0], "");
  28725   listFreeS(r);
  28726   // NULL list
  28727   freeO(self);
  28728   ck_assert_ptr_eq(splitSO(self, ";"), NULL);
  28729   // NULL delimiter
  28730   freeO(self);
  28731   setTopSO(self, "test");
  28732   ck_assert_ptr_eq(splitSO(self, NULL), NULL);
  28733   terminateO(self);
  28734 
  28735 END_TEST
  28736 
  28737 
  28738 START_TEST(splitCharSSmallJsonT)
  28739 
  28740   char** r;
  28741   smallJsont *self = allocSmallJson();
  28742   setTopSO(self, "");
  28743 
  28744   // string
  28745   freeO(self);
  28746   setTopSO(self, "one/two");
  28747   r = splitCharSO(self, '/');
  28748   ck_assert_uint_eq(listLengthS(r),2);
  28749   ck_assert_str_eq(r[0], "one");
  28750   ck_assert_str_eq(r[1], "two");
  28751   listFreeS(r);
  28752   // delimiter on the edge
  28753   freeO(self);
  28754   setTopSO(self, "/one");
  28755   r = splitCharSO(self, '/');
  28756   ck_assert_uint_eq(listLengthS(r),2);
  28757   ck_assert_str_eq(r[0], "");
  28758   ck_assert_str_eq(r[1], "one");
  28759   listFreeS(r);
  28760   freeO(self);
  28761   setTopSO(self, "one/");
  28762   r = splitCharSO(self, '/');
  28763   ck_assert_uint_eq(listLengthS(r),2);
  28764   ck_assert_str_eq(r[0], "one");
  28765   ck_assert_str_eq(r[1], "");
  28766   listFreeS(r);
  28767   // delimiter not found
  28768   freeO(self);
  28769   setTopSO(self, "one/two");
  28770   r = splitCharSO(self, '|');
  28771   ck_assert_uint_eq(listLengthS(r),1);
  28772   ck_assert_str_eq(r[0], "one/two");
  28773   listFreeS(r);
  28774   // split with several delimiters after each other
  28775   freeO(self);
  28776   setTopSO(self, "one/two  three ");
  28777   r = splitCharSO(self, ' ');
  28778   ck_assert_uint_eq(listLengthS(r),4);
  28779   ck_assert_str_eq(r[0], "one/two");
  28780   ck_assert_str_eq(r[1], "");
  28781   ck_assert_str_eq(r[2], "three");
  28782   ck_assert_str_eq(r[3], "");
  28783   listFreeS(r);
  28784   // empty string
  28785   emptyO(self);
  28786   r = splitCharSO(self, '$');
  28787   ck_assert_uint_eq(listLengthS(r),1);
  28788   ck_assert_str_eq(r[0], "");
  28789   listFreeS(r);
  28790   // NULL list
  28791   freeO(self);
  28792   ck_assert_ptr_eq(splitCharSO(self, ';'), NULL);
  28793   terminateO(self);
  28794 
  28795 END_TEST
  28796 
  28797 
  28798 START_TEST(splitSmallJsonSSmallJsonT)
  28799 
  28800   char** r;
  28801   smallJsont *self = allocSmallJson();
  28802   setTopSO(self, "");
  28803   smallJsont *delim  = allocSmallJson();
  28804 
  28805   // string
  28806   freeO(self);
  28807   setTopSO(self, "one/two");
  28808   setTopSO(delim, "/");
  28809   r = splitSmallJsonSO(self, delim);
  28810   ck_assert_uint_eq(listLengthS(r),2);
  28811   ck_assert_str_eq(r[0], "one");
  28812   ck_assert_str_eq(r[1], "two");
  28813   listFreeS(r);
  28814   // delimiter on the edge
  28815   freeO(self);
  28816   setTopSO(self, "/one");
  28817   r = splitSmallJsonSO(self, delim);
  28818   ck_assert_uint_eq(listLengthS(r),2);
  28819   ck_assert_str_eq(r[0], "");
  28820   ck_assert_str_eq(r[1], "one");
  28821   listFreeS(r);
  28822   freeO(self);
  28823   setTopSO(self, "one/");
  28824   r = splitSmallJsonSO(self, delim);
  28825   ck_assert_uint_eq(listLengthS(r),2);
  28826   ck_assert_str_eq(r[0], "one");
  28827   ck_assert_str_eq(r[1], "");
  28828   listFreeS(r);
  28829   // delimiter not found
  28830   freeO(self);
  28831   setTopSO(self, "one/two");
  28832   freeO(delim);
  28833   setTopSO(delim, "||");
  28834   r = splitSmallJsonSO(self, delim);
  28835   ck_assert_uint_eq(listLengthS(r),1);
  28836   ck_assert_str_eq(r[0], "one/two");
  28837   listFreeS(r);
  28838   // split with several delimiters after each other
  28839   freeO(self);
  28840   setTopSO(self, "one/two  three ");
  28841   freeO(delim);
  28842   setTopSO(delim, " ");
  28843   r = splitSmallJsonSO(self, delim);
  28844   ck_assert_uint_eq(listLengthS(r),4);
  28845   ck_assert_str_eq(r[0], "one/two");
  28846   ck_assert_str_eq(r[1], "");
  28847   ck_assert_str_eq(r[2], "three");
  28848   ck_assert_str_eq(r[3], "");
  28849   listFreeS(r);
  28850   // multiple character delimiter
  28851   freeO(self);
  28852   setTopSO(self, "AAe three extract");
  28853   freeO(delim);
  28854   setTopSO(delim, "e ");
  28855   r = splitSmallJsonSO(self, delim);
  28856   ck_assert_uint_eq(listLengthS(r),3);
  28857   ck_assert_str_eq(r[0], "AA");
  28858   ck_assert_str_eq(r[1], "thre");
  28859   ck_assert_str_eq(r[2], "extract");
  28860   listFreeS(r);
  28861   // empty delimiter
  28862   freeO(self);
  28863   setTopSO(self, "AAd");
  28864   freeO(delim);
  28865   setTopSO(delim, "");
  28866   r = splitSmallJsonSO(self, delim);
  28867   ck_assert_uint_eq(listLengthS(r),1);
  28868   ck_assert_str_eq(r[0], "AAd");
  28869   listFreeS(r);
  28870   // empty string
  28871   emptyO(self);
  28872   freeO(delim);
  28873   setTopSO(delim, "$");
  28874   r = splitSmallJsonSO(self, delim);
  28875   ck_assert_uint_eq(listLengthS(r),1);
  28876   ck_assert_str_eq(r[0], "");
  28877   listFreeS(r);
  28878   // non json string delimiter
  28879   freeO(delim);
  28880   ck_assert_ptr_eq(splitSmallJsonSO(self, delim), NULL);
  28881   // non json object delimiter
  28882   terminateO(delim);
  28883   delim = (smallJsont*) allocSmallInt(1);
  28884   ck_assert_ptr_eq(splitSmallJsonSO(self, delim), NULL);
  28885   terminateO(delim);
  28886   delim  = allocSmallJson();
  28887   // NULL list
  28888   freeO(self);
  28889   freeO(delim);
  28890   setTopSO(delim, ";");
  28891   ck_assert_ptr_eq(splitSmallJsonSO(self, delim), NULL);
  28892   // NULL delimiter
  28893   freeO(self);
  28894   setTopSO(self, "test");
  28895   ck_assert_ptr_eq(splitSmallJsonSO(self, NULL), NULL);
  28896   terminateO(delim);
  28897   terminateO(self);
  28898 
  28899 END_TEST
  28900 
  28901 
  28902 START_TEST(splitSmallStringSSmallJsonT)
  28903 
  28904   char** r;
  28905   smallJsont *self = allocSmallJson();
  28906   setTopSO(self, "");
  28907   smallStringt *delim = allocSmallString("/");
  28908 
  28909   // string
  28910   freeO(self);
  28911   setTopSO(self, "one/two");
  28912   r = splitSmallStringSO(self, delim);
  28913   ck_assert_uint_eq(listLengthS(r),2);
  28914   ck_assert_str_eq(r[0], "one");
  28915   ck_assert_str_eq(r[1], "two");
  28916   listFreeS(r);
  28917   // delimiter on the edge
  28918   freeO(self);
  28919   setTopSO(self, "/one");
  28920   r = splitSmallStringSO(self, delim);
  28921   ck_assert_uint_eq(listLengthS(r),2);
  28922   ck_assert_str_eq(r[0], "");
  28923   ck_assert_str_eq(r[1], "one");
  28924   listFreeS(r);
  28925   freeO(self);
  28926   setTopSO(self, "one/");
  28927   r = splitSmallStringSO(self, delim);
  28928   ck_assert_uint_eq(listLengthS(r),2);
  28929   ck_assert_str_eq(r[0], "one");
  28930   ck_assert_str_eq(r[1], "");
  28931   listFreeS(r);
  28932   // delimiter not found
  28933   freeO(self);
  28934   setTopSO(self, "one/two");
  28935   setValO(delim, "||");
  28936   r = splitSmallStringSO(self, delim);
  28937   ck_assert_uint_eq(listLengthS(r),1);
  28938   ck_assert_str_eq(r[0], "one/two");
  28939   listFreeS(r);
  28940   // split with several delimiters after each other
  28941   freeO(self);
  28942   setTopSO(self, "one/two  three ");
  28943   setValO(delim, " ");
  28944   r = splitSmallStringSO(self, delim);
  28945   ck_assert_uint_eq(listLengthS(r),4);
  28946   ck_assert_str_eq(r[0], "one/two");
  28947   ck_assert_str_eq(r[1], "");
  28948   ck_assert_str_eq(r[2], "three");
  28949   ck_assert_str_eq(r[3], "");
  28950   listFreeS(r);
  28951   // multiple character delimiter
  28952   freeO(self);
  28953   setTopSO(self, "AAe three extract");
  28954   setValO(delim, "e ");
  28955   r = splitSmallStringSO(self, delim);
  28956   ck_assert_uint_eq(listLengthS(r),3);
  28957   ck_assert_str_eq(r[0], "AA");
  28958   ck_assert_str_eq(r[1], "thre");
  28959   ck_assert_str_eq(r[2], "extract");
  28960   listFreeS(r);
  28961   // empty delimiter
  28962   freeO(self);
  28963   setTopSO(self, "AAd");
  28964   setValO(delim, "");
  28965   r = splitSmallStringSO(self, delim);
  28966   ck_assert_uint_eq(listLengthS(r),1);
  28967   ck_assert_str_eq(r[0], "AAd");
  28968   listFreeS(r);
  28969   // empty string
  28970   emptyO(self);
  28971   setValO(delim, "$");
  28972   r = splitSmallStringSO(self, delim);
  28973   ck_assert_uint_eq(listLengthS(r),1);
  28974   ck_assert_str_eq(r[0], "");
  28975   listFreeS(r);
  28976   // non smallString object delimiter
  28977   terminateO(delim);
  28978   delim = (smallStringt*) allocSmallInt(1);
  28979   ck_assert_ptr_eq(splitSmallStringSO(self, delim), NULL);
  28980   terminateO(delim);
  28981   // NULL list
  28982   freeO(self);
  28983   delim  = allocSmallString(";");
  28984   ck_assert_ptr_eq(splitSmallStringSO(self, delim), NULL);
  28985   // NULL delimiter
  28986   freeO(self);
  28987   setTopSO(self, "test");
  28988   ck_assert_ptr_eq(splitSmallStringSO(self, NULL), NULL);
  28989   terminateO(delim);
  28990   terminateO(self);
  28991 
  28992 END_TEST
  28993 
  28994 
  28995 START_TEST(extractSmallJsonT)
  28996 
  28997   smallJsont* r;
  28998   smallJsont *self = allocSmallJson();
  28999   setTopSO(self, "");
  29000 
  29001   // string
  29002   freeO(self);
  29003   setTopSO(self, "one/two|");
  29004   r = extractO(self, "/", "|");
  29005   ck_assert_ptr_ne(r, null);
  29006   char *s = toStringO(r);
  29007   ck_assert_str_eq(s, "[\"two\"]");
  29008   free(s);
  29009   terminateO(r);
  29010   // delimiter not found
  29011   freeO(self);
  29012   setTopSO(self, "one/two");
  29013   r = extractO(self, "||", "/");
  29014   ck_assert_ptr_eq(r, NULL);
  29015   // extractO with several delimiters after each other
  29016   freeO(self);
  29017   setTopSO(self, "one/ two  /three ");
  29018   r = extractO(self, "/", " ");
  29019   ck_assert_ptr_ne(r, null);
  29020   s = toStringO(r);
  29021   ck_assert_str_eq(s, "[\"\",\"three\"]");
  29022   free(s);
  29023   terminateO(r);
  29024   // multiple character delimiter
  29025   freeO(self);
  29026   setTopSO(self, "AAe thre|e extract");
  29027   r = extractO(self, "e ", "|");
  29028   ck_assert_ptr_ne(r, null);
  29029   s = toStringO(r);
  29030   ck_assert_str_eq(s, "[\"thre\"]");
  29031   free(s);
  29032   terminateO(r);
  29033   // empty delimiter
  29034   freeO(self);
  29035   setTopSO(self, "AAd");
  29036   r = extractO(self, "", "Ad");
  29037   ck_assert_ptr_eq(r, NULL);
  29038   freeO(self);
  29039   setTopSO(self, "AAd");
  29040   r = extractO(self, "A", "");
  29041   ck_assert_ptr_eq(r, NULL);
  29042   // empty string
  29043   freeO(self);
  29044   setTopSO(self, "");
  29045   r = extractO(self, "$", "#");
  29046   ck_assert_ptr_eq(r, NULL);
  29047   // delim1 = delim2
  29048   freeO(self);
  29049   setTopSO(self, "");
  29050   r = extractO(self, "$", "$");
  29051   ck_assert_ptr_eq(r, NULL);
  29052   // NULL string
  29053   freeO(self);
  29054   ck_assert_ptr_eq(extractO(self, ";", ","), NULL);
  29055   // NULL delimiter
  29056   freeO(self);
  29057   setTopSO(self, "test");
  29058   ck_assert_ptr_eq(extractO(self, NULL, ","), NULL);
  29059   ck_assert_ptr_eq(extractO(self, ",", NULL), NULL);
  29060   terminateO(self);
  29061 
  29062 END_TEST
  29063 
  29064 
  29065 START_TEST(extractCharSSmallJsonT)
  29066 
  29067   smallJsont* r;
  29068   smallJsont *self = allocSmallJson();
  29069   setTopSO(self, "");
  29070 
  29071   // string
  29072   freeO(self);
  29073   setTopSO(self, "one/two|");
  29074   r = extractCharSO(self, '/', "|");
  29075   ck_assert_ptr_ne(r, null);
  29076   char *s = toStringO(r);
  29077   ck_assert_str_eq(s, "[\"two\"]");
  29078   free(s);
  29079   terminateO(r);
  29080   // delimiter not found
  29081   freeO(self);
  29082   setTopSO(self, "one/two");
  29083   r = extractCharSO(self, '|', "/");
  29084   ck_assert_ptr_eq(r, NULL);
  29085   // extractCharSO with several delimiters after each other
  29086   freeO(self);
  29087   setTopSO(self, "one/ two  /three ");
  29088   r = extractCharSO(self, '/', " ");
  29089   ck_assert_ptr_ne(r, null);
  29090   s = toStringO(r);
  29091   ck_assert_str_eq(s, "[\"\",\"three\"]");
  29092   free(s);
  29093   terminateO(r);
  29094   // multiple character delimiter
  29095   freeO(self);
  29096   setTopSO(self, "AAe thre|e extract");
  29097   r = extractCharSO(self, ' ', "|e");
  29098   ck_assert_ptr_ne(r, null);
  29099   s = toStringO(r);
  29100   ck_assert_str_eq(s, "[\"thre\"]");
  29101   free(s);
  29102   terminateO(r);
  29103   // empty delimiter
  29104   freeO(self);
  29105   setTopSO(self, "AAd");
  29106   r = extractCharSO(self, 'A', "");
  29107   ck_assert_ptr_eq(r, NULL);
  29108   // empty string
  29109   freeO(self);
  29110   setTopSO(self, "");
  29111   r = extractCharSO(self, '$', "#");
  29112   ck_assert_ptr_eq(r, NULL);
  29113   // delim1 = delim2
  29114   freeO(self);
  29115   setTopSO(self, "");
  29116   r = extractCharSO(self, '$', "$");
  29117   ck_assert_ptr_eq(r, NULL);
  29118   // NULL string
  29119   freeO(self);
  29120   ck_assert_ptr_eq(extractCharSO(self, ';', ","), NULL);
  29121   // NULL delimiter
  29122   freeO(self);
  29123   setTopSO(self, "test");
  29124   ck_assert_ptr_eq(extractCharSO(self, ',', NULL), NULL);
  29125   terminateO(self);
  29126 
  29127 END_TEST
  29128 
  29129 
  29130 START_TEST(extractSCharSmallJsonT)
  29131 
  29132   smallJsont* r;
  29133   smallJsont *self = allocSmallJson();
  29134   setTopSO(self, "");
  29135 
  29136   // string
  29137   freeO(self);
  29138   setTopSO(self, "one/two|");
  29139   r = extractSCharO(self, "/", '|');
  29140   ck_assert_ptr_ne(r, null);
  29141   char *s = toStringO(r);
  29142   ck_assert_str_eq(s, "[\"two\"]");
  29143   free(s);
  29144   terminateO(r);
  29145   // delimiter not found
  29146   freeO(self);
  29147   setTopSO(self, "one/two");
  29148   r = extractSCharO(self, "||", '/');
  29149   ck_assert_ptr_eq(r, NULL);
  29150   // extractSCharO with several delimiters after each other
  29151   freeO(self);
  29152   setTopSO(self, "one/ two  /three ");
  29153   r = extractSCharO(self, "/", ' ');
  29154   ck_assert_ptr_ne(r, null);
  29155   s = toStringO(r);
  29156   ck_assert_str_eq(s, "[\"\",\"three\"]");
  29157   free(s);
  29158   terminateO(r);
  29159   // multiple character delimiter
  29160   freeO(self);
  29161   setTopSO(self, "AAe thre|e extract");
  29162   r = extractSCharO(self, "e ", '|');
  29163   ck_assert_ptr_ne(r, null);
  29164   s = toStringO(r);
  29165   ck_assert_str_eq(s, "[\"thre\"]");
  29166   free(s);
  29167   terminateO(r);
  29168   // empty delimiter
  29169   freeO(self);
  29170   setTopSO(self, "AAd");
  29171   r = extractSCharO(self, "", 'A');
  29172   ck_assert_ptr_eq(r, NULL);
  29173   // empty string
  29174   freeO(self);
  29175   setTopSO(self, "");
  29176   r = extractSCharO(self, "$", '#');
  29177   ck_assert_ptr_eq(r, NULL);
  29178   // delim1 = delim2
  29179   freeO(self);
  29180   setTopSO(self, "");
  29181   r = extractSCharO(self, "$", '$');
  29182   ck_assert_ptr_eq(r, NULL);
  29183   // NULL string
  29184   freeO(self);
  29185   ck_assert_ptr_eq(extractSCharO(self, ";", ','), NULL);
  29186   // NULL delimiter
  29187   freeO(self);
  29188   setTopSO(self, "test");
  29189   ck_assert_ptr_eq(extractSCharO(self, NULL, ','), NULL);
  29190   terminateO(self);
  29191 
  29192 END_TEST
  29193 
  29194 
  29195 START_TEST(extractCharCharSmallJsonT)
  29196 
  29197   smallJsont* r;
  29198   smallJsont *self = allocSmallJson();
  29199   setTopSO(self, "");
  29200 
  29201   // string
  29202   freeO(self);
  29203   setTopSO(self, "one/two|");
  29204   r = extractCharCharO(self, '/', '|');
  29205   ck_assert_ptr_ne(r, null);
  29206   char *s = toStringO(r);
  29207   ck_assert_str_eq(s, "[\"two\"]");
  29208   free(s);
  29209   terminateO(r);
  29210   // delimiter not found
  29211   freeO(self);
  29212   setTopSO(self, "one/two");
  29213   r = extractCharCharO(self, '|', '/');
  29214   ck_assert_ptr_eq(r, NULL);
  29215   // extractCharCharO with several delimiters after each other
  29216   freeO(self);
  29217   setTopSO(self, "one/ two  /three ");
  29218   r = extractCharCharO(self, '/', ' ');
  29219   ck_assert_ptr_ne(r, null);
  29220   s = toStringO(r);
  29221   ck_assert_str_eq(s, "[\"\",\"three\"]");
  29222   free(s);
  29223   terminateO(r);
  29224   // multiple character delimiter
  29225   freeO(self);
  29226   setTopSO(self, "AAe thre|e extract");
  29227   r = extractCharCharO(self, ' ', '|');
  29228   ck_assert_ptr_ne(r, null);
  29229   s = toStringO(r);
  29230   ck_assert_str_eq(s, "[\"thre\"]");
  29231   free(s);
  29232   terminateO(r);
  29233   // empty string
  29234   freeO(self);
  29235   setTopSO(self, "");
  29236   r = extractCharCharO(self, '$', '#');
  29237   ck_assert_ptr_eq(r, NULL);
  29238   // delim1 = delim2
  29239   freeO(self);
  29240   setTopSO(self, "");
  29241   r = extractCharCharO(self, '$', '$');
  29242   ck_assert_ptr_eq(r, NULL);
  29243   // NULL string
  29244   freeO(self);
  29245   ck_assert_ptr_eq(extractCharCharO(self, ';', ','), NULL);
  29246   terminateO(self);
  29247 
  29248 END_TEST
  29249 
  29250 
  29251 START_TEST(extractSmallJsonSmallJsonSmallJsonT)
  29252 
  29253   smallJsont* r;
  29254   smallJsont *self = allocSmallJson();
  29255   setTopSO(self, "");
  29256   smallJsont* delim1 = allocSmallJson();
  29257   smallJsont* delim2 = allocSmallJson();
  29258 
  29259   // string
  29260   freeO(self);
  29261   setTopSO(self, "one/two|");
  29262   setTopSO(delim1, "/");
  29263   setTopSO(delim2, "|");
  29264   r = extractSmallJsonSmallJsonO(self, delim1, delim2);
  29265   ck_assert_ptr_ne(r, null);
  29266   char *s = toStringO(r);
  29267   ck_assert_str_eq(s, "[\"two\"]");
  29268   free(s);
  29269   terminateO(r);
  29270   // delimiter not found
  29271   freeO(self);
  29272   setTopSO(self, "one/two");
  29273   freeO(delim1);
  29274   freeO(delim2);
  29275   setTopSO(delim1, "||");
  29276   setTopSO(delim2, "/");
  29277   r = extractSmallJsonSmallJsonO(self, delim1, delim2);
  29278   ck_assert_ptr_eq(r, NULL);
  29279   // extractSmallJsonSmallJsonO with several delimiters after each other
  29280   freeO(self);
  29281   setTopSO(self, "one/ two  /three ");
  29282   freeO(delim1);
  29283   freeO(delim2);
  29284   setTopSO(delim1, "/");
  29285   setTopSO(delim2, " ");
  29286   r = extractSmallJsonSmallJsonO(self, delim1, delim2);
  29287   ck_assert_ptr_ne(r, null);
  29288   s = toStringO(r);
  29289   ck_assert_str_eq(s, "[\"\",\"three\"]");
  29290   free(s);
  29291   terminateO(r);
  29292   // multiple character delimiter
  29293   freeO(self);
  29294   setTopSO(self, "AAe thre|e extract");
  29295   freeO(delim1);
  29296   freeO(delim2);
  29297   setTopSO(delim1, "e ");
  29298   setTopSO(delim2, "|");
  29299   r = extractSmallJsonSmallJsonO(self, delim1, delim2);
  29300   ck_assert_ptr_ne(r, null);
  29301   s = toStringO(r);
  29302   ck_assert_str_eq(s, "[\"thre\"]");
  29303   free(s);
  29304   terminateO(r);
  29305   // empty delimiter
  29306   freeO(self);
  29307   setTopSO(self, "AAd");
  29308   freeO(delim1);
  29309   freeO(delim2);
  29310   setTopSO(delim1, "");
  29311   setTopSO(delim2, "Ad");
  29312   r = extractSmallJsonSmallJsonO(self, delim1, delim2);
  29313   ck_assert_ptr_eq(r, NULL);
  29314   freeO(self);
  29315   setTopSO(self, "AAd");
  29316   freeO(delim1);
  29317   freeO(delim2);
  29318   setTopSO(delim1, "A");
  29319   setTopSO(delim2, "");
  29320   r = extractSmallJsonSmallJsonO(self, delim1, delim2);
  29321   ck_assert_ptr_eq(r, NULL);
  29322   // empty string
  29323   freeO(self);
  29324   setTopSO(self, "");
  29325   freeO(delim1);
  29326   freeO(delim2);
  29327   setTopSO(delim1, "$");
  29328   setTopSO(delim2, "#");
  29329   r = extractSmallJsonSmallJsonO(self, delim1, delim2);
  29330   ck_assert_ptr_eq(r, NULL);
  29331   // delim1 = delim2
  29332   freeO(self);
  29333   setTopSO(self, "$qwe$");
  29334   freeO(delim1);
  29335   freeO(delim2);
  29336   setTopSO(delim1, "$");
  29337   setTopSO(delim2, "$");
  29338   r = extractSmallJsonSmallJsonO(self, delim1, delim2);
  29339   ck_assert_ptr_eq(r, NULL);
  29340   // non json string
  29341   freeO(delim1);
  29342   r = extractSmallJsonSmallJsonO(self, delim1, delim2);
  29343   ck_assert_ptr_eq(r, NULL);
  29344   setTopSO(delim1, "$");
  29345   freeO(delim2);
  29346   r = extractSmallJsonSmallJsonO(self, delim1, delim2);
  29347   ck_assert_ptr_eq(r, NULL);
  29348   // non json object
  29349   terminateO(delim1);
  29350   delim1 = (smallJsont*) allocSmallInt(1);
  29351   setTopSO(delim2, "$");
  29352   r = extractSmallJsonSmallJsonO(self, delim1, delim2);
  29353   ck_assert_ptr_eq(r, NULL);
  29354   terminateO(delim1);
  29355   delim1 = allocSmallJson();
  29356   setTopSO(delim1, ";");
  29357   terminateO(delim2);
  29358   delim2 = (smallJsont*) allocSmallInt(1);
  29359   r = extractSmallJsonSmallJsonO(self, delim1, delim2);
  29360   ck_assert_ptr_eq(r, NULL);
  29361   terminateO(delim2);
  29362   delim2 = allocSmallJson();
  29363   // NULL string
  29364   freeO(self);
  29365   freeO(delim1);
  29366   freeO(delim2);
  29367   setTopSO(delim1, ";");
  29368   setTopSO(delim2, ",");
  29369   ck_assert_ptr_eq(extractSmallJsonSmallJsonO(self, delim1, delim2), NULL);
  29370   // NULL delimiter
  29371   freeO(self);
  29372   setTopSO(self, "test");
  29373   ck_assert_ptr_eq(extractSmallJsonSmallJsonO(self, NULL, delim2), NULL);
  29374   ck_assert_ptr_eq(extractSmallJsonSmallJsonO(self, delim1, NULL), NULL);
  29375   terminateO(delim1);
  29376   terminateO(delim2);
  29377   terminateO(self);
  29378 
  29379 END_TEST
  29380 
  29381 
  29382 START_TEST(extractSmallJsonSmallStringSmallJsonT)
  29383 
  29384   smallJsont* r;
  29385   smallJsont *self = allocSmallJson();
  29386   setTopSO(self, "");
  29387   smallJsont* delim1   = allocSmallJson();
  29388   smallStringt* delim2 = allocSmallString("|");
  29389 
  29390   // string
  29391   freeO(self);
  29392   setTopSO(self, "one/two|");
  29393   setTopSO(delim1, "/");
  29394   r = extractSmallJsonSmallStringO(self, delim1, delim2);
  29395   ck_assert_ptr_ne(r, null);
  29396   char *s = toStringO(r);
  29397   ck_assert_str_eq(s, "[\"two\"]");
  29398   free(s);
  29399   terminateO(r);
  29400   // delimiter not found
  29401   freeO(self);
  29402   setTopSO(self, "one/two");
  29403   freeO(delim1);
  29404   setTopSO(delim1, "||");
  29405   setValO(delim2, "/");
  29406   r = extractSmallJsonSmallStringO(self, delim1, delim2);
  29407   ck_assert_ptr_eq(r, NULL);
  29408   // extractSmallJsonSmallStringO with several delimiters after each other
  29409   freeO(self);
  29410   setTopSO(self, "one/ two  /three ");
  29411   freeO(delim1);
  29412   setTopSO(delim1, "/");
  29413   setValO(delim2, " ");
  29414   r = extractSmallJsonSmallStringO(self, delim1, delim2);
  29415   ck_assert_ptr_ne(r, null);
  29416   s = toStringO(r);
  29417   ck_assert_str_eq(s, "[\"\",\"three\"]");
  29418   free(s);
  29419   terminateO(r);
  29420   // multiple character delimiter
  29421   freeO(self);
  29422   setTopSO(self, "AAe thre|e extract");
  29423   freeO(delim1);
  29424   setTopSO(delim1, "e ");
  29425   setValO(delim2, "|");
  29426   r = extractSmallJsonSmallStringO(self, delim1, delim2);
  29427   ck_assert_ptr_ne(r, null);
  29428   s = toStringO(r);
  29429   ck_assert_str_eq(s, "[\"thre\"]");
  29430   free(s);
  29431   terminateO(r);
  29432   // empty delimiter
  29433   freeO(self);
  29434   setTopSO(self, "AAd");
  29435   freeO(delim1);
  29436   setTopSO(delim1, "");
  29437   setValO(delim2, "Ad");
  29438   r = extractSmallJsonSmallStringO(self, delim1, delim2);
  29439   ck_assert_ptr_eq(r, NULL);
  29440   freeO(self);
  29441   setTopSO(self, "AAd");
  29442   freeO(delim1);
  29443   setTopSO(delim1, "A");
  29444   setValO(delim2, "");
  29445   r = extractSmallJsonSmallStringO(self, delim1, delim2);
  29446   ck_assert_ptr_eq(r, NULL);
  29447   // empty string
  29448   freeO(self);
  29449   setTopSO(self, "");
  29450   freeO(delim1);
  29451   setTopSO(delim1, "$");
  29452   setValO(delim2, "#");
  29453   r = extractSmallJsonSmallStringO(self, delim1, delim2);
  29454   ck_assert_ptr_eq(r, NULL);
  29455   // delim1 = delim2
  29456   freeO(self);
  29457   setTopSO(self, "$qwe$");
  29458   freeO(delim1);
  29459   setTopSO(delim1, "$");
  29460   setValO(delim2, "$");
  29461   r = extractSmallJsonSmallStringO(self, delim1, delim2);
  29462   ck_assert_ptr_eq(r, NULL);
  29463   // non json string
  29464   freeO(delim1);
  29465   r = extractSmallJsonSmallStringO(self, delim1, delim2);
  29466   ck_assert_ptr_eq(r, NULL);
  29467   // non json object
  29468   terminateO(delim1);
  29469   delim1 = (smallJsont*) allocSmallInt(1);
  29470   r = extractSmallJsonSmallStringO(self, delim1, delim2);
  29471   ck_assert_ptr_eq(r, NULL);
  29472   terminateO(delim1);
  29473   delim1 = allocSmallJson();
  29474   setTopSO(delim1, ";");
  29475   terminateO(delim2);
  29476   delim2 = (smallStringt*) allocSmallInt(1);
  29477   r = extractSmallJsonSmallStringO(self, delim1, delim2);
  29478   ck_assert_ptr_eq(r, NULL);
  29479   terminateO(delim2);
  29480   delim2 = allocSmallString(",");
  29481   // NULL string
  29482   freeO(self);
  29483   freeO(delim1);
  29484   setTopSO(delim1, ";");
  29485   ck_assert_ptr_eq(extractSmallJsonSmallStringO(self, delim1, delim2), NULL);
  29486   // NULL delimiter
  29487   freeO(self);
  29488   setTopSO(self, "test");
  29489   ck_assert_ptr_eq(extractSmallJsonSmallStringO(self, NULL, delim2), NULL);
  29490   ck_assert_ptr_eq(extractSmallJsonSmallStringO(self, delim1, NULL), NULL);
  29491   terminateO(delim1);
  29492   terminateO(delim2);
  29493   terminateO(self);
  29494 
  29495 END_TEST
  29496 
  29497 
  29498 START_TEST(extractSmallJsonSSmallJsonT)
  29499 
  29500   smallJsont* r;
  29501   smallJsont *self = allocSmallJson();
  29502   setTopSO(self, "");
  29503   smallJsont* delim1 = allocSmallJson();
  29504 
  29505   // string
  29506   freeO(self);
  29507   setTopSO(self, "one/two|");
  29508   setTopSO(delim1, "/");
  29509   r = extractSmallJsonSO(self, delim1, "|");
  29510   ck_assert_ptr_ne(r, null);
  29511   char *s = toStringO(r);
  29512   ck_assert_str_eq(s, "[\"two\"]");
  29513   free(s);
  29514   terminateO(r);
  29515   // delimiter not found
  29516   freeO(self);
  29517   setTopSO(self, "one/two");
  29518   freeO(delim1);
  29519   setTopSO(delim1, "||");
  29520   r = extractSmallJsonSO(self, delim1, "/");
  29521   ck_assert_ptr_eq(r, NULL);
  29522   // extractSmallJsonSO with several delimiters after each other
  29523   freeO(self);
  29524   setTopSO(self, "one/ two  /three ");
  29525   freeO(delim1);
  29526   setTopSO(delim1, "/");
  29527   r = extractSmallJsonSO(self, delim1, " ");
  29528   ck_assert_ptr_ne(r, null);
  29529   s = toStringO(r);
  29530   ck_assert_str_eq(s, "[\"\",\"three\"]");
  29531   free(s);
  29532   terminateO(r);
  29533   // multiple character delimiter
  29534   freeO(self);
  29535   setTopSO(self, "AAe thre|e extract");
  29536   freeO(delim1);
  29537   setTopSO(delim1, "e ");
  29538   r = extractSmallJsonSO(self, delim1, "|");
  29539   ck_assert_ptr_ne(r, null);
  29540   s = toStringO(r);
  29541   ck_assert_str_eq(s, "[\"thre\"]");
  29542   free(s);
  29543   terminateO(r);
  29544   // empty delimiter
  29545   freeO(self);
  29546   setTopSO(self, "AAd");
  29547   freeO(delim1);
  29548   setTopSO(delim1, "");
  29549   r = extractSmallJsonSO(self, delim1, "Ad");
  29550   ck_assert_ptr_eq(r, NULL);
  29551   freeO(self);
  29552   setTopSO(self, "AAd");
  29553   freeO(delim1);
  29554   setTopSO(delim1, "A");
  29555   r = extractSmallJsonSO(self, delim1, "");
  29556   ck_assert_ptr_eq(r, NULL);
  29557   // empty string
  29558   freeO(self);
  29559   setTopSO(self, "");
  29560   freeO(delim1);
  29561   setTopSO(delim1, "$");
  29562   r = extractSmallJsonSO(self, delim1, "#");
  29563   ck_assert_ptr_eq(r, NULL);
  29564   // delim1 = delim2
  29565   freeO(self);
  29566   setTopSO(self, "$qwe$");
  29567   freeO(delim1);
  29568   setTopSO(delim1, "$");
  29569   r = extractSmallJsonSO(self, delim1, "$");
  29570   ck_assert_ptr_eq(r, NULL);
  29571   // non json string
  29572   freeO(delim1);
  29573   r = extractSmallJsonSO(self, delim1, "$");
  29574   ck_assert_ptr_eq(r, NULL);
  29575   // non json object
  29576   terminateO(delim1);
  29577   delim1 = (smallJsont*) allocSmallInt(1);
  29578   r = extractSmallJsonSO(self, delim1, "$");
  29579   ck_assert_ptr_eq(r, NULL);
  29580   terminateO(delim1);
  29581   delim1 = allocSmallJson();
  29582   // NULL string
  29583   freeO(self);
  29584   freeO(delim1);
  29585   setTopSO(delim1, ";");
  29586   ck_assert_ptr_eq(extractSmallJsonSO(self, delim1, ","), NULL);
  29587   // NULL delimiter
  29588   freeO(self);
  29589   setTopSO(self, "test");
  29590   ck_assert_ptr_eq(extractSmallJsonSO(self, NULL, ","), NULL);
  29591   ck_assert_ptr_eq(extractSmallJsonSO(self, delim1, NULL), NULL);
  29592   terminateO(delim1);
  29593   terminateO(self);
  29594 
  29595 END_TEST
  29596 
  29597 
  29598 START_TEST(extractSmallJsonCharSmallJsonT)
  29599 
  29600   smallJsont* r;
  29601   smallJsont *self = allocSmallJson();
  29602   setTopSO(self, "");
  29603   smallJsont* delim1 = allocSmallJson();
  29604 
  29605   // string
  29606   freeO(self);
  29607   setTopSO(self, "one/two|");
  29608   setTopSO(delim1, "/");
  29609   r = extractSmallJsonCharO(self, delim1, '|');
  29610   ck_assert_ptr_ne(r, null);
  29611   char *s = toStringO(r);
  29612   ck_assert_str_eq(s, "[\"two\"]");
  29613   free(s);
  29614   terminateO(r);
  29615   // delimiter not found
  29616   freeO(self);
  29617   setTopSO(self, "one/two");
  29618   freeO(delim1);
  29619   setTopSO(delim1, "||");
  29620   r = extractSmallJsonCharO(self, delim1, '/');
  29621   ck_assert_ptr_eq(r, NULL);
  29622   // extractSmallJsonCharO with several delimiters after each other
  29623   freeO(self);
  29624   setTopSO(self, "one/ two  /three ");
  29625   freeO(delim1);
  29626   setTopSO(delim1, "/");
  29627   r = extractSmallJsonCharO(self, delim1, ' ');
  29628   ck_assert_ptr_ne(r, null);
  29629   s = toStringO(r);
  29630   ck_assert_str_eq(s, "[\"\",\"three\"]");
  29631   free(s);
  29632   terminateO(r);
  29633   // multiple character delimiter
  29634   freeO(self);
  29635   setTopSO(self, "AAe thre|e extract");
  29636   freeO(delim1);
  29637   setTopSO(delim1, "e ");
  29638   r = extractSmallJsonCharO(self, delim1, '|');
  29639   ck_assert_ptr_ne(r, null);
  29640   s = toStringO(r);
  29641   ck_assert_str_eq(s, "[\"thre\"]");
  29642   free(s);
  29643   terminateO(r);
  29644   // empty delimiter
  29645   freeO(self);
  29646   setTopSO(self, "AAd");
  29647   freeO(delim1);
  29648   setTopSO(delim1, "");
  29649   r = extractSmallJsonCharO(self, delim1, 'd');
  29650   ck_assert_ptr_eq(r, NULL);
  29651   freeO(self);
  29652   setTopSO(self, "AAd");
  29653   // empty string
  29654   freeO(self);
  29655   setTopSO(self, "");
  29656   freeO(delim1);
  29657   setTopSO(delim1, "$");
  29658   r = extractSmallJsonCharO(self, delim1, '#');
  29659   ck_assert_ptr_eq(r, NULL);
  29660   // delim1 = delim2
  29661   freeO(self);
  29662   setTopSO(self, "$qwe$");
  29663   freeO(delim1);
  29664   setTopSO(delim1, "$");
  29665   r = extractSmallJsonCharO(self, delim1, '$');
  29666   ck_assert_ptr_eq(r, NULL);
  29667   // non json string
  29668   freeO(delim1);
  29669   r = extractSmallJsonCharO(self, delim1, '$');
  29670   ck_assert_ptr_eq(r, NULL);
  29671   // non json object
  29672   terminateO(delim1);
  29673   delim1 = (smallJsont*) allocSmallInt(1);
  29674   r = extractSmallJsonCharO(self, delim1, '$');
  29675   ck_assert_ptr_eq(r, NULL);
  29676   terminateO(delim1);
  29677   delim1 = allocSmallJson();
  29678   // NULL string
  29679   freeO(self);
  29680   freeO(delim1);
  29681   setTopSO(delim1, ";");
  29682   ck_assert_ptr_eq(extractSmallJsonCharO(self, delim1, ','), NULL);
  29683   // NULL delimiter
  29684   freeO(self);
  29685   setTopSO(self, "test");
  29686   ck_assert_ptr_eq(extractSmallJsonCharO(self, NULL, ','), NULL);
  29687   terminateO(delim1);
  29688   terminateO(self);
  29689 
  29690 END_TEST
  29691 
  29692 
  29693 START_TEST(extractSmallStringSmallJsonSmallJsonT)
  29694 
  29695   smallJsont* r;
  29696   smallJsont *self = allocSmallJson();
  29697   setTopSO(self, "");
  29698   smallStringt* delim1 = allocSmallString("/");
  29699   smallJsont* delim2   = allocSmallJson();
  29700 
  29701   // string
  29702   freeO(self);
  29703   setTopSO(self, "one/two|");
  29704   setTopSO(delim2, "|");
  29705   r = extractSmallStringSmallJsonO(self, delim1, delim2);
  29706   ck_assert_ptr_ne(r, null);
  29707   char *s = toStringO(r);
  29708   ck_assert_str_eq(s, "[\"two\"]");
  29709   free(s);
  29710   terminateO(r);
  29711   // delimiter not found
  29712   freeO(self);
  29713   setTopSO(self, "one/two");
  29714   freeO(delim2);
  29715   setValO(delim1, "||");
  29716   setTopSO(delim2, "/");
  29717   r = extractSmallStringSmallJsonO(self, delim1, delim2);
  29718   ck_assert_ptr_eq(r, NULL);
  29719   // extractSmallStringSmallJsonO with several delimiters after each other
  29720   freeO(self);
  29721   setTopSO(self, "one/ two  /three ");
  29722   freeO(delim2);
  29723   setValO(delim1, "/");
  29724   setTopSO(delim2, " ");
  29725   r = extractSmallStringSmallJsonO(self, delim1, delim2);
  29726   ck_assert_ptr_ne(r, null);
  29727   s = toStringO(r);
  29728   ck_assert_str_eq(s, "[\"\",\"three\"]");
  29729   free(s);
  29730   terminateO(r);
  29731   // multiple character delimiter
  29732   freeO(self);
  29733   setTopSO(self, "AAe thre|e extract");
  29734   freeO(delim2);
  29735   setValO(delim1, "e ");
  29736   setTopSO(delim2, "|");
  29737   r = extractSmallStringSmallJsonO(self, delim1, delim2);
  29738   ck_assert_ptr_ne(r, null);
  29739   s = toStringO(r);
  29740   ck_assert_str_eq(s, "[\"thre\"]");
  29741   free(s);
  29742   terminateO(r);
  29743   // empty delimiter
  29744   freeO(self);
  29745   setTopSO(self, "AAd");
  29746   freeO(delim2);
  29747   setValO(delim1, "");
  29748   setTopSO(delim2, "Ad");
  29749   r = extractSmallStringSmallJsonO(self, delim1, delim2);
  29750   ck_assert_ptr_eq(r, NULL);
  29751   freeO(self);
  29752   setTopSO(self, "AAd");
  29753   freeO(delim2);
  29754   setValO(delim1, "A");
  29755   setTopSO(delim2, "");
  29756   r = extractSmallStringSmallJsonO(self, delim1, delim2);
  29757   ck_assert_ptr_eq(r, NULL);
  29758   // empty string
  29759   freeO(self);
  29760   setTopSO(self, "");
  29761   freeO(delim2);
  29762   setValO(delim1, "$");
  29763   setTopSO(delim2, "#");
  29764   r = extractSmallStringSmallJsonO(self, delim1, delim2);
  29765   ck_assert_ptr_eq(r, NULL);
  29766   // delim1 = delim2
  29767   freeO(self);
  29768   setTopSO(self, "$qwe$");
  29769   freeO(delim2);
  29770   setValO(delim1, "$");
  29771   setTopSO(delim2, "$");
  29772   r = extractSmallStringSmallJsonO(self, delim1, delim2);
  29773   ck_assert_ptr_eq(r, NULL);
  29774   // non json string
  29775   freeO(delim2);
  29776   r = extractSmallStringSmallJsonO(self, delim1, delim2);
  29777   ck_assert_ptr_eq(r, NULL);
  29778   // non json object
  29779   terminateO(delim1);
  29780   delim1 = (smallStringt*) allocSmallInt(1);
  29781   setTopSO(delim2, "$");
  29782   r = extractSmallStringSmallJsonO(self, delim1, delim2);
  29783   ck_assert_ptr_eq(r, NULL);
  29784   terminateO(delim1);
  29785   delim1 = allocSmallString(";");
  29786   terminateO(delim2);
  29787   delim2 = (smallJsont*) allocSmallInt(1);
  29788   r = extractSmallStringSmallJsonO(self, delim1, delim2);
  29789   ck_assert_ptr_eq(r, NULL);
  29790   terminateO(delim2);
  29791   delim2 = allocSmallJson();
  29792   // NULL string
  29793   freeO(self);
  29794   freeO(delim2);
  29795   setValO(delim1, ";");
  29796   setTopSO(delim2, ",");
  29797   ck_assert_ptr_eq(extractSmallStringSmallJsonO(self, delim1, delim2), NULL);
  29798   // NULL delimiter
  29799   freeO(self);
  29800   setTopSO(self, "test");
  29801   ck_assert_ptr_eq(extractSmallStringSmallJsonO(self, NULL, delim2), NULL);
  29802   ck_assert_ptr_eq(extractSmallStringSmallJsonO(self, delim1, NULL), NULL);
  29803   terminateO(delim1);
  29804   terminateO(delim2);
  29805   terminateO(self);
  29806 
  29807 END_TEST
  29808 
  29809 
  29810 START_TEST(extractSmallStringSmallStringSmallJsonT)
  29811 
  29812   smallJsont* r;
  29813   smallJsont *self = allocSmallJson();
  29814   setTopSO(self, "");
  29815   smallStringt* delim1 = allocSmallString("/");
  29816   smallStringt* delim2 = allocSmallString("|");
  29817 
  29818   // string
  29819   freeO(self);
  29820   setTopSO(self, "one/two|");
  29821   setValO(delim2, "|");
  29822   r = extractSmallStringSmallStringO(self, delim1, delim2);
  29823   ck_assert_ptr_ne(r, null);
  29824   char *s = toStringO(r);
  29825   ck_assert_str_eq(s, "[\"two\"]");
  29826   free(s);
  29827   terminateO(r);
  29828   // delimiter not found
  29829   freeO(self);
  29830   setTopSO(self, "one/two");
  29831   setValO(delim1, "||");
  29832   setValO(delim2, "/");
  29833   r = extractSmallStringSmallStringO(self, delim1, delim2);
  29834   ck_assert_ptr_eq(r, NULL);
  29835   // extractSmallStringSmallStringO with several delimiters after each other
  29836   freeO(self);
  29837   setTopSO(self, "one/ two  /three ");
  29838   setValO(delim1, "/");
  29839   setValO(delim2, " ");
  29840   r = extractSmallStringSmallStringO(self, delim1, delim2);
  29841   ck_assert_ptr_ne(r, null);
  29842   s = toStringO(r);
  29843   ck_assert_str_eq(s, "[\"\",\"three\"]");
  29844   free(s);
  29845   terminateO(r);
  29846   // multiple character delimiter
  29847   freeO(self);
  29848   setTopSO(self, "AAe thre|e extract");
  29849   setValO(delim1, "e ");
  29850   setValO(delim2, "|");
  29851   r = extractSmallStringSmallStringO(self, delim1, delim2);
  29852   ck_assert_ptr_ne(r, null);
  29853   s = toStringO(r);
  29854   ck_assert_str_eq(s, "[\"thre\"]");
  29855   free(s);
  29856   terminateO(r);
  29857   // empty delimiter
  29858   freeO(self);
  29859   setTopSO(self, "AAd");
  29860   setValO(delim1, "");
  29861   setValO(delim2, "Ad");
  29862   r = extractSmallStringSmallStringO(self, delim1, delim2);
  29863   ck_assert_ptr_eq(r, NULL);
  29864   freeO(self);
  29865   setTopSO(self, "AAd");
  29866   setValO(delim1, "A");
  29867   setValO(delim2, "");
  29868   r = extractSmallStringSmallStringO(self, delim1, delim2);
  29869   ck_assert_ptr_eq(r, NULL);
  29870   // empty string
  29871   freeO(self);
  29872   setTopSO(self, "");
  29873   setValO(delim1, "$");
  29874   setValO(delim2, "#");
  29875   r = extractSmallStringSmallStringO(self, delim1, delim2);
  29876   ck_assert_ptr_eq(r, NULL);
  29877   // delim1 = delim2
  29878   freeO(self);
  29879   setTopSO(self, "$qwe$");
  29880   setValO(delim1, "$");
  29881   setValO(delim2, "$");
  29882   r = extractSmallStringSmallStringO(self, delim1, delim2);
  29883   ck_assert_ptr_eq(r, NULL);
  29884   // non json object
  29885   terminateO(delim1);
  29886   delim1 = (smallStringt*) allocSmallInt(1);
  29887   r = extractSmallStringSmallStringO(self, delim1, delim2);
  29888   ck_assert_ptr_eq(r, NULL);
  29889   terminateO(delim1);
  29890   delim1 = allocSmallString(";");
  29891   terminateO(delim2);
  29892   delim2 = (smallStringt*) allocSmallInt(1);
  29893   r = extractSmallStringSmallStringO(self, delim1, delim2);
  29894   ck_assert_ptr_eq(r, NULL);
  29895   terminateO(delim2);
  29896   delim2 = allocSmallString(",");
  29897   // NULL string
  29898   freeO(self);
  29899   setValO(delim1, ";");
  29900   ck_assert_ptr_eq(extractSmallStringSmallStringO(self, delim1, delim2), NULL);
  29901   // NULL delimiter
  29902   freeO(self);
  29903   setTopSO(self, "test");
  29904   ck_assert_ptr_eq(extractSmallStringSmallStringO(self, NULL, delim2), NULL);
  29905   ck_assert_ptr_eq(extractSmallStringSmallStringO(self, delim1, NULL), NULL);
  29906   terminateO(delim1);
  29907   terminateO(delim2);
  29908   terminateO(self);
  29909 
  29910 END_TEST
  29911 
  29912 
  29913 START_TEST(extractSmallStringSSmallJsonT)
  29914 
  29915   smallJsont* r;
  29916   smallJsont *self = allocSmallJson();
  29917   setTopSO(self, "");
  29918   smallStringt* delim1 = allocSmallString("/");
  29919 
  29920   // string
  29921   freeO(self);
  29922   setTopSO(self, "one/two|");
  29923   r = extractSmallStringSO(self, delim1, "|");
  29924   ck_assert_ptr_ne(r, null);
  29925   char *s = toStringO(r);
  29926   ck_assert_str_eq(s, "[\"two\"]");
  29927   free(s);
  29928   terminateO(r);
  29929   // delimiter not found
  29930   freeO(self);
  29931   setTopSO(self, "one/two");
  29932   setValO(delim1, "||");
  29933   r = extractSmallStringSO(self, delim1, "/");
  29934   ck_assert_ptr_eq(r, NULL);
  29935   // extractSmallStringSO with several delimiters after each other
  29936   freeO(self);
  29937   setTopSO(self, "one/ two  /three ");
  29938   setValO(delim1, "/");
  29939   r = extractSmallStringSO(self, delim1, " ");
  29940   ck_assert_ptr_ne(r, null);
  29941   s = toStringO(r);
  29942   ck_assert_str_eq(s, "[\"\",\"three\"]");
  29943   free(s);
  29944   terminateO(r);
  29945   // multiple character delimiter
  29946   freeO(self);
  29947   setTopSO(self, "AAe thre|e extract");
  29948   setValO(delim1, "e ");
  29949   r = extractSmallStringSO(self, delim1, "|");
  29950   ck_assert_ptr_ne(r, null);
  29951   s = toStringO(r);
  29952   ck_assert_str_eq(s, "[\"thre\"]");
  29953   free(s);
  29954   terminateO(r);
  29955   // empty delimiter
  29956   freeO(self);
  29957   setTopSO(self, "AAd");
  29958   setValO(delim1, "");
  29959   r = extractSmallStringSO(self, delim1, "Ad");
  29960   ck_assert_ptr_eq(r, NULL);
  29961   freeO(self);
  29962   setTopSO(self, "AAd");
  29963   setValO(delim1, "A");
  29964   r = extractSmallStringSO(self, delim1, "");
  29965   ck_assert_ptr_eq(r, NULL);
  29966   // empty string
  29967   freeO(self);
  29968   setTopSO(self, "");
  29969   setValO(delim1, "$");
  29970   r = extractSmallStringSO(self, delim1, "#");
  29971   ck_assert_ptr_eq(r, NULL);
  29972   // delim1 = delim2
  29973   freeO(self);
  29974   setTopSO(self, "$qwe$");
  29975   setValO(delim1, "$");
  29976   r = extractSmallStringSO(self, delim1, "$");
  29977   ck_assert_ptr_eq(r, NULL);
  29978   // non json object
  29979   terminateO(delim1);
  29980   delim1 = (smallStringt*) allocSmallInt(1);
  29981   r = extractSmallStringSO(self, delim1, "$");
  29982   ck_assert_ptr_eq(r, NULL);
  29983   terminateO(delim1);
  29984   delim1 = allocSmallString(";");
  29985   // NULL string
  29986   freeO(self);
  29987   setValO(delim1, ";");
  29988   ck_assert_ptr_eq(extractSmallStringSO(self, delim1, ","), NULL);
  29989   // NULL delimiter
  29990   freeO(self);
  29991   setTopSO(self, "test");
  29992   ck_assert_ptr_eq(extractSmallStringSO(self, NULL, ","), NULL);
  29993   ck_assert_ptr_eq(extractSmallStringSO(self, delim1, NULL), NULL);
  29994   terminateO(delim1);
  29995   terminateO(self);
  29996 
  29997 END_TEST
  29998 
  29999 
  30000 START_TEST(extractSmallStringCharSmallJsonT)
  30001 
  30002   smallJsont* r;
  30003   smallJsont *self = allocSmallJson();
  30004   setTopSO(self, "");
  30005   smallStringt* delim1 = allocSmallString("/");
  30006 
  30007   // string
  30008   freeO(self);
  30009   setTopSO(self, "one/two|");
  30010   r = extractSmallStringCharO(self, delim1, '|');
  30011   ck_assert_ptr_ne(r, null);
  30012   char *s = toStringO(r);
  30013   ck_assert_str_eq(s, "[\"two\"]");
  30014   free(s);
  30015   terminateO(r);
  30016   // delimiter not found
  30017   freeO(self);
  30018   setTopSO(self, "one/two");
  30019   setValO(delim1, "||");
  30020   r = extractSmallStringCharO(self, delim1, '/');
  30021   ck_assert_ptr_eq(r, NULL);
  30022   // extractSmallStringCharO with several delimiters after each other
  30023   freeO(self);
  30024   setTopSO(self, "one/ two  /three ");
  30025   setValO(delim1, "/");
  30026   r = extractSmallStringCharO(self, delim1, ' ');
  30027   ck_assert_ptr_ne(r, null);
  30028   s = toStringO(r);
  30029   ck_assert_str_eq(s, "[\"\",\"three\"]");
  30030   free(s);
  30031   terminateO(r);
  30032   // multiple character delimiter
  30033   freeO(self);
  30034   setTopSO(self, "AAe thre|e extract");
  30035   setValO(delim1, "e ");
  30036   r = extractSmallStringCharO(self, delim1, '|');
  30037   ck_assert_ptr_ne(r, null);
  30038   s = toStringO(r);
  30039   ck_assert_str_eq(s, "[\"thre\"]");
  30040   free(s);
  30041   terminateO(r);
  30042   // empty delimiter
  30043   freeO(self);
  30044   setTopSO(self, "AAd");
  30045   setValO(delim1, "");
  30046   r = extractSmallStringCharO(self, delim1, 'A');
  30047   ck_assert_ptr_eq(r, NULL);
  30048   freeO(self);
  30049   setTopSO(self, "AAd");
  30050   setValO(delim1, "A");
  30051   // empty string
  30052   freeO(self);
  30053   setTopSO(self, "");
  30054   setValO(delim1, "$");
  30055   r = extractSmallStringCharO(self, delim1, '#');
  30056   ck_assert_ptr_eq(r, NULL);
  30057   // delim1 = delim2
  30058   freeO(self);
  30059   setTopSO(self, "$qwe$");
  30060   setValO(delim1, "$");
  30061   r = extractSmallStringCharO(self, delim1, '$');
  30062   ck_assert_ptr_eq(r, NULL);
  30063   // non json object
  30064   terminateO(delim1);
  30065   delim1 = (smallStringt*) allocSmallInt(1);
  30066   r = extractSmallStringCharO(self, delim1, '$');
  30067   ck_assert_ptr_eq(r, NULL);
  30068   terminateO(delim1);
  30069   delim1 = allocSmallString(";");
  30070   // NULL string
  30071   freeO(self);
  30072   setValO(delim1, ";");
  30073   ck_assert_ptr_eq(extractSmallStringCharO(self, delim1, ','), NULL);
  30074   // NULL delimiter
  30075   freeO(self);
  30076   setTopSO(self, "test");
  30077   ck_assert_ptr_eq(extractSmallStringCharO(self, NULL, ','), NULL);
  30078   terminateO(delim1);
  30079   terminateO(self);
  30080 
  30081 END_TEST
  30082 
  30083 
  30084 START_TEST(extractSSmallJsonSmallJsonT)
  30085 
  30086   smallJsont* r;
  30087   smallJsont *self = allocSmallJson();
  30088   setTopSO(self, "");
  30089   smallJsont* delim2 = allocSmallJson();
  30090 
  30091   // string
  30092   freeO(self);
  30093   setTopSO(self, "one/two|");
  30094   setTopSO(delim2, "|");
  30095   r = extractSSmallJsonO(self, "/", delim2);
  30096   ck_assert_ptr_ne(r, null);
  30097   char *s = toStringO(r);
  30098   ck_assert_str_eq(s, "[\"two\"]");
  30099   free(s);
  30100   terminateO(r);
  30101   // delimiter not found
  30102   freeO(self);
  30103   setTopSO(self, "one/two");
  30104   freeO(delim2);
  30105   setTopSO(delim2, "/");
  30106   r = extractSSmallJsonO(self, "||", delim2);
  30107   ck_assert_ptr_eq(r, NULL);
  30108   // extractSSmallJsonO with several delimiters after each other
  30109   freeO(self);
  30110   setTopSO(self, "one/ two  /three ");
  30111   freeO(delim2);
  30112   setTopSO(delim2, " ");
  30113   r = extractSSmallJsonO(self, "/", delim2);
  30114   ck_assert_ptr_ne(r, null);
  30115   s = toStringO(r);
  30116   ck_assert_str_eq(s, "[\"\",\"three\"]");
  30117   free(s);
  30118   terminateO(r);
  30119   // multiple character delimiter
  30120   freeO(self);
  30121   setTopSO(self, "AAe thre|e extract");
  30122   freeO(delim2);
  30123   setTopSO(delim2, "|");
  30124   r = extractSSmallJsonO(self, "e ", delim2);
  30125   ck_assert_ptr_ne(r, null);
  30126   s = toStringO(r);
  30127   ck_assert_str_eq(s, "[\"thre\"]");
  30128   free(s);
  30129   terminateO(r);
  30130   // empty delimiter
  30131   freeO(self);
  30132   setTopSO(self, "AAd");
  30133   freeO(delim2);
  30134   setTopSO(delim2, "Ad");
  30135   r = extractSSmallJsonO(self, "", delim2);
  30136   ck_assert_ptr_eq(r, NULL);
  30137   freeO(self);
  30138   setTopSO(self, "AAd");
  30139   freeO(delim2);
  30140   setTopSO(delim2, "");
  30141   r = extractSSmallJsonO(self, "A", delim2);
  30142   ck_assert_ptr_eq(r, NULL);
  30143   // empty string
  30144   freeO(self);
  30145   setTopSO(self, "");
  30146   freeO(delim2);
  30147   setTopSO(delim2, "#");
  30148   r = extractSSmallJsonO(self, "$", delim2);
  30149   ck_assert_ptr_eq(r, NULL);
  30150   // delim1 = delim2
  30151   freeO(self);
  30152   setTopSO(self, "$qwe$");
  30153   freeO(delim2);
  30154   setTopSO(delim2, "$");
  30155   r = extractSSmallJsonO(self, "$", delim2);
  30156   ck_assert_ptr_eq(r, NULL);
  30157   // non json string
  30158   freeO(delim2);
  30159   r = extractSSmallJsonO(self, "$", delim2);
  30160   ck_assert_ptr_eq(r, NULL);
  30161   // non json object
  30162   terminateO(delim2);
  30163   delim2 = (smallJsont*) allocSmallInt(1);
  30164   r = extractSSmallJsonO(self, ";", delim2);
  30165   ck_assert_ptr_eq(r, NULL);
  30166   terminateO(delim2);
  30167   delim2 = allocSmallJson();
  30168   // NULL string
  30169   freeO(self);
  30170   freeO(delim2);
  30171   setTopSO(delim2, ",");
  30172   ck_assert_ptr_eq(extractSSmallJsonO(self, ";", delim2), NULL);
  30173   // NULL delimiter
  30174   freeO(self);
  30175   setTopSO(self, "test");
  30176   ck_assert_ptr_eq(extractSSmallJsonO(self, NULL, delim2), NULL);
  30177   ck_assert_ptr_eq(extractSSmallJsonO(self, ";", NULL), NULL);
  30178   terminateO(delim2);
  30179   terminateO(self);
  30180 
  30181 END_TEST
  30182 
  30183 
  30184 START_TEST(extractSSmallStringSmallJsonT)
  30185 
  30186   smallJsont* r;
  30187   smallJsont *self = allocSmallJson();
  30188   setTopSO(self, "");
  30189   smallStringt* delim2 = allocSmallString("|");
  30190 
  30191   // string
  30192   freeO(self);
  30193   setTopSO(self, "one/two|");
  30194   setValO(delim2, "|");
  30195   r = extractSSmallStringO(self, "/", delim2);
  30196   ck_assert_ptr_ne(r, null);
  30197   char *s = toStringO(r);
  30198   ck_assert_str_eq(s, "[\"two\"]");
  30199   free(s);
  30200   terminateO(r);
  30201   // delimiter not found
  30202   freeO(self);
  30203   setTopSO(self, "one/two");
  30204   setValO(delim2, "/");
  30205   r = extractSSmallStringO(self, "||", delim2);
  30206   ck_assert_ptr_eq(r, NULL);
  30207   // extractSSmallStringO with several delimiters after each other
  30208   freeO(self);
  30209   setTopSO(self, "one/ two  /three ");
  30210   setValO(delim2, " ");
  30211   r = extractSSmallStringO(self, "/", delim2);
  30212   ck_assert_ptr_ne(r, null);
  30213   s = toStringO(r);
  30214   ck_assert_str_eq(s, "[\"\",\"three\"]");
  30215   free(s);
  30216   terminateO(r);
  30217   // multiple character delimiter
  30218   freeO(self);
  30219   setTopSO(self, "AAe thre|e extract");
  30220   setValO(delim2, "|");
  30221   r = extractSSmallStringO(self, "e ", delim2);
  30222   ck_assert_ptr_ne(r, null);
  30223   s = toStringO(r);
  30224   ck_assert_str_eq(s, "[\"thre\"]");
  30225   free(s);
  30226   terminateO(r);
  30227   // empty delimiter
  30228   freeO(self);
  30229   setTopSO(self, "AAd");
  30230   setValO(delim2, "Ad");
  30231   r = extractSSmallStringO(self, "", delim2);
  30232   ck_assert_ptr_eq(r, NULL);
  30233   freeO(self);
  30234   setTopSO(self, "AAd");
  30235   setValO(delim2, "");
  30236   r = extractSSmallStringO(self, "A", delim2);
  30237   ck_assert_ptr_eq(r, NULL);
  30238   // empty string
  30239   freeO(self);
  30240   setTopSO(self, "");
  30241   setValO(delim2, "#");
  30242   r = extractSSmallStringO(self, "$", delim2);
  30243   ck_assert_ptr_eq(r, NULL);
  30244   // delim1 = delim2
  30245   freeO(self);
  30246   setTopSO(self, "$qwe$");
  30247   setValO(delim2, "$");
  30248   r = extractSSmallStringO(self, "$", delim2);
  30249   ck_assert_ptr_eq(r, NULL);
  30250   // non json object
  30251   terminateO(delim2);
  30252   delim2 = (smallStringt*) allocSmallInt(1);
  30253   r = extractSSmallStringO(self, ";", delim2);
  30254   ck_assert_ptr_eq(r, NULL);
  30255   terminateO(delim2);
  30256   delim2 = allocSmallString(",");
  30257   // NULL string
  30258   freeO(self);
  30259   ck_assert_ptr_eq(extractSSmallStringO(self, ";", delim2), NULL);
  30260   // NULL delimiter
  30261   freeO(self);
  30262   setTopSO(self, "test");
  30263   ck_assert_ptr_eq(extractSSmallStringO(self, NULL, delim2), NULL);
  30264   ck_assert_ptr_eq(extractSSmallStringO(self, ";", NULL), NULL);
  30265   terminateO(delim2);
  30266   terminateO(self);
  30267 
  30268 END_TEST
  30269 
  30270 
  30271 START_TEST(extractCharSmallJsonSmallJsonT)
  30272 
  30273   smallJsont* r;
  30274   smallJsont *self = allocSmallJson();
  30275   setTopSO(self, "");
  30276   smallJsont* delim2 = allocSmallJson();
  30277 
  30278   // string
  30279   freeO(self);
  30280   setTopSO(self, "one/two|");
  30281   setTopSO(delim2, "|");
  30282   r = extractCharSmallJsonO(self, '/', delim2);
  30283   ck_assert_ptr_ne(r, null);
  30284   char *s = toStringO(r);
  30285   ck_assert_str_eq(s, "[\"two\"]");
  30286   free(s);
  30287   terminateO(r);
  30288   // delimiter not found
  30289   freeO(self);
  30290   setTopSO(self, "one/two");
  30291   freeO(delim2);
  30292   setTopSO(delim2, "/");
  30293   r = extractCharSmallJsonO(self, '|', delim2);
  30294   ck_assert_ptr_eq(r, NULL);
  30295   // extractCharSmallJsonO with several delimiters after each other
  30296   freeO(self);
  30297   setTopSO(self, "one/ two  /three ");
  30298   freeO(delim2);
  30299   setTopSO(delim2, " ");
  30300   r = extractCharSmallJsonO(self, '/', delim2);
  30301   ck_assert_ptr_ne(r, null);
  30302   s = toStringO(r);
  30303   ck_assert_str_eq(s, "[\"\",\"three\"]");
  30304   free(s);
  30305   terminateO(r);
  30306   // multiple character delimiter
  30307   freeO(self);
  30308   setTopSO(self, "AAe thre|e extract");
  30309   freeO(delim2);
  30310   setTopSO(delim2, "|");
  30311   r = extractCharSmallJsonO(self, ' ', delim2);
  30312   ck_assert_ptr_ne(r, null);
  30313   s = toStringO(r);
  30314   ck_assert_str_eq(s, "[\"thre\"]");
  30315   free(s);
  30316   terminateO(r);
  30317   // empty delimiter
  30318   freeO(self);
  30319   setTopSO(self, "AAd");
  30320   freeO(delim2);
  30321   setTopSO(delim2, "");
  30322   r = extractCharSmallJsonO(self, 'A', delim2);
  30323   ck_assert_ptr_eq(r, NULL);
  30324   // empty string
  30325   freeO(self);
  30326   setTopSO(self, "");
  30327   freeO(delim2);
  30328   setTopSO(delim2, "#");
  30329   r = extractCharSmallJsonO(self, '$', delim2);
  30330   ck_assert_ptr_eq(r, NULL);
  30331   // delim1 = delim2
  30332   freeO(self);
  30333   setTopSO(self, "$qwe$");
  30334   freeO(delim2);
  30335   setTopSO(delim2, "$");
  30336   r = extractCharSmallJsonO(self, '$', delim2);
  30337   ck_assert_ptr_eq(r, NULL);
  30338   // non json string
  30339   freeO(delim2);
  30340   r = extractCharSmallJsonO(self, '$', delim2);
  30341   ck_assert_ptr_eq(r, NULL);
  30342   // non json object
  30343   terminateO(delim2);
  30344   delim2 = (smallJsont*) allocSmallInt(1);
  30345   r = extractCharSmallJsonO(self, ';', delim2);
  30346   ck_assert_ptr_eq(r, NULL);
  30347   terminateO(delim2);
  30348   delim2 = allocSmallJson();
  30349   // NULL string
  30350   freeO(self);
  30351   freeO(delim2);
  30352   setTopSO(delim2, ",");
  30353   ck_assert_ptr_eq(extractCharSmallJsonO(self, ';', delim2), NULL);
  30354   // NULL delimiter
  30355   freeO(self);
  30356   setTopSO(self, "test");
  30357   ck_assert_ptr_eq(extractCharSmallJsonO(self, ';', NULL), NULL);
  30358   terminateO(delim2);
  30359   terminateO(self);
  30360 
  30361 END_TEST
  30362 
  30363 
  30364 START_TEST(extractCharSmallStringSmallJsonT)
  30365 
  30366   smallJsont* r;
  30367   smallJsont *self = allocSmallJson();
  30368   setTopSO(self, "");
  30369   smallStringt* delim2 = allocSmallString("|");
  30370 
  30371   // string
  30372   freeO(self);
  30373   setTopSO(self, "one/two|");
  30374   setValO(delim2, "|");
  30375   r = extractCharSmallStringO(self, '/', delim2);
  30376   ck_assert_ptr_ne(r, null);
  30377   char *s = toStringO(r);
  30378   ck_assert_str_eq(s, "[\"two\"]");
  30379   free(s);
  30380   terminateO(r);
  30381   // delimiter not found
  30382   freeO(self);
  30383   setTopSO(self, "one/two");
  30384   setValO(delim2, "/");
  30385   r = extractCharSmallStringO(self, '|', delim2);
  30386   ck_assert_ptr_eq(r, NULL);
  30387   // extractCharSmallStringO with several delimiters after each other
  30388   freeO(self);
  30389   setTopSO(self, "one/ two  /three ");
  30390   setValO(delim2, " ");
  30391   r = extractCharSmallStringO(self, '/', delim2);
  30392   ck_assert_ptr_ne(r, null);
  30393   s = toStringO(r);
  30394   ck_assert_str_eq(s, "[\"\",\"three\"]");
  30395   free(s);
  30396   terminateO(r);
  30397   // multiple character delimiter
  30398   freeO(self);
  30399   setTopSO(self, "AAe thre|e extract");
  30400   setValO(delim2, "|e");
  30401   r = extractCharSmallStringO(self, ' ', delim2);
  30402   ck_assert_ptr_ne(r, null);
  30403   s = toStringO(r);
  30404   ck_assert_str_eq(s, "[\"thre\"]");
  30405   free(s);
  30406   terminateO(r);
  30407   // empty delimiter
  30408   freeO(self);
  30409   setTopSO(self, "AAd");
  30410   setValO(delim2, "");
  30411   r = extractCharSmallStringO(self, 'A', delim2);
  30412   ck_assert_ptr_eq(r, NULL);
  30413   // empty string
  30414   freeO(self);
  30415   setTopSO(self, "");
  30416   setValO(delim2, "#");
  30417   r = extractCharSmallStringO(self, '$', delim2);
  30418   ck_assert_ptr_eq(r, NULL);
  30419   // delim1 = delim2
  30420   freeO(self);
  30421   setTopSO(self, "$qwe$");
  30422   setValO(delim2, "$");
  30423   r = extractCharSmallStringO(self, '$', delim2);
  30424   ck_assert_ptr_eq(r, NULL);
  30425   // non json object
  30426   terminateO(delim2);
  30427   delim2 = (smallStringt*) allocSmallInt(1);
  30428   r = extractCharSmallStringO(self, ';', delim2);
  30429   ck_assert_ptr_eq(r, NULL);
  30430   terminateO(delim2);
  30431   delim2 = allocSmallString(",");
  30432   // NULL string
  30433   freeO(self);
  30434   ck_assert_ptr_eq(extractCharSmallStringO(self, ';', delim2), NULL);
  30435   // NULL delimiter
  30436   freeO(self);
  30437   setTopSO(self, "test");
  30438   ck_assert_ptr_eq(extractCharSmallStringO(self, ';', NULL), NULL);
  30439   terminateO(delim2);
  30440   terminateO(self);
  30441 
  30442 END_TEST
  30443 
  30444 
  30445 START_TEST(icSplitSmallJsonT)
  30446 
  30447   smallJsont* r;
  30448   smallJsont *self = allocSmallJson();
  30449   setTopSO(self, "");
  30450 
  30451   // string
  30452   freeO(self);
  30453   setTopSO(self, "one/two");
  30454   r = icSplitO(self, "/");
  30455   ck_assert_ptr_ne(r, null);
  30456   char *s = toStringO(r);
  30457   ck_assert_str_eq(s, "[\"one\",\"two\"]");
  30458   free(s);
  30459   terminateO(r);
  30460   // delimiter on the edge
  30461   freeO(self);
  30462   setTopSO(self, "/one");
  30463   r = icSplitO(self, "/");
  30464   ck_assert_ptr_ne(r, null);
  30465   s = toStringO(r);
  30466   ck_assert_str_eq(s, "[\"\",\"one\"]");
  30467   free(s);
  30468   terminateO(r);
  30469   freeO(self);
  30470   setTopSO(self, "one/");
  30471   r = icSplitO(self, "/");
  30472   ck_assert_ptr_ne(r, null);
  30473   s = toStringO(r);
  30474   ck_assert_str_eq(s, "[\"one\",\"\"]");
  30475   free(s);
  30476   terminateO(r);
  30477   // delimiter not found
  30478   freeO(self);
  30479   setTopSO(self, "one/two");
  30480   r = icSplitO(self, "||");
  30481   ck_assert_ptr_ne(r, null);
  30482   s = toStringO(r);
  30483   ck_assert_str_eq(s, "[\"one/two\"]");
  30484   free(s);
  30485   terminateO(r);
  30486   // icSplit with several delimiters after each other
  30487   freeO(self);
  30488   setTopSO(self, "one/two  three ");
  30489   r = icSplitO(self, " ");
  30490   ck_assert_ptr_ne(r, null);
  30491   s = toStringO(r);
  30492   ck_assert_str_eq(s, "[\"one/two\",\"\",\"three\",\"\"]");
  30493   free(s);
  30494   terminateO(r);
  30495   // multiple character delimiter
  30496   freeO(self);
  30497   setTopSO(self, "AAe three extract");
  30498   r = icSplitO(self, "E ");
  30499   ck_assert_ptr_ne(r, null);
  30500   s = toStringO(r);
  30501   ck_assert_str_eq(s, "[\"AA\",\"thre\",\"extract\"]");
  30502   free(s);
  30503   terminateO(r);
  30504   // empty delimiter
  30505   freeO(self);
  30506   setTopSO(self, "AAd");
  30507   r = icSplitO(self, "");
  30508   ck_assert_ptr_ne(r, null);
  30509   s = toStringO(r);
  30510   ck_assert_str_eq(s, "[\"AAd\"]");
  30511   free(s);
  30512   terminateO(r);
  30513   // empty string
  30514   emptyO(self);
  30515   r = icSplitO(self, "$");
  30516   ck_assert_ptr_ne(r, null);
  30517   s = toStringO(r);
  30518   ck_assert_str_eq(s, "[\"\"]");
  30519   free(s);
  30520   terminateO(r);
  30521   // NULL list
  30522   freeO(self);
  30523   ck_assert_ptr_eq(icSplitO(self, ";"), NULL);
  30524   // NULL delimiter
  30525   freeO(self);
  30526   setTopSO(self, "test");
  30527   ck_assert_ptr_eq(icSplitO(self, NULL), NULL);
  30528   terminateO(self);
  30529 
  30530 END_TEST
  30531 
  30532 
  30533 START_TEST(icSplitCharSmallJsonT)
  30534 
  30535   smallJsont* r;
  30536   smallJsont *self = allocSmallJson();
  30537   setTopSO(self, "");
  30538 
  30539   // string
  30540   freeO(self);
  30541   setTopSO(self, "one/two");
  30542   r = icSplitCharO(self, 'T');
  30543   ck_assert_ptr_ne(r, null);
  30544   char *s = toStringO(r);
  30545   ck_assert_str_eq(s, "[\"one/\",\"wo\"]");
  30546   free(s);
  30547   terminateO(r);
  30548   // delimiter on the edge
  30549   freeO(self);
  30550   setTopSO(self, "/one");
  30551   r = icSplitCharO(self, '/');
  30552   ck_assert_ptr_ne(r, null);
  30553   s = toStringO(r);
  30554   ck_assert_str_eq(s, "[\"\",\"one\"]");
  30555   free(s);
  30556   terminateO(r);
  30557   freeO(self);
  30558   setTopSO(self, "one/");
  30559   r = icSplitCharO(self, '/');
  30560   ck_assert_ptr_ne(r, null);
  30561   s = toStringO(r);
  30562   ck_assert_str_eq(s, "[\"one\",\"\"]");
  30563   free(s);
  30564   terminateO(r);
  30565   // delimiter not found
  30566   freeO(self);
  30567   setTopSO(self, "one/two");
  30568   r = icSplitCharO(self, '|');
  30569   ck_assert_ptr_ne(r, null);
  30570   s = toStringO(r);
  30571   ck_assert_str_eq(s, "[\"one/two\"]");
  30572   free(s);
  30573   terminateO(r);
  30574   // icSplit with several delimiters after each other
  30575   freeO(self);
  30576   setTopSO(self, "one/two  three ");
  30577   r = icSplitCharO(self, ' ');
  30578   ck_assert_ptr_ne(r, null);
  30579   s = toStringO(r);
  30580   ck_assert_str_eq(s, "[\"one/two\",\"\",\"three\",\"\"]");
  30581   free(s);
  30582   terminateO(r);
  30583   // empty string
  30584   emptyO(self);
  30585   r = icSplitCharO(self, '$');
  30586   ck_assert_ptr_ne(r, null);
  30587   s = toStringO(r);
  30588   ck_assert_str_eq(s, "[\"\"]");
  30589   free(s);
  30590   terminateO(r);
  30591   // NULL list
  30592   freeO(self);
  30593   ck_assert_ptr_eq(icSplitCharO(self, ';'), NULL);
  30594   terminateO(self);
  30595 
  30596 END_TEST
  30597 
  30598 
  30599 START_TEST(icSplitSmallJsonSmallJsonT)
  30600 
  30601   smallJsont* r;
  30602   smallJsont *self = allocSmallJson();
  30603   setTopSO(self, "");
  30604   smallJsont *delim  = allocSmallJson();
  30605 
  30606   // string
  30607   freeO(self);
  30608   setTopSO(self, "one/two");
  30609   setTopSO(delim, "/");
  30610   r = self->f->icSplitSmallJson(self, delim);
  30611   ck_assert_ptr_ne(r, null);
  30612   char *s = toStringO(r);
  30613   ck_assert_str_eq(s, "[\"one\",\"two\"]");
  30614   free(s);
  30615   terminateO(r);
  30616   // delimiter on the edge
  30617   freeO(self);
  30618   setTopSO(self, "/one");
  30619   r = self->f->icSplitSmallJson(self, delim);
  30620   ck_assert_ptr_ne(r, null);
  30621   s = toStringO(r);
  30622   ck_assert_str_eq(s, "[\"\",\"one\"]");
  30623   free(s);
  30624   terminateO(r);
  30625   freeO(self);
  30626   setTopSO(self, "one/");
  30627   r = self->f->icSplitSmallJson(self, delim);
  30628   ck_assert_ptr_ne(r, null);
  30629   s = toStringO(r);
  30630   ck_assert_str_eq(s, "[\"one\",\"\"]");
  30631   free(s);
  30632   terminateO(r);
  30633   // delimiter not found
  30634   freeO(self);
  30635   setTopSO(self, "one/two");
  30636   freeO(delim);
  30637   setTopSO(delim, "||");
  30638   r = self->f->icSplitSmallJson(self, delim);
  30639   ck_assert_ptr_ne(r, null);
  30640   s = toStringO(r);
  30641   ck_assert_str_eq(s, "[\"one/two\"]");
  30642   free(s);
  30643   terminateO(r);
  30644   // icSplit with several delimiters after each other
  30645   freeO(self);
  30646   setTopSO(self, "one/two  three ");
  30647   freeO(delim);
  30648   setTopSO(delim, " ");
  30649   r = self->f->icSplitSmallJson(self, delim);
  30650   ck_assert_ptr_ne(r, null);
  30651   s = toStringO(r);
  30652   ck_assert_str_eq(s, "[\"one/two\",\"\",\"three\",\"\"]");
  30653   free(s);
  30654   terminateO(r);
  30655   // multiple character delimiter
  30656   freeO(self);
  30657   setTopSO(self, "AAe three extract");
  30658   freeO(delim);
  30659   setTopSO(delim, "E ");
  30660   r = self->f->icSplitSmallJson(self, delim);
  30661   ck_assert_ptr_ne(r, null);
  30662   s = toStringO(r);
  30663   ck_assert_str_eq(s, "[\"AA\",\"thre\",\"extract\"]");
  30664   free(s);
  30665   terminateO(r);
  30666   // empty delimiter
  30667   freeO(self);
  30668   setTopSO(self, "AAd");
  30669   freeO(delim);
  30670   setTopSO(delim, "");
  30671   r = self->f->icSplitSmallJson(self, delim);
  30672   ck_assert_ptr_ne(r, null);
  30673   s = toStringO(r);
  30674   ck_assert_str_eq(s, "[\"AAd\"]");
  30675   free(s);
  30676   terminateO(r);
  30677   // empty string
  30678   emptyO(self);
  30679   freeO(delim);
  30680   setTopSO(delim, "$");
  30681   r = self->f->icSplitSmallJson(self, delim);
  30682   ck_assert_ptr_ne(r, null);
  30683   s = toStringO(r);
  30684   ck_assert_str_eq(s, "[\"\"]");
  30685   free(s);
  30686   terminateO(r);
  30687   // non json string delimiter
  30688   freeO(delim);
  30689   ck_assert_ptr_eq(self->f->icSplitSmallJson(self, delim), NULL);
  30690   // non json object delimiter
  30691   terminateO(delim);
  30692   delim = (smallJsont*) allocSmallInt(1);
  30693   ck_assert_ptr_eq(self->f->icSplitSmallJson(self, delim), NULL);
  30694   terminateO(delim);
  30695   delim  = allocSmallJson();
  30696   // NULL list
  30697   freeO(self);
  30698   freeO(delim);
  30699   setTopSO(delim, ";");
  30700   ck_assert_ptr_eq(self->f->icSplitSmallJson(self, delim), NULL);
  30701   // NULL delimiter
  30702   freeO(self);
  30703   setTopSO(self, "test");
  30704   ck_assert_ptr_eq(self->f->icSplitSmallJson(self, NULL), NULL);
  30705   terminateO(delim);
  30706   terminateO(self);
  30707 
  30708 END_TEST
  30709 
  30710 
  30711 START_TEST(icSplitSmallStringSmallJsonT)
  30712 
  30713   smallJsont* r;
  30714   smallJsont *self = allocSmallJson();
  30715   setTopSO(self, "");
  30716   smallStringt *delim = allocSmallString("/");
  30717 
  30718   // string
  30719   freeO(self);
  30720   setTopSO(self, "one/two");
  30721   r = self->f->icSplitSmallString(self, delim);
  30722   ck_assert_ptr_ne(r, null);
  30723   char *s = toStringO(r);
  30724   ck_assert_str_eq(s, "[\"one\",\"two\"]");
  30725   free(s);
  30726   terminateO(r);
  30727   // delimiter on the edge
  30728   freeO(self);
  30729   setTopSO(self, "/one");
  30730   r = self->f->icSplitSmallString(self, delim);
  30731   ck_assert_ptr_ne(r, null);
  30732   s = toStringO(r);
  30733   ck_assert_str_eq(s, "[\"\",\"one\"]");
  30734   free(s);
  30735   terminateO(r);
  30736   freeO(self);
  30737   setTopSO(self, "one/");
  30738   r = self->f->icSplitSmallString(self, delim);
  30739   ck_assert_ptr_ne(r, null);
  30740   s = toStringO(r);
  30741   ck_assert_str_eq(s, "[\"one\",\"\"]");
  30742   free(s);
  30743   terminateO(r);
  30744   // delimiter not found
  30745   freeO(self);
  30746   setTopSO(self, "one/two");
  30747   setValO(delim, "||");
  30748   r = self->f->icSplitSmallString(self, delim);
  30749   ck_assert_ptr_ne(r, null);
  30750   s = toStringO(r);
  30751   ck_assert_str_eq(s, "[\"one/two\"]");
  30752   free(s);
  30753   terminateO(r);
  30754   // icSplit with several delimiters after each other
  30755   freeO(self);
  30756   setTopSO(self, "one/two  three ");
  30757   setValO(delim, " ");
  30758   r = self->f->icSplitSmallString(self, delim);
  30759   ck_assert_ptr_ne(r, null);
  30760   s = toStringO(r);
  30761   ck_assert_str_eq(s, "[\"one/two\",\"\",\"three\",\"\"]");
  30762   free(s);
  30763   terminateO(r);
  30764   // multiple character delimiter
  30765   freeO(self);
  30766   setTopSO(self, "AAe three extract");
  30767   setValO(delim, "E ");
  30768   r = self->f->icSplitSmallString(self, delim);
  30769   ck_assert_ptr_ne(r, null);
  30770   s = toStringO(r);
  30771   ck_assert_str_eq(s, "[\"AA\",\"thre\",\"extract\"]");
  30772   free(s);
  30773   terminateO(r);
  30774   // empty delimiter
  30775   freeO(self);
  30776   setTopSO(self, "AAd");
  30777   setValO(delim, "");
  30778   r = self->f->icSplitSmallString(self, delim);
  30779   ck_assert_ptr_ne(r, null);
  30780   s = toStringO(r);
  30781   ck_assert_str_eq(s, "[\"AAd\"]");
  30782   free(s);
  30783   terminateO(r);
  30784   // empty string
  30785   emptyO(self);
  30786   setValO(delim, "$");
  30787   r = self->f->icSplitSmallString(self, delim);
  30788   ck_assert_ptr_ne(r, null);
  30789   s = toStringO(r);
  30790   ck_assert_str_eq(s, "[\"\"]");
  30791   free(s);
  30792   terminateO(r);
  30793   // null string delimiter
  30794   freeO(delim);
  30795   ck_assert_ptr_eq(self->f->icSplitSmallString(self, delim), NULL);
  30796   // non json object delimiter
  30797   terminateO(delim);
  30798   delim = (smallStringt*) allocSmallInt(1);
  30799   ck_assert_ptr_eq(self->f->icSplitSmallString(self, delim), NULL);
  30800   terminateO(delim);
  30801   // NULL list
  30802   freeO(self);
  30803   delim  = allocSmallString(";");
  30804   ck_assert_ptr_eq(self->f->icSplitSmallString(self, delim), NULL);
  30805   // NULL delimiter
  30806   freeO(self);
  30807   setTopSO(self, "test");
  30808   ck_assert_ptr_eq(self->f->icSplitSmallString(self, NULL), NULL);
  30809   terminateO(delim);
  30810   terminateO(self);
  30811 
  30812 END_TEST
  30813 
  30814 
  30815 START_TEST(icSplitSSmallJsonT)
  30816 
  30817   char** r;
  30818   smallJsont *self = allocSmallJson();
  30819   setTopSO(self, "");
  30820 
  30821   // string
  30822   freeO(self);
  30823   setTopSO(self, "one/two");
  30824   r = icSplitSO(self, "/");
  30825   ck_assert_uint_eq(listLengthS(r),2);
  30826   ck_assert_str_eq(r[0], "one");
  30827   ck_assert_str_eq(r[1], "two");
  30828   listFreeS(r);
  30829   // delimiter on the edge
  30830   freeO(self);
  30831   setTopSO(self, "/one");
  30832   r = icSplitSO(self, "/");
  30833   ck_assert_uint_eq(listLengthS(r),2);
  30834   ck_assert_str_eq(r[0], "");
  30835   ck_assert_str_eq(r[1], "one");
  30836   listFreeS(r);
  30837   freeO(self);
  30838   setTopSO(self, "one/");
  30839   r = icSplitSO(self, "/");
  30840   ck_assert_uint_eq(listLengthS(r),2);
  30841   ck_assert_str_eq(r[0], "one");
  30842   ck_assert_str_eq(r[1], "");
  30843   listFreeS(r);
  30844   // delimiter not found
  30845   freeO(self);
  30846   setTopSO(self, "one/two");
  30847   r = icSplitSO(self, "||");
  30848   ck_assert_uint_eq(listLengthS(r),1);
  30849   ck_assert_str_eq(r[0], "one/two");
  30850   listFreeS(r);
  30851   // icSplit with several delimiters after each other
  30852   freeO(self);
  30853   setTopSO(self, "one/two  three ");
  30854   r = icSplitSO(self, " ");
  30855   ck_assert_uint_eq(listLengthS(r),4);
  30856   ck_assert_str_eq(r[0], "one/two");
  30857   ck_assert_str_eq(r[1], "");
  30858   ck_assert_str_eq(r[2], "three");
  30859   ck_assert_str_eq(r[3], "");
  30860   listFreeS(r);
  30861   // multiple character delimiter
  30862   freeO(self);
  30863   setTopSO(self, "AAe three extract");
  30864   r = icSplitSO(self, "E ");
  30865   ck_assert_uint_eq(listLengthS(r),3);
  30866   ck_assert_str_eq(r[0], "AA");
  30867   ck_assert_str_eq(r[1], "thre");
  30868   ck_assert_str_eq(r[2], "extract");
  30869   listFreeS(r);
  30870   // empty delimiter
  30871   freeO(self);
  30872   setTopSO(self, "AAd");
  30873   r = icSplitSO(self, "");
  30874   ck_assert_uint_eq(listLengthS(r),1);
  30875   ck_assert_str_eq(r[0], "AAd");
  30876   listFreeS(r);
  30877   // empty string
  30878   emptyO(self);
  30879   r = icSplitSO(self, "$");
  30880   ck_assert_uint_eq(listLengthS(r),1);
  30881   ck_assert_str_eq(r[0], "");
  30882   listFreeS(r);
  30883   // NULL list
  30884   freeO(self);
  30885   ck_assert_ptr_eq(icSplitSO(self, ";"), NULL);
  30886   // NULL delimiter
  30887   freeO(self);
  30888   setTopSO(self, "test");
  30889   ck_assert_ptr_eq(icSplitSO(self, NULL), NULL);
  30890   terminateO(self);
  30891 
  30892 END_TEST
  30893 
  30894 
  30895 START_TEST(icSplitCharSSmallJsonT)
  30896 
  30897   char** r;
  30898   smallJsont *self = allocSmallJson();
  30899   setTopSO(self, "");
  30900 
  30901   // string
  30902   freeO(self);
  30903   setTopSO(self, "one/two");
  30904   r = icSplitCharSO(self, 'T');
  30905   ck_assert_uint_eq(listLengthS(r),2);
  30906   ck_assert_str_eq(r[0], "one/");
  30907   ck_assert_str_eq(r[1], "wo");
  30908   listFreeS(r);
  30909   // delimiter on the edge
  30910   freeO(self);
  30911   setTopSO(self, "/one");
  30912   r = icSplitCharSO(self, '/');
  30913   ck_assert_uint_eq(listLengthS(r),2);
  30914   ck_assert_str_eq(r[0], "");
  30915   ck_assert_str_eq(r[1], "one");
  30916   listFreeS(r);
  30917   freeO(self);
  30918   setTopSO(self, "one/");
  30919   r = icSplitCharSO(self, '/');
  30920   ck_assert_uint_eq(listLengthS(r),2);
  30921   ck_assert_str_eq(r[0], "one");
  30922   ck_assert_str_eq(r[1], "");
  30923   listFreeS(r);
  30924   // delimiter not found
  30925   freeO(self);
  30926   setTopSO(self, "one/two");
  30927   r = icSplitCharSO(self, '|');
  30928   ck_assert_uint_eq(listLengthS(r),1);
  30929   ck_assert_str_eq(r[0], "one/two");
  30930   listFreeS(r);
  30931   // icSplit with several delimiters after each other
  30932   freeO(self);
  30933   setTopSO(self, "one/two  three ");
  30934   r = icSplitCharSO(self, ' ');
  30935   ck_assert_uint_eq(listLengthS(r),4);
  30936   ck_assert_str_eq(r[0], "one/two");
  30937   ck_assert_str_eq(r[1], "");
  30938   ck_assert_str_eq(r[2], "three");
  30939   ck_assert_str_eq(r[3], "");
  30940   listFreeS(r);
  30941   // empty string
  30942   emptyO(self);
  30943   r = icSplitCharSO(self, '$');
  30944   ck_assert_uint_eq(listLengthS(r),1);
  30945   ck_assert_str_eq(r[0], "");
  30946   listFreeS(r);
  30947   // NULL list
  30948   freeO(self);
  30949   ck_assert_ptr_eq(icSplitCharSO(self, ';'), NULL);
  30950   terminateO(self);
  30951 
  30952 END_TEST
  30953 
  30954 
  30955 START_TEST(icSplitSmallJsonSSmallJsonT)
  30956 
  30957   char** r;
  30958   smallJsont *self = allocSmallJson();
  30959   setTopSO(self, "");
  30960   smallJsont *delim  = allocSmallJson();
  30961 
  30962   // string
  30963   freeO(self);
  30964   setTopSO(self, "one/two");
  30965   setTopSO(delim, "/");
  30966   r = icSplitSmallJsonSO(self, delim);
  30967   ck_assert_uint_eq(listLengthS(r),2);
  30968   ck_assert_str_eq(r[0], "one");
  30969   ck_assert_str_eq(r[1], "two");
  30970   listFreeS(r);
  30971   // delimiter on the edge
  30972   freeO(self);
  30973   setTopSO(self, "/one");
  30974   r = icSplitSmallJsonSO(self, delim);
  30975   ck_assert_uint_eq(listLengthS(r),2);
  30976   ck_assert_str_eq(r[0], "");
  30977   ck_assert_str_eq(r[1], "one");
  30978   listFreeS(r);
  30979   freeO(self);
  30980   setTopSO(self, "one/");
  30981   r = icSplitSmallJsonSO(self, delim);
  30982   ck_assert_uint_eq(listLengthS(r),2);
  30983   ck_assert_str_eq(r[0], "one");
  30984   ck_assert_str_eq(r[1], "");
  30985   listFreeS(r);
  30986   // delimiter not found
  30987   freeO(self);
  30988   setTopSO(self, "one/two");
  30989   freeO(delim);
  30990   setTopSO(delim, "||");
  30991   r = icSplitSmallJsonSO(self, delim);
  30992   ck_assert_uint_eq(listLengthS(r),1);
  30993   ck_assert_str_eq(r[0], "one/two");
  30994   listFreeS(r);
  30995   // icSplit with several delimiters after each other
  30996   freeO(self);
  30997   setTopSO(self, "one/two  three ");
  30998   freeO(delim);
  30999   setTopSO(delim, " ");
  31000   r = icSplitSmallJsonSO(self, delim);
  31001   ck_assert_uint_eq(listLengthS(r),4);
  31002   ck_assert_str_eq(r[0], "one/two");
  31003   ck_assert_str_eq(r[1], "");
  31004   ck_assert_str_eq(r[2], "three");
  31005   ck_assert_str_eq(r[3], "");
  31006   listFreeS(r);
  31007   // multiple character delimiter
  31008   freeO(self);
  31009   setTopSO(self, "AAe three extract");
  31010   freeO(delim);
  31011   setTopSO(delim, "E ");
  31012   r = icSplitSmallJsonSO(self, delim);
  31013   ck_assert_uint_eq(listLengthS(r),3);
  31014   ck_assert_str_eq(r[0], "AA");
  31015   ck_assert_str_eq(r[1], "thre");
  31016   ck_assert_str_eq(r[2], "extract");
  31017   listFreeS(r);
  31018   // empty delimiter
  31019   freeO(self);
  31020   setTopSO(self, "AAd");
  31021   freeO(delim);
  31022   setTopSO(delim, "");
  31023   r = icSplitSmallJsonSO(self, delim);
  31024   ck_assert_uint_eq(listLengthS(r),1);
  31025   ck_assert_str_eq(r[0], "AAd");
  31026   listFreeS(r);
  31027   // empty string
  31028   emptyO(self);
  31029   freeO(delim);
  31030   setTopSO(delim, "$");
  31031   r = icSplitSmallJsonSO(self, delim);
  31032   ck_assert_uint_eq(listLengthS(r),1);
  31033   ck_assert_str_eq(r[0], "");
  31034   listFreeS(r);
  31035   // non json string delimiter
  31036   freeO(delim);
  31037   ck_assert_ptr_eq(icSplitSmallJsonSO(self, delim), NULL);
  31038   // non json object delimiter
  31039   terminateO(delim);
  31040   delim = (smallJsont*) allocSmallInt(1);
  31041   ck_assert_ptr_eq(icSplitSmallJsonSO(self, delim), NULL);
  31042   terminateO(delim);
  31043   delim  = allocSmallJson();
  31044   // NULL list
  31045   freeO(self);
  31046   freeO(delim);
  31047   setTopSO(delim, ";");
  31048   ck_assert_ptr_eq(icSplitSmallJsonSO(self, delim), NULL);
  31049   // NULL delimiter
  31050   freeO(self);
  31051   setTopSO(self, "test");
  31052   ck_assert_ptr_eq(icSplitSmallJsonSO(self, NULL), NULL);
  31053   terminateO(delim);
  31054   terminateO(self);
  31055 
  31056 END_TEST
  31057 
  31058 
  31059 START_TEST(icSplitSmallStringSSmallJsonT)
  31060 
  31061   char** r;
  31062   smallJsont *self = allocSmallJson();
  31063   setTopSO(self, "");
  31064   smallStringt *delim = allocSmallString("/");
  31065 
  31066   // string
  31067   freeO(self);
  31068   setTopSO(self, "one/two");
  31069   r = icSplitSmallStringSO(self, delim);
  31070   ck_assert_uint_eq(listLengthS(r),2);
  31071   ck_assert_str_eq(r[0], "one");
  31072   ck_assert_str_eq(r[1], "two");
  31073   listFreeS(r);
  31074   // delimiter on the edge
  31075   freeO(self);
  31076   setTopSO(self, "/one");
  31077   r = icSplitSmallStringSO(self, delim);
  31078   ck_assert_uint_eq(listLengthS(r),2);
  31079   ck_assert_str_eq(r[0], "");
  31080   ck_assert_str_eq(r[1], "one");
  31081   listFreeS(r);
  31082   freeO(self);
  31083   setTopSO(self, "one/");
  31084   r = icSplitSmallStringSO(self, delim);
  31085   ck_assert_uint_eq(listLengthS(r),2);
  31086   ck_assert_str_eq(r[0], "one");
  31087   ck_assert_str_eq(r[1], "");
  31088   listFreeS(r);
  31089   // delimiter not found
  31090   freeO(self);
  31091   setTopSO(self, "one/two");
  31092   setValO(delim, "||");
  31093   r = icSplitSmallStringSO(self, delim);
  31094   ck_assert_uint_eq(listLengthS(r),1);
  31095   ck_assert_str_eq(r[0], "one/two");
  31096   listFreeS(r);
  31097   // icSplit with several delimiters after each other
  31098   freeO(self);
  31099   setTopSO(self, "one/two  three ");
  31100   setValO(delim, " ");
  31101   r = icSplitSmallStringSO(self, delim);
  31102   ck_assert_uint_eq(listLengthS(r),4);
  31103   ck_assert_str_eq(r[0], "one/two");
  31104   ck_assert_str_eq(r[1], "");
  31105   ck_assert_str_eq(r[2], "three");
  31106   ck_assert_str_eq(r[3], "");
  31107   listFreeS(r);
  31108   // multiple character delimiter
  31109   freeO(self);
  31110   setTopSO(self, "AAe three extract");
  31111   setValO(delim, "E ");
  31112   r = icSplitSmallStringSO(self, delim);
  31113   ck_assert_uint_eq(listLengthS(r),3);
  31114   ck_assert_str_eq(r[0], "AA");
  31115   ck_assert_str_eq(r[1], "thre");
  31116   ck_assert_str_eq(r[2], "extract");
  31117   listFreeS(r);
  31118   // empty delimiter
  31119   freeO(self);
  31120   setTopSO(self, "AAd");
  31121   setValO(delim, "");
  31122   r = icSplitSmallStringSO(self, delim);
  31123   ck_assert_uint_eq(listLengthS(r),1);
  31124   ck_assert_str_eq(r[0], "AAd");
  31125   listFreeS(r);
  31126   // empty string
  31127   emptyO(self);
  31128   setValO(delim, "$");
  31129   r = icSplitSmallStringSO(self, delim);
  31130   ck_assert_uint_eq(listLengthS(r),1);
  31131   ck_assert_str_eq(r[0], "");
  31132   listFreeS(r);
  31133   // non smallString object delimiter
  31134   terminateO(delim);
  31135   delim = (smallStringt*) allocSmallInt(1);
  31136   ck_assert_ptr_eq(icSplitSmallStringSO(self, delim), NULL);
  31137   terminateO(delim);
  31138   // NULL list
  31139   freeO(self);
  31140   delim  = allocSmallString(";");
  31141   ck_assert_ptr_eq(icSplitSmallStringSO(self, delim), NULL);
  31142   // NULL delimiter
  31143   freeO(self);
  31144   setTopSO(self, "test");
  31145   ck_assert_ptr_eq(icSplitSmallStringSO(self, NULL), NULL);
  31146   terminateO(delim);
  31147   terminateO(self);
  31148 
  31149 END_TEST
  31150 
  31151 
  31152 START_TEST(icExtractSmallJsonT)
  31153 
  31154   smallJsont* r;
  31155   smallJsont *self = allocSmallJson();
  31156   setTopSO(self, "");
  31157 
  31158   // string
  31159   freeO(self);
  31160   setTopSO(self, "one/twos");
  31161   r = icExtractO(self, "E", "S");
  31162   ck_assert_ptr_ne(r, null);
  31163   char *s = toStringO(r);
  31164   ck_assert_str_eq(s, "[\"/two\"]");
  31165   free(s);
  31166   terminateO(r);
  31167   // delimiter not found
  31168   freeO(self);
  31169   setTopSO(self, "one/two");
  31170   r = icExtractO(self, "||", "/");
  31171   ck_assert_ptr_eq(r, NULL);
  31172   // icExtractO with several delimiters after each other
  31173   freeO(self);
  31174   setTopSO(self, "one/ two  /three ");
  31175   r = icExtractO(self, "/", " ");
  31176   ck_assert_ptr_ne(r, null);
  31177   s = toStringO(r);
  31178   ck_assert_str_eq(s, "[\"\",\"three\"]");
  31179   free(s);
  31180   terminateO(r);
  31181   // multiple character delimiter
  31182   freeO(self);
  31183   setTopSO(self, "AAe thre|e icExtract");
  31184   r = icExtractO(self, "e ", "|");
  31185   ck_assert_ptr_ne(r, null);
  31186   s = toStringO(r);
  31187   ck_assert_str_eq(s, "[\"thre\"]");
  31188   free(s);
  31189   terminateO(r);
  31190   // empty delimiter
  31191   freeO(self);
  31192   setTopSO(self, "AAd");
  31193   r = icExtractO(self, "", "Ad");
  31194   ck_assert_ptr_eq(r, NULL);
  31195   freeO(self);
  31196   setTopSO(self, "AAd");
  31197   r = icExtractO(self, "A", "");
  31198   ck_assert_ptr_eq(r, NULL);
  31199   // empty string
  31200   freeO(self);
  31201   setTopSO(self, "");
  31202   r = icExtractO(self, "$", "#");
  31203   ck_assert_ptr_eq(r, NULL);
  31204   // delim1 = delim2
  31205   freeO(self);
  31206   setTopSO(self, "");
  31207   r = icExtractO(self, "$", "$");
  31208   ck_assert_ptr_eq(r, NULL);
  31209   // NULL string
  31210   freeO(self);
  31211   ck_assert_ptr_eq(icExtractO(self, ";", ","), NULL);
  31212   // NULL delimiter
  31213   freeO(self);
  31214   setTopSO(self, "test");
  31215   ck_assert_ptr_eq(icExtractO(self, NULL, ","), NULL);
  31216   ck_assert_ptr_eq(icExtractO(self, ",", NULL), NULL);
  31217   terminateO(self);
  31218 
  31219 END_TEST
  31220 
  31221 
  31222 START_TEST(icExtractCharSSmallJsonT)
  31223 
  31224   smallJsont* r;
  31225   smallJsont *self = allocSmallJson();
  31226   setTopSO(self, "");
  31227 
  31228   // string
  31229   freeO(self);
  31230   setTopSO(self, "one/twos");
  31231   r = icExtractCharSO(self, 'E', "S");
  31232   ck_assert_ptr_ne(r, null);
  31233   char *s = toStringO(r);
  31234   ck_assert_str_eq(s, "[\"/two\"]");
  31235   free(s);
  31236   terminateO(r);
  31237   // delimiter not found
  31238   freeO(self);
  31239   setTopSO(self, "one/two");
  31240   r = icExtractCharSO(self, '|', "/");
  31241   ck_assert_ptr_eq(r, NULL);
  31242   // icExtractCharSO with several delimiters after each other
  31243   freeO(self);
  31244   setTopSO(self, "one/ two  /three ");
  31245   r = icExtractCharSO(self, '/', " ");
  31246   ck_assert_ptr_ne(r, null);
  31247   s = toStringO(r);
  31248   ck_assert_str_eq(s, "[\"\",\"three\"]");
  31249   free(s);
  31250   terminateO(r);
  31251   // multiple character delimiter
  31252   freeO(self);
  31253   setTopSO(self, "AAe thre|e icExtract");
  31254   r = icExtractCharSO(self, ' ', "|e");
  31255   ck_assert_ptr_ne(r, null);
  31256   s = toStringO(r);
  31257   ck_assert_str_eq(s, "[\"thre\"]");
  31258   free(s);
  31259   terminateO(r);
  31260   // empty delimiter
  31261   freeO(self);
  31262   setTopSO(self, "AAd");
  31263   r = icExtractCharSO(self, 'A', "");
  31264   ck_assert_ptr_eq(r, NULL);
  31265   // empty string
  31266   freeO(self);
  31267   setTopSO(self, "");
  31268   r = icExtractCharSO(self, '$', "#");
  31269   ck_assert_ptr_eq(r, NULL);
  31270   // delim1 = delim2
  31271   freeO(self);
  31272   setTopSO(self, "");
  31273   r = icExtractCharSO(self, '$', "$");
  31274   ck_assert_ptr_eq(r, NULL);
  31275   // NULL string
  31276   freeO(self);
  31277   ck_assert_ptr_eq(icExtractCharSO(self, ';', ","), NULL);
  31278   // NULL delimiter
  31279   freeO(self);
  31280   setTopSO(self, "test");
  31281   ck_assert_ptr_eq(icExtractCharSO(self, ',', NULL), NULL);
  31282   terminateO(self);
  31283 
  31284 END_TEST
  31285 
  31286 
  31287 START_TEST(icExtractSCharSmallJsonT)
  31288 
  31289   smallJsont* r;
  31290   smallJsont *self = allocSmallJson();
  31291   setTopSO(self, "");
  31292 
  31293   // string
  31294   freeO(self);
  31295   setTopSO(self, "one/twos");
  31296   r = icExtractSCharO(self, "E", 'S');
  31297   ck_assert_ptr_ne(r, null);
  31298   char *s = toStringO(r);
  31299   ck_assert_str_eq(s, "[\"/two\"]");
  31300   free(s);
  31301   terminateO(r);
  31302   // delimiter not found
  31303   freeO(self);
  31304   setTopSO(self, "one/two");
  31305   r = icExtractSCharO(self, "||", '/');
  31306   ck_assert_ptr_eq(r, NULL);
  31307   // icExtractSCharO with several delimiters after each other
  31308   freeO(self);
  31309   setTopSO(self, "one/ two  /three ");
  31310   r = icExtractSCharO(self, "/", ' ');
  31311   ck_assert_ptr_ne(r, null);
  31312   s = toStringO(r);
  31313   ck_assert_str_eq(s, "[\"\",\"three\"]");
  31314   free(s);
  31315   terminateO(r);
  31316   // multiple character delimiter
  31317   freeO(self);
  31318   setTopSO(self, "AAe thre|e icExtract");
  31319   r = icExtractSCharO(self, "e ", '|');
  31320   ck_assert_ptr_ne(r, null);
  31321   s = toStringO(r);
  31322   ck_assert_str_eq(s, "[\"thre\"]");
  31323   free(s);
  31324   terminateO(r);
  31325   // empty delimiter
  31326   freeO(self);
  31327   setTopSO(self, "AAd");
  31328   r = icExtractSCharO(self, "", 'A');
  31329   ck_assert_ptr_eq(r, NULL);
  31330   // empty string
  31331   freeO(self);
  31332   setTopSO(self, "");
  31333   r = icExtractSCharO(self, "$", '#');
  31334   ck_assert_ptr_eq(r, NULL);
  31335   // delim1 = delim2
  31336   freeO(self);
  31337   setTopSO(self, "");
  31338   r = icExtractSCharO(self, "$", '$');
  31339   ck_assert_ptr_eq(r, NULL);
  31340   // NULL string
  31341   freeO(self);
  31342   ck_assert_ptr_eq(icExtractSCharO(self, ";", ','), NULL);
  31343   // NULL delimiter
  31344   freeO(self);
  31345   setTopSO(self, "test");
  31346   ck_assert_ptr_eq(icExtractSCharO(self, NULL, ','), NULL);
  31347   terminateO(self);
  31348 
  31349 END_TEST
  31350 
  31351 
  31352 START_TEST(icExtractCharCharSmallJsonT)
  31353 
  31354   smallJsont* r;
  31355   smallJsont *self = allocSmallJson();
  31356   setTopSO(self, "");
  31357 
  31358   // string
  31359   freeO(self);
  31360   setTopSO(self, "one/twos");
  31361   r = icExtractCharCharO(self, 'E', 'S');
  31362   ck_assert_ptr_ne(r, null);
  31363   char *s = toStringO(r);
  31364   ck_assert_str_eq(s, "[\"/two\"]");
  31365   free(s);
  31366   terminateO(r);
  31367   // delimiter not found
  31368   freeO(self);
  31369   setTopSO(self, "one/two");
  31370   r = icExtractCharCharO(self, '|', '/');
  31371   ck_assert_ptr_eq(r, NULL);
  31372   // icExtractCharCharO with several delimiters after each other
  31373   freeO(self);
  31374   setTopSO(self, "one/ two  /three ");
  31375   r = icExtractCharCharO(self, '/', ' ');
  31376   ck_assert_ptr_ne(r, null);
  31377   s = toStringO(r);
  31378   ck_assert_str_eq(s, "[\"\",\"three\"]");
  31379   free(s);
  31380   terminateO(r);
  31381   // multiple character delimiter
  31382   freeO(self);
  31383   setTopSO(self, "AAe thre|e icExtract");
  31384   r = icExtractCharCharO(self, ' ', '|');
  31385   ck_assert_ptr_ne(r, null);
  31386   s = toStringO(r);
  31387   ck_assert_str_eq(s, "[\"thre\"]");
  31388   free(s);
  31389   terminateO(r);
  31390   // empty string
  31391   freeO(self);
  31392   setTopSO(self, "");
  31393   r = icExtractCharCharO(self, '$', '#');
  31394   ck_assert_ptr_eq(r, NULL);
  31395   // delim1 = delim2
  31396   freeO(self);
  31397   setTopSO(self, "");
  31398   r = icExtractCharCharO(self, '$', '$');
  31399   ck_assert_ptr_eq(r, NULL);
  31400   // NULL string
  31401   freeO(self);
  31402   ck_assert_ptr_eq(icExtractCharCharO(self, ';', ','), NULL);
  31403   terminateO(self);
  31404 
  31405 END_TEST
  31406 
  31407 
  31408 START_TEST(icExtractSmallJsonSmallJsonSmallJsonT)
  31409 
  31410   smallJsont* r;
  31411   smallJsont *self = allocSmallJson();
  31412   setTopSO(self, "");
  31413   smallJsont* delim1 = allocSmallJson();
  31414   smallJsont* delim2 = allocSmallJson();
  31415 
  31416   // string
  31417   freeO(self);
  31418   setTopSO(self, "one/twos");
  31419   setTopSO(delim1, "E");
  31420   setTopSO(delim2, "S");
  31421   r = icExtractSmallJsonSmallJsonO(self, delim1, delim2);
  31422   ck_assert_ptr_ne(r, null);
  31423   char *s = toStringO(r);
  31424   ck_assert_str_eq(s, "[\"/two\"]");
  31425   free(s);
  31426   terminateO(r);
  31427   // delimiter not found
  31428   freeO(self);
  31429   setTopSO(self, "one/two");
  31430   freeO(delim1);
  31431   freeO(delim2);
  31432   setTopSO(delim1, "||");
  31433   setTopSO(delim2, "/");
  31434   r = icExtractSmallJsonSmallJsonO(self, delim1, delim2);
  31435   ck_assert_ptr_eq(r, NULL);
  31436   // icExtractSmallJsonSmallJsonO with several delimiters after each other
  31437   freeO(self);
  31438   setTopSO(self, "one/ two  /three ");
  31439   freeO(delim1);
  31440   freeO(delim2);
  31441   setTopSO(delim1, "/");
  31442   setTopSO(delim2, " ");
  31443   r = icExtractSmallJsonSmallJsonO(self, delim1, delim2);
  31444   ck_assert_ptr_ne(r, null);
  31445   s = toStringO(r);
  31446   ck_assert_str_eq(s, "[\"\",\"three\"]");
  31447   free(s);
  31448   terminateO(r);
  31449   // multiple character delimiter
  31450   freeO(self);
  31451   setTopSO(self, "AAe thre|e icExtract");
  31452   freeO(delim1);
  31453   freeO(delim2);
  31454   setTopSO(delim1, "e ");
  31455   setTopSO(delim2, "|");
  31456   r = icExtractSmallJsonSmallJsonO(self, delim1, delim2);
  31457   ck_assert_ptr_ne(r, null);
  31458   s = toStringO(r);
  31459   ck_assert_str_eq(s, "[\"thre\"]");
  31460   free(s);
  31461   terminateO(r);
  31462   // empty delimiter
  31463   freeO(self);
  31464   setTopSO(self, "AAd");
  31465   freeO(delim1);
  31466   freeO(delim2);
  31467   setTopSO(delim1, "");
  31468   setTopSO(delim2, "Ad");
  31469   r = icExtractSmallJsonSmallJsonO(self, delim1, delim2);
  31470   ck_assert_ptr_eq(r, NULL);
  31471   freeO(self);
  31472   setTopSO(self, "AAd");
  31473   freeO(delim1);
  31474   freeO(delim2);
  31475   setTopSO(delim1, "A");
  31476   setTopSO(delim2, "");
  31477   r = icExtractSmallJsonSmallJsonO(self, delim1, delim2);
  31478   ck_assert_ptr_eq(r, NULL);
  31479   // empty string
  31480   freeO(self);
  31481   setTopSO(self, "");
  31482   freeO(delim1);
  31483   freeO(delim2);
  31484   setTopSO(delim1, "$");
  31485   setTopSO(delim2, "#");
  31486   r = icExtractSmallJsonSmallJsonO(self, delim1, delim2);
  31487   ck_assert_ptr_eq(r, NULL);
  31488   // delim1 = delim2
  31489   freeO(self);
  31490   setTopSO(self, "$qwe$");
  31491   freeO(delim1);
  31492   freeO(delim2);
  31493   setTopSO(delim1, "$");
  31494   setTopSO(delim2, "$");
  31495   r = icExtractSmallJsonSmallJsonO(self, delim1, delim2);
  31496   ck_assert_ptr_eq(r, NULL);
  31497   // non json string
  31498   freeO(delim1);
  31499   r = icExtractSmallJsonSmallJsonO(self, delim1, delim2);
  31500   ck_assert_ptr_eq(r, NULL);
  31501   setTopSO(delim1, "$");
  31502   freeO(delim2);
  31503   r = icExtractSmallJsonSmallJsonO(self, delim1, delim2);
  31504   ck_assert_ptr_eq(r, NULL);
  31505   // non json object
  31506   terminateO(delim1);
  31507   delim1 = (smallJsont*) allocSmallInt(1);
  31508   setTopSO(delim2, "$");
  31509   r = icExtractSmallJsonSmallJsonO(self, delim1, delim2);
  31510   ck_assert_ptr_eq(r, NULL);
  31511   terminateO(delim1);
  31512   delim1 = allocSmallJson();
  31513   setTopSO(delim1, ";");
  31514   terminateO(delim2);
  31515   delim2 = (smallJsont*) allocSmallInt(1);
  31516   r = icExtractSmallJsonSmallJsonO(self, delim1, delim2);
  31517   ck_assert_ptr_eq(r, NULL);
  31518   terminateO(delim2);
  31519   delim2 = allocSmallJson();
  31520   // NULL string
  31521   freeO(self);
  31522   freeO(delim1);
  31523   freeO(delim2);
  31524   setTopSO(delim1, ";");
  31525   setTopSO(delim2, ",");
  31526   ck_assert_ptr_eq(icExtractSmallJsonSmallJsonO(self, delim1, delim2), NULL);
  31527   // NULL delimiter
  31528   freeO(self);
  31529   setTopSO(self, "test");
  31530   ck_assert_ptr_eq(icExtractSmallJsonSmallJsonO(self, NULL, delim2), NULL);
  31531   ck_assert_ptr_eq(icExtractSmallJsonSmallJsonO(self, delim1, NULL), NULL);
  31532   terminateO(delim1);
  31533   terminateO(delim2);
  31534   terminateO(self);
  31535 
  31536 END_TEST
  31537 
  31538 
  31539 START_TEST(icExtractSmallJsonSmallStringSmallJsonT)
  31540 
  31541   smallJsont* r;
  31542   smallJsont *self = allocSmallJson();
  31543   setTopSO(self, "");
  31544   smallJsont* delim1   = allocSmallJson();
  31545   smallStringt* delim2 = allocSmallString("S");
  31546 
  31547   // string
  31548   freeO(self);
  31549   setTopSO(self, "one/twos");
  31550   setTopSO(delim1, "E");
  31551   r = icExtractSmallJsonSmallStringO(self, delim1, delim2);
  31552   ck_assert_ptr_ne(r, null);
  31553   char *s = toStringO(r);
  31554   ck_assert_str_eq(s, "[\"/two\"]");
  31555   free(s);
  31556   terminateO(r);
  31557   // delimiter not found
  31558   freeO(self);
  31559   setTopSO(self, "one/two");
  31560   freeO(delim1);
  31561   setTopSO(delim1, "||");
  31562   setValO(delim2, "/");
  31563   r = icExtractSmallJsonSmallStringO(self, delim1, delim2);
  31564   ck_assert_ptr_eq(r, NULL);
  31565   // icExtractSmallJsonSmallStringO with several delimiters after each other
  31566   freeO(self);
  31567   setTopSO(self, "one/ two  /three ");
  31568   freeO(delim1);
  31569   setTopSO(delim1, "/");
  31570   setValO(delim2, " ");
  31571   r = icExtractSmallJsonSmallStringO(self, delim1, delim2);
  31572   ck_assert_ptr_ne(r, null);
  31573   s = toStringO(r);
  31574   ck_assert_str_eq(s, "[\"\",\"three\"]");
  31575   free(s);
  31576   terminateO(r);
  31577   // multiple character delimiter
  31578   freeO(self);
  31579   setTopSO(self, "AAe thre|e icExtract");
  31580   freeO(delim1);
  31581   setTopSO(delim1, "e ");
  31582   setValO(delim2, "|");
  31583   r = icExtractSmallJsonSmallStringO(self, delim1, delim2);
  31584   ck_assert_ptr_ne(r, null);
  31585   s = toStringO(r);
  31586   ck_assert_str_eq(s, "[\"thre\"]");
  31587   free(s);
  31588   terminateO(r);
  31589   // empty delimiter
  31590   freeO(self);
  31591   setTopSO(self, "AAd");
  31592   freeO(delim1);
  31593   setTopSO(delim1, "");
  31594   setValO(delim2, "Ad");
  31595   r = icExtractSmallJsonSmallStringO(self, delim1, delim2);
  31596   ck_assert_ptr_eq(r, NULL);
  31597   freeO(self);
  31598   setTopSO(self, "AAd");
  31599   freeO(delim1);
  31600   setTopSO(delim1, "A");
  31601   setValO(delim2, "");
  31602   r = icExtractSmallJsonSmallStringO(self, delim1, delim2);
  31603   ck_assert_ptr_eq(r, NULL);
  31604   // empty string
  31605   freeO(self);
  31606   setTopSO(self, "");
  31607   freeO(delim1);
  31608   setTopSO(delim1, "$");
  31609   setValO(delim2, "#");
  31610   r = icExtractSmallJsonSmallStringO(self, delim1, delim2);
  31611   ck_assert_ptr_eq(r, NULL);
  31612   // delim1 = delim2
  31613   freeO(self);
  31614   setTopSO(self, "$qwe$");
  31615   freeO(delim1);
  31616   setTopSO(delim1, "$");
  31617   setValO(delim2, "$");
  31618   r = icExtractSmallJsonSmallStringO(self, delim1, delim2);
  31619   ck_assert_ptr_eq(r, NULL);
  31620   // non json string
  31621   freeO(delim1);
  31622   r = icExtractSmallJsonSmallStringO(self, delim1, delim2);
  31623   ck_assert_ptr_eq(r, NULL);
  31624   // non json object
  31625   terminateO(delim1);
  31626   delim1 = (smallJsont*) allocSmallInt(1);
  31627   r = icExtractSmallJsonSmallStringO(self, delim1, delim2);
  31628   ck_assert_ptr_eq(r, NULL);
  31629   terminateO(delim1);
  31630   delim1 = allocSmallJson();
  31631   setTopSO(delim1, ";");
  31632   terminateO(delim2);
  31633   delim2 = (smallStringt*) allocSmallInt(1);
  31634   r = icExtractSmallJsonSmallStringO(self, delim1, delim2);
  31635   ck_assert_ptr_eq(r, NULL);
  31636   terminateO(delim2);
  31637   delim2 = allocSmallString(",");
  31638   // NULL string
  31639   freeO(self);
  31640   freeO(delim1);
  31641   setTopSO(delim1, ";");
  31642   ck_assert_ptr_eq(icExtractSmallJsonSmallStringO(self, delim1, delim2), NULL);
  31643   // NULL delimiter
  31644   freeO(self);
  31645   setTopSO(self, "test");
  31646   ck_assert_ptr_eq(icExtractSmallJsonSmallStringO(self, NULL, delim2), NULL);
  31647   ck_assert_ptr_eq(icExtractSmallJsonSmallStringO(self, delim1, NULL), NULL);
  31648   terminateO(delim1);
  31649   terminateO(delim2);
  31650   terminateO(self);
  31651 
  31652 END_TEST
  31653 
  31654 
  31655 START_TEST(icExtractSmallJsonSSmallJsonT)
  31656 
  31657   smallJsont* r;
  31658   smallJsont *self = allocSmallJson();
  31659   setTopSO(self, "");
  31660   smallJsont* delim1 = allocSmallJson();
  31661 
  31662   // string
  31663   freeO(self);
  31664   setTopSO(self, "one/twos");
  31665   setTopSO(delim1, "E");
  31666   r = icExtractSmallJsonSO(self, delim1, "S");
  31667   ck_assert_ptr_ne(r, null);
  31668   char *s = toStringO(r);
  31669   ck_assert_str_eq(s, "[\"/two\"]");
  31670   free(s);
  31671   terminateO(r);
  31672   // delimiter not found
  31673   freeO(self);
  31674   setTopSO(self, "one/two");
  31675   freeO(delim1);
  31676   setTopSO(delim1, "||");
  31677   r = icExtractSmallJsonSO(self, delim1, "/");
  31678   ck_assert_ptr_eq(r, NULL);
  31679   // icExtractSmallJsonSO with several delimiters after each other
  31680   freeO(self);
  31681   setTopSO(self, "one/ two  /three ");
  31682   freeO(delim1);
  31683   setTopSO(delim1, "/");
  31684   r = icExtractSmallJsonSO(self, delim1, " ");
  31685   ck_assert_ptr_ne(r, null);
  31686   s = toStringO(r);
  31687   ck_assert_str_eq(s, "[\"\",\"three\"]");
  31688   free(s);
  31689   terminateO(r);
  31690   // multiple character delimiter
  31691   freeO(self);
  31692   setTopSO(self, "AAe thre|e icExtract");
  31693   freeO(delim1);
  31694   setTopSO(delim1, "e ");
  31695   r = icExtractSmallJsonSO(self, delim1, "|");
  31696   ck_assert_ptr_ne(r, null);
  31697   s = toStringO(r);
  31698   ck_assert_str_eq(s, "[\"thre\"]");
  31699   free(s);
  31700   terminateO(r);
  31701   // empty delimiter
  31702   freeO(self);
  31703   setTopSO(self, "AAd");
  31704   freeO(delim1);
  31705   setTopSO(delim1, "");
  31706   r = icExtractSmallJsonSO(self, delim1, "Ad");
  31707   ck_assert_ptr_eq(r, NULL);
  31708   freeO(self);
  31709   setTopSO(self, "AAd");
  31710   freeO(delim1);
  31711   setTopSO(delim1, "A");
  31712   r = icExtractSmallJsonSO(self, delim1, "");
  31713   ck_assert_ptr_eq(r, NULL);
  31714   // empty string
  31715   freeO(self);
  31716   setTopSO(self, "");
  31717   freeO(delim1);
  31718   setTopSO(delim1, "$");
  31719   r = icExtractSmallJsonSO(self, delim1, "#");
  31720   ck_assert_ptr_eq(r, NULL);
  31721   // delim1 = delim2
  31722   freeO(self);
  31723   setTopSO(self, "$qwe$");
  31724   freeO(delim1);
  31725   setTopSO(delim1, "$");
  31726   r = icExtractSmallJsonSO(self, delim1, "$");
  31727   ck_assert_ptr_eq(r, NULL);
  31728   // non json string
  31729   freeO(delim1);
  31730   r = icExtractSmallJsonSO(self, delim1, "$");
  31731   ck_assert_ptr_eq(r, NULL);
  31732   // non json object
  31733   terminateO(delim1);
  31734   delim1 = (smallJsont*) allocSmallInt(1);
  31735   r = icExtractSmallJsonSO(self, delim1, "$");
  31736   ck_assert_ptr_eq(r, NULL);
  31737   terminateO(delim1);
  31738   delim1 = allocSmallJson();
  31739   // NULL string
  31740   freeO(self);
  31741   freeO(delim1);
  31742   setTopSO(delim1, ";");
  31743   ck_assert_ptr_eq(icExtractSmallJsonSO(self, delim1, ","), NULL);
  31744   // NULL delimiter
  31745   freeO(self);
  31746   setTopSO(self, "test");
  31747   ck_assert_ptr_eq(icExtractSmallJsonSO(self, NULL, ","), NULL);
  31748   ck_assert_ptr_eq(icExtractSmallJsonSO(self, delim1, NULL), NULL);
  31749   terminateO(delim1);
  31750   terminateO(self);
  31751 
  31752 END_TEST
  31753 
  31754 
  31755 START_TEST(icExtractSmallJsonCharSmallJsonT)
  31756 
  31757   smallJsont* r;
  31758   smallJsont *self = allocSmallJson();
  31759   setTopSO(self, "");
  31760   smallJsont* delim1 = allocSmallJson();
  31761 
  31762   // string
  31763   freeO(self);
  31764   setTopSO(self, "one/twos");
  31765   setTopSO(delim1, "E");
  31766   r = icExtractSmallJsonCharO(self, delim1, 'S');
  31767   ck_assert_ptr_ne(r, null);
  31768   char *s = toStringO(r);
  31769   ck_assert_str_eq(s, "[\"/two\"]");
  31770   free(s);
  31771   terminateO(r);
  31772   // delimiter not found
  31773   freeO(self);
  31774   setTopSO(self, "one/two");
  31775   freeO(delim1);
  31776   setTopSO(delim1, "||");
  31777   r = icExtractSmallJsonCharO(self, delim1, '/');
  31778   ck_assert_ptr_eq(r, NULL);
  31779   // icExtractSmallJsonCharO with several delimiters after each other
  31780   freeO(self);
  31781   setTopSO(self, "one/ two  /three ");
  31782   freeO(delim1);
  31783   setTopSO(delim1, "/");
  31784   r = icExtractSmallJsonCharO(self, delim1, ' ');
  31785   ck_assert_ptr_ne(r, null);
  31786   s = toStringO(r);
  31787   ck_assert_str_eq(s, "[\"\",\"three\"]");
  31788   free(s);
  31789   terminateO(r);
  31790   // multiple character delimiter
  31791   freeO(self);
  31792   setTopSO(self, "AAe thre|e icExtract");
  31793   freeO(delim1);
  31794   setTopSO(delim1, "e ");
  31795   r = icExtractSmallJsonCharO(self, delim1, '|');
  31796   ck_assert_ptr_ne(r, null);
  31797   s = toStringO(r);
  31798   ck_assert_str_eq(s, "[\"thre\"]");
  31799   free(s);
  31800   terminateO(r);
  31801   // empty delimiter
  31802   freeO(self);
  31803   setTopSO(self, "AAd");
  31804   freeO(delim1);
  31805   setTopSO(delim1, "");
  31806   r = icExtractSmallJsonCharO(self, delim1, 'd');
  31807   ck_assert_ptr_eq(r, NULL);
  31808   freeO(self);
  31809   setTopSO(self, "AAd");
  31810   // empty string
  31811   freeO(self);
  31812   setTopSO(self, "");
  31813   freeO(delim1);
  31814   setTopSO(delim1, "$");
  31815   r = icExtractSmallJsonCharO(self, delim1, '#');
  31816   ck_assert_ptr_eq(r, NULL);
  31817   // delim1 = delim2
  31818   freeO(self);
  31819   setTopSO(self, "$qwe$");
  31820   freeO(delim1);
  31821   setTopSO(delim1, "$");
  31822   r = icExtractSmallJsonCharO(self, delim1, '$');
  31823   ck_assert_ptr_eq(r, NULL);
  31824   // non json string
  31825   freeO(delim1);
  31826   r = icExtractSmallJsonCharO(self, delim1, '$');
  31827   ck_assert_ptr_eq(r, NULL);
  31828   // non json object
  31829   terminateO(delim1);
  31830   delim1 = (smallJsont*) allocSmallInt(1);
  31831   r = icExtractSmallJsonCharO(self, delim1, '$');
  31832   ck_assert_ptr_eq(r, NULL);
  31833   terminateO(delim1);
  31834   delim1 = allocSmallJson();
  31835   // NULL string
  31836   freeO(self);
  31837   freeO(delim1);
  31838   setTopSO(delim1, ";");
  31839   ck_assert_ptr_eq(icExtractSmallJsonCharO(self, delim1, ','), NULL);
  31840   // NULL delimiter
  31841   freeO(self);
  31842   setTopSO(self, "test");
  31843   ck_assert_ptr_eq(icExtractSmallJsonCharO(self, NULL, ','), NULL);
  31844   terminateO(delim1);
  31845   terminateO(self);
  31846 
  31847 END_TEST
  31848 
  31849 
  31850 START_TEST(icExtractSmallStringSmallJsonSmallJsonT)
  31851 
  31852   smallJsont* r;
  31853   smallJsont *self = allocSmallJson();
  31854   setTopSO(self, "");
  31855   smallStringt* delim1 = allocSmallString("E");
  31856   smallJsont* delim2   = allocSmallJson();
  31857 
  31858   // string
  31859   freeO(self);
  31860   setTopSO(self, "one/twos");
  31861   setTopSO(delim2, "S");
  31862   r = icExtractSmallStringSmallJsonO(self, delim1, delim2);
  31863   ck_assert_ptr_ne(r, null);
  31864   char *s = toStringO(r);
  31865   ck_assert_str_eq(s, "[\"/two\"]");
  31866   free(s);
  31867   terminateO(r);
  31868   // delimiter not found
  31869   freeO(self);
  31870   setTopSO(self, "one/two");
  31871   freeO(delim2);
  31872   setValO(delim1, "||");
  31873   setTopSO(delim2, "/");
  31874   r = icExtractSmallStringSmallJsonO(self, delim1, delim2);
  31875   ck_assert_ptr_eq(r, NULL);
  31876   // icExtractSmallStringSmallJsonO with several delimiters after each other
  31877   freeO(self);
  31878   setTopSO(self, "one/ two  /three ");
  31879   freeO(delim2);
  31880   setValO(delim1, "/");
  31881   setTopSO(delim2, " ");
  31882   r = icExtractSmallStringSmallJsonO(self, delim1, delim2);
  31883   ck_assert_ptr_ne(r, null);
  31884   s = toStringO(r);
  31885   ck_assert_str_eq(s, "[\"\",\"three\"]");
  31886   free(s);
  31887   terminateO(r);
  31888   // multiple character delimiter
  31889   freeO(self);
  31890   setTopSO(self, "AAe thre|e icExtract");
  31891   freeO(delim2);
  31892   setValO(delim1, "e ");
  31893   setTopSO(delim2, "|");
  31894   r = icExtractSmallStringSmallJsonO(self, delim1, delim2);
  31895   ck_assert_ptr_ne(r, null);
  31896   s = toStringO(r);
  31897   ck_assert_str_eq(s, "[\"thre\"]");
  31898   free(s);
  31899   terminateO(r);
  31900   // empty delimiter
  31901   freeO(self);
  31902   setTopSO(self, "AAd");
  31903   freeO(delim2);
  31904   setValO(delim1, "");
  31905   setTopSO(delim2, "Ad");
  31906   r = icExtractSmallStringSmallJsonO(self, delim1, delim2);
  31907   ck_assert_ptr_eq(r, NULL);
  31908   freeO(self);
  31909   setTopSO(self, "AAd");
  31910   freeO(delim2);
  31911   setValO(delim1, "A");
  31912   setTopSO(delim2, "");
  31913   r = icExtractSmallStringSmallJsonO(self, delim1, delim2);
  31914   ck_assert_ptr_eq(r, NULL);
  31915   // empty string
  31916   freeO(self);
  31917   setTopSO(self, "");
  31918   freeO(delim2);
  31919   setValO(delim1, "$");
  31920   setTopSO(delim2, "#");
  31921   r = icExtractSmallStringSmallJsonO(self, delim1, delim2);
  31922   ck_assert_ptr_eq(r, NULL);
  31923   // delim1 = delim2
  31924   freeO(self);
  31925   setTopSO(self, "$qwe$");
  31926   freeO(delim2);
  31927   setValO(delim1, "$");
  31928   setTopSO(delim2, "$");
  31929   r = icExtractSmallStringSmallJsonO(self, delim1, delim2);
  31930   ck_assert_ptr_eq(r, NULL);
  31931   // non json string
  31932   freeO(delim2);
  31933   r = icExtractSmallStringSmallJsonO(self, delim1, delim2);
  31934   ck_assert_ptr_eq(r, NULL);
  31935   // non json object
  31936   terminateO(delim1);
  31937   delim1 = (smallStringt*) allocSmallInt(1);
  31938   setTopSO(delim2, "$");
  31939   r = icExtractSmallStringSmallJsonO(self, delim1, delim2);
  31940   ck_assert_ptr_eq(r, NULL);
  31941   terminateO(delim1);
  31942   delim1 = allocSmallString(";");
  31943   terminateO(delim2);
  31944   delim2 = (smallJsont*) allocSmallInt(1);
  31945   r = icExtractSmallStringSmallJsonO(self, delim1, delim2);
  31946   ck_assert_ptr_eq(r, NULL);
  31947   terminateO(delim2);
  31948   delim2 = allocSmallJson();
  31949   // NULL string
  31950   freeO(self);
  31951   freeO(delim2);
  31952   setValO(delim1, ";");
  31953   setTopSO(delim2, ",");
  31954   ck_assert_ptr_eq(icExtractSmallStringSmallJsonO(self, delim1, delim2), NULL);
  31955   // NULL delimiter
  31956   freeO(self);
  31957   setTopSO(self, "test");
  31958   ck_assert_ptr_eq(icExtractSmallStringSmallJsonO(self, NULL, delim2), NULL);
  31959   ck_assert_ptr_eq(icExtractSmallStringSmallJsonO(self, delim1, NULL), NULL);
  31960   terminateO(delim1);
  31961   terminateO(delim2);
  31962   terminateO(self);
  31963 
  31964 END_TEST
  31965 
  31966 
  31967 START_TEST(icExtractSmallStringSmallStringSmallJsonT)
  31968 
  31969   smallJsont* r;
  31970   smallJsont *self = allocSmallJson();
  31971   setTopSO(self, "");
  31972   smallStringt* delim1 = allocSmallString("E");
  31973   smallStringt* delim2 = allocSmallString("|");
  31974 
  31975   // string
  31976   freeO(self);
  31977   setTopSO(self, "one/twos");
  31978   setValO(delim2, "S");
  31979   r = icExtractSmallStringSmallStringO(self, delim1, delim2);
  31980   ck_assert_ptr_ne(r, null);
  31981   char *s = toStringO(r);
  31982   ck_assert_str_eq(s, "[\"/two\"]");
  31983   free(s);
  31984   terminateO(r);
  31985   // delimiter not found
  31986   freeO(self);
  31987   setTopSO(self, "one/two");
  31988   setValO(delim1, "||");
  31989   setValO(delim2, "/");
  31990   r = icExtractSmallStringSmallStringO(self, delim1, delim2);
  31991   ck_assert_ptr_eq(r, NULL);
  31992   // icExtractSmallStringSmallStringO with several delimiters after each other
  31993   freeO(self);
  31994   setTopSO(self, "one/ two  /three ");
  31995   setValO(delim1, "/");
  31996   setValO(delim2, " ");
  31997   r = icExtractSmallStringSmallStringO(self, delim1, delim2);
  31998   ck_assert_ptr_ne(r, null);
  31999   s = toStringO(r);
  32000   ck_assert_str_eq(s, "[\"\",\"three\"]");
  32001   free(s);
  32002   terminateO(r);
  32003   // multiple character delimiter
  32004   freeO(self);
  32005   setTopSO(self, "AAe thre|e icExtract");
  32006   setValO(delim1, "e ");
  32007   setValO(delim2, "|");
  32008   r = icExtractSmallStringSmallStringO(self, delim1, delim2);
  32009   ck_assert_ptr_ne(r, null);
  32010   s = toStringO(r);
  32011   ck_assert_str_eq(s, "[\"thre\"]");
  32012   free(s);
  32013   terminateO(r);
  32014   // empty delimiter
  32015   freeO(self);
  32016   setTopSO(self, "AAd");
  32017   setValO(delim1, "");
  32018   setValO(delim2, "Ad");
  32019   r = icExtractSmallStringSmallStringO(self, delim1, delim2);
  32020   ck_assert_ptr_eq(r, NULL);
  32021   freeO(self);
  32022   setTopSO(self, "AAd");
  32023   setValO(delim1, "A");
  32024   setValO(delim2, "");
  32025   r = icExtractSmallStringSmallStringO(self, delim1, delim2);
  32026   ck_assert_ptr_eq(r, NULL);
  32027   // empty string
  32028   freeO(self);
  32029   setTopSO(self, "");
  32030   setValO(delim1, "$");
  32031   setValO(delim2, "#");
  32032   r = icExtractSmallStringSmallStringO(self, delim1, delim2);
  32033   ck_assert_ptr_eq(r, NULL);
  32034   // delim1 = delim2
  32035   freeO(self);
  32036   setTopSO(self, "$qwe$");
  32037   setValO(delim1, "$");
  32038   setValO(delim2, "$");
  32039   r = icExtractSmallStringSmallStringO(self, delim1, delim2);
  32040   ck_assert_ptr_eq(r, NULL);
  32041   // non json object
  32042   terminateO(delim1);
  32043   delim1 = (smallStringt*) allocSmallInt(1);
  32044   r = icExtractSmallStringSmallStringO(self, delim1, delim2);
  32045   ck_assert_ptr_eq(r, NULL);
  32046   terminateO(delim1);
  32047   delim1 = allocSmallString(";");
  32048   terminateO(delim2);
  32049   delim2 = (smallStringt*) allocSmallInt(1);
  32050   r = icExtractSmallStringSmallStringO(self, delim1, delim2);
  32051   ck_assert_ptr_eq(r, NULL);
  32052   terminateO(delim2);
  32053   delim2 = allocSmallString(",");
  32054   // NULL string
  32055   freeO(self);
  32056   setValO(delim1, ";");
  32057   ck_assert_ptr_eq(icExtractSmallStringSmallStringO(self, delim1, delim2), NULL);
  32058   // NULL delimiter
  32059   freeO(self);
  32060   setTopSO(self, "test");
  32061   ck_assert_ptr_eq(icExtractSmallStringSmallStringO(self, NULL, delim2), NULL);
  32062   ck_assert_ptr_eq(icExtractSmallStringSmallStringO(self, delim1, NULL), NULL);
  32063   terminateO(delim1);
  32064   terminateO(delim2);
  32065   terminateO(self);
  32066 
  32067 END_TEST
  32068 
  32069 
  32070 START_TEST(icExtractSmallStringSSmallJsonT)
  32071 
  32072   smallJsont* r;
  32073   smallJsont *self = allocSmallJson();
  32074   setTopSO(self, "");
  32075   smallStringt* delim1 = allocSmallString("E");
  32076 
  32077   // string
  32078   freeO(self);
  32079   setTopSO(self, "one/twos");
  32080   r = icExtractSmallStringSO(self, delim1, "S");
  32081   ck_assert_ptr_ne(r, null);
  32082   char *s = toStringO(r);
  32083   ck_assert_str_eq(s, "[\"/two\"]");
  32084   free(s);
  32085   terminateO(r);
  32086   // delimiter not found
  32087   freeO(self);
  32088   setTopSO(self, "one/two");
  32089   setValO(delim1, "||");
  32090   r = icExtractSmallStringSO(self, delim1, "/");
  32091   ck_assert_ptr_eq(r, NULL);
  32092   // icExtractSmallStringSO with several delimiters after each other
  32093   freeO(self);
  32094   setTopSO(self, "one/ two  /three ");
  32095   setValO(delim1, "/");
  32096   r = icExtractSmallStringSO(self, delim1, " ");
  32097   ck_assert_ptr_ne(r, null);
  32098   s = toStringO(r);
  32099   ck_assert_str_eq(s, "[\"\",\"three\"]");
  32100   free(s);
  32101   terminateO(r);
  32102   // multiple character delimiter
  32103   freeO(self);
  32104   setTopSO(self, "AAe thre|e icExtract");
  32105   setValO(delim1, "e ");
  32106   r = icExtractSmallStringSO(self, delim1, "|");
  32107   ck_assert_ptr_ne(r, null);
  32108   s = toStringO(r);
  32109   ck_assert_str_eq(s, "[\"thre\"]");
  32110   free(s);
  32111   terminateO(r);
  32112   // empty delimiter
  32113   freeO(self);
  32114   setTopSO(self, "AAd");
  32115   setValO(delim1, "");
  32116   r = icExtractSmallStringSO(self, delim1, "Ad");
  32117   ck_assert_ptr_eq(r, NULL);
  32118   freeO(self);
  32119   setTopSO(self, "AAd");
  32120   setValO(delim1, "A");
  32121   r = icExtractSmallStringSO(self, delim1, "");
  32122   ck_assert_ptr_eq(r, NULL);
  32123   // empty string
  32124   freeO(self);
  32125   setTopSO(self, "");
  32126   setValO(delim1, "$");
  32127   r = icExtractSmallStringSO(self, delim1, "#");
  32128   ck_assert_ptr_eq(r, NULL);
  32129   // delim1 = delim2
  32130   freeO(self);
  32131   setTopSO(self, "$qwe$");
  32132   setValO(delim1, "$");
  32133   r = icExtractSmallStringSO(self, delim1, "$");
  32134   ck_assert_ptr_eq(r, NULL);
  32135   // non json object
  32136   terminateO(delim1);
  32137   delim1 = (smallStringt*) allocSmallInt(1);
  32138   r = icExtractSmallStringSO(self, delim1, "$");
  32139   ck_assert_ptr_eq(r, NULL);
  32140   terminateO(delim1);
  32141   delim1 = allocSmallString(";");
  32142   // NULL string
  32143   freeO(self);
  32144   setValO(delim1, ";");
  32145   ck_assert_ptr_eq(icExtractSmallStringSO(self, delim1, ","), NULL);
  32146   // NULL delimiter
  32147   freeO(self);
  32148   setTopSO(self, "test");
  32149   ck_assert_ptr_eq(icExtractSmallStringSO(self, NULL, ","), NULL);
  32150   ck_assert_ptr_eq(icExtractSmallStringSO(self, delim1, NULL), NULL);
  32151   terminateO(delim1);
  32152   terminateO(self);
  32153 
  32154 END_TEST
  32155 
  32156 
  32157 START_TEST(icExtractSmallStringCharSmallJsonT)
  32158 
  32159   smallJsont* r;
  32160   smallJsont *self = allocSmallJson();
  32161   setTopSO(self, "");
  32162   smallStringt* delim1 = allocSmallString("E");
  32163 
  32164   // string
  32165   freeO(self);
  32166   setTopSO(self, "one/twos");
  32167   r = icExtractSmallStringCharO(self, delim1, 'S');
  32168   ck_assert_ptr_ne(r, null);
  32169   char *s = toStringO(r);
  32170   ck_assert_str_eq(s, "[\"/two\"]");
  32171   free(s);
  32172   terminateO(r);
  32173   // delimiter not found
  32174   freeO(self);
  32175   setTopSO(self, "one/two");
  32176   setValO(delim1, "||");
  32177   r = icExtractSmallStringCharO(self, delim1, '/');
  32178   ck_assert_ptr_eq(r, NULL);
  32179   // icExtractSmallStringCharO with several delimiters after each other
  32180   freeO(self);
  32181   setTopSO(self, "one/ two  /three ");
  32182   setValO(delim1, "/");
  32183   r = icExtractSmallStringCharO(self, delim1, ' ');
  32184   ck_assert_ptr_ne(r, null);
  32185   s = toStringO(r);
  32186   ck_assert_str_eq(s, "[\"\",\"three\"]");
  32187   free(s);
  32188   terminateO(r);
  32189   // multiple character delimiter
  32190   freeO(self);
  32191   setTopSO(self, "AAe thre|e icExtract");
  32192   setValO(delim1, "e ");
  32193   r = icExtractSmallStringCharO(self, delim1, '|');
  32194   ck_assert_ptr_ne(r, null);
  32195   s = toStringO(r);
  32196   ck_assert_str_eq(s, "[\"thre\"]");
  32197   free(s);
  32198   terminateO(r);
  32199   // empty delimiter
  32200   freeO(self);
  32201   setTopSO(self, "AAd");
  32202   setValO(delim1, "");
  32203   r = icExtractSmallStringCharO(self, delim1, 'A');
  32204   ck_assert_ptr_eq(r, NULL);
  32205   freeO(self);
  32206   setTopSO(self, "AAd");
  32207   setValO(delim1, "A");
  32208   // empty string
  32209   freeO(self);
  32210   setTopSO(self, "");
  32211   setValO(delim1, "$");
  32212   r = icExtractSmallStringCharO(self, delim1, '#');
  32213   ck_assert_ptr_eq(r, NULL);
  32214   // delim1 = delim2
  32215   freeO(self);
  32216   setTopSO(self, "$qwe$");
  32217   setValO(delim1, "$");
  32218   r = icExtractSmallStringCharO(self, delim1, '$');
  32219   ck_assert_ptr_eq(r, NULL);
  32220   // non json object
  32221   terminateO(delim1);
  32222   delim1 = (smallStringt*) allocSmallInt(1);
  32223   r = icExtractSmallStringCharO(self, delim1, '$');
  32224   ck_assert_ptr_eq(r, NULL);
  32225   terminateO(delim1);
  32226   delim1 = allocSmallString(";");
  32227   // NULL string
  32228   freeO(self);
  32229   setValO(delim1, ";");
  32230   ck_assert_ptr_eq(icExtractSmallStringCharO(self, delim1, ','), NULL);
  32231   // NULL delimiter
  32232   freeO(self);
  32233   setTopSO(self, "test");
  32234   ck_assert_ptr_eq(icExtractSmallStringCharO(self, NULL, ','), NULL);
  32235   terminateO(delim1);
  32236   terminateO(self);
  32237 
  32238 END_TEST
  32239 
  32240 
  32241 START_TEST(icExtractSSmallJsonSmallJsonT)
  32242 
  32243   smallJsont* r;
  32244   smallJsont *self = allocSmallJson();
  32245   setTopSO(self, "");
  32246   smallJsont* delim2 = allocSmallJson();
  32247 
  32248   // string
  32249   freeO(self);
  32250   setTopSO(self, "one/twos");
  32251   setTopSO(delim2, "S");
  32252   r = icExtractSSmallJsonO(self, "E", delim2);
  32253   ck_assert_ptr_ne(r, null);
  32254   char *s = toStringO(r);
  32255   ck_assert_str_eq(s, "[\"/two\"]");
  32256   free(s);
  32257   terminateO(r);
  32258   // delimiter not found
  32259   freeO(self);
  32260   setTopSO(self, "one/two");
  32261   freeO(delim2);
  32262   setTopSO(delim2, "/");
  32263   r = icExtractSSmallJsonO(self, "||", delim2);
  32264   ck_assert_ptr_eq(r, NULL);
  32265   // icExtractSSmallJsonO with several delimiters after each other
  32266   freeO(self);
  32267   setTopSO(self, "one/ two  /three ");
  32268   freeO(delim2);
  32269   setTopSO(delim2, " ");
  32270   r = icExtractSSmallJsonO(self, "/", delim2);
  32271   ck_assert_ptr_ne(r, null);
  32272   s = toStringO(r);
  32273   ck_assert_str_eq(s, "[\"\",\"three\"]");
  32274   free(s);
  32275   terminateO(r);
  32276   // multiple character delimiter
  32277   freeO(self);
  32278   setTopSO(self, "AAe thre|e icExtract");
  32279   freeO(delim2);
  32280   setTopSO(delim2, "|");
  32281   r = icExtractSSmallJsonO(self, "e ", delim2);
  32282   ck_assert_ptr_ne(r, null);
  32283   s = toStringO(r);
  32284   ck_assert_str_eq(s, "[\"thre\"]");
  32285   free(s);
  32286   terminateO(r);
  32287   // empty delimiter
  32288   freeO(self);
  32289   setTopSO(self, "AAd");
  32290   freeO(delim2);
  32291   setTopSO(delim2, "Ad");
  32292   r = icExtractSSmallJsonO(self, "", delim2);
  32293   ck_assert_ptr_eq(r, NULL);
  32294   freeO(self);
  32295   setTopSO(self, "AAd");
  32296   freeO(delim2);
  32297   setTopSO(delim2, "");
  32298   r = icExtractSSmallJsonO(self, "A", delim2);
  32299   ck_assert_ptr_eq(r, NULL);
  32300   // empty string
  32301   freeO(self);
  32302   setTopSO(self, "");
  32303   freeO(delim2);
  32304   setTopSO(delim2, "#");
  32305   r = icExtractSSmallJsonO(self, "$", delim2);
  32306   ck_assert_ptr_eq(r, NULL);
  32307   // delim1 = delim2
  32308   freeO(self);
  32309   setTopSO(self, "$qwe$");
  32310   freeO(delim2);
  32311   setTopSO(delim2, "$");
  32312   r = icExtractSSmallJsonO(self, "$", delim2);
  32313   ck_assert_ptr_eq(r, NULL);
  32314   // non json string
  32315   freeO(delim2);
  32316   r = icExtractSSmallJsonO(self, "$", delim2);
  32317   ck_assert_ptr_eq(r, NULL);
  32318   // non json object
  32319   terminateO(delim2);
  32320   delim2 = (smallJsont*) allocSmallInt(1);
  32321   r = icExtractSSmallJsonO(self, ";", delim2);
  32322   ck_assert_ptr_eq(r, NULL);
  32323   terminateO(delim2);
  32324   delim2 = allocSmallJson();
  32325   // NULL string
  32326   freeO(self);
  32327   freeO(delim2);
  32328   setTopSO(delim2, ",");
  32329   ck_assert_ptr_eq(icExtractSSmallJsonO(self, ";", delim2), NULL);
  32330   // NULL delimiter
  32331   freeO(self);
  32332   setTopSO(self, "test");
  32333   ck_assert_ptr_eq(icExtractSSmallJsonO(self, NULL, delim2), NULL);
  32334   ck_assert_ptr_eq(icExtractSSmallJsonO(self, ";", NULL), NULL);
  32335   terminateO(delim2);
  32336   terminateO(self);
  32337 
  32338 END_TEST
  32339 
  32340 
  32341 START_TEST(icExtractSSmallStringSmallJsonT)
  32342 
  32343   smallJsont* r;
  32344   smallJsont *self = allocSmallJson();
  32345   setTopSO(self, "");
  32346   smallStringt* delim2 = allocSmallString("|");
  32347 
  32348   // string
  32349   freeO(self);
  32350   setTopSO(self, "one/twos");
  32351   setValO(delim2, "S");
  32352   r = icExtractSSmallStringO(self, "E", delim2);
  32353   ck_assert_ptr_ne(r, null);
  32354   char *s = toStringO(r);
  32355   ck_assert_str_eq(s, "[\"/two\"]");
  32356   free(s);
  32357   terminateO(r);
  32358   // delimiter not found
  32359   freeO(self);
  32360   setTopSO(self, "one/two");
  32361   setValO(delim2, "/");
  32362   r = icExtractSSmallStringO(self, "||", delim2);
  32363   ck_assert_ptr_eq(r, NULL);
  32364   // icExtractSSmallStringO with several delimiters after each other
  32365   freeO(self);
  32366   setTopSO(self, "one/ two  /three ");
  32367   setValO(delim2, " ");
  32368   r = icExtractSSmallStringO(self, "/", delim2);
  32369   ck_assert_ptr_ne(r, null);
  32370   s = toStringO(r);
  32371   ck_assert_str_eq(s, "[\"\",\"three\"]");
  32372   free(s);
  32373   terminateO(r);
  32374   // multiple character delimiter
  32375   freeO(self);
  32376   setTopSO(self, "AAe thre|e icExtract");
  32377   setValO(delim2, "|");
  32378   r = icExtractSSmallStringO(self, "e ", delim2);
  32379   ck_assert_ptr_ne(r, null);
  32380   s = toStringO(r);
  32381   ck_assert_str_eq(s, "[\"thre\"]");
  32382   free(s);
  32383   terminateO(r);
  32384   // empty delimiter
  32385   freeO(self);
  32386   setTopSO(self, "AAd");
  32387   setValO(delim2, "Ad");
  32388   r = icExtractSSmallStringO(self, "", delim2);
  32389   ck_assert_ptr_eq(r, NULL);
  32390   freeO(self);
  32391   setTopSO(self, "AAd");
  32392   setValO(delim2, "");
  32393   r = icExtractSSmallStringO(self, "A", delim2);
  32394   ck_assert_ptr_eq(r, NULL);
  32395   // empty string
  32396   freeO(self);
  32397   setTopSO(self, "");
  32398   setValO(delim2, "#");
  32399   r = icExtractSSmallStringO(self, "$", delim2);
  32400   ck_assert_ptr_eq(r, NULL);
  32401   // delim1 = delim2
  32402   freeO(self);
  32403   setTopSO(self, "$qwe$");
  32404   setValO(delim2, "$");
  32405   r = icExtractSSmallStringO(self, "$", delim2);
  32406   ck_assert_ptr_eq(r, NULL);
  32407   // non json object
  32408   terminateO(delim2);
  32409   delim2 = (smallStringt*) allocSmallInt(1);
  32410   r = icExtractSSmallStringO(self, ";", delim2);
  32411   ck_assert_ptr_eq(r, NULL);
  32412   terminateO(delim2);
  32413   delim2 = allocSmallString(",");
  32414   // NULL string
  32415   freeO(self);
  32416   ck_assert_ptr_eq(icExtractSSmallStringO(self, ";", delim2), NULL);
  32417   // NULL delimiter
  32418   freeO(self);
  32419   setTopSO(self, "test");
  32420   ck_assert_ptr_eq(icExtractSSmallStringO(self, NULL, delim2), NULL);
  32421   ck_assert_ptr_eq(icExtractSSmallStringO(self, ";", NULL), NULL);
  32422   terminateO(delim2);
  32423   terminateO(self);
  32424 
  32425 END_TEST
  32426 
  32427 
  32428 START_TEST(icExtractCharSmallJsonSmallJsonT)
  32429 
  32430   smallJsont* r;
  32431   smallJsont *self = allocSmallJson();
  32432   setTopSO(self, "");
  32433   smallJsont* delim2 = allocSmallJson();
  32434 
  32435   // string
  32436   freeO(self);
  32437   setTopSO(self, "one/twos");
  32438   setTopSO(delim2, "S");
  32439   r = icExtractCharSmallJsonO(self, 'E', delim2);
  32440   ck_assert_ptr_ne(r, null);
  32441   char *s = toStringO(r);
  32442   ck_assert_str_eq(s, "[\"/two\"]");
  32443   free(s);
  32444   terminateO(r);
  32445   // delimiter not found
  32446   freeO(self);
  32447   setTopSO(self, "one/two");
  32448   freeO(delim2);
  32449   setTopSO(delim2, "/");
  32450   r = icExtractCharSmallJsonO(self, '|', delim2);
  32451   ck_assert_ptr_eq(r, NULL);
  32452   // icExtractCharSmallJsonO with several delimiters after each other
  32453   freeO(self);
  32454   setTopSO(self, "one/ two  /three ");
  32455   freeO(delim2);
  32456   setTopSO(delim2, " ");
  32457   r = icExtractCharSmallJsonO(self, '/', delim2);
  32458   ck_assert_ptr_ne(r, null);
  32459   s = toStringO(r);
  32460   ck_assert_str_eq(s, "[\"\",\"three\"]");
  32461   free(s);
  32462   terminateO(r);
  32463   // multiple character delimiter
  32464   freeO(self);
  32465   setTopSO(self, "AAe thre|e icExtract");
  32466   freeO(delim2);
  32467   setTopSO(delim2, "|");
  32468   r = icExtractCharSmallJsonO(self, ' ', delim2);
  32469   ck_assert_ptr_ne(r, null);
  32470   s = toStringO(r);
  32471   ck_assert_str_eq(s, "[\"thre\"]");
  32472   free(s);
  32473   terminateO(r);
  32474   // empty delimiter
  32475   freeO(self);
  32476   setTopSO(self, "AAd");
  32477   freeO(delim2);
  32478   setTopSO(delim2, "");
  32479   r = icExtractCharSmallJsonO(self, 'A', delim2);
  32480   ck_assert_ptr_eq(r, NULL);
  32481   // empty string
  32482   freeO(self);
  32483   setTopSO(self, "");
  32484   freeO(delim2);
  32485   setTopSO(delim2, "#");
  32486   r = icExtractCharSmallJsonO(self, '$', delim2);
  32487   ck_assert_ptr_eq(r, NULL);
  32488   // delim1 = delim2
  32489   freeO(self);
  32490   setTopSO(self, "$qwe$");
  32491   freeO(delim2);
  32492   setTopSO(delim2, "$");
  32493   r = icExtractCharSmallJsonO(self, '$', delim2);
  32494   ck_assert_ptr_eq(r, NULL);
  32495   // non json string
  32496   freeO(delim2);
  32497   r = icExtractCharSmallJsonO(self, '$', delim2);
  32498   ck_assert_ptr_eq(r, NULL);
  32499   // non json object
  32500   terminateO(delim2);
  32501   delim2 = (smallJsont*) allocSmallInt(1);
  32502   r = icExtractCharSmallJsonO(self, ';', delim2);
  32503   ck_assert_ptr_eq(r, NULL);
  32504   terminateO(delim2);
  32505   delim2 = allocSmallJson();
  32506   // NULL string
  32507   freeO(self);
  32508   freeO(delim2);
  32509   setTopSO(delim2, ",");
  32510   ck_assert_ptr_eq(icExtractCharSmallJsonO(self, ';', delim2), NULL);
  32511   // NULL delimiter
  32512   freeO(self);
  32513   setTopSO(self, "test");
  32514   ck_assert_ptr_eq(icExtractCharSmallJsonO(self, ';', NULL), NULL);
  32515   terminateO(delim2);
  32516   terminateO(self);
  32517 
  32518 END_TEST
  32519 
  32520 
  32521 START_TEST(icExtractCharSmallStringSmallJsonT)
  32522 
  32523   smallJsont* r;
  32524   smallJsont *self = allocSmallJson();
  32525   setTopSO(self, "");
  32526   smallStringt* delim2 = allocSmallString("|");
  32527 
  32528   // string
  32529   freeO(self);
  32530   setTopSO(self, "one/twos");
  32531   setValO(delim2, "S");
  32532   r = icExtractCharSmallStringO(self, 'E', delim2);
  32533   ck_assert_ptr_ne(r, null);
  32534   char *s = toStringO(r);
  32535   ck_assert_str_eq(s, "[\"/two\"]");
  32536   free(s);
  32537   terminateO(r);
  32538   // delimiter not found
  32539   freeO(self);
  32540   setTopSO(self, "one/two");
  32541   setValO(delim2, "/");
  32542   r = icExtractCharSmallStringO(self, '|', delim2);
  32543   ck_assert_ptr_eq(r, NULL);
  32544   // icExtractCharSmallStringO with several delimiters after each other
  32545   freeO(self);
  32546   setTopSO(self, "one/ two  /three ");
  32547   setValO(delim2, " ");
  32548   r = icExtractCharSmallStringO(self, '/', delim2);
  32549   ck_assert_ptr_ne(r, null);
  32550   s = toStringO(r);
  32551   ck_assert_str_eq(s, "[\"\",\"three\"]");
  32552   free(s);
  32553   terminateO(r);
  32554   // multiple character delimiter
  32555   freeO(self);
  32556   setTopSO(self, "AAe thre|e icExtract");
  32557   setValO(delim2, "|e");
  32558   r = icExtractCharSmallStringO(self, ' ', delim2);
  32559   ck_assert_ptr_ne(r, null);
  32560   s = toStringO(r);
  32561   ck_assert_str_eq(s, "[\"thre\"]");
  32562   free(s);
  32563   terminateO(r);
  32564   // empty delimiter
  32565   freeO(self);
  32566   setTopSO(self, "AAd");
  32567   setValO(delim2, "");
  32568   r = icExtractCharSmallStringO(self, 'A', delim2);
  32569   ck_assert_ptr_eq(r, NULL);
  32570   // empty string
  32571   freeO(self);
  32572   setTopSO(self, "");
  32573   setValO(delim2, "#");
  32574   r = icExtractCharSmallStringO(self, '$', delim2);
  32575   ck_assert_ptr_eq(r, NULL);
  32576   // delim1 = delim2
  32577   freeO(self);
  32578   setTopSO(self, "$qwe$");
  32579   setValO(delim2, "$");
  32580   r = icExtractCharSmallStringO(self, '$', delim2);
  32581   ck_assert_ptr_eq(r, NULL);
  32582   // non json object
  32583   terminateO(delim2);
  32584   delim2 = (smallStringt*) allocSmallInt(1);
  32585   r = icExtractCharSmallStringO(self, ';', delim2);
  32586   ck_assert_ptr_eq(r, NULL);
  32587   terminateO(delim2);
  32588   delim2 = allocSmallString(",");
  32589   // NULL string
  32590   freeO(self);
  32591   ck_assert_ptr_eq(icExtractCharSmallStringO(self, ';', delim2), NULL);
  32592   // NULL delimiter
  32593   freeO(self);
  32594   setTopSO(self, "test");
  32595   ck_assert_ptr_eq(icExtractCharSmallStringO(self, ';', NULL), NULL);
  32596   terminateO(delim2);
  32597   terminateO(self);
  32598 
  32599 END_TEST
  32600 
  32601 
  32602 START_TEST(colorSmallJsonT)
  32603 
  32604   smallJsont* r;
  32605   smallJsont *self = allocSmallJson();
  32606   setTopSO(self, "qwe");
  32607 
  32608   r = colorO(self, RED);
  32609   ck_assert_ptr_ne(r, null);
  32610   char *s = toStringO(r);
  32611   ck_assert_str_eq(s, RED"qwe"RST);
  32612   free(s);
  32613   // null color
  32614   r = colorO(self, null);
  32615   ck_assert_ptr_eq(r, NULL);
  32616   // empty self
  32617   freeO(self);
  32618   r = colorO(self, RED);
  32619   ck_assert_ptr_eq(r, NULL);
  32620   terminateO(self);
  32621 
  32622 END_TEST
  32623 
  32624 
  32625 START_TEST(colordSmallJsonT)
  32626 
  32627   char* r;
  32628   smallJsont *self = allocSmallJson();
  32629   setTopSO(self, "qwe");
  32630 
  32631   r = colordO(self, RED);
  32632   ck_assert_ptr_ne(r, null);
  32633   ck_assert_str_eq(r, RED"qwe"RST);
  32634   free(r);
  32635   // empty string
  32636   emptyO(self);
  32637   r = colordO(self, RED);
  32638   ck_assert_ptr_ne(r, null);
  32639   ck_assert_str_eq(r, "");
  32640   free(r);
  32641   // null color
  32642   r = colordO(self, null);
  32643   ck_assert_ptr_eq(r, NULL);
  32644   // empty self
  32645   freeO(self);
  32646   r = colordO(self, RED);
  32647   ck_assert_ptr_eq(r, NULL);
  32648   terminateO(self);
  32649 
  32650 END_TEST
  32651 
  32652 
  32653 START_TEST(zipSmallJsonT)
  32654 
  32655   smallJsont* r;
  32656   smallJsont *self   = allocSmallJson();
  32657   smallArrayt *array1 = allocSmallArray();
  32658   smallArrayt *array2 = allocSmallArray();
  32659 
  32660   // non json array or dict
  32661   setTypeBoolO(self);
  32662   r = zipO(self, array1, array2);
  32663   ck_assert_ptr_eq(r, NULL);
  32664   // json array
  32665   // zip arrays
  32666   //   empty self
  32667   freeO(self);
  32668   array1->f->pushS(array1, "a");
  32669   array2->f->pushInt(array2, 1);
  32670   r = zipO(self, array1, array2);
  32671   ck_assert_ptr_ne(r, NULL);
  32672   char *s = toStringO(r);
  32673   ck_assert_str_eq(s, "[[\"a\",1]]");
  32674   free(s);
  32675   disposeO(array1);
  32676   disposeO(array2);
  32677   freeO(self);
  32678   // add an element to self
  32679   // array1 has 2 elements
  32680   // array2 has 3 elements
  32681   // only 2 elements are zipped
  32682   self->f->pushS(self, "qwe");
  32683   array1->f->pushS(array1, "a");
  32684   array1->f->pushS(array1, "b");
  32685   array2->f->pushInt(array2, 1);
  32686   array2->f->pushInt(array2, 2);
  32687   array2->f->pushInt(array2, 3);
  32688   r = zipO(self, array1, array2);
  32689   ck_assert_ptr_ne(r, NULL);
  32690   s = toStringO(r);
  32691   ck_assert_str_eq(s, "[\"qwe\",[\"a\",1],[\"b\",2]]");
  32692   free(s);
  32693   //    delete the element not in self
  32694   delElemO(array2, 2);
  32695   // empty arrays
  32696   disposeO(array2);
  32697   r = zipO(self, array1, array2);
  32698   ck_assert_ptr_ne(r, NULL);
  32699   s = toStringO(r);
  32700   ck_assert_str_eq(s, "[\"qwe\",[\"a\",1],[\"b\",2]]");
  32701   free(s);
  32702   disposeO(array1);
  32703   r = zipO(self, array1, array2);
  32704   ck_assert_ptr_ne(r, NULL);
  32705   s = toStringO(r);
  32706   ck_assert_str_eq(s, "[\"qwe\",[\"a\",1],[\"b\",2]]");
  32707   free(s);
  32708   // array1 and array2 same element count
  32709   array1->f->pushS(array1, "aa");
  32710   array1->f->pushS(array1, "bb");
  32711   array2->f->pushInt(array2, 11);
  32712   array2->f->pushInt(array2, 22);
  32713   delElemO(array1, 1);
  32714   r = zipO(self, array1, array2);
  32715   delElemO(array2, 1);
  32716   ck_assert_ptr_ne(r, NULL);
  32717   //  some elements were zipped
  32718   s = toStringO(self);
  32719   ck_assert_str_eq(s, "[\"qwe\",[\"a\",1],[\"b\",2],[\"aa\",11]]");
  32720   free(s);
  32721   // but an element is NULL
  32722   // non smallArray objects
  32723   smashO(array1);
  32724   array1 = (smallArrayt*) allocSmallInt(2);
  32725   r = zipO(self, array1, array2);
  32726   ck_assert_ptr_eq(r, NULL);
  32727   terminateO(array1);
  32728   array1 = allocSmallArray();
  32729   smashO(array2);
  32730   array2 = (smallArrayt*) allocSmallInt(2);
  32731   r = zipO(self, array1, array2);
  32732   ck_assert_ptr_eq(r, NULL);
  32733   terminateO(array2);
  32734   array2 = allocSmallArray();
  32735   // NULL arrays
  32736   r = zipO(self, NULL, array2);
  32737   ck_assert_ptr_eq(r, NULL);
  32738   r = zipO(self, array1, NULL);
  32739   ck_assert_ptr_eq(r, NULL);
  32740   terminateO(self);
  32741   smashO(array1);
  32742   smashO(array2);
  32743   // json dict
  32744   self = allocSmallJson();
  32745   setTypeDictO(self);
  32746   smallArrayt *keys   = allocSmallArray();
  32747   smallArrayt *values = allocSmallArray();
  32748   self->f->setInt(self, "", 1);
  32749   // 3 elements in keys
  32750   // 2 elements in values
  32751   // only 2 key/values are zipped
  32752   keys->f->pushS(keys, "a");
  32753   keys->f->pushS(keys, "b");
  32754   keys->f->pushS(keys, "c");
  32755   values->f->pushInt(values, 1);
  32756   values->f->pushInt(values, 2);
  32757   r = zipO(self, keys, values);
  32758   terminateO(keys);
  32759   smashO(values);
  32760   ck_assert_ptr_ne(r, NULL);
  32761   s = toStringO(r);
  32762   ck_assert_str_eq(s, "{\"\":1,\"a\":1,\"b\":2}");
  32763   free(s);
  32764   // keys array with non string objects
  32765   keys   = allocSmallArray();
  32766   values = allocSmallArray();
  32767   keys->f->pushInt(keys, 1);
  32768   values->f->pushInt(values, 1);
  32769   r = zipO(self, keys, values);
  32770   ck_assert_ptr_eq(r, NULL);
  32771   terminateO(keys);
  32772   terminateO(values);
  32773   // empty values
  32774   keys   = allocSmallArray();
  32775   values = allocSmallArray();
  32776   keys->f->pushInt(keys, 1);
  32777   r = zipO(self, keys, values);
  32778   ck_assert_ptr_eq(r, self);
  32779   terminateO(keys);
  32780   terminateO(values);
  32781   terminateO(self);
  32782 
  32783 END_TEST
  32784 
  32785 
  32786 START_TEST(zipArraySmallJsonT)
  32787 
  32788   smallJsont* r;
  32789   smallJsont *self = allocSmallJson();
  32790   char** array1;
  32791   smallArrayt *array2 = allocSmallArray();
  32792 
  32793   // non json array or dict
  32794   setTypeBoolO(self);
  32795   array1 = listCreateS("a");
  32796   r = zipArrayO(self, array1, array2);
  32797   ck_assert_ptr_eq(r, NULL);
  32798   // json array
  32799   // zip arrays
  32800   //   empty self
  32801   freeO(self);
  32802   array2->f->pushInt(array2, 1);
  32803   r       = zipArrayO(self, array1, array2);
  32804   ck_assert_ptr_ne(r, NULL);
  32805   char *s = toStringO(r);
  32806   ck_assert_str_eq(s, "[[\"a\",1]]");
  32807   free(s);
  32808   freen(array1);
  32809   disposeO(array2);
  32810   freeO(self);
  32811   // add an element to self
  32812   // array1 has 2 elements
  32813   // array2 has 3 elements
  32814   // only 2 elements are zipped
  32815   self->f->pushS(self, "qwe");
  32816   array1  = listCreateS("a", "b");
  32817   array2->f->pushInt(array2, 1);
  32818   array2->f->pushInt(array2, 2);
  32819   array2->f->pushInt(array2, 3);
  32820   r = zipArrayO(self, array1, array2);
  32821   ck_assert_ptr_ne(r, NULL);
  32822   s = toStringO(r);
  32823   ck_assert_str_eq(s, "[\"qwe\",[\"a\",1],[\"b\",2]]");
  32824   free(s);
  32825   //    delete the element not in self
  32826   delElemO(array2, 2);
  32827   // empty arrays
  32828   disposeO(array2);
  32829   r = zipArrayO(self, array1, array2);
  32830   ck_assert_ptr_ne(r, NULL);
  32831   s = toStringO(r);
  32832   ck_assert_str_eq(s, "[\"qwe\",[\"a\",1],[\"b\",2]]");
  32833   free(s);
  32834   iListRemoveS(&array1, 0, 2);
  32835   r = zipArrayO(self, array1, array2);
  32836   free(array1);
  32837   ck_assert_ptr_ne(r, NULL);
  32838   s = toStringO(r);
  32839   ck_assert_str_eq(s, "[\"qwe\",[\"a\",1],[\"b\",2]]");
  32840   free(s);
  32841   // array1 and array2 same element count
  32842   array1 = listCreateS("aa", "bb");
  32843   array2->f->pushInt(array2, 11);
  32844   array2->f->pushInt(array2, 22);
  32845   iListDelElemS(&array1, 1);
  32846   r = zipArrayO(self, array1, array2);
  32847   delElemO(array2, 1);
  32848   ck_assert_ptr_ne(r, NULL);
  32849   //  some elements were zipped
  32850   s = toStringO(self);
  32851   ck_assert_str_eq(s, "[\"qwe\",[\"a\",1],[\"b\",2],[\"aa\",11]]");
  32852   free(s);
  32853   // but an element is NULL
  32854   // non smallArray objects
  32855   smashO(array2);
  32856   array2 = (smallArrayt*) allocSmallInt(2);
  32857   r = zipArrayO(self, array1, array2);
  32858   ck_assert_ptr_eq(r, NULL);
  32859   terminateO(array2);
  32860   array2 = allocSmallArray();
  32861   // NULL arrays
  32862   r = zipArrayO(self, NULL, array2);
  32863   ck_assert_ptr_eq(r, NULL);
  32864   r = zipArrayO(self, array1, NULL);
  32865   ck_assert_ptr_eq(r, NULL);
  32866   terminateO(self);
  32867   free(array1);
  32868   smashO(array2);
  32869   // json dict
  32870   self = allocSmallJson();
  32871   char** keys;
  32872   smallArrayt *values = allocSmallArray();
  32873   self->f->setInt(self, "", 1);
  32874   // 3 elements in keys
  32875   // 2 elements in values
  32876   // only 2 key/values are zipped
  32877   keys = listCreateS("a", "b", "c");
  32878   values->f->pushInt(values, 1);
  32879   values->f->pushInt(values, 2);
  32880   r = zipArrayO(self, keys, values);
  32881   listFreeS(keys);
  32882   smashO(values);
  32883   ck_assert_ptr_ne(r, NULL);
  32884   s = toStringO(r);
  32885   ck_assert_str_eq(s, "{\"\":1,\"a\":1,\"b\":2}");
  32886   free(s);
  32887   // empty values
  32888   keys   = listCreateS("a");
  32889   values = allocSmallArray();
  32890   r = zipArrayO(self, keys, values);
  32891   ck_assert_ptr_eq(r, self);
  32892   listFreeS(keys);
  32893   terminateO(values);
  32894   terminateO(self);
  32895 
  32896 END_TEST
  32897 
  32898 
  32899 START_TEST(zipCArraySmallJsonT)
  32900 
  32901   smallJsont* r;
  32902   smallJsont *self    = allocSmallJson();
  32903   const char* array1[] = {"a", "b", null};
  32904   smallArrayt *array2  = allocSmallArray();
  32905 
  32906   // non json array or dict
  32907   setTypeBoolO(self);
  32908   r = zipCArrayO(self, array1, array2);
  32909   ck_assert_ptr_eq(r, NULL);
  32910   // json array
  32911   // zip arrays
  32912   //   empty self
  32913   freeO(self);
  32914   array2->f->pushInt(array2, 1);
  32915   r       = zipCArrayO(self, array1, array2);
  32916   ck_assert_ptr_ne(r, NULL);
  32917   char *s = toStringO(r);
  32918   ck_assert_str_eq(s, "[[\"a\",1]]");
  32919   free(s);
  32920   disposeO(array2);
  32921   freeO(self);
  32922   // add an element to self
  32923   // array1 has 2 elements
  32924   // array2 has 3 elements
  32925   // only 2 elements are zipped
  32926   self->f->pushS(self, "qwe");
  32927   array2->f->pushInt(array2, 1);
  32928   array2->f->pushInt(array2, 2);
  32929   array2->f->pushInt(array2, 3);
  32930   r = zipCArrayO(self, array1, array2);
  32931   ck_assert_ptr_ne(r, NULL);
  32932   s = toStringO(r);
  32933   ck_assert_str_eq(s, "[\"qwe\",[\"a\",1],[\"b\",2]]");
  32934   free(s);
  32935   //    delete the element not in self
  32936   delElemO(array2, 2);
  32937   // empty arrays
  32938   disposeO(array2);
  32939   r = zipCArrayO(self, array1, array2);
  32940   ck_assert_ptr_ne(r, NULL);
  32941   s = toStringO(r);
  32942   ck_assert_str_eq(s, "[\"qwe\",[\"a\",1],[\"b\",2]]");
  32943   free(s);
  32944   array1[0] = null;
  32945   r = zipCArrayO(self, array1, array2);
  32946   ck_assert_ptr_ne(r, NULL);
  32947   s = toStringO(r);
  32948   ck_assert_str_eq(s, "[\"qwe\",[\"a\",1],[\"b\",2]]");
  32949   free(s);
  32950   // array1 and array2 same element count
  32951   array1[0] = "aa";
  32952   array1[1] = null;
  32953   array2->f->pushInt(array2, 11);
  32954   array2->f->pushInt(array2, 22);
  32955   r = zipCArrayO(self, array1, array2);
  32956   delElemO(array2, 1);
  32957   ck_assert_ptr_ne(r, NULL);
  32958   //  some elements were zipped
  32959   s = toStringO(self);
  32960   ck_assert_str_eq(s, "[\"qwe\",[\"a\",1],[\"b\",2],[\"aa\",11]]");
  32961   free(s);
  32962   // but an element is NULL
  32963   // non smallArray objects
  32964   smashO(array2);
  32965   array2 = (smallArrayt*) allocSmallInt(2);
  32966   r = zipCArrayO(self, array1, array2);
  32967   ck_assert_ptr_eq(r, NULL);
  32968   terminateO(array2);
  32969   array2 = allocSmallArray();
  32970   // NULL arrays
  32971   r = zipCArrayO(self, NULL, array2);
  32972   ck_assert_ptr_eq(r, NULL);
  32973   r = zipCArrayO(self, array1, NULL);
  32974   ck_assert_ptr_eq(r, NULL);
  32975   terminateO(self);
  32976   smashO(array2);
  32977   // json dict
  32978   self = allocSmallJson();
  32979   const char* keys[] = {"a", "b", "c", null};
  32980   smallArrayt *values = allocSmallArray();
  32981   self->f->setInt(self, "", 1);
  32982   // 3 elements in keys
  32983   // 2 elements in values
  32984   // only 2 key/values are zipped
  32985   values->f->pushInt(values, 1);
  32986   values->f->pushInt(values, 2);
  32987   r = zipCArrayO(self, keys, values);
  32988   smashO(values);
  32989   ck_assert_ptr_ne(r, NULL);
  32990   s = toStringO(r);
  32991   ck_assert_str_eq(s, "{\"\":1,\"a\":1,\"b\":2}");
  32992   free(s);
  32993   // empty values
  32994   values = allocSmallArray();
  32995   r = zipCArrayO(self, keys, values);
  32996   ck_assert_ptr_eq(r, self);
  32997   terminateO(values);
  32998   terminateO(self);
  32999 
  33000 END_TEST
  33001 
  33002 
  33003 START_TEST(zipCharSmallJsonT)
  33004 
  33005   smallJsont* r;
  33006   smallJsont *self   = allocSmallJson();
  33007   smallArrayt *array1 = allocSmallArray();
  33008   char** array2;
  33009 
  33010   // non json array or dict
  33011   setTypeBoolO(self);
  33012   array2 = listCreateS("1");
  33013   r = zipCharO(self, array1, array2);
  33014   ck_assert_ptr_eq(r, NULL);
  33015   // json array
  33016   // zip arrays
  33017   //   empty self
  33018   freeO(self);
  33019   array1->f->pushS(array1, "a");
  33020   r       = zipCharO(self, array1, array2);
  33021   ck_assert_ptr_ne(r, NULL);
  33022   char *s = toStringO(r);
  33023   ck_assert_str_eq(s, "[[\"a\",\"1\"]]");
  33024   free(s);
  33025   disposeO(array1);
  33026   freen(array2);
  33027   freeO(self);
  33028   // add an element to self
  33029   // array1 has 2 elements
  33030   // array2 has 3 elements
  33031   // only 2 elements are zipped
  33032   self->f->pushS(self, "qwe");
  33033   array1->f->pushS(array1, "a");
  33034   array1->f->pushS(array1, "b");
  33035   array2  = listCreateS("1", "2", "3");
  33036   r = zipCharO(self, array1, array2);
  33037   ck_assert_ptr_ne(r, NULL);
  33038   s = toStringO(r);
  33039   ck_assert_str_eq(s, "[\"qwe\",[\"a\",\"1\"],[\"b\",\"2\"]]");
  33040   free(s);
  33041   //    delete the element not in self
  33042   iListDelElemS(&array2, 2);
  33043   // empty arrays
  33044   iListRemoveS(&array2, 0, 2);
  33045   r = zipCharO(self, array1, array2);
  33046   ck_assert_ptr_ne(r, NULL);
  33047   s = toStringO(r);
  33048   ck_assert_str_eq(s, "[\"qwe\",[\"a\",\"1\"],[\"b\",\"2\"]]");
  33049   free(s);
  33050   disposeO(array1);
  33051   r = zipCharO(self, array1, array2);
  33052   ck_assert_ptr_ne(r, NULL);
  33053   s = toStringO(r);
  33054   ck_assert_str_eq(s, "[\"qwe\",[\"a\",\"1\"],[\"b\",\"2\"]]");
  33055   free(s);
  33056   free(array2);
  33057   // array1 and array2 same element count
  33058   array1->f->pushS(array1, "aa");
  33059   array1->f->pushS(array1, "bb");
  33060   array2  = listCreateS("11", "22");
  33061   delElemO(array1, 1);
  33062   r = zipCharO(self, array1, array2);
  33063   iListDelElemS(&array2, 1);
  33064   ck_assert_ptr_ne(r, NULL);
  33065   //  some elements were zipped
  33066   s = toStringO(self);
  33067   ck_assert_str_eq(s, "[\"qwe\",[\"a\",\"1\"],[\"b\",\"2\"],[\"aa\",\"11\"]]");
  33068   free(s);
  33069   // but an element is NULL
  33070   // non smallJson objects
  33071   smashO(array1);
  33072   array1 = (smallArrayt*) allocSmallInt(2);
  33073   r = zipCharO(self, array1, array2);
  33074   ck_assert_ptr_eq(r, NULL);
  33075   terminateO(array1);
  33076   array1 = allocSmallArray();
  33077   // NULL arrays
  33078   r = zipCharO(self, NULL, array2);
  33079   ck_assert_ptr_eq(r, NULL);
  33080   r = zipCharO(self, array1, NULL);
  33081   ck_assert_ptr_eq(r, NULL);
  33082   terminateO(self);
  33083   smashO(array1);
  33084   free(array2);
  33085   // json dict
  33086   self = allocSmallJson();
  33087   smallArrayt *keys = allocSmallArray();
  33088   char** values;
  33089   self->f->setInt(self, "", 1);
  33090   // 3 elements in keys
  33091   // 2 elements in values
  33092   // only 2 key/values are zipped
  33093   keys->f->pushS(keys, "a");
  33094   keys->f->pushS(keys, "b");
  33095   keys->f->pushS(keys, "c");
  33096   values = listCreateS("1", "2");
  33097   r = zipCharO(self, keys, values);
  33098   terminateO(keys);
  33099   listFreeS(values);
  33100   ck_assert_ptr_ne(r, NULL);
  33101   s = toStringO(r);
  33102   ck_assert_str_eq(s, "{\"\":1,\"a\":\"1\",\"b\":\"2\"}");
  33103   free(s);
  33104   // keys array with non string objects
  33105   keys   = allocSmallArray();
  33106   keys->f->pushInt(keys, 1);
  33107   values = listCreateS("1");
  33108   r = zipCharO(self, keys, values);
  33109   ck_assert_ptr_eq(r, NULL);
  33110   terminateO(keys);
  33111   listFreeS(values);
  33112   // empty values
  33113   keys   = allocSmallArray();
  33114   keys->f->pushInt(keys, 1);
  33115   listEmptyS(values);
  33116   r = zipCharO(self, keys, values);
  33117   ck_assert_ptr_eq(r, self);
  33118   terminateO(keys);
  33119   listFreeS(values);
  33120   terminateO(self);
  33121 
  33122 END_TEST
  33123 
  33124 
  33125 START_TEST(zipCCharSmallJsonT)
  33126 
  33127   smallJsont* r;
  33128   smallJsont *self     = allocSmallJson();
  33129   smallArrayt *array1  = allocSmallArray();
  33130   const char* array2[] = {"1", "2", "3", null};
  33131 
  33132   // non json array or dict
  33133   setTypeBoolO(self);
  33134   r = zipCCharO(self, array1, array2);
  33135   ck_assert_ptr_eq(r, NULL);
  33136   // json array
  33137   // zip arrays
  33138   //   empty self
  33139   freeO(self);
  33140   array1->f->pushS(array1, "a");
  33141   r       = zipCCharO(self, array1, array2);
  33142   ck_assert_ptr_ne(r, NULL);
  33143   char *s = toStringO(r);
  33144   ck_assert_str_eq(s, "[[\"a\",\"1\"]]");
  33145   free(s);
  33146   disposeO(array1);
  33147   freeO(self);
  33148   // add an element to self
  33149   // array1 has 2 elements
  33150   // array2 has 3 elements
  33151   // only 2 elements are zipped
  33152   self->f->pushS(self, "qwe");
  33153   array1->f->pushS(array1, "a");
  33154   array1->f->pushS(array1, "b");
  33155   r = zipCCharO(self, array1, array2);
  33156   ck_assert_ptr_ne(r, NULL);
  33157   s = toStringO(r);
  33158   ck_assert_str_eq(s, "[\"qwe\",[\"a\",\"1\"],[\"b\",\"2\"]]");
  33159   free(s);
  33160   // empty arrays
  33161   array2[0] = null;
  33162   r = zipCCharO(self, array1, array2);
  33163   ck_assert_ptr_ne(r, NULL);
  33164   s = toStringO(r);
  33165   ck_assert_str_eq(s, "[\"qwe\",[\"a\",\"1\"],[\"b\",\"2\"]]");
  33166   free(s);
  33167   disposeO(array1);
  33168   array2[0] = "1";
  33169   r = zipCCharO(self, array1, array2);
  33170   ck_assert_ptr_ne(r, NULL);
  33171   s = toStringO(r);
  33172   ck_assert_str_eq(s, "[\"qwe\",[\"a\",\"1\"],[\"b\",\"2\"]]");
  33173   free(s);
  33174   // array1 and array2 same element count
  33175   array1->f->pushS(array1, "aa");
  33176   array1->f->pushS(array1, "bb");
  33177   array2[0] = "11";
  33178   array2[1] = "22";
  33179   array2[2] = null;
  33180   delElemO(array1, 1);
  33181   r = zipCCharO(self, array1, array2);
  33182   ck_assert_ptr_ne(r, NULL);
  33183   //  some elements were zipped
  33184   s = toStringO(self);
  33185   ck_assert_str_eq(s, "[\"qwe\",[\"a\",\"1\"],[\"b\",\"2\"],[\"aa\",\"11\"]]");
  33186   free(s);
  33187   // but an element is NULL
  33188   // non smallJson objects
  33189   smashO(array1);
  33190   array1 = (smallArrayt*) allocSmallInt(2);
  33191   r = zipCCharO(self, array1, array2);
  33192   ck_assert_ptr_eq(r, NULL);
  33193   terminateO(array1);
  33194   array1 = allocSmallArray();
  33195   // NULL arrays
  33196   r = zipCCharO(self, NULL, array2);
  33197   ck_assert_ptr_eq(r, NULL);
  33198   r = zipCCharO(self, array1, NULL);
  33199   ck_assert_ptr_eq(r, NULL);
  33200   terminateO(self);
  33201   smashO(array1);
  33202   // json dict
  33203   self = allocSmallJson();
  33204   smallArrayt *keys = allocSmallArray();
  33205   const char* values[] = {"1", "2", null};
  33206   self->f->setInt(self, "", 1);
  33207   // 3 elements in keys
  33208   // 2 elements in values
  33209   // only 2 key/values are zipped
  33210   keys->f->pushS(keys, "a");
  33211   keys->f->pushS(keys, "b");
  33212   keys->f->pushS(keys, "c");
  33213   r = zipCCharO(self, keys, values);
  33214   terminateO(keys);
  33215   ck_assert_ptr_ne(r, NULL);
  33216   s = toStringO(r);
  33217   ck_assert_str_eq(s, "{\"\":1,\"a\":\"1\",\"b\":\"2\"}");
  33218   free(s);
  33219   // keys array with non string objects
  33220   keys   = allocSmallArray();
  33221   keys->f->pushInt(keys, 1);
  33222   r = zipCCharO(self, keys, values);
  33223   ck_assert_ptr_eq(r, NULL);
  33224   terminateO(keys);
  33225   // empty values
  33226   keys   = allocSmallArray();
  33227   keys->f->pushInt(keys, 1);
  33228   values[0] = null;
  33229   r = zipCCharO(self, keys, values);
  33230   ck_assert_ptr_eq(r, self);
  33231   terminateO(keys);
  33232   terminateO(self);
  33233 
  33234 END_TEST
  33235 
  33236 
  33237 START_TEST(zipArrayCharSmallJsonT)
  33238 
  33239   smallJsont* r;
  33240   smallJsont *self = allocSmallJson();
  33241   char** array1;
  33242   char** array2;
  33243 
  33244   // non json array or dict
  33245   setTypeBoolO(self);
  33246   array1 = listCreateS("a");
  33247   array2 = listCreateS("1");
  33248   r = zipArrayCharO(self, array1, array2);
  33249   ck_assert_ptr_eq(r, NULL);
  33250   // json array
  33251   // zip arrays
  33252   //   empty self
  33253   freeO(self);
  33254   r       = zipArrayCharO(self, array1, array2);
  33255   ck_assert_ptr_ne(r, NULL);
  33256   char *s = toStringO(r);
  33257   ck_assert_str_eq(s, "[[\"a\",\"1\"]]");
  33258   free(s);
  33259   freen(array1);
  33260   freen(array2);
  33261   freeO(self);
  33262   // add an element to self
  33263   // array1 has 2 elements
  33264   // array2 has 3 elements
  33265   // only 2 elements are zipped
  33266   self->f->pushS(self, "qwe");
  33267   array1  = listCreateS("a", "b");
  33268   array2  = listCreateS("1", "2", "3");
  33269   r = zipArrayCharO(self, array1, array2);
  33270   ck_assert_ptr_ne(r, NULL);
  33271   s = toStringO(r);
  33272   ck_assert_str_eq(s, "[\"qwe\",[\"a\",\"1\"],[\"b\",\"2\"]]");
  33273   free(s);
  33274   //    delete the element not in self
  33275   iListDelElemS(&array2, 2);
  33276   // empty arrays
  33277   iListRemoveS(&array2, 0, 2);
  33278   r = zipArrayCharO(self, array1, array2);
  33279   ck_assert_ptr_ne(r, NULL);
  33280   s = toStringO(r);
  33281   ck_assert_str_eq(s, "[\"qwe\",[\"a\",\"1\"],[\"b\",\"2\"]]");
  33282   free(s);
  33283   iListRemoveS(&array1, 0, 2);
  33284   r = zipArrayCharO(self, array1, array2);
  33285   ck_assert_ptr_ne(r, NULL);
  33286   s = toStringO(r);
  33287   ck_assert_str_eq(s, "[\"qwe\",[\"a\",\"1\"],[\"b\",\"2\"]]");
  33288   free(s);
  33289   free(array1);
  33290   free(array2);
  33291   // array1 and array2 same element count
  33292   array1 = listCreateS("aa", "bb");
  33293   array2 = listCreateS("11", "22");
  33294   iListDelElemS(&array1, 1);
  33295   r = zipArrayCharO(self, array1, array2);
  33296   iListDelElemS(&array2, 1);
  33297   ck_assert_ptr_ne(r, NULL);
  33298   //  some elements were zipped
  33299   s = toStringO(self);
  33300   ck_assert_str_eq(s, "[\"qwe\",[\"a\",\"1\"],[\"b\",\"2\"],[\"aa\",\"11\"]]");
  33301   free(s);
  33302   // but an element is NULL
  33303   // NULL arrays
  33304   r = zipArrayCharO(self, NULL, array2);
  33305   ck_assert_ptr_eq(r, NULL);
  33306   r = zipArrayCharO(self, array1, NULL);
  33307   ck_assert_ptr_eq(r, NULL);
  33308   terminateO(self);
  33309   free(array1);
  33310   free(array2);
  33311   // json dict
  33312   self = allocSmallJson();
  33313   char** keys;
  33314   char** values;
  33315   self->f->setInt(self, "", 1);
  33316   // 3 elements in keys
  33317   // 2 elements in values
  33318   // only 2 key/values are zipped
  33319   keys   = listCreateS("a", "b", "c");
  33320   values = listCreateS("1", "2");
  33321   r = zipArrayCharO(self, keys, values);
  33322   listFreeS(keys);
  33323   listFreeS(values);
  33324   ck_assert_ptr_ne(r, NULL);
  33325   s = toStringO(r);
  33326   ck_assert_str_eq(s, "{\"\":1,\"a\":\"1\",\"b\":\"2\"}");
  33327   free(s);
  33328   // empty values
  33329   keys = listCreateS("a", "b", "c");
  33330   listEmptyS(values);
  33331   r = zipArrayCharO(self, keys, values);
  33332   ck_assert_ptr_eq(r, self);
  33333   listFreeS(keys);
  33334   listFreeS(values);
  33335   terminateO(self);
  33336 
  33337 END_TEST
  33338 
  33339 
  33340 START_TEST(zipCArrayCharSmallJsonT)
  33341 
  33342   smallJsont* r;
  33343   smallJsont *self = allocSmallJson();
  33344   const char* array1[] = {"a", "b", null};
  33345   char** array2;
  33346 
  33347   // non json array or dict
  33348   setTypeBoolO(self);
  33349   array2 = listCreateS("1");
  33350   r = zipCArrayCharO(self, array1, array2);
  33351   ck_assert_ptr_eq(r, NULL);
  33352   // json array
  33353   // zip arrays
  33354   //   empty self
  33355   freeO(self);
  33356   r       = zipCArrayCharO(self, array1, array2);
  33357   ck_assert_ptr_ne(r, NULL);
  33358   char *s = toStringO(r);
  33359   ck_assert_str_eq(s, "[[\"a\",\"1\"]]");
  33360   free(s);
  33361   freen(array2);
  33362   freeO(self);
  33363   // add an element to self
  33364   // array1 has 2 elements
  33365   // array2 has 3 elements
  33366   // only 2 elements are zipped
  33367   self->f->pushS(self, "qwe");
  33368   array2  = listCreateS("1", "2", "3");
  33369   r = zipCArrayCharO(self, array1, array2);
  33370   ck_assert_ptr_ne(r, NULL);
  33371   s = toStringO(r);
  33372   ck_assert_str_eq(s, "[\"qwe\",[\"a\",\"1\"],[\"b\",\"2\"]]");
  33373   free(s);
  33374   //    delete the element not in self
  33375   iListDelElemS(&array2, 2);
  33376   // empty arrays
  33377   iListRemoveS(&array2, 0, 2);
  33378   r = zipCArrayCharO(self, array1, array2);
  33379   ck_assert_ptr_ne(r, NULL);
  33380   s = toStringO(r);
  33381   ck_assert_str_eq(s, "[\"qwe\",[\"a\",\"1\"],[\"b\",\"2\"]]");
  33382   free(s);
  33383   array1[0] = null;
  33384   r = zipCArrayCharO(self, array1, array2);
  33385   ck_assert_ptr_ne(r, NULL);
  33386   s = toStringO(r);
  33387   ck_assert_str_eq(s, "[\"qwe\",[\"a\",\"1\"],[\"b\",\"2\"]]");
  33388   free(s);
  33389   free(array2);
  33390   // array1 and array2 same element count
  33391   array1[0] = "aa";
  33392   array1[1] = null;
  33393   array2 = listCreateS("11", "22");
  33394   r = zipCArrayCharO(self, array1, array2);
  33395   iListDelElemS(&array2, 1);
  33396   ck_assert_ptr_ne(r, NULL);
  33397   //  some elements were zipped
  33398   s = toStringO(self);
  33399   ck_assert_str_eq(s, "[\"qwe\",[\"a\",\"1\"],[\"b\",\"2\"],[\"aa\",\"11\"]]");
  33400   free(s);
  33401   // but an element is NULL
  33402   // NULL arrays
  33403   r = zipCArrayCharO(self, NULL, array2);
  33404   ck_assert_ptr_eq(r, NULL);
  33405   r = zipCArrayCharO(self, array1, NULL);
  33406   ck_assert_ptr_eq(r, NULL);
  33407   terminateO(self);
  33408   free(array2);
  33409   // json dict
  33410   self = allocSmallJson();
  33411   const char* keys[] = {"a", "b", "c", null};
  33412   char** values;
  33413   self->f->setInt(self, "", 1);
  33414   // 3 elements in keys
  33415   // 2 elements in values
  33416   // only 2 key/values are zipped
  33417   values = listCreateS("1", "2");
  33418   r = zipCArrayCharO(self, keys, values);
  33419   listFreeS(values);
  33420   ck_assert_ptr_ne(r, NULL);
  33421   s = toStringO(r);
  33422   ck_assert_str_eq(s, "{\"\":1,\"a\":\"1\",\"b\":\"2\"}");
  33423   free(s);
  33424   // empty values
  33425   listEmptyS(values);
  33426   r = zipCArrayCharO(self, keys, values);
  33427   ck_assert_ptr_eq(r, self);
  33428   listFreeS(values);
  33429   terminateO(self);
  33430 
  33431 END_TEST
  33432 
  33433 
  33434 START_TEST(zipArrayCCharSmallJsonT)
  33435 
  33436   smallJsont* r;
  33437   smallJsont *self = allocSmallJson();
  33438   char** array1;
  33439   const char* array2[] = {"1", "2", "3", null};
  33440 
  33441   // non json array or dict
  33442   setTypeBoolO(self);
  33443   array1 = listCreateS("a");
  33444   r = zipArrayCCharO(self, array1, array2);
  33445   ck_assert_ptr_eq(r, NULL);
  33446   // json array
  33447   // zip arrays
  33448   //   empty self
  33449   freeO(self);
  33450   r       = zipArrayCCharO(self, array1, array2);
  33451   ck_assert_ptr_ne(r, NULL);
  33452   char *s = toStringO(r);
  33453   ck_assert_str_eq(s, "[[\"a\",\"1\"]]");
  33454   free(s);
  33455   freen(array1);
  33456   freeO(self);
  33457   // add an element to self
  33458   // array1 has 2 elements
  33459   // array2 has 3 elements
  33460   // only 2 elements are zipped
  33461   self->f->pushS(self, "qwe");
  33462   array1  = listCreateS("a", "b");
  33463   r = zipArrayCCharO(self, array1, array2);
  33464   ck_assert_ptr_ne(r, NULL);
  33465   s = toStringO(r);
  33466   ck_assert_str_eq(s, "[\"qwe\",[\"a\",\"1\"],[\"b\",\"2\"]]");
  33467   free(s);
  33468   // empty arrays
  33469   array2[0] = null;
  33470   r = zipArrayCCharO(self, array1, array2);
  33471   ck_assert_ptr_ne(r, NULL);
  33472   s = toStringO(r);
  33473   ck_assert_str_eq(s, "[\"qwe\",[\"a\",\"1\"],[\"b\",\"2\"]]");
  33474   free(s);
  33475   iListRemoveS(&array1, 0, 2);
  33476   array2[0] = "11";
  33477   r = zipArrayCCharO(self, array1, array2);
  33478   ck_assert_ptr_ne(r, NULL);
  33479   s = toStringO(r);
  33480   ck_assert_str_eq(s, "[\"qwe\",[\"a\",\"1\"],[\"b\",\"2\"]]");
  33481   free(s);
  33482   free(array1);
  33483   // array1 and array2 same element count
  33484   array1 = listCreateS("aa", "bb");
  33485   array2[1] = "22";
  33486   iListDelElemS(&array1, 1);
  33487   r = zipArrayCCharO(self, array1, array2);
  33488   ck_assert_ptr_ne(r, NULL);
  33489   //  some elements were zipped
  33490   s = toStringO(self);
  33491   ck_assert_str_eq(s, "[\"qwe\",[\"a\",\"1\"],[\"b\",\"2\"],[\"aa\",\"11\"]]");
  33492   free(s);
  33493   // but an element is NULL
  33494   // NULL arrays
  33495   r = zipArrayCCharO(self, NULL, array2);
  33496   ck_assert_ptr_eq(r, NULL);
  33497   r = zipArrayCCharO(self, array1, NULL);
  33498   ck_assert_ptr_eq(r, NULL);
  33499   terminateO(self);
  33500   free(array1);
  33501   // json dict
  33502   self = allocSmallJson();
  33503   char** keys;
  33504   const char* values[] = {"1", "2", null};
  33505   self->f->setInt(self, "", 1);
  33506   // 3 elements in keys
  33507   // 2 elements in values
  33508   // only 2 key/values are zipped
  33509   keys   = listCreateS("a", "b", "c");
  33510   r = zipArrayCCharO(self, keys, values);
  33511   listFreeS(keys);
  33512   ck_assert_ptr_ne(r, NULL);
  33513   s = toStringO(r);
  33514   ck_assert_str_eq(s, "{\"\":1,\"a\":\"1\",\"b\":\"2\"}");
  33515   free(s);
  33516   // empty values
  33517   keys = listCreateS("a", "b", "c");
  33518   values[0] = null;
  33519   r = zipArrayCCharO(self, keys, values);
  33520   ck_assert_ptr_eq(r, self);
  33521   listFreeS(keys);
  33522   terminateO(self);
  33523 
  33524 END_TEST
  33525 
  33526 
  33527 START_TEST(zipCArrayCCharSmallJsonT)
  33528 
  33529   smallJsont* r;
  33530   smallJsont *self = allocSmallJson();
  33531   const char* array1[] = {"a", "b", null};
  33532   const char* array2[] = {"1", "2", "3", null};
  33533 
  33534   // non json array or dict
  33535   setTypeBoolO(self);
  33536   r = zipCArrayCCharO(self, array1, array2);
  33537   ck_assert_ptr_eq(r, NULL);
  33538   // json array
  33539   // zip arrays
  33540   //   empty self
  33541   freeO(self);
  33542   array1[1] = null;
  33543   r       = zipCArrayCCharO(self, array1, array2);
  33544   ck_assert_ptr_ne(r, NULL);
  33545   char *s = toStringO(r);
  33546   ck_assert_str_eq(s, "[[\"a\",\"1\"]]");
  33547   free(s);
  33548   freeO(self);
  33549   // add an element to self
  33550   // array1 has 2 elements
  33551   // array2 has 3 elements
  33552   // only 2 elements are zipped
  33553   self->f->pushS(self, "qwe");
  33554   array1[1] = "b";
  33555   r = zipCArrayCCharO(self, array1, array2);
  33556   ck_assert_ptr_ne(r, NULL);
  33557   s = toStringO(r);
  33558   ck_assert_str_eq(s, "[\"qwe\",[\"a\",\"1\"],[\"b\",\"2\"]]");
  33559   free(s);
  33560   // empty arrays
  33561   array2[0] = null;
  33562   r = zipCArrayCCharO(self, array1, array2);
  33563   ck_assert_ptr_ne(r, NULL);
  33564   s = toStringO(r);
  33565   ck_assert_str_eq(s, "[\"qwe\",[\"a\",\"1\"],[\"b\",\"2\"]]");
  33566   free(s);
  33567   array1[0] = null;
  33568   array2[0] = "11";
  33569   r = zipCArrayCCharO(self, array1, array2);
  33570   ck_assert_ptr_ne(r, NULL);
  33571   s = toStringO(r);
  33572   ck_assert_str_eq(s, "[\"qwe\",[\"a\",\"1\"],[\"b\",\"2\"]]");
  33573   free(s);
  33574   // array1 and array2 same element count
  33575   array1[0] = "aa";
  33576   array1[1] = null;
  33577   array2[1] = "22";
  33578   r = zipCArrayCCharO(self, array1, array2);
  33579   ck_assert_ptr_ne(r, NULL);
  33580   //  some elements were zipped
  33581   s = toStringO(self);
  33582   ck_assert_str_eq(s, "[\"qwe\",[\"a\",\"1\"],[\"b\",\"2\"],[\"aa\",\"11\"]]");
  33583   free(s);
  33584   // but an element is NULL
  33585   // NULL arrays
  33586   r = zipCArrayCCharO(self, NULL, array2);
  33587   ck_assert_ptr_eq(r, NULL);
  33588   r = zipCArrayCCharO(self, array1, NULL);
  33589   ck_assert_ptr_eq(r, NULL);
  33590   terminateO(self);
  33591   // json dict
  33592   self = allocSmallJson();
  33593   const char* keys[]   = {"a", "b", "c", null};
  33594   const char* values[] = {"1", "2", null};
  33595   self->f->setInt(self, "", 1);
  33596   // 3 elements in keys
  33597   // 2 elements in values
  33598   // only 2 key/values are zipped
  33599   r = zipCArrayCCharO(self, keys, values);
  33600   ck_assert_ptr_ne(r, NULL);
  33601   s = toStringO(r);
  33602   ck_assert_str_eq(s, "{\"\":1,\"a\":\"1\",\"b\":\"2\"}");
  33603   free(s);
  33604   // empty values
  33605   values[0] = null;
  33606   r = zipCArrayCCharO(self, keys, values);
  33607   ck_assert_ptr_eq(r, self);
  33608   terminateO(self);
  33609 
  33610 END_TEST
  33611 
  33612 
  33613 START_TEST(zipJsonSmallJsonT)
  33614 
  33615   smallJsont* r;
  33616   smallJsont *self   = allocSmallJson();
  33617   smallJsont *keys   = allocSmallJson();
  33618   smallJsont *values = allocSmallJson();
  33619 
  33620   // non json array or dict
  33621   setTypeBoolO(self);
  33622   r = self->f->zipJson(self, keys, values);
  33623   ck_assert_ptr_eq(r, NULL);
  33624   freeO(self);
  33625   // json array
  33626   smallJsont *array1 = allocSmallJson();
  33627   smallJsont *array2 = allocSmallJson();
  33628   // zip arrays
  33629   //   empty self
  33630   array1->f->pushS(array1, "a");
  33631   array2->f->pushInt(array2, 1);
  33632   r = self->f->zipJson(self, array1, array2);
  33633   ck_assert_ptr_ne(r, NULL);
  33634   char *s = toStringO(r);
  33635   ck_assert_str_eq(s, "[[\"a\",1]]");
  33636   free(s);
  33637   disposeO(array1);
  33638   disposeO(array2);
  33639   freeO(self);
  33640   // add an element to self
  33641   // array1 has 2 elements
  33642   // array2 has 3 elements
  33643   // only 2 elements are zipped
  33644   self->f->pushS(self, "qwe");
  33645   array1->f->pushS(array1, "a");
  33646   array1->f->pushS(array1, "b");
  33647   array2->f->pushInt(array2, 1);
  33648   array2->f->pushInt(array2, 2);
  33649   array2->f->pushInt(array2, 3);
  33650   r       = self->f->zipJson(self, array1, array2);
  33651   ck_assert_ptr_ne(r, NULL);
  33652   s = toStringO(r);
  33653   ck_assert_str_eq(s, "[\"qwe\",[\"a\",1],[\"b\",2]]");
  33654   free(s);
  33655   //    delete the element not in self
  33656   delElemIndexO(array2, 2);
  33657   // empty arrays
  33658   disposeO(array1);
  33659   r = self->f->zipJson(self, array1, array2);
  33660   ck_assert_ptr_eq(r, NULL);
  33661   disposeO(array2);
  33662   array1->f->pushS(array1, "a");
  33663   r = self->f->zipJson(self, array1, array2);
  33664   ck_assert_ptr_eq(r, NULL);
  33665   array2->f->pushInt(array2, 1);
  33666   delElemIndexO(array2, 0);
  33667   r = self->f->zipJson(self, array1, array2);
  33668   ck_assert_ptr_ne(r, NULL);
  33669   s = toStringO(r);
  33670   ck_assert_str_eq(s, "[\"qwe\",[\"a\",1],[\"b\",2],[\"a\"]]");
  33671   free(s);
  33672   disposeO(array1);
  33673   trimO(array2);
  33674   // array1 and array2 same element count
  33675   array1->f->pushS(array1, "aa");
  33676   array1->f->pushS(array1, "bb");
  33677   array2->f->pushInt(array2, 11);
  33678   array2->f->pushInt(array2, 22);
  33679   delElemIndexO(array1, 1);
  33680   r = self->f->zipJson(self, array1, array2);
  33681   delElemIndexO(array2, 1);
  33682   ck_assert_ptr_ne(r, NULL);
  33683   //  some elements were zipped
  33684   s = toStringO(self);
  33685   ck_assert_str_eq(s, "[\"qwe\",[\"a\",1],[\"b\",2],[\"a\"],[\"aa\",11]]");
  33686   free(s);
  33687   // but an element is NULL
  33688   // non smallJson objects
  33689   smashO(array1);
  33690   array1 = (smallJsont*) allocSmallInt(2);
  33691   r = self->f->zipJson(self, array1, array2);
  33692   ck_assert_ptr_eq(r, NULL);
  33693   terminateO(array1);
  33694   array1 = allocSmallJson();
  33695   smashO(array2);
  33696   array2 = (smallJsont*) allocSmallInt(2);
  33697   r = self->f->zipJson(self, array1, array2);
  33698   ck_assert_ptr_eq(r, NULL);
  33699   terminateO(array2);
  33700   array2 = allocSmallJson();
  33701   // NULL arrays
  33702   r = self->f->zipJson(self, NULL, array2);
  33703   ck_assert_ptr_eq(r, NULL);
  33704   r = self->f->zipJson(self, array1, NULL);
  33705   ck_assert_ptr_eq(r, NULL);
  33706   terminateO(self);
  33707   smashO(array1);
  33708   smashO(array2);
  33709   // json dict
  33710   self = allocSmallJson();
  33711   // zip arrays
  33712   self->f->setInt(self, "", 1);
  33713   // 3 elements in keys
  33714   // 2 elements in values
  33715   // only 2 key/values are zipped
  33716   keys->f->pushS(keys, "a");
  33717   keys->f->pushS(keys, "b");
  33718   keys->f->pushS(keys, "c");
  33719   values->f->pushInt(values, 1);
  33720   values->f->pushInt(values, 2);
  33721   r = self->f->zipJson(self, keys, values);
  33722   terminateO(keys);
  33723   smashO(values);
  33724   ck_assert_ptr_ne(r, NULL);
  33725   s = toStringO(r);
  33726   ck_assert_str_eq(s, "{\"\":1,\"a\":1,\"b\":2}");
  33727   free(s);
  33728   // keys array with non string objects
  33729   keys   = allocSmallJson();
  33730   values = allocSmallJson();
  33731   keys->f->pushInt(keys, 1);
  33732   values->f->pushInt(values, 1);
  33733   r = self->f->zipJson(self, keys, values);
  33734   ck_assert_ptr_eq(r, NULL);
  33735   terminateO(keys);
  33736   terminateO(values);
  33737   // empty values
  33738   keys   = allocSmallJson();
  33739   values = allocSmallJson();
  33740   keys->f->pushInt(keys, 1);
  33741   values->f->pushInt(values, 1);
  33742   delElemIndexO(values, 0);
  33743   trimO(values);
  33744   r = self->f->zipJson(self, keys, values);
  33745   ck_assert_ptr_eq(r, self);
  33746   terminateO(keys);
  33747   // non json array keys
  33748   keys   = allocSmallJson();
  33749   setTopIntO(keys, 1);
  33750   r = self->f->zipJson(self, keys, values);
  33751   ck_assert_ptr_eq(r, null);
  33752   terminateO(keys);
  33753   // non json array values
  33754   keys   = allocSmallJson();
  33755   keys->f->pushInt(keys, 1);
  33756   freeO(values);
  33757   setTopIntO(values, 1);
  33758   r = self->f->zipJson(self, keys, values);
  33759   ck_assert_ptr_eq(r, null);
  33760   terminateO(keys);
  33761   terminateO(values);
  33762   // non smallJson object
  33763   keys = (smallJsont*) allocSmallInt(1);
  33764   values = allocSmallJson();
  33765   r = self->f->zipJson(self, keys, values);
  33766   ck_assert_ptr_eq(r, null);
  33767   terminateO(keys);
  33768   keys   = allocSmallJson();
  33769   terminateO(values);
  33770   values = (smallJsont*) allocSmallInt(2);
  33771   r = self->f->zipJson(self, keys, values);
  33772   ck_assert_ptr_eq(r, null);
  33773   // null
  33774   r = self->f->zipJson(self, null, values);
  33775   ck_assert_ptr_eq(r, null);
  33776   r = self->f->zipJson(self, keys, null);
  33777   ck_assert_ptr_eq(r, null);
  33778   terminateO(keys);
  33779   terminateO(values);
  33780   terminateO(self);
  33781 
  33782 END_TEST
  33783 
  33784 
  33785 START_TEST(zipJsonSmallArraySmallJsonT)
  33786 
  33787   smallJsont* r;
  33788   smallJsont *self    = allocSmallJson();
  33789   smallJsont *keys    = allocSmallJson();
  33790   smallArrayt *values = allocSmallArray();
  33791   smallJsont *array1  = allocSmallJson();
  33792   smallArrayt *array2 = allocSmallArray();
  33793 
  33794   // non json array or dict
  33795   setTypeBoolO(self);
  33796   r = self->f->zipJsonSmallArray(self, array1, array2);
  33797   ck_assert_ptr_eq(r, NULL);
  33798   // json array
  33799   // zip arrays
  33800   //   empty self
  33801   freeO(self);
  33802   array1->f->pushS(array1, "a");
  33803   array2->f->pushInt(array2, 1);
  33804   r = self->f->zipJsonSmallArray(self, array1, array2);
  33805   ck_assert_ptr_ne(r, NULL);
  33806   char *s = toStringO(r);
  33807   ck_assert_str_eq(s, "[[\"a\",1]]");
  33808   free(s);
  33809   disposeO(array1);
  33810   disposeO(array2);
  33811   freeO(self);
  33812   // add an element to self
  33813   // array1 has 2 elements
  33814   // array2 has 3 elements
  33815   // only 2 elements are zipped
  33816   self->f->pushS(self, "qwe");
  33817   array1->f->pushS(array1, "a");
  33818   array1->f->pushS(array1, "b");
  33819   array2->f->pushInt(array2, 1);
  33820   array2->f->pushInt(array2, 2);
  33821   array2->f->pushInt(array2, 3);
  33822   r = self->f->zipJsonSmallArray(self, array1, array2);
  33823   ck_assert_ptr_ne(r, NULL);
  33824   s = toStringO(r);
  33825   ck_assert_str_eq(s, "[\"qwe\",[\"a\",1],[\"b\",2]]");
  33826   free(s);
  33827   //    delete the element not in self
  33828   delElemO(array2, 2);
  33829   // empty arrays
  33830   disposeO(array2);
  33831   r = self->f->zipJsonSmallArray(self, array1, array2);
  33832   ck_assert_ptr_ne(r, NULL);
  33833   s = toStringO(r);
  33834   ck_assert_str_eq(s, "[\"qwe\",[\"a\",1],[\"b\",2]]");
  33835   free(s);
  33836   disposeO(array1);
  33837   setTypeArrayO(array1);
  33838   r = self->f->zipJsonSmallArray(self, array1, array2);
  33839   ck_assert_ptr_ne(r, NULL);
  33840   s = toStringO(r);
  33841   ck_assert_str_eq(s, "[\"qwe\",[\"a\",1],[\"b\",2]]");
  33842   free(s);
  33843   // array1 and array2 same element count
  33844   array1->f->pushS(array1, "aa");
  33845   array1->f->pushS(array1, "bb");
  33846   array2->f->pushInt(array2, 11);
  33847   array2->f->pushInt(array2, 22);
  33848   delElemIndexO(array1, 1);
  33849   r = self->f->zipJsonSmallArray(self, array1, array2);
  33850   delElemO(array2, 1);
  33851   ck_assert_ptr_ne(r, NULL);
  33852   //  some elements were zipped
  33853   s = toStringO(self);
  33854   ck_assert_str_eq(s, "[\"qwe\",[\"a\",1],[\"b\",2],[\"aa\",11]]");
  33855   free(s);
  33856   // but an element is NULL
  33857   // non smallArray objects
  33858   smashO(array1);
  33859   array1 = (smallJsont*) allocSmallInt(2);
  33860   r = self->f->zipJsonSmallArray(self, array1, array2);
  33861   ck_assert_ptr_eq(r, NULL);
  33862   terminateO(array1);
  33863   array1 = allocSmallJson();
  33864   setTypeArrayO(array1);
  33865   smashO(array2);
  33866   array2 = (smallArrayt*) allocSmallInt(2);
  33867   r = self->f->zipJsonSmallArray(self, array1, array2);
  33868   ck_assert_ptr_eq(r, NULL);
  33869   terminateO(array2);
  33870   array2 = allocSmallArray();
  33871   // NULL arrays
  33872   r = self->f->zipJsonSmallArray(self, NULL, array2);
  33873   ck_assert_ptr_eq(r, NULL);
  33874   r = self->f->zipJsonSmallArray(self, array1, NULL);
  33875   ck_assert_ptr_eq(r, NULL);
  33876   terminateO(self);
  33877   smashO(array1);
  33878   smashO(array2);
  33879   // json dict
  33880   self = allocSmallJson();
  33881   self->f->setInt(self, "", 1);
  33882   // 3 elements in keys
  33883   // 2 elements in values
  33884   // only 2 key/values are zipped
  33885   keys->f->pushS(keys, "a");
  33886   keys->f->pushS(keys, "b");
  33887   keys->f->pushS(keys, "c");
  33888   values->f->pushInt(values, 1);
  33889   values->f->pushInt(values, 2);
  33890   r = self->f->zipJsonSmallArray(self, keys, values);
  33891   terminateO(keys);
  33892   smashO(values);
  33893   ck_assert_ptr_ne(r, NULL);
  33894   s = toStringO(r);
  33895   ck_assert_str_eq(s, "{\"\":1,\"a\":1,\"b\":2}");
  33896   free(s);
  33897   // keys array with non string objects
  33898   keys   = allocSmallJson();
  33899   values = allocSmallArray();
  33900   keys->f->pushInt(keys, 1);
  33901   values->f->pushInt(values, 1);
  33902   r = self->f->zipJsonSmallArray(self, keys, values);
  33903   ck_assert_ptr_eq(r, NULL);
  33904   terminateO(keys);
  33905   terminateO(values);
  33906   // empty values
  33907   keys   = allocSmallJson();
  33908   values = allocSmallArray();
  33909   keys->f->pushInt(keys, 1);
  33910   r = self->f->zipJsonSmallArray(self, keys, values);
  33911   ck_assert_ptr_eq(r, self);
  33912   terminateO(keys);
  33913   // non json array keys
  33914   keys   = allocSmallJson();
  33915   setTopIntO(keys, 1);
  33916   r = self->f->zipJsonSmallArray(self, keys, values);
  33917   ck_assert_ptr_eq(r, null);
  33918   terminateO(keys);
  33919   // non smallArray object
  33920   keys = (smallJsont*) allocSmallInt(1);
  33921   r = self->f->zipJsonSmallArray(self, keys, values);
  33922   ck_assert_ptr_eq(r, null);
  33923   terminateO(keys);
  33924   keys   = allocSmallJson();
  33925   terminateO(values);
  33926   values = (smallArrayt*) allocSmallInt(2);
  33927   r = self->f->zipJsonSmallArray(self, keys, values);
  33928   ck_assert_ptr_eq(r, null);
  33929   // null
  33930   r = self->f->zipJsonSmallArray(self, null, values);
  33931   ck_assert_ptr_eq(r, null);
  33932   r = self->f->zipJsonSmallArray(self, keys, null);
  33933   ck_assert_ptr_eq(r, null);
  33934   terminateO(keys);
  33935   terminateO(values);
  33936   terminateO(self);
  33937 
  33938 END_TEST
  33939 
  33940 
  33941 START_TEST(zipJsonArraySmallJsonT)
  33942 
  33943   smallJsont* r;
  33944   smallJsont *self = allocSmallJson();
  33945   smallJsont *keys = allocSmallJson();
  33946   char** values;
  33947   smallJsont *array1 = allocSmallJson();
  33948   char** array2;
  33949 
  33950   // non json array or dict
  33951   setTypeBoolO(self);
  33952   setTypeArrayO(array1);
  33953   array2 = listCreateS("1");
  33954   r = self->f->zipJsonArray(self, array1, array2);
  33955   ck_assert_ptr_eq(r, NULL);
  33956   // json array
  33957   // zip arrays
  33958   //   empty self
  33959   freeO(self);
  33960   array1->f->pushS(array1, "a");
  33961   r       = self->f->zipJsonArray(self, array1, array2);
  33962   ck_assert_ptr_ne(r, NULL);
  33963   char *s = toStringO(r);
  33964   ck_assert_str_eq(s, "[[\"a\",\"1\"]]");
  33965   free(s);
  33966   disposeO(array1);
  33967   freen(array2);
  33968   freeO(self);
  33969   // add an element to self
  33970   // array1 has 2 elements
  33971   // array2 has 3 elements
  33972   // only 2 elements are zipped
  33973   self->f->pushS(self, "qwe");
  33974   array1->f->pushS(array1, "a");
  33975   array1->f->pushS(array1, "b");
  33976   array2  = listCreateS("1", "2", "3");
  33977   r = self->f->zipJsonArray(self, array1, array2);
  33978   ck_assert_ptr_ne(r, NULL);
  33979   s = toStringO(r);
  33980   ck_assert_str_eq(s, "[\"qwe\",[\"a\",\"1\"],[\"b\",\"2\"]]");
  33981   free(s);
  33982   //    delete the element not in self
  33983   iListDelElemS(&array2, 2);
  33984   // empty arrays
  33985   iListRemoveS(&array2, 0, 2);
  33986   r = self->f->zipJsonArray(self, array1, array2);
  33987   ck_assert_ptr_ne(r, NULL);
  33988   s = toStringO(r);
  33989   ck_assert_str_eq(s, "[\"qwe\",[\"a\",\"1\"],[\"b\",\"2\"]]");
  33990   free(s);
  33991   disposeO(array1);
  33992   setTypeArrayO(array1);
  33993   r = self->f->zipJsonArray(self, array1, array2);
  33994   ck_assert_ptr_ne(r, NULL);
  33995   s = toStringO(r);
  33996   ck_assert_str_eq(s, "[\"qwe\",[\"a\",\"1\"],[\"b\",\"2\"]]");
  33997   free(s);
  33998   free(array2);
  33999   // array1 and array2 same element count
  34000   array1->f->pushS(array1, "aa");
  34001   array1->f->pushS(array1, "bb");
  34002   array2  = listCreateS("11", "22");
  34003   delElemIndexO(array1, 1);
  34004   r = self->f->zipJsonArray(self, array1, array2);
  34005   iListDelElemS(&array2, 1);
  34006   ck_assert_ptr_ne(r, NULL);
  34007   //  some elements were zipped
  34008   s = toStringO(self);
  34009   ck_assert_str_eq(s, "[\"qwe\",[\"a\",\"1\"],[\"b\",\"2\"],[\"aa\",\"11\"]]");
  34010   free(s);
  34011   // but an element is NULL
  34012   // non smallJson objects
  34013   smashO(array1);
  34014   array1 = (smallJsont*) allocSmallInt(2);
  34015   r = self->f->zipJsonArray(self, array1, array2);
  34016   ck_assert_ptr_eq(r, NULL);
  34017   terminateO(array1);
  34018   array1 = allocSmallJson();
  34019   setTypeArrayO(array1);
  34020   // NULL arrays
  34021   r = self->f->zipJsonArray(self, NULL, array2);
  34022   ck_assert_ptr_eq(r, NULL);
  34023   r = self->f->zipJsonArray(self, array1, NULL);
  34024   ck_assert_ptr_eq(r, NULL);
  34025   terminateO(self);
  34026   smashO(array1);
  34027   free(array2);
  34028   // json dict
  34029   self = allocSmallJson();
  34030   self->f->setInt(self, "", 1);
  34031   // 3 elements in keys
  34032   // 2 elements in values
  34033   // only 2 key/values are zipped
  34034   keys->f->pushS(keys, "a");
  34035   keys->f->pushS(keys, "b");
  34036   keys->f->pushS(keys, "c");
  34037   values = listCreateS("1", "2");
  34038   r = self->f->zipJsonArray(self, keys, values);
  34039   terminateO(keys);
  34040   listFreeS(values);
  34041   ck_assert_ptr_ne(r, NULL);
  34042   s = toStringO(r);
  34043   ck_assert_str_eq(s, "{\"\":1,\"a\":\"1\",\"b\":\"2\"}");
  34044   free(s);
  34045   // keys array with non string objects
  34046   keys   = allocSmallJson();
  34047   keys->f->pushInt(keys, 1);
  34048   values = listCreateS("1");
  34049   r = self->f->zipJsonArray(self, keys, values);
  34050   ck_assert_ptr_eq(r, NULL);
  34051   terminateO(keys);
  34052   listFreeS(values);
  34053   // empty values
  34054   keys   = allocSmallJson();
  34055   keys->f->pushInt(keys, 1);
  34056   listEmptyS(values);
  34057   r = self->f->zipJsonArray(self, keys, values);
  34058   ck_assert_ptr_eq(r, self);
  34059   terminateO(keys);
  34060   // non json array keys
  34061   keys   = allocSmallJson();
  34062   setTopIntO(keys, 1);
  34063   r = self->f->zipJsonArray(self, keys, values);
  34064   ck_assert_ptr_eq(r, null);
  34065   terminateO(keys);
  34066   // non smallArray object
  34067   keys = (smallJsont*) allocSmallInt(1);
  34068   r = self->f->zipJsonArray(self, keys, values);
  34069   ck_assert_ptr_eq(r, null);
  34070   terminateO(keys);
  34071   keys   = allocSmallJson();
  34072   // null
  34073   r = self->f->zipJsonArray(self, null, values);
  34074   ck_assert_ptr_eq(r, null);
  34075   r = self->f->zipJsonArray(self, keys, null);
  34076   ck_assert_ptr_eq(r, null);
  34077   terminateO(keys);
  34078   listFreeS(values);
  34079   terminateO(self);
  34080 
  34081 END_TEST
  34082 
  34083 
  34084 START_TEST(zipJsonCArraySmallJsonT)
  34085 
  34086   smallJsont* r;
  34087   smallJsont *self     = allocSmallJson();
  34088   smallJsont *keys     = allocSmallJson();
  34089   const char* values[] = {"1", "2", null};
  34090   smallJsont *array1   = allocSmallJson();
  34091   const char* array2[] = {"1", "2", "3", null};
  34092 
  34093   // non json array or dict
  34094   setTypeBoolO(self);
  34095   setTypeArrayO(array1);
  34096   r = self->f->zipJsonCArray(self, array1, array2);
  34097   ck_assert_ptr_eq(r, NULL);
  34098   // json array
  34099   // zip arrays
  34100   //   empty self
  34101   freeO(self);
  34102   array1->f->pushS(array1, "a");
  34103   r       = self->f->zipJsonCArray(self, array1, array2);
  34104   ck_assert_ptr_ne(r, NULL);
  34105   char *s = toStringO(r);
  34106   ck_assert_str_eq(s, "[[\"a\",\"1\"]]");
  34107   free(s);
  34108   disposeO(array1);
  34109   freeO(self);
  34110   // add an element to self
  34111   // array1 has 2 elements
  34112   // array2 has 3 elements
  34113   // only 2 elements are zipped
  34114   self->f->pushS(self, "qwe");
  34115   array1->f->pushS(array1, "a");
  34116   array1->f->pushS(array1, "b");
  34117   r = self->f->zipJsonCArray(self, array1, array2);
  34118   ck_assert_ptr_ne(r, NULL);
  34119   s = toStringO(r);
  34120   ck_assert_str_eq(s, "[\"qwe\",[\"a\",\"1\"],[\"b\",\"2\"]]");
  34121   free(s);
  34122   // empty arrays
  34123   array2[0] = null;
  34124   r = self->f->zipJsonCArray(self, array1, array2);
  34125   ck_assert_ptr_ne(r, NULL);
  34126   s = toStringO(r);
  34127   ck_assert_str_eq(s, "[\"qwe\",[\"a\",\"1\"],[\"b\",\"2\"]]");
  34128   free(s);
  34129   disposeO(array1);
  34130   setTypeArrayO(array1);
  34131   array2[0] = "11";
  34132   r = self->f->zipJsonCArray(self, array1, array2);
  34133   ck_assert_ptr_ne(r, NULL);
  34134   s = toStringO(r);
  34135   ck_assert_str_eq(s, "[\"qwe\",[\"a\",\"1\"],[\"b\",\"2\"]]");
  34136   free(s);
  34137   // array1 and array2 same element count
  34138   array1->f->pushS(array1, "aa");
  34139   array1->f->pushS(array1, "bb");
  34140   array2[1] = "22";
  34141   delElemIndexO(array1, 1);
  34142   r = self->f->zipJsonCArray(self, array1, array2);
  34143   ck_assert_ptr_ne(r, NULL);
  34144   //  some elements were zipped
  34145   s = toStringO(self);
  34146   ck_assert_str_eq(s, "[\"qwe\",[\"a\",\"1\"],[\"b\",\"2\"],[\"aa\",\"11\"]]");
  34147   free(s);
  34148   // but an element is NULL
  34149   // non smallJson objects
  34150   smashO(array1);
  34151   array1 = (smallJsont*) allocSmallInt(2);
  34152   r = self->f->zipJsonCArray(self, array1, array2);
  34153   ck_assert_ptr_eq(r, NULL);
  34154   terminateO(array1);
  34155   array1 = allocSmallJson();
  34156   setTypeArrayO(array1);
  34157   // NULL arrays
  34158   r = self->f->zipJsonCArray(self, NULL, array2);
  34159   ck_assert_ptr_eq(r, NULL);
  34160   r = self->f->zipJsonCArray(self, array1, NULL);
  34161   ck_assert_ptr_eq(r, NULL);
  34162   terminateO(self);
  34163   smashO(array1);
  34164   // json dict
  34165   self = allocSmallJson();
  34166   self->f->setInt(self, "", 1);
  34167   // 3 elements in keys
  34168   // 2 elements in values
  34169   // only 2 key/values are zipped
  34170   keys->f->pushS(keys, "a");
  34171   keys->f->pushS(keys, "b");
  34172   keys->f->pushS(keys, "c");
  34173   r = self->f->zipJsonCArray(self, keys, values);
  34174   terminateO(keys);
  34175   ck_assert_ptr_ne(r, NULL);
  34176   s = toStringO(r);
  34177   ck_assert_str_eq(s, "{\"\":1,\"a\":\"1\",\"b\":\"2\"}");
  34178   free(s);
  34179   // keys array with non string objects
  34180   keys   = allocSmallJson();
  34181   keys->f->pushInt(keys, 1);
  34182   r = self->f->zipJsonCArray(self, keys, values);
  34183   ck_assert_ptr_eq(r, NULL);
  34184   terminateO(keys);
  34185   // empty values
  34186   keys   = allocSmallJson();
  34187   keys->f->pushInt(keys, 1);
  34188   values[0] = null;
  34189   r = self->f->zipJsonCArray(self, keys, values);
  34190   ck_assert_ptr_eq(r, self);
  34191   values[0] = "1";
  34192   terminateO(keys);
  34193   // non json array keys
  34194   keys   = allocSmallJson();
  34195   setTopIntO(keys, 1);
  34196   r = self->f->zipJsonCArray(self, keys, values);
  34197   ck_assert_ptr_eq(r, null);
  34198   terminateO(keys);
  34199   // non smallArray object
  34200   keys = (smallJsont*) allocSmallInt(1);
  34201   r = self->f->zipJsonCArray(self, keys, values);
  34202   ck_assert_ptr_eq(r, null);
  34203   terminateO(keys);
  34204   keys   = allocSmallJson();
  34205   // null
  34206   r = self->f->zipJsonCArray(self, null, values);
  34207   ck_assert_ptr_eq(r, null);
  34208   r = self->f->zipJsonCArray(self, keys, null);
  34209   ck_assert_ptr_eq(r, null);
  34210   terminateO(keys);
  34211   terminateO(self);
  34212 
  34213 END_TEST
  34214 
  34215 
  34216 START_TEST(zipSmallArrayJsonSmallJsonT)
  34217 
  34218   smallJsont* r;
  34219   smallJsont *self   = allocSmallJson();
  34220   smallArrayt *keys  = allocSmallArray();
  34221   smallJsont *values = allocSmallJson();
  34222 
  34223   // non json array or dict
  34224   setTypeBoolO(self);
  34225   r = self->f->zipSmallArrayJson(self, keys, values);
  34226   ck_assert_ptr_eq(r, NULL);
  34227   freeO(self);
  34228   // json array
  34229   smallArrayt *array1 = allocSmallArray();
  34230   smallJsont *array2  = allocSmallJson();
  34231   // zip arrays
  34232   //   empty self
  34233   array1->f->pushS(array1, "a");
  34234   array2->f->pushInt(array2, 1);
  34235   r = self->f->zipSmallArrayJson(self, array1, array2);
  34236   ck_assert_ptr_ne(r, NULL);
  34237   char *s = toStringO(r);
  34238   ck_assert_str_eq(s, "[[\"a\",1]]");
  34239   free(s);
  34240   disposeO(array1);
  34241   disposeO(array2);
  34242   freeO(self);
  34243   // add an element to self
  34244   // array1 has 2 elements
  34245   // array2 has 3 elements
  34246   // only 2 elements are zipped
  34247   self->f->pushS(self, "qwe");
  34248   array1->f->pushS(array1, "a");
  34249   array1->f->pushS(array1, "b");
  34250   array2->f->pushInt(array2, 1);
  34251   array2->f->pushInt(array2, 2);
  34252   array2->f->pushInt(array2, 3);
  34253   r       = self->f->zipSmallArrayJson(self, array1, array2);
  34254   ck_assert_ptr_ne(r, NULL);
  34255   s = toStringO(r);
  34256   ck_assert_str_eq(s, "[\"qwe\",[\"a\",1],[\"b\",2]]");
  34257   free(s);
  34258   //    delete the element not in self
  34259   delElemIndexO(array2, 2);
  34260   // empty arrays
  34261   disposeO(array1);
  34262   r = self->f->zipSmallArrayJson(self, array1, array2);
  34263   ck_assert_ptr_ne(r, NULL);
  34264   s = toStringO(r);
  34265   ck_assert_str_eq(s, "[\"qwe\",[\"a\",1],[\"b\",2]]");
  34266   free(s);
  34267   disposeO(array2);
  34268   array1->f->pushS(array1, "a");
  34269   r = self->f->zipSmallArrayJson(self, array1, array2);
  34270   ck_assert_ptr_eq(r, NULL);
  34271   array2->f->pushInt(array2, 1);
  34272   delElemIndexO(array2, 0);
  34273   r = self->f->zipSmallArrayJson(self, array1, array2);
  34274   ck_assert_ptr_ne(r, NULL);
  34275   s = toStringO(r);
  34276   ck_assert_str_eq(s, "[\"qwe\",[\"a\",1],[\"b\",2],[\"a\"]]");
  34277   free(s);
  34278   disposeO(array1);
  34279   trimO(array2);
  34280   // array1 and array2 same element count
  34281   array1->f->pushS(array1, "aa");
  34282   array1->f->pushS(array1, "bb");
  34283   array2->f->pushInt(array2, 11);
  34284   array2->f->pushInt(array2, 22);
  34285   delElemO(array1, 1);
  34286   r = self->f->zipSmallArrayJson(self, array1, array2);
  34287   delElemIndexO(array2, 1);
  34288   ck_assert_ptr_ne(r, NULL);
  34289   //  some elements were zipped
  34290   s = toStringO(self);
  34291   ck_assert_str_eq(s, "[\"qwe\",[\"a\",1],[\"b\",2],[\"a\"],[\"aa\",11]]");
  34292   free(s);
  34293   // but an element is NULL
  34294   // non smallJson objects
  34295   smashO(array1);
  34296   array1 = (smallArrayt*) allocSmallInt(2);
  34297   r = self->f->zipSmallArrayJson(self, array1, array2);
  34298   ck_assert_ptr_eq(r, NULL);
  34299   terminateO(array1);
  34300   array1 = allocSmallArray();
  34301   smashO(array2);
  34302   array2 = (smallJsont*) allocSmallInt(2);
  34303   r = self->f->zipSmallArrayJson(self, array1, array2);
  34304   ck_assert_ptr_eq(r, NULL);
  34305   terminateO(array2);
  34306   array2 = allocSmallJson();
  34307   // NULL arrays
  34308   r = self->f->zipSmallArrayJson(self, NULL, array2);
  34309   ck_assert_ptr_eq(r, NULL);
  34310   r = self->f->zipSmallArrayJson(self, array1, NULL);
  34311   ck_assert_ptr_eq(r, NULL);
  34312   terminateO(self);
  34313   smashO(array1);
  34314   smashO(array2);
  34315   // json dict
  34316   self = allocSmallJson();
  34317   // zip arrays
  34318   self->f->setInt(self, "", 1);
  34319   // 3 elements in keys
  34320   // 2 elements in values
  34321   // only 2 key/values are zipped
  34322   keys->f->pushS(keys, "a");
  34323   keys->f->pushS(keys, "b");
  34324   keys->f->pushS(keys, "c");
  34325   values->f->pushInt(values, 1);
  34326   values->f->pushInt(values, 2);
  34327   r = self->f->zipSmallArrayJson(self, keys, values);
  34328   terminateO(keys);
  34329   smashO(values);
  34330   ck_assert_ptr_ne(r, NULL);
  34331   s = toStringO(r);
  34332   ck_assert_str_eq(s, "{\"\":1,\"a\":1,\"b\":2}");
  34333   free(s);
  34334   // keys array with non string objects
  34335   keys   = allocSmallArray();
  34336   values = allocSmallJson();
  34337   keys->f->pushInt(keys, 1);
  34338   values->f->pushInt(values, 1);
  34339   r = self->f->zipSmallArrayJson(self, keys, values);
  34340   ck_assert_ptr_eq(r, NULL);
  34341   terminateO(keys);
  34342   terminateO(values);
  34343   // empty values
  34344   keys   = allocSmallArray();
  34345   values = allocSmallJson();
  34346   keys->f->pushInt(keys, 1);
  34347   values->f->pushInt(values, 1);
  34348   delElemIndexO(values, 0);
  34349   trimO(values);
  34350   r = self->f->zipSmallArrayJson(self, keys, values);
  34351   ck_assert_ptr_eq(r, self);
  34352   terminateO(keys);
  34353   // non smallArray object
  34354   keys = (smallArrayt*) allocSmallInt(1);
  34355   r = self->f->zipSmallArrayJson(self, keys, values);
  34356   ck_assert_ptr_eq(r, null);
  34357   terminateO(keys);
  34358   keys   = allocSmallArray();
  34359   terminateO(values);
  34360   // non json array
  34361   values = allocSmallJson();
  34362   setTopIntO(values, 1);
  34363   r = self->f->zipSmallArrayJson(self, keys, values);
  34364   ck_assert_ptr_eq(r, null);
  34365   terminateO(values);
  34366   // non smallJson values
  34367   values = (smallJsont*) allocSmallInt(2);
  34368   r = self->f->zipSmallArrayJson(self, keys, values);
  34369   ck_assert_ptr_eq(r, null);
  34370   // null
  34371   r = self->f->zipSmallArrayJson(self, null, values);
  34372   ck_assert_ptr_eq(r, null);
  34373   r = self->f->zipSmallArrayJson(self, keys, null);
  34374   ck_assert_ptr_eq(r, null);
  34375   terminateO(keys);
  34376   terminateO(values);
  34377   terminateO(self);
  34378 
  34379 END_TEST
  34380 
  34381 
  34382 START_TEST(zipArrayJsonSmallJsonT)
  34383 
  34384   smallJsont* r;
  34385   smallJsont *self   = allocSmallJson();
  34386   char** keys;
  34387   smallJsont *values = allocSmallJson();
  34388   char** array1;
  34389   smallJsont *array2 = allocSmallJson();
  34390 
  34391   // non json array or dict
  34392   setTypeBoolO(self);
  34393   array1 = listCreateS("a");
  34394   r = self->f->zipArrayJson(self, array1, array2);
  34395   ck_assert_ptr_eq(r, NULL);
  34396   // json array
  34397   // zip arrays
  34398   //   empty self
  34399   freeO(self);
  34400   array2->f->pushInt(array2, 1);
  34401   r       = self->f->zipArrayJson(self, array1, array2);
  34402   ck_assert_ptr_ne(r, NULL);
  34403   char *s = toStringO(r);
  34404   ck_assert_str_eq(s, "[[\"a\",1]]");
  34405   free(s);
  34406   freen(array1);
  34407   disposeO(array2);
  34408   freeO(self);
  34409   // add an element to self
  34410   // array1 has 2 elements
  34411   // array2 has 3 elements
  34412   // only 2 elements are zipped
  34413   self->f->pushS(self, "qwe");
  34414   array1  = listCreateS("a", "b");
  34415   array2->f->pushInt(array2, 1);
  34416   array2->f->pushInt(array2, 2);
  34417   array2->f->pushInt(array2, 3);
  34418   r = self->f->zipArrayJson(self, array1, array2);
  34419   ck_assert_ptr_ne(r, NULL);
  34420   s = toStringO(r);
  34421   ck_assert_str_eq(s, "[\"qwe\",[\"a\",1],[\"b\",2]]");
  34422   free(s);
  34423   //    delete the element not in self
  34424   delElemIndexO(array2, 2);
  34425   // empty arrays
  34426   disposeO(array2);
  34427   setTypeArrayO(array2);
  34428   r = self->f->zipArrayJson(self, array1, array2);
  34429   ck_assert_ptr_ne(r, NULL);
  34430   s = toStringO(r);
  34431   ck_assert_str_eq(s, "[\"qwe\",[\"a\",1],[\"b\",2]]");
  34432   free(s);
  34433   iListRemoveS(&array1, 0, 2);
  34434   r = self->f->zipArrayJson(self, array1, array2);
  34435   free(array1);
  34436   ck_assert_ptr_ne(r, NULL);
  34437   s = toStringO(r);
  34438   ck_assert_str_eq(s, "[\"qwe\",[\"a\",1],[\"b\",2]]");
  34439   free(s);
  34440   // array1 and array2 same element count
  34441   array1 = listCreateS("aa", "bb");
  34442   array2->f->pushInt(array2, 11);
  34443   array2->f->pushInt(array2, 22);
  34444   iListDelElemS(&array1, 1);
  34445   r = self->f->zipArrayJson(self, array1, array2);
  34446   delElemIndexO(array2, 1);
  34447   ck_assert_ptr_ne(r, NULL);
  34448   //  some elements were zipped
  34449   s = toStringO(self);
  34450   ck_assert_str_eq(s, "[\"qwe\",[\"a\",1],[\"b\",2],[\"aa\",11]]");
  34451   free(s);
  34452   // but an element is NULL
  34453   // non smallArray objects
  34454   smashO(array2);
  34455   array2 = (smallJsont*) allocSmallInt(2);
  34456   r = self->f->zipArrayJson(self, array1, array2);
  34457   ck_assert_ptr_eq(r, NULL);
  34458   terminateO(array2);
  34459   array2 = allocSmallJson();
  34460   // NULL arrays
  34461   r = self->f->zipArrayJson(self, NULL, array2);
  34462   ck_assert_ptr_eq(r, NULL);
  34463   r = self->f->zipArrayJson(self, array1, NULL);
  34464   ck_assert_ptr_eq(r, NULL);
  34465   terminateO(self);
  34466   free(array1);
  34467   smashO(array2);
  34468   // json dict
  34469   self = allocSmallJson();
  34470   self->f->setInt(self, "", 1);
  34471   // 3 elements in keys
  34472   // 2 elements in values
  34473   // only 2 key/values are zipped
  34474   keys = listCreateS("a", "b", "c");
  34475   values->f->pushInt(values, 1);
  34476   values->f->pushInt(values, 2);
  34477   r = self->f->zipArrayJson(self, keys, values);
  34478   listFreeS(keys);
  34479   smashO(values);
  34480   ck_assert_ptr_ne(r, NULL);
  34481   s = toStringO(r);
  34482   ck_assert_str_eq(s, "{\"\":1,\"a\":1,\"b\":2}");
  34483   free(s);
  34484   // empty values
  34485   keys   = listCreateS("a");
  34486   values = allocSmallJson();
  34487   values->f->pushInt(values, 1);
  34488   delElemIndexO(values, 0);
  34489   trimO(values);
  34490   r = self->f->zipArrayJson(self, keys, values);
  34491   ck_assert_ptr_eq(r, self);
  34492   terminateO(values);
  34493   // non json array
  34494   values = allocSmallJson();
  34495   setTopIntO(values, 1);
  34496   r = self->f->zipArrayJson(self, keys, values);
  34497   ck_assert_ptr_eq(r, null);
  34498   terminateO(values);
  34499   // non smallJson values
  34500   values = (smallJsont*) allocSmallInt(2);
  34501   r = self->f->zipArrayJson(self, keys, values);
  34502   ck_assert_ptr_eq(r, null);
  34503   // null
  34504   r = self->f->zipArrayJson(self, null, values);
  34505   ck_assert_ptr_eq(r, null);
  34506   r = self->f->zipArrayJson(self, keys, null);
  34507   ck_assert_ptr_eq(r, null);
  34508   listFreeS(keys);
  34509   terminateO(values);
  34510   terminateO(self);
  34511 
  34512 END_TEST
  34513 
  34514 
  34515 START_TEST(zipCArrayJsonSmallJsonT)
  34516 
  34517   smallJsont* r;
  34518   smallJsont *self   = allocSmallJson();
  34519   const char* keys[] = {"a", "b", "c", null};
  34520   smallJsont *values = allocSmallJson();
  34521   const char* array1[] = {"a", "b", null};
  34522   smallJsont *array2 = allocSmallJson();
  34523 
  34524   // non json array or dict
  34525   setTypeBoolO(self);
  34526   r = self->f->zipCArrayJson(self, array1, array2);
  34527   ck_assert_ptr_eq(r, NULL);
  34528   // json array
  34529   // zip arrays
  34530   //   empty self
  34531   freeO(self);
  34532   array2->f->pushInt(array2, 1);
  34533   r       = self->f->zipCArrayJson(self, array1, array2);
  34534   ck_assert_ptr_ne(r, NULL);
  34535   char *s = toStringO(r);
  34536   ck_assert_str_eq(s, "[[\"a\",1]]");
  34537   free(s);
  34538   disposeO(array2);
  34539   freeO(self);
  34540   // add an element to self
  34541   // array1 has 2 elements
  34542   // array2 has 3 elements
  34543   // only 2 elements are zipped
  34544   self->f->pushS(self, "qwe");
  34545   array2->f->pushInt(array2, 1);
  34546   array2->f->pushInt(array2, 2);
  34547   array2->f->pushInt(array2, 3);
  34548   r = self->f->zipCArrayJson(self, array1, array2);
  34549   ck_assert_ptr_ne(r, NULL);
  34550   s = toStringO(r);
  34551   ck_assert_str_eq(s, "[\"qwe\",[\"a\",1],[\"b\",2]]");
  34552   free(s);
  34553   //    delete the element not in self
  34554   delElemIndexO(array2, 2);
  34555   // empty arrays
  34556   disposeO(array2);
  34557   setTypeArrayO(array2);
  34558   r = self->f->zipCArrayJson(self, array1, array2);
  34559   ck_assert_ptr_ne(r, NULL);
  34560   s = toStringO(r);
  34561   ck_assert_str_eq(s, "[\"qwe\",[\"a\",1],[\"b\",2]]");
  34562   free(s);
  34563   array1[0] = null;
  34564   r = self->f->zipCArrayJson(self, array1, array2);
  34565   ck_assert_ptr_ne(r, NULL);
  34566   s = toStringO(r);
  34567   ck_assert_str_eq(s, "[\"qwe\",[\"a\",1],[\"b\",2]]");
  34568   free(s);
  34569   // array1 and array2 same element count
  34570   array1[0] = "aa";
  34571   array1[1] = null;
  34572   array2->f->pushInt(array2, 11);
  34573   array2->f->pushInt(array2, 22);
  34574   r = self->f->zipCArrayJson(self, array1, array2);
  34575   delElemIndexO(array2, 1);
  34576   ck_assert_ptr_ne(r, NULL);
  34577   //  some elements were zipped
  34578   s = toStringO(self);
  34579   ck_assert_str_eq(s, "[\"qwe\",[\"a\",1],[\"b\",2],[\"aa\",11]]");
  34580   free(s);
  34581   // but an element is NULL
  34582   // non smallArray objects
  34583   smashO(array2);
  34584   array2 = (smallJsont*) allocSmallInt(2);
  34585   r = self->f->zipCArrayJson(self, array1, array2);
  34586   ck_assert_ptr_eq(r, NULL);
  34587   terminateO(array2);
  34588   array2 = allocSmallJson();
  34589   // NULL arrays
  34590   r = self->f->zipCArrayJson(self, NULL, array2);
  34591   ck_assert_ptr_eq(r, NULL);
  34592   r = self->f->zipCArrayJson(self, array1, NULL);
  34593   ck_assert_ptr_eq(r, NULL);
  34594   terminateO(self);
  34595   smashO(array2);
  34596   // json dict
  34597   self = allocSmallJson();
  34598   self->f->setInt(self, "", 1);
  34599   // 3 elements in keys
  34600   // 2 elements in values
  34601   // only 2 key/values are zipped
  34602   values->f->pushInt(values, 1);
  34603   values->f->pushInt(values, 2);
  34604   r = self->f->zipCArrayJson(self, keys, values);
  34605   smashO(values);
  34606   ck_assert_ptr_ne(r, NULL);
  34607   s = toStringO(r);
  34608   ck_assert_str_eq(s, "{\"\":1,\"a\":1,\"b\":2}");
  34609   free(s);
  34610   // empty values
  34611   values = allocSmallJson();
  34612   values->f->pushInt(values, 1);
  34613   delElemIndexO(values, 0);
  34614   trimO(values);
  34615   r = self->f->zipCArrayJson(self, keys, values);
  34616   ck_assert_ptr_eq(r, self);
  34617   terminateO(values);
  34618   // non json array
  34619   values = allocSmallJson();
  34620   setTopIntO(values, 1);
  34621   r = self->f->zipCArrayJson(self, keys, values);
  34622   ck_assert_ptr_eq(r, null);
  34623   terminateO(values);
  34624   // non smallJson values
  34625   values = (smallJsont*) allocSmallInt(2);
  34626   r = self->f->zipCArrayJson(self, keys, values);
  34627   ck_assert_ptr_eq(r, null);
  34628   // null
  34629   r = self->f->zipCArrayJson(self, null, values);
  34630   ck_assert_ptr_eq(r, null);
  34631   r = self->f->zipCArrayJson(self, keys, null);
  34632   ck_assert_ptr_eq(r, null);
  34633   terminateO(values);
  34634   terminateO(self);
  34635 
  34636 END_TEST
  34637 
  34638 
  34639 START_TEST(iterStartSmallJsonT)
  34640 
  34641   baset* r;
  34642   smallJsont *self = allocSmallJson();
  34643 
  34644   // non json array or dict
  34645   setTypeBoolO(self);
  34646   r = iterStartO(self);
  34647   ck_assert_ptr_eq(r, NULL);
  34648   freeO(self);
  34649   // json array
  34650   // array with sObjects
  34651   self->f->pushUndefined(self);
  34652   self->f->pushBool(self, true);
  34653   r = iterStartO(self);
  34654   ck_assert_ptr_ne(r, NULL);
  34655   ck_assert(isOUndefined(r));
  34656   // start again
  34657   r = iterStartO(self);
  34658   ck_assert_ptr_ne(r, NULL);
  34659   ck_assert(isOUndefined(r));
  34660   // array with objects from other classes
  34661   emptyO(self);
  34662   createAllocateSmallInt(ip);
  34663   ip->type = "anothertype";
  34664   setValG(ip, 11);
  34665   smallJsont *r2 = self->f->push(self, (baset*)ip);
  34666   ck_assert_ptr_ne(r2, NULL);
  34667   r = iterStartO(self);
  34668   ck_assert_ptr_ne(r, NULL);
  34669   // array with all deleted elements
  34670   emptyO(self);
  34671   self->f->pushUndefined(self);
  34672   delElemIndexO(self, 0);
  34673   r = iterStartO(self);
  34674   ck_assert_ptr_eq(r, NULL);
  34675   // empty array
  34676   emptyO(self);
  34677   r = iterStartO(self);
  34678   ck_assert_ptr_eq(r, NULL);
  34679   terminateO(self);
  34680   // json dict
  34681   self = allocSmallJson();
  34682   // dict with keys and values
  34683   self->f->setInt(self, "a", 1);
  34684   self->f->setInt(self, "b", 2);
  34685   r = iterStartO(self);
  34686   ck_assert_ptr_ne(r, NULL);
  34687   ck_assert(isOSmallInt(r));
  34688   // dict with objects from other classes
  34689   emptyO(self);
  34690   ip = allocSmallInt(2);
  34691   ip->type = "anothertype";
  34692   self->f->set(self, "d", (baset*)ip);
  34693   r = iterStartO(self);
  34694   ck_assert_ptr_ne(r, NULL);
  34695   // dict with deleted elements
  34696   self->f->setInt(self, "a", 1);
  34697   self->f->delElem(self, "d");
  34698   r = iterStartO(self);
  34699   ck_assert_ptr_ne(r, NULL);
  34700   // call iterStart again to trigger if (self->iterElementDataType != SH_DT_BASET) finishO(self->iterElement);
  34701   r = iterStartO(self);
  34702   ck_assert_ptr_ne(r, NULL);
  34703   // empty self
  34704   emptyO(self);
  34705   r = iterStartO(self);
  34706   ck_assert_ptr_eq(r, NULL);
  34707   emptyO(self);
  34708   r = iterStartO(self);
  34709   ck_assert_ptr_eq(r, NULL);
  34710   terminateO(self);
  34711 
  34712 END_TEST
  34713 
  34714 
  34715 START_TEST(iterStartKeySmallJsonT)
  34716 
  34717   const char* r;
  34718   smallJsont *self = allocSmallJson();
  34719 
  34720   // non json dict
  34721   r = iterStartKeyO(self);
  34722   ck_assert_ptr_eq(r, NULL);
  34723   // json dict
  34724   // dict with keys and values
  34725   self->f->setInt(self, "a", 1);
  34726   self->f->setInt(self, "b", 2);
  34727   r = iterStartKeyO(self);
  34728   ck_assert_ptr_ne(r, NULL);
  34729   ck_assert_str_eq(r, "a");
  34730   // dict with objects from other classes
  34731   emptyO(self);
  34732   smallIntt *ip = allocSmallInt(2);
  34733   ip->type = "anothertype";
  34734   self->f->set(self, "d", (baset*)ip);
  34735   r = iterStartKeyO(self);
  34736   ck_assert_ptr_ne(r, NULL);
  34737   ck_assert_str_eq(r, "d");
  34738   // dict with deleted elements
  34739   self->f->setInt(self, "a", 1);
  34740   self->f->delElem(self, "d");
  34741   r = iterStartKeyO(self);
  34742   ck_assert_ptr_ne(r, NULL);
  34743   ck_assert_str_eq(r, "a");
  34744   // call iterStart again to trigger if (self->iterElementDataType != SH_DT_BASET) finishO(self->iterElement);
  34745   r = iterStartKeyO(self);
  34746   ck_assert_ptr_ne(r, NULL);
  34747   ck_assert_str_eq(r, "a");
  34748   // empty self
  34749   emptyO(self);
  34750   r = iterStartKeyO(self);
  34751   ck_assert_ptr_eq(r, NULL);
  34752   terminateO(self);
  34753 
  34754 END_TEST
  34755 
  34756 
  34757 START_TEST(iterStartLastSmallJsonT)
  34758 
  34759   baset* r;
  34760   smallJsont *self = allocSmallJson();
  34761 
  34762   // non json array
  34763   r = iterStartLastO(self);
  34764   ck_assert_ptr_eq(r, NULL);
  34765   // array with sObjects
  34766   self->f->pushUndefined(self);
  34767   self->f->pushBool(self, true);
  34768   r = iterStartLastO(self);
  34769   ck_assert_ptr_ne(r, NULL);
  34770   ck_assert(isOSmallBool(r));
  34771   // start again
  34772   r = iterStartLastO(self);
  34773   ck_assert_ptr_ne(r, NULL);
  34774   ck_assert(isOSmallBool(r));
  34775   // array with objects from other classes
  34776   emptyO(self);
  34777   createAllocateSmallInt(ip);
  34778   ip->type = "anothertype";
  34779   setValG(ip, 11);
  34780   smallJsont *r2 = self->f->push(self, (baset*)ip);
  34781   ck_assert_ptr_ne(r2, NULL);
  34782   r = iterStartLastO(self);
  34783   ck_assert_ptr_ne(r, NULL);
  34784   ck_assert(isOType(r, "anothertype"));
  34785   // array with all deleted elements
  34786   emptyO(self);
  34787   self->f->pushUndefined(self);
  34788   delElemIndexO(self, 0);
  34789   r = iterStartLastO(self);
  34790   ck_assert_ptr_eq(r, NULL);
  34791   // empty array
  34792   emptyO(self);
  34793   r = iterStartLastO(self);
  34794   ck_assert_ptr_eq(r, NULL);
  34795   terminateO(self);
  34796 
  34797 END_TEST
  34798 
  34799 
  34800 START_TEST(iterStartFromSmallJsonT)
  34801 
  34802   baset* r;
  34803   smallJsont *self = allocSmallJson();
  34804 
  34805   // non json array
  34806   r = iterStartFromO(self, 0);
  34807   ck_assert_ptr_eq(r, NULL);
  34808   // array with sObjects
  34809   self->f->pushUndefined(self);
  34810   self->f->pushBool(self, true);
  34811   r = iterStartFromO(self, 1);
  34812   ck_assert_ptr_ne(r, NULL);
  34813   ck_assert(isOSmallBool(r));
  34814   // start again
  34815   r = iterStartFromO(self, 1);
  34816   ck_assert_ptr_ne(r, NULL);
  34817   ck_assert(isOSmallBool(r));
  34818   // array with objects from other classes
  34819   emptyO(self);
  34820   self->f->pushUndefined(self);
  34821   createAllocateSmallInt(ip);
  34822   ip->type = "anothertype";
  34823   setValG(ip, 11);
  34824   smallJsont *r2 = self->f->push(self, (baset*)ip);
  34825   ck_assert_ptr_ne(r2, NULL);
  34826   r = iterStartFromO(self, -1);
  34827   ck_assert_ptr_ne(r, NULL);
  34828   ck_assert(isOType(r, "anothertype"));
  34829   // index outside array
  34830   r = iterStartFromO(self, 2);
  34831   ck_assert_ptr_eq(r, NULL);
  34832   r = iterStartFromO(self, -3);
  34833   ck_assert_ptr_eq(r, NULL);
  34834   // array with all deleted elements
  34835   // except the ones before the start index
  34836   emptyO(self);
  34837   self->f->pushUndefined(self);
  34838   self->f->pushUndefined(self);
  34839   self->f->pushUndefined(self);
  34840   delElemIndexO(self, 1);
  34841   delElemIndexO(self, 2);
  34842   r = iterStartFromO(self, 1);
  34843   ck_assert_ptr_eq(r, NULL);
  34844   // array with all deleted elements
  34845   emptyO(self);
  34846   self->f->pushUndefined(self);
  34847   self->f->pushUndefined(self);
  34848   self->f->pushUndefined(self);
  34849   delElemIndexO(self, 0);
  34850   delElemIndexO(self, 1);
  34851   delElemIndexO(self, 2);
  34852   r = iterStartFromO(self, 1);
  34853   ck_assert_ptr_eq(r, NULL);
  34854   // empty array
  34855   emptyO(self);
  34856   r = iterStartFromO(self, 1);
  34857   ck_assert_ptr_eq(r, NULL);
  34858   terminateO(self);
  34859 
  34860 END_TEST
  34861 
  34862 
  34863 START_TEST(iterStartFromStepSmallJsonT)
  34864 
  34865   baset* r;
  34866   smallJsont *self = allocSmallJson();
  34867 
  34868   // non json array
  34869   r = iterStartFromStepO(self, 0, 1);
  34870   ck_assert_ptr_eq(r, NULL);
  34871   // array with sObjects
  34872   self->f->pushUndefined(self);
  34873   self->f->pushBool(self, true);
  34874   r = iterStartFromStepO(self, 1, 2);
  34875   ck_assert_ptr_ne(r, NULL);
  34876   ck_assert(isOSmallBool(r));
  34877   // start again
  34878   r = iterStartFromStepO(self, 1, 2);
  34879   ck_assert_ptr_ne(r, NULL);
  34880   ck_assert(isOSmallBool(r));
  34881   // array with objects from other classes
  34882   emptyO(self);
  34883   self->f->pushUndefined(self);
  34884   createAllocateSmallInt(ip);
  34885   ip->type = "anothertype";
  34886   setValG(ip, 11);
  34887   smallJsont *r2 = self->f->push(self, (baset*)ip);
  34888   ck_assert_ptr_ne(r2, NULL);
  34889   r = iterStartFromStepO(self, -1, 2);
  34890   ck_assert_ptr_ne(r, NULL);
  34891   ck_assert(isOType(r, "anothertype"));
  34892   // index outside array
  34893   r = iterStartFromStepO(self, 2, 1);
  34894   ck_assert_ptr_eq(r, NULL);
  34895   r = iterStartFromStepO(self, -3, 1);
  34896   ck_assert_ptr_eq(r, NULL);
  34897   // array with all deleted elements
  34898   // except the ones before the start index
  34899   emptyO(self);
  34900   self->f->pushUndefined(self);
  34901   self->f->pushUndefined(self);
  34902   self->f->pushUndefined(self);
  34903   delElemIndexO(self, 1);
  34904   delElemIndexO(self, 2);
  34905   r = iterStartFromStepO(self, 1, 1);
  34906   ck_assert_ptr_eq(r, NULL);
  34907   //    negative step
  34908   r = iterStartFromStepO(self, 1, -1);
  34909   ck_assert_ptr_ne(r, NULL);
  34910   ck_assert(isOUndefined(r));
  34911   // array with all deleted elements
  34912   emptyO(self);
  34913   self->f->pushUndefined(self);
  34914   self->f->pushUndefined(self);
  34915   self->f->pushUndefined(self);
  34916   delElemIndexO(self, 0);
  34917   delElemIndexO(self, 1);
  34918   delElemIndexO(self, 2);
  34919   r = iterStartFromStepO(self, 1, 2);
  34920   ck_assert_ptr_eq(r, NULL);
  34921   // empty array
  34922   emptyO(self);
  34923   r = iterStartFromStepO(self, 1, 1);
  34924   ck_assert_ptr_eq(r, NULL);
  34925   // step 0
  34926   self->f->pushUndefined(self);
  34927   r = iterStartFromStepO(self, 0, 0);
  34928   ck_assert_ptr_eq(r, NULL);
  34929   terminateO(self);
  34930 
  34931 END_TEST
  34932 
  34933 
  34934 START_TEST(iterNextSmallJsonT)
  34935 
  34936   baset* r;
  34937   smallJsont *self = allocSmallJson();
  34938 
  34939   // json array
  34940   // array with sObjects
  34941   self->f->pushUndefined(self);
  34942   self->f->pushBool(self, true);
  34943   r = iterStartO(self);
  34944   ck_assert_ptr_ne(r, NULL);
  34945   ck_assert(isOUndefined(r));
  34946   r = iterNextO(self);
  34947   ck_assert(isOSmallBool(r));
  34948   // array with objects from other classes
  34949   emptyO(self);
  34950   createAllocateSmallInt(ip);
  34951   ip->type = "anothertype";
  34952   setValG(ip, 11);
  34953   smallJsont *r2 = self->f->push(self, (baset*)ip);
  34954   ck_assert_ptr_ne(r2, NULL);
  34955   createAllocateSmallInt(ip2);
  34956   ip2->type = "anothertype2";
  34957   setValG(ip2, 11);
  34958   r2        = self->f->push(self, (baset*)ip2);
  34959   ck_assert_ptr_ne(r2, NULL);
  34960   r = iterStartO(self);
  34961   ck_assert_ptr_ne(r, NULL);
  34962   ck_assert(isOType(r, "anothertype"));
  34963   r = iterNextO(self);
  34964   ck_assert_ptr_ne(r, NULL);
  34965   ck_assert_str_eq(r->type, "anothertype2");
  34966   //    iteration ended
  34967   r = iterNextO(self);
  34968   ck_assert_ptr_eq(r, NULL);
  34969   // array with all deleted elements
  34970   emptyO(self);
  34971   self->f->pushUndefined(self);
  34972   delElemIndexO(self, 0);
  34973   r = iterStartO(self);
  34974   ck_assert_ptr_eq(r, NULL);
  34975   // empty array
  34976   emptyO(self);
  34977   r = iterStartO(self);
  34978   ck_assert_ptr_eq(r, NULL);
  34979   // empty array, uninitialized iterator
  34980   emptyO(self);
  34981   r = iterNextO(self);
  34982   ck_assert_ptr_eq(r, NULL);
  34983   terminateO(self);
  34984   // json dict
  34985   self = allocSmallJson();
  34986   // dict with keys and values
  34987   self->f->setInt(self, "a", 1);
  34988   self->f->setInt(self, "b", 2);
  34989   r = iterStartO(self);
  34990   ck_assert_ptr_ne(r, NULL);
  34991   ck_assert(isOSmallInt(r));
  34992   smallIntt *i = (smallIntt*)r;
  34993   ck_assert_int_eq(getValO(i), 1);
  34994   r = iterNextO(self);
  34995   ck_assert_ptr_ne(r, NULL);
  34996   ck_assert(isOSmallInt(r));
  34997   i = (smallIntt*)r;
  34998   ck_assert_int_eq(getValO(i), 2);
  34999   // dict with objects from other classes
  35000   emptyO(self);
  35001   ip = allocSmallInt(2);
  35002   ip->type = "anothertype";
  35003   self->f->set(self, "d", (baset*)ip);
  35004   self->f->setInt(self, "a", 1);
  35005   ip = allocSmallInt(3);
  35006   ip->type = "anothertype2";
  35007   self->f->set(self, "e", (baset*)ip);
  35008   self->f->setInt(self, "b", 2);
  35009   self->f->delElem(self, "a");
  35010   self->f->delElem(self, "b");
  35011   r = iterStartO(self);
  35012   ck_assert_ptr_ne(r, NULL);
  35013   ck_assert(isOType(r, "anothertype"));
  35014   r = iterNextO(self);
  35015   ck_assert_ptr_ne(r, NULL);
  35016   ck_assert(isOType(r, "anothertype2"));
  35017   //    iteration ended
  35018   r = iterNextO(self);
  35019   ck_assert_ptr_eq(r, NULL);
  35020   // empty self, uninitialized iterator
  35021   emptyO(self);
  35022   r = iterNextO(self);
  35023   ck_assert_ptr_eq(r, NULL);
  35024   terminateO(self);
  35025 
  35026 END_TEST
  35027 
  35028 
  35029 START_TEST(iterNextKeySmallJsonT)
  35030 
  35031   const char* r;
  35032   smallJsont *self = allocSmallJson();
  35033 
  35034   // non json dict
  35035   r = iterNextKeyO(self);
  35036   ck_assert_ptr_eq(r, NULL);
  35037   // json dict
  35038   // dict with keys and values
  35039   self->f->setInt(self, "a", 1);
  35040   self->f->setInt(self, "b", 2);
  35041   r = iterStartKeyO(self);
  35042   ck_assert_ptr_ne(r, NULL);
  35043   ck_assert_str_eq(r, "a");
  35044   r = iterNextKeyO(self);
  35045   ck_assert_ptr_ne(r, NULL);
  35046   ck_assert_str_eq(r, "b");
  35047   // dict with objects from other classes
  35048   emptyO(self);
  35049   smallIntt *ip = allocSmallInt(2);
  35050   ip->type = "anothertype";
  35051   self->f->set(self, "d", (baset*)ip);
  35052   self->f->setInt(self, "a", 1);
  35053   ip = allocSmallInt(3);
  35054   ip->type = "anothertype2";
  35055   self->f->set(self, "e", (baset*)ip);
  35056   self->f->setInt(self, "b", 2);
  35057   self->f->delElem(self, "a");
  35058   self->f->delElem(self, "b");
  35059   r = iterStartKeyO(self);
  35060   ck_assert_ptr_ne(r, NULL);
  35061   ck_assert_str_eq(r, "d");
  35062   r = iterNextKeyO(self);
  35063   ck_assert_ptr_ne(r, NULL);
  35064   ck_assert_str_eq(r, "e");
  35065   //    iteration ended
  35066   r = iterNextKeyO(self);
  35067   ck_assert_ptr_eq(r, NULL);
  35068   // empty self
  35069   emptyO(self);
  35070   r = iterNextKeyO(self);
  35071   ck_assert_ptr_eq(r, NULL);
  35072   terminateO(self);
  35073 
  35074 END_TEST
  35075 
  35076 
  35077 START_TEST(iterElementSmallJsonT)
  35078 
  35079   baset* r;
  35080   smallJsont *self = allocSmallJson();
  35081 
  35082   // start iteration
  35083   self->f->pushUndefined(self);
  35084   r         = iterStartO(self);
  35085   ck_assert_ptr_ne(r, NULL);
  35086   baset *r2 = iterElementO(self);
  35087   ck_assert_ptr_eq(r, r2);
  35088   ck_assert_str_eq(r->type, "undefined");
  35089   // end iteration
  35090   r = iterNextO(self);
  35091   ck_assert_ptr_eq(r, NULL);
  35092   r = iterElementO(self);
  35093   ck_assert_ptr_eq(r, NULL);
  35094   terminateO(self);
  35095 
  35096 END_TEST
  35097 
  35098 
  35099 START_TEST(iterKeySmallJsonT)
  35100 
  35101   const char* r;
  35102   smallJsont *self = allocSmallJson();
  35103 
  35104   self->f->setInt(self, "a", 1);
  35105   baset *r2 = iterStartO(self);
  35106   ck_assert_ptr_ne(r2, NULL);
  35107   r = iterKeyO(self);
  35108   ck_assert_ptr_ne(r, NULL);
  35109   ck_assert_str_eq(r, "a");
  35110   // empty self
  35111   freeO(self);
  35112   r = iterKeyO(self);
  35113   ck_assert_ptr_eq(r, NULL);
  35114   terminateO(self);
  35115 
  35116 END_TEST
  35117 
  35118 
  35119 START_TEST(iterIndexSmallJsonT)
  35120 
  35121   ssize_t r;
  35122   baset* r2;
  35123   smallJsont *self = allocSmallJson();
  35124 
  35125   // start iteration
  35126   self->f->pushUndefined(self);
  35127   r2 = iterStartO(self);
  35128   ck_assert_ptr_ne(r2, NULL);
  35129   ck_assert_str_eq(r2->type, "undefined");
  35130   r  = iterIndexO(self);
  35131   ck_assert_int_eq(r, 0);
  35132   // end iteration
  35133   r2 = iterNextO(self);
  35134   ck_assert_ptr_eq(r2, NULL);
  35135   r = iterIndexO(self);
  35136   ck_assert_int_eq(r, -1);
  35137   // empty self
  35138   freeO(self);
  35139   r = iterIndexO(self);
  35140   ck_assert_int_eq(r, -1);
  35141   terminateO(self);
  35142 
  35143 END_TEST
  35144 
  35145 
  35146 START_TEST(iterStepSmallJsonT)
  35147 
  35148   int64_t r;
  35149   baset* r2;
  35150   smallJsont *self = allocSmallJson();
  35151 
  35152   // start iteration
  35153   self->f->pushUndefined(self);
  35154   r2 = iterStartO(self);
  35155   ck_assert_ptr_ne(r2, NULL);
  35156   ck_assert_str_eq(r2->type, "undefined");
  35157   r  = iterStepO(self);
  35158   ck_assert_int_eq(r, 1);
  35159   // start iterator twice and
  35160   // set step
  35161   r2 =iterStartFromStepO(self, 0, 10);
  35162   ck_assert_ptr_ne(r2, NULL);
  35163   ck_assert_str_eq(r2->type, "undefined");
  35164   r  = iterStepO(self);
  35165   ck_assert_int_eq(r, 10);
  35166   // empty self
  35167   freeO(self);
  35168   r = iterStepO(self);
  35169   ck_assert_int_eq(r, -1);
  35170   terminateO(self);
  35171 
  35172 END_TEST
  35173 
  35174 
  35175 START_TEST(getUndefinedSmallJsonT)
  35176 
  35177   undefinedt* r;
  35178   smallJsont *self = allocSmallJson();
  35179 
  35180   smallJsont *r2 = self->f->setUndefined(self, "1");
  35181   ck_assert_ptr_ne(r2, null);
  35182   r = self->f->getUndefined(self, "1");
  35183   ck_assert_ptr_ne(r, null);
  35184   finishO(r);
  35185   // path
  35186   createSmallArray(a);
  35187   createSmallDict(d);
  35188   a.f->pushDict(&a, &d);
  35189   self->f->setArray(self, "array", &a);
  35190   r2 = self->f->setUndefined(self, "\"array\"[0].\"key\"");
  35191   ck_assert_ptr_ne(r2, null);
  35192   r = self->f->getUndefined(self, "\"array\"[0].\"key\"");
  35193   ck_assert_ptr_ne(r, null);
  35194   finishO(r);
  35195   // json bool
  35196   freeO(self);
  35197   setTypeBoolO(self);
  35198   r = self->f->getUndefined(self, "1");
  35199   ck_assert_ptr_eq(r, null);
  35200   // json array
  35201   freeO(self);
  35202   setTypeArrayO(self);
  35203   r = self->f->getUndefined(self, "1");
  35204   ck_assert_ptr_eq(r, null);
  35205   // non existing dict path
  35206   freeO(self);
  35207   r = self->f->getUndefined(self, "\"1\"[1]");
  35208   ck_assert_ptr_eq(r, null);
  35209   //   dict path but the object is an array
  35210   resetO(&a);
  35211   self->f->setArray(self, "1", &a);
  35212   r = self->f->getUndefined(self, "\"1\".\"1\"");
  35213   ck_assert_ptr_eq(r, null);
  35214   //   dict object in path but the key doesn't exists
  35215   resetO(&d);
  35216   self->f->setDict(self, "2", &d);
  35217   r = self->f->getUndefined(self, "\"2\".\"1\".[12]");
  35218   ck_assert_ptr_eq(r, null);
  35219   // non undefined object
  35220   r2 = self->f->setInt(self, "1", 2);
  35221   ck_assert_ptr_ne(r2, null);
  35222   r = self->f->getUndefined(self, "1");
  35223   ck_assert_ptr_eq(r, null);
  35224   // null key
  35225   r = self->f->getUndefined(self, null);
  35226   ck_assert_ptr_eq(r, null);
  35227 	// empty self
  35228   freeO(self);
  35229   r = self->f->getUndefined(self, "1");
  35230   ck_assert_ptr_eq(r, null);
  35231   terminateO(self);
  35232 
  35233 END_TEST
  35234 
  35235 
  35236 START_TEST(getBoolSmallJsonT)
  35237 
  35238   bool r;
  35239   smallJsont *self = allocSmallJson();
  35240 
  35241   smallJsont *r2 = self->f->setBool(self, "1", true);
  35242   ck_assert_ptr_ne(r2, null);
  35243   r = self->f->getBool(self, "1");
  35244   ck_assert(r);
  35245   // non bool object
  35246   r2 = self->f->setInt(self, "1", 2);
  35247   ck_assert_ptr_ne(r2, null);
  35248   r = self->f->getBool(self, "1");
  35249   ck_assert(!r);
  35250   // null key
  35251   r = self->f->getBool(self, null);
  35252   ck_assert(!r);
  35253 	// empty self
  35254   freeO(self);
  35255   r = self->f->getBool(self, "1");
  35256   ck_assert(!r);
  35257   terminateO(self);
  35258 
  35259 END_TEST
  35260 
  35261 
  35262 START_TEST(getBoolPSmallJsonT)
  35263 
  35264   bool* r;
  35265   smallJsont *self = allocSmallJson();
  35266 
  35267   smallJsont *r2 = self->f->setBool(self, "1", true);
  35268   ck_assert_ptr_ne(r2, null);
  35269   r = self->f->getBoolP(self, "1");
  35270   ck_assert_ptr_ne(r, null);
  35271   ck_assert(*r);
  35272   // non bool object
  35273   r2 = self->f->setInt(self, "1", 2);
  35274   ck_assert_ptr_ne(r2, null);
  35275   r = self->f->getBoolP(self, "1");
  35276   ck_assert_ptr_eq(r, null);
  35277   // null key
  35278   r = self->f->getBoolP(self, null);
  35279   ck_assert_ptr_eq(r, null);
  35280 	// empty self
  35281   freeO(self);
  35282   r = self->f->getBoolP(self, "1");
  35283   ck_assert_ptr_eq(r, null);
  35284   terminateO(self);
  35285 
  35286 END_TEST
  35287 
  35288 
  35289 START_TEST(getDoubleSmallJsonT)
  35290 
  35291   double r;
  35292   smallJsont *self = allocSmallJson();
  35293 
  35294   smallJsont *r2 = self->f->setDouble(self, "1", 2.2);
  35295   ck_assert_ptr_ne(r2, null);
  35296   r = self->f->getDouble(self, "1");
  35297   ck_assert(r == 2.2);
  35298   // non double object
  35299   r2 = self->f->setInt(self, "1", 2);
  35300   ck_assert_ptr_ne(r2, null);
  35301   r = self->f->getDouble(self, "1");
  35302   ck_assert(r == 0);
  35303   // null key
  35304   r = self->f->getDouble(self, null);
  35305   ck_assert(!r);
  35306 	// empty self
  35307   freeO(self);
  35308   r = self->f->getDouble(self, "1");
  35309   ck_assert(!r);
  35310   terminateO(self);
  35311 
  35312 END_TEST
  35313 
  35314 
  35315 START_TEST(getDoublePSmallJsonT)
  35316 
  35317   double* r;
  35318   smallJsont *self = allocSmallJson();
  35319 
  35320   smallJsont *r2 = self->f->setDouble(self, "1", 2.2);
  35321   ck_assert_ptr_ne(r2, null);
  35322   r = self->f->getDoubleP(self, "1");
  35323   ck_assert_ptr_ne(r, null);
  35324   ck_assert(*r == 2.2);
  35325   // non double object
  35326   r2 = self->f->setInt(self, "1", 2);
  35327   ck_assert_ptr_ne(r2, null);
  35328   r = self->f->getDoubleP(self, "1");
  35329   ck_assert_ptr_eq(r, null);
  35330   // null key
  35331   r = self->f->getDoubleP(self, null);
  35332   ck_assert_ptr_eq(r, null);
  35333 	// empty self
  35334   freeO(self);
  35335   r = self->f->getDoubleP(self, "1");
  35336   ck_assert_ptr_eq(r, null);
  35337   terminateO(self);
  35338 
  35339 END_TEST
  35340 
  35341 
  35342 START_TEST(getIntSmallJsonT)
  35343 
  35344   int64_t r;
  35345   smallJsont *self = allocSmallJson();
  35346 
  35347   smallJsont *r2 = self->f->setInt(self, "1", 2);
  35348   ck_assert_ptr_ne(r2, null);
  35349   r = self->f->getInt(self, "1");
  35350   ck_assert_int_eq(r, 2);
  35351   // non int object
  35352   r2 = self->f->setBool(self, "1", true);
  35353   ck_assert_ptr_ne(r2, null);
  35354   r = self->f->getInt(self, "1");
  35355   ck_assert(!r);
  35356   // null key
  35357   r = self->f->getInt(self, null);
  35358   ck_assert(!r);
  35359 	// empty self
  35360   freeO(self);
  35361   r = self->f->getInt(self, "1");
  35362   ck_assert(!r);
  35363   terminateO(self);
  35364 
  35365 END_TEST
  35366 
  35367 
  35368 START_TEST(getIntPSmallJsonT)
  35369 
  35370   int64_t* r;
  35371   smallJsont *self = allocSmallJson();
  35372 
  35373   smallJsont *r2 = self->f->setInt(self, "1", 2);
  35374   ck_assert_ptr_ne(r2, null);
  35375   r = self->f->getIntP(self, "1");
  35376   ck_assert_ptr_ne(r, null);
  35377   ck_assert_int_eq(*r, 2);
  35378   // non int object
  35379   r2 = self->f->setBool(self, "1", true);
  35380   ck_assert_ptr_ne(r2, null);
  35381   r = self->f->getIntP(self, "1");
  35382   ck_assert_ptr_eq(r, null);
  35383   // null key
  35384   r = self->f->getIntP(self, null);
  35385   ck_assert_ptr_eq(r, null);
  35386 	// empty self
  35387   freeO(self);
  35388   r = self->f->getIntP(self, "1");
  35389   ck_assert_ptr_eq(r, null);
  35390   terminateO(self);
  35391 
  35392 END_TEST
  35393 
  35394 
  35395 START_TEST(getInt32SmallJsonT)
  35396 
  35397   int32_t r;
  35398   smallJsont *self = allocSmallJson();
  35399 
  35400   smallJsont *r2 = self->f->setInt(self, "1", 2);
  35401   ck_assert_ptr_ne(r2, null);
  35402   r = self->f->getInt32(self, "1");
  35403   ck_assert_int_eq(r, 2);
  35404   // non int object
  35405   r2 = self->f->setBool(self, "1", true);
  35406   ck_assert_ptr_ne(r2, null);
  35407   r = self->f->getInt32(self, "1");
  35408   ck_assert(!r);
  35409   // null key
  35410   r = self->f->getInt32(self, null);
  35411   ck_assert(!r);
  35412 	// empty self
  35413   freeO(self);
  35414   r = self->f->getInt32(self, "1");
  35415   ck_assert(!r);
  35416   terminateO(self);
  35417 
  35418 END_TEST
  35419 
  35420 
  35421 START_TEST(getInt32PSmallJsonT)
  35422 
  35423   int32_t* r;
  35424   smallJsont *self = allocSmallJson();
  35425 
  35426   smallJsont *r2 = self->f->setInt(self, "1", 2);
  35427   ck_assert_ptr_ne(r2, null);
  35428   r = self->f->getInt32P(self, "1");
  35429   ck_assert_ptr_ne(r, null);
  35430   ck_assert_int_eq(*r, 2);
  35431   // non int object
  35432   r2 = self->f->setBool(self, "1", true);
  35433   ck_assert_ptr_ne(r2, null);
  35434   r = self->f->getInt32P(self, "1");
  35435   ck_assert_ptr_eq(r, null);
  35436   // null key
  35437   r = self->f->getInt32P(self, null);
  35438   ck_assert_ptr_eq(r, null);
  35439 	// empty self
  35440   freeO(self);
  35441   r = self->f->getInt32P(self, "1");
  35442   ck_assert_ptr_eq(r, null);
  35443   terminateO(self);
  35444 
  35445 END_TEST
  35446 
  35447 
  35448 START_TEST(getUintSmallJsonT)
  35449 
  35450   uint64_t r;
  35451   smallJsont *self = allocSmallJson();
  35452 
  35453   smallJsont *r2 = self->f->setInt(self, "1", 2);
  35454   ck_assert_ptr_ne(r2, null);
  35455   r = self->f->getUint(self, "1");
  35456   ck_assert_int_eq(r, 2);
  35457   // non int object
  35458   r2 = self->f->setBool(self, "1", true);
  35459   ck_assert_ptr_ne(r2, null);
  35460   r = self->f->getUint(self, "1");
  35461   ck_assert(!r);
  35462   // null key
  35463   r = self->f->getUint(self, null);
  35464   ck_assert(!r);
  35465 	// empty self
  35466   freeO(self);
  35467   r = self->f->getUint(self, "1");
  35468   ck_assert(!r);
  35469   terminateO(self);
  35470 
  35471 END_TEST
  35472 
  35473 
  35474 START_TEST(getUintPSmallJsonT)
  35475 
  35476   uint64_t* r;
  35477   smallJsont *self = allocSmallJson();
  35478 
  35479   smallJsont *r2 = self->f->setInt(self, "1", 2);
  35480   ck_assert_ptr_ne(r2, null);
  35481   r = self->f->getUintP(self, "1");
  35482   ck_assert_ptr_ne(r, null);
  35483   ck_assert_int_eq(*r, 2);
  35484   // non int object
  35485   r2 = self->f->setBool(self, "1", true);
  35486   ck_assert_ptr_ne(r2, null);
  35487   r = self->f->getUintP(self, "1");
  35488   ck_assert_ptr_eq(r, null);
  35489   // null key
  35490   r = self->f->getUintP(self, null);
  35491   ck_assert_ptr_eq(r, null);
  35492 	// empty self
  35493   freeO(self);
  35494   r = self->f->getUintP(self, "1");
  35495   ck_assert_ptr_eq(r, null);
  35496   terminateO(self);
  35497 
  35498 END_TEST
  35499 
  35500 
  35501 START_TEST(getUint32SmallJsonT)
  35502 
  35503   uint32_t r;
  35504   smallJsont *self = allocSmallJson();
  35505 
  35506   smallJsont *r2 = self->f->setInt(self, "1", 2);
  35507   ck_assert_ptr_ne(r2, null);
  35508   r = self->f->getUint32(self, "1");
  35509   ck_assert_int_eq(r, 2);
  35510   // non int object
  35511   r2 = self->f->setBool(self, "1", true);
  35512   ck_assert_ptr_ne(r2, null);
  35513   r = self->f->getUint32(self, "1");
  35514   ck_assert(!r);
  35515   // null key
  35516   r = self->f->getUint32(self, null);
  35517   ck_assert(!r);
  35518 	// empty self
  35519   freeO(self);
  35520   r = self->f->getUint32(self, "1");
  35521   ck_assert(!r);
  35522   terminateO(self);
  35523 
  35524 END_TEST
  35525 
  35526 
  35527 START_TEST(getUint32PSmallJsonT)
  35528 
  35529   uint32_t* r;
  35530   smallJsont *self = allocSmallJson();
  35531 
  35532   smallJsont *r2 = self->f->setInt(self, "1", 2);
  35533   ck_assert_ptr_ne(r2, null);
  35534   r = self->f->getUint32P(self, "1");
  35535   ck_assert_ptr_ne(r, null);
  35536   ck_assert_int_eq(*r, 2);
  35537   // non int object
  35538   r2 = self->f->setBool(self, "1", true);
  35539   ck_assert_ptr_ne(r2, null);
  35540   r = self->f->getUint32P(self, "1");
  35541   ck_assert_ptr_eq(r, null);
  35542   // null key
  35543   r = self->f->getUint32P(self, null);
  35544   ck_assert_ptr_eq(r, null);
  35545 	// empty self
  35546   freeO(self);
  35547   r = self->f->getUint32P(self, "1");
  35548   ck_assert_ptr_eq(r, null);
  35549   terminateO(self);
  35550 
  35551 END_TEST
  35552 
  35553 
  35554 START_TEST(getSSmallJsonT)
  35555 
  35556   char* r;
  35557   smallJsont *self = allocSmallJson();
  35558 
  35559   smallJsont *r2 = self->f->setS(self, "1", "qwe");
  35560   ck_assert_ptr_ne(r2, null);
  35561   r = self->f->getS(self, "1");
  35562   ck_assert_ptr_ne(r, null);
  35563   ck_assert_str_eq(r, "qwe");
  35564   // non string object
  35565   r2 = self->f->setBool(self, "1", true);
  35566   ck_assert_ptr_ne(r2, null);
  35567   r = self->f->getS(self, "1");
  35568   ck_assert_ptr_eq(r, null);
  35569   // null key
  35570   r = self->f->getS(self, null);
  35571   ck_assert_ptr_eq(r, null);
  35572 	// empty self
  35573   freeO(self);
  35574   r = self->f->getS(self, "1");
  35575   ck_assert_ptr_eq(r, null);
  35576   terminateO(self);
  35577 
  35578 END_TEST
  35579 
  35580 
  35581 START_TEST(getDictSmallJsonT)
  35582 
  35583   smallDictt* r;
  35584   smallJsont *self = allocSmallJson();
  35585 
  35586   createAllocateSmallDict(D);
  35587   smallJsont *r2 = self->f->setNFreeDict(self, "1", D);
  35588   ck_assert_ptr_ne(r2, null);
  35589   r = self->f->getDict(self, "1");
  35590   ck_assert_ptr_ne(r, null);
  35591   char *s = toStringO(r);
  35592   finishO(r);
  35593   ck_assert_str_eq(s, "{}");
  35594   free(s);
  35595   // non dict object
  35596   r2 = self->f->setBool(self, "1", true);
  35597   ck_assert_ptr_ne(r2, null);
  35598   r = self->f->getDict(self, "1");
  35599   ck_assert_ptr_eq(r, null);
  35600   // path
  35601   smallDictt *dict = allocSmallDict();
  35602   createSmallArray(a);
  35603   createSmallDict(d);
  35604   a.f->pushDict(&a, &d);
  35605   self->f->setArray(self, "array", &a);
  35606   r2 = self->f->setDict(self, "\"array\"[0].\"key\"", dict);
  35607   ck_assert_ptr_ne(r2, null);
  35608   finishO(dict);
  35609   r = self->f->getDict(self, "\"array\"[0].\"key\"");
  35610   ck_assert_ptr_ne(r, null);
  35611   finishO(r);
  35612   // json bool
  35613   freeO(self);
  35614   setTypeBoolO(self);
  35615   r = self->f->getDict(self, "1");
  35616   ck_assert_ptr_eq(r, null);
  35617   // json array
  35618   freeO(self);
  35619   setTypeArrayO(self);
  35620   r = self->f->getDict(self, "1");
  35621   ck_assert_ptr_eq(r, null);
  35622   // non existing dict path
  35623   freeO(self);
  35624   r = self->f->getDict(self, "\"1\"[1]");
  35625   ck_assert_ptr_eq(r, null);
  35626   //   dict path but the object is an array
  35627   resetO(&a);
  35628   self->f->setArray(self, "1", &a);
  35629   r = self->f->getDict(self, "\"1\".\"1\"");
  35630   ck_assert_ptr_eq(r, null);
  35631   //   dict object in path but the key doesn't exists
  35632   resetO(&d);
  35633   self->f->setDict(self, "2", &d);
  35634   r = self->f->getDict(self, "\"2\".\"1\".[12]");
  35635   ck_assert_ptr_eq(r, null);
  35636   // null key
  35637   r = self->f->getDict(self, null);
  35638   ck_assert_ptr_eq(r, null);
  35639 	// empty self
  35640   freeO(self);
  35641   r = self->f->getDict(self, "1");
  35642   ck_assert_ptr_eq(r, null);
  35643   terminateO(self);
  35644 
  35645 END_TEST
  35646 
  35647 
  35648 START_TEST(getArraySmallJsonT)
  35649 
  35650   smallArrayt* r;
  35651   smallJsont *self = allocSmallJson();
  35652 
  35653   createAllocateSmallArray(D);
  35654   smallJsont *r2 = self->f->setNFreeArray(self, "1", D);
  35655   ck_assert_ptr_ne(r2, null);
  35656   r = self->f->getArray(self, "1");
  35657   ck_assert_ptr_ne(r, null);
  35658   char *s = toStringO(r);
  35659   finishO(r);
  35660   ck_assert_str_eq(s, "[]");
  35661   free(s);
  35662   // non Array object
  35663   r2 = self->f->setBool(self, "1", true);
  35664   ck_assert_ptr_ne(r2, null);
  35665   r = self->f->getArray(self, "1");
  35666   ck_assert_ptr_eq(r, null);
  35667   // path
  35668   smallArrayt *array = allocSmallArray();
  35669   createSmallArray(a);
  35670   createSmallDict(d);
  35671   a.f->pushDict(&a, &d);
  35672   self->f->setArray(self, "array", &a);
  35673   r2 = self->f->setArray(self, "\"array\"[0].\"key\"", array);
  35674   ck_assert_ptr_ne(r2, null);
  35675   finishO(array);
  35676   r = self->f->getArray(self, "\"array\"[0].\"key\"");
  35677   ck_assert_ptr_ne(r, null);
  35678   finishO(r);
  35679   // json bool
  35680   freeO(self);
  35681   setTypeBoolO(self);
  35682   r = self->f->getArray(self, "1");
  35683   ck_assert_ptr_eq(r, null);
  35684   // json array
  35685   freeO(self);
  35686   setTypeArrayO(self);
  35687   r = self->f->getArray(self, "1");
  35688   ck_assert_ptr_eq(r, null);
  35689   // non existing dict path
  35690   freeO(self);
  35691   r = self->f->getArray(self, "\"1\"[1]");
  35692   ck_assert_ptr_eq(r, null);
  35693   //   dict path but the object is an array
  35694   resetO(&a);
  35695   self->f->setArray(self, "1", &a);
  35696   r = self->f->getArray(self, "\"1\".\"1\"");
  35697   ck_assert_ptr_eq(r, null);
  35698   //   dict object in path but the key doesn't exists
  35699   resetO(&d);
  35700   self->f->setDict(self, "2", &d);
  35701   r = self->f->getArray(self, "\"2\".\"1\".[12]");
  35702   ck_assert_ptr_eq(r, null);
  35703   // null key
  35704   r = self->f->getArray(self, null);
  35705   ck_assert_ptr_eq(r, null);
  35706 	// empty self
  35707   freeO(self);
  35708   r = self->f->getArray(self, "1");
  35709   ck_assert_ptr_eq(r, null);
  35710   terminateO(self);
  35711 
  35712 END_TEST
  35713 
  35714 
  35715 START_TEST(getSmallBoolSmallJsonT)
  35716 
  35717   smallBoolt* r;
  35718   smallJsont *self = allocSmallJson();
  35719 
  35720   createAllocateSmallBool(D);
  35721   smallJsont *r2 = self->f->setNFreeSmallBool(self, "1", D);
  35722   ck_assert_ptr_ne(r2, null);
  35723   r = self->f->getSmallBool(self, "1");
  35724   ck_assert_ptr_ne(r, null);
  35725   char *s = toStringO(r);
  35726   finishO(r);
  35727   ck_assert_str_eq(s, "false");
  35728   free(s);
  35729   // non SmallBool object
  35730   r2 = self->f->setInt(self, "1", 0);
  35731   ck_assert_ptr_ne(r2, null);
  35732   r = self->f->getSmallBool(self, "1");
  35733   ck_assert_ptr_eq(r, null);
  35734   // path
  35735   smallBoolt *value = allocSmallBool(true);
  35736   createSmallArray(a);
  35737   createSmallDict(d);
  35738   a.f->pushDict(&a, &d);
  35739   self->f->setArray(self, "array", &a);
  35740   r2 = self->f->setSmallBool(self, "\"array\"[0].\"key\"", value);
  35741   ck_assert_ptr_ne(r2, null);
  35742   finishO(value);
  35743   r = self->f->getSmallBool(self, "\"array\"[0].\"key\"");
  35744   ck_assert_ptr_ne(r, null);
  35745   finishO(r);
  35746   // json bool
  35747   freeO(self);
  35748   setTypeBoolO(self);
  35749   r = self->f->getSmallBool(self, "1");
  35750   ck_assert_ptr_eq(r, null);
  35751   // json array
  35752   freeO(self);
  35753   setTypeArrayO(self);
  35754   r = self->f->getSmallBool(self, "1");
  35755   ck_assert_ptr_eq(r, null);
  35756   // non existing dict path
  35757   freeO(self);
  35758   r = self->f->getSmallBool(self, "\"1\"[1]");
  35759   ck_assert_ptr_eq(r, null);
  35760   //   dict path but the object is an array
  35761   resetO(&a);
  35762   self->f->setArray(self, "1", &a);
  35763   r = self->f->getSmallBool(self, "\"1\".\"1\"");
  35764   ck_assert_ptr_eq(r, null);
  35765   //   dict object in path but the key doesn't exists
  35766   resetO(&d);
  35767   self->f->setDict(self, "2", &d);
  35768   r = self->f->getSmallBool(self, "\"2\".\"1\".[12]");
  35769   ck_assert_ptr_eq(r, null);
  35770   // null key
  35771   r = self->f->getSmallBool(self, null);
  35772   ck_assert_ptr_eq(r, null);
  35773 	// empty self
  35774   freeO(self);
  35775   r = self->f->getSmallBool(self, "1");
  35776   ck_assert_ptr_eq(r, null);
  35777   terminateO(self);
  35778 
  35779 END_TEST
  35780 
  35781 
  35782 START_TEST(getSmallBytesSmallJsonT)
  35783 
  35784   smallBytest* r;
  35785   smallJsont *self = allocSmallJson();
  35786 
  35787   createAllocateSmallBytes(D);
  35788   smallJsont *r2 = self->f->setNFreeSmallBytes(self, "1", D);
  35789   ck_assert_ptr_ne(r2, null);
  35790   r = self->f->getSmallBytes(self, "1");
  35791   ck_assert_ptr_ne(r, null);
  35792   char *s = toStringO(r);
  35793   finishO(r);
  35794   ck_assert_str_eq(s, "[]");
  35795   free(s);
  35796   // non SmallBytes object
  35797   r2 = self->f->setBool(self, "1", true);
  35798   ck_assert_ptr_ne(r2, null);
  35799   r = self->f->getSmallBytes(self, "1");
  35800   ck_assert_ptr_eq(r, null);
  35801   // path
  35802   smallBytest *value = allocSmallBytes("qwf", sizeof("qwf"));
  35803   createSmallArray(a);
  35804   createSmallDict(d);
  35805   a.f->pushDict(&a, &d);
  35806   self->f->setArray(self, "array", &a);
  35807   r2 = self->f->setSmallBytes(self, "\"array\"[0].\"key\"", value);
  35808   ck_assert_ptr_ne(r2, null);
  35809   finishO(value);
  35810   r = self->f->getSmallBytes(self, "\"array\"[0].\"key\"");
  35811   ck_assert_ptr_ne(r, null);
  35812   finishO(r);
  35813   // json bool
  35814   freeO(self);
  35815   setTypeBoolO(self);
  35816   r = self->f->getSmallBytes(self, "1");
  35817   ck_assert_ptr_eq(r, null);
  35818   // json array
  35819   freeO(self);
  35820   setTypeArrayO(self);
  35821   r = self->f->getSmallBytes(self, "1");
  35822   ck_assert_ptr_eq(r, null);
  35823   // non existing dict path
  35824   freeO(self);
  35825   r = self->f->getSmallBytes(self, "\"1\"[1]");
  35826   ck_assert_ptr_eq(r, null);
  35827   //   dict path but the object is an array
  35828   resetO(&a);
  35829   self->f->setArray(self, "1", &a);
  35830   r = self->f->getSmallBytes(self, "\"1\".\"1\"");
  35831   ck_assert_ptr_eq(r, null);
  35832   //   dict object in path but the key doesn't exists
  35833   resetO(&d);
  35834   self->f->setDict(self, "2", &d);
  35835   r = self->f->getSmallBytes(self, "\"2\".\"1\".[12]");
  35836   ck_assert_ptr_eq(r, null);
  35837   // null key
  35838   r = self->f->getSmallBytes(self, null);
  35839   ck_assert_ptr_eq(r, null);
  35840 	// empty self
  35841   freeO(self);
  35842   r = self->f->getSmallBytes(self, "1");
  35843   ck_assert_ptr_eq(r, null);
  35844   terminateO(self);
  35845 
  35846 END_TEST
  35847 
  35848 
  35849 START_TEST(getSmallDoubleSmallJsonT)
  35850 
  35851   smallDoublet* r;
  35852   smallJsont *self = allocSmallJson();
  35853 
  35854   createAllocateSmallDouble(D);
  35855   smallJsont *r2 = self->f->setNFreeSmallDouble(self, "1", D);
  35856   ck_assert_ptr_ne(r2, null);
  35857   r = self->f->getSmallDouble(self, "1");
  35858   ck_assert_ptr_ne(r, null);
  35859   char *s = toStringO(r);
  35860   finishO(r);
  35861   ck_assert_str_eq(s, "0.000000e+00");
  35862   free(s);
  35863   // non SmallDouble object
  35864   r2 = self->f->setBool(self, "1", true);
  35865   ck_assert_ptr_ne(r2, null);
  35866   r = self->f->getSmallDouble(self, "1");
  35867   ck_assert_ptr_eq(r, null);
  35868   // path
  35869   smallDoublet *value = allocSmallDouble(1.2);
  35870   createSmallArray(a);
  35871   createSmallDict(d);
  35872   a.f->pushDict(&a, &d);
  35873   self->f->setArray(self, "array", &a);
  35874   r2 = self->f->setSmallDouble(self, "\"array\"[0].\"key\"", value);
  35875   ck_assert_ptr_ne(r2, null);
  35876   finishO(value);
  35877   r = self->f->getSmallDouble(self, "\"array\"[0].\"key\"");
  35878   ck_assert_ptr_ne(r, null);
  35879   finishO(r);
  35880   // json bool
  35881   freeO(self);
  35882   setTypeBoolO(self);
  35883   r = self->f->getSmallDouble(self, "1");
  35884   ck_assert_ptr_eq(r, null);
  35885   // json array
  35886   freeO(self);
  35887   setTypeArrayO(self);
  35888   r = self->f->getSmallDouble(self, "1");
  35889   ck_assert_ptr_eq(r, null);
  35890   // non existing dict path
  35891   freeO(self);
  35892   r = self->f->getSmallDouble(self, "\"1\"[1]");
  35893   ck_assert_ptr_eq(r, null);
  35894   //   dict path but the object is an array
  35895   resetO(&a);
  35896   self->f->setArray(self, "1", &a);
  35897   r = self->f->getSmallDouble(self, "\"1\".\"1\"");
  35898   ck_assert_ptr_eq(r, null);
  35899   //   dict object in path but the key doesn't exists
  35900   resetO(&d);
  35901   self->f->setDict(self, "2", &d);
  35902   r = self->f->getSmallDouble(self, "\"2\".\"1\".[12]");
  35903   ck_assert_ptr_eq(r, null);
  35904   // null key
  35905   r = self->f->getSmallDouble(self, null);
  35906   ck_assert_ptr_eq(r, null);
  35907 	// empty self
  35908   freeO(self);
  35909   r = self->f->getSmallDouble(self, "1");
  35910   ck_assert_ptr_eq(r, null);
  35911   terminateO(self);
  35912 
  35913 END_TEST
  35914 
  35915 
  35916 START_TEST(getSmallIntSmallJsonT)
  35917 
  35918   smallIntt* r;
  35919   smallJsont *self = allocSmallJson();
  35920 
  35921   createAllocateSmallInt(D);
  35922   smallJsont *r2 = self->f->setNFreeSmallInt(self, "1", D);
  35923   ck_assert_ptr_ne(r2, null);
  35924   r = self->f->getSmallInt(self, "1");
  35925   ck_assert_ptr_ne(r, null);
  35926   char *s = toStringO(r);
  35927   finishO(r);
  35928   ck_assert_str_eq(s, "0");
  35929   free(s);
  35930   // non SmallInt object
  35931   r2 = self->f->setBool(self, "1", true);
  35932   ck_assert_ptr_ne(r2, null);
  35933   r = self->f->getSmallInt(self, "1");
  35934   ck_assert_ptr_eq(r, null);
  35935   // path
  35936   smallIntt *value = allocSmallInt(1);
  35937   createSmallArray(a);
  35938   createSmallDict(d);
  35939   a.f->pushDict(&a, &d);
  35940   self->f->setArray(self, "array", &a);
  35941   r2 = self->f->setSmallInt(self, "\"array\"[0].\"key\"", value);
  35942   ck_assert_ptr_ne(r2, null);
  35943   finishO(value);
  35944   r = self->f->getSmallInt(self, "\"array\"[0].\"key\"");
  35945   ck_assert_ptr_ne(r, null);
  35946   finishO(r);
  35947   // json bool
  35948   freeO(self);
  35949   setTypeBoolO(self);
  35950   r = self->f->getSmallInt(self, "1");
  35951   ck_assert_ptr_eq(r, null);
  35952   // json array
  35953   freeO(self);
  35954   setTypeArrayO(self);
  35955   r = self->f->getSmallInt(self, "1");
  35956   ck_assert_ptr_eq(r, null);
  35957   // non existing dict path
  35958   freeO(self);
  35959   r = self->f->getSmallInt(self, "\"1\"[1]");
  35960   ck_assert_ptr_eq(r, null);
  35961   //   dict path but the object is an array
  35962   resetO(&a);
  35963   self->f->setArray(self, "1", &a);
  35964   r = self->f->getSmallInt(self, "\"1\".\"1\"");
  35965   ck_assert_ptr_eq(r, null);
  35966   //   dict object in path but the key doesn't exists
  35967   resetO(&d);
  35968   self->f->setDict(self, "2", &d);
  35969   r = self->f->getSmallInt(self, "\"2\".\"1\".[12]");
  35970   ck_assert_ptr_eq(r, null);
  35971   // null key
  35972   r = self->f->getSmallInt(self, null);
  35973   ck_assert_ptr_eq(r, null);
  35974 	// empty self
  35975   freeO(self);
  35976   r = self->f->getSmallInt(self, "1");
  35977   ck_assert_ptr_eq(r, null);
  35978   terminateO(self);
  35979 
  35980 END_TEST
  35981 
  35982 
  35983 START_TEST(getSmallJsonSmallJsonT)
  35984 
  35985   smallJsont* r;
  35986   smallJsont *self = allocSmallJson();
  35987 
  35988   createAllocateSmallJson(D);
  35989   smallJsont *r2 = self->f->setNFreeSmallJson(self, "1", D);
  35990   ck_assert_ptr_ne(r2, null);
  35991   r = self->f->getSmallJson(self, "1");
  35992   ck_assert_ptr_ne(r, null);
  35993   char *s = toStringO(r);
  35994   finishO(r);
  35995   ck_assert_str_eq(s, "{}");
  35996   free(s);
  35997   r2 = self->f->setBool(self, "1", true);
  35998   ck_assert_ptr_ne(r2, null);
  35999   r = self->f->getSmallJson(self, "1");
  36000   ck_assert_ptr_ne(r, null);
  36001   s = toStringO(r);
  36002   finishO(r);
  36003   ck_assert_str_eq(s, "true");
  36004   free(s);
  36005   // non SmallJson object
  36006   smallContainert *c = allocSmallContainer(NULL);
  36007   r2 = self->f->setNFreeSmallContainer(self, "1", c);
  36008   ck_assert_ptr_ne(r2, null);
  36009   r = self->f->getSmallJson(self, "1");
  36010   ck_assert_ptr_eq(r, null);
  36011   // path
  36012   smallJsont *value = allocSmallJson();
  36013   createSmallArray(a);
  36014   createSmallDict(d);
  36015   a.f->pushDict(&a, &d);
  36016   self->f->setArray(self, "array", &a);
  36017   r = self->f->setSmallJson(self, "\"array\"[0].\"key\"", value);
  36018   ck_assert_ptr_ne(r, null);
  36019   finishO(value);
  36020   r = self->f->getSmallJson(self, "\"array\"[0].\"key\"");
  36021   ck_assert_ptr_ne(r, null);
  36022   finishO(r);
  36023   // json bool
  36024   freeO(self);
  36025   setTypeBoolO(self);
  36026   r = self->f->getSmallJson(self, "1");
  36027   ck_assert_ptr_eq(r, null);
  36028   // json array
  36029   freeO(self);
  36030   setTypeArrayO(self);
  36031   r = self->f->getSmallJson(self, "1");
  36032   ck_assert_ptr_eq(r, null);
  36033   // non existing dict path
  36034   freeO(self);
  36035   r = self->f->getSmallJson(self, "\"1\"[1]");
  36036   ck_assert_ptr_eq(r, null);
  36037   //   dict path but the object is an array
  36038   resetO(&a);
  36039   self->f->setArray(self, "1", &a);
  36040   r = self->f->getSmallJson(self, "\"1\".\"1\"");
  36041   ck_assert_ptr_eq(r, null);
  36042   //   dict object in path but the key doesn't exists
  36043   resetO(&d);
  36044   self->f->setDict(self, "2", &d);
  36045   r = self->f->getSmallJson(self, "\"2\".\"1\".[12]");
  36046   ck_assert_ptr_eq(r, null);
  36047   // null key
  36048   r = self->f->getSmallJson(self, null);
  36049   ck_assert_ptr_eq(r, null);
  36050 	// empty self
  36051   freeO(self);
  36052   r = self->f->getSmallJson(self, "1");
  36053   ck_assert_ptr_eq(r, null);
  36054   terminateO(self);
  36055 
  36056 END_TEST
  36057 
  36058 
  36059 START_TEST(getSmallStringSmallJsonT)
  36060 
  36061   smallStringt* r;
  36062   smallJsont *self = allocSmallJson();
  36063 
  36064   createAllocateSmallString(D);
  36065   smallJsont *r2 = self->f->setNFreeSmallString(self, "1", D);
  36066   ck_assert_ptr_ne(r2, null);
  36067   r = self->f->getSmallString(self, "1");
  36068   ck_assert_ptr_ne(r, null);
  36069   char *s = toStringO(r);
  36070   finishO(r);
  36071   ck_assert_str_eq(s, "");
  36072   free(s);
  36073   // non SmallString object
  36074   r2 = self->f->setBool(self, "1", true);
  36075   ck_assert_ptr_ne(r2, null);
  36076   r = self->f->getSmallString(self, "1");
  36077   ck_assert_ptr_eq(r, null);
  36078   // path
  36079   smallStringt *value = allocSmallString("asd");
  36080   createSmallArray(a);
  36081   createSmallDict(d);
  36082   a.f->pushDict(&a, &d);
  36083   self->f->setArray(self, "array", &a);
  36084   r2 = self->f->setSmallString(self, "\"array\"[0].\"key\"", value);
  36085   ck_assert_ptr_ne(r2, null);
  36086   finishO(value);
  36087   r = self->f->getSmallString(self, "\"array\"[0].\"key\"");
  36088   ck_assert_ptr_ne(r, null);
  36089   finishO(r);
  36090   // json bool
  36091   freeO(self);
  36092   setTypeBoolO(self);
  36093   r = self->f->getSmallString(self, "1");
  36094   ck_assert_ptr_eq(r, null);
  36095   // json array
  36096   freeO(self);
  36097   setTypeArrayO(self);
  36098   r = self->f->getSmallString(self, "1");
  36099   ck_assert_ptr_eq(r, null);
  36100   // non existing dict path
  36101   freeO(self);
  36102   r = self->f->getSmallString(self, "\"1\"[1]");
  36103   ck_assert_ptr_eq(r, null);
  36104   //   dict path but the object is an array
  36105   resetO(&a);
  36106   self->f->setArray(self, "1", &a);
  36107   r = self->f->getSmallString(self, "\"1\".\"1\"");
  36108   ck_assert_ptr_eq(r, null);
  36109   //   dict object in path but the key doesn't exists
  36110   resetO(&d);
  36111   self->f->setDict(self, "2", &d);
  36112   r = self->f->getSmallString(self, "\"2\".\"1\".[12]");
  36113   ck_assert_ptr_eq(r, null);
  36114   // null key
  36115   r = self->f->getSmallString(self, null);
  36116   ck_assert_ptr_eq(r, null);
  36117 	// empty self
  36118   freeO(self);
  36119   r = self->f->getSmallString(self, "1");
  36120   ck_assert_ptr_eq(r, null);
  36121   terminateO(self);
  36122 
  36123 END_TEST
  36124 
  36125 
  36126 START_TEST(getVoidSmallJsonT)
  36127 
  36128   void* r;
  36129   smallJsont *self = allocSmallJson();
  36130 
  36131   smallContainert* D = allocSmallContainer(&r);
  36132   smallJsont *r2 = self->f->setNFreeSmallContainer(self, "1", D);
  36133   ck_assert_ptr_ne(r2, null);
  36134   r = self->f->getVoid(self, "1");
  36135   ck_assert_ptr_eq(r, &r);
  36136   // non container object
  36137   r2 = self->f->setBool(self, "1", true);
  36138   ck_assert_ptr_ne(r2, null);
  36139   r = self->f->getVoid(self, "1");
  36140   ck_assert_ptr_eq(r, null);
  36141   // path
  36142   smallContainert *value = allocSmallContainer(&r);
  36143   createSmallArray(a);
  36144   createSmallDict(d);
  36145   a.f->pushDict(&a, &d);
  36146   self->f->setArray(self, "array", &a);
  36147   r2 = self->f->setSmallContainer(self, "\"array\"[0].\"key\"", value);
  36148   ck_assert_ptr_ne(r2, null);
  36149   finishO(value);
  36150   r = self->f->getVoid(self, "\"array\"[0].\"key\"");
  36151   ck_assert_ptr_ne(r, null);
  36152   // json bool
  36153   freeO(self);
  36154   setTypeBoolO(self);
  36155   r = self->f->getVoid(self, "1");
  36156   ck_assert_ptr_eq(r, null);
  36157   // json array
  36158   freeO(self);
  36159   setTypeArrayO(self);
  36160   r = self->f->getVoid(self, "1");
  36161   ck_assert_ptr_eq(r, null);
  36162   // non existing dict path
  36163   freeO(self);
  36164   r = self->f->getVoid(self, "\"1\"[1]");
  36165   ck_assert_ptr_eq(r, null);
  36166   //   dict path but the object is an array
  36167   resetO(&a);
  36168   self->f->setArray(self, "1", &a);
  36169   r = self->f->getVoid(self, "\"1\".\"1\"");
  36170   ck_assert_ptr_eq(r, null);
  36171   //   dict object in path but the key doesn't exists
  36172   resetO(&d);
  36173   self->f->setDict(self, "2", &d);
  36174   r = self->f->getVoid(self, "\"2\".\"1\".[12]");
  36175   ck_assert_ptr_eq(r, null);
  36176   // null key
  36177   r = self->f->getVoid(self, null);
  36178   ck_assert_ptr_eq(r, null);
  36179 	// empty self
  36180   freeO(self);
  36181   r = self->f->getVoid(self, "1");
  36182   ck_assert_ptr_eq(r, null);
  36183   terminateO(self);
  36184 
  36185 END_TEST
  36186 
  36187 
  36188 START_TEST(getSmallContainerSmallJsonT)
  36189 
  36190   smallContainert* r;
  36191   smallJsont *self = allocSmallJson();
  36192 
  36193   createAllocateSmallContainer(D);
  36194   smallJsont *r2 = self->f->setNFreeSmallContainer(self, "1", D);
  36195   ck_assert_ptr_ne(r2, null);
  36196   r = self->f->getSmallContainer(self, "1");
  36197   ck_assert_ptr_ne(r, null);
  36198   char *s = toStringO(r);
  36199   finishO(r);
  36200   ck_assert_str_eq(s, "<data smallContainer>");
  36201   free(s);
  36202   // other base class
  36203   smallIntt *t = allocSmallInt(2);
  36204   t->type = "randomClass";
  36205   r2 = self->f->setNFree(self, "1", (baset*)t);
  36206   ck_assert_ptr_ne(r2, null);
  36207   r = self->f->getSmallContainer(self, "1");
  36208   ck_assert_ptr_eq(r, null);
  36209   // non SmallContainer object
  36210   r2 = self->f->setBool(self, "1", true);
  36211   ck_assert_ptr_ne(r2, null);
  36212   r = self->f->getSmallContainer(self, "1");
  36213   ck_assert_ptr_eq(r, null);
  36214   // path
  36215   smallContainert *value = allocSmallContainer(null);
  36216   createSmallArray(a);
  36217   createSmallDict(d);
  36218   a.f->pushDict(&a, &d);
  36219   self->f->setArray(self, "array", &a);
  36220   r2 = self->f->setSmallContainer(self, "\"array\"[0].\"key\"", value);
  36221   ck_assert_ptr_ne(r2, null);
  36222   finishO(value);
  36223   r = self->f->getSmallContainer(self, "\"array\"[0].\"key\"");
  36224   ck_assert_ptr_ne(r, null);
  36225   finishO(r);
  36226   // json bool
  36227   freeO(self);
  36228   setTypeBoolO(self);
  36229   r = self->f->getSmallContainer(self, "1");
  36230   ck_assert_ptr_eq(r, null);
  36231   // json array
  36232   freeO(self);
  36233   setTypeArrayO(self);
  36234   r = self->f->getSmallContainer(self, "1");
  36235   ck_assert_ptr_eq(r, null);
  36236   // non existing dict path
  36237   freeO(self);
  36238   r = self->f->getSmallContainer(self, "\"1\"[1]");
  36239   ck_assert_ptr_eq(r, null);
  36240   //   dict path but the object is an array
  36241   resetO(&a);
  36242   self->f->setArray(self, "1", &a);
  36243   r = self->f->getSmallContainer(self, "\"1\".\"1\"");
  36244   ck_assert_ptr_eq(r, null);
  36245   //   dict object in path but the key doesn't exists
  36246   resetO(&d);
  36247   self->f->setDict(self, "2", &d);
  36248   r = self->f->getSmallContainer(self, "\"2\".\"1\".[12]");
  36249   ck_assert_ptr_eq(r, null);
  36250   // null key
  36251   r = self->f->getSmallContainer(self, null);
  36252   ck_assert_ptr_eq(r, null);
  36253 	// empty self
  36254   freeO(self);
  36255   r = self->f->getSmallContainer(self, "1");
  36256   ck_assert_ptr_eq(r, null);
  36257   terminateO(self);
  36258 
  36259 END_TEST
  36260 
  36261 
  36262 START_TEST(getNDupSmallJsonT)
  36263 
  36264   baset* r;
  36265   smallJsont *self = allocSmallJson();
  36266 
  36267   smallIntt *c   = allocSmallInt(2);
  36268   smallJsont *r2 = self->f->setNFree(self, "1", (baset*) c);
  36269   ck_assert_ptr_ne(r2, null);
  36270   r = self->f->getNDup(self, "1");
  36271   ck_assert_ptr_ne(r, null);
  36272   char *s = toStringO(r);
  36273   terminateO(r);
  36274   ck_assert_str_eq(s, "2");
  36275   free(s);
  36276   // other base class
  36277   smallIntt *t = allocSmallInt(3);
  36278   t->type = "randomClass";
  36279   r2 = self->f->setNFree(self, "1", (baset*)t);
  36280   ck_assert_ptr_ne(r2, null);
  36281   r = self->f->getNDup(self, "1");
  36282   ck_assert_ptr_ne(r, null);
  36283   s = toStringO(r);
  36284   terminateO(r);
  36285   ck_assert_str_eq(s, "3");
  36286   free(s);
  36287   // path
  36288   smallIntt *value = allocSmallInt(1);
  36289   createSmallArray(a);
  36290   createSmallDict(d);
  36291   a.f->pushDict(&a, &d);
  36292   self->f->setArray(self, "array", &a);
  36293   r2 = self->f->setSmallInt(self, "\"array\"[0].\"key\"", value);
  36294   ck_assert_ptr_ne(r2, null);
  36295   finishO(value);
  36296   r = self->f->getNDup(self, "\"array\"[0].\"key\"");
  36297   ck_assert_ptr_ne(r, null);
  36298   terminateO(r);
  36299   // json bool
  36300   freeO(self);
  36301   setTypeBoolO(self);
  36302   r = self->f->getNDup(self, "1");
  36303   ck_assert_ptr_eq(r, null);
  36304   // json array
  36305   freeO(self);
  36306   setTypeArrayO(self);
  36307   r = self->f->getNDup(self, "1");
  36308   ck_assert_ptr_eq(r, null);
  36309   // non existing dict path
  36310   freeO(self);
  36311   r = self->f->getNDup(self, "\"1\"[1]");
  36312   ck_assert_ptr_eq(r, null);
  36313   //   dict path but the object is an array
  36314   resetO(&a);
  36315   self->f->setArray(self, "1", &a);
  36316   r = self->f->getNDup(self, "\"1\".\"1\"");
  36317   ck_assert_ptr_eq(r, null);
  36318   //   dict object in path but the key doesn't exists
  36319   resetO(&d);
  36320   self->f->setDict(self, "2", &d);
  36321   r = self->f->getNDup(self, "\"2\".\"1\".[12]");
  36322   ck_assert_ptr_eq(r, null);
  36323   // null key
  36324   r = self->f->getNDup(self, null);
  36325   ck_assert_ptr_eq(r, null);
  36326 	// empty self
  36327   freeO(self);
  36328   r = self->f->getNDup(self, "1");
  36329   ck_assert_ptr_eq(r, null);
  36330   terminateO(self);
  36331 
  36332 END_TEST
  36333 
  36334 
  36335 START_TEST(getNDupUndefinedSmallJsonT)
  36336 
  36337   undefinedt* r;
  36338   smallJsont *self = allocSmallJson();
  36339 
  36340   smallJsont *r2 = self->f->setUndefined(self, "1");
  36341   ck_assert_ptr_ne(r2, null);
  36342   r = self->f->getNDupUndefined(self, "1");
  36343   ck_assert_ptr_ne(r, null);
  36344   terminateO(r);
  36345   // non undefined object
  36346   r2 = self->f->setInt(self, "1", 2);
  36347   ck_assert_ptr_ne(r2, null);
  36348   r = self->f->getNDupUndefined(self, "1");
  36349   ck_assert_ptr_eq(r, null);
  36350   // path
  36351   createSmallArray(a);
  36352   createSmallDict(d);
  36353   a.f->pushDict(&a, &d);
  36354   self->f->setArray(self, "array", &a);
  36355   r2 = self->f->setUndefined(self, "\"array\"[0].\"key\"");
  36356   ck_assert_ptr_ne(r2, null);
  36357   r = self->f->getNDupUndefined(self, "\"array\"[0].\"key\"");
  36358   ck_assert_ptr_ne(r, null);
  36359   terminateO(r);
  36360   // json bool
  36361   freeO(self);
  36362   setTypeBoolO(self);
  36363   r = self->f->getNDupUndefined(self, "1");
  36364   ck_assert_ptr_eq(r, null);
  36365   // json array
  36366   freeO(self);
  36367   setTypeArrayO(self);
  36368   r = self->f->getNDupUndefined(self, "1");
  36369   ck_assert_ptr_eq(r, null);
  36370   // non existing dict path
  36371   freeO(self);
  36372   r = self->f->getNDupUndefined(self, "\"1\"[1]");
  36373   ck_assert_ptr_eq(r, null);
  36374   //   dict path but the object is an array
  36375   resetO(&a);
  36376   self->f->setArray(self, "1", &a);
  36377   r = self->f->getNDupUndefined(self, "\"1\".\"1\"");
  36378   ck_assert_ptr_eq(r, null);
  36379   //   dict object in path but the key doesn't exists
  36380   resetO(&d);
  36381   self->f->setDict(self, "2", &d);
  36382   r = self->f->getNDupUndefined(self, "\"2\".\"1\".[12]");
  36383   ck_assert_ptr_eq(r, null);
  36384   // null key
  36385   r = self->f->getNDupUndefined(self, null);
  36386   ck_assert_ptr_eq(r, null);
  36387 	// empty self
  36388   freeO(self);
  36389   r = self->f->getNDupUndefined(self, "1");
  36390   ck_assert_ptr_eq(r, null);
  36391   terminateO(self);
  36392 
  36393 END_TEST
  36394 
  36395 
  36396 START_TEST(getNDupBoolSmallJsonT)
  36397 
  36398   bool r;
  36399   smallJsont *self = allocSmallJson();
  36400 
  36401   smallJsont *r2 = self->f->setBool(self, "1", true);
  36402   ck_assert_ptr_ne(r2, null);
  36403   r = self->f->getNDupBool(self, "1");
  36404   ck_assert(r);
  36405   // non bool object
  36406   r2 = self->f->setInt(self, "1", 2);
  36407   ck_assert_ptr_ne(r2, null);
  36408   r = self->f->getNDupBool(self, "1");
  36409   ck_assert(!r);
  36410   // null key
  36411   r = self->f->getNDupBool(self, null);
  36412   ck_assert(!r);
  36413 	// empty self
  36414   freeO(self);
  36415   r = self->f->getNDupBool(self, "1");
  36416   ck_assert(!r);
  36417   terminateO(self);
  36418 
  36419 END_TEST
  36420 
  36421 
  36422 START_TEST(getNDupDoubleSmallJsonT)
  36423 
  36424   double r;
  36425   smallJsont *self = allocSmallJson();
  36426 
  36427   smallJsont *r2 = self->f->setDouble(self, "1", 2.2);
  36428   ck_assert_ptr_ne(r2, null);
  36429   r = self->f->getNDupDouble(self, "1");
  36430   ck_assert(r == 2.2);
  36431   // non double object
  36432   r2 = self->f->setInt(self, "1", 2);
  36433   ck_assert_ptr_ne(r2, null);
  36434   r = self->f->getNDupDouble(self, "1");
  36435   ck_assert(r == 0);
  36436   // null key
  36437   r = self->f->getNDupDouble(self, null);
  36438   ck_assert(r == 0);
  36439 	// empty self
  36440   freeO(self);
  36441   r = self->f->getNDupDouble(self, "1");
  36442   ck_assert(!r);
  36443   terminateO(self);
  36444 
  36445 END_TEST
  36446 
  36447 
  36448 START_TEST(getNDupIntSmallJsonT)
  36449 
  36450   int64_t r;
  36451   smallJsont *self = allocSmallJson();
  36452 
  36453   smallJsont *r2 = self->f->setInt(self, "1", 2);
  36454   ck_assert_ptr_ne(r2, null);
  36455   r = self->f->getNDupInt(self, "1");
  36456   ck_assert_int_eq(r, 2);
  36457   // non int object
  36458   r2 = self->f->setBool(self, "1", true);
  36459   ck_assert_ptr_ne(r2, null);
  36460   r = self->f->getNDupInt(self, "1");
  36461   ck_assert(!r);
  36462   // null key
  36463   r = self->f->getNDupInt(self, null);
  36464   ck_assert_int_eq(r, 0);
  36465 	// empty self
  36466   freeO(self);
  36467   r = self->f->getNDupInt(self, "1");
  36468   ck_assert(!r);
  36469   terminateO(self);
  36470 
  36471 END_TEST
  36472 
  36473 
  36474 START_TEST(getNDupInt32SmallJsonT)
  36475 
  36476   int32_t r;
  36477   smallJsont *self = allocSmallJson();
  36478 
  36479   smallJsont *r2 = self->f->setInt(self, "1", 2);
  36480   ck_assert_ptr_ne(r2, null);
  36481   r = self->f->getNDupInt32(self, "1");
  36482   ck_assert_int_eq(r, 2);
  36483   // non int object
  36484   r2 = self->f->setBool(self, "1", true);
  36485   ck_assert_ptr_ne(r2, null);
  36486   r = self->f->getNDupInt32(self, "1");
  36487   ck_assert(!r);
  36488   // null key
  36489   r = self->f->getNDupInt32(self, null);
  36490   ck_assert_int_eq(r, 0);
  36491 	// empty self
  36492   freeO(self);
  36493   r = self->f->getNDupInt32(self, "1");
  36494   ck_assert(!r);
  36495   terminateO(self);
  36496 
  36497 END_TEST
  36498 
  36499 
  36500 START_TEST(getNDupUintSmallJsonT)
  36501 
  36502   uint64_t r;
  36503   smallJsont *self = allocSmallJson();
  36504 
  36505   smallJsont *r2 = self->f->setInt(self, "1", 2);
  36506   ck_assert_ptr_ne(r2, null);
  36507   r = self->f->getNDupUint(self, "1");
  36508   ck_assert_int_eq(r, 2);
  36509   // non int object
  36510   r2 = self->f->setBool(self, "1", true);
  36511   ck_assert_ptr_ne(r2, null);
  36512   r = self->f->getNDupUint(self, "1");
  36513   ck_assert(!r);
  36514   // null key
  36515   r = self->f->getNDupUint(self, null);
  36516   ck_assert_int_eq(r, 0);
  36517 	// empty self
  36518   freeO(self);
  36519   r = self->f->getNDupUint(self, "1");
  36520   ck_assert(!r);
  36521   terminateO(self);
  36522 
  36523 END_TEST
  36524 
  36525 
  36526 START_TEST(getNDupUint32SmallJsonT)
  36527 
  36528   uint32_t r;
  36529   smallJsont *self = allocSmallJson();
  36530 
  36531   smallJsont *r2 = self->f->setInt(self, "1", 2);
  36532   ck_assert_ptr_ne(r2, null);
  36533   r = self->f->getNDupUint32(self, "1");
  36534   ck_assert_int_eq(r, 2);
  36535   // non int object
  36536   r2 = self->f->setBool(self, "1", true);
  36537   ck_assert_ptr_ne(r2, null);
  36538   r = self->f->getNDupUint32(self, "1");
  36539   ck_assert(!r);
  36540   // null key
  36541   r = self->f->getNDupUint32(self, null);
  36542   ck_assert_int_eq(r, 0);
  36543 	// empty self
  36544   freeO(self);
  36545   r = self->f->getNDupUint32(self, "1");
  36546   ck_assert(!r);
  36547   terminateO(self);
  36548 
  36549 END_TEST
  36550 
  36551 
  36552 START_TEST(getNDupSSmallJsonT)
  36553 
  36554   char* r;
  36555   smallJsont *self = allocSmallJson();
  36556 
  36557   smallJsont *r2 = self->f->setS(self, "1", "qwe");
  36558   ck_assert_ptr_ne(r2, null);
  36559   r = self->f->getNDupS(self, "1");
  36560   ck_assert_ptr_ne(r, null);
  36561   ck_assert_str_eq(r, "qwe");
  36562   free(r);
  36563   // non string object
  36564   r2 = self->f->setBool(self, "1", true);
  36565   ck_assert_ptr_ne(r2, null);
  36566   r = self->f->getNDupS(self, "1");
  36567   ck_assert_ptr_eq(r, null);
  36568   // null key
  36569   r = self->f->getNDupS(self, null);
  36570   ck_assert_ptr_eq(r, null);
  36571 	// empty self
  36572   freeO(self);
  36573   r = self->f->getNDupS(self, "1");
  36574   ck_assert_ptr_eq(r, null);
  36575   terminateO(self);
  36576 
  36577 END_TEST
  36578 
  36579 
  36580 START_TEST(getNDupDictSmallJsonT)
  36581 
  36582   smallDictt* r;
  36583   smallJsont *self = allocSmallJson();
  36584 
  36585   createAllocateSmallDict(D);
  36586   smallJsont *r2 = self->f->setNFreeDict(self, "1", D);
  36587   ck_assert_ptr_ne(r2, null);
  36588   r = self->f->getNDupDict(self, "1");
  36589   ck_assert_ptr_ne(r, null);
  36590   char *s = toStringO(r);
  36591   terminateO(r);
  36592   ck_assert_str_eq(s, "{}");
  36593   free(s);
  36594   // non dict object
  36595   r2 = self->f->setBool(self, "1", true);
  36596   ck_assert_ptr_ne(r2, null);
  36597   r = self->f->getNDupDict(self, "1");
  36598   ck_assert_ptr_eq(r, null);
  36599   // path
  36600   smallDictt *dict = allocSmallDict();
  36601   createSmallArray(a);
  36602   createSmallDict(d);
  36603   a.f->pushDict(&a, &d);
  36604   self->f->setArray(self, "array", &a);
  36605   r2 = self->f->setDict(self, "\"array\"[0].\"key\"", dict);
  36606   ck_assert_ptr_ne(r2, null);
  36607   finishO(dict);
  36608   r = self->f->getNDupDict(self, "\"array\"[0].\"key\"");
  36609   ck_assert_ptr_ne(r, null);
  36610   terminateO(r);
  36611   // json bool
  36612   freeO(self);
  36613   setTypeBoolO(self);
  36614   r = self->f->getNDupDict(self, "1");
  36615   ck_assert_ptr_eq(r, null);
  36616   // json array
  36617   freeO(self);
  36618   setTypeArrayO(self);
  36619   r = self->f->getNDupDict(self, "1");
  36620   ck_assert_ptr_eq(r, null);
  36621   // non existing dict path
  36622   freeO(self);
  36623   r = self->f->getNDupDict(self, "\"1\"[1]");
  36624   ck_assert_ptr_eq(r, null);
  36625   //   dict path but the object is an array
  36626   resetO(&a);
  36627   self->f->setArray(self, "1", &a);
  36628   r = self->f->getNDupDict(self, "\"1\".\"1\"");
  36629   ck_assert_ptr_eq(r, null);
  36630   //   dict object in path but the key doesn't exists
  36631   resetO(&d);
  36632   self->f->setDict(self, "2", &d);
  36633   r = self->f->getNDupDict(self, "\"2\".\"1\".[12]");
  36634   ck_assert_ptr_eq(r, null);
  36635   // null key
  36636   r = self->f->getNDupDict(self, null);
  36637   ck_assert_ptr_eq(r, null);
  36638 	// empty self
  36639   freeO(self);
  36640   r = self->f->getNDupDict(self, "1");
  36641   ck_assert_ptr_eq(r, null);
  36642   terminateO(self);
  36643 
  36644 END_TEST
  36645 
  36646 
  36647 START_TEST(getNDupArraySmallJsonT)
  36648 
  36649   smallArrayt* r;
  36650   smallJsont *self = allocSmallJson();
  36651 
  36652   createAllocateSmallArray(D);
  36653   smallJsont *r2 = self->f->setNFreeArray(self, "1", D);
  36654   ck_assert_ptr_ne(r2, null);
  36655   r = self->f->getNDupArray(self, "1");
  36656   ck_assert_ptr_ne(r, null);
  36657   char *s = toStringO(r);
  36658   terminateO(r);
  36659   ck_assert_str_eq(s, "[]");
  36660   free(s);
  36661   // non Array object
  36662   r2 = self->f->setBool(self, "1", true);
  36663   ck_assert_ptr_ne(r2, null);
  36664   r = self->f->getNDupArray(self, "1");
  36665   ck_assert_ptr_eq(r, null);
  36666   // path
  36667   smallArrayt *array = allocSmallArray();
  36668   createSmallArray(a);
  36669   createSmallDict(d);
  36670   a.f->pushDict(&a, &d);
  36671   self->f->setArray(self, "array", &a);
  36672   r2 = self->f->setArray(self, "\"array\"[0].\"key\"", array);
  36673   ck_assert_ptr_ne(r2, null);
  36674   finishO(array);
  36675   r = self->f->getNDupArray(self, "\"array\"[0].\"key\"");
  36676   ck_assert_ptr_ne(r, null);
  36677   terminateO(r);
  36678   // json bool
  36679   freeO(self);
  36680   setTypeBoolO(self);
  36681   r = self->f->getNDupArray(self, "1");
  36682   ck_assert_ptr_eq(r, null);
  36683   // json array
  36684   freeO(self);
  36685   setTypeArrayO(self);
  36686   r = self->f->getNDupArray(self, "1");
  36687   ck_assert_ptr_eq(r, null);
  36688   // non existing dict path
  36689   freeO(self);
  36690   r = self->f->getNDupArray(self, "\"1\"[1]");
  36691   ck_assert_ptr_eq(r, null);
  36692   //   dict path but the object is an array
  36693   resetO(&a);
  36694   self->f->setArray(self, "1", &a);
  36695   r = self->f->getNDupArray(self, "\"1\".\"1\"");
  36696   ck_assert_ptr_eq(r, null);
  36697   //   dict object in path but the key doesn't exists
  36698   resetO(&d);
  36699   self->f->setDict(self, "2", &d);
  36700   r = self->f->getNDupArray(self, "\"2\".\"1\".[12]");
  36701   ck_assert_ptr_eq(r, null);
  36702   // null key
  36703   r = self->f->getNDupArray(self, null);
  36704   ck_assert_ptr_eq(r, null);
  36705 	// empty self
  36706   freeO(self);
  36707   r = self->f->getNDupArray(self, "1");
  36708   ck_assert_ptr_eq(r, null);
  36709   terminateO(self);
  36710 
  36711 END_TEST
  36712 
  36713 
  36714 START_TEST(getNDupSmallBoolSmallJsonT)
  36715 
  36716   smallBoolt* r;
  36717   smallJsont *self = allocSmallJson();
  36718 
  36719   createAllocateSmallBool(D);
  36720   smallJsont *r2 = self->f->setNFreeSmallBool(self, "1", D);
  36721   ck_assert_ptr_ne(r2, null);
  36722   r = self->f->getNDupSmallBool(self, "1");
  36723   ck_assert_ptr_ne(r, null);
  36724   char *s = toStringO(r);
  36725   terminateO(r);
  36726   ck_assert_str_eq(s, "false");
  36727   free(s);
  36728   // non SmallBool object
  36729   r2 = self->f->setInt(self, "1", 0);
  36730   ck_assert_ptr_ne(r2, null);
  36731   r = self->f->getNDupSmallBool(self, "1");
  36732   ck_assert_ptr_eq(r, null);
  36733   // path
  36734   smallBoolt *value = allocSmallBool(true);
  36735   createSmallArray(a);
  36736   createSmallDict(d);
  36737   a.f->pushDict(&a, &d);
  36738   self->f->setArray(self, "array", &a);
  36739   r2 = self->f->setSmallBool(self, "\"array\"[0].\"key\"", value);
  36740   ck_assert_ptr_ne(r2, null);
  36741   finishO(value);
  36742   r = self->f->getNDupSmallBool(self, "\"array\"[0].\"key\"");
  36743   ck_assert_ptr_ne(r, null);
  36744   terminateO(r);
  36745   // json bool
  36746   freeO(self);
  36747   setTypeBoolO(self);
  36748   r = self->f->getNDupSmallBool(self, "1");
  36749   ck_assert_ptr_eq(r, null);
  36750   // json array
  36751   freeO(self);
  36752   setTypeArrayO(self);
  36753   r = self->f->getNDupSmallBool(self, "1");
  36754   ck_assert_ptr_eq(r, null);
  36755   // non existing dict path
  36756   freeO(self);
  36757   r = self->f->getNDupSmallBool(self, "\"1\"[1]");
  36758   ck_assert_ptr_eq(r, null);
  36759   //   dict path but the object is an array
  36760   resetO(&a);
  36761   self->f->setArray(self, "1", &a);
  36762   r = self->f->getNDupSmallBool(self, "\"1\".\"1\"");
  36763   ck_assert_ptr_eq(r, null);
  36764   //   dict object in path but the key doesn't exists
  36765   resetO(&d);
  36766   self->f->setDict(self, "2", &d);
  36767   r = self->f->getNDupSmallBool(self, "\"2\".\"1\".[12]");
  36768   ck_assert_ptr_eq(r, null);
  36769   // null key
  36770   r = self->f->getNDupSmallBool(self, null);
  36771   ck_assert_ptr_eq(r, null);
  36772 	// empty self
  36773   freeO(self);
  36774   r = self->f->getNDupSmallBool(self, "1");
  36775   ck_assert_ptr_eq(r, null);
  36776   terminateO(self);
  36777 
  36778 END_TEST
  36779 
  36780 
  36781 START_TEST(getNDupSmallBytesSmallJsonT)
  36782 
  36783   smallBytest* r;
  36784   smallJsont *self = allocSmallJson();
  36785 
  36786   createAllocateSmallBytes(D);
  36787   smallJsont *r2 = self->f->setNFreeSmallBytes(self, "1", D);
  36788   ck_assert_ptr_ne(r2, null);
  36789   r = self->f->getNDupSmallBytes(self, "1");
  36790   ck_assert_ptr_ne(r, null);
  36791   char *s = toStringO(r);
  36792   terminateO(r);
  36793   ck_assert_str_eq(s, "[]");
  36794   free(s);
  36795   // non SmallBytes object
  36796   r2 = self->f->setBool(self, "1", true);
  36797   ck_assert_ptr_ne(r2, null);
  36798   r = self->f->getNDupSmallBytes(self, "1");
  36799   ck_assert_ptr_eq(r, null);
  36800   // path
  36801   smallBytest *value = allocSmallBytes("qwf", sizeof("qwf"));
  36802   createSmallArray(a);
  36803   createSmallDict(d);
  36804   a.f->pushDict(&a, &d);
  36805   self->f->setArray(self, "array", &a);
  36806   r2 = self->f->setSmallBytes(self, "\"array\"[0].\"key\"", value);
  36807   ck_assert_ptr_ne(r2, null);
  36808   finishO(value);
  36809   r = self->f->getNDupSmallBytes(self, "\"array\"[0].\"key\"");
  36810   ck_assert_ptr_ne(r, null);
  36811   terminateO(r);
  36812   // json bool
  36813   freeO(self);
  36814   setTypeBoolO(self);
  36815   r = self->f->getNDupSmallBytes(self, "1");
  36816   ck_assert_ptr_eq(r, null);
  36817   // json array
  36818   freeO(self);
  36819   setTypeArrayO(self);
  36820   r = self->f->getNDupSmallBytes(self, "1");
  36821   ck_assert_ptr_eq(r, null);
  36822   // non existing dict path
  36823   freeO(self);
  36824   r = self->f->getNDupSmallBytes(self, "\"1\"[1]");
  36825   ck_assert_ptr_eq(r, null);
  36826   //   dict path but the object is an array
  36827   resetO(&a);
  36828   self->f->setArray(self, "1", &a);
  36829   r = self->f->getNDupSmallBytes(self, "\"1\".\"1\"");
  36830   ck_assert_ptr_eq(r, null);
  36831   //   dict object in path but the key doesn't exists
  36832   resetO(&d);
  36833   self->f->setDict(self, "2", &d);
  36834   r = self->f->getNDupSmallBytes(self, "\"2\".\"1\".[12]");
  36835   ck_assert_ptr_eq(r, null);
  36836   // null key
  36837   r = self->f->getNDupSmallBytes(self, null);
  36838   ck_assert_ptr_eq(r, null);
  36839 	// empty self
  36840   freeO(self);
  36841   r = self->f->getNDupSmallBytes(self, "1");
  36842   ck_assert_ptr_eq(r, null);
  36843   terminateO(self);
  36844 
  36845 END_TEST
  36846 
  36847 
  36848 START_TEST(getNDupSmallDoubleSmallJsonT)
  36849 
  36850   smallDoublet* r;
  36851   smallJsont *self = allocSmallJson();
  36852 
  36853   createAllocateSmallDouble(D);
  36854   smallJsont *r2 = self->f->setNFreeSmallDouble(self, "1", D);
  36855   ck_assert_ptr_ne(r2, null);
  36856   r = self->f->getNDupSmallDouble(self, "1");
  36857   ck_assert_ptr_ne(r, null);
  36858   char *s = toStringO(r);
  36859   terminateO(r);
  36860   ck_assert_str_eq(s, "0.000000e+00");
  36861   free(s);
  36862   // non SmallDouble object
  36863   r2 = self->f->setBool(self, "1", true);
  36864   ck_assert_ptr_ne(r2, null);
  36865   r = self->f->getNDupSmallDouble(self, "1");
  36866   ck_assert_ptr_eq(r, null);
  36867   // path
  36868   smallDoublet *value = allocSmallDouble(1.2);
  36869   createSmallArray(a);
  36870   createSmallDict(d);
  36871   a.f->pushDict(&a, &d);
  36872   self->f->setArray(self, "array", &a);
  36873   r2 = self->f->setSmallDouble(self, "\"array\"[0].\"key\"", value);
  36874   ck_assert_ptr_ne(r2, null);
  36875   finishO(value);
  36876   r = self->f->getNDupSmallDouble(self, "\"array\"[0].\"key\"");
  36877   ck_assert_ptr_ne(r, null);
  36878   terminateO(r);
  36879   // json bool
  36880   freeO(self);
  36881   setTypeBoolO(self);
  36882   r = self->f->getNDupSmallDouble(self, "1");
  36883   ck_assert_ptr_eq(r, null);
  36884   // json array
  36885   freeO(self);
  36886   setTypeArrayO(self);
  36887   r = self->f->getNDupSmallDouble(self, "1");
  36888   ck_assert_ptr_eq(r, null);
  36889   // non existing dict path
  36890   freeO(self);
  36891   r = self->f->getNDupSmallDouble(self, "\"1\"[1]");
  36892   ck_assert_ptr_eq(r, null);
  36893   //   dict path but the object is an array
  36894   resetO(&a);
  36895   self->f->setArray(self, "1", &a);
  36896   r = self->f->getNDupSmallDouble(self, "\"1\".\"1\"");
  36897   ck_assert_ptr_eq(r, null);
  36898   //   dict object in path but the key doesn't exists
  36899   resetO(&d);
  36900   self->f->setDict(self, "2", &d);
  36901   r = self->f->getNDupSmallDouble(self, "\"2\".\"1\".[12]");
  36902   ck_assert_ptr_eq(r, null);
  36903   // null key
  36904   r = self->f->getNDupSmallDouble(self, null);
  36905   ck_assert_ptr_eq(r, null);
  36906 	// empty self
  36907   freeO(self);
  36908   r = self->f->getNDupSmallDouble(self, "1");
  36909   ck_assert_ptr_eq(r, null);
  36910   terminateO(self);
  36911 
  36912 END_TEST
  36913 
  36914 
  36915 START_TEST(getNDupSmallIntSmallJsonT)
  36916 
  36917   smallIntt* r;
  36918   smallJsont *self = allocSmallJson();
  36919 
  36920   createAllocateSmallInt(D);
  36921   smallJsont *r2 = self->f->setNFreeSmallInt(self, "1", D);
  36922   ck_assert_ptr_ne(r2, null);
  36923   r = self->f->getNDupSmallInt(self, "1");
  36924   ck_assert_ptr_ne(r, null);
  36925   char *s = toStringO(r);
  36926   terminateO(r);
  36927   ck_assert_str_eq(s, "0");
  36928   free(s);
  36929   // non SmallInt object
  36930   r2 = self->f->setBool(self, "1", true);
  36931   ck_assert_ptr_ne(r2, null);
  36932   r = self->f->getNDupSmallInt(self, "1");
  36933   ck_assert_ptr_eq(r, null);
  36934   // path
  36935   smallIntt *value = allocSmallInt(1);
  36936   createSmallArray(a);
  36937   createSmallDict(d);
  36938   a.f->pushDict(&a, &d);
  36939   self->f->setArray(self, "array", &a);
  36940   r2 = self->f->setSmallInt(self, "\"array\"[0].\"key\"", value);
  36941   ck_assert_ptr_ne(r2, null);
  36942   finishO(value);
  36943   r = self->f->getNDupSmallInt(self, "\"array\"[0].\"key\"");
  36944   ck_assert_ptr_ne(r, null);
  36945   terminateO(r);
  36946   // json bool
  36947   freeO(self);
  36948   setTypeBoolO(self);
  36949   r = self->f->getNDupSmallInt(self, "1");
  36950   ck_assert_ptr_eq(r, null);
  36951   // json array
  36952   freeO(self);
  36953   setTypeArrayO(self);
  36954   r = self->f->getNDupSmallInt(self, "1");
  36955   ck_assert_ptr_eq(r, null);
  36956   // non existing dict path
  36957   freeO(self);
  36958   r = self->f->getNDupSmallInt(self, "\"1\"[1]");
  36959   ck_assert_ptr_eq(r, null);
  36960   //   dict path but the object is an array
  36961   resetO(&a);
  36962   self->f->setArray(self, "1", &a);
  36963   r = self->f->getNDupSmallInt(self, "\"1\".\"1\"");
  36964   ck_assert_ptr_eq(r, null);
  36965   //   dict object in path but the key doesn't exists
  36966   resetO(&d);
  36967   self->f->setDict(self, "2", &d);
  36968   r = self->f->getNDupSmallInt(self, "\"2\".\"1\".[12]");
  36969   ck_assert_ptr_eq(r, null);
  36970   // null key
  36971   r = self->f->getNDupSmallInt(self, null);
  36972   ck_assert_ptr_eq(r, null);
  36973 	// empty self
  36974   freeO(self);
  36975   r = self->f->getNDupSmallInt(self, "1");
  36976   ck_assert_ptr_eq(r, null);
  36977   terminateO(self);
  36978 
  36979 END_TEST
  36980 
  36981 
  36982 START_TEST(getNDupSmallJsonSmallJsonT)
  36983 
  36984   smallJsont* r;
  36985   smallJsont *self = allocSmallJson();
  36986 
  36987   createAllocateSmallJson(D);
  36988   smallJsont *r2 = self->f->setNFreeSmallJson(self, "1", D);
  36989   ck_assert_ptr_ne(r2, null);
  36990   r = self->f->getNDupSmallJson(self, "1");
  36991   ck_assert_ptr_ne(r, null);
  36992   char *s = toStringO(r);
  36993   terminateO(r);
  36994   ck_assert_str_eq(s, "{}");
  36995   free(s);
  36996   r2 = self->f->setBool(self, "1", true);
  36997   ck_assert_ptr_ne(r2, null);
  36998   r = self->f->getNDupSmallJson(self, "1");
  36999   ck_assert_ptr_ne(r, null);
  37000   s = toStringO(r);
  37001   terminateO(r);
  37002   ck_assert_str_eq(s, "true");
  37003   free(s);
  37004   // non SmallJson object
  37005   smallContainert *c = allocSmallContainer(NULL);
  37006   r2 = self->f->setNFreeSmallContainer(self, "1", c);
  37007   ck_assert_ptr_ne(r2, null);
  37008   r = self->f->getNDupSmallJson(self, "1");
  37009   ck_assert_ptr_eq(r, null);
  37010   // path
  37011   smallJsont *value = allocSmallJson();
  37012   createSmallArray(a);
  37013   createSmallDict(d);
  37014   a.f->pushDict(&a, &d);
  37015   self->f->setArray(self, "array", &a);
  37016   r = self->f->setSmallJson(self, "\"array\"[0].\"key\"", value);
  37017   ck_assert_ptr_ne(r, null);
  37018   finishO(value);
  37019   r = self->f->getNDupSmallJson(self, "\"array\"[0].\"key\"");
  37020   ck_assert_ptr_ne(r, null);
  37021   terminateO(r);
  37022   // json bool
  37023   freeO(self);
  37024   setTypeBoolO(self);
  37025   r = self->f->getNDupSmallJson(self, "1");
  37026   ck_assert_ptr_eq(r, null);
  37027   // json array
  37028   freeO(self);
  37029   setTypeArrayO(self);
  37030   r = self->f->getNDupSmallJson(self, "1");
  37031   ck_assert_ptr_eq(r, null);
  37032   // non existing dict path
  37033   freeO(self);
  37034   r = self->f->getNDupSmallJson(self, "\"1\"[1]");
  37035   ck_assert_ptr_eq(r, null);
  37036   //   dict path but the object is an array
  37037   resetO(&a);
  37038   self->f->setArray(self, "1", &a);
  37039   r = self->f->getNDupSmallJson(self, "\"1\".\"1\"");
  37040   ck_assert_ptr_eq(r, null);
  37041   //   dict object in path but the key doesn't exists
  37042   resetO(&d);
  37043   self->f->setDict(self, "2", &d);
  37044   r = self->f->getNDupSmallJson(self, "\"2\".\"1\".[12]");
  37045   ck_assert_ptr_eq(r, null);
  37046   // null key
  37047   r = self->f->getNDupSmallJson(self, null);
  37048   ck_assert_ptr_eq(r, null);
  37049 	// empty self
  37050   freeO(self);
  37051   r = self->f->getNDupSmallJson(self, "1");
  37052   ck_assert_ptr_eq(r, null);
  37053   terminateO(self);
  37054 
  37055 END_TEST
  37056 
  37057 
  37058 START_TEST(getNDupSmallStringSmallJsonT)
  37059 
  37060   smallStringt* r;
  37061   smallJsont *self = allocSmallJson();
  37062 
  37063   createAllocateSmallString(D);
  37064   smallJsont *r2 = self->f->setNFreeSmallString(self, "1", D);
  37065   ck_assert_ptr_ne(r2, null);
  37066   r = self->f->getNDupSmallString(self, "1");
  37067   ck_assert_ptr_ne(r, null);
  37068   char *s = toStringO(r);
  37069   terminateO(r);
  37070   ck_assert_str_eq(s, "");
  37071   free(s);
  37072   // non SmallString object
  37073   r2 = self->f->setBool(self, "1", true);
  37074   ck_assert_ptr_ne(r2, null);
  37075   r = self->f->getNDupSmallString(self, "1");
  37076   ck_assert_ptr_eq(r, null);
  37077   // path
  37078   smallStringt *value = allocSmallString("asd");
  37079   createSmallArray(a);
  37080   createSmallDict(d);
  37081   a.f->pushDict(&a, &d);
  37082   self->f->setArray(self, "array", &a);
  37083   r2 = self->f->setSmallString(self, "\"array\"[0].\"key\"", value);
  37084   ck_assert_ptr_ne(r2, null);
  37085   finishO(value);
  37086   r = self->f->getNDupSmallString(self, "\"array\"[0].\"key\"");
  37087   ck_assert_ptr_ne(r, null);
  37088   terminateO(r);
  37089   // json bool
  37090   freeO(self);
  37091   setTypeBoolO(self);
  37092   r = self->f->getNDupSmallString(self, "1");
  37093   ck_assert_ptr_eq(r, null);
  37094   // json array
  37095   freeO(self);
  37096   setTypeArrayO(self);
  37097   r = self->f->getNDupSmallString(self, "1");
  37098   ck_assert_ptr_eq(r, null);
  37099   // non existing dict path
  37100   freeO(self);
  37101   r = self->f->getNDupSmallString(self, "\"1\"[1]");
  37102   ck_assert_ptr_eq(r, null);
  37103   //   dict path but the object is an array
  37104   resetO(&a);
  37105   self->f->setArray(self, "1", &a);
  37106   r = self->f->getNDupSmallString(self, "\"1\".\"1\"");
  37107   ck_assert_ptr_eq(r, null);
  37108   //   dict object in path but the key doesn't exists
  37109   resetO(&d);
  37110   self->f->setDict(self, "2", &d);
  37111   r = self->f->getNDupSmallString(self, "\"2\".\"1\".[12]");
  37112   ck_assert_ptr_eq(r, null);
  37113   // null key
  37114   r = self->f->getNDupSmallString(self, null);
  37115   ck_assert_ptr_eq(r, null);
  37116 	// empty self
  37117   freeO(self);
  37118   r = self->f->getNDupSmallString(self, "1");
  37119   ck_assert_ptr_eq(r, null);
  37120   terminateO(self);
  37121 
  37122 END_TEST
  37123 
  37124 
  37125 START_TEST(getNDupVoidSmallJsonT)
  37126 
  37127   void* r;
  37128   smallJsont *self = allocSmallJson();
  37129 
  37130   smallContainert* D = allocSmallContainer(&r);
  37131   smallJsont *r2 = self->f->setNFreeSmallContainer(self, "1", D);
  37132   ck_assert_ptr_ne(r2, null);
  37133   r = self->f->getNDupVoid(self, "1");
  37134   // result is null because the duplicate function in the container
  37135   // is not set.
  37136   ck_assert_ptr_eq(r, null);
  37137   // non container object
  37138   r2 = self->f->setBool(self, "1", true);
  37139   ck_assert_ptr_ne(r2, null);
  37140   r = self->f->getNDupVoid(self, "1");
  37141   ck_assert_ptr_eq(r, null);
  37142   // path
  37143   smallContainert *value = allocSmallContainer(&r);
  37144   createSmallArray(a);
  37145   createSmallDict(d);
  37146   a.f->pushDict(&a, &d);
  37147   self->f->setArray(self, "array", &a);
  37148   r2 = self->f->setSmallContainer(self, "\"array\"[0].\"key\"", value);
  37149   ck_assert_ptr_ne(r2, null);
  37150   finishO(value);
  37151   r = self->f->getNDupVoid(self, "\"array\"[0].\"key\"");
  37152   // result is null because the duplicate function in the container
  37153   // is not set.
  37154   ck_assert_ptr_eq(r, null);
  37155   // json bool
  37156   freeO(self);
  37157   setTypeBoolO(self);
  37158   r = self->f->getNDupVoid(self, "1");
  37159   ck_assert_ptr_eq(r, null);
  37160   // json array
  37161   freeO(self);
  37162   setTypeArrayO(self);
  37163   r = self->f->getNDupVoid(self, "1");
  37164   ck_assert_ptr_eq(r, null);
  37165   // non existing dict path
  37166   freeO(self);
  37167   r = self->f->getNDupVoid(self, "\"1\"[1]");
  37168   ck_assert_ptr_eq(r, null);
  37169   //   dict path but the object is an array
  37170   resetO(&a);
  37171   self->f->setArray(self, "1", &a);
  37172   r = self->f->getNDupVoid(self, "\"1\".\"1\"");
  37173   ck_assert_ptr_eq(r, null);
  37174   //   dict object in path but the key doesn't exists
  37175   resetO(&d);
  37176   self->f->setDict(self, "2", &d);
  37177   r = self->f->getNDupVoid(self, "\"2\".\"1\".[12]");
  37178   ck_assert_ptr_eq(r, null);
  37179   // null key
  37180   r = self->f->getNDupVoid(self, null);
  37181   ck_assert_ptr_eq(r, null);
  37182 	// empty self
  37183   freeO(self);
  37184   r = self->f->getNDupVoid(self, "1");
  37185   ck_assert_ptr_eq(r, null);
  37186   terminateO(self);
  37187 
  37188 END_TEST
  37189 
  37190 
  37191 START_TEST(getNDupSmallContainerSmallJsonT)
  37192 
  37193   smallContainert* r;
  37194   smallJsont *self = allocSmallJson();
  37195 
  37196   createAllocateSmallContainer(D);
  37197   smallJsont *r2 = self->f->setNFreeSmallContainer(self, "1", D);
  37198   ck_assert_ptr_ne(r2, null);
  37199   r = self->f->getNDupSmallContainer(self, "1");
  37200   ck_assert_ptr_ne(r, null);
  37201   char *s = toStringO(r);
  37202   terminateO(r);
  37203   ck_assert_str_eq(s, "<data smallContainer>");
  37204   free(s);
  37205   // other base class
  37206   smallIntt *t = allocSmallInt(2);
  37207   t->type = "randomClass";
  37208   r2 = self->f->setNFree(self, "1", (baset*)t);
  37209   ck_assert_ptr_ne(r2, null);
  37210   r = self->f->getNDupSmallContainer(self, "1");
  37211   ck_assert_ptr_eq(r, null);
  37212   // non SmallContainer object
  37213   r2 = self->f->setBool(self, "1", true);
  37214   ck_assert_ptr_ne(r2, null);
  37215   r = self->f->getNDupSmallContainer(self, "1");
  37216   ck_assert_ptr_eq(r, null);
  37217   // path
  37218   smallContainert *value = allocSmallContainer(null);
  37219   createSmallArray(a);
  37220   createSmallDict(d);
  37221   a.f->pushDict(&a, &d);
  37222   self->f->setArray(self, "array", &a);
  37223   r2 = self->f->setSmallContainer(self, "\"array\"[0].\"key\"", value);
  37224   ck_assert_ptr_ne(r2, null);
  37225   finishO(value);
  37226   r = self->f->getNDupSmallContainer(self, "\"array\"[0].\"key\"");
  37227   ck_assert_ptr_ne(r, null);
  37228   terminateO(r);
  37229   // json bool
  37230   freeO(self);
  37231   setTypeBoolO(self);
  37232   r = self->f->getNDupSmallContainer(self, "1");
  37233   ck_assert_ptr_eq(r, null);
  37234   // json array
  37235   freeO(self);
  37236   setTypeArrayO(self);
  37237   r = self->f->getNDupSmallContainer(self, "1");
  37238   ck_assert_ptr_eq(r, null);
  37239   // non existing dict path
  37240   freeO(self);
  37241   r = self->f->getNDupSmallContainer(self, "\"1\"[1]");
  37242   ck_assert_ptr_eq(r, null);
  37243   //   dict path but the object is an array
  37244   resetO(&a);
  37245   self->f->setArray(self, "1", &a);
  37246   r = self->f->getNDupSmallContainer(self, "\"1\".\"1\"");
  37247   ck_assert_ptr_eq(r, null);
  37248   //   dict object in path but the key doesn't exists
  37249   resetO(&d);
  37250   self->f->setDict(self, "2", &d);
  37251   r = self->f->getNDupSmallContainer(self, "\"2\".\"1\".[12]");
  37252   ck_assert_ptr_eq(r, null);
  37253   // null key
  37254   r = self->f->getNDupSmallContainer(self, null);
  37255   ck_assert_ptr_eq(r, null);
  37256 	// empty self
  37257   freeO(self);
  37258   r = self->f->getNDupSmallContainer(self, "1");
  37259   ck_assert_ptr_eq(r, null);
  37260   terminateO(self);
  37261 
  37262 END_TEST
  37263 
  37264 
  37265 START_TEST(getAtSmallJsonT)
  37266 
  37267   baset* r;
  37268   smallJsont *self = allocG(rtSmallJsont);
  37269   smallJsont *r2;
  37270 
  37271   // non json array
  37272   ck_assert_ptr_eq(getAtO(self, 0), null);
  37273   // add elements to self
  37274   r2 = self->f->pushInt(self, 1);
  37275   ck_assert_ptr_ne(r2, null);
  37276   createSmallDict(e2);
  37277   r2 = self->f->pushDict(self, &e2);
  37278   ck_assert_ptr_ne(r2, null);
  37279   r2 = self->f->pushInt(self, 3);
  37280   ck_assert_ptr_ne(r2, null);
  37281   createSmallDict(e4);
  37282   r2 = self->f->pushDict(self, &e4);
  37283   ck_assert_ptr_ne(r2, null);
  37284   // positive index
  37285   r       = getAtO(self,1);
  37286   ck_assert_ptr_ne(r, null);
  37287   char *s = toStringO(r);
  37288   finishO(r);
  37289   ck_assert_str_eq(s, "{}");
  37290   free(s);
  37291   s = toStringO(self);
  37292   ck_assert_str_eq(s, "[1,{},3,{}]");
  37293   free(s);
  37294   // negative index
  37295   r = getAtO(self,-1);
  37296   ck_assert_ptr_ne(r, null);
  37297   s = toStringO(r);
  37298   finishO(r);
  37299   ck_assert_str_eq(s, "{}");
  37300   free(s);
  37301   s = toStringO(self);
  37302   ck_assert_str_eq(s, "[1,{},3,{}]");
  37303   free(s);
  37304   // index outside
  37305   ck_assert_ptr_eq(getAtO(self, 20), NULL);
  37306   ck_assert_ptr_eq(getAtO(self, -7), NULL);
  37307   // empty list
  37308   emptyO(self);
  37309   ck_assert_ptr_eq(getAtO(self, 0), NULL);
  37310   ck_assert_ptr_eq(getAtO(self, -1), NULL);
  37311   terminateO(self);
  37312 
  37313 END_TEST
  37314 
  37315 
  37316 START_TEST(getAtUndefinedSmallJsonT)
  37317 
  37318   undefinedt* r;
  37319   smallJsont *self = allocSmallJson();
  37320   smallJsont *r2;
  37321 
  37322   // non json array
  37323   ck_assert_ptr_eq(self->f->getAtUndefined(self, 0), null);
  37324   // add elements to self
  37325   r2 = self->f->pushInt(self, 1);
  37326   ck_assert_ptr_ne(r2, null);
  37327   r2 = self->f->pushUndefined(self);
  37328   ck_assert_ptr_ne(r2, null);
  37329   r2 = self->f->pushInt(self, 3);
  37330   ck_assert_ptr_ne(r2, null);
  37331   r2 = self->f->pushUndefined(self);
  37332   ck_assert_ptr_ne(r2, null);
  37333 
  37334   // positive index
  37335   r       = self->f->getAtUndefined(self,1);
  37336   ck_assert_ptr_ne(r, null);
  37337   char *s = toStringO(r);
  37338   finishO(r);
  37339   ck_assert_str_eq(s, "null");
  37340   free(s);
  37341   s = toStringO(self);
  37342   ck_assert_str_eq(s, "[1,null,3,null]");
  37343   free(s);
  37344   // negative index
  37345   r = self->f->getAtUndefined(self,-1);
  37346   ck_assert_ptr_ne(r, null);
  37347   s = toStringO(r);
  37348   finishO(r);
  37349   ck_assert_str_eq(s, "null");
  37350   free(s);
  37351   s = toStringO(self);
  37352   ck_assert_str_eq(s, "[1,null,3,null]");
  37353   free(s);
  37354   // wrong object type
  37355   createSmallInt(I);
  37356   setValG(&I, 11);
  37357   r2 = self->f->pushSmallInt(self, &I);
  37358   ck_assert_ptr_ne(r2, null);
  37359   r = self->f->getAtUndefined(self,-1);
  37360   ck_assert_ptr_eq(r, null);
  37361   s = toStringO(self);
  37362   ck_assert_str_eq(s, "[1,null,3,null,11]");
  37363   free(s);
  37364   // index outside
  37365   ck_assert_ptr_eq(self->f->getAtUndefined(self, 20), NULL);
  37366   ck_assert_ptr_eq(self->f->getAtUndefined(self, -6), NULL);
  37367   // empty list
  37368   emptyO(self);
  37369   ck_assert_ptr_eq(self->f->getAtUndefined(self, 0), NULL);
  37370   ck_assert_ptr_eq(self->f->getAtUndefined(self, -1), NULL);
  37371   terminateO(self);
  37372 
  37373 END_TEST
  37374 
  37375 
  37376 START_TEST(getAtBoolSmallJsonT)
  37377 
  37378   bool r;
  37379   smallJsont *self = allocSmallJson();
  37380   smallJsont *r2;
  37381 
  37382   // add elements to self
  37383   r2 = self->f->pushInt(self, 1);
  37384   ck_assert_ptr_ne(r2, null);
  37385   r2 = self->f->pushBool(self, TRUE);
  37386   ck_assert_ptr_ne(r2, null);
  37387   r2 = self->f->pushInt(self, 3);
  37388   ck_assert_ptr_ne(r2, null);
  37389   r2 = self->f->pushBool(self, TRUE);
  37390   ck_assert_ptr_ne(r2, null);
  37391 
  37392   // positive index
  37393   r       = self->f->getAtBool(self,1);
  37394   ck_assert(r);
  37395   char *s = toStringO(self);
  37396   ck_assert_str_eq(s, "[1,true,3,true]");
  37397   free(s);
  37398   // negative index
  37399   r = self->f->getAtBool(self,-1);
  37400   ck_assert(r);
  37401   s = toStringO(self);
  37402   ck_assert_str_eq(s, "[1,true,3,true]");
  37403   free(s);
  37404   // wrong object type
  37405   createSmallInt(I);
  37406   setValG(&I, 11);
  37407   r2 = self->f->pushSmallInt(self, &I);
  37408   r = self->f->getAtBool(self,-1);
  37409   ck_assert(!r);
  37410   s = toStringO(self);
  37411   ck_assert_str_eq(s, "[1,true,3,true,11]");
  37412   free(s);
  37413   // wrong object type of another user class
  37414   //   User classes are stored in containers transparently
  37415   createAllocateSmallInt(ip);
  37416   ip->type = "anothertype";
  37417   setValG(ip, 11);
  37418   r2 = self->f->push(self, (baset*)ip);
  37419   ck_assert_ptr_ne(r2, null);
  37420   r = self->f->getAtBool(self,-1);
  37421   ck_assert(!r);
  37422   s = toStringO(self);
  37423   ck_assert_str_eq(s, "[1,true,3,true,11,\"<data container>\"]");
  37424   free(s);
  37425   // index outside
  37426   ck_assert(!self->f->getAtBool(self, 20));
  37427   ck_assert(!self->f->getAtBool(self, -7));
  37428   // empty list
  37429   emptyO(self);
  37430   ck_assert(!self->f->getAtBool(self, 0));
  37431   ck_assert(!self->f->getAtBool(self, -1));
  37432   terminateO(self);
  37433 
  37434 END_TEST
  37435 
  37436 
  37437 START_TEST(getAtBoolPSmallJsonT)
  37438 
  37439   bool* r;
  37440   smallJsont *self = allocSmallJson();
  37441   smallJsont *r2;
  37442 
  37443   // add elements to self
  37444   r2 = self->f->pushInt(self, 1);
  37445   ck_assert_ptr_ne(r2, null);
  37446   r2 = self->f->pushBool(self, TRUE);
  37447   ck_assert_ptr_ne(r2, null);
  37448   r2 = self->f->pushInt(self, 3);
  37449   ck_assert_ptr_ne(r2, null);
  37450   r2 = self->f->pushBool(self, TRUE);
  37451   ck_assert_ptr_ne(r2, null);
  37452 
  37453   // positive index
  37454   r       = self->f->getAtBoolP(self,1);
  37455   ck_assert_ptr_ne(r, null);
  37456   ck_assert(*r);
  37457   char *s = toStringO(self);
  37458   ck_assert_str_eq(s, "[1,true,3,true]");
  37459   free(s);
  37460   // negative index
  37461   r = self->f->getAtBoolP(self,-1);
  37462   ck_assert_ptr_ne(r, null);
  37463   ck_assert(*r);
  37464   s = toStringO(self);
  37465   ck_assert_str_eq(s, "[1,true,3,true]");
  37466   free(s);
  37467   // wrong object type
  37468   createSmallInt(I);
  37469   setValG(&I, 11);
  37470   r2 = self->f->pushSmallInt(self, &I);
  37471   r = self->f->getAtBoolP(self,-1);
  37472   ck_assert_ptr_eq(r, null);
  37473   s = toStringO(self);
  37474   ck_assert_str_eq(s, "[1,true,3,true,11]");
  37475   free(s);
  37476   // wrong object type of another user class
  37477   //   User classes are stored in containers transparently
  37478   createAllocateSmallInt(ip);
  37479   ip->type = "anothertype";
  37480   setValG(ip, 11);
  37481   r2 = self->f->push(self, (baset*)ip);
  37482   ck_assert_ptr_ne(r2, null);
  37483   r = self->f->getAtBoolP(self,-1);
  37484   ck_assert_ptr_eq(r, null);
  37485   s = toStringO(self);
  37486   ck_assert_str_eq(s, "[1,true,3,true,11,\"<data container>\"]");
  37487   free(s);
  37488   // index outside
  37489   ck_assert(!self->f->getAtBoolP(self, 20));
  37490   ck_assert(!self->f->getAtBoolP(self, -7));
  37491   // empty list
  37492   emptyO(self);
  37493   ck_assert(!self->f->getAtBoolP(self, 0));
  37494   ck_assert(!self->f->getAtBoolP(self, -1));
  37495   terminateO(self);
  37496 
  37497 END_TEST
  37498 
  37499 
  37500 START_TEST(getAtDoubleSmallJsonT)
  37501 
  37502   double r;
  37503   smallJsont *self = allocSmallJson();
  37504   smallJsont *r2;
  37505 
  37506   // add elements to self
  37507   r2 = self->f->pushInt(self, 1);
  37508   ck_assert_ptr_ne(r2, null);
  37509   r2 = self->f->pushDouble(self, 2);
  37510   ck_assert_ptr_ne(r2, null);
  37511   r2 = self->f->pushInt(self, 3);
  37512   ck_assert_ptr_ne(r2, null);
  37513   r2 = self->f->pushDouble(self, 4);
  37514   ck_assert_ptr_ne(r2, null);
  37515 
  37516   // positive index
  37517   r       = self->f->getAtDouble(self,1);
  37518   ck_assert(r==2);
  37519   char *s = toStringO(self);
  37520   ck_assert_str_eq(s, "[1,2.000000e+00,3,4.000000e+00]");
  37521   free(s);
  37522   // negative index
  37523   r = self->f->getAtDouble(self,-1);
  37524   ck_assert(r==4);
  37525   s = toStringO(self);
  37526   ck_assert_str_eq(s, "[1,2.000000e+00,3,4.000000e+00]");
  37527   free(s);
  37528   // wrong object type
  37529   createSmallInt(I);
  37530   setValG(&I, 11);
  37531   r2 = self->f->pushSmallInt(self, &I);
  37532   r = self->f->getAtDouble(self,-1);
  37533   ck_assert(!r);
  37534   s = toStringO(self);
  37535   ck_assert_str_eq(s, "[1,2.000000e+00,3,4.000000e+00,11]");
  37536   free(s);
  37537   // wrong object type of another user class
  37538   //   User classes are stored in containers transparently
  37539   createAllocateSmallInt(ip);
  37540   ip->type = "anothertype";
  37541   setValG(ip, 11);
  37542   r2 = self->f->push(self, (baset*)ip);
  37543   ck_assert_ptr_ne(r2, null);
  37544   r = self->f->getAtDouble(self,-1);
  37545   ck_assert(!r);
  37546   s = toStringO(self);
  37547   ck_assert_str_eq(s, "[1,2.000000e+00,3,4.000000e+00,11,\"<data container>\"]");
  37548   free(s);
  37549   // index outside
  37550   ck_assert(!self->f->getAtDouble(self, 20));
  37551   ck_assert(!self->f->getAtDouble(self, -7));
  37552   // empty list
  37553   emptyO(self);
  37554   ck_assert(!self->f->getAtDouble(self, 0));
  37555   ck_assert(!self->f->getAtDouble(self, -1));
  37556   terminateO(self);
  37557 
  37558 END_TEST
  37559 
  37560 
  37561 START_TEST(getAtDoublePSmallJsonT)
  37562 
  37563   double* r;
  37564   smallJsont *self = allocSmallJson();
  37565   smallJsont *r2;
  37566 
  37567   // add elements to self
  37568   r2 = self->f->pushInt(self, 1);
  37569   ck_assert_ptr_ne(r2, null);
  37570   r2 = self->f->pushDouble(self, 2);
  37571   ck_assert_ptr_ne(r2, null);
  37572   r2 = self->f->pushInt(self, 3);
  37573   ck_assert_ptr_ne(r2, null);
  37574   r2 = self->f->pushDouble(self, 4);
  37575   ck_assert_ptr_ne(r2, null);
  37576 
  37577   // positive index
  37578   r       = self->f->getAtDoubleP(self,1);
  37579   ck_assert_ptr_ne(r, null);
  37580   ck_assert(*r==2);
  37581   char *s = toStringO(self);
  37582   ck_assert_str_eq(s, "[1,2.000000e+00,3,4.000000e+00]");
  37583   free(s);
  37584   // negative index
  37585   r = self->f->getAtDoubleP(self,-1);
  37586   ck_assert_ptr_ne(r, null);
  37587   ck_assert(*r==4);
  37588   s = toStringO(self);
  37589   ck_assert_str_eq(s, "[1,2.000000e+00,3,4.000000e+00]");
  37590   free(s);
  37591   // wrong object type
  37592   createSmallInt(I);
  37593   setValG(&I, 11);
  37594   r2 = self->f->pushSmallInt(self, &I);
  37595   r = self->f->getAtDoubleP(self,-1);
  37596   ck_assert_ptr_eq(r, null);
  37597   s = toStringO(self);
  37598   ck_assert_str_eq(s, "[1,2.000000e+00,3,4.000000e+00,11]");
  37599   free(s);
  37600   // wrong object type of another user class
  37601   //   User classes are stored in containers transparently
  37602   createAllocateSmallInt(ip);
  37603   ip->type = "anothertype";
  37604   setValG(ip, 11);
  37605   r2 = self->f->push(self, (baset*)ip);
  37606   ck_assert_ptr_ne(r2, null);
  37607   r = self->f->getAtDoubleP(self,-1);
  37608   ck_assert_ptr_eq(r, null);
  37609   s = toStringO(self);
  37610   ck_assert_str_eq(s, "[1,2.000000e+00,3,4.000000e+00,11,\"<data container>\"]");
  37611   free(s);
  37612   // index outside
  37613   ck_assert(!self->f->getAtDoubleP(self, 20));
  37614   ck_assert(!self->f->getAtDoubleP(self, -7));
  37615   // empty list
  37616   emptyO(self);
  37617   ck_assert(!self->f->getAtDoubleP(self, 0));
  37618   ck_assert(!self->f->getAtDoubleP(self, -1));
  37619   terminateO(self);
  37620 
  37621 END_TEST
  37622 
  37623 
  37624 START_TEST(getAtIntSmallJsonT)
  37625 
  37626   int64_t r;
  37627   smallJsont *self = allocSmallJson();
  37628   smallJsont *r2;
  37629 
  37630   // add elements to self
  37631   r2 = self->f->pushInt(self, 1);
  37632   ck_assert_ptr_ne(r2, null);
  37633   r2 = self->f->pushInt(self, 2);
  37634   ck_assert_ptr_ne(r2, null);
  37635   r2 = self->f->pushInt(self, 3);
  37636   ck_assert_ptr_ne(r2, null);
  37637   r2 = self->f->pushInt(self, 4);
  37638   ck_assert_ptr_ne(r2, null);
  37639 
  37640   // positive index
  37641   r       = self->f->getAtInt(self,1);
  37642   ck_assert(r==2);
  37643   char *s = toStringO(self);
  37644   ck_assert_str_eq(s, "[1,2,3,4]");
  37645   free(s);
  37646   // negative index
  37647   r = self->f->getAtInt(self,-1);
  37648   ck_assert(r==4);
  37649   s = toStringO(self);
  37650   ck_assert_str_eq(s, "[1,2,3,4]");
  37651   free(s);
  37652   // wrong object type
  37653   createSmallDouble(I);
  37654   setValG(&I, 11);
  37655   r2 = self->f->pushSmallDouble(self, &I);
  37656   r = self->f->getAtInt(self,-1);
  37657   ck_assert(!r);
  37658   s = toStringO(self);
  37659   ck_assert_str_eq(s, "[1,2,3,4,1.100000e+01]");
  37660   free(s);
  37661   // wrong object type of another user class
  37662   //   User classes are stored in containers transparently
  37663   createAllocateSmallInt(ip);
  37664   ip->type = "anothertype";
  37665   setValG(ip, 11);
  37666   r2 = self->f->push(self, (baset*)ip);
  37667   ck_assert_ptr_ne(r2, null);
  37668   r = self->f->getAtInt(self,-1);
  37669   ck_assert(!r);
  37670   s = toStringO(self);
  37671   ck_assert_str_eq(s, "[1,2,3,4,1.100000e+01,\"<data container>\"]");
  37672   free(s);
  37673   // index outside
  37674   ck_assert(!self->f->getAtInt(self, 20));
  37675   ck_assert(!self->f->getAtInt(self, -7));
  37676   // empty list
  37677   emptyO(self);
  37678   ck_assert(!self->f->getAtInt(self, 0));
  37679   ck_assert(!self->f->getAtInt(self, -1));
  37680   terminateO(self);
  37681 
  37682 END_TEST
  37683 
  37684 
  37685 START_TEST(getAtIntPSmallJsonT)
  37686 
  37687   int64_t* r;
  37688   smallJsont *self = allocSmallJson();
  37689   smallJsont *r2;
  37690 
  37691   // add elements to self
  37692   r2 = self->f->pushInt(self, 1);
  37693   ck_assert_ptr_ne(r2, null);
  37694   r2 = self->f->pushInt(self, 2);
  37695   ck_assert_ptr_ne(r2, null);
  37696   r2 = self->f->pushInt(self, 3);
  37697   ck_assert_ptr_ne(r2, null);
  37698   r2 = self->f->pushInt(self, 4);
  37699   ck_assert_ptr_ne(r2, null);
  37700 
  37701   // positive index
  37702   r       = self->f->getAtIntP(self,1);
  37703   ck_assert_ptr_ne(r, null);
  37704   ck_assert(*r==2);
  37705   char *s = toStringO(self);
  37706   ck_assert_str_eq(s, "[1,2,3,4]");
  37707   free(s);
  37708   // negative index
  37709   r = self->f->getAtIntP(self,-1);
  37710   ck_assert_ptr_ne(r, null);
  37711   ck_assert(*r==4);
  37712   s = toStringO(self);
  37713   ck_assert_str_eq(s, "[1,2,3,4]");
  37714   free(s);
  37715   // wrong object type
  37716   createSmallDouble(I);
  37717   setValG(&I, 11);
  37718   r2 = self->f->pushSmallDouble(self, &I);
  37719   r = self->f->getAtIntP(self,-1);
  37720   ck_assert_ptr_eq(r, null);
  37721   s = toStringO(self);
  37722   ck_assert_str_eq(s, "[1,2,3,4,1.100000e+01]");
  37723   free(s);
  37724   // wrong object type of another user class
  37725   //   User classes are stored in containers transparently
  37726   createAllocateSmallInt(ip);
  37727   ip->type = "anothertype";
  37728   setValG(ip, 11);
  37729   r2 = self->f->push(self, (baset*)ip);
  37730   ck_assert_ptr_ne(r2, null);
  37731   r = self->f->getAtIntP(self,-1);
  37732   ck_assert_ptr_eq(r, null);
  37733   s = toStringO(self);
  37734   ck_assert_str_eq(s, "[1,2,3,4,1.100000e+01,\"<data container>\"]");
  37735   free(s);
  37736   // index outside
  37737   ck_assert(!self->f->getAtIntP(self, 20));
  37738   ck_assert(!self->f->getAtIntP(self, -7));
  37739   // empty list
  37740   emptyO(self);
  37741   ck_assert(!self->f->getAtIntP(self, 0));
  37742   ck_assert(!self->f->getAtIntP(self, -1));
  37743   terminateO(self);
  37744 
  37745 END_TEST
  37746 
  37747 
  37748 START_TEST(getAtInt32SmallJsonT)
  37749 
  37750   int32_t r;
  37751   smallJsont *self = allocSmallJson();
  37752   smallJsont *r2;
  37753 
  37754   // add elements to self
  37755   r2 = self->f->pushInt(self, 1);
  37756   ck_assert_ptr_ne(r2, null);
  37757   r2 = self->f->pushInt(self, 2);
  37758   ck_assert_ptr_ne(r2, null);
  37759   r2 = self->f->pushInt(self, 3);
  37760   ck_assert_ptr_ne(r2, null);
  37761   r2 = self->f->pushInt(self, 4);
  37762   ck_assert_ptr_ne(r2, null);
  37763 
  37764   // positive index
  37765   r       = self->f->getAtInt32(self,1);
  37766   ck_assert(r==2);
  37767   char *s = toStringO(self);
  37768   ck_assert_str_eq(s, "[1,2,3,4]");
  37769   free(s);
  37770   // negative index
  37771   r = self->f->getAtInt32(self,-1);
  37772   ck_assert(r==4);
  37773   s = toStringO(self);
  37774   ck_assert_str_eq(s, "[1,2,3,4]");
  37775   free(s);
  37776   // wrong object type
  37777   createSmallDouble(I);
  37778   setValG(&I, 11);
  37779   r2 = self->f->pushSmallDouble(self, &I);
  37780   r = self->f->getAtInt32(self,-1);
  37781   ck_assert(!r);
  37782   s = toStringO(self);
  37783   ck_assert_str_eq(s, "[1,2,3,4,1.100000e+01]");
  37784   free(s);
  37785   // wrong object type of another user class
  37786   //   User classes are stored in containers transparently
  37787   createAllocateSmallInt(ip);
  37788   ip->type = "anothertype";
  37789   setValG(ip, 11);
  37790   r2 = self->f->push(self, (baset*)ip);
  37791   ck_assert_ptr_ne(r2, null);
  37792   r = self->f->getAtInt32(self,-1);
  37793   ck_assert(!r);
  37794   s = toStringO(self);
  37795   ck_assert_str_eq(s, "[1,2,3,4,1.100000e+01,\"<data container>\"]");
  37796   free(s);
  37797   // index outside
  37798   ck_assert(!self->f->getAtInt32(self, 20));
  37799   ck_assert(!self->f->getAtInt32(self, -7));
  37800   // empty list
  37801   emptyO(self);
  37802   ck_assert(!self->f->getAtInt32(self, 0));
  37803   ck_assert(!self->f->getAtInt32(self, -1));
  37804   terminateO(self);
  37805 
  37806 END_TEST
  37807 
  37808 
  37809 START_TEST(getAtInt32PSmallJsonT)
  37810 
  37811   int32_t* r;
  37812   smallJsont *self = allocSmallJson();
  37813   smallJsont *r2;
  37814 
  37815   // add elements to self
  37816   r2 = self->f->pushInt(self, 1);
  37817   ck_assert_ptr_ne(r2, null);
  37818   r2 = self->f->pushInt(self, 2);
  37819   ck_assert_ptr_ne(r2, null);
  37820   r2 = self->f->pushInt(self, 3);
  37821   ck_assert_ptr_ne(r2, null);
  37822   r2 = self->f->pushInt(self, 4);
  37823   ck_assert_ptr_ne(r2, null);
  37824 
  37825   // positive index
  37826   r       = self->f->getAtInt32P(self,1);
  37827   ck_assert_ptr_ne(r, null);
  37828   ck_assert(*r==2);
  37829   char *s = toStringO(self);
  37830   ck_assert_str_eq(s, "[1,2,3,4]");
  37831   free(s);
  37832   // negative index
  37833   r = self->f->getAtInt32P(self,-1);
  37834   ck_assert_ptr_ne(r, null);
  37835   ck_assert(*r==4);
  37836   s = toStringO(self);
  37837   ck_assert_str_eq(s, "[1,2,3,4]");
  37838   free(s);
  37839   // wrong object type
  37840   createSmallDouble(I);
  37841   setValG(&I, 11);
  37842   r2 = self->f->pushSmallDouble(self, &I);
  37843   r = self->f->getAtInt32P(self,-1);
  37844   ck_assert_ptr_eq(r, null);
  37845   s = toStringO(self);
  37846   ck_assert_str_eq(s, "[1,2,3,4,1.100000e+01]");
  37847   free(s);
  37848   // wrong object type of another user class
  37849   //   User classes are stored in containers transparently
  37850   createAllocateSmallInt(ip);
  37851   ip->type = "anothertype";
  37852   setValG(ip, 11);
  37853   r2 = self->f->push(self, (baset*)ip);
  37854   ck_assert_ptr_ne(r2, null);
  37855   r = self->f->getAtInt32P(self,-1);
  37856   ck_assert_ptr_eq(r, null);
  37857   s = toStringO(self);
  37858   ck_assert_str_eq(s, "[1,2,3,4,1.100000e+01,\"<data container>\"]");
  37859   free(s);
  37860   // index outside
  37861   ck_assert(!self->f->getAtInt32P(self, 20));
  37862   ck_assert(!self->f->getAtInt32P(self, -7));
  37863   // empty list
  37864   emptyO(self);
  37865   ck_assert(!self->f->getAtInt32P(self, 0));
  37866   ck_assert(!self->f->getAtInt32P(self, -1));
  37867   terminateO(self);
  37868 
  37869 END_TEST
  37870 
  37871 
  37872 START_TEST(getAtUintSmallJsonT)
  37873 
  37874   uint64_t r;
  37875   smallJsont *self = allocSmallJson();
  37876   smallJsont *r2;
  37877 
  37878   // add elements to self
  37879   r2 = self->f->pushInt(self, 1);
  37880   ck_assert_ptr_ne(r2, null);
  37881   r2 = self->f->pushInt(self, 2);
  37882   ck_assert_ptr_ne(r2, null);
  37883   r2 = self->f->pushInt(self, 3);
  37884   ck_assert_ptr_ne(r2, null);
  37885   r2 = self->f->pushInt(self, 4);
  37886   ck_assert_ptr_ne(r2, null);
  37887 
  37888   // positive index
  37889   r       = self->f->getAtUint(self,1);
  37890   ck_assert(r==2);
  37891   char *s = toStringO(self);
  37892   ck_assert_str_eq(s, "[1,2,3,4]");
  37893   free(s);
  37894   // negative index
  37895   r = self->f->getAtUint(self,-1);
  37896   ck_assert(r==4);
  37897   s = toStringO(self);
  37898   ck_assert_str_eq(s, "[1,2,3,4]");
  37899   free(s);
  37900   // wrong object type
  37901   createSmallDouble(I);
  37902   setValG(&I, 11);
  37903   r2 = self->f->pushSmallDouble(self, &I);
  37904   r = self->f->getAtUint(self,-1);
  37905   ck_assert(!r);
  37906   s = toStringO(self);
  37907   ck_assert_str_eq(s, "[1,2,3,4,1.100000e+01]");
  37908   free(s);
  37909   // wrong object type of another user class
  37910   //   User classes are stored in containers transparently
  37911   createAllocateSmallInt(ip);
  37912   ip->type = "anothertype";
  37913   setValG(ip, 11);
  37914   r2 = self->f->push(self, (baset*)ip);
  37915   ck_assert_ptr_ne(r2, null);
  37916   r = self->f->getAtUint(self,-1);
  37917   ck_assert(!r);
  37918   s = toStringO(self);
  37919   ck_assert_str_eq(s, "[1,2,3,4,1.100000e+01,\"<data container>\"]");
  37920   free(s);
  37921   // index outside
  37922   ck_assert(!self->f->getAtUint(self, 20));
  37923   ck_assert(!self->f->getAtUint(self, -7));
  37924   // empty list
  37925   emptyO(self);
  37926   ck_assert(!self->f->getAtUint(self, 0));
  37927   ck_assert(!self->f->getAtUint(self, -1));
  37928   terminateO(self);
  37929 
  37930 END_TEST
  37931 
  37932 
  37933 START_TEST(getAtUintPSmallJsonT)
  37934 
  37935   uint64_t* r;
  37936   smallJsont *self = allocSmallJson();
  37937   smallJsont *r2;
  37938 
  37939   // add elements to self
  37940   r2 = self->f->pushInt(self, 1);
  37941   ck_assert_ptr_ne(r2, null);
  37942   r2 = self->f->pushInt(self, 2);
  37943   ck_assert_ptr_ne(r2, null);
  37944   r2 = self->f->pushInt(self, 3);
  37945   ck_assert_ptr_ne(r2, null);
  37946   r2 = self->f->pushInt(self, 4);
  37947   ck_assert_ptr_ne(r2, null);
  37948 
  37949   // positive index
  37950   r       = self->f->getAtUintP(self,1);
  37951   ck_assert_ptr_ne(r, null);
  37952   ck_assert(*r==2);
  37953   char *s = toStringO(self);
  37954   ck_assert_str_eq(s, "[1,2,3,4]");
  37955   free(s);
  37956   // negative index
  37957   r = self->f->getAtUintP(self,-1);
  37958   ck_assert_ptr_ne(r, null);
  37959   ck_assert(*r==4);
  37960   s = toStringO(self);
  37961   ck_assert_str_eq(s, "[1,2,3,4]");
  37962   free(s);
  37963   // wrong object type
  37964   createSmallDouble(I);
  37965   setValG(&I, 11);
  37966   r2 = self->f->pushSmallDouble(self, &I);
  37967   r = self->f->getAtUintP(self,-1);
  37968   ck_assert_ptr_eq(r, null);
  37969   s = toStringO(self);
  37970   ck_assert_str_eq(s, "[1,2,3,4,1.100000e+01]");
  37971   free(s);
  37972   // wrong object type of another user class
  37973   //   User classes are stored in containers transparently
  37974   createAllocateSmallInt(ip);
  37975   ip->type = "anothertype";
  37976   setValG(ip, 11);
  37977   r2 = self->f->push(self, (baset*)ip);
  37978   ck_assert_ptr_ne(r2, null);
  37979   r = self->f->getAtUintP(self,-1);
  37980   ck_assert_ptr_eq(r, null);
  37981   s = toStringO(self);
  37982   ck_assert_str_eq(s, "[1,2,3,4,1.100000e+01,\"<data container>\"]");
  37983   free(s);
  37984   // index outside
  37985   ck_assert(!self->f->getAtUintP(self, 20));
  37986   ck_assert(!self->f->getAtUintP(self, -7));
  37987   // empty list
  37988   emptyO(self);
  37989   ck_assert(!self->f->getAtUintP(self, 0));
  37990   ck_assert(!self->f->getAtUintP(self, -1));
  37991   terminateO(self);
  37992 
  37993 END_TEST
  37994 
  37995 
  37996 START_TEST(getAtUint32SmallJsonT)
  37997 
  37998   uint32_t r;
  37999   smallJsont *self = allocSmallJson();
  38000   smallJsont *r2;
  38001 
  38002   // add elements to self
  38003   r2 = self->f->pushInt(self, 1);
  38004   ck_assert_ptr_ne(r2, null);
  38005   r2 = self->f->pushInt(self, 2);
  38006   ck_assert_ptr_ne(r2, null);
  38007   r2 = self->f->pushInt(self, 3);
  38008   ck_assert_ptr_ne(r2, null);
  38009   r2 = self->f->pushInt(self, 4);
  38010   ck_assert_ptr_ne(r2, null);
  38011 
  38012   // positive index
  38013   r       = self->f->getAtUint32(self,1);
  38014   ck_assert(r==2);
  38015   char *s = toStringO(self);
  38016   ck_assert_str_eq(s, "[1,2,3,4]");
  38017   free(s);
  38018   // negative index
  38019   r = self->f->getAtUint32(self,-1);
  38020   ck_assert(r==4);
  38021   s = toStringO(self);
  38022   ck_assert_str_eq(s, "[1,2,3,4]");
  38023   free(s);
  38024   // wrong object type
  38025   createSmallDouble(I);
  38026   setValG(&I, 11);
  38027   r2 = self->f->pushSmallDouble(self, &I);
  38028   r = self->f->getAtUint32(self,-1);
  38029   ck_assert(!r);
  38030   s = toStringO(self);
  38031   ck_assert_str_eq(s, "[1,2,3,4,1.100000e+01]");
  38032   free(s);
  38033   // wrong object type of another user class
  38034   //   User classes are stored in containers transparently
  38035   createAllocateSmallInt(ip);
  38036   ip->type = "anothertype";
  38037   setValG(ip, 11);
  38038   r2 = self->f->push(self, (baset*)ip);
  38039   ck_assert_ptr_ne(r2, null);
  38040   r = self->f->getAtUint32(self,-1);
  38041   ck_assert(!r);
  38042   s = toStringO(self);
  38043   ck_assert_str_eq(s, "[1,2,3,4,1.100000e+01,\"<data container>\"]");
  38044   free(s);
  38045   // index outside
  38046   ck_assert(!self->f->getAtUint32(self, 20));
  38047   ck_assert(!self->f->getAtUint32(self, -7));
  38048   // empty list
  38049   emptyO(self);
  38050   ck_assert(!self->f->getAtUint32(self, 0));
  38051   ck_assert(!self->f->getAtUint32(self, -1));
  38052   terminateO(self);
  38053 
  38054 END_TEST
  38055 
  38056 
  38057 START_TEST(getAtUint32PSmallJsonT)
  38058 
  38059   uint32_t* r;
  38060   smallJsont *self = allocSmallJson();
  38061   smallJsont *r2;
  38062 
  38063   // add elements to self
  38064   r2 = self->f->pushInt(self, 1);
  38065   ck_assert_ptr_ne(r2, null);
  38066   r2 = self->f->pushInt(self, 2);
  38067   ck_assert_ptr_ne(r2, null);
  38068   r2 = self->f->pushInt(self, 3);
  38069   ck_assert_ptr_ne(r2, null);
  38070   r2 = self->f->pushInt(self, 4);
  38071   ck_assert_ptr_ne(r2, null);
  38072 
  38073   // positive index
  38074   r       = self->f->getAtUint32P(self,1);
  38075   ck_assert_ptr_ne(r, null);
  38076   ck_assert(*r==2);
  38077   char *s = toStringO(self);
  38078   ck_assert_str_eq(s, "[1,2,3,4]");
  38079   free(s);
  38080   // negative index
  38081   r = self->f->getAtUint32P(self,-1);
  38082   ck_assert_ptr_ne(r, null);
  38083   ck_assert(*r==4);
  38084   s = toStringO(self);
  38085   ck_assert_str_eq(s, "[1,2,3,4]");
  38086   free(s);
  38087   // wrong object type
  38088   createSmallDouble(I);
  38089   setValG(&I, 11);
  38090   r2 = self->f->pushSmallDouble(self, &I);
  38091   r = self->f->getAtUint32P(self,-1);
  38092   ck_assert_ptr_eq(r, null);
  38093   s = toStringO(self);
  38094   ck_assert_str_eq(s, "[1,2,3,4,1.100000e+01]");
  38095   free(s);
  38096   // wrong object type of another user class
  38097   //   User classes are stored in containers transparently
  38098   createAllocateSmallInt(ip);
  38099   ip->type = "anothertype";
  38100   setValG(ip, 11);
  38101   r2 = self->f->push(self, (baset*)ip);
  38102   ck_assert_ptr_ne(r2, null);
  38103   r = self->f->getAtUint32P(self,-1);
  38104   ck_assert_ptr_eq(r, null);
  38105   s = toStringO(self);
  38106   ck_assert_str_eq(s, "[1,2,3,4,1.100000e+01,\"<data container>\"]");
  38107   free(s);
  38108   // index outside
  38109   ck_assert(!self->f->getAtUint32P(self, 20));
  38110   ck_assert(!self->f->getAtUint32P(self, -7));
  38111   // empty list
  38112   emptyO(self);
  38113   ck_assert(!self->f->getAtUint32P(self, 0));
  38114   ck_assert(!self->f->getAtUint32P(self, -1));
  38115   terminateO(self);
  38116 
  38117 END_TEST
  38118 
  38119 
  38120 START_TEST(getAtSSmallJsonT)
  38121 
  38122   char* r;
  38123   smallJsont *self = allocSmallJson();
  38124   smallJsont *r2;
  38125 
  38126   // add elements to self
  38127   r2 = self->f->pushInt(self, 1);
  38128   ck_assert_ptr_ne(r2, null);
  38129   r2 = self->f->pushS(self, "2");
  38130   ck_assert_ptr_ne(r2, null);
  38131   r2 = self->f->pushInt(self, 3);
  38132   ck_assert_ptr_ne(r2, null);
  38133   r2 = self->f->pushS(self, "4");
  38134   ck_assert_ptr_ne(r2, null);
  38135 
  38136   // positive index
  38137   r       = self->f->getAtS(self,1);
  38138   ck_assert_ptr_ne(r, null);
  38139   ck_assert_str_eq(r, "2");
  38140   char *s = toStringO(self);
  38141   ck_assert_str_eq(s, "[1,\"2\",3,\"4\"]");
  38142   free(s);
  38143   // negative index
  38144   r = self->f->getAtS(self,-1);
  38145   ck_assert_ptr_ne(r, null);
  38146   ck_assert_str_eq(r, "4");
  38147   s = toStringO(self);
  38148   ck_assert_str_eq(s, "[1,\"2\",3,\"4\"]");
  38149   free(s);
  38150   // wrong object type
  38151   createSmallInt(I);
  38152   setValG(&I, 11);
  38153   r2 = self->f->pushSmallInt(self, &I);
  38154   r = self->f->getAtS(self,-1);
  38155   ck_assert_ptr_eq(r, NULL);
  38156   s = toStringO(self);
  38157   ck_assert_str_eq(s, "[1,\"2\",3,\"4\",11]");
  38158   free(s);
  38159   // wrong object type of another user class
  38160   //   User classes are stored in containers transparently
  38161   createAllocateSmallInt(ip);
  38162   ip->type = "anothertype";
  38163   setValG(ip, 11);
  38164   r2 = self->f->push(self, (baset*)ip);
  38165   ck_assert_ptr_ne(r2, null);
  38166   r = self->f->getAtS(self,-1);
  38167   ck_assert_ptr_eq(r, NULL);
  38168   s = toStringO(self);
  38169   ck_assert_str_eq(s, "[1,\"2\",3,\"4\",11,\"<data container>\"]");
  38170   free(s);
  38171   // index outside
  38172   ck_assert_ptr_eq(self->f->getAtS(self, 20), NULL);
  38173   ck_assert_ptr_eq(self->f->getAtS(self, -7), NULL);
  38174   // empty list
  38175   emptyO(self);
  38176   ck_assert_ptr_eq(self->f->getAtS(self, 0), NULL);
  38177   ck_assert_ptr_eq(self->f->getAtS(self, -1), NULL);
  38178   terminateO(self);
  38179 
  38180 END_TEST
  38181 
  38182 
  38183 START_TEST(getAtDictSmallJsonT)
  38184 
  38185   smallDictt* r;
  38186   smallJsont *self = allocSmallJson();
  38187   smallJsont *r2;
  38188 
  38189   // non json array
  38190   ck_assert_ptr_eq(self->f->getAtDict(self, 0), null);
  38191   // add elements to self
  38192   r2 = self->f->pushInt(self, 1);
  38193   ck_assert_ptr_ne(r2, null);
  38194   createSmallDict(e2);
  38195   r2 = self->f->pushDict(self, &e2);
  38196   ck_assert_ptr_ne(r2, null);
  38197   r2 = self->f->pushInt(self, 3);
  38198   ck_assert_ptr_ne(r2, null);
  38199   createSmallDict(e4);
  38200   r2 = self->f->pushDict(self, &e4);
  38201   ck_assert_ptr_ne(r2, null);
  38202 
  38203   // positive index
  38204   r       = self->f->getAtDict(self,1);
  38205   ck_assert_ptr_ne(r, null);
  38206   char *s = toStringO(r);
  38207   finishO(r);
  38208   ck_assert_str_eq(s, "{}");
  38209   free(s);
  38210   s = toStringO(self);
  38211   ck_assert_str_eq(s, "[1,{},3,{}]");
  38212   free(s);
  38213   // negative index
  38214   r = self->f->getAtDict(self,-1);
  38215   ck_assert_ptr_ne(r, null);
  38216   s = toStringO(r);
  38217   finishO(r);
  38218   ck_assert_str_eq(s, "{}");
  38219   free(s);
  38220   s = toStringO(self);
  38221   ck_assert_str_eq(s, "[1,{},3,{}]");
  38222   free(s);
  38223   // wrong object type
  38224   createSmallInt(I);
  38225   setValG(&I, 11);
  38226   r2 = self->f->pushSmallInt(self, &I);
  38227   r = self->f->getAtDict(self,-1);
  38228   ck_assert_ptr_eq(r, NULL);
  38229   s = toStringO(self);
  38230   ck_assert_str_eq(s, "[1,{},3,{},11]");
  38231   free(s);
  38232   // wrong object type of another user class
  38233   //   User classes are stored in containers transparently
  38234   createAllocateSmallInt(ip);
  38235   ip->type = "anothertype";
  38236   setValG(ip, 11);
  38237   r2 = self->f->push(self, (baset*)ip);
  38238   ck_assert_ptr_ne(r2, null);
  38239   r = self->f->getAtDict(self,-1);
  38240   ck_assert_ptr_eq(r, NULL);
  38241   s = toStringO(self);
  38242   ck_assert_str_eq(s, "[1,{},3,{},11,\"<data container>\"]");
  38243   free(s);
  38244   // index outside
  38245   ck_assert_ptr_eq(self->f->getAtDict(self, 20), NULL);
  38246   ck_assert_ptr_eq(self->f->getAtDict(self, -7), NULL);
  38247   // empty list
  38248   emptyO(self);
  38249   ck_assert_ptr_eq(self->f->getAtDict(self, 0), NULL);
  38250   ck_assert_ptr_eq(self->f->getAtDict(self, -1), NULL);
  38251   terminateO(self);
  38252 
  38253 END_TEST
  38254 
  38255 
  38256 START_TEST(getAtArraySmallJsonT)
  38257 
  38258   smallArrayt* r;
  38259   smallJsont *self = allocSmallJson();
  38260   smallJsont *r2;
  38261 
  38262   // non json array
  38263   ck_assert_ptr_eq(self->f->getAtArray(self, 0), null);
  38264   // add elements to self
  38265   r2 = self->f->pushInt(self, 1);
  38266   ck_assert_ptr_ne(r2, null);
  38267   createSmallArray(e2);
  38268   r2 = self->f->pushArray(self, &e2);
  38269   ck_assert_ptr_ne(r2, null);
  38270   r2 = self->f->pushInt(self, 3);
  38271   ck_assert_ptr_ne(r2, null);
  38272   createSmallArray(e4);
  38273   r2 = self->f->pushArray(self, &e4);
  38274   ck_assert_ptr_ne(r2, null);
  38275 
  38276   // positive index
  38277   r       = self->f->getAtArray(self,1);
  38278   ck_assert_ptr_ne(r, null);
  38279   char *s = toStringO(r);
  38280   finishO(r);
  38281   ck_assert_str_eq(s, "[]");
  38282   free(s);
  38283   s = toStringO(self);
  38284   ck_assert_str_eq(s, "[1,[],3,[]]");
  38285   free(s);
  38286   // negative index
  38287   r = self->f->getAtArray(self,-1);
  38288   ck_assert_ptr_ne(r, null);
  38289   s = toStringO(r);
  38290   finishO(r);
  38291   ck_assert_str_eq(s, "[]");
  38292   free(s);
  38293   s = toStringO(self);
  38294   ck_assert_str_eq(s, "[1,[],3,[]]");
  38295   free(s);
  38296   // wrong object type
  38297   createSmallInt(I);
  38298   setValG(&I, 11);
  38299   r2 = self->f->pushSmallInt(self, &I);
  38300   r = self->f->getAtArray(self,-1);
  38301   ck_assert_ptr_eq(r, NULL);
  38302   s = toStringO(self);
  38303   ck_assert_str_eq(s, "[1,[],3,[],11]");
  38304   free(s);
  38305   // wrong object type of another user class
  38306   //   User classes are stored in containers transparently
  38307   createAllocateSmallInt(ip);
  38308   ip->type = "anothertype";
  38309   setValG(ip, 11);
  38310   r2 = self->f->push(self, (baset*)ip);
  38311   ck_assert_ptr_ne(r2, null);
  38312   r = self->f->getAtArray(self,-1);
  38313   ck_assert_ptr_eq(r, NULL);
  38314   s = toStringO(self);
  38315   ck_assert_str_eq(s, "[1,[],3,[],11,\"<data container>\"]");
  38316   free(s);
  38317   // index outside
  38318   ck_assert_ptr_eq(self->f->getAtArray(self, 20), NULL);
  38319   ck_assert_ptr_eq(self->f->getAtArray(self, -7), NULL);
  38320   // empty list
  38321   emptyO(self);
  38322   ck_assert_ptr_eq(self->f->getAtArray(self, 0), NULL);
  38323   ck_assert_ptr_eq(self->f->getAtArray(self, -1), NULL);
  38324   terminateO(self);
  38325 
  38326 END_TEST
  38327 
  38328 
  38329 START_TEST(getAtSmallBoolSmallJsonT)
  38330 
  38331   smallBoolt* r;
  38332   smallJsont *self = allocSmallJson();
  38333   smallJsont *r2;
  38334 
  38335   // non json array
  38336   ck_assert_ptr_eq(self->f->getAtSmallBool(self, 0), null);
  38337   // add elements to self
  38338   r2 = self->f->pushInt(self, 1);
  38339   ck_assert_ptr_ne(r2, null);
  38340   createSmallBool(e2);
  38341   r2 = self->f->pushBool(self, true);
  38342   ck_assert_ptr_ne(r2, null);
  38343   r2 = self->f->pushInt(self, 3);
  38344   ck_assert_ptr_ne(r2, null);
  38345   createSmallBool(e4);
  38346   r2 = self->f->pushBool(self, true);
  38347   ck_assert_ptr_ne(r2, null);
  38348 
  38349   // positive index
  38350   r       = self->f->getAtSmallBool(self,1);
  38351   ck_assert_ptr_ne(r, null);
  38352   char *s = toStringO(r);
  38353   finishO(r);
  38354   ck_assert_str_eq(s, "true");
  38355   free(s);
  38356   s = toStringO(self);
  38357   ck_assert_str_eq(s, "[1,true,3,true]");
  38358   free(s);
  38359   // negative index
  38360   r = self->f->getAtSmallBool(self,-1);
  38361   ck_assert_ptr_ne(r, null);
  38362   s = toStringO(r);
  38363   finishO(r);
  38364   ck_assert_str_eq(s, "true");
  38365   free(s);
  38366   s = toStringO(self);
  38367   ck_assert_str_eq(s, "[1,true,3,true]");
  38368   free(s);
  38369   // wrong object type
  38370   createSmallInt(I);
  38371   setValG(&I, 11);
  38372   r2 = self->f->pushSmallInt(self, &I);
  38373   r = self->f->getAtSmallBool(self,2);
  38374   ck_assert_ptr_eq(r, NULL);
  38375   s = toStringO(self);
  38376   ck_assert_str_eq(s, "[1,true,3,true,11]");
  38377   free(s);
  38378   // wrong object type of another user class
  38379   //   User classes are stored in containers transparently
  38380   createAllocateSmallInt(ip);
  38381   ip->type = "anothertype";
  38382   setValG(ip, 11);
  38383   r2 = self->f->push(self, (baset*)ip);
  38384   ck_assert_ptr_ne(r2, null);
  38385   r = self->f->getAtSmallBool(self,-1);
  38386   ck_assert_ptr_eq(r, NULL);
  38387   s = toStringO(self);
  38388   ck_assert_str_eq(s, "[1,true,3,true,11,\"<data container>\"]");
  38389   free(s);
  38390   // index outside
  38391   ck_assert_ptr_eq(self->f->getAtSmallBool(self, 20), NULL);
  38392   ck_assert_ptr_eq(self->f->getAtSmallBool(self, -7), NULL);
  38393   // empty list
  38394   emptyO(self);
  38395   ck_assert_ptr_eq(self->f->getAtSmallBool(self, 0), NULL);
  38396   ck_assert_ptr_eq(self->f->getAtSmallBool(self, -1), NULL);
  38397   terminateO(self);
  38398 
  38399 END_TEST
  38400 
  38401 
  38402 START_TEST(getAtSmallBytesSmallJsonT)
  38403 
  38404   smallBytest* r;
  38405   smallJsont *self = allocSmallJson();
  38406   smallJsont *r2;
  38407 
  38408   // non json array
  38409   ck_assert_ptr_eq(self->f->getAtSmallBytes(self, 0), null);
  38410   // add elements to self
  38411   r2 = self->f->pushInt(self, 1);
  38412   ck_assert_ptr_ne(r2, null);
  38413   createSmallBytes(e2);
  38414   r2 = self->f->pushSmallBytes(self, &e2);
  38415   ck_assert_ptr_ne(r2, null);
  38416   r2 = self->f->pushInt(self, 3);
  38417   ck_assert_ptr_ne(r2, null);
  38418   createSmallBytes(e4);
  38419   r2 = self->f->pushSmallBytes(self, &e4);
  38420   ck_assert_ptr_ne(r2, null);
  38421 
  38422   // positive index
  38423   r       = self->f->getAtSmallBytes(self,1);
  38424   ck_assert_ptr_ne(r, null);
  38425   char *s = toStringO(r);
  38426   finishO(r);
  38427   ck_assert_str_eq(s, "[]");
  38428   free(s);
  38429   s = toStringO(self);
  38430   ck_assert_str_eq(s, "[1,[],3,[]]");
  38431   free(s);
  38432   // negative index
  38433   r = self->f->getAtSmallBytes(self,-1);
  38434   ck_assert_ptr_ne(r, null);
  38435   s = toStringO(r);
  38436   finishO(r);
  38437   ck_assert_str_eq(s, "[]");
  38438   free(s);
  38439   s = toStringO(self);
  38440   ck_assert_str_eq(s, "[1,[],3,[]]");
  38441   free(s);
  38442   // wrong object type
  38443   createSmallInt(I);
  38444   setValG(&I, 11);
  38445   r2 = self->f->pushSmallInt(self, &I);
  38446   r = self->f->getAtSmallBytes(self,-1);
  38447   ck_assert_ptr_eq(r, NULL);
  38448   s = toStringO(self);
  38449   ck_assert_str_eq(s, "[1,[],3,[],11]");
  38450   free(s);
  38451   // wrong object type of another user class
  38452   //   User classes are stored in containers transparently
  38453   createAllocateSmallInt(ip);
  38454   ip->type = "anothertype";
  38455   setValG(ip, 11);
  38456   r2 = self->f->push(self, (baset*)ip);
  38457   ck_assert_ptr_ne(r2, null);
  38458   r = self->f->getAtSmallBytes(self,-1);
  38459   ck_assert_ptr_eq(r, NULL);
  38460   s = toStringO(self);
  38461   ck_assert_str_eq(s, "[1,[],3,[],11,\"<data container>\"]");
  38462   free(s);
  38463   // index outside
  38464   ck_assert_ptr_eq(self->f->getAtSmallBytes(self, 20), NULL);
  38465   ck_assert_ptr_eq(self->f->getAtSmallBytes(self, -7), NULL);
  38466   // empty list
  38467   emptyO(self);
  38468   ck_assert_ptr_eq(self->f->getAtSmallBytes(self, 0), NULL);
  38469   ck_assert_ptr_eq(self->f->getAtSmallBytes(self, -1), NULL);
  38470   terminateO(self);
  38471 
  38472 END_TEST
  38473 
  38474 
  38475 START_TEST(getAtSmallDoubleSmallJsonT)
  38476 
  38477   smallDoublet* r;
  38478   smallJsont *self = allocSmallJson();
  38479   smallJsont *r2;
  38480 
  38481   // non json array
  38482   ck_assert_ptr_eq(self->f->getAtSmallDouble(self, 0), null);
  38483   // add elements to self
  38484   r2 = self->f->pushInt(self, 1);
  38485   ck_assert_ptr_ne(r2, null);
  38486   createSmallDouble(e2);
  38487   r2 = self->f->pushSmallDouble(self, &e2);
  38488   ck_assert_ptr_ne(r2, null);
  38489   r2 = self->f->pushInt(self, 3);
  38490   ck_assert_ptr_ne(r2, null);
  38491   createSmallDouble(e4);
  38492   r2 = self->f->pushSmallDouble(self, &e4);
  38493   ck_assert_ptr_ne(r2, null);
  38494 
  38495   // positive index
  38496   r       = self->f->getAtSmallDouble(self,1);
  38497   ck_assert_ptr_ne(r, null);
  38498   char *s = toStringO(r);
  38499   finishO(r);
  38500   ck_assert_str_eq(s, "0.000000e+00");
  38501   free(s);
  38502   s = toStringO(self);
  38503   ck_assert_str_eq(s, "[1,0.000000e+00,3,0.000000e+00]");
  38504   free(s);
  38505   // negative index
  38506   r = self->f->getAtSmallDouble(self,-1);
  38507   ck_assert_ptr_ne(r, null);
  38508   s = toStringO(r);
  38509   finishO(r);
  38510   ck_assert_str_eq(s, "0.000000e+00");
  38511   free(s);
  38512   s = toStringO(self);
  38513   ck_assert_str_eq(s, "[1,0.000000e+00,3,0.000000e+00]");
  38514   free(s);
  38515   // wrong object type
  38516   createSmallInt(I);
  38517   setValG(&I, 11);
  38518   r2 = self->f->pushSmallInt(self, &I);
  38519   r = self->f->getAtSmallDouble(self,-1);
  38520   ck_assert_ptr_eq(r, NULL);
  38521   s = toStringO(self);
  38522   ck_assert_str_eq(s, "[1,0.000000e+00,3,0.000000e+00,11]");
  38523   free(s);
  38524   // wrong object type of another user class
  38525   //   User classes are stored in containers transparently
  38526   createAllocateSmallInt(ip);
  38527   ip->type = "anothertype";
  38528   setValG(ip, 11);
  38529   r2 = self->f->push(self, (baset*)ip);
  38530   ck_assert_ptr_ne(r2, null);
  38531   r = self->f->getAtSmallDouble(self,-1);
  38532   ck_assert_ptr_eq(r, NULL);
  38533   s = toStringO(self);
  38534   ck_assert_str_eq(s, "[1,0.000000e+00,3,0.000000e+00,11,\"<data container>\"]");
  38535   free(s);
  38536   // index outside
  38537   ck_assert_ptr_eq(self->f->getAtSmallDouble(self, 20), NULL);
  38538   ck_assert_ptr_eq(self->f->getAtSmallDouble(self, -7), NULL);
  38539   // empty list
  38540   emptyO(self);
  38541   ck_assert_ptr_eq(self->f->getAtSmallDouble(self, 0), NULL);
  38542   ck_assert_ptr_eq(self->f->getAtSmallDouble(self, -1), NULL);
  38543   terminateO(self);
  38544 
  38545 END_TEST
  38546 
  38547 
  38548 START_TEST(getAtSmallIntSmallJsonT)
  38549 
  38550   smallIntt* r;
  38551   smallJsont *self = allocSmallJson();
  38552   smallJsont *r2;
  38553 
  38554   // non json array
  38555   ck_assert_ptr_eq(self->f->getAtSmallInt(self, 0), null);
  38556   // add elements to self
  38557   r2 = self->f->pushBool(self, true);
  38558   ck_assert_ptr_ne(r2, null);
  38559   createSmallInt(e2);
  38560   r2 = self->f->pushSmallInt(self, &e2);
  38561   ck_assert_ptr_ne(r2, null);
  38562   r2 = self->f->pushBool(self, true);
  38563   ck_assert_ptr_ne(r2, null);
  38564   createSmallInt(e4);
  38565   r2 = self->f->pushSmallInt(self, &e4);
  38566   ck_assert_ptr_ne(r2, null);
  38567 
  38568   // positive index
  38569   r       = self->f->getAtSmallInt(self,1);
  38570   ck_assert_ptr_ne(r, null);
  38571   char *s = toStringO(r);
  38572   finishO(r);
  38573   ck_assert_str_eq(s, "0");
  38574   free(s);
  38575   s = toStringO(self);
  38576   ck_assert_str_eq(s, "[true,0,true,0]");
  38577   free(s);
  38578   // negative index
  38579   r = self->f->getAtSmallInt(self,-1);
  38580   ck_assert_ptr_ne(r, null);
  38581   s = toStringO(r);
  38582   finishO(r);
  38583   ck_assert_str_eq(s, "0");
  38584   free(s);
  38585   s = toStringO(self);
  38586   ck_assert_str_eq(s, "[true,0,true,0]");
  38587   free(s);
  38588   // wrong object type
  38589   createSmallDouble(I);
  38590   setValG(&I, 11);
  38591   r2 = self->f->pushSmallDouble(self, &I);
  38592   r = self->f->getAtSmallInt(self,-1);
  38593   ck_assert_ptr_eq(r, NULL);
  38594   s = toStringO(self);
  38595   ck_assert_str_eq(s, "[true,0,true,0,1.100000e+01]");
  38596   free(s);
  38597   // wrong object type of another user class
  38598   //   User classes are stored in containers transparently
  38599   createAllocateSmallInt(ip);
  38600   ip->type = "anothertype";
  38601   setValG(ip, 11);
  38602   r2 = self->f->push(self, (baset*)ip);
  38603   ck_assert_ptr_ne(r2, null);
  38604   r = self->f->getAtSmallInt(self,-1);
  38605   ck_assert_ptr_eq(r, NULL);
  38606   s = toStringO(self);
  38607   ck_assert_str_eq(s, "[true,0,true,0,1.100000e+01,\"<data container>\"]");
  38608   free(s);
  38609   // index outside
  38610   ck_assert_ptr_eq(self->f->getAtSmallInt(self, 20), NULL);
  38611   ck_assert_ptr_eq(self->f->getAtSmallInt(self, -7), NULL);
  38612   // empty list
  38613   emptyO(self);
  38614   ck_assert_ptr_eq(self->f->getAtSmallInt(self, 0), NULL);
  38615   ck_assert_ptr_eq(self->f->getAtSmallInt(self, -1), NULL);
  38616   terminateO(self);
  38617 
  38618 END_TEST
  38619 
  38620 
  38621 START_TEST(getAtSmallJsonSmallJsonT)
  38622 
  38623   smallJsont* r;
  38624   smallJsont *self = allocSmallJson();
  38625   smallJsont *r2;
  38626 
  38627   // non json array
  38628   ck_assert_ptr_eq(self->f->getAtSmallJson(self, 0), null);
  38629   // add elements to self
  38630   r2 = self->f->pushInt(self, 1);
  38631   ck_assert_ptr_ne(r2, null);
  38632   createSmallJson(e2);
  38633   r2 = self->f->pushSmallJson(self, &e2);
  38634   ck_assert_ptr_ne(r2, null);
  38635   r2 = self->f->pushInt(self, 3);
  38636   ck_assert_ptr_ne(r2, null);
  38637   createSmallJson(e4);
  38638   r2 = self->f->pushSmallJson(self, &e4);
  38639   ck_assert_ptr_ne(r2, null);
  38640 
  38641   // positive index
  38642   r       = self->f->getAtSmallJson(self,1);
  38643   ck_assert_ptr_ne(r, null);
  38644   char *s = toStringO(r);
  38645   finishO(r);
  38646   ck_assert_str_eq(s, "{}");
  38647   free(s);
  38648   s = toStringO(self);
  38649   ck_assert_str_eq(s, "[1,{},3,{}]");
  38650   free(s);
  38651   // negative index
  38652   r = self->f->getAtSmallJson(self,-1);
  38653   ck_assert_ptr_ne(r, null);
  38654   s = toStringO(r);
  38655   finishO(r);
  38656   ck_assert_str_eq(s, "{}");
  38657   free(s);
  38658   s = toStringO(self);
  38659   ck_assert_str_eq(s, "[1,{},3,{}]");
  38660   free(s);
  38661   // wrong object type
  38662   createSmallBytes(I);
  38663   r2 = self->f->pushSmallBytes(self, &I);
  38664   r = self->f->getAtSmallJson(self,-1);
  38665   ck_assert_ptr_eq(r, NULL);
  38666   s = toStringO(self);
  38667   ck_assert_str_eq(s, "[1,{},3,{},[]]");
  38668   free(s);
  38669   // wrong object type of another user class
  38670   //   User classes are stored in containers transparently
  38671   createAllocateSmallInt(ip);
  38672   ip->type = "anothertype";
  38673   setValG(ip, 11);
  38674   r2 = self->f->push(self, (baset*)ip);
  38675   ck_assert_ptr_ne(r2, null);
  38676   r = self->f->getAtSmallJson(self,-1);
  38677   ck_assert_ptr_eq(r, NULL);
  38678   s = toStringO(self);
  38679   ck_assert_str_eq(s, "[1,{},3,{},[],\"<data container>\"]");
  38680   free(s);
  38681   // index outside
  38682   ck_assert_ptr_eq(self->f->getAtSmallJson(self, 20), NULL);
  38683   ck_assert_ptr_eq(self->f->getAtSmallJson(self, -7), NULL);
  38684   // empty list
  38685   emptyO(self);
  38686   ck_assert_ptr_eq(self->f->getAtSmallJson(self, 0), NULL);
  38687   ck_assert_ptr_eq(self->f->getAtSmallJson(self, -1), NULL);
  38688   terminateO(self);
  38689 
  38690 END_TEST
  38691 
  38692 
  38693 START_TEST(getAtSmallStringSmallJsonT)
  38694 
  38695   smallStringt* r;
  38696   smallJsont *self = allocSmallJson();
  38697   smallJsont *r2;
  38698 
  38699   // non json array
  38700   ck_assert_ptr_eq(self->f->getAtSmallString(self, 0), null);
  38701   // add elements to self
  38702   r2 = self->f->pushInt(self, 1);
  38703   ck_assert_ptr_ne(r2, null);
  38704   createSmallString(e2);
  38705   r2 = self->f->pushSmallString(self, &e2);
  38706   ck_assert_ptr_ne(r2, null);
  38707   r2 = self->f->pushInt(self, 3);
  38708   ck_assert_ptr_ne(r2, null);
  38709   createSmallString(e4);
  38710   r2 = self->f->pushSmallString(self, &e4);
  38711   ck_assert_ptr_ne(r2, null);
  38712 
  38713   // positive index
  38714   r       = self->f->getAtSmallString(self,1);
  38715   ck_assert_ptr_ne(r, null);
  38716   char *s = toStringO(r);
  38717   finishO(r);
  38718   ck_assert_str_eq(s, "");
  38719   free(s);
  38720   s = toStringO(self);
  38721   ck_assert_str_eq(s, "[1,\"\",3,\"\"]");
  38722   free(s);
  38723   // negative index
  38724   r = self->f->getAtSmallString(self,-1);
  38725   ck_assert_ptr_ne(r, null);
  38726   s = toStringO(r);
  38727   finishO(r);
  38728   ck_assert_str_eq(s, "");
  38729   free(s);
  38730   s = toStringO(self);
  38731   ck_assert_str_eq(s, "[1,\"\",3,\"\"]");
  38732   free(s);
  38733   // wrong object type
  38734   createSmallInt(I);
  38735   setValG(&I, 11);
  38736   r2 = self->f->pushSmallInt(self, &I);
  38737   r = self->f->getAtSmallString(self,-1);
  38738   ck_assert_ptr_eq(r, NULL);
  38739   s = toStringO(self);
  38740   ck_assert_str_eq(s, "[1,\"\",3,\"\",11]");
  38741   free(s);
  38742   // wrong object type of another user class
  38743   //   User classes are stored in containers transparently
  38744   createAllocateSmallInt(ip);
  38745   ip->type = "anothertype";
  38746   setValG(ip, 11);
  38747   r2 = self->f->push(self, (baset*)ip);
  38748   ck_assert_ptr_ne(r2, null);
  38749   r = self->f->getAtSmallString(self,-1);
  38750   ck_assert_ptr_eq(r, NULL);
  38751   s = toStringO(self);
  38752   ck_assert_str_eq(s, "[1,\"\",3,\"\",11,\"<data container>\"]");
  38753   free(s);
  38754   // index outside
  38755   ck_assert_ptr_eq(self->f->getAtSmallString(self, 20), NULL);
  38756   ck_assert_ptr_eq(self->f->getAtSmallString(self, -7), NULL);
  38757   // empty list
  38758   emptyO(self);
  38759   ck_assert_ptr_eq(self->f->getAtSmallString(self, 0), NULL);
  38760   ck_assert_ptr_eq(self->f->getAtSmallString(self, -1), NULL);
  38761   terminateO(self);
  38762 
  38763 END_TEST
  38764 
  38765 
  38766 START_TEST(getAtVoidSmallJsonT)
  38767 
  38768   void* r;
  38769   smallJsont *self = allocSmallJson();
  38770   smallJsont *r2;
  38771 
  38772   // non json array
  38773   ck_assert_ptr_eq(self->f->getAtVoid(self, 0), null);
  38774   // add elements to self
  38775   r2 = self->f->pushInt(self, 1);
  38776   ck_assert_ptr_ne(r2, null);
  38777   r2 = pushVoidSmallJsonG(self, &r);
  38778   ck_assert_ptr_ne(r2, null);
  38779   r2 = self->f->pushInt(self, 3);
  38780   ck_assert_ptr_ne(r2, null);
  38781   r2 = pushVoidSmallJsonG(self, &self);
  38782   ck_assert_ptr_ne(r2, null);
  38783 
  38784   // positive index
  38785   r       = self->f->getAtVoid(self,1);
  38786   ck_assert_ptr_eq(r, &r);
  38787   char *s = toStringO(self);
  38788   ck_assert_str_eq(s, "[1,\"<data container>\",3,\"<data container>\"]");
  38789   free(s);
  38790   // negative index
  38791   r = self->f->getAtVoid(self,-1);
  38792   ck_assert_ptr_eq(r, &self);
  38793   s = toStringO(self);
  38794   ck_assert_str_eq(s, "[1,\"<data container>\",3,\"<data container>\"]");
  38795   free(s);
  38796   // wrong object type
  38797   createSmallInt(I);
  38798   setValG(&I, 11);
  38799   r2 = self->f->pushSmallInt(self, &I);
  38800   r = self->f->getAtVoid(self,-1);
  38801   ck_assert_ptr_eq(r, NULL);
  38802   s = toStringO(self);
  38803   ck_assert_str_eq(s, "[1,\"<data container>\",3,\"<data container>\",11]");
  38804   free(s);
  38805   // wrong object type of another user class
  38806   //   User classes are stored in containers transparently
  38807   createAllocateSmallInt(ip);
  38808   ip->type = "anothertype";
  38809   setValG(ip, 11);
  38810   r2 = self->f->push(self, (baset*)ip);
  38811   ck_assert_ptr_ne(r2, null);
  38812   r = self->f->getAtVoid(self,-1);
  38813   ck_assert_ptr_eq(r, NULL);
  38814   s = toStringO(self);
  38815   ck_assert_str_eq(s, "[1,\"<data container>\",3,\"<data container>\",11,\"<data container>\"]");
  38816   free(s);
  38817   // index outside
  38818   ck_assert_ptr_eq(self->f->getAtVoid(self, 20), NULL);
  38819   ck_assert_ptr_eq(self->f->getAtVoid(self, -7), NULL);
  38820   // empty list
  38821   emptyO(self);
  38822   ck_assert_ptr_eq(self->f->getAtVoid(self, 0), NULL);
  38823   ck_assert_ptr_eq(self->f->getAtVoid(self, -1), NULL);
  38824   terminateO(self);
  38825 
  38826 END_TEST
  38827 
  38828 
  38829 START_TEST(getAtSmallContainerSmallJsonT)
  38830 
  38831   smallContainert* r;
  38832   smallJsont *self = allocSmallJson();
  38833   smallJsont *r2;
  38834 
  38835   // non json array
  38836   ck_assert_ptr_eq(self->f->getAtSmallContainer(self, 0), null);
  38837   // add elements to self
  38838   r2 = self->f->pushInt(self, 1);
  38839   ck_assert_ptr_ne(r2, null);
  38840   createSmallContainer(e2);
  38841   r2 = self->f->pushSmallContainer(self, &e2);
  38842   ck_assert_ptr_ne(r2, null);
  38843   r2 = self->f->pushInt(self, 3);
  38844   ck_assert_ptr_ne(r2, null);
  38845   createSmallContainer(e4);
  38846   r2 = self->f->pushSmallContainer(self, &e4);
  38847   ck_assert_ptr_ne(r2, null);
  38848 
  38849   // positive index
  38850   r       = self->f->getAtSmallContainer(self,1);
  38851   ck_assert_ptr_ne(r, null);
  38852   char *s = toStringO(r);
  38853   finishO(r);
  38854   ck_assert_str_eq(s, "<data smallContainer>");
  38855   free(s);
  38856   s = toStringO(self);
  38857   ck_assert_str_eq(s, "[1,\"<data container>\",3,\"<data container>\"]");
  38858   free(s);
  38859   // negative index
  38860   r = self->f->getAtSmallContainer(self,-1);
  38861   ck_assert_ptr_ne(r, null);
  38862   s = toStringO(r);
  38863   finishO(r);
  38864   ck_assert_str_eq(s, "<data smallContainer>");
  38865   free(s);
  38866   s = toStringO(self);
  38867   ck_assert_str_eq(s, "[1,\"<data container>\",3,\"<data container>\"]");
  38868   free(s);
  38869   // wrong object type
  38870   createSmallInt(I);
  38871   setValG(&I, 11);
  38872   r2 = self->f->pushSmallInt(self, &I);
  38873   r = self->f->getAtSmallContainer(self,-1);
  38874   ck_assert_ptr_eq(r, NULL);
  38875   s = toStringO(self);
  38876   ck_assert_str_eq(s, "[1,\"<data container>\",3,\"<data container>\",11]");
  38877   free(s);
  38878   // wrong object type of another user class
  38879   //   User classes are stored in containers transparently
  38880   createAllocateSmallInt(ip);
  38881   ip->type = "anothertype";
  38882   setValG(ip, 11);
  38883   r2 = self->f->push(self, (baset*)ip);
  38884   ck_assert_ptr_ne(r2, null);
  38885   r = self->f->getAtSmallContainer(self,-1);
  38886   ck_assert_ptr_eq(r, NULL);
  38887   s = toStringO(self);
  38888   ck_assert_str_eq(s, "[1,\"<data container>\",3,\"<data container>\",11,\"<data container>\"]");
  38889   free(s);
  38890   // index outside
  38891   ck_assert_ptr_eq(self->f->getAtSmallContainer(self, 20), NULL);
  38892   ck_assert_ptr_eq(self->f->getAtSmallContainer(self, -7), NULL);
  38893   // empty list
  38894   emptyO(self);
  38895   ck_assert_ptr_eq(self->f->getAtSmallContainer(self, 0), NULL);
  38896   ck_assert_ptr_eq(self->f->getAtSmallContainer(self, -1), NULL);
  38897   terminateO(self);
  38898 
  38899 END_TEST
  38900 
  38901 
  38902 START_TEST(getAtNDupSmallJsonT)
  38903 
  38904   baset* r;
  38905   smallJsont *self = allocSmallJson();
  38906   smallJsont *r2;
  38907 
  38908   // non json array
  38909   ck_assert_ptr_eq(self->f->getAtNDup(self, 0), null);
  38910   // add elements to self
  38911   r2 = self->f->pushInt(self, 1);
  38912   ck_assert_ptr_ne(r2, null);
  38913   r2 = self->f->pushInt(self, 2);
  38914   ck_assert_ptr_ne(r2, null);
  38915   r2 = self->f->pushInt(self, 3);
  38916   ck_assert_ptr_ne(r2, null);
  38917   r2 = self->f->pushInt(self, 4);
  38918   ck_assert_ptr_ne(r2, null);
  38919 
  38920   // positive index
  38921   r       = self->f->getAtNDup(self,1);
  38922   ck_assert_ptr_ne(r, null);
  38923   char *s = toStringO(r);
  38924   terminateO(r);
  38925   ck_assert_str_eq(s, "2");
  38926   free(s);
  38927   s = toStringO(self);
  38928   ck_assert_str_eq(s, "[1,2,3,4]");
  38929   free(s);
  38930   // negative index
  38931   r = self->f->getAtNDup(self,-1);
  38932   ck_assert_ptr_ne(r, null);
  38933   s = toStringO(r);
  38934   terminateO(r);
  38935   ck_assert_str_eq(s, "4");
  38936   free(s);
  38937   s = toStringO(self);
  38938   ck_assert_str_eq(s, "[1,2,3,4]");
  38939   free(s);
  38940   // undefined object
  38941   r2 = self->f->pushUndefined(self);
  38942   ck_assert_ptr_ne(r2, null);
  38943   r = self->f->getAtNDup(self,-1);
  38944   ck_assert_ptr_ne(r, null);
  38945   s = toStringO(r);
  38946   terminateO(r);
  38947   ck_assert_str_eq(s, "null");
  38948   free(s);
  38949   s = toStringO(self);
  38950   ck_assert_str_eq(s, "[1,2,3,4,null]");
  38951   free(s);
  38952   // container
  38953   createSmallContainer(c);
  38954   r2 = self->f->pushSmallContainer(self, &c);
  38955   r = self->f->getAtNDup(self,-1);
  38956   ck_assert_ptr_ne(r, null);
  38957   s = toStringO(r);
  38958   terminateO(r);
  38959   ck_assert_str_eq(s, "<data smallContainer>");
  38960   free(s);
  38961   s = toStringO(self);
  38962   ck_assert_str_eq(s, "[1,2,3,4,null,\"<data container>\"]");
  38963   free(s);
  38964   // base object in container
  38965   createAllocateSmallInt(I);
  38966   setValG(I, 11);
  38967   I->type = "anothertype";
  38968   r2 = self->f->push(self, (baset*)I);
  38969   r = self->f->getAtNDup(self,-1);
  38970   ck_assert_ptr_ne(r, null);
  38971   // r->type is not anothertype, because the duplicate function is from the smallInt class
  38972   ck_assert_str_eq(r->type, "smallInt");
  38973   s = toStringO(r);
  38974   terminateO(r);
  38975   ck_assert_str_eq(s, "11");
  38976   free(s);
  38977   s = toStringO(self);
  38978   ck_assert_str_eq(s, "[1,2,3,4,null,\"<data container>\",\"<data container>\"]");
  38979   free(s);
  38980   // index outside
  38981   ck_assert_ptr_eq(self->f->getAtNDup(self, 20), NULL);
  38982   ck_assert_ptr_eq(self->f->getAtNDup(self, -8), NULL);
  38983   // empty list
  38984   emptyO(self);
  38985   ck_assert_ptr_eq(self->f->getAtNDup(self, 0), NULL);
  38986   ck_assert_ptr_eq(self->f->getAtNDup(self, -1), NULL);
  38987   terminateO(self);
  38988 
  38989 END_TEST
  38990 
  38991 
  38992 START_TEST(getAtNDupUndefinedSmallJsonT)
  38993 
  38994   undefinedt* r;
  38995   smallJsont *self = allocSmallJson();
  38996   smallJsont *r2;
  38997 
  38998   // non json array
  38999   ck_assert_ptr_eq(self->f->getAtNDupUndefined(self, 0), null);
  39000   // add elements to self
  39001   r2 = self->f->pushInt(self, 1);
  39002   ck_assert_ptr_ne(r2, null);
  39003   r2 = self->f->pushUndefined(self);
  39004   ck_assert_ptr_ne(r2, null);
  39005   r2 = self->f->pushInt(self, 3);
  39006   ck_assert_ptr_ne(r2, null);
  39007   r2 = self->f->pushUndefined(self);
  39008   ck_assert_ptr_ne(r2, null);
  39009 
  39010   // positive index
  39011   r       = self->f->getAtNDupUndefined(self,1);
  39012   ck_assert_ptr_ne(r, null);
  39013   char *s = toStringO(r);
  39014   terminateO(r);
  39015   ck_assert_str_eq(s, "null");
  39016   free(s);
  39017   s = toStringO(self);
  39018   ck_assert_str_eq(s, "[1,null,3,null]");
  39019   free(s);
  39020   // negative index
  39021   r = self->f->getAtNDupUndefined(self,-1);
  39022   ck_assert_ptr_ne(r, null);
  39023   s = toStringO(r);
  39024   terminateO(r);
  39025   ck_assert_str_eq(s, "null");
  39026   free(s);
  39027   s = toStringO(self);
  39028   ck_assert_str_eq(s, "[1,null,3,null]");
  39029   free(s);
  39030   // wrong object type
  39031   createSmallInt(I);
  39032   setValG(&I, 11);
  39033   r2 = self->f->pushSmallInt(self, &I);
  39034   ck_assert_ptr_ne(r2, null);
  39035   r = self->f->getAtNDupUndefined(self,-1);
  39036   ck_assert_ptr_eq(r, null);
  39037   s = toStringO(self);
  39038   ck_assert_str_eq(s, "[1,null,3,null,11]");
  39039   free(s);
  39040   // index outside
  39041   ck_assert_ptr_eq(self->f->getAtNDupUndefined(self, 20), NULL);
  39042   ck_assert_ptr_eq(self->f->getAtNDupUndefined(self, -6), NULL);
  39043   // empty list
  39044   emptyO(self);
  39045   ck_assert_ptr_eq(self->f->getAtNDupUndefined(self, 0), NULL);
  39046   ck_assert_ptr_eq(self->f->getAtNDupUndefined(self, -1), NULL);
  39047   terminateO(self);
  39048 
  39049 END_TEST
  39050 
  39051 
  39052 START_TEST(getAtNDupBoolSmallJsonT)
  39053 
  39054   bool r;
  39055   smallJsont *self = allocSmallJson();
  39056   smallJsont *r2;
  39057 
  39058   // add elements to self
  39059   r2 = self->f->pushInt(self, 1);
  39060   ck_assert_ptr_ne(r2, null);
  39061   r2 = self->f->pushBool(self, TRUE);
  39062   ck_assert_ptr_ne(r2, null);
  39063   r2 = self->f->pushInt(self, 3);
  39064   ck_assert_ptr_ne(r2, null);
  39065   r2 = self->f->pushBool(self, TRUE);
  39066   ck_assert_ptr_ne(r2, null);
  39067 
  39068   // positive index
  39069   r       = self->f->getAtNDupBool(self,1);
  39070   ck_assert(r);
  39071   char *s = toStringO(self);
  39072   ck_assert_str_eq(s, "[1,true,3,true]");
  39073   free(s);
  39074   // negative index
  39075   r = self->f->getAtNDupBool(self,-1);
  39076   ck_assert(r);
  39077   s = toStringO(self);
  39078   ck_assert_str_eq(s, "[1,true,3,true]");
  39079   free(s);
  39080   // wrong object type
  39081   createSmallInt(I);
  39082   setValG(&I, 11);
  39083   r2 = self->f->pushSmallInt(self, &I);
  39084   r = self->f->getAtNDupBool(self,-1);
  39085   ck_assert(!r);
  39086   s = toStringO(self);
  39087   ck_assert_str_eq(s, "[1,true,3,true,11]");
  39088   free(s);
  39089   // wrong object type of another user class
  39090   //   User classes are stored in containers transparently
  39091   createAllocateSmallInt(ip);
  39092   ip->type = "anothertype";
  39093   setValG(ip, 11);
  39094   r2 = self->f->push(self, (baset*)ip);
  39095   ck_assert_ptr_ne(r2, null);
  39096   r = self->f->getAtNDupBool(self,-1);
  39097   ck_assert(!r);
  39098   s = toStringO(self);
  39099   ck_assert_str_eq(s, "[1,true,3,true,11,\"<data container>\"]");
  39100   free(s);
  39101   // index outside
  39102   ck_assert(!self->f->getAtNDupBool(self, 20));
  39103   ck_assert(!self->f->getAtNDupBool(self, -7));
  39104   // empty list
  39105   emptyO(self);
  39106   ck_assert(!self->f->getAtNDupBool(self, 0));
  39107   ck_assert(!self->f->getAtNDupBool(self, -1));
  39108   terminateO(self);
  39109 
  39110 END_TEST
  39111 
  39112 
  39113 START_TEST(getAtNDupDoubleSmallJsonT)
  39114 
  39115   double r;
  39116   smallJsont *self = allocSmallJson();
  39117   smallJsont *r2;
  39118 
  39119   // add elements to self
  39120   r2 = self->f->pushInt(self, 1);
  39121   ck_assert_ptr_ne(r2, null);
  39122   r2 = self->f->pushDouble(self, 2);
  39123   ck_assert_ptr_ne(r2, null);
  39124   r2 = self->f->pushInt(self, 3);
  39125   ck_assert_ptr_ne(r2, null);
  39126   r2 = self->f->pushDouble(self, 4);
  39127   ck_assert_ptr_ne(r2, null);
  39128 
  39129   // positive index
  39130   r       = self->f->getAtNDupDouble(self,1);
  39131   ck_assert(r==2);
  39132   char *s = toStringO(self);
  39133   ck_assert_str_eq(s, "[1,2.000000e+00,3,4.000000e+00]");
  39134   free(s);
  39135   // negative index
  39136   r = self->f->getAtNDupDouble(self,-1);
  39137   ck_assert(r==4);
  39138   s = toStringO(self);
  39139   ck_assert_str_eq(s, "[1,2.000000e+00,3,4.000000e+00]");
  39140   free(s);
  39141   // wrong object type
  39142   createSmallInt(I);
  39143   setValG(&I, 11);
  39144   r2 = self->f->pushSmallInt(self, &I);
  39145   r = self->f->getAtNDupDouble(self,-1);
  39146   ck_assert(!r);
  39147   s = toStringO(self);
  39148   ck_assert_str_eq(s, "[1,2.000000e+00,3,4.000000e+00,11]");
  39149   free(s);
  39150   // wrong object type of another user class
  39151   //   User classes are stored in containers transparently
  39152   createAllocateSmallInt(ip);
  39153   ip->type = "anothertype";
  39154   setValG(ip, 11);
  39155   r2 = self->f->push(self, (baset*)ip);
  39156   ck_assert_ptr_ne(r2, null);
  39157   r = self->f->getAtNDupDouble(self,-1);
  39158   ck_assert(!r);
  39159   s = toStringO(self);
  39160   ck_assert_str_eq(s, "[1,2.000000e+00,3,4.000000e+00,11,\"<data container>\"]");
  39161   free(s);
  39162   // index outside
  39163   ck_assert(!self->f->getAtNDupDouble(self, 20));
  39164   ck_assert(!self->f->getAtNDupDouble(self, -7));
  39165   // empty list
  39166   emptyO(self);
  39167   ck_assert(!self->f->getAtNDupDouble(self, 0));
  39168   ck_assert(!self->f->getAtNDupDouble(self, -1));
  39169   terminateO(self);
  39170 
  39171 END_TEST
  39172 
  39173 
  39174 START_TEST(getAtNDupIntSmallJsonT)
  39175 
  39176   int64_t r;
  39177   smallJsont *self = allocSmallJson();
  39178   smallJsont *r2;
  39179 
  39180   // add elements to self
  39181   r2 = self->f->pushInt(self, 1);
  39182   ck_assert_ptr_ne(r2, null);
  39183   r2 = self->f->pushInt(self, 2);
  39184   ck_assert_ptr_ne(r2, null);
  39185   r2 = self->f->pushInt(self, 3);
  39186   ck_assert_ptr_ne(r2, null);
  39187   r2 = self->f->pushInt(self, 4);
  39188   ck_assert_ptr_ne(r2, null);
  39189 
  39190   // positive index
  39191   r       = self->f->getAtNDupInt(self,1);
  39192   ck_assert(r==2);
  39193   char *s = toStringO(self);
  39194   ck_assert_str_eq(s, "[1,2,3,4]");
  39195   free(s);
  39196   // negative index
  39197   r = self->f->getAtNDupInt(self,-1);
  39198   ck_assert(r==4);
  39199   s = toStringO(self);
  39200   ck_assert_str_eq(s, "[1,2,3,4]");
  39201   free(s);
  39202   // wrong object type
  39203   createSmallDouble(I);
  39204   setValG(&I, 11);
  39205   r2 = self->f->pushSmallDouble(self, &I);
  39206   r = self->f->getAtNDupInt(self,-1);
  39207   ck_assert(!r);
  39208   s = toStringO(self);
  39209   ck_assert_str_eq(s, "[1,2,3,4,1.100000e+01]");
  39210   free(s);
  39211   // wrong object type of another user class
  39212   //   User classes are stored in containers transparently
  39213   createAllocateSmallInt(ip);
  39214   ip->type = "anothertype";
  39215   setValG(ip, 11);
  39216   r2 = self->f->push(self, (baset*)ip);
  39217   ck_assert_ptr_ne(r2, null);
  39218   r = self->f->getAtNDupInt(self,-1);
  39219   ck_assert(!r);
  39220   s = toStringO(self);
  39221   ck_assert_str_eq(s, "[1,2,3,4,1.100000e+01,\"<data container>\"]");
  39222   free(s);
  39223   // index outside
  39224   ck_assert(!self->f->getAtNDupInt(self, 20));
  39225   ck_assert(!self->f->getAtNDupInt(self, -7));
  39226   // empty list
  39227   emptyO(self);
  39228   ck_assert(!self->f->getAtNDupInt(self, 0));
  39229   ck_assert(!self->f->getAtNDupInt(self, -1));
  39230   terminateO(self);
  39231 
  39232 END_TEST
  39233 
  39234 
  39235 START_TEST(getAtNDupInt32SmallJsonT)
  39236 
  39237   int32_t r;
  39238   smallJsont *self = allocSmallJson();
  39239   smallJsont *r2;
  39240 
  39241   // add elements to self
  39242   r2 = self->f->pushInt(self, 1);
  39243   ck_assert_ptr_ne(r2, null);
  39244   r2 = self->f->pushInt(self, 2);
  39245   ck_assert_ptr_ne(r2, null);
  39246   r2 = self->f->pushInt(self, 3);
  39247   ck_assert_ptr_ne(r2, null);
  39248   r2 = self->f->pushInt(self, 4);
  39249   ck_assert_ptr_ne(r2, null);
  39250 
  39251   // positive index
  39252   r       = self->f->getAtNDupInt32(self,1);
  39253   ck_assert(r==2);
  39254   char *s = toStringO(self);
  39255   ck_assert_str_eq(s, "[1,2,3,4]");
  39256   free(s);
  39257   // negative index
  39258   r = self->f->getAtNDupInt32(self,-1);
  39259   ck_assert(r==4);
  39260   s = toStringO(self);
  39261   ck_assert_str_eq(s, "[1,2,3,4]");
  39262   free(s);
  39263   // wrong object type
  39264   createSmallDouble(I);
  39265   setValG(&I, 11);
  39266   r2 = self->f->pushSmallDouble(self, &I);
  39267   r = self->f->getAtNDupInt32(self,-1);
  39268   ck_assert(!r);
  39269   s = toStringO(self);
  39270   ck_assert_str_eq(s, "[1,2,3,4,1.100000e+01]");
  39271   free(s);
  39272   // wrong object type of another user class
  39273   //   User classes are stored in containers transparently
  39274   createAllocateSmallInt(ip);
  39275   ip->type = "anothertype";
  39276   setValG(ip, 11);
  39277   r2 = self->f->push(self, (baset*)ip);
  39278   ck_assert_ptr_ne(r2, null);
  39279   r = self->f->getAtNDupInt32(self,-1);
  39280   ck_assert(!r);
  39281   s = toStringO(self);
  39282   ck_assert_str_eq(s, "[1,2,3,4,1.100000e+01,\"<data container>\"]");
  39283   free(s);
  39284   // index outside
  39285   ck_assert(!self->f->getAtNDupInt32(self, 20));
  39286   ck_assert(!self->f->getAtNDupInt32(self, -7));
  39287   // empty list
  39288   emptyO(self);
  39289   ck_assert(!self->f->getAtNDupInt32(self, 0));
  39290   ck_assert(!self->f->getAtNDupInt32(self, -1));
  39291   terminateO(self);
  39292 
  39293 END_TEST
  39294 
  39295 
  39296 START_TEST(getAtNDupUintSmallJsonT)
  39297 
  39298   uint64_t r;
  39299   smallJsont *self = allocSmallJson();
  39300   smallJsont *r2;
  39301 
  39302   // add elements to self
  39303   r2 = self->f->pushInt(self, 1);
  39304   ck_assert_ptr_ne(r2, null);
  39305   r2 = self->f->pushInt(self, 2);
  39306   ck_assert_ptr_ne(r2, null);
  39307   r2 = self->f->pushInt(self, 3);
  39308   ck_assert_ptr_ne(r2, null);
  39309   r2 = self->f->pushInt(self, 4);
  39310   ck_assert_ptr_ne(r2, null);
  39311 
  39312   // positive index
  39313   r       = self->f->getAtNDupUint(self,1);
  39314   ck_assert(r==2);
  39315   char *s = toStringO(self);
  39316   ck_assert_str_eq(s, "[1,2,3,4]");
  39317   free(s);
  39318   // negative index
  39319   r = self->f->getAtNDupUint(self,-1);
  39320   ck_assert(r==4);
  39321   s = toStringO(self);
  39322   ck_assert_str_eq(s, "[1,2,3,4]");
  39323   free(s);
  39324   // wrong object type
  39325   createSmallDouble(I);
  39326   setValG(&I, 11);
  39327   r2 = self->f->pushSmallDouble(self, &I);
  39328   r = self->f->getAtNDupUint(self,-1);
  39329   ck_assert(!r);
  39330   s = toStringO(self);
  39331   ck_assert_str_eq(s, "[1,2,3,4,1.100000e+01]");
  39332   free(s);
  39333   // wrong object type of another user class
  39334   //   User classes are stored in containers transparently
  39335   createAllocateSmallInt(ip);
  39336   ip->type = "anothertype";
  39337   setValG(ip, 11);
  39338   r2 = self->f->push(self, (baset*)ip);
  39339   ck_assert_ptr_ne(r2, null);
  39340   r = self->f->getAtNDupUint(self,-1);
  39341   ck_assert(!r);
  39342   s = toStringO(self);
  39343   ck_assert_str_eq(s, "[1,2,3,4,1.100000e+01,\"<data container>\"]");
  39344   free(s);
  39345   // index outside
  39346   ck_assert(!self->f->getAtNDupUint(self, 20));
  39347   ck_assert(!self->f->getAtNDupUint(self, -7));
  39348   // empty list
  39349   emptyO(self);
  39350   ck_assert(!self->f->getAtNDupUint(self, 0));
  39351   ck_assert(!self->f->getAtNDupUint(self, -1));
  39352   terminateO(self);
  39353 
  39354 END_TEST
  39355 
  39356 
  39357 START_TEST(getAtNDupUint32SmallJsonT)
  39358 
  39359   uint32_t r;
  39360   smallJsont *self = allocSmallJson();
  39361   smallJsont *r2;
  39362 
  39363   // add elements to self
  39364   r2 = self->f->pushInt(self, 1);
  39365   ck_assert_ptr_ne(r2, null);
  39366   r2 = self->f->pushInt(self, 2);
  39367   ck_assert_ptr_ne(r2, null);
  39368   r2 = self->f->pushInt(self, 3);
  39369   ck_assert_ptr_ne(r2, null);
  39370   r2 = self->f->pushInt(self, 4);
  39371   ck_assert_ptr_ne(r2, null);
  39372 
  39373   // positive index
  39374   r       = self->f->getAtNDupUint32(self,1);
  39375   ck_assert(r==2);
  39376   char *s = toStringO(self);
  39377   ck_assert_str_eq(s, "[1,2,3,4]");
  39378   free(s);
  39379   // negative index
  39380   r = self->f->getAtNDupUint32(self,-1);
  39381   ck_assert(r==4);
  39382   s = toStringO(self);
  39383   ck_assert_str_eq(s, "[1,2,3,4]");
  39384   free(s);
  39385   // wrong object type
  39386   createSmallDouble(I);
  39387   setValG(&I, 11);
  39388   r2 = self->f->pushSmallDouble(self, &I);
  39389   r = self->f->getAtNDupUint32(self,-1);
  39390   ck_assert(!r);
  39391   s = toStringO(self);
  39392   ck_assert_str_eq(s, "[1,2,3,4,1.100000e+01]");
  39393   free(s);
  39394   // wrong object type of another user class
  39395   //   User classes are stored in containers transparently
  39396   createAllocateSmallInt(ip);
  39397   ip->type = "anothertype";
  39398   setValG(ip, 11);
  39399   r2 = self->f->push(self, (baset*)ip);
  39400   ck_assert_ptr_ne(r2, null);
  39401   r = self->f->getAtNDupUint32(self,-1);
  39402   ck_assert(!r);
  39403   s = toStringO(self);
  39404   ck_assert_str_eq(s, "[1,2,3,4,1.100000e+01,\"<data container>\"]");
  39405   free(s);
  39406   // index outside
  39407   ck_assert(!self->f->getAtNDupUint32(self, 20));
  39408   ck_assert(!self->f->getAtNDupUint32(self, -7));
  39409   // empty list
  39410   emptyO(self);
  39411   ck_assert(!self->f->getAtNDupUint32(self, 0));
  39412   ck_assert(!self->f->getAtNDupUint32(self, -1));
  39413   terminateO(self);
  39414 
  39415 END_TEST
  39416 
  39417 
  39418 START_TEST(getAtNDupSSmallJsonT)
  39419 
  39420   char* r;
  39421   smallJsont *self = allocSmallJson();
  39422   smallJsont *r2;
  39423 
  39424   // add elements to self
  39425   r2 = self->f->pushInt(self, 1);
  39426   ck_assert_ptr_ne(r2, null);
  39427   r2 = self->f->pushS(self, "2");
  39428   ck_assert_ptr_ne(r2, null);
  39429   r2 = self->f->pushInt(self, 3);
  39430   ck_assert_ptr_ne(r2, null);
  39431   r2 = self->f->pushS(self, "4");
  39432   ck_assert_ptr_ne(r2, null);
  39433 
  39434   // positive index
  39435   r       = self->f->getAtNDupS(self,1);
  39436   ck_assert_ptr_ne(r, null);
  39437   ck_assert_str_eq(r, "2");
  39438   free(r);
  39439   char *s = toStringO(self);
  39440   ck_assert_str_eq(s, "[1,\"2\",3,\"4\"]");
  39441   free(s);
  39442   // negative index
  39443   r = self->f->getAtNDupS(self,-1);
  39444   ck_assert_ptr_ne(r, null);
  39445   ck_assert_str_eq(r, "4");
  39446   free(r);
  39447   s = toStringO(self);
  39448   ck_assert_str_eq(s, "[1,\"2\",3,\"4\"]");
  39449   free(s);
  39450   // wrong object type
  39451   createSmallInt(I);
  39452   setValG(&I, 11);
  39453   r2 = self->f->pushSmallInt(self, &I);
  39454   r = self->f->getAtNDupS(self,-1);
  39455   ck_assert_ptr_eq(r, NULL);
  39456   s = toStringO(self);
  39457   ck_assert_str_eq(s, "[1,\"2\",3,\"4\",11]");
  39458   free(s);
  39459   // wrong object type of another user class
  39460   //   User classes are stored in containers transparently
  39461   createAllocateSmallInt(ip);
  39462   ip->type = "anothertype";
  39463   setValG(ip, 11);
  39464   r2 = self->f->push(self, (baset*)ip);
  39465   ck_assert_ptr_ne(r2, null);
  39466   r = self->f->getAtNDupS(self,-1);
  39467   ck_assert_ptr_eq(r, NULL);
  39468   s = toStringO(self);
  39469   ck_assert_str_eq(s, "[1,\"2\",3,\"4\",11,\"<data container>\"]");
  39470   free(s);
  39471   // index outside
  39472   ck_assert_ptr_eq(self->f->getAtNDupS(self, 20), NULL);
  39473   ck_assert_ptr_eq(self->f->getAtNDupS(self, -7), NULL);
  39474   // empty list
  39475   emptyO(self);
  39476   ck_assert_ptr_eq(self->f->getAtNDupS(self, 0), NULL);
  39477   ck_assert_ptr_eq(self->f->getAtNDupS(self, -1), NULL);
  39478   terminateO(self);
  39479 
  39480 END_TEST
  39481 
  39482 
  39483 START_TEST(getAtNDupDictSmallJsonT)
  39484 
  39485   smallDictt* r;
  39486   smallJsont *self = allocSmallJson();
  39487   smallJsont *r2;
  39488 
  39489   // non json array
  39490   ck_assert_ptr_eq(self->f->getAtNDupDict(self, 0), null);
  39491   // add elements to self
  39492   r2 = self->f->pushInt(self, 1);
  39493   ck_assert_ptr_ne(r2, null);
  39494   createSmallDict(e2);
  39495   r2 = self->f->pushDict(self, &e2);
  39496   ck_assert_ptr_ne(r2, null);
  39497   r2 = self->f->pushInt(self, 3);
  39498   ck_assert_ptr_ne(r2, null);
  39499   createSmallDict(e4);
  39500   r2 = self->f->pushDict(self, &e4);
  39501   ck_assert_ptr_ne(r2, null);
  39502 
  39503   // positive index
  39504   r       = self->f->getAtNDupDict(self,1);
  39505   ck_assert_ptr_ne(r, null);
  39506   char *s = toStringO(r);
  39507   terminateO(r);
  39508   ck_assert_str_eq(s, "{}");
  39509   free(s);
  39510   s = toStringO(self);
  39511   ck_assert_str_eq(s, "[1,{},3,{}]");
  39512   free(s);
  39513   // negative index
  39514   r = self->f->getAtNDupDict(self,-1);
  39515   ck_assert_ptr_ne(r, null);
  39516   s = toStringO(r);
  39517   terminateO(r);
  39518   ck_assert_str_eq(s, "{}");
  39519   free(s);
  39520   s = toStringO(self);
  39521   ck_assert_str_eq(s, "[1,{},3,{}]");
  39522   free(s);
  39523   // wrong object type
  39524   createSmallInt(I);
  39525   setValG(&I, 11);
  39526   r2 = self->f->pushSmallInt(self, &I);
  39527   r = self->f->getAtNDupDict(self,-1);
  39528   ck_assert_ptr_eq(r, NULL);
  39529   s = toStringO(self);
  39530   ck_assert_str_eq(s, "[1,{},3,{},11]");
  39531   free(s);
  39532   // wrong object type of another user class
  39533   //   User classes are stored in containers transparently
  39534   createAllocateSmallInt(ip);
  39535   ip->type = "anothertype";
  39536   setValG(ip, 11);
  39537   r2 = self->f->push(self, (baset*)ip);
  39538   ck_assert_ptr_ne(r2, null);
  39539   r = self->f->getAtNDupDict(self,-1);
  39540   ck_assert_ptr_eq(r, NULL);
  39541   s = toStringO(self);
  39542   ck_assert_str_eq(s, "[1,{},3,{},11,\"<data container>\"]");
  39543   free(s);
  39544   // index outside
  39545   ck_assert_ptr_eq(self->f->getAtNDupDict(self, 20), NULL);
  39546   ck_assert_ptr_eq(self->f->getAtNDupDict(self, -7), NULL);
  39547   // empty list
  39548   emptyO(self);
  39549   ck_assert_ptr_eq(self->f->getAtNDupDict(self, 0), NULL);
  39550   ck_assert_ptr_eq(self->f->getAtNDupDict(self, -1), NULL);
  39551   terminateO(self);
  39552 
  39553 END_TEST
  39554 
  39555 
  39556 START_TEST(getAtNDupArraySmallJsonT)
  39557 
  39558   smallArrayt* r;
  39559   smallJsont *self = allocSmallJson();
  39560   smallJsont *r2;
  39561 
  39562   // non json array
  39563   ck_assert_ptr_eq(self->f->getAtNDupArray(self, 0), null);
  39564   // add elements to self
  39565   r2 = self->f->pushInt(self, 1);
  39566   ck_assert_ptr_ne(r2, null);
  39567   createSmallArray(e2);
  39568   r2 = self->f->pushArray(self, &e2);
  39569   ck_assert_ptr_ne(r2, null);
  39570   r2 = self->f->pushInt(self, 3);
  39571   ck_assert_ptr_ne(r2, null);
  39572   createSmallArray(e4);
  39573   r2 = self->f->pushArray(self, &e4);
  39574   ck_assert_ptr_ne(r2, null);
  39575 
  39576   // positive index
  39577   r       = self->f->getAtNDupArray(self,1);
  39578   ck_assert_ptr_ne(r, null);
  39579   char *s = toStringO(r);
  39580   terminateO(r);
  39581   ck_assert_str_eq(s, "[]");
  39582   free(s);
  39583   s = toStringO(self);
  39584   ck_assert_str_eq(s, "[1,[],3,[]]");
  39585   free(s);
  39586   // negative index
  39587   r = self->f->getAtNDupArray(self,-1);
  39588   ck_assert_ptr_ne(r, null);
  39589   s = toStringO(r);
  39590   terminateO(r);
  39591   ck_assert_str_eq(s, "[]");
  39592   free(s);
  39593   s = toStringO(self);
  39594   ck_assert_str_eq(s, "[1,[],3,[]]");
  39595   free(s);
  39596   // wrong object type
  39597   createSmallInt(I);
  39598   setValG(&I, 11);
  39599   r2 = self->f->pushSmallInt(self, &I);
  39600   r = self->f->getAtNDupArray(self,-1);
  39601   ck_assert_ptr_eq(r, NULL);
  39602   s = toStringO(self);
  39603   ck_assert_str_eq(s, "[1,[],3,[],11]");
  39604   free(s);
  39605   // wrong object type of another user class
  39606   //   User classes are stored in containers transparently
  39607   createAllocateSmallInt(ip);
  39608   ip->type = "anothertype";
  39609   setValG(ip, 11);
  39610   r2 = self->f->push(self, (baset*)ip);
  39611   ck_assert_ptr_ne(r2, null);
  39612   r = self->f->getAtNDupArray(self,-1);
  39613   ck_assert_ptr_eq(r, NULL);
  39614   s = toStringO(self);
  39615   ck_assert_str_eq(s, "[1,[],3,[],11,\"<data container>\"]");
  39616   free(s);
  39617   // index outside
  39618   ck_assert_ptr_eq(self->f->getAtNDupArray(self, 20), NULL);
  39619   ck_assert_ptr_eq(self->f->getAtNDupArray(self, -7), NULL);
  39620   // empty list
  39621   emptyO(self);
  39622   ck_assert_ptr_eq(self->f->getAtNDupArray(self, 0), NULL);
  39623   ck_assert_ptr_eq(self->f->getAtNDupArray(self, -1), NULL);
  39624   terminateO(self);
  39625 
  39626 END_TEST
  39627 
  39628 
  39629 START_TEST(getAtNDupSmallBoolSmallJsonT)
  39630 
  39631   smallBoolt* r;
  39632   smallJsont *self = allocSmallJson();
  39633   smallJsont *r2;
  39634 
  39635   // non json array
  39636   ck_assert_ptr_eq(self->f->getAtNDupSmallBool(self, 0), null);
  39637   // add elements to self
  39638   r2 = self->f->pushInt(self, 1);
  39639   ck_assert_ptr_ne(r2, null);
  39640   createSmallBool(e2);
  39641   r2 = self->f->pushBool(self, true);
  39642   ck_assert_ptr_ne(r2, null);
  39643   r2 = self->f->pushInt(self, 3);
  39644   ck_assert_ptr_ne(r2, null);
  39645   createSmallBool(e4);
  39646   r2 = self->f->pushBool(self, true);
  39647   ck_assert_ptr_ne(r2, null);
  39648 
  39649   // positive index
  39650   r       = self->f->getAtNDupSmallBool(self,1);
  39651   ck_assert_ptr_ne(r, null);
  39652   char *s = toStringO(r);
  39653   terminateO(r);
  39654   ck_assert_str_eq(s, "true");
  39655   free(s);
  39656   s = toStringO(self);
  39657   ck_assert_str_eq(s, "[1,true,3,true]");
  39658   free(s);
  39659   // negative index
  39660   r = self->f->getAtNDupSmallBool(self,-1);
  39661   ck_assert_ptr_ne(r, null);
  39662   s = toStringO(r);
  39663   terminateO(r);
  39664   ck_assert_str_eq(s, "true");
  39665   free(s);
  39666   s = toStringO(self);
  39667   ck_assert_str_eq(s, "[1,true,3,true]");
  39668   free(s);
  39669   // wrong object type
  39670   createSmallInt(I);
  39671   setValG(&I, 11);
  39672   r2 = self->f->pushSmallInt(self, &I);
  39673   r = self->f->getAtNDupSmallBool(self,2);
  39674   ck_assert_ptr_eq(r, NULL);
  39675   s = toStringO(self);
  39676   ck_assert_str_eq(s, "[1,true,3,true,11]");
  39677   free(s);
  39678   // wrong object type of another user class
  39679   //   User classes are stored in containers transparently
  39680   createAllocateSmallInt(ip);
  39681   ip->type = "anothertype";
  39682   setValG(ip, 11);
  39683   r2 = self->f->push(self, (baset*)ip);
  39684   ck_assert_ptr_ne(r2, null);
  39685   r = self->f->getAtNDupSmallBool(self,-1);
  39686   ck_assert_ptr_eq(r, NULL);
  39687   s = toStringO(self);
  39688   ck_assert_str_eq(s, "[1,true,3,true,11,\"<data container>\"]");
  39689   free(s);
  39690   // index outside
  39691   ck_assert_ptr_eq(self->f->getAtNDupSmallBool(self, 20), NULL);
  39692   ck_assert_ptr_eq(self->f->getAtNDupSmallBool(self, -7), NULL);
  39693   // empty list
  39694   emptyO(self);
  39695   ck_assert_ptr_eq(self->f->getAtNDupSmallBool(self, 0), NULL);
  39696   ck_assert_ptr_eq(self->f->getAtNDupSmallBool(self, -1), NULL);
  39697   terminateO(self);
  39698 
  39699 END_TEST
  39700 
  39701 
  39702 START_TEST(getAtNDupSmallBytesSmallJsonT)
  39703 
  39704   smallBytest* r;
  39705   smallJsont *self = allocSmallJson();
  39706   smallJsont *r2;
  39707 
  39708   // non json array
  39709   ck_assert_ptr_eq(self->f->getAtNDupSmallBytes(self, 0), null);
  39710   // add elements to self
  39711   r2 = self->f->pushInt(self, 1);
  39712   ck_assert_ptr_ne(r2, null);
  39713   createSmallBytes(e2);
  39714   r2 = self->f->pushSmallBytes(self, &e2);
  39715   ck_assert_ptr_ne(r2, null);
  39716   r2 = self->f->pushInt(self, 3);
  39717   ck_assert_ptr_ne(r2, null);
  39718   createSmallBytes(e4);
  39719   r2 = self->f->pushSmallBytes(self, &e4);
  39720   ck_assert_ptr_ne(r2, null);
  39721 
  39722   // positive index
  39723   r       = self->f->getAtNDupSmallBytes(self,1);
  39724   ck_assert_ptr_ne(r, null);
  39725   char *s = toStringO(r);
  39726   terminateO(r);
  39727   ck_assert_str_eq(s, "[]");
  39728   free(s);
  39729   s = toStringO(self);
  39730   ck_assert_str_eq(s, "[1,[],3,[]]");
  39731   free(s);
  39732   // negative index
  39733   r = self->f->getAtNDupSmallBytes(self,-1);
  39734   ck_assert_ptr_ne(r, null);
  39735   s = toStringO(r);
  39736   terminateO(r);
  39737   ck_assert_str_eq(s, "[]");
  39738   free(s);
  39739   s = toStringO(self);
  39740   ck_assert_str_eq(s, "[1,[],3,[]]");
  39741   free(s);
  39742   // wrong object type
  39743   createSmallInt(I);
  39744   setValG(&I, 11);
  39745   r2 = self->f->pushSmallInt(self, &I);
  39746   r = self->f->getAtNDupSmallBytes(self,-1);
  39747   ck_assert_ptr_eq(r, NULL);
  39748   s = toStringO(self);
  39749   ck_assert_str_eq(s, "[1,[],3,[],11]");
  39750   free(s);
  39751   // wrong object type of another user class
  39752   //   User classes are stored in containers transparently
  39753   createAllocateSmallInt(ip);
  39754   ip->type = "anothertype";
  39755   setValG(ip, 11);
  39756   r2 = self->f->push(self, (baset*)ip);
  39757   ck_assert_ptr_ne(r2, null);
  39758   r = self->f->getAtNDupSmallBytes(self,-1);
  39759   ck_assert_ptr_eq(r, NULL);
  39760   s = toStringO(self);
  39761   ck_assert_str_eq(s, "[1,[],3,[],11,\"<data container>\"]");
  39762   free(s);
  39763   // index outside
  39764   ck_assert_ptr_eq(self->f->getAtNDupSmallBytes(self, 20), NULL);
  39765   ck_assert_ptr_eq(self->f->getAtNDupSmallBytes(self, -7), NULL);
  39766   // empty list
  39767   emptyO(self);
  39768   ck_assert_ptr_eq(self->f->getAtNDupSmallBytes(self, 0), NULL);
  39769   ck_assert_ptr_eq(self->f->getAtNDupSmallBytes(self, -1), NULL);
  39770   terminateO(self);
  39771 
  39772 END_TEST
  39773 
  39774 
  39775 START_TEST(getAtNDupSmallDoubleSmallJsonT)
  39776 
  39777   smallDoublet* r;
  39778   smallJsont *self = allocSmallJson();
  39779   smallJsont *r2;
  39780 
  39781   // non json array
  39782   ck_assert_ptr_eq(self->f->getAtNDupSmallDouble(self, 0), null);
  39783   // add elements to self
  39784   r2 = self->f->pushInt(self, 1);
  39785   ck_assert_ptr_ne(r2, null);
  39786   createSmallDouble(e2);
  39787   r2 = self->f->pushSmallDouble(self, &e2);
  39788   ck_assert_ptr_ne(r2, null);
  39789   r2 = self->f->pushInt(self, 3);
  39790   ck_assert_ptr_ne(r2, null);
  39791   createSmallDouble(e4);
  39792   r2 = self->f->pushSmallDouble(self, &e4);
  39793   ck_assert_ptr_ne(r2, null);
  39794 
  39795   // positive index
  39796   r       = self->f->getAtNDupSmallDouble(self,1);
  39797   ck_assert_ptr_ne(r, null);
  39798   char *s = toStringO(r);
  39799   terminateO(r);
  39800   ck_assert_str_eq(s, "0.000000e+00");
  39801   free(s);
  39802   s = toStringO(self);
  39803   ck_assert_str_eq(s, "[1,0.000000e+00,3,0.000000e+00]");
  39804   free(s);
  39805   // negative index
  39806   r = self->f->getAtNDupSmallDouble(self,-1);
  39807   ck_assert_ptr_ne(r, null);
  39808   s = toStringO(r);
  39809   terminateO(r);
  39810   ck_assert_str_eq(s, "0.000000e+00");
  39811   free(s);
  39812   s = toStringO(self);
  39813   ck_assert_str_eq(s, "[1,0.000000e+00,3,0.000000e+00]");
  39814   free(s);
  39815   // wrong object type
  39816   createSmallInt(I);
  39817   setValG(&I, 11);
  39818   r2 = self->f->pushSmallInt(self, &I);
  39819   r = self->f->getAtNDupSmallDouble(self,-1);
  39820   ck_assert_ptr_eq(r, NULL);
  39821   s = toStringO(self);
  39822   ck_assert_str_eq(s, "[1,0.000000e+00,3,0.000000e+00,11]");
  39823   free(s);
  39824   // wrong object type of another user class
  39825   //   User classes are stored in containers transparently
  39826   createAllocateSmallInt(ip);
  39827   ip->type = "anothertype";
  39828   setValG(ip, 11);
  39829   r2 = self->f->push(self, (baset*)ip);
  39830   ck_assert_ptr_ne(r2, null);
  39831   r = self->f->getAtNDupSmallDouble(self,-1);
  39832   ck_assert_ptr_eq(r, NULL);
  39833   s = toStringO(self);
  39834   ck_assert_str_eq(s, "[1,0.000000e+00,3,0.000000e+00,11,\"<data container>\"]");
  39835   free(s);
  39836   // index outside
  39837   ck_assert_ptr_eq(self->f->getAtNDupSmallDouble(self, 20), NULL);
  39838   ck_assert_ptr_eq(self->f->getAtNDupSmallDouble(self, -7), NULL);
  39839   // empty list
  39840   emptyO(self);
  39841   ck_assert_ptr_eq(self->f->getAtNDupSmallDouble(self, 0), NULL);
  39842   ck_assert_ptr_eq(self->f->getAtNDupSmallDouble(self, -1), NULL);
  39843   terminateO(self);
  39844 
  39845 END_TEST
  39846 
  39847 
  39848 START_TEST(getAtNDupSmallIntSmallJsonT)
  39849 
  39850   smallIntt* r;
  39851   smallJsont *self = allocSmallJson();
  39852   smallJsont *r2;
  39853 
  39854   // non json array
  39855   ck_assert_ptr_eq(self->f->getAtNDupSmallInt(self, 0), null);
  39856   // add elements to self
  39857   r2 = self->f->pushBool(self, true);
  39858   ck_assert_ptr_ne(r2, null);
  39859   createSmallInt(e2);
  39860   r2 = self->f->pushSmallInt(self, &e2);
  39861   ck_assert_ptr_ne(r2, null);
  39862   r2 = self->f->pushBool(self, true);
  39863   ck_assert_ptr_ne(r2, null);
  39864   createSmallInt(e4);
  39865   r2 = self->f->pushSmallInt(self, &e4);
  39866   ck_assert_ptr_ne(r2, null);
  39867 
  39868   // positive index
  39869   r       = self->f->getAtNDupSmallInt(self,1);
  39870   ck_assert_ptr_ne(r, null);
  39871   char *s = toStringO(r);
  39872   terminateO(r);
  39873   ck_assert_str_eq(s, "0");
  39874   free(s);
  39875   s = toStringO(self);
  39876   ck_assert_str_eq(s, "[true,0,true,0]");
  39877   free(s);
  39878   // negative index
  39879   r = self->f->getAtNDupSmallInt(self,-1);
  39880   ck_assert_ptr_ne(r, null);
  39881   s = toStringO(r);
  39882   terminateO(r);
  39883   ck_assert_str_eq(s, "0");
  39884   free(s);
  39885   s = toStringO(self);
  39886   ck_assert_str_eq(s, "[true,0,true,0]");
  39887   free(s);
  39888   // wrong object type
  39889   createSmallDouble(I);
  39890   setValG(&I, 11);
  39891   r2 = self->f->pushSmallDouble(self, &I);
  39892   r = self->f->getAtNDupSmallInt(self,-1);
  39893   ck_assert_ptr_eq(r, NULL);
  39894   s = toStringO(self);
  39895   ck_assert_str_eq(s, "[true,0,true,0,1.100000e+01]");
  39896   free(s);
  39897   // wrong object type of another user class
  39898   //   User classes are stored in containers transparently
  39899   createAllocateSmallInt(ip);
  39900   ip->type = "anothertype";
  39901   setValG(ip, 11);
  39902   r2 = self->f->push(self, (baset*)ip);
  39903   ck_assert_ptr_ne(r2, null);
  39904   r = self->f->getAtNDupSmallInt(self,-1);
  39905   ck_assert_ptr_eq(r, NULL);
  39906   s = toStringO(self);
  39907   ck_assert_str_eq(s, "[true,0,true,0,1.100000e+01,\"<data container>\"]");
  39908   free(s);
  39909   // index outside
  39910   ck_assert_ptr_eq(self->f->getAtNDupSmallInt(self, 20), NULL);
  39911   ck_assert_ptr_eq(self->f->getAtNDupSmallInt(self, -7), NULL);
  39912   // empty list
  39913   emptyO(self);
  39914   ck_assert_ptr_eq(self->f->getAtNDupSmallInt(self, 0), NULL);
  39915   ck_assert_ptr_eq(self->f->getAtNDupSmallInt(self, -1), NULL);
  39916   terminateO(self);
  39917 
  39918 END_TEST
  39919 
  39920 
  39921 START_TEST(getAtNDupSmallJsonSmallJsonT)
  39922 
  39923   smallJsont* r;
  39924   smallJsont *self = allocSmallJson();
  39925   smallJsont *r2;
  39926 
  39927   // non json array
  39928   ck_assert_ptr_eq(self->f->getAtNDupSmallJson(self, 0), null);
  39929   // add elements to self
  39930   r2 = self->f->pushInt(self, 1);
  39931   ck_assert_ptr_ne(r2, null);
  39932   createSmallJson(e2);
  39933   r2 = self->f->pushSmallJson(self, &e2);
  39934   ck_assert_ptr_ne(r2, null);
  39935   r2 = self->f->pushInt(self, 3);
  39936   ck_assert_ptr_ne(r2, null);
  39937   createSmallJson(e4);
  39938   r2 = self->f->pushSmallJson(self, &e4);
  39939   ck_assert_ptr_ne(r2, null);
  39940 
  39941   // positive index
  39942   r       = self->f->getAtNDupSmallJson(self,1);
  39943   ck_assert_ptr_ne(r, null);
  39944   char *s = toStringO(r);
  39945   terminateO(r);
  39946   ck_assert_str_eq(s, "{}");
  39947   free(s);
  39948   s = toStringO(self);
  39949   ck_assert_str_eq(s, "[1,{},3,{}]");
  39950   free(s);
  39951   // negative index
  39952   r = self->f->getAtNDupSmallJson(self,-1);
  39953   ck_assert_ptr_ne(r, null);
  39954   s = toStringO(r);
  39955   terminateO(r);
  39956   ck_assert_str_eq(s, "{}");
  39957   free(s);
  39958   s = toStringO(self);
  39959   ck_assert_str_eq(s, "[1,{},3,{}]");
  39960   free(s);
  39961   // wrong object type
  39962   createSmallBytes(I);
  39963   r2 = self->f->pushSmallBytes(self, &I);
  39964   r = self->f->getAtNDupSmallJson(self,-1);
  39965   ck_assert_ptr_eq(r, NULL);
  39966   s = toStringO(self);
  39967   ck_assert_str_eq(s, "[1,{},3,{},[]]");
  39968   free(s);
  39969   // wrong object type of another user class
  39970   //   User classes are stored in containers transparently
  39971   createAllocateSmallInt(ip);
  39972   ip->type = "anothertype";
  39973   setValG(ip, 11);
  39974   r2 = self->f->push(self, (baset*)ip);
  39975   ck_assert_ptr_ne(r2, null);
  39976   r = self->f->getAtNDupSmallJson(self,-1);
  39977   ck_assert_ptr_eq(r, NULL);
  39978   s = toStringO(self);
  39979   ck_assert_str_eq(s, "[1,{},3,{},[],\"<data container>\"]");
  39980   free(s);
  39981   // index outside
  39982   ck_assert_ptr_eq(self->f->getAtNDupSmallJson(self, 20), NULL);
  39983   ck_assert_ptr_eq(self->f->getAtNDupSmallJson(self, -7), NULL);
  39984   // empty list
  39985   emptyO(self);
  39986   ck_assert_ptr_eq(self->f->getAtNDupSmallJson(self, 0), NULL);
  39987   ck_assert_ptr_eq(self->f->getAtNDupSmallJson(self, -1), NULL);
  39988   terminateO(self);
  39989 
  39990 END_TEST
  39991 
  39992 
  39993 START_TEST(getAtNDupSmallStringSmallJsonT)
  39994 
  39995   smallStringt* r;
  39996   smallJsont *self = allocSmallJson();
  39997   smallJsont *r2;
  39998 
  39999   // non json array
  40000   ck_assert_ptr_eq(self->f->getAtNDupSmallString(self, 0), null);
  40001   // add elements to self
  40002   r2 = self->f->pushInt(self, 1);
  40003   ck_assert_ptr_ne(r2, null);
  40004   createSmallString(e2);
  40005   r2 = self->f->pushSmallString(self, &e2);
  40006   ck_assert_ptr_ne(r2, null);
  40007   r2 = self->f->pushInt(self, 3);
  40008   ck_assert_ptr_ne(r2, null);
  40009   createSmallString(e4);
  40010   r2 = self->f->pushSmallString(self, &e4);
  40011   ck_assert_ptr_ne(r2, null);
  40012 
  40013   // positive index
  40014   r       = self->f->getAtNDupSmallString(self,1);
  40015   ck_assert_ptr_ne(r, null);
  40016   char *s = toStringO(r);
  40017   terminateO(r);
  40018   ck_assert_str_eq(s, "");
  40019   free(s);
  40020   s = toStringO(self);
  40021   ck_assert_str_eq(s, "[1,\"\",3,\"\"]");
  40022   free(s);
  40023   // negative index
  40024   r = self->f->getAtNDupSmallString(self,-1);
  40025   ck_assert_ptr_ne(r, null);
  40026   s = toStringO(r);
  40027   terminateO(r);
  40028   ck_assert_str_eq(s, "");
  40029   free(s);
  40030   s = toStringO(self);
  40031   ck_assert_str_eq(s, "[1,\"\",3,\"\"]");
  40032   free(s);
  40033   // wrong object type
  40034   createSmallInt(I);
  40035   setValG(&I, 11);
  40036   r2 = self->f->pushSmallInt(self, &I);
  40037   r = self->f->getAtNDupSmallString(self,-1);
  40038   ck_assert_ptr_eq(r, NULL);
  40039   s = toStringO(self);
  40040   ck_assert_str_eq(s, "[1,\"\",3,\"\",11]");
  40041   free(s);
  40042   // wrong object type of another user class
  40043   //   User classes are stored in containers transparently
  40044   createAllocateSmallInt(ip);
  40045   ip->type = "anothertype";
  40046   setValG(ip, 11);
  40047   r2 = self->f->push(self, (baset*)ip);
  40048   ck_assert_ptr_ne(r2, null);
  40049   r = self->f->getAtNDupSmallString(self,-1);
  40050   ck_assert_ptr_eq(r, NULL);
  40051   s = toStringO(self);
  40052   ck_assert_str_eq(s, "[1,\"\",3,\"\",11,\"<data container>\"]");
  40053   free(s);
  40054   // index outside
  40055   ck_assert_ptr_eq(self->f->getAtNDupSmallString(self, 20), NULL);
  40056   ck_assert_ptr_eq(self->f->getAtNDupSmallString(self, -7), NULL);
  40057   // empty list
  40058   emptyO(self);
  40059   ck_assert_ptr_eq(self->f->getAtNDupSmallString(self, 0), NULL);
  40060   ck_assert_ptr_eq(self->f->getAtNDupSmallString(self, -1), NULL);
  40061   terminateO(self);
  40062 
  40063 END_TEST
  40064 
  40065 
  40066 START_TEST(getAtNDupVoidSmallJsonT)
  40067 
  40068   void* r;
  40069   smallJsont *self = allocSmallJson();
  40070   smallJsont *r2;
  40071 
  40072   // non json array
  40073   ck_assert_ptr_eq(self->f->getAtNDupVoid(self, 0), null);
  40074   // add elements to self
  40075   r2 = self->f->pushInt(self, 1);
  40076   ck_assert_ptr_ne(r2, null);
  40077   r2 = pushVoidSmallJsonG(self, &r);
  40078   ck_assert_ptr_ne(r2, null);
  40079   r2 = self->f->pushInt(self, 3);
  40080   ck_assert_ptr_ne(r2, null);
  40081   r2 = pushVoidSmallJsonG(self, &self);
  40082   ck_assert_ptr_ne(r2, null);
  40083 
  40084   // positive index
  40085   r       = self->f->getAtNDupVoid(self,1);
  40086   // duplicate function is not set so the data is not duplicated
  40087   ck_assert_ptr_eq(r, NULL);
  40088   char *s = toStringO(self);
  40089   ck_assert_str_eq(s, "[1,\"<data container>\",3,\"<data container>\"]");
  40090   free(s);
  40091   // negative index
  40092   r = self->f->getAtNDupVoid(self,-1);
  40093   // duplicate function is not set so the data is not duplicated
  40094   ck_assert_ptr_eq(r, NULL);
  40095   s = toStringO(self);
  40096   ck_assert_str_eq(s, "[1,\"<data container>\",3,\"<data container>\"]");
  40097   free(s);
  40098   // wrong object type
  40099   createSmallInt(I);
  40100   setValG(&I, 11);
  40101   r2 = self->f->pushSmallInt(self, &I);
  40102   r = self->f->getAtNDupVoid(self,-1);
  40103   ck_assert_ptr_eq(r, NULL);
  40104   s = toStringO(self);
  40105   ck_assert_str_eq(s, "[1,\"<data container>\",3,\"<data container>\",11]");
  40106   free(s);
  40107   // wrong object type of another user class
  40108   //   User classes are stored in containers transparently
  40109   createAllocateSmallInt(ip);
  40110   ip->type = "anothertype";
  40111   setValG(ip, 11);
  40112   r2 = self->f->push(self, (baset*)ip);
  40113   ck_assert_ptr_ne(r2, null);
  40114   r = self->f->getAtNDupVoid(self,-1);
  40115   ck_assert_ptr_eq(r, NULL);
  40116   s = toStringO(self);
  40117   ck_assert_str_eq(s, "[1,\"<data container>\",3,\"<data container>\",11,\"<data container>\"]");
  40118   free(s);
  40119   // index outside
  40120   ck_assert_ptr_eq(self->f->getAtNDupVoid(self, 20), NULL);
  40121   ck_assert_ptr_eq(self->f->getAtNDupVoid(self, -7), NULL);
  40122   // empty list
  40123   emptyO(self);
  40124   ck_assert_ptr_eq(self->f->getAtNDupVoid(self, 0), NULL);
  40125   ck_assert_ptr_eq(self->f->getAtNDupVoid(self, -1), NULL);
  40126   terminateO(self);
  40127 
  40128 END_TEST
  40129 
  40130 
  40131 START_TEST(getAtNDupSmallContainerSmallJsonT)
  40132 
  40133   smallContainert* r;
  40134   smallJsont *self = allocSmallJson();
  40135   smallJsont *r2;
  40136 
  40137   // non json array
  40138   ck_assert_ptr_eq(self->f->getAtNDupSmallContainer(self, 0), null);
  40139   // add elements to self
  40140   r2 = self->f->pushInt(self, 1);
  40141   ck_assert_ptr_ne(r2, null);
  40142   createSmallContainer(e2);
  40143   r2 = self->f->pushSmallContainer(self, &e2);
  40144   ck_assert_ptr_ne(r2, null);
  40145   r2 = self->f->pushInt(self, 3);
  40146   ck_assert_ptr_ne(r2, null);
  40147   createSmallContainer(e4);
  40148   r2 = self->f->pushSmallContainer(self, &e4);
  40149   ck_assert_ptr_ne(r2, null);
  40150 
  40151   // positive index
  40152   r       = self->f->getAtNDupSmallContainer(self,1);
  40153   ck_assert_ptr_ne(r, null);
  40154   char *s = toStringO(r);
  40155   terminateO(r);
  40156   ck_assert_str_eq(s, "<data smallContainer>");
  40157   free(s);
  40158   s = toStringO(self);
  40159   ck_assert_str_eq(s, "[1,\"<data container>\",3,\"<data container>\"]");
  40160   free(s);
  40161   // negative index
  40162   r = self->f->getAtNDupSmallContainer(self,-1);
  40163   ck_assert_ptr_ne(r, null);
  40164   s = toStringO(r);
  40165   terminateO(r);
  40166   ck_assert_str_eq(s, "<data smallContainer>");
  40167   free(s);
  40168   s = toStringO(self);
  40169   ck_assert_str_eq(s, "[1,\"<data container>\",3,\"<data container>\"]");
  40170   free(s);
  40171   // wrong object type
  40172   createSmallInt(I);
  40173   setValG(&I, 11);
  40174   r2 = self->f->pushSmallInt(self, &I);
  40175   r = self->f->getAtNDupSmallContainer(self,-1);
  40176   ck_assert_ptr_eq(r, NULL);
  40177   s = toStringO(self);
  40178   ck_assert_str_eq(s, "[1,\"<data container>\",3,\"<data container>\",11]");
  40179   free(s);
  40180   // wrong object type of another user class
  40181   //   User classes are stored in containers transparently
  40182   createAllocateSmallInt(ip);
  40183   ip->type = "anothertype";
  40184   setValG(ip, 11);
  40185   r2 = self->f->push(self, (baset*)ip);
  40186   ck_assert_ptr_ne(r2, null);
  40187   r = self->f->getAtNDupSmallContainer(self,-1);
  40188   ck_assert_ptr_eq(r, NULL);
  40189   s = toStringO(self);
  40190   ck_assert_str_eq(s, "[1,\"<data container>\",3,\"<data container>\",11,\"<data container>\"]");
  40191   free(s);
  40192   // index outside
  40193   ck_assert_ptr_eq(self->f->getAtNDupSmallContainer(self, 20), NULL);
  40194   ck_assert_ptr_eq(self->f->getAtNDupSmallContainer(self, -7), NULL);
  40195   // empty list
  40196   emptyO(self);
  40197   ck_assert_ptr_eq(self->f->getAtNDupSmallContainer(self, 0), NULL);
  40198   ck_assert_ptr_eq(self->f->getAtNDupSmallContainer(self, -1), NULL);
  40199   terminateO(self);
  40200 
  40201 END_TEST
  40202 
  40203 
  40204 START_TEST(getNumSmallJsonT)
  40205 
  40206   double r;
  40207   smallJsont *self = allocSmallJson();
  40208   smallJsont *r2;
  40209 
  40210   // non json array
  40211   ck_assert(getNumO(self, 0) == 0);
  40212   r2 = self->f->setInt(self, "1", 1);
  40213   ck_assert_ptr_ne(r2, null);
  40214   r2 = self->f->setDouble(self, "2", 2.2);
  40215   ck_assert_ptr_ne(r2, null);
  40216   r2 = self->f->setS(self, "3", "2");
  40217   ck_assert_ptr_ne(r2, null);
  40218   r = getNumO(self, "1");
  40219   ck_assert(r == 1);
  40220   r = getNumO(self, "2");
  40221   ck_assert(r == 2.2);
  40222   // not a number
  40223   r = getNumO(self, "3");
  40224   ck_assert(r == 0);
  40225   // path
  40226   createSmallArray(a);
  40227   createSmallDict(d);
  40228   a.f->pushDict(&a, &d);
  40229   self->f->setArray(self, "array", &a);
  40230   r2 = self->f->setInt(self, "\"array\"[0].\"key\"", 123);
  40231   ck_assert_ptr_ne(r2, null);
  40232   r = getNumO(self, "\"array\"[0].\"key\"");
  40233   ck_assert_int_eq(r, 123);
  40234   // json bool
  40235   freeO(self);
  40236   setTypeBoolO(self);
  40237   r = getNumO(self, "1");
  40238   ck_assert(r == 0);
  40239   // json array
  40240   freeO(self);
  40241   setTypeArrayO(self);
  40242   r = getNumO(self, "1");
  40243   ck_assert(r == 0);
  40244   // non existing dict path
  40245   freeO(self);
  40246   r = getNumO(self, "\"1\"[1]");
  40247   ck_assert(r == 0);
  40248   //   dict path but the object is an array
  40249   resetO(&a);
  40250   self->f->setArray(self, "1", &a);
  40251   r = getNumO(self, "\"1\".\"1\"");
  40252   ck_assert(r == 0);
  40253   //   dict object in path but the key doesn't exists
  40254   resetO(&d);
  40255   self->f->setDict(self, "2", &d);
  40256   r = getNumO(self, "\"2\".\"1\".[12]");
  40257   ck_assert(r == 0);
  40258   // null key
  40259   r = getNumO(self, null);
  40260   ck_assert(r == 0);
  40261 	// empty self
  40262   freeO(self);
  40263   r = getNumO(self, "1");
  40264   ck_assert(r == 0);
  40265   terminateO(self);
  40266 
  40267 END_TEST
  40268 
  40269 
  40270 START_TEST(getNumAtSmallJsonT)
  40271 
  40272   double r;
  40273   smallJsont *self = allocSmallJson();
  40274   smallJsont *r2;
  40275 
  40276   // non json array
  40277   ck_assert(!getNumAtO(self, 0));
  40278   // add elements to self
  40279   r2 = self->f->pushInt(self, 1);
  40280   ck_assert_ptr_ne(r2, null);
  40281   r2 = self->f->pushDouble(self, 2);
  40282   ck_assert_ptr_ne(r2, null);
  40283   r2 = self->f->pushInt(self, 3);
  40284   ck_assert_ptr_ne(r2, null);
  40285   r2 = self->f->pushInt(self, 4);
  40286   ck_assert_ptr_ne(r2, null);
  40287 
  40288   // positive index
  40289   r       = getNumAtO(self,1);
  40290   ck_assert(r==2);
  40291   char *s = toStringO(self);
  40292   ck_assert_str_eq(s, "[1,2.000000e+00,3,4]");
  40293   free(s);
  40294   // negative index
  40295   r = getNumAtO(self,-1);
  40296   ck_assert(r==4);
  40297   s = toStringO(self);
  40298   ck_assert_str_eq(s, "[1,2.000000e+00,3,4]");
  40299   free(s);
  40300   // wrong object type of another user class
  40301   //   User classes are stored in containers transparently
  40302   createAllocateSmallInt(ip);
  40303   ip->type = "anothertype";
  40304   setValG(ip, 11);
  40305   r2 = self->f->push(self, (baset*)ip);
  40306   ck_assert_ptr_ne(r2, null);
  40307   r = getNumAtO(self,-1);
  40308   ck_assert(!r);
  40309   s = toStringO(self);
  40310   ck_assert_str_eq(s, "[1,2.000000e+00,3,4,\"<data container>\"]");
  40311   free(s);
  40312   // index outside
  40313   ck_assert(!getNumAtO(self, 20));
  40314   ck_assert(!getNumAtO(self, -7));
  40315   // empty list
  40316   emptyO(self);
  40317   ck_assert(!getNumAtO(self, 0));
  40318   ck_assert(!getNumAtO(self, -1));
  40319   terminateO(self);
  40320 
  40321 END_TEST
  40322 
  40323 
  40324 START_TEST(delElemSmallJsonT)
  40325 
  40326   smallJsont* r;
  40327   smallJsont *self = allocG(rtSmallJsont);
  40328 
  40329   self->f->setBool(self, "lib", true);
  40330   // delete element
  40331   r = delElemO(self, "lib");
  40332   ck_assert_ptr_ne(r, null);
  40333   smallBoolt *oBool3 = (smallBoolt *)self->f->get(self, "lib");
  40334   ck_assert_ptr_eq(oBool3, NULL);
  40335   // path
  40336   baset *value = (baset*) allocSmallInt(2);
  40337   createSmallArray(a);
  40338   createSmallDict(d);
  40339   a.f->pushDict(&a, &d);
  40340   self->f->setArray(self, "array", &a);
  40341   r = self->f->set(self, "\"array\"[0].\"key\"", value);
  40342   ck_assert_ptr_ne(r, null);
  40343   finishO(value);
  40344   r = delElemO(self, "\"array\"[0].\"key\"");
  40345   ck_assert_ptr_ne(r, null);
  40346   // json bool
  40347   freeO(self);
  40348   setTypeBoolO(self);
  40349   r = delElemO(self, "1");
  40350   ck_assert_ptr_eq(r, null);
  40351   // json array
  40352   freeO(self);
  40353   setTypeArrayO(self);
  40354   r = delElemO(self, "1");
  40355   ck_assert_ptr_eq(r, null);
  40356   // non existing dict path
  40357   freeO(self);
  40358   r = delElemO(self, "\"1\"[1]");
  40359   ck_assert_ptr_eq(r, null);
  40360   //   dict path but the object is an array
  40361   resetO(&a);
  40362   self->f->setArray(self, "1", &a);
  40363   r = delElemO(self, "\"1\".\"1\"");
  40364   ck_assert_ptr_eq(r, null);
  40365   //   dict object in path but the key doesn't exists
  40366   resetO(&d);
  40367   self->f->setDict(self, "2", &d);
  40368   r = delElemO(self, "\"2\".\"1\".[12]");
  40369   ck_assert_ptr_eq(r, null);
  40370   // delete non existing element
  40371   r = delElemO(self, NULL);
  40372   ck_assert_ptr_eq(r, null);
  40373   r = delElemO(self, "non existing");
  40374   ck_assert_ptr_ne(r, null);
  40375   terminateO(self);
  40376 
  40377 END_TEST
  40378 
  40379 
  40380 START_TEST(delSmallJsonT)
  40381 
  40382   smallJsont* r;
  40383   smallJsont *self = allocG(rtSmallJsont);
  40384 
  40385   // json string
  40386   // empty string
  40387   setTopSO(self, "");
  40388   r = delO(self, 0,1);
  40389   ck_assert_ptr_eq(r, null);
  40390   // del
  40391   freeO(self);
  40392   setTopSO(self, "sheepy");
  40393   r = delO(self, 0,2);
  40394   ck_assert_ptr_ne(r, null);
  40395   char *s = toStringO(r);
  40396   ck_assert_str_eq(s, "eepy");
  40397   free(s);
  40398   // negative index
  40399   freeO(self);
  40400   setTopSO(self, "sheepy");
  40401   r = delO(self, -2,0);
  40402   ck_assert_ptr_ne(r, null);
  40403   s = toStringO(r);
  40404   ck_assert_str_eq(s, "shee");
  40405   free(s);
  40406   // positive and negative indexes
  40407   freeO(self);
  40408   setTopSO(self, "sheepy");
  40409   r = delO(self, 2,-2);
  40410   ck_assert_ptr_ne(r, null);
  40411   s = toStringO(r);
  40412   ck_assert_str_eq(s, "shpy");
  40413   free(s);
  40414   // start = end
  40415   freeO(self);
  40416   setTopSO(self, "sheepy");
  40417   r = delO(self, 2,-4);
  40418   ck_assert_ptr_ne(r, null);
  40419   s = toStringO(r);
  40420   ck_assert_str_eq(s, "sheepy");
  40421   free(s);
  40422   // delete entire string
  40423   freeO(self);
  40424   setTopSO(self, "sheepy");
  40425   r = delO(self, 0,0);
  40426   ck_assert_ptr_ne(r, null);
  40427   s = toStringO(r);
  40428   ck_assert_str_eq(s, "");
  40429   free(s);
  40430   // end of string
  40431   freeO(self);
  40432   setTopSO(self, "sheepy");
  40433   r = delO(self, 2,6);
  40434   ck_assert_ptr_ne(r, null);
  40435   s = toStringO(r);
  40436   ck_assert_str_eq(s, "sh");
  40437   free(s);
  40438   // NULL string
  40439   freeO(self);
  40440   r = delO(self, 2,-4);
  40441   ck_assert_ptr_eq(r, NULL);
  40442   // start outside string
  40443   freeO(self);
  40444   setTopSO(self, "sheepy");
  40445   r = delO(self, 20,-4);
  40446   ck_assert_ptr_eq(r, null);
  40447   s = toStringO(self);
  40448   ck_assert_str_eq(s, "sheepy");
  40449   free(s);
  40450   r = delO(self, -20,-4);
  40451   ck_assert_ptr_ne(r, null);
  40452   s = toStringO(r);
  40453   ck_assert_str_eq(s, "eepy");
  40454   free(s);
  40455   // end outside string
  40456   freeO(self);
  40457   setTopSO(self, "sheepy");
  40458   r = delO(self, 2,40);
  40459   ck_assert_ptr_ne(r, null);
  40460   s = toStringO(r);
  40461   ck_assert_str_eq(s, "sh");
  40462   free(s);
  40463   freeO(self);
  40464   setTopSO(self, "sheepy");
  40465   r = delO(self, 2,-40);
  40466   ck_assert_ptr_eq(r, null);
  40467   s = toStringO(self);
  40468   ck_assert_str_eq(s, "sheepy");
  40469   free(s);
  40470   // end before start
  40471   freeO(self);
  40472   setTopSO(self, "sheepy");
  40473   r = delO(self, 4,2);
  40474   ck_assert_ptr_eq(r, null);
  40475   s = toStringO(self);
  40476   ck_assert_str_eq(s, "sheepy");
  40477   free(s);
  40478   terminateO(self);
  40479   // json array
  40480   self = allocSmallJson();
  40481   self->f->pushUndefined(self);
  40482   self->f->pushInt(self, 123);
  40483   self->f->pushS(self, "sheepy");
  40484   self->f->pushInt(self, 5345);
  40485   // del
  40486   r = delO(self,1,-1);
  40487   ck_assert_ptr_ne(r, null);
  40488   s = toStringO(self);
  40489   ck_assert_str_eq(s, "[null,5345]");
  40490   free(s);
  40491   terminateO(self);
  40492     // start outside
  40493   self = allocSmallJson();
  40494   self->f->pushUndefined(self);
  40495   self->f->pushInt(self, 123);
  40496   self->f->pushS(self, "sheepy");
  40497   self->f->pushInt(self, 5345);
  40498   r = delO(self,20,-1);
  40499   ck_assert_ptr_eq(r, null);
  40500   s = toStringO(self);
  40501   ck_assert_str_eq(s, "[null,123,\"sheepy\",5345]");
  40502   free(s);
  40503   terminateO(self);
  40504     // start negative and outside
  40505   self = allocSmallJson();
  40506   self->f->pushUndefined(self);
  40507   self->f->pushInt(self, 123);
  40508   self->f->pushS(self, "sheepy");
  40509   self->f->pushInt(self, 5345);
  40510   r = delO(self,-20,1);
  40511   ck_assert_ptr_ne(r, null);
  40512   s = toStringO(self);
  40513   ck_assert_str_eq(s, "[123,\"sheepy\",5345]");
  40514   free(s);
  40515   terminateO(self);
  40516     // end outside
  40517   self = allocSmallJson();
  40518   self->f->pushUndefined(self);
  40519   self->f->pushInt(self, 123);
  40520   self->f->pushS(self, "sheepy");
  40521   self->f->pushInt(self, 5345);
  40522   r = delO(self,2,40);
  40523   ck_assert_ptr_ne(r, null);
  40524   s = toStringO(self);
  40525   ck_assert_str_eq(s, "[null,123]");
  40526   free(s);
  40527   terminateO(self);
  40528     // end negative and outside
  40529   self = allocSmallJson();
  40530   self->f->pushUndefined(self);
  40531   self->f->pushInt(self, 123);
  40532   self->f->pushS(self, "sheepy");
  40533   self->f->pushInt(self, 5345);
  40534   r = delO(self,2,-40);
  40535   ck_assert_ptr_eq(r, null);
  40536   s = toStringO(self);
  40537   ck_assert_str_eq(s, "[null,123,\"sheepy\",5345]");
  40538   free(s);
  40539   terminateO(self);
  40540     // end before start
  40541   self = allocSmallJson();
  40542   self->f->pushUndefined(self);
  40543   self->f->pushInt(self, 123);
  40544   self->f->pushS(self, "sheepy");
  40545   self->f->pushInt(self, 5345);
  40546   r = delO(self,3,2);
  40547   ck_assert_ptr_eq(r, null);
  40548   s = toStringO(self);
  40549   ck_assert_str_eq(s, "[null,123,\"sheepy\",5345]");
  40550   free(s);
  40551   terminateO(self);
  40552     // negative start last element
  40553   self = allocSmallJson();
  40554   self->f->pushUndefined(self);
  40555   self->f->pushInt(self, 123);
  40556   self->f->pushS(self, "sheepy");
  40557   self->f->pushInt(self, 5345);
  40558   r = delO(self,-1,0);
  40559   ck_assert_ptr_ne(r, null);
  40560   s = toStringO(self);
  40561   ck_assert_str_eq(s, "[null,123,\"sheepy\"]");
  40562   free(s);
  40563   terminateO(self);
  40564     // start = end
  40565   self = allocSmallJson();
  40566   self->f->pushUndefined(self);
  40567   self->f->pushInt(self, 123);
  40568   self->f->pushS(self, "sheepy");
  40569   self->f->pushInt(self, 5345);
  40570   r = delO(self,1,1);
  40571   ck_assert_ptr_ne(r, null);
  40572   s = toStringO(self);
  40573   ck_assert_str_eq(s, "[null,123,\"sheepy\",5345]");
  40574   free(s);
  40575   terminateO(self);
  40576     // empty list
  40577   self = allocSmallJson();
  40578   r = delO(self,0,0);
  40579   ck_assert_ptr_eq(r, null);
  40580   setTypeArrayO(self);
  40581   r = delO(self,0,0);
  40582   ck_assert_ptr_eq(r, null);
  40583   terminateO(self);
  40584 
  40585 END_TEST
  40586 
  40587 
  40588 START_TEST(delElemIndexSmallJsonT)
  40589 
  40590   smallJsont* r;
  40591   smallJsont *self = allocG(rtSmallJsont);
  40592 
  40593   // non json array
  40594   r = delElemIndexO(self, 0);
  40595   ck_assert_ptr_eq(r, null);
  40596   // json string
  40597   // del
  40598   freeO(self);
  40599   setTopSO(self, "sheepy");
  40600   r = delElemIndexO(self, 0);
  40601   ck_assert_ptr_ne(r, null);
  40602   char *s = toStringO(r);
  40603   ck_assert_str_eq(s, "heepy");
  40604   free(s);
  40605   freeO(self);
  40606   setTopSO(self, "sheepy");
  40607   r = delElemIndexO(self, 5);
  40608   ck_assert_ptr_ne(r, null);
  40609   s = toStringO(r);
  40610   ck_assert_str_eq(s, "sheep");
  40611   free(s);
  40612   // negative index
  40613   freeO(self);
  40614   setTopSO(self, "sheepy");
  40615   r = delElemIndexO(self, -1);
  40616   ck_assert_ptr_ne(r, null);
  40617   s = toStringO(r);
  40618   ck_assert_str_eq(s, "sheep");
  40619   free(s);
  40620   freeO(self);
  40621   setTopSO(self, "sheepy");
  40622   r = delElemIndexO(self, -6);
  40623   ck_assert_ptr_ne(r, null);
  40624   s = toStringO(r);
  40625   ck_assert_str_eq(s, "heepy");
  40626   free(s);
  40627   // index outside string
  40628   freeO(self);
  40629   setTopSO(self, "sheepy");
  40630   r = delElemIndexO(self, 6);
  40631   ck_assert_ptr_eq(r, null);
  40632   r = delElemIndexO(self, -7);
  40633   ck_assert_ptr_eq(r, null);
  40634   // empty string
  40635   freeO(self);
  40636   setTopSO(self, "");
  40637   ck_assert_ptr_eq(delElemIndexO(self, 0), null);
  40638   // null string
  40639   freeO(self);
  40640   ck_assert_ptr_eq(delElemIndexO(self, 0), null);
  40641   terminateO(self);
  40642   // json array
  40643   self = allocSmallJson();
  40644   setTypeArrayO(self);
  40645   // empty array
  40646   ck_assert_ptr_eq(delElemIndexO(self, 0), null);
  40647   // outside positive and negative
  40648   self->f->pushS(self, "");
  40649   ck_assert_ptr_eq(delElemIndexO(self, 1), null);
  40650   ck_assert_ptr_eq(delElemIndexO(self, -2), null);
  40651   // del
  40652   ck_assert_ptr_ne(delElemIndexO(self, -1), null);
  40653   s = toStringO(self);
  40654   ck_assert_str_eq(s, "[]");
  40655   free(s);
  40656   terminateO(self);
  40657 
  40658 END_TEST
  40659 
  40660 
  40661 START_TEST(removeElemSmallJsonT)
  40662 
  40663   smallJsont* r;
  40664   smallJsont *self = allocSmallJson();
  40665 
  40666   smallIntt *i = allocSmallInt(1);
  40667   r = self->f->setSmallInt(self, "1", i);
  40668   ck_assert_ptr_ne(r, null);
  40669   r = self->f->removeElem(self, "1");
  40670   ck_assert_ptr_ne(r, null);
  40671   terminateO(i);
  40672   char *s = toStringO(r);
  40673   ck_assert_str_eq(s, "{}");
  40674   free(s);
  40675   // path
  40676   baset *value = (baset*) allocSmallInt(2);
  40677   createSmallArray(a);
  40678   createSmallDict(d);
  40679   a.f->pushDict(&a, &d);
  40680   self->f->setArray(self, "array", &a);
  40681   r = self->f->set(self, "\"array\"[0].\"key\"", value);
  40682   ck_assert_ptr_ne(r, null);
  40683   r = self->f->removeElem(self, "\"array\"[0].\"key\"");
  40684   ck_assert_ptr_ne(r, null);
  40685   terminateO(value);
  40686   // json bool
  40687   freeO(self);
  40688   setTypeBoolO(self);
  40689   r = self->f->removeElem(self, "1");
  40690   ck_assert_ptr_eq(r, null);
  40691   // json array
  40692   freeO(self);
  40693   setTypeArrayO(self);
  40694   r = self->f->removeElem(self, "1");
  40695   ck_assert_ptr_eq(r, null);
  40696   // non existing dict path
  40697   freeO(self);
  40698   r = self->f->removeElem(self, "\"1\"[1]");
  40699   ck_assert_ptr_eq(r, null);
  40700   //   dict path but the object is an array
  40701   resetO(&a);
  40702   self->f->setArray(self, "1", &a);
  40703   r = self->f->removeElem(self, "\"1\".\"1\"");
  40704   ck_assert_ptr_eq(r, null);
  40705   //   dict object in path but the key doesn't exists
  40706   resetO(&d);
  40707   self->f->setDict(self, "2", &d);
  40708   r = self->f->removeElem(self, "\"2\".\"1\".[12]");
  40709   ck_assert_ptr_eq(r, null);
  40710   delElemO(self, "2");
  40711   // non existing key
  40712   r = self->f->removeElem(self, "1");
  40713   ck_assert_ptr_ne(r, null);
  40714   freeO(&a); // self->f->setArray(self, "1", &a) above allocates an sArray
  40715   s = toStringO(r);
  40716   ck_assert_str_eq(s, "{}");
  40717   free(s);
  40718   // null key
  40719   r = self->f->removeElem(self, null);
  40720   ck_assert_ptr_eq(r, null);
  40721 	// empty self
  40722   freeO(self);
  40723   r = self->f->removeElem(self, "qwe");
  40724   ck_assert_ptr_eq(r, null);
  40725   terminateO(self);
  40726 
  40727 END_TEST
  40728 
  40729 
  40730 START_TEST(removeSmallJsonT)
  40731 
  40732   smallJsont* r;
  40733   smallJsont *self = allocSmallJson();
  40734 
  40735   // non json array or string
  40736   ck_assert_ptr_eq(removeO(self, 0, 1), null);
  40737   // json string -> same code as delO json string
  40738   // empty string
  40739   setTopSO(self, "");
  40740   r = removeO(self, 0,1);
  40741   ck_assert_ptr_eq(r, null);
  40742   // del
  40743   freeO(self);
  40744   setTopSO(self, "sheepy");
  40745   r = removeO(self, 0,2);
  40746   ck_assert_ptr_ne(r, null);
  40747   char *s = toStringO(r);
  40748   ck_assert_str_eq(s, "eepy");
  40749   free(s);
  40750   // negative index
  40751   freeO(self);
  40752   setTopSO(self, "sheepy");
  40753   r = removeO(self, -2,0);
  40754   ck_assert_ptr_ne(r, null);
  40755   s = toStringO(r);
  40756   ck_assert_str_eq(s, "shee");
  40757   free(s);
  40758   // positive and negative indexes
  40759   freeO(self);
  40760   setTopSO(self, "sheepy");
  40761   r = removeO(self, 2,-2);
  40762   ck_assert_ptr_ne(r, null);
  40763   s = toStringO(r);
  40764   ck_assert_str_eq(s, "shpy");
  40765   free(s);
  40766   // start = end
  40767   freeO(self);
  40768   setTopSO(self, "sheepy");
  40769   r = removeO(self, 2,-4);
  40770   ck_assert_ptr_ne(r, null);
  40771   s = toStringO(r);
  40772   ck_assert_str_eq(s, "sheepy");
  40773   free(s);
  40774   // delete entire string
  40775   freeO(self);
  40776   setTopSO(self, "sheepy");
  40777   r = removeO(self, 0,0);
  40778   ck_assert_ptr_ne(r, null);
  40779   s = toStringO(r);
  40780   ck_assert_str_eq(s, "");
  40781   free(s);
  40782   // end of string
  40783   freeO(self);
  40784   setTopSO(self, "sheepy");
  40785   r = removeO(self, 2,6);
  40786   ck_assert_ptr_ne(r, null);
  40787   s = toStringO(r);
  40788   ck_assert_str_eq(s, "sh");
  40789   free(s);
  40790   // NULL string
  40791   freeO(self);
  40792   r = removeO(self, 2,-4);
  40793   ck_assert_ptr_eq(r, NULL);
  40794   // start outside string
  40795   freeO(self);
  40796   setTopSO(self, "sheepy");
  40797   r = removeO(self, 20,-4);
  40798   ck_assert_ptr_eq(r, null);
  40799   s = toStringO(self);
  40800   ck_assert_str_eq(s, "sheepy");
  40801   free(s);
  40802   r = removeO(self, -20,-4);
  40803   ck_assert_ptr_ne(r, null);
  40804   s = toStringO(r);
  40805   ck_assert_str_eq(s, "eepy");
  40806   free(s);
  40807   // end outside string
  40808   freeO(self);
  40809   setTopSO(self, "sheepy");
  40810   r = removeO(self, 2,40);
  40811   ck_assert_ptr_ne(r, null);
  40812   s = toStringO(r);
  40813   ck_assert_str_eq(s, "sh");
  40814   free(s);
  40815   freeO(self);
  40816   setTopSO(self, "sheepy");
  40817   r = removeO(self, 2,-40);
  40818   ck_assert_ptr_eq(r, null);
  40819   s = toStringO(self);
  40820   ck_assert_str_eq(s, "sheepy");
  40821   free(s);
  40822   // end before start
  40823   freeO(self);
  40824   setTopSO(self, "sheepy");
  40825   r = removeO(self, 4,2);
  40826   ck_assert_ptr_eq(r, null);
  40827   s = toStringO(self);
  40828   ck_assert_str_eq(s, "sheepy");
  40829   free(s);
  40830   terminateO(self);
  40831   // json array
  40832   self = allocSmallJson();
  40833   // add elements to self
  40834   r = self->f->pushInt(self, 1);
  40835   ck_assert_ptr_ne(r, null);
  40836   r = self->f->pushInt(self, 2);
  40837   ck_assert_ptr_ne(r, null);
  40838   r = self->f->pushInt(self, 3);
  40839   ck_assert_ptr_ne(r, null);
  40840   r = self->f->pushInt(self, 4);
  40841   ck_assert_ptr_ne(r, null);
  40842 
  40843   smallIntt *e[4];
  40844   arange(i,e) {
  40845     e[i] = self->f->getAtSmallInt(self, i);
  40846   }
  40847 
  40848   // negative index
  40849   r = removeO(self, 1, -1);
  40850   ck_assert_ptr_ne(r, null);
  40851   s = toStringO(self);
  40852   ck_assert_str_eq(s, "[1,4]");
  40853   free(s);
  40854   // start outside
  40855   ck_assert_ptr_eq(removeO(self, 20, -4), NULL);
  40856   // end outside
  40857   r = removeO(self, 0, 40);
  40858   ck_assert_ptr_ne(r, null);
  40859   s = toStringO(self);
  40860   ck_assert_str_eq(s, "[]");
  40861   free(s);
  40862   arange(i,e) {
  40863     terminateO(e[i]);
  40864   }
  40865   // end negative and outside
  40866   //   remove elements with NULL (set by removeO)
  40867   trimO(self);
  40868   //   add elements to self
  40869   r = self->f->pushInt(self, 1);
  40870   ck_assert_ptr_ne(r, null);
  40871   r = self->f->pushInt(self, 2);
  40872   ck_assert_ptr_ne(r, null);
  40873   r = self->f->pushInt(self, 3);
  40874   ck_assert_ptr_ne(r, null);
  40875   r = self->f->pushInt(self, 4);
  40876   ck_assert_ptr_ne(r, null);
  40877   arange(i,e) {
  40878     e[i] = self->f->getAtSmallInt(self, i);
  40879   }
  40880   ck_assert_ptr_eq(removeO(self, 2, -40), NULL);
  40881   s = toStringO(self);
  40882   ck_assert_str_eq(s, "[1,2,3,4]");
  40883   free(s);
  40884   // end before start
  40885   ck_assert_ptr_eq(removeO(self, 3, 2), NULL);
  40886   s = toStringO(self);
  40887   ck_assert_str_eq(s, "[1,2,3,4]");
  40888   free(s);
  40889   // negative start last element
  40890   r = removeO(self, -1, 0);
  40891   ck_assert_ptr_ne(r, null);
  40892   s = toStringO(self);
  40893   ck_assert_str_eq(s, "[1,2,3]");
  40894   free(s);
  40895   // negative start and outside
  40896   r = removeO(self, -10, 1);
  40897   ck_assert_ptr_ne(r, null);
  40898   s = toStringO(self);
  40899   ck_assert_str_eq(s, "[2,3]");
  40900   free(s);
  40901   // start = end
  40902   r = removeO(self, 1, 1);
  40903   ck_assert_ptr_ne(r, null);
  40904   s = toStringO(self);
  40905   ck_assert_str_eq(s, "[2,3]");
  40906   free(s);
  40907   // remove all
  40908   r = removeO(self, 0, 0);
  40909   ck_assert_ptr_ne(r, null);
  40910   s = toStringO(self);
  40911   ck_assert_str_eq(s, "[]");
  40912   free(s);
  40913   arange(i,e) {
  40914     terminateO(e[i]);
  40915   }
  40916   // empty list
  40917   emptyO(self);
  40918   ck_assert_ptr_eq(removeO(self, 0, 0), NULL);
  40919   ck_assert_ptr_eq(removeO(self, -1, 0), NULL);
  40920   terminateO(self);
  40921 
  40922 END_TEST
  40923 
  40924 
  40925 START_TEST(removeElemIndexSmallJsonT)
  40926 
  40927   smallJsont* r;
  40928   smallJsont *self = allocSmallJson();
  40929 
  40930   // non json array
  40931   r = removeElemIndexO(self, 0);
  40932   ck_assert_ptr_eq(r, null);
  40933   // json string
  40934   // del
  40935   freeO(self);
  40936   setTopSO(self, "sheepy");
  40937   r = removeElemIndexO(self, 0);
  40938   ck_assert_ptr_ne(r, null);
  40939   char *s = toStringO(r);
  40940   ck_assert_str_eq(s, "heepy");
  40941   free(s);
  40942   freeO(self);
  40943   setTopSO(self, "sheepy");
  40944   r = removeElemIndexO(self, 5);
  40945   ck_assert_ptr_ne(r, null);
  40946   s = toStringO(r);
  40947   ck_assert_str_eq(s, "sheep");
  40948   free(s);
  40949   // negative index
  40950   freeO(self);
  40951   setTopSO(self, "sheepy");
  40952   r = removeElemIndexO(self, -1);
  40953   ck_assert_ptr_ne(r, null);
  40954   s = toStringO(r);
  40955   ck_assert_str_eq(s, "sheep");
  40956   free(s);
  40957   freeO(self);
  40958   setTopSO(self, "sheepy");
  40959   r = removeElemIndexO(self, -6);
  40960   ck_assert_ptr_ne(r, null);
  40961   s = toStringO(r);
  40962   ck_assert_str_eq(s, "heepy");
  40963   free(s);
  40964   // index outside string
  40965   freeO(self);
  40966   setTopSO(self, "sheepy");
  40967   r = removeElemIndexO(self, 6);
  40968   ck_assert_ptr_eq(r, null);
  40969   r = removeElemIndexO(self, -7);
  40970   ck_assert_ptr_eq(r, null);
  40971   // empty string
  40972   freeO(self);
  40973   setTopSO(self, "");
  40974   ck_assert_ptr_eq(removeElemIndexO(self, 0), null);
  40975   // null string
  40976   freeO(self);
  40977   ck_assert_ptr_eq(removeElemIndexO(self, 0), null);
  40978   terminateO(self);
  40979   // json array
  40980   self = allocSmallJson();
  40981   // add elements to self
  40982   r = self->f->pushInt(self, 1);
  40983   ck_assert_ptr_ne(r, null);
  40984   r = self->f->pushInt(self, 2);
  40985   ck_assert_ptr_ne(r, null);
  40986   r = self->f->pushInt(self, 3);
  40987   ck_assert_ptr_ne(r, null);
  40988   r = self->f->pushInt(self, 4);
  40989   ck_assert_ptr_ne(r, null);
  40990 
  40991   smallIntt *e[2];
  40992   e[0] = self->f->getAtSmallInt(self, 1);
  40993   e[1] = self->f->getAtSmallInt(self, 3);
  40994 
  40995   // positive index
  40996   r       = removeElemIndexO(self,1);
  40997   ck_assert_ptr_ne(r, null);
  40998   s = toStringO(self);
  40999   ck_assert_str_eq(s, "[1,3,4]");
  41000   free(s);
  41001   // negative index
  41002   r = removeElemIndexO(self,-1);
  41003   ck_assert_ptr_ne(r, null);
  41004   s = toStringO(self);
  41005   ck_assert_str_eq(s, "[1,3]");
  41006   free(s);
  41007   terminateO(e[0]);
  41008   terminateO(e[1]);
  41009   // index outside
  41010   ck_assert_ptr_eq(removeElemIndexO(self, 20), NULL);
  41011   ck_assert_ptr_eq(removeElemIndexO(self, -5), NULL);
  41012   // empty list
  41013   emptyO(self);
  41014   ck_assert_ptr_eq(removeElemIndexO(self, 0), NULL);
  41015   ck_assert_ptr_eq(removeElemIndexO(self, -1), NULL);
  41016   terminateO(self);
  41017 
  41018 END_TEST
  41019 
  41020 
  41021 START_TEST(stringifySmallStringSmallJsonT)
  41022 
  41023   smallStringt* r;
  41024   smallJsont *self = allocG(rtSmallJsont);
  41025 
  41026   // stringifySmallJson is tested in cSmallJsonT
  41027   // this test checks the parts not tested in cSmallJsonT
  41028   // json dict
  41029   self->f->setS(self, "\\\\", "\\erw\\\"");
  41030   r = stringifySmallStringO(self, 2);
  41031   ck_assert_ptr_ne(r, null);
  41032   char *s = toStringO(r);
  41033   terminateO(r);
  41034   ck_assert_str_eq(s, "{\n  \"\\\\\": \"\\\\erw\\\\\\\"\"\n}\n");
  41035   free(s);
  41036   // json array
  41037   freeO(self);
  41038   self->f->pushS(self, "\\\\ewq\\\"");
  41039   r = stringifySmallStringO(self, 2);
  41040   ck_assert_ptr_ne(r, null);
  41041   s = toStringO(r);
  41042   terminateO(r);
  41043   ck_assert_str_eq(s, "[\n  \"\\\\\\\\ewq\\\\\\\"\"\n]\n");
  41044   free(s);
  41045   terminateO(self);
  41046 
  41047 END_TEST
  41048 
  41049 
  41050 START_TEST(toYMLSmallStringSmallJsonT)
  41051 
  41052   smallStringt* r;
  41053   smallJsont *self = allocG(rtSmallJsont);
  41054 
  41055   self->f->pushS(self, "qwe");
  41056   r = toYMLSmallStringO(self, 2);
  41057   ck_assert_ptr_ne(r, null);
  41058   char *s = toStringO(r);
  41059   ck_assert_str_eq(s, "---\n  - qwe\n");
  41060   free(s);
  41061   terminateO(r);
  41062   // blank and empty keys should have quotes
  41063   freeO(self);
  41064   self->f->setS(self, "", "empty");
  41065   self->f->setS(self, "  ", "blank");
  41066   r = toYMLSmallStringO(self, 2);
  41067   ck_assert_ptr_ne(r, null);
  41068   s = toStringO(r);
  41069   ck_assert_str_eq(s, "---\n  \"\": empty\n  \"  \": blank\n");
  41070   free(s);
  41071   terminateO(r);
  41072   terminateO(self);
  41073 
  41074 END_TEST
  41075 
  41076 
  41077 START_TEST(parseSmallJsonSmallJsonT)
  41078 
  41079   bool r;
  41080   smallJsont *self  = allocG(rtSmallJsont);
  41081   smallJsont *input = allocSmallJson();
  41082 
  41083   // non json string
  41084   r = self->f->parseSmallJson(self, input);
  41085   ck_assert(!r);
  41086   // json string
  41087   setTopSO(input, "true");
  41088   r = self->f->parseSmallJson(self, input);
  41089   ck_assert(r);
  41090   terminateO(input);
  41091   char *s = toStringO(self);
  41092   ck_assert_str_eq(s, "true");
  41093   free(s);
  41094   // non json object
  41095   input = (smallJsont*) allocSmallInt(123);
  41096   r = self->f->parseSmallJson(self, input);
  41097   ck_assert(!r);
  41098   terminateO(input);
  41099   // null
  41100   r = self->f->parseSmallJson(self, null);
  41101   ck_assert(!r);
  41102   terminateO(self);
  41103 
  41104 END_TEST
  41105 
  41106 
  41107 START_TEST(parseSmallStringSmallJsonT)
  41108 
  41109   bool r;
  41110   smallJsont *self    = allocG(rtSmallJsont);
  41111   smallStringt *input = allocSmallString("true");
  41112 
  41113   // string
  41114   r = self->f->parseSmallString(self, input);
  41115   ck_assert(r);
  41116   terminateO(input);
  41117   char *s = toStringO(self);
  41118   ck_assert_str_eq(s, "true");
  41119   free(s);
  41120   // non smallString object
  41121   input = (smallStringt*) allocSmallInt(123);
  41122   r = self->f->parseSmallString(self, input);
  41123   ck_assert(!r);
  41124   terminateO(input);
  41125   // null
  41126   r = self->f->parseSmallString(self, null);
  41127   ck_assert(!r);
  41128   terminateO(self);
  41129 
  41130 END_TEST
  41131 
  41132 
  41133 START_TEST(parseYMLSmallJsonSmallJsonT)
  41134 
  41135   bool r;
  41136   smallJsont *self = allocG(rtSmallJsont);
  41137   smallJsont *input = allocSmallJson();
  41138 
  41139   // non json string
  41140   r = self->f->parseYMLSmallJson(self, input);
  41141   ck_assert(!r);
  41142   // json string
  41143   setTopSO(input, "---\n - qwe");
  41144   r = self->f->parseYMLSmallJson(self, input);
  41145   ck_assert(r);
  41146   terminateO(input);
  41147   char *s = toStringO(self);
  41148   ck_assert_str_eq(s, "[\"qwe\"]");
  41149   free(s);
  41150   // non json object
  41151   input = (smallJsont*) allocSmallInt(123);
  41152   r = self->f->parseYMLSmallJson(self, input);
  41153   ck_assert(!r);
  41154   terminateO(input);
  41155   // null
  41156   r = self->f->parseYMLSmallJson(self, null);
  41157   ck_assert(!r);
  41158   terminateO(self);
  41159 
  41160 END_TEST
  41161 
  41162 
  41163 START_TEST(parseYMLSmallStringSmallJsonT)
  41164 
  41165   bool r;
  41166   smallJsont *self = allocG(rtSmallJsont);
  41167   smallStringt *input = allocSmallString("---\n - qwe");
  41168 
  41169   // string
  41170   r = self->f->parseYMLSmallString(self, input);
  41171   ck_assert(r);
  41172   terminateO(input);
  41173   char *s = toStringO(self);
  41174   ck_assert_str_eq(s, "[\"qwe\"]");
  41175   free(s);
  41176   // non smallString object
  41177   input = (smallStringt*) allocSmallInt(123);
  41178   r = self->f->parseYMLSmallString(self, input);
  41179   ck_assert(!r);
  41180   terminateO(input);
  41181   // null
  41182   r = self->f->parseYMLSmallString(self, null);
  41183   ck_assert(!r);
  41184   terminateO(self);
  41185 
  41186 END_TEST
  41187 
  41188 
  41189 START_TEST(logSmallJsonT)
  41190 
  41191   smallJsont *self = allocSmallJson();
  41192 
  41193   // only prints to stdout
  41194   logO(self);
  41195   terminateO(self);
  41196 
  41197 END_TEST
  41198 
  41199 
  41200 START_TEST(readFileSmallJsonT)
  41201 
  41202   smallJsont *self = allocG(rtSmallJsont);
  41203 
  41204   self->f->setS(self, "key", "value");
  41205   writeFileO(self, "read.JSON");
  41206   writeFileO(self, "read.YML");
  41207   writeFileO(self, "read.BIN");
  41208   // read files
  41209   freeO(self);
  41210   ck_assert_ptr_ne(readFileO(self, "read.JSON"), null);
  41211   char *s = toStringO(self);
  41212   ck_assert_str_eq(s, "{\"key\":\"value\"}");
  41213   free(s);
  41214   freeO(self);
  41215   ck_assert_ptr_ne(readFileO(self, "read.YML"), null);
  41216   s = toStringO(self);
  41217   ck_assert_str_eq(s, "{\"key\":\"value\"}");
  41218   free(s);
  41219   freeO(self);
  41220   ck_assert_ptr_ne(readFileO(self, "read.BIN"), null);
  41221   s = toStringO(self);
  41222   ck_assert_str_eq(s, "{\"key\":\"value\"}");
  41223   free(s);
  41224   freeO(self);
  41225   rmAll("read.JSON");
  41226   rmAll("read.YML");
  41227   rmAll("read.BIN");
  41228   // non existing files
  41229   ck_assert_ptr_eq(readFileO(self, "nonexisting.json"), null);
  41230   ck_assert_ptr_eq(readFileO(self, "nonexisting.Yml"), null);
  41231   ck_assert_ptr_eq(readFileO(self, "nonexisting.Bin"), null);
  41232   // invalid extension, not json, yml or bin
  41233   ck_assert_ptr_eq(readFileO(self, "libsheepyCSmallArray.h"), null);
  41234   // null filename
  41235   ck_assert_ptr_eq(readFileO(self, null), null);
  41236   terminateO(self);
  41237 
  41238 END_TEST
  41239 
  41240 
  41241 START_TEST(readFileSmallStringSmallJsonT)
  41242 
  41243   smallJsont *self       = allocG(rtSmallJsont);
  41244   smallStringt *filePath = allocSmallString("read.json");
  41245 
  41246   self->f->setS(self, "key", "value");
  41247   writeFileO(self, "read.json");
  41248   freeO(self);
  41249   ck_assert_ptr_ne(self->f->readFileSmallString(self, filePath), null);
  41250   char *s = toStringO(self);
  41251   ck_assert_str_eq(s, "{\"key\":\"value\"}");
  41252   free(s);
  41253   freeO(self);
  41254   rmAll("read.json");
  41255   // non smallString object
  41256   terminateO(filePath);
  41257   filePath = (smallStringt*) allocSmallInt(123);
  41258   ck_assert_ptr_eq(self->f->readFileSmallString(self, filePath), null);
  41259   terminateO(filePath);
  41260   // null path
  41261   ck_assert_ptr_eq(self->f->readFileSmallString(self, null), null);
  41262   terminateO(self);
  41263 
  41264 END_TEST
  41265 
  41266 
  41267 START_TEST(readFileJsonSmallJsonT)
  41268 
  41269   smallJsont *self     = allocG(rtSmallJsont);
  41270   smallJsont *filePath = allocSmallJson();
  41271 
  41272   setTopSO(filePath, "read.json");
  41273   self->f->setS(self, "key", "value");
  41274   writeFileO(self, "read.json");
  41275   freeO(self);
  41276   ck_assert_ptr_ne(readFileJsonO(self, filePath), null);
  41277   char *s = toStringO(self);
  41278   ck_assert_str_eq(s, "{\"key\":\"value\"}");
  41279   free(s);
  41280   freeO(self);
  41281   rmAll("read.json");
  41282   // non json string
  41283   freeO(filePath);
  41284   setTypeBoolO(filePath);
  41285   ck_assert_ptr_eq(readFileJsonO(self, filePath), null);
  41286   // non smallJson object
  41287   terminateO(filePath);
  41288   filePath = (smallJsont*) allocSmallInt(123);
  41289   ck_assert_ptr_eq(readFileJsonO(self, filePath), null);
  41290   terminateO(filePath);
  41291   // null path
  41292   ck_assert_ptr_eq(readFileJsonO(self, null), null);
  41293   terminateO(self);
  41294 
  41295 END_TEST
  41296 
  41297 
  41298 START_TEST(readStreamSmallJsonT)
  41299 
  41300   smallJsont* r;
  41301   smallJsont *self = allocSmallJson();
  41302   FILE *fp;
  41303 
  41304   // stream
  41305   fp = fopen("file.json", "r");
  41306   r = readStreamO(self, fp);
  41307   fclose(fp);
  41308   ck_assert_ptr_ne(r, NULL);
  41309   char *s = toStringO(r);
  41310   ck_assert_str_eq(s, "{\"dasd\":\"asd\",\"asd\":234,\"dict\":{\"array\":[1,1],\"asd\":true,\"float\":3.434000e+01},\"bool\":false,\"zzz\":null}");
  41311   free(s);
  41312   // empty stream, error because it is not valid json
  41313   emptyO(self);
  41314   fp = fopen("../chmodTest.null", "r");
  41315   r = readStreamO(self, fp);
  41316   fclose(fp);
  41317   ck_assert_ptr_eq(r, NULL);
  41318   ck_assert(isEmptyO(self));
  41319   // NULL stream
  41320   ck_assert_ptr_eq(readStreamO(self, NULL), NULL);
  41321   terminateO(self);
  41322 
  41323 END_TEST
  41324 
  41325 
  41326 START_TEST(writeFileSmallJsonT)
  41327 
  41328   bool r;
  41329   smallJsont *self = allocSmallJson();
  41330 
  41331   self->f->setInt(self, "", 1);
  41332   self->f->setInt(self, "b", 2);
  41333   r = writeFileO(self, "smallDictFile.json");
  41334   ck_assert(r);
  41335   ck_assert(fileExists("smallDictFile.json"));
  41336   char *s = readFileToS("smallDictFile.json");
  41337   ck_assert_str_eq(s, "{\n  \"\": 1,\n  \"b\": 2\n}\n");
  41338   free(s);
  41339   rmAll("smallDictFile.json");
  41340   r = writeFileO(self, "smallDictFile.yml");
  41341   ck_assert(r);
  41342   ck_assert(fileExists("smallDictFile.yml"));
  41343   freeO(self);
  41344   ck_assert_ptr_ne(readFileO(self, "smallDictFile.yml"), null);
  41345   s = toStringO(self);
  41346   ck_assert_str_eq(s, "{\"\":1,\"b\":2}");
  41347   free(s);
  41348   rmAll("smallDictFile.yml");
  41349   r = writeFileO(self, "smallDictFile.bin");
  41350   ck_assert(r);
  41351   ck_assert(fileExists("smallDictFile.bin"));
  41352   freeO(self);
  41353   readFileO(self, "smallDictFile.bin");
  41354   s = toStringO(self);
  41355   ck_assert_str_eq(s, "{\"\":1,\"b\":2}");
  41356   free(s);
  41357   rmAll("smallDictFile.bin");
  41358   // write readonly path
  41359   ck_assert(!writeFileO(self, "/readOnlyFileTest.bin"));
  41360   // blank file path
  41361   r = writeFileO(self, "   ");
  41362   ck_assert(!r);
  41363   // null file path
  41364   r = writeFileO(self, null);
  41365   ck_assert(!r);
  41366   terminateO(self);
  41367 
  41368 END_TEST
  41369 
  41370 
  41371 START_TEST(writeFileSmallStringSmallJsonT)
  41372 
  41373   bool r;
  41374   smallJsont *self       = allocSmallJson();
  41375   smallStringt *filePath = allocSmallString("smallDictFile.json");
  41376 
  41377   self->f->setInt(self, "", 1);
  41378   self->f->setInt(self, "b", 2);
  41379   r = self->f->writeFileSmallString(self, filePath);
  41380   ck_assert(r);
  41381   ck_assert(fileExists("smallDictFile.json"));
  41382   char *s = readFileToS("smallDictFile.json");
  41383   ck_assert_str_eq(s, "{\n  \"\": 1,\n  \"b\": 2\n}\n");
  41384   free(s);
  41385   rmAll("smallDictFile.json");
  41386   // blank path
  41387   setValO(filePath, "   ");
  41388   r = self->f->writeFileSmallString(self, filePath);
  41389   ck_assert(!r);
  41390   // non smallString object
  41391   terminateO(filePath);
  41392   filePath = (smallStringt*) allocSmallInt(2);
  41393   r = self->f->writeFileSmallString(self, filePath);
  41394   ck_assert(!r);
  41395   // null path
  41396   r = self->f->writeFileSmallString(self, null);
  41397   ck_assert(!r);
  41398   terminateO(filePath);
  41399   terminateO(self);
  41400 
  41401 END_TEST
  41402 
  41403 
  41404 START_TEST(writeFileJsonSmallJsonT)
  41405 
  41406   bool r;
  41407   smallJsont *self     = allocSmallJson();
  41408   smallJsont *filePath = allocSmallJson();
  41409 
  41410   self->f->setInt(self, "", 1);
  41411   self->f->setInt(self, "b", 2);
  41412   setTopSO(filePath, "smallDictFile.json");
  41413   r = self->f->writeFileJson(self, filePath);
  41414   ck_assert(r);
  41415   ck_assert(fileExists("smallDictFile.json"));
  41416   char *s = readFileToS("smallDictFile.json");
  41417   ck_assert_str_eq(s, "{\n  \"\": 1,\n  \"b\": 2\n}\n");
  41418   free(s);
  41419   rmAll("smallDictFile.json");
  41420   // blank path
  41421   freeO(filePath);
  41422   setTopSO(filePath, "   ");
  41423   r = self->f->writeFileJson(self, filePath);
  41424   ck_assert(!r);
  41425   // non json string
  41426   freeO(filePath);
  41427   setTopIntO(filePath, 2);
  41428   r = self->f->writeFileJson(self, filePath);
  41429   ck_assert(!r);
  41430   // non json object
  41431   terminateO(filePath);
  41432   filePath = (smallJsont*) allocSmallInt(2);
  41433   r = self->f->writeFileJson(self, filePath);
  41434   ck_assert(!r);
  41435   // null path
  41436   r = self->f->writeFileJson(self, null);
  41437   ck_assert(!r);
  41438   terminateO(filePath);
  41439   terminateO(self);
  41440 
  41441 END_TEST
  41442 
  41443 
  41444 START_TEST(writeStreamSmallJsonT)
  41445 
  41446   bool r;
  41447   smallJsont *self = allocSmallJson();
  41448   FILE *fp;
  41449 
  41450   // write textOutTest.null
  41451   fp = fopen("file.json", "r");
  41452   smallJsont *r2 = readStreamO(self, fp);
  41453   fclose(fp);
  41454   ck_assert_ptr_ne(r2, NULL);
  41455   fp = fopen("outTest.json", "w");
  41456   r = writeStreamO(self, fp);
  41457   ck_assert(r);
  41458   fclose(fp);
  41459     // check textOutTest.null
  41460   fp = fopen("outTest.json", "r");
  41461   r2 = readStreamO(self, fp);
  41462   fclose(fp);
  41463   ck_assert_ptr_ne(r2, NULL);
  41464   char *s = toStringO(r2);
  41465   ck_assert_str_eq(s, "{\"dasd\":\"asd\",\"asd\":234,\"dict\":{\"array\":[1,1],\"asd\":true,\"float\":3.434000e+01},\"bool\":false,\"zzz\":null}");
  41466   free(s);
  41467   // wrong stream: read instead of write
  41468   fp = fopen("outTest.json", "r");
  41469   ck_assert(!writeStreamO(self, fp));
  41470   fclose(fp);
  41471   // null stream
  41472   ck_assert(!writeStreamO(self, null));
  41473   rmAll("outTest.json");
  41474   terminateO(self);
  41475 
  41476 END_TEST
  41477 
  41478 
  41479 START_TEST(appendFileSmallJsonT)
  41480 
  41481   bool r;
  41482   smallJsont *self = allocSmallJson();
  41483 
  41484   self->f->setInt(self, "", 1);
  41485   self->f->setInt(self, "b", 2);
  41486   // append json
  41487   writeFileS("smallDictFile.json", "-");
  41488   r = appendFileO(self, "smallDictFile.json");
  41489   ck_assert(r);
  41490   ck_assert(fileExists("smallDictFile.json"));
  41491   char *s = readFileToS("smallDictFile.json");
  41492   ck_assert_str_eq(s, "-{\n  \"\": 1,\n  \"b\": 2\n}\n");
  41493   free(s);
  41494   rmAll("smallDictFile.json");
  41495   // append yml
  41496   writeFileS("smallDictFile.yml", "-");
  41497   r = appendFileO(self, "smallDictFile.yml");
  41498   ck_assert(r);
  41499   ck_assert(fileExists("smallDictFile.yml"));
  41500   s = readFileToS("smallDictFile.yml");
  41501   ck_assert_str_eq(s, "----\n  \"\": 1\n  b: 2\n");
  41502   free(s);
  41503   rmAll("smallDictFile.yml");
  41504   // append json string
  41505   writeFileS("smallDictFile", "-");
  41506   freeO(self);
  41507   setTopSO(self, "qwe");
  41508   r = appendFileO(self, "smallDictFile");
  41509   ck_assert(r);
  41510   ck_assert(fileExists("smallDictFile"));
  41511   s = readFileToS("smallDictFile");
  41512   ck_assert_str_eq(s, "-qwe");
  41513   free(s);
  41514   rmAll("smallDictFile");
  41515   // append json array
  41516   writeFileS("smallDictFile", "-");
  41517   freeO(self);
  41518   self->f->pushS(self, "qwe");
  41519   self->f->pushS(self, "asd");
  41520   r = appendFileO(self, "smallDictFile");
  41521   ck_assert(r);
  41522   ck_assert(fileExists("smallDictFile"));
  41523   s = readFileToS("smallDictFile");
  41524   ck_assert_str_eq(s, "-qwe\nasd\n");
  41525   free(s);
  41526   rmAll("smallDictFile");
  41527   // read only path
  41528   r = appendFileO(self, "/readOnlyAppend");
  41529   ck_assert(!r);
  41530   // append json int should not work
  41531   // blank file path
  41532   r = appendFileO(self, "   ");
  41533   ck_assert(!r);
  41534   // null file path
  41535   r = appendFileO(self, null);
  41536   ck_assert(!r);
  41537   terminateO(self);
  41538 
  41539 END_TEST
  41540 
  41541 
  41542 START_TEST(appendFileSmallStringSmallJsonT)
  41543 
  41544   bool r;
  41545   smallJsont *self       = allocSmallJson();
  41546   smallStringt *filePath = allocSmallString("smallDictFile.json");
  41547 
  41548   self->f->setInt(self, "", 1);
  41549   self->f->setInt(self, "b", 2);
  41550   writeFileS("smallDictFile.json", "-");
  41551   r = self->f->appendFileSmallString(self, filePath);
  41552   ck_assert(r);
  41553   ck_assert(fileExists("smallDictFile.json"));
  41554   char *s = readFileToS("smallDictFile.json");
  41555   ck_assert_str_eq(s, "-{\n  \"\": 1,\n  \"b\": 2\n}\n");
  41556   free(s);
  41557   rmAll("smallDictFile.json");
  41558   // blank path
  41559   setValO(filePath, "   ");
  41560   r = self->f->appendFileSmallString(self, filePath);
  41561   ck_assert(!r);
  41562   // non smallString object
  41563   terminateO(filePath);
  41564   filePath = (smallStringt*) allocSmallInt(2);
  41565   r = self->f->appendFileSmallString(self, filePath);
  41566   ck_assert(!r);
  41567   // null path
  41568   r = self->f->appendFileSmallString(self, null);
  41569   ck_assert(!r);
  41570   terminateO(filePath);
  41571   terminateO(self);
  41572 
  41573 END_TEST
  41574 
  41575 
  41576 START_TEST(appendFileJsonSmallJsonT)
  41577 
  41578   int r;
  41579   smallJsont *self     = allocG(rtSmallJsont);
  41580   smallJsont *filePath = allocSmallJson();
  41581 
  41582   setTopSO(filePath, "smallDictFile.json");
  41583   self->f->setInt(self, "", 1);
  41584   self->f->setInt(self, "b", 2);
  41585   writeFileS("smallDictFile.json", "-");
  41586   r = appendFileJsonO(self, filePath);
  41587   ck_assert(r);
  41588   ck_assert(fileExists("smallDictFile.json"));
  41589   char *s = readFileToS("smallDictFile.json");
  41590   ck_assert_str_eq(s, "-{\n  \"\": 1,\n  \"b\": 2\n}\n");
  41591   free(s);
  41592   rmAll("smallDictFile.json");
  41593   // blank path
  41594   freeO(filePath);
  41595   setTopSO(filePath, "   ");
  41596   r = appendFileJsonO(self, filePath);
  41597   ck_assert(!r);
  41598   // non smallJson object
  41599   terminateO(filePath);
  41600   filePath = (smallJsont*) allocSmallInt(2);
  41601   r = appendFileJsonO(self, filePath);
  41602   ck_assert(!r);
  41603   // null path
  41604   r = appendFileJsonO(self, null);
  41605   ck_assert(!r);
  41606   terminateO(filePath);
  41607   terminateO(self);
  41608 
  41609 END_TEST
  41610 
  41611 
  41612 START_TEST(readTextSmallJsonT)
  41613 
  41614   smallJsont* r;
  41615   smallJsont *self = allocSmallJson();
  41616 
  41617   // text
  41618   r = readTextO(self, "../textTest.null");
  41619   ck_assert_ptr_ne(r, NULL);
  41620   char *s = toStringO(r);
  41621   ck_assert_str_eq(s, "[\"LINE 1\",\"ANOTHER line\"]");
  41622   free(s);
  41623   // non empty and non json array
  41624   freeO(self);
  41625   setTypeIntO(self);
  41626   r = readTextO(self, "../textTest.null");
  41627   ck_assert_ptr_eq(r, NULL);
  41628   // empty text
  41629   setTypeArrayO(self);
  41630   emptyO(self);
  41631   r = readTextO(self, "../chmodTest.null");
  41632   ck_assert_ptr_ne(r, NULL);
  41633   ck_assert(isEmptyO(self));
  41634   // NULL path
  41635   r = readTextO(self, NULL);
  41636   ck_assert_ptr_eq(r, NULL);
  41637   // non existing path
  41638   if (fileExists("../nonExistingFile"))
  41639     rmAll("../nonExistingFile");
  41640   r = readTextO(self, "../nonExistingFile");
  41641   ck_assert_ptr_eq(r, NULL);
  41642   terminateO(self);
  41643 
  41644 END_TEST
  41645 
  41646 
  41647 START_TEST(readTextSmallStringSmallJsonT)
  41648 
  41649   smallJsont* r;
  41650   smallJsont *self       = allocSmallJson();
  41651   smallStringt *filePath = allocSmallString("");
  41652 
  41653   // text
  41654   setValO(filePath, "../textTest.null");
  41655   r = readTextSmallStringO(self, filePath);
  41656   ck_assert_ptr_ne(r, NULL);
  41657   char *s = toStringO(r);
  41658   ck_assert_str_eq(s, "[\"LINE 1\",\"ANOTHER line\"]");
  41659   free(s);
  41660   // empty text
  41661   emptyO(self);
  41662   setValO(filePath, "../chmodTest.null");
  41663   r = readTextSmallStringO(self, filePath);
  41664   ck_assert_ptr_ne(r, NULL);
  41665   ck_assert(isEmptyO(self));
  41666   // NULL path
  41667   r = readTextSmallStringO(self, NULL);
  41668   ck_assert_ptr_eq(r, NULL);
  41669   // non existing path
  41670   if (fileExists("../nonExistingFile"))
  41671     rmAll("../nonExistingFile");
  41672   setValO(filePath, "../nonExistingFile");
  41673   r = readTextSmallStringO(self, filePath);
  41674   ck_assert_ptr_eq(r, NULL);
  41675   // blank file path
  41676   setValO(filePath, "  ");
  41677   r = readTextSmallStringO(self, filePath);
  41678   ck_assert_ptr_eq(r, NULL);
  41679   // non smallString object
  41680   terminateO(filePath);
  41681   filePath = (smallStringt*) allocSmallInt(2);
  41682   r = readTextSmallStringO(self, filePath);
  41683   ck_assert_ptr_eq(r, NULL);
  41684   terminateO(self);
  41685   terminateO(filePath);
  41686 
  41687 END_TEST
  41688 
  41689 
  41690 START_TEST(readTextJsonSmallJsonT)
  41691 
  41692   smallJsont* r;
  41693   smallJsont *self     = allocG(rtSmallJsont);
  41694   smallJsont *filePath = allocSmallJson();
  41695 
  41696   // text
  41697   freeO(filePath);
  41698   setTopSO(filePath, "../textTest.null");
  41699   r = readTextJsonO(self, filePath);
  41700   ck_assert_ptr_ne(r, NULL);
  41701   char *s = toStringO(r);
  41702   ck_assert_str_eq(s, "[\"LINE 1\",\"ANOTHER line\"]");
  41703   free(s);
  41704   // empty text
  41705   emptyO(self);
  41706   freeO(filePath);
  41707   setTopSO(filePath, "../chmodTest.null");
  41708   r = readTextJsonO(self, filePath);
  41709   ck_assert_ptr_ne(r, NULL);
  41710   ck_assert(isEmptyO(self));
  41711   // NULL path
  41712   r = readTextJsonO(self, NULL);
  41713   ck_assert_ptr_eq(r, NULL);
  41714   // non existing path
  41715   if (fileExists("../nonExistingFile"))
  41716     rmAll("../nonExistingFile");
  41717   freeO(filePath);
  41718   setTopSO(filePath, "../nonExistingFile");
  41719   r = readTextJsonO(self, filePath);
  41720   ck_assert_ptr_eq(r, NULL);
  41721   // blank file path
  41722   freeO(filePath);
  41723   setTopSO(filePath, "  ");
  41724   r = readTextJsonO(self, filePath);
  41725   ck_assert_ptr_eq(r, NULL);
  41726   // non smallString object
  41727   terminateO(filePath);
  41728   filePath = (smallJsont*) allocSmallInt(2);
  41729   r = readTextJsonO(self, filePath);
  41730   ck_assert_ptr_eq(r, NULL);
  41731   terminateO(self);
  41732   terminateO(filePath);
  41733 
  41734 END_TEST
  41735 
  41736 
  41737 START_TEST(readTextStreamSmallJsonT)
  41738 
  41739   smallJsont* r;
  41740   smallJsont *self = allocG(rtSmallJsont);
  41741   FILE *fp;
  41742 
  41743   // stream
  41744   fp = fopen("../textTest.null", "r");
  41745   r = self->f->readTextStream(self, fp);
  41746   fclose(fp);
  41747   ck_assert_ptr_ne(r, NULL);
  41748   char *s = toStringO(r);
  41749   ck_assert_str_eq(s, "[\"LINE 1\",\"ANOTHER line\"]");
  41750   free(s);
  41751   // non empty and non json array
  41752   freeO(self);
  41753   setTypeIntO(self);
  41754   fp = fopen("../chmodTest.null", "r");
  41755   ck_assert_ptr_eq(self->f->readTextStream(self, fp), NULL);
  41756   // empty stream
  41757   setTypeArrayO(self);
  41758   r = self->f->readTextStream(self, fp);
  41759   fclose(fp);
  41760   ck_assert_ptr_ne(r, NULL);
  41761   ck_assert(isEmptyO(self));
  41762   // NULL stream
  41763   ck_assert_ptr_eq(self->f->readTextStream(self, NULL), NULL);
  41764   terminateO(self);
  41765 
  41766 END_TEST
  41767 
  41768 
  41769 START_TEST(writeTextSmallJsonT)
  41770 
  41771   bool r;
  41772   smallJsont *self = allocSmallJson();
  41773 
  41774   // write textOutTest.null
  41775   smallJsont *r2 = readTextO(self, "../textTest.null");
  41776   ck_assert_ptr_ne(r2, NULL);
  41777   r = writeTextO(self, "../textOutTest.null");
  41778   ck_assert(r);
  41779     // check textOutTest.null
  41780   emptyO(self);
  41781   r2 = readTextO(self, "../textOutTest.null");
  41782   ck_assert_ptr_ne(r2, NULL);
  41783   char *s = toStringO(r2);
  41784   ck_assert_str_eq(s, "[\"LINE 1\",\"ANOTHER line\"]");
  41785   free(s);
  41786   // read only path
  41787   r = writeTextO(self, "/readOnlyPath");
  41788   ck_assert(!r);
  41789   // non empty and non json array
  41790   freeO(self);
  41791   setTypeIntO(self);
  41792   r = writeTextO(self, "../textOutTest.null");
  41793   ck_assert(!r);
  41794   // empty text
  41795   setTypeArrayO(self);
  41796   emptyO(self);
  41797   r = writeTextO(self, "../textOutTest.null");
  41798   ck_assert(!r);
  41799   r2 = readTextO(self, "../textOutTest.null");
  41800   ck_assert_ptr_ne(r2, NULL);
  41801   s  = toStringO(r2);
  41802   ck_assert_str_eq(s, "[]");
  41803   free(s);
  41804   // non existing file
  41805     // make sure the file doesnt exist
  41806   if (fileExists("../nonExistingFile"))
  41807     rmAll("../nonExistingFile");
  41808   self->f->pushS(self, "qwe");
  41809   ck_assert(writeTextO(self, "../nonExistingFile"));
  41810   if (fileExists("../nonExistingFile"))
  41811     rmAll("../nonExistingFile");
  41812   // NULL path
  41813   ck_assert(!writeTextO(self, NULL));
  41814   terminateO(self);
  41815 
  41816 END_TEST
  41817 
  41818 
  41819 START_TEST(writeTextSmallStringSmallJsonT)
  41820 
  41821   bool r;
  41822   smallJsont *self       = allocSmallJson();
  41823   smallStringt *filePath = allocSmallString("");
  41824 
  41825   // write textOutTest.null
  41826   smallJsont *r2 = readTextO(self, "../textTest.null");
  41827   ck_assert_ptr_ne(r2, NULL);
  41828   setValO(filePath, "../textOutTest.null");
  41829   r = writeTextSmallStringO(self, filePath);
  41830   ck_assert(r);
  41831     // check textOutTest.null
  41832   emptyO(self);
  41833   r2 = readTextO(self, "../textOutTest.null");
  41834   ck_assert_ptr_ne(r2, NULL);
  41835   char *s = toStringO(r2);
  41836   ck_assert_str_eq(s, "[\"LINE 1\",\"ANOTHER line\"]");
  41837   free(s);
  41838   // empty array
  41839   emptyO(self);
  41840   setValO(filePath, "../textOutTest.null");
  41841   r = writeTextSmallStringO(self, filePath);
  41842   ck_assert(!r);
  41843   r2 = readTextO(self, "../textOutTest.null");
  41844   ck_assert_ptr_ne(r2, NULL);
  41845   s  = toStringO(r2);
  41846   ck_assert_str_eq(s, "[]");
  41847   free(s);
  41848   // non existing file
  41849     // make sure the file doesnt exist
  41850   if (fileExists("../nonExistingFile"))
  41851     rmAll("../nonExistingFile");
  41852   self->f->pushS(self, "qwe");
  41853   setValO(filePath, "../nonExistingFile");
  41854   ck_assert(writeTextSmallStringO(self, filePath));
  41855   if (fileExists("../nonExistingFile"))
  41856     rmAll("../nonExistingFile");
  41857   // non smallJson object
  41858   terminateO(filePath);
  41859   filePath = (smallStringt*) allocSmallInt(2);
  41860   r = writeTextSmallStringO(self, filePath);
  41861   ck_assert(!r);
  41862   // NULL path
  41863   ck_assert(!writeTextSmallStringO(self, NULL));
  41864   terminateO(self);
  41865   terminateO(filePath);
  41866 
  41867 END_TEST
  41868 
  41869 
  41870 START_TEST(writeTextJsonSmallJsonT)
  41871 
  41872   bool r;
  41873   smallJsont *self     = allocG(rtSmallJsont);
  41874   smallJsont *filePath = allocSmallJson();
  41875 
  41876   // write textOutTest.null
  41877   smallJsont *r2 = readTextO(self, "../textTest.null");
  41878   ck_assert_ptr_ne(r2, NULL);
  41879   freeO(filePath);
  41880   setTopSO(filePath, "../textOutTest.null");
  41881   r = writeTextJsonO(self, filePath);
  41882   ck_assert(r);
  41883     // check textOutTest.null
  41884   emptyO(self);
  41885   r2 = readTextO(self, "../textOutTest.null");
  41886   ck_assert_ptr_ne(r2, NULL);
  41887   char *s = toStringO(r2);
  41888   ck_assert_str_eq(s, "[\"LINE 1\",\"ANOTHER line\"]");
  41889   free(s);
  41890   // empty array
  41891   emptyO(self);
  41892   freeO(filePath);
  41893   setTopSO(filePath, "../textOutTest.null");
  41894   r = writeTextJsonO(self, filePath);
  41895   ck_assert(!r);
  41896   r2 = readTextO(self, "../textOutTest.null");
  41897   ck_assert_ptr_ne(r2, NULL);
  41898   s  = toStringO(r2);
  41899   ck_assert_str_eq(s, "[]");
  41900   free(s);
  41901   // non existing file
  41902     // make sure the file doesnt exist
  41903   if (fileExists("../nonExistingFile"))
  41904     rmAll("../nonExistingFile");
  41905   self->f->pushS(self, "qwe");
  41906   freeO(filePath);
  41907   setTopSO(filePath, "../nonExistingFile");
  41908   ck_assert(writeTextJsonO(self, filePath));
  41909   if (fileExists("../nonExistingFile"))
  41910     rmAll("../nonExistingFile");
  41911   // non smallJson object
  41912   terminateO(filePath);
  41913   filePath = (smallJsont*) allocSmallInt(2);
  41914   r = writeTextJsonO(self, filePath);
  41915   ck_assert(!r);
  41916   // NULL path
  41917   ck_assert(!writeTextJsonO(self, NULL));
  41918   rmAll("../textOutTest.null");
  41919   terminateO(self);
  41920   terminateO(filePath);
  41921 
  41922 END_TEST
  41923 
  41924 
  41925 START_TEST(writeTextStreamSmallJsonT)
  41926 
  41927   bool r;
  41928   smallJsont *self = allocG(rtSmallJsont);
  41929   FILE *fp;
  41930 
  41931   // non json array
  41932   fp = fopen("../textTest.null", "r");
  41933   r = self->f->writeTextStream(self, fp);
  41934   ck_assert(!r);
  41935   // write textOutTest.null
  41936   smallJsont *r2 = self->f->readTextStream(self, fp);
  41937   fclose(fp);
  41938   ck_assert_ptr_ne(r2, NULL);
  41939   fp = fopen("../textOutTest.null", "w");
  41940   r = self->f->writeTextStream(self, fp);
  41941   ck_assert(r);
  41942   // empty array
  41943   emptyO(self);
  41944   ck_assert(!self->f->writeTextStream(self, fp));
  41945   fclose(fp);
  41946     // check textOutTest.null
  41947   fp = fopen("../textOutTest.null", "r");
  41948   r2 = self->f->readTextStream(self, fp);
  41949   fclose(fp);
  41950   ck_assert_ptr_ne(r2, NULL);
  41951   char *s = toStringO(r2);
  41952   ck_assert_str_eq(s, "[\"LINE 1\",\"ANOTHER line\"]");
  41953   free(s);
  41954   terminateO(self);
  41955 
  41956 END_TEST
  41957 
  41958 
  41959 START_TEST(appendTextSmallJsonT)
  41960 
  41961   bool r;
  41962   smallJsont *self = allocSmallJson();
  41963 
  41964   // append to textOutTest.null
  41965   smallJsont *r2 = readTextO(self, "../textTest.null");
  41966   ck_assert_ptr_ne(r2, NULL);
  41967   r = writeTextO(self, "../textOutTest.null");
  41968   ck_assert(r);
  41969   emptyO(self);
  41970   self->f->pushS(self, "A");
  41971   self->f->pushS(self, "B");
  41972   r = appendTextO(self, "../textOutTest.null");
  41973     // check textOutTest.null
  41974   emptyO(self);
  41975   r2 = readTextO(self, "../textOutTest.null");
  41976   ck_assert_ptr_ne(r2, NULL);
  41977   char *s = toStringO(r2);
  41978   ck_assert_str_eq(s, "[\"LINE 1\",\"ANOTHER line\",\"A\",\"B\"]");
  41979   free(s);
  41980   // non existing file
  41981     // make sure the file doesnt exist
  41982   if (fileExists("../nonExistingFile"))
  41983     rmAll("../nonExistingFile");
  41984   ck_assert(appendTextO(self, "../nonExistingFile"));
  41985   if (fileExists("../nonExistingFile"))
  41986     rmAll("../nonExistingFile");
  41987   // empty array
  41988   emptyO(self);
  41989   r = appendTextO(self, "../textOutTest.null");
  41990   ck_assert(!r);
  41991     // check textOutTest.null
  41992   emptyO(self);
  41993   r2 = readTextO(self, "../textOutTest.null");
  41994   ck_assert_ptr_ne(r2, NULL);
  41995   s  = toStringO(r2);
  41996   ck_assert_str_eq(s, "[\"LINE 1\",\"ANOTHER line\",\"A\",\"B\"]");
  41997   free(s);
  41998   // blank path
  41999   ck_assert(!appendTextO(self, "  "));
  42000   // NULL path
  42001   ck_assert(!appendTextO(self, NULL));
  42002   // non empty json and non json array
  42003   freeO(self);
  42004   setTypeBoolO(self);
  42005   ck_assert(!appendTextO(self, "appendTest.txt"));
  42006   terminateO(self);
  42007 
  42008 END_TEST
  42009 
  42010 
  42011 START_TEST(appendTextSmallStringSmallJsonT)
  42012 
  42013   bool r;
  42014   smallJsont *self      = allocSmallJson();
  42015   smallStringt *filePath = allocSmallString("");
  42016 
  42017   // append to textOutTest.null
  42018   smallJsont *r2 = readTextO(self, "../textTest.null");
  42019   ck_assert_ptr_ne(r2, NULL);
  42020   r = writeTextO(self, "../textOutTest.null");
  42021   ck_assert(r);
  42022   emptyO(self);
  42023   self->f->pushS(self, "A");
  42024   self->f->pushS(self, "B");
  42025   setValO(filePath, "../textOutTest.null");
  42026   r = appendTextSmallStringO(self, filePath);
  42027     // check textOutTest.null
  42028   emptyO(self);
  42029   r2 = readTextO(self, "../textOutTest.null");
  42030   ck_assert_ptr_ne(r2, NULL);
  42031   char *s = toStringO(r2);
  42032   ck_assert_str_eq(s, "[\"LINE 1\",\"ANOTHER line\",\"A\",\"B\"]");
  42033   free(s);
  42034   // non existing file
  42035     // make sure the file doesnt exist
  42036   if (fileExists("../nonExistingFile"))
  42037     rmAll("../nonExistingFile");
  42038   setValO(filePath, "../nonExistingFile");
  42039   ck_assert(appendTextSmallStringO(self, filePath));
  42040   if (fileExists("../nonExistingFile"))
  42041     rmAll("../nonExistingFile");
  42042   // empty array
  42043   emptyO(self);
  42044   r = appendTextSmallStringO(self, filePath);
  42045   ck_assert(!r);
  42046     // check textOutTest.null
  42047   emptyO(self);
  42048   r2 = readTextO(self, "../textOutTest.null");
  42049   ck_assert_ptr_ne(r2, NULL);
  42050   s  = toStringO(r2);
  42051   ck_assert_str_eq(s, "[\"LINE 1\",\"ANOTHER line\",\"A\",\"B\"]");
  42052   free(s);
  42053   // blank path
  42054   setValO(filePath, "   ");
  42055   ck_assert(!appendTextSmallStringO(self, filePath));
  42056   // non smallString object
  42057   terminateO(filePath);
  42058   filePath = (smallStringt*) allocSmallInt(2);
  42059   r = appendTextSmallStringO(self, filePath);
  42060   ck_assert(!r);
  42061   // NULL path
  42062   ck_assert(!appendTextSmallStringO(self, NULL));
  42063   terminateO(self);
  42064   terminateO(filePath);
  42065 
  42066 END_TEST
  42067 
  42068 
  42069 START_TEST(appendTextJsonSmallJsonT)
  42070 
  42071   bool r;
  42072   smallJsont *self     = allocG(rtSmallJsont);
  42073   smallJsont *filePath = allocSmallJson();
  42074 
  42075   // append to textOutTest.null
  42076   smallJsont *r2 = readTextO(self, "../textTest.null");
  42077   ck_assert_ptr_ne(r2, NULL);
  42078   r = writeTextO(self, "../textOutTest.null");
  42079   ck_assert(r);
  42080   emptyO(self);
  42081   self->f->pushS(self, "A");
  42082   self->f->pushS(self, "B");
  42083   freeO(filePath);
  42084   setTopSO(filePath, "../textOutTest.null");
  42085   r = appendTextJsonO(self, filePath);
  42086     // check textOutTest.null
  42087   emptyO(self);
  42088   r2 = readTextO(self, "../textOutTest.null");
  42089   ck_assert_ptr_ne(r2, NULL);
  42090   char *s = toStringO(r2);
  42091   ck_assert_str_eq(s, "[\"LINE 1\",\"ANOTHER line\",\"A\",\"B\"]");
  42092   free(s);
  42093   // non existing file
  42094     // make sure the file doesnt exist
  42095   if (fileExists("../nonExistingFile"))
  42096     rmAll("../nonExistingFile");
  42097   freeO(filePath);
  42098   setTopSO(filePath, "../nonExistingFile");
  42099   ck_assert(appendTextJsonO(self, filePath));
  42100   if (fileExists("../nonExistingFile"))
  42101     rmAll("../nonExistingFile");
  42102   // empty array
  42103   emptyO(self);
  42104   r = appendTextJsonO(self, filePath);
  42105   ck_assert(!r);
  42106     // check textOutTest.null
  42107   emptyO(self);
  42108   r2 = readTextO(self, "../textOutTest.null");
  42109   ck_assert_ptr_ne(r2, NULL);
  42110   s  = toStringO(r2);
  42111   ck_assert_str_eq(s, "[\"LINE 1\",\"ANOTHER line\",\"A\",\"B\"]");
  42112   free(s);
  42113   // blank path
  42114   freeO(filePath);
  42115   setTopSO(filePath, "   ");
  42116   ck_assert(!appendTextJsonO(self, filePath));
  42117   // non smallString object
  42118   terminateO(filePath);
  42119   filePath = (smallJsont*) allocSmallInt(2);
  42120   r = appendTextJsonO(self, filePath);
  42121   ck_assert(!r);
  42122   // NULL path
  42123   ck_assert(!appendTextJsonO(self, NULL));
  42124   terminateO(self);
  42125   terminateO(filePath);
  42126 
  42127 END_TEST
  42128 
  42129 
  42130 START_TEST(typeStringSmallJsonT)
  42131 
  42132   const char* r;
  42133   smallJsont *self = allocG(rtSmallJsont);
  42134 
  42135   self->f->setBool(self, "lib", true);
  42136   r = typeStringO(self, "lib");
  42137   ck_assert_ptr_ne(r, null);
  42138   ck_assert_str_eq(r, "bool");
  42139   // path
  42140   baset *value = (baset*) allocSmallInt(2);
  42141   createSmallArray(a);
  42142   createSmallDict(d);
  42143   a.f->pushDict(&a, &d);
  42144   self->f->setArray(self, "array", &a);
  42145   smallJsont *r2 = self->f->set(self, "\"array\"[0].\"key\"", value);
  42146   ck_assert_ptr_ne(r2, null);
  42147   finishO(value);
  42148   r = typeStringO(self, "\"array\"[0].\"key\"");
  42149   ck_assert_ptr_ne(r, null);
  42150   ck_assert_str_eq(r, "int");
  42151   // json bool
  42152   freeO(self);
  42153   setTypeBoolO(self);
  42154   r = typeStringO(self, "1");
  42155   ck_assert_ptr_eq(r, null);
  42156   // json array
  42157   freeO(self);
  42158   setTypeArrayO(self);
  42159   r = typeStringO(self, "1");
  42160   ck_assert_ptr_eq(r, null);
  42161   // non existing dict path
  42162   freeO(self);
  42163   r = typeStringO(self, "\"1\"[1]");
  42164   ck_assert_ptr_eq(r, null);
  42165   //   dict path but the object is an array
  42166   resetO(&a);
  42167   self->f->setArray(self, "1", &a);
  42168   r = typeStringO(self, "\"1\".\"1\"");
  42169   ck_assert_ptr_eq(r, null);
  42170   //   dict object in path but the key doesn't exists
  42171   resetO(&d);
  42172   self->f->setDict(self, "2", &d);
  42173   r = typeStringO(self, "\"2\".\"1\".[12]");
  42174   ck_assert_ptr_eq(r, null);
  42175   // non existing element
  42176   r = typeStringO(self, "randomKey");
  42177   ck_assert_ptr_eq(r, null);
  42178   // null key
  42179   r = typeStringO(self, null);
  42180   ck_assert_ptr_eq(r, null);
  42181   terminateO(self);
  42182 
  42183 END_TEST
  42184 
  42185 
  42186 START_TEST(typeSmallStringSmallJsonT)
  42187 
  42188   smallStringt* r;
  42189   smallJsont *self = allocSmallJson();
  42190 
  42191   self->f->setInt(self, "", 1);
  42192   self->f->setInt(self, "b", 2);
  42193   r = typeSmallStringO(self, "");
  42194   ck_assert_str_eq(ssGet(r), "int");
  42195   terminateO(r);
  42196   // non existing key
  42197   r = typeSmallStringO(self, "asd");
  42198   ck_assert_ptr_eq(r, null);
  42199   terminateO(self);
  42200 
  42201 END_TEST
  42202 
  42203 
  42204 START_TEST(typeAtStringSmallJsonT)
  42205 
  42206   const char* r;
  42207   smallJsont *self = allocG(rtSmallJsont);
  42208 
  42209   // empty self
  42210   r = typeAtStringO(self, 0);
  42211   ck_assert_str_eq(r, "not a sheepy object");
  42212   terminateO(self);
  42213 
  42214 END_TEST
  42215 
  42216 
  42217 START_TEST(typeAtSmallStringSmallJsonT)
  42218 
  42219   smallStringt* r;
  42220   smallJsont *self = allocSmallJson();
  42221 
  42222   // empty array
  42223   r = typeAtSmallStringO(self, 0);
  42224   ck_assert_ptr_ne(r, NULL);
  42225   char *s = toStringO(r);
  42226   ck_assert_str_eq(s, "not a sheepy object");
  42227   free(s);
  42228   terminateO(self);
  42229   terminateO(r);
  42230 
  42231 END_TEST
  42232 
  42233 
  42234 START_TEST(typeStringKCharSmallJsonT)
  42235 
  42236   const char* r;
  42237   smallJsont *self = allocSmallJson();
  42238 
  42239   self->f->setInt(self, "", 1);
  42240   self->f->setInt(self, "b", 2);
  42241   r = typeStringKCharO(self, 'b');
  42242   ck_assert_str_eq(r, "int");
  42243   terminateO(self);
  42244 
  42245 END_TEST
  42246 
  42247 
  42248 START_TEST(typeSmallStringKCharSmallJsonT)
  42249 
  42250   smallStringt* r;
  42251   smallJsont *self = allocSmallJson();
  42252 
  42253   self->f->setInt(self, "", 1);
  42254   self->f->setInt(self, "b", 2);
  42255   r = typeSmallStringKCharO(self, 'b');
  42256   ck_assert_str_eq(ssGet(r), "int");
  42257   terminateO(r);
  42258   // non existing key
  42259   r = typeSmallStringKCharO(self, 'a');
  42260   ck_assert_ptr_eq(r, null);
  42261   terminateO(self);
  42262 
  42263 END_TEST
  42264 
  42265 
  42266 START_TEST(typeSmallJsonT)
  42267 
  42268   char r;
  42269   smallJsont *self = allocG(rtSmallJsont);
  42270 
  42271   self->f->setBool(self, "lib", true);
  42272   r = typeO(self, "lib");
  42273   ck_assert_int_eq(r, 2);
  42274   // path
  42275   baset *value = (baset*) allocSmallInt(2);
  42276   createSmallArray(a);
  42277   createSmallDict(d);
  42278   a.f->pushDict(&a, &d);
  42279   self->f->setArray(self, "array", &a);
  42280   smallJsont *r2 = self->f->set(self, "\"array\"[0].\"key\"", value);
  42281   ck_assert_ptr_ne(r2, null);
  42282   finishO(value);
  42283   r = typeO(self, "\"array\"[0].\"key\"");
  42284   ck_assert_int_eq(r, 7);
  42285   // json bool
  42286   freeO(self);
  42287   setTypeBoolO(self);
  42288   r = typeO(self, "1");
  42289   ck_assert(!r);
  42290   // json array
  42291   freeO(self);
  42292   setTypeArrayO(self);
  42293   r = typeO(self, "1");
  42294   ck_assert(!r);
  42295   // non existing dict path
  42296   freeO(self);
  42297   r = typeO(self, "\"1\"[1]");
  42298   ck_assert(!r);
  42299   //   dict path but the object is an array
  42300   resetO(&a);
  42301   self->f->setArray(self, "1", &a);
  42302   r = typeO(self, "\"1\".\"1\"");
  42303   ck_assert(!r);
  42304   //   dict object in path but the key doesn't exists
  42305   resetO(&d);
  42306   self->f->setDict(self, "2", &d);
  42307   r = typeO(self, "\"2\".\"1\".[12]");
  42308   ck_assert(!r);
  42309   // non existing element
  42310   r = typeO(self, "randomKey");
  42311   ck_assert(!r);
  42312   // null key
  42313   r = typeO(self, null);
  42314   ck_assert(!r);
  42315   terminateO(self);
  42316 
  42317 END_TEST
  42318 
  42319 
  42320 START_TEST(typeKCharSmallJsonT)
  42321 
  42322   char r;
  42323   smallJsont *self = allocSmallJson();
  42324 
  42325   self->f->setInt(self, "", 1);
  42326   self->f->setInt(self, "b", 2);
  42327   r = typeKCharO(self, 'b');
  42328   ck_assert_int_eq(r, 7);
  42329   terminateO(self);
  42330 
  42331 END_TEST
  42332 
  42333 
  42334 START_TEST(typeAtSmallJsonT)
  42335 
  42336   smallJsont *self = allocG(rtSmallJsont);
  42337 
  42338   // non json array
  42339   ck_assert_int_eq(typeAtO(self, 0), 0);
  42340   // empty json array
  42341   setTypeArrayO(self);
  42342   ck_assert_int_eq(typeAtO(self, 0), 0);
  42343   // type
  42344   self->f->pushInt(self, 1);
  42345   ck_assert_int_eq(typeAtO(self, 0), 7);
  42346   // outside
  42347   ck_assert_int_eq(typeAtO(self, 1), 0);
  42348   ck_assert_int_eq(typeAtO(self, -2), 0);
  42349   terminateO(self);
  42350 
  42351 END_TEST
  42352 
  42353 
  42354 START_TEST(typeStringsSmallJsonT)
  42355 
  42356   smallJsont* r;
  42357   smallJsont *self = allocG(rtSmallJsont);
  42358 
  42359   // non json array or dict
  42360   setTypeBoolO(self);
  42361   r = typeStringsO(self);
  42362   ck_assert_ptr_eq(r, null);
  42363   // json dict
  42364   freeO(self);
  42365   self->f->setUndefined(self, "u");
  42366   self->f->setS(self, "s", "s");
  42367   self->f->setInt(self, "i", 123);
  42368   r = typeStringsO(self);
  42369   ck_assert_ptr_ne(r, null);
  42370   char *s = toStringO(r);
  42371   ck_assert_str_eq(s, "{\"u\":\"undefined\",\"s\":\"string\",\"i\":\"int\"}");
  42372   free(s);
  42373   terminateO(r);
  42374   // json array
  42375   freeO(self);
  42376   self->f->pushUndefined(self);
  42377   self->f->pushS(self,"qwe");
  42378   self->f->pushInt(self,123);
  42379   r = typeStringsO(self);
  42380   ck_assert_ptr_ne(r, null);
  42381   s = toStringO(r);
  42382   ck_assert_str_eq(s, "[\"undefined\",\"string\",\"int\"]");
  42383   free(s);
  42384   terminateO(r);
  42385   terminateO(self);
  42386 
  42387 END_TEST
  42388 
  42389 
  42390 START_TEST(typesSmallJsonT)
  42391 
  42392   smallBytest* r;
  42393   smallJsont *self = allocG(rtSmallJsont);
  42394 
  42395   // non json array
  42396   r = typesO(self);
  42397   ck_assert_ptr_eq(r, null);
  42398   // empty json array
  42399   setTypeArrayO(self);
  42400   r = typesO(self);
  42401   ck_assert_ptr_eq(r, null);
  42402   // json array with elements
  42403   self->f->pushUndefined(self);
  42404   self->f->pushS(self,"qwe");
  42405   self->f->pushInt(self,123);
  42406   r = typesO(self);
  42407   ck_assert_ptr_ne(r, null);
  42408   char *s = toStringO(r);
  42409   ck_assert_str_eq(s, "[0x01,0x08,0x07]");
  42410   free(s);
  42411   terminateO(r);
  42412   terminateO(self);
  42413 
  42414 END_TEST
  42415 
  42416 
  42417 START_TEST(isETypeAtSmallJsonT)
  42418 
  42419   bool r;
  42420   smallJsont *self = allocSmallJson();
  42421 
  42422   // non json array
  42423   r = isETypeAtO(self, 0, "undefined");
  42424   ck_assert(!r);
  42425   // json array
  42426   self->f->pushUndefined(self);
  42427   r = isETypeAtO(self, 0, "undefined");
  42428   ck_assert(r);
  42429   // NULL type
  42430   emptyO(self);
  42431   r = isETypeAtO(self, 0, NULL);
  42432   ck_assert(!r);
  42433   terminateO(self);
  42434 
  42435 END_TEST
  42436 
  42437 
  42438 START_TEST(isEUndefinedAtSmallJsonT)
  42439 
  42440   bool r;
  42441   smallJsont *self = allocSmallJson();
  42442 
  42443   // non json array
  42444   r = isEUndefinedAtO(self, 0);
  42445   ck_assert(!r);
  42446   // array
  42447   self->f->pushUndefined(self);
  42448   self->f->pushS(self, "");
  42449   r = isEUndefinedAtO(self, 0);
  42450   ck_assert(r);
  42451   r = isEUndefinedAtO(self, -1);
  42452   ck_assert(!r);
  42453   terminateO(self);
  42454 
  42455 END_TEST
  42456 
  42457 
  42458 START_TEST(isEBoolAtSmallJsonT)
  42459 
  42460   bool r;
  42461   smallJsont *self = allocSmallJson();
  42462 
  42463   // non json array
  42464   r = isEBoolAtO(self, 0);
  42465   ck_assert(!r);
  42466   // array
  42467   self->f->pushBool(self, true);
  42468   self->f->pushS(self, "");
  42469   r = isEBoolAtO(self, 0);
  42470   ck_assert(r);
  42471   r = isEBoolAtO(self, -1);
  42472   ck_assert(!r);
  42473   terminateO(self);
  42474 
  42475 END_TEST
  42476 
  42477 
  42478 START_TEST(isEContainerAtSmallJsonT)
  42479 
  42480   bool r;
  42481   smallJsont *self = allocSmallJson();
  42482 
  42483   // non json array
  42484   r = isEContainerAtO(self, 0);
  42485   ck_assert(!r);
  42486   // array
  42487   createSmallContainer(c);
  42488   self->f->pushSmallContainer(self, &c);
  42489   self->f->pushS(self, "");
  42490   r = isEContainerAtO(self, 0);
  42491   ck_assert(r);
  42492   r = isEContainerAtO(self, -1);
  42493   ck_assert(!r);
  42494   terminateO(self);
  42495 
  42496 END_TEST
  42497 
  42498 
  42499 START_TEST(isEDictAtSmallJsonT)
  42500 
  42501   bool r;
  42502   smallJsont *self = allocSmallJson();
  42503 
  42504   // non json array
  42505   r = isEDictAtO(self, 0);
  42506   ck_assert(!r);
  42507   // array
  42508   createSmallDict(d);
  42509   self->f->pushDict(self, &d);
  42510   self->f->pushS(self, "");
  42511   r = isEDictAtO(self, 0);
  42512   ck_assert(r);
  42513   r = isEDictAtO(self, -1);
  42514   ck_assert(!r);
  42515   terminateO(self);
  42516 
  42517 END_TEST
  42518 
  42519 
  42520 START_TEST(isEDoubleAtSmallJsonT)
  42521 
  42522   bool r;
  42523   smallJsont *self = allocSmallJson();
  42524 
  42525   // non json array
  42526   r = isEDoubleAtO(self, 0);
  42527   ck_assert(!r);
  42528   // array
  42529   self->f->pushDouble(self, 1);
  42530   self->f->pushS(self, "");
  42531   r = isEDoubleAtO(self, 0);
  42532   ck_assert(r);
  42533   r = isEDoubleAtO(self, -1);
  42534   ck_assert(!r);
  42535   terminateO(self);
  42536 
  42537 END_TEST
  42538 
  42539 
  42540 START_TEST(isEIntAtSmallJsonT)
  42541 
  42542   bool r;
  42543   smallJsont *self = allocSmallJson();
  42544 
  42545   // non json array
  42546   r = isEIntAtO(self, 0);
  42547   ck_assert(!r);
  42548   // array
  42549   self->f->pushInt(self, 1);
  42550   self->f->pushS(self, "");
  42551   r = isEIntAtO(self, 0);
  42552   ck_assert(r);
  42553   r = isEIntAtO(self, -1);
  42554   ck_assert(!r);
  42555   terminateO(self);
  42556 
  42557 END_TEST
  42558 
  42559 
  42560 START_TEST(isEStringAtSmallJsonT)
  42561 
  42562   bool r;
  42563   smallJsont *self = allocSmallJson();
  42564 
  42565   // non json array
  42566   r = isEStringAtO(self, 0);
  42567   ck_assert(!r);
  42568   // array
  42569   self->f->pushUndefined(self);
  42570   self->f->pushS(self, "");
  42571   r = isEStringAtO(self, -1);
  42572   ck_assert(r);
  42573   r = isEStringAtO(self, 0);
  42574   ck_assert(!r);
  42575   terminateO(self);
  42576 
  42577 END_TEST
  42578 
  42579 
  42580 START_TEST(isEFaststringAtSmallJsonT)
  42581 
  42582   bool r;
  42583   smallJsont *self = allocG(rtSmallJsont);
  42584 
  42585   // non json array
  42586   r = isEFaststringAtO(self, 0);
  42587   ck_assert(!r);
  42588   // array
  42589   self->f->pushUndefined(self);
  42590   self->f->pushS(self, "");
  42591   r = isEFaststringAtO(self, -1);
  42592   ck_assert(!r);
  42593   r = isEFaststringAtO(self, 0);
  42594   ck_assert(!r);
  42595   terminateO(self);
  42596 
  42597 END_TEST
  42598 
  42599 
  42600 START_TEST(isEArrayAtSmallJsonT)
  42601 
  42602   bool r;
  42603   smallJsont *self = allocSmallJson();
  42604 
  42605   // non json array
  42606   r = isEArrayAtO(self, 0);
  42607   ck_assert(!r);
  42608   // array
  42609   createSmallArray(a);
  42610   self->f->pushArray(self, &a);
  42611   self->f->pushS(self, "");
  42612   r = isEArrayAtO(self, 0);
  42613   ck_assert(r);
  42614   r = isEArrayAtO(self, -1);
  42615   ck_assert(!r);
  42616   terminateO(self);
  42617 
  42618 END_TEST
  42619 
  42620 
  42621 START_TEST(isEBytesAtSmallJsonT)
  42622 
  42623   bool r;
  42624   smallJsont *self = allocSmallJson();
  42625 
  42626   // non json array
  42627   r = isEBytesAtO(self, 0);
  42628   ck_assert(!r);
  42629   // array
  42630   createSmallBytes(b);
  42631   self->f->pushSmallBytes(self, &b);
  42632   self->f->pushS(self, "");
  42633   r = isEBytesAtO(self, 0);
  42634   ck_assert(r);
  42635   r = isEBytesAtO(self, -1);
  42636   ck_assert(!r);
  42637   terminateO(self);
  42638 
  42639 END_TEST
  42640 
  42641 
  42642 START_TEST(isETypeSmallJsonT)
  42643 
  42644   bool r;
  42645   smallJsont *self = allocSmallJson();
  42646 
  42647   self->f->setInt(self, "", 1);
  42648   r = isETypeO(self, "", "int");
  42649   ck_assert(r);
  42650   // path
  42651   baset *value = (baset*) allocSmallInt(2);
  42652   createSmallArray(a);
  42653   createSmallDict(d);
  42654   a.f->pushDict(&a, &d);
  42655   self->f->setArray(self, "array", &a);
  42656   smallJsont *r2 = self->f->set(self, "\"array\"[0].\"key\"", value);
  42657   ck_assert_ptr_ne(r2, null);
  42658   finishO(value);
  42659   r = isETypeO(self, "\"array\"[0].\"key\"", "int");
  42660   ck_assert(r);
  42661   r = isETypeO(self, "\"array\"[0].\"key\"", "bool");
  42662   ck_assert(!r);
  42663   // json bool
  42664   freeO(self);
  42665   setTypeBoolO(self);
  42666   r = isETypeO(self, "1", "bool");
  42667   ck_assert(!r);
  42668   // json array
  42669   freeO(self);
  42670   setTypeArrayO(self);
  42671   r = isETypeO(self, "1", "array");
  42672   ck_assert(!r);
  42673   // non existing dict path
  42674   freeO(self);
  42675   r = isETypeO(self, "\"1\"[1]", "int");
  42676   ck_assert(!r);
  42677   //   dict path but the object is an array
  42678   resetO(&a);
  42679   self->f->setArray(self, "1", &a);
  42680   r = isETypeO(self, "\"1\".\"1\"", "int");
  42681   ck_assert(!r);
  42682   //   dict object in path but the key doesn't exists
  42683   resetO(&d);
  42684   self->f->setDict(self, "2", &d);
  42685   r = isETypeO(self, "\"2\".\"1\".[12]", "int");
  42686   ck_assert(!r);
  42687   // non existing element
  42688   r = isETypeO(self, "randomKey", "int");
  42689   ck_assert(!r);
  42690   // null type
  42691   r = isETypeO(self, "", null);
  42692   ck_assert(!r);
  42693   // null key
  42694   r = isETypeO(self, null, "int");
  42695   ck_assert(!r);
  42696   // empty dict
  42697   freeO(self);
  42698   r = isETypeO(self, "", "int");
  42699   ck_assert(!r);
  42700   terminateO(self);
  42701 
  42702 END_TEST
  42703 
  42704 
  42705 START_TEST(isEUndefinedSmallJsonT)
  42706 
  42707   bool r;
  42708   smallJsont *self = allocSmallJson();
  42709 
  42710   self->f->setInt(self, "", 1);
  42711   self->f->setUndefined(self, "b");
  42712   r = isEUndefinedO(self, "b");
  42713   ck_assert(r);
  42714   r = isEUndefinedO(self, "");
  42715   ck_assert(!r);
  42716   // path
  42717   createSmallArray(a);
  42718   createSmallDict(d);
  42719   a.f->pushDict(&a, &d);
  42720   self->f->setArray(self, "array", &a);
  42721   smallJsont *r2 = self->f->setUndefined(self, "\"array\"[0].\"key\"");
  42722   r2             = self->f->setS(self, "\"array\"[0].\"s\"", "asd");
  42723   ck_assert_ptr_ne(r2, null);
  42724   r = isEUndefinedO(self, "\"array\"[0].\"key\"");
  42725   ck_assert(r);
  42726   r = isEUndefinedO(self, "\"array\"[0].\"s\"");
  42727   ck_assert(!r);
  42728   // json bool
  42729   freeO(self);
  42730   setTypeBoolO(self);
  42731   r = isEUndefinedO(self, "1");
  42732   ck_assert(!r);
  42733   // json array
  42734   freeO(self);
  42735   setTypeArrayO(self);
  42736   r = isEUndefinedO(self, "1");
  42737   ck_assert(!r);
  42738   // non existing dict path
  42739   freeO(self);
  42740   r = isEUndefinedO(self, "\"1\"[1]");
  42741   ck_assert(!r);
  42742   //   dict path but the object is an array
  42743   resetO(&a);
  42744   self->f->setArray(self, "1", &a);
  42745   r = isEUndefinedO(self, "\"1\".\"1\"");
  42746   ck_assert(!r);
  42747   //   dict object in path but the key doesn't exists
  42748   resetO(&d);
  42749   self->f->setDict(self, "2", &d);
  42750   r = isEUndefinedO(self, "\"2\".\"1\".[12]");
  42751   ck_assert(!r);
  42752   // non existing key
  42753   r = isEUndefinedO(self, "qwe");
  42754   ck_assert(!r);
  42755   // empty dict
  42756   freeO(self);
  42757   r = isEUndefinedO(self, "");
  42758   ck_assert(!r);
  42759   terminateO(self);
  42760 
  42761 END_TEST
  42762 
  42763 
  42764 START_TEST(isEBoolSmallJsonT)
  42765 
  42766   bool r;
  42767   smallJsont *self = allocSmallJson();
  42768 
  42769   self->f->setInt(self, "", 1);
  42770   self->f->setBool(self, "b", true);
  42771   r = isEBoolO(self, "b");
  42772   ck_assert(r);
  42773   r = isEBoolO(self, "");
  42774   ck_assert(!r);
  42775   // path
  42776   baset *value = (baset*) allocSmallBool(true);
  42777   createSmallArray(a);
  42778   createSmallDict(d);
  42779   a.f->pushDict(&a, &d);
  42780   self->f->setArray(self, "array", &a);
  42781   smallJsont *r2 = self->f->set(self, "\"array\"[0].\"key\"", value);
  42782   r2             = self->f->setUndefined(self, "\"array\"[0].\"s\"");
  42783   ck_assert_ptr_ne(r2, null);
  42784   finishO(value);
  42785   r = isEBoolO(self, "\"array\"[0].\"key\"");
  42786   ck_assert(r);
  42787   r = isEBoolO(self, "\"array\"[0].\"s\"");
  42788   ck_assert(!r);
  42789   // json bool
  42790   freeO(self);
  42791   setTypeBoolO(self);
  42792   r = isEBoolO(self, "1");
  42793   ck_assert(!r);
  42794   // json array
  42795   freeO(self);
  42796   setTypeArrayO(self);
  42797   r = isEBoolO(self, "1");
  42798   ck_assert(!r);
  42799   // non existing dict path
  42800   freeO(self);
  42801   r = isEBoolO(self, "\"1\"[1]");
  42802   ck_assert(!r);
  42803   //   dict path but the object is an array
  42804   resetO(&a);
  42805   self->f->setArray(self, "1", &a);
  42806   r = isEBoolO(self, "\"1\".\"1\"");
  42807   ck_assert(!r);
  42808   //   dict object in path but the key doesn't exists
  42809   resetO(&d);
  42810   self->f->setDict(self, "2", &d);
  42811   r = isEBoolO(self, "\"2\".\"1\".[12]");
  42812   ck_assert(!r);
  42813   // non existing key
  42814   r = isEBoolO(self, "qwe");
  42815   ck_assert(!r);
  42816   // empty dict
  42817   freeO(self);
  42818   r = isEBoolO(self, "");
  42819   ck_assert(!r);
  42820   terminateO(self);
  42821 
  42822 END_TEST
  42823 
  42824 
  42825 START_TEST(isEContainerSmallJsonT)
  42826 
  42827   bool r;
  42828   smallJsont *self = allocSmallJson();
  42829 
  42830   createSmallContainer(c);
  42831   self->f->setInt(self, "", 1);
  42832   self->f->setBool(self, "b", true);
  42833   self->f->setSmallContainer(self, "c", &c);
  42834   r = isEContainerO(self, "c");
  42835   ck_assert(r);
  42836   r = isEContainerO(self, "b");
  42837   ck_assert(!r);
  42838   // path
  42839   baset *value = (baset*) allocSmallContainer(null);
  42840   createSmallArray(a);
  42841   createSmallDict(d);
  42842   a.f->pushDict(&a, &d);
  42843   self->f->setArray(self, "array", &a);
  42844   smallJsont *r2 = self->f->set(self, "\"array\"[0].\"key\"", value);
  42845   r2             = self->f->setUndefined(self, "\"array\"[0].\"s\"");
  42846   ck_assert_ptr_ne(r2, null);
  42847   finishO(value);
  42848   r = isEContainerO(self, "\"array\"[0].\"key\"");
  42849   ck_assert(r);
  42850   r = isEContainerO(self, "\"array\"[0].\"s\"");
  42851   ck_assert(!r);
  42852   // json bool
  42853   freeO(self);
  42854   setTypeBoolO(self);
  42855   r = isEContainerO(self, "1");
  42856   ck_assert(!r);
  42857   // json array
  42858   freeO(self);
  42859   setTypeArrayO(self);
  42860   r = isEContainerO(self, "1");
  42861   ck_assert(!r);
  42862   // non existing dict path
  42863   freeO(self);
  42864   r = isEContainerO(self, "\"1\"[1]");
  42865   ck_assert(!r);
  42866   //   dict path but the object is an array
  42867   resetO(&a);
  42868   self->f->setArray(self, "1", &a);
  42869   r = isEContainerO(self, "\"1\".\"1\"");
  42870   ck_assert(!r);
  42871   //   dict object in path but the key doesn't exists
  42872   resetO(&d);
  42873   self->f->setDict(self, "2", &d);
  42874   r = isEContainerO(self, "\"2\".\"1\".[12]");
  42875   ck_assert(!r);
  42876   // non existing key
  42877   r = isEContainerO(self, "qwe");
  42878   ck_assert(!r);
  42879   // empty dict
  42880   freeO(self);
  42881   r = isEContainerO(self, "");
  42882   ck_assert(!r);
  42883   terminateO(self);
  42884 
  42885 END_TEST
  42886 
  42887 
  42888 START_TEST(isEDictSmallJsonT)
  42889 
  42890   bool r;
  42891   smallJsont *self = allocSmallJson();
  42892 
  42893   self->f->setInt(self, "", 1);
  42894   createSmallDict(D);
  42895   self->f->setDict(self, "b", &D);
  42896   r = isEDictO(self, "b");
  42897   ck_assert(r);
  42898   r = isEDictO(self, "");
  42899   ck_assert(!r);
  42900   // path
  42901   baset *value = (baset*) allocSmallDict();
  42902   createSmallArray(a);
  42903   createSmallDict(d);
  42904   a.f->pushDict(&a, &d);
  42905   self->f->setArray(self, "array", &a);
  42906   smallJsont *r2 = self->f->set(self, "\"array\"[0].\"key\"", value);
  42907   r2             = self->f->setUndefined(self, "\"array\"[0].\"s\"");
  42908   ck_assert_ptr_ne(r2, null);
  42909   finishO(value);
  42910   r = isEDictO(self, "\"array\"[0].\"key\"");
  42911   ck_assert(r);
  42912   r = isEDictO(self, "\"array\"[0].\"s\"");
  42913   ck_assert(!r);
  42914   // json bool
  42915   freeO(self);
  42916   setTypeBoolO(self);
  42917   r = isEDictO(self, "1");
  42918   ck_assert(!r);
  42919   // json array
  42920   freeO(self);
  42921   setTypeArrayO(self);
  42922   r = isEDictO(self, "1");
  42923   ck_assert(!r);
  42924   // non existing dict path
  42925   freeO(self);
  42926   r = isEDictO(self, "\"1\"[1]");
  42927   ck_assert(!r);
  42928   //   dict path but the object is an array
  42929   resetO(&a);
  42930   self->f->setArray(self, "1", &a);
  42931   r = isEDictO(self, "\"1\".\"1\"");
  42932   ck_assert(!r);
  42933   //   dict object in path but the key doesn't exists
  42934   resetO(&d);
  42935   self->f->setDict(self, "2", &d);
  42936   r = isEDictO(self, "\"2\".\"1\".[12]");
  42937   ck_assert(!r);
  42938   // non existing key
  42939   r = isEDictO(self, "qwe");
  42940   ck_assert(!r);
  42941   // empty dict
  42942   freeO(self);
  42943   r = isEDictO(self, "");
  42944   ck_assert(!r);
  42945   terminateO(self);
  42946 
  42947 END_TEST
  42948 
  42949 
  42950 START_TEST(isEDoubleSmallJsonT)
  42951 
  42952   bool r;
  42953   smallJsont *self = allocSmallJson();
  42954 
  42955   self->f->setInt(self, "", 1);
  42956   self->f->setDouble(self, "b", 2.2);
  42957   r = isEDoubleO(self, "b");
  42958   ck_assert(r);
  42959   r = isEDoubleO(self, "");
  42960   ck_assert(!r);
  42961   // path
  42962   baset *value = (baset*) allocSmallDouble(2.2);
  42963   createSmallArray(a);
  42964   createSmallDict(d);
  42965   a.f->pushDict(&a, &d);
  42966   self->f->setArray(self, "array", &a);
  42967   smallJsont *r2 = self->f->set(self, "\"array\"[0].\"key\"", value);
  42968   r2             = self->f->setUndefined(self, "\"array\"[0].\"s\"");
  42969   ck_assert_ptr_ne(r2, null);
  42970   finishO(value);
  42971   r = isEDoubleO(self, "\"array\"[0].\"key\"");
  42972   ck_assert(r);
  42973   r = isEDoubleO(self, "\"array\"[0].\"s\"");
  42974   ck_assert(!r);
  42975   // json bool
  42976   freeO(self);
  42977   setTypeBoolO(self);
  42978   r = isEDoubleO(self, "1");
  42979   ck_assert(!r);
  42980   // json array
  42981   freeO(self);
  42982   setTypeArrayO(self);
  42983   r = isEDoubleO(self, "1");
  42984   ck_assert(!r);
  42985   // non existing dict path
  42986   freeO(self);
  42987   r = isEDoubleO(self, "\"1\"[1]");
  42988   ck_assert(!r);
  42989   //   dict path but the object is an array
  42990   resetO(&a);
  42991   self->f->setArray(self, "1", &a);
  42992   r = isEDoubleO(self, "\"1\".\"1\"");
  42993   ck_assert(!r);
  42994   //   dict object in path but the key doesn't exists
  42995   resetO(&d);
  42996   self->f->setDict(self, "2", &d);
  42997   r = isEDoubleO(self, "\"2\".\"1\".[12]");
  42998   ck_assert(!r);
  42999   // non existing key
  43000   r = isEDoubleO(self, "qwe");
  43001   ck_assert(!r);
  43002   // empty dict
  43003   freeO(self);
  43004   r = isEDoubleO(self, "");
  43005   ck_assert(!r);
  43006   terminateO(self);
  43007 
  43008 END_TEST
  43009 
  43010 
  43011 START_TEST(isEIntSmallJsonT)
  43012 
  43013   bool r;
  43014   smallJsont *self = allocSmallJson();
  43015 
  43016   self->f->setBool(self, "", true);
  43017   self->f->setInt(self, "b", 2);
  43018   r = isEIntO(self, "b");
  43019   ck_assert(r);
  43020   r = isEIntO(self, "");
  43021   ck_assert(!r);
  43022   // path
  43023   baset *value = (baset*) allocSmallInt(123);
  43024   createSmallArray(a);
  43025   createSmallDict(d);
  43026   a.f->pushDict(&a, &d);
  43027   self->f->setArray(self, "array", &a);
  43028   smallJsont *r2 = self->f->set(self, "\"array\"[0].\"key\"", value);
  43029   r2             = self->f->setUndefined(self, "\"array\"[0].\"s\"");
  43030   ck_assert_ptr_ne(r2, null);
  43031   finishO(value);
  43032   r = isEIntO(self, "\"array\"[0].\"key\"");
  43033   ck_assert(r);
  43034   r = isEIntO(self, "\"array\"[0].\"s\"");
  43035   ck_assert(!r);
  43036   // json bool
  43037   freeO(self);
  43038   setTypeBoolO(self);
  43039   r = isEIntO(self, "1");
  43040   ck_assert(!r);
  43041   // json array
  43042   freeO(self);
  43043   setTypeArrayO(self);
  43044   r = isEIntO(self, "1");
  43045   ck_assert(!r);
  43046   // non existing dict path
  43047   freeO(self);
  43048   r = isEIntO(self, "\"1\"[1]");
  43049   ck_assert(!r);
  43050   //   dict path but the object is an array
  43051   resetO(&a);
  43052   self->f->setArray(self, "1", &a);
  43053   r = isEIntO(self, "\"1\".\"1\"");
  43054   ck_assert(!r);
  43055   //   dict object in path but the key doesn't exists
  43056   resetO(&d);
  43057   self->f->setDict(self, "2", &d);
  43058   r = isEIntO(self, "\"2\".\"1\".[12]");
  43059   ck_assert(!r);
  43060   // non existing key
  43061   r = isEIntO(self, "qwe");
  43062   ck_assert(!r);
  43063   // empty dict
  43064   freeO(self);
  43065   r = isEIntO(self, "");
  43066   ck_assert(!r);
  43067   terminateO(self);
  43068 
  43069 END_TEST
  43070 
  43071 
  43072 START_TEST(isEStringSmallJsonT)
  43073 
  43074   bool r;
  43075   smallJsont *self = allocSmallJson();
  43076 
  43077   self->f->setInt(self, "", 1);
  43078   self->f->setS(self, "b", "!@#");
  43079   r = isEStringO(self, "b");
  43080   ck_assert(r);
  43081   r = isEStringO(self, "");
  43082   ck_assert(!r);
  43083   // path
  43084   baset *value = (baset*) allocSmallString("qwe");
  43085   createSmallArray(a);
  43086   createSmallDict(d);
  43087   a.f->pushDict(&a, &d);
  43088   self->f->setArray(self, "array", &a);
  43089   smallJsont *r2 = self->f->set(self, "\"array\"[0].\"key\"", value);
  43090   r2             = self->f->setUndefined(self, "\"array\"[0].\"s\"");
  43091   ck_assert_ptr_ne(r2, null);
  43092   finishO(value);
  43093   r = isEStringO(self, "\"array\"[0].\"key\"");
  43094   ck_assert(r);
  43095   r = isEStringO(self, "\"array\"[0].\"s\"");
  43096   ck_assert(!r);
  43097   // json bool
  43098   freeO(self);
  43099   setTypeBoolO(self);
  43100   r = isEStringO(self, "1");
  43101   ck_assert(!r);
  43102   // json array
  43103   freeO(self);
  43104   setTypeArrayO(self);
  43105   r = isEStringO(self, "1");
  43106   ck_assert(!r);
  43107   // non existing dict path
  43108   freeO(self);
  43109   r = isEStringO(self, "\"1\"[1]");
  43110   ck_assert(!r);
  43111   //   dict path but the object is an array
  43112   resetO(&a);
  43113   self->f->setArray(self, "1", &a);
  43114   r = isEStringO(self, "\"1\".\"1\"");
  43115   ck_assert(!r);
  43116   //   dict object in path but the key doesn't exists
  43117   resetO(&d);
  43118   self->f->setDict(self, "2", &d);
  43119   r = isEStringO(self, "\"2\".\"1\".[12]");
  43120   ck_assert(!r);
  43121   // non existing key
  43122   r = isEStringO(self, "qwe");
  43123   ck_assert(!r);
  43124   // empty dict
  43125   freeO(self);
  43126   r = isEStringO(self, "");
  43127   ck_assert(!r);
  43128   terminateO(self);
  43129 
  43130 END_TEST
  43131 
  43132 
  43133 START_TEST(isEFaststringSmallJsonT)
  43134 
  43135   bool r;
  43136   smallJsont *self = allocSmallJson();
  43137 
  43138   self->f->setInt(self, "", 1);
  43139   r = isEFaststringO(self, "");
  43140   ck_assert(!r);
  43141   // path
  43142   baset *value = (baset*) allocSmallBool(true);
  43143   createSmallArray(a);
  43144   createSmallDict(d);
  43145   a.f->pushDict(&a, &d);
  43146   self->f->setArray(self, "array", &a);
  43147   smallJsont *r2 = self->f->set(self, "\"array\"[0].\"key\"", value);
  43148   r2             = self->f->setUndefined(self, "\"array\"[0].\"s\"");
  43149   ck_assert_ptr_ne(r2, null);
  43150   finishO(value);
  43151   r = isEFaststringO(self, "\"array\"[0].\"key\"");
  43152   ck_assert(!r);
  43153   r = isEFaststringO(self, "\"array\"[0].\"s\"");
  43154   ck_assert(!r);
  43155   // json bool
  43156   freeO(self);
  43157   setTypeBoolO(self);
  43158   r = isEFaststringO(self, "1");
  43159   ck_assert(!r);
  43160   // json array
  43161   freeO(self);
  43162   setTypeArrayO(self);
  43163   r = isEFaststringO(self, "1");
  43164   ck_assert(!r);
  43165   // non existing dict path
  43166   freeO(self);
  43167   r = isEFaststringO(self, "\"1\"[1]");
  43168   ck_assert(!r);
  43169   //   dict path but the object is an array
  43170   resetO(&a);
  43171   self->f->setArray(self, "1", &a);
  43172   r = isEFaststringO(self, "\"1\".\"1\"");
  43173   ck_assert(!r);
  43174   //   dict object in path but the key doesn't exists
  43175   resetO(&d);
  43176   self->f->setDict(self, "2", &d);
  43177   r = isEFaststringO(self, "\"2\".\"1\".[12]");
  43178   ck_assert(!r);
  43179   // non existing key
  43180   r = isEFaststringO(self, "qwe");
  43181   ck_assert(!r);
  43182   // empty dict
  43183   freeO(self);
  43184   r = isEFaststringO(self, "");
  43185   ck_assert(!r);
  43186   terminateO(self);
  43187 
  43188 END_TEST
  43189 
  43190 
  43191 START_TEST(isEArraySmallJsonT)
  43192 
  43193   bool r;
  43194   smallJsont *self = allocSmallJson();
  43195 
  43196   createSmallArray(A);
  43197   self->f->setInt(self, "", 1);
  43198   self->f->setArray(self, "b", &A);
  43199   r = isEArrayO(self, "b");
  43200   ck_assert(r);
  43201   r = isEArrayO(self, "");
  43202   ck_assert(!r);
  43203   // path
  43204   baset *value = (baset*) allocSmallArray();
  43205   createSmallArray(a);
  43206   createSmallDict(d);
  43207   a.f->pushDict(&a, &d);
  43208   self->f->setArray(self, "array", &a);
  43209   smallJsont *r2 = self->f->set(self, "\"array\"[0].\"key\"", value);
  43210   r2             = self->f->setUndefined(self, "\"array\"[0].\"s\"");
  43211   ck_assert_ptr_ne(r2, null);
  43212   finishO(value);
  43213   r = isEArrayO(self, "\"array\"[0].\"key\"");
  43214   ck_assert(r);
  43215   r = isEArrayO(self, "\"array\"[0].\"s\"");
  43216   ck_assert(!r);
  43217   // json bool
  43218   freeO(self);
  43219   setTypeBoolO(self);
  43220   r = isEArrayO(self, "1");
  43221   ck_assert(!r);
  43222   // json array
  43223   freeO(self);
  43224   setTypeArrayO(self);
  43225   r = isEArrayO(self, "1");
  43226   ck_assert(!r);
  43227   // non existing dict path
  43228   freeO(self);
  43229   r = isEArrayO(self, "\"1\"[1]");
  43230   ck_assert(!r);
  43231   //   dict path but the object is an array
  43232   resetO(&a);
  43233   self->f->setArray(self, "1", &a);
  43234   r = isEArrayO(self, "\"1\".\"1\"");
  43235   ck_assert(!r);
  43236   //   dict object in path but the key doesn't exists
  43237   resetO(&d);
  43238   self->f->setDict(self, "2", &d);
  43239   r = isEArrayO(self, "\"2\".\"1\".[12]");
  43240   ck_assert(!r);
  43241   // non existing key
  43242   r = isEArrayO(self, "qwe");
  43243   ck_assert(!r);
  43244   // empty dict
  43245   freeO(self);
  43246   r = isEArrayO(self, "");
  43247   ck_assert(!r);
  43248   terminateO(self);
  43249 
  43250 END_TEST
  43251 
  43252 
  43253 START_TEST(isEBytesSmallJsonT)
  43254 
  43255   bool r;
  43256   smallJsont *self = allocSmallJson();
  43257 
  43258   createSmallBytes(b);
  43259   self->f->setInt(self, "", 1);
  43260   self->f->setSmallBytes(self, "b", &b);
  43261   r = isEBytesO(self, "b");
  43262   ck_assert(r);
  43263   r = isEBytesO(self, "");
  43264   ck_assert(!r);
  43265   // path
  43266   baset *value = (baset*) allocSmallBytes("", sizeof(""));
  43267   createSmallArray(a);
  43268   createSmallDict(d);
  43269   a.f->pushDict(&a, &d);
  43270   self->f->setArray(self, "array", &a);
  43271   smallJsont *r2 = self->f->set(self, "\"array\"[0].\"key\"", value);
  43272   r2             = self->f->setUndefined(self, "\"array\"[0].\"s\"");
  43273   ck_assert_ptr_ne(r2, null);
  43274   finishO(value);
  43275   r = isEBytesO(self, "\"array\"[0].\"key\"");
  43276   ck_assert(r);
  43277   r = isEBytesO(self, "\"array\"[0].\"s\"");
  43278   ck_assert(!r);
  43279   // json bool
  43280   freeO(self);
  43281   setTypeBoolO(self);
  43282   r = isEBytesO(self, "1");
  43283   ck_assert(!r);
  43284   // json array
  43285   freeO(self);
  43286   setTypeArrayO(self);
  43287   r = isEBytesO(self, "1");
  43288   ck_assert(!r);
  43289   // non existing dict path
  43290   freeO(self);
  43291   r = isEBytesO(self, "\"1\"[1]");
  43292   ck_assert(!r);
  43293   //   dict path but the object is an array
  43294   resetO(&a);
  43295   self->f->setArray(self, "1", &a);
  43296   r = isEBytesO(self, "\"1\".\"1\"");
  43297   ck_assert(!r);
  43298   //   dict object in path but the key doesn't exists
  43299   resetO(&d);
  43300   self->f->setDict(self, "2", &d);
  43301   r = isEBytesO(self, "\"2\".\"1\".[12]");
  43302   ck_assert(!r);
  43303   // non existing key
  43304   r = isEBytesO(self, "qwe");
  43305   ck_assert(!r);
  43306   // empty dict
  43307   freeO(self);
  43308   r = isEBytesO(self, "");
  43309   ck_assert(!r);
  43310   terminateO(self);
  43311 
  43312 END_TEST
  43313 
  43314 
  43315 START_TEST(areAllETypeSmallJsonT)
  43316 
  43317   bool r;
  43318   smallJsont *self = allocSmallJson();
  43319 
  43320   self->f->setBool(self, "a", true);
  43321   self->f->setBool(self, "b", true);
  43322   r = areAllETypeO(self, "bool");
  43323   ck_assert(r);
  43324   self->f->setInt(self, "c", 2);
  43325   r = areAllETypeO(self, "bool");
  43326   ck_assert(!r);
  43327   // null type
  43328   r = areAllETypeO(self, null);
  43329   ck_assert(!r);
  43330   // empty self
  43331   freeO(self);
  43332   setTypeDictO(self);
  43333   r = areAllETypeO(self, "bool");
  43334   ck_assert(!r);
  43335   self->f->setS(self, "a", "");
  43336   self->f->delElem(self, "a");
  43337   r = areAllETypeO(self, "string");
  43338   ck_assert(!r);
  43339   // json array
  43340   freeO(self);
  43341   // empty array
  43342   r = areAllETypeO(self, "undefined");
  43343   ck_assert(!r);
  43344   setTypeArrayO(self);
  43345   r = areAllETypeO(self, "undefined");
  43346   ck_assert(!r);
  43347   // array
  43348   self->f->pushUndefined(self);
  43349   self->f->pushUndefined(self);
  43350   self->f->pushUndefined(self);
  43351   delElemIndexO(self, 1);
  43352   r = areAllETypeO(self, "undefined");
  43353   ck_assert(!r);
  43354   trimO(self);
  43355   r = areAllETypeO(self, "undefined");
  43356   ck_assert(r);
  43357   // NULL type
  43358   r = areAllETypeO(self, NULL);
  43359   ck_assert(!r);
  43360   terminateO(self);
  43361 
  43362 END_TEST
  43363 
  43364 
  43365 START_TEST(areAllEUndefinedSmallJsonT)
  43366 
  43367   bool r;
  43368   smallJsont *self = allocSmallJson();
  43369 
  43370   // array
  43371   self->f->pushUndefined(self);
  43372   self->f->pushUndefined(self);
  43373   self->f->pushUndefined(self);
  43374   r = areAllEUndefinedO(self);
  43375   ck_assert(r);
  43376   terminateO(self);
  43377 
  43378 END_TEST
  43379 
  43380 
  43381 START_TEST(areAllEBoolSmallJsonT)
  43382 
  43383   bool r;
  43384   smallJsont *self = allocSmallJson();
  43385 
  43386   // array
  43387   self->f->pushBool(self, true);
  43388   self->f->pushBool(self, true);
  43389   self->f->pushBool(self, true);
  43390   r = areAllEBoolO(self);
  43391   ck_assert(r);
  43392   terminateO(self);
  43393 
  43394 END_TEST
  43395 
  43396 
  43397 START_TEST(areAllEContainerSmallJsonT)
  43398 
  43399   bool r;
  43400   smallJsont *self = allocSmallJson();
  43401 
  43402   createSmallContainer(c);
  43403   self->f->pushSmallContainer(self, &c);
  43404   r = areAllEContainerO(self);
  43405   ck_assert(r);
  43406   terminateO(self);
  43407 
  43408 END_TEST
  43409 
  43410 
  43411 START_TEST(areAllEDictSmallJsonT)
  43412 
  43413   bool r;
  43414   smallJsont *self = allocSmallJson();
  43415 
  43416   createSmallDict(d);
  43417   self->f->pushDict(self, &d);
  43418   r = areAllEDictO(self);
  43419   ck_assert(r);
  43420   terminateO(self);
  43421 
  43422 END_TEST
  43423 
  43424 
  43425 START_TEST(areAllEDoubleSmallJsonT)
  43426 
  43427   bool r;
  43428   smallJsont *self = allocSmallJson();
  43429 
  43430   self->f->pushDouble(self, 1);
  43431   r = areAllEDoubleO(self);
  43432   ck_assert(r);
  43433   terminateO(self);
  43434 
  43435 END_TEST
  43436 
  43437 
  43438 START_TEST(areAllEIntSmallJsonT)
  43439 
  43440   bool r;
  43441   smallJsont *self = allocSmallJson();
  43442 
  43443   self->f->pushInt(self, 1);
  43444   r = areAllEIntO(self);
  43445   ck_assert(r);
  43446   terminateO(self);
  43447 
  43448 END_TEST
  43449 
  43450 
  43451 START_TEST(areAllEStringSmallJsonT)
  43452 
  43453   bool r;
  43454   smallJsont *self = allocSmallJson();
  43455 
  43456   self->f->pushS(self, "");
  43457   r = areAllEStringO(self);
  43458   ck_assert(r);
  43459   terminateO(self);
  43460 
  43461 END_TEST
  43462 
  43463 
  43464 START_TEST(areAllEFaststringSmallJsonT)
  43465 
  43466   bool r;
  43467   smallJsont *self = allocSmallJson();
  43468 
  43469   self->f->pushS(self, "");
  43470   r = areAllEFaststringO(self);
  43471   ck_assert(!r);
  43472   terminateO(self);
  43473 
  43474 END_TEST
  43475 
  43476 
  43477 START_TEST(areAllEArraySmallJsonT)
  43478 
  43479   bool r;
  43480   smallJsont *self = allocSmallJson();
  43481 
  43482   createSmallArray(a);
  43483   self->f->pushArray(self, &a);
  43484   r = areAllEArrayO(self);
  43485   ck_assert(r);
  43486   terminateO(self);
  43487 
  43488 END_TEST
  43489 
  43490 
  43491 START_TEST(areAllEBytesSmallJsonT)
  43492 
  43493   bool r;
  43494   smallJsont *self = allocSmallJson();
  43495 
  43496   createSmallBytes(b);
  43497   self->f->pushSmallBytes(self, &b);
  43498   r = areAllEBytesO(self);
  43499   ck_assert(r);
  43500   terminateO(self);
  43501 
  43502 END_TEST
  43503 
  43504 
  43505 START_TEST(duplicateSmallJsonGT)
  43506 
  43507   smallJsont* r;
  43508   smallJsont *self = allocSmallJson();
  43509 
  43510   self->f->pushInt(self, 1);
  43511   iterStartO(self);
  43512   r = duplicateSmallJsonG(self);
  43513   char *s = toStringO(r);
  43514   ck_assert_int_eq(r->iterIndex, 0);
  43515   terminateO(r);
  43516   ck_assert_str_eq(s, "[1]");
  43517   free(s);
  43518   // with iterator
  43519   freeO(self);
  43520   self->f->setS(self, "qwe", "asd");
  43521   iterStartO(self);
  43522   r = duplicateSmallJsonG(self);
  43523   ck_assert_ptr_ne(r, null);
  43524   s = toStringO(r);
  43525   ck_assert_str_eq(s, "{\"qwe\":\"asd\"}");
  43526   free(s);
  43527   ck_assert_str_eq(r->iterKey, "qwe");
  43528   terminateO(r);
  43529   terminateO(self);
  43530 
  43531 END_TEST
  43532 
  43533 
  43534 START_TEST(freeSmallJsonGT)
  43535 
  43536   smallJsont *self = allocSmallJson();
  43537 
  43538   self->f->pushInt(self, 1);
  43539   freeSmallJsonG(self);
  43540   char *s = toStringO(self);
  43541   ck_assert_str_eq(s, "{}");
  43542   free(s);
  43543   terminateO(self);
  43544 
  43545 END_TEST
  43546 
  43547 
  43548 START_TEST(setTopSmallJsonGT)
  43549 
  43550   smallJsont* r;
  43551   smallJsont *self = allocG(rtSmallJsont);
  43552 
  43553   // value is a smallJson
  43554   // undefined
  43555   createAllocateSmallJson(js);
  43556   createUndefined(u);
  43557   setTopO(js, (baset*)&u);
  43558   r = setTopSmallJsonG(self, (baset*) js);
  43559   ck_assert_ptr_ne(r, null);
  43560   char *s = toStringO(r);
  43561   ck_assert_str_eq(s, "null");
  43562   free(s);
  43563   resetO(js);
  43564   freeO(self);
  43565   // bool
  43566   setTopBoolO(js, true);
  43567   r = setTopSmallJsonG(self, (baset*) js);
  43568   ck_assert_ptr_ne(r, null);
  43569   s = toStringO(r);
  43570   ck_assert_str_eq(s, "true");
  43571   free(s);
  43572   resetO(js);
  43573   freeO(self);
  43574   // double
  43575   setTopDoubleO(js, 2.2);
  43576   r = setTopSmallJsonG(self, (baset*) js);
  43577   ck_assert_ptr_ne(r, null);
  43578   s = toStringO(r);
  43579   ck_assert_str_eq(s, "2.200000e+00");
  43580   free(s);
  43581   resetO(js);
  43582   freeO(self);
  43583   // int
  43584   setTopIntO(js, 2);
  43585   r = setTopSmallJsonG(self, (baset*) js);
  43586   ck_assert_ptr_ne(r, null);
  43587   s = toStringO(r);
  43588   ck_assert_str_eq(s, "2");
  43589   free(s);
  43590   resetO(js);
  43591   freeO(self);
  43592   // string
  43593   setTopSO(js, "qwe");
  43594   r = setTopSmallJsonG(self, (baset*) js);
  43595   ck_assert_ptr_ne(r, null);
  43596   s = toStringO(r);
  43597   ck_assert_str_eq(s, "qwe");
  43598   free(s);
  43599   resetO(js);
  43600   freeO(self);
  43601   // dict
  43602   js->f->setS(js, "1", "2");
  43603   r = setTopSmallJsonG(self, (baset*) js);
  43604   ck_assert_ptr_ne(r, null);
  43605   s = toStringO(r);
  43606   ck_assert_str_eq(s, "{\"1\":\"2\"}");
  43607   free(s);
  43608   resetO(js);
  43609   freeO(self);
  43610   // array
  43611   js->f->pushS(js, "qwe");
  43612   r = setTopSmallJsonG(self, (baset*) js);
  43613   ck_assert_ptr_ne(r, null);
  43614   s = toStringO(r);
  43615   ck_assert_str_eq(s, "[\"qwe\"]");
  43616   free(s);
  43617   resetO(js);
  43618   terminateO(js);
  43619   terminateO(self);
  43620 
  43621 END_TEST
  43622 
  43623 
  43624 START_TEST(setTopBoolSmallJsonGT)
  43625 
  43626   smallJsont* r;
  43627   smallJsont *self = allocG(rtSmallJsont);
  43628 
  43629   r = setTopBoolSmallJsonG(self, true);
  43630   ck_assert_ptr_ne(r, null);
  43631   char *s = toStringO(r);
  43632   ck_assert_str_eq(s, "true");
  43633   free(s);
  43634   terminateO(self);
  43635 
  43636 END_TEST
  43637 
  43638 
  43639 START_TEST(setTopDoubleSmallJsonGT)
  43640 
  43641   smallJsont* r;
  43642   smallJsont *self = allocG(rtSmallJsont);
  43643 
  43644   r = setTopDoubleSmallJsonG(self, 2);
  43645   ck_assert_ptr_ne(r, null);
  43646   char *s = toStringO(r);
  43647   ck_assert_str_eq(s, "2.000000e+00");
  43648   free(s);
  43649   terminateO(self);
  43650 
  43651 END_TEST
  43652 
  43653 
  43654 START_TEST(setTopIntSmallJsonGT)
  43655 
  43656   smallJsont* r;
  43657   smallJsont *self = allocG(rtSmallJsont);
  43658 
  43659   r = setTopIntSmallJsonG(self, 2);
  43660   ck_assert_ptr_ne(r, null);
  43661   char *s = toStringO(r);
  43662   ck_assert_str_eq(s, "2");
  43663   free(s);
  43664   terminateO(self);
  43665 
  43666 END_TEST
  43667 
  43668 
  43669 START_TEST(setTopStringSmallJsonGT)
  43670 
  43671   smallJsont* r;
  43672   smallJsont *self = allocG(rtSmallJsont);
  43673 
  43674   r = setTopStringSmallJsonG(self, "qwe");
  43675   ck_assert_ptr_ne(r, null);
  43676   char *s = toStringO(r);
  43677   ck_assert_str_eq(s, "qwe");
  43678   free(s);
  43679   terminateO(self);
  43680 
  43681 END_TEST
  43682 
  43683 
  43684 START_TEST(setTopCharSmallJsonGT)
  43685 
  43686   smallJsont* r;
  43687   smallJsont *self = allocG(rtSmallJsont);
  43688 
  43689   r = setTopCharSmallJsonG(self, 'X');
  43690   ck_assert_ptr_ne(r, null);
  43691   char *s = toStringO(r);
  43692   ck_assert_str_eq(s, "X");
  43693   free(s);
  43694   terminateO(self);
  43695 
  43696 END_TEST
  43697 
  43698 
  43699 START_TEST(setTopDictSmallJsonGT)
  43700 
  43701   smallJsont* r;
  43702   smallJsont *self = allocG(rtSmallJsont);
  43703   smallDictt *value = allocSmallDict();
  43704 
  43705   r = setTopDictSmallJsonG(self, value);
  43706   ck_assert_ptr_ne(r, null);
  43707   finishG(value);
  43708   char *s = toStringO(r);
  43709   ck_assert_str_eq(s, "{}");
  43710   free(s);
  43711   terminateO(self);
  43712 
  43713 END_TEST
  43714 
  43715 
  43716 START_TEST(setTopArraySmallJsonGT)
  43717 
  43718   smallJsont* r;
  43719   smallJsont *self = allocG(rtSmallJsont);
  43720   smallArrayt *value = allocSmallArray();
  43721 
  43722   r = setTopArraySmallJsonG(self, value);
  43723   ck_assert_ptr_ne(r, null);
  43724   finishG(value);
  43725   char *s = toStringO(r);
  43726   ck_assert_str_eq(s, "[]");
  43727   free(s);
  43728   terminateO(self);
  43729 
  43730 END_TEST
  43731 
  43732 
  43733 START_TEST(setTopArraycSmallJsonGT)
  43734 
  43735   smallJsont* r;
  43736   smallJsont *self = allocG(rtSmallJsont);
  43737   char **value     = listCreateS("a","bb");
  43738 
  43739   r = setTopArraycSmallJsonG(self, value);
  43740   ck_assert_ptr_ne(r, null);
  43741   listFreeS(value);
  43742   char *s = toStringO(r);
  43743   ck_assert_str_eq(s, "[\"a\",\"bb\"]");
  43744   free(s);
  43745   terminateO(self);
  43746 
  43747 END_TEST
  43748 
  43749 
  43750 START_TEST(setTopCArraycSmallJsonGT)
  43751 
  43752   smallJsont* r;
  43753   smallJsont *self    = allocG(rtSmallJsont);
  43754   const char *value[] = {"a", "bb", null};
  43755 
  43756   r = setTopCArraycSmallJsonG(self, value);
  43757   ck_assert_ptr_ne(r, null);
  43758   char *s = toStringO(r);
  43759   ck_assert_str_eq(s, "[\"a\",\"bb\"]");
  43760   free(s);
  43761   terminateO(self);
  43762 
  43763 END_TEST
  43764 
  43765 
  43766 START_TEST(setTopSmallBoolSmallJsonGT)
  43767 
  43768   smallJsont* r;
  43769   smallJsont *self  = allocG(rtSmallJsont);
  43770   smallBoolt *value = allocSmallBool(true);
  43771 
  43772   r = setTopSmallBoolSmallJsonG(self, value);
  43773   ck_assert_ptr_ne(r, null);
  43774   finishG(value);
  43775   char *s = toStringO(r);
  43776   ck_assert_str_eq(s, "true");
  43777   free(s);
  43778   terminateO(self);
  43779 
  43780 END_TEST
  43781 
  43782 
  43783 START_TEST(setTopSmallDoubleSmallJsonGT)
  43784 
  43785   smallJsont* r;
  43786   smallJsont *self    = allocG(rtSmallJsont);
  43787   smallDoublet *value = allocSmallDouble(2);
  43788 
  43789   r = setTopSmallDoubleSmallJsonG(self, value);
  43790   ck_assert_ptr_ne(r, null);
  43791   finishG(value);
  43792   char *s = toStringO(r);
  43793   ck_assert_str_eq(s, "2.000000e+00");
  43794   free(s);
  43795   terminateO(self);
  43796 
  43797 END_TEST
  43798 
  43799 
  43800 START_TEST(setTopSmallIntSmallJsonGT)
  43801 
  43802   smallJsont* r;
  43803   smallJsont *self = allocG(rtSmallJsont);
  43804   smallIntt *value = allocSmallInt(2);
  43805 
  43806   r = setTopSmallIntSmallJsonG(self, value);
  43807   ck_assert_ptr_ne(r, null);
  43808   finishG(value);
  43809   char *s = toStringO(r);
  43810   ck_assert_str_eq(s, "2");
  43811   free(s);
  43812   terminateO(self);
  43813 
  43814 END_TEST
  43815 
  43816 
  43817 START_TEST(setTopSmallJsonSmallJsonGT)
  43818 
  43819   smallJsont* r;
  43820   smallJsont *self  = allocG(rtSmallJsont);
  43821   smallJsont *value = allocSmallJson();
  43822 
  43823   r = setTopSmallJsonSmallJsonG(self, value);
  43824   ck_assert_ptr_ne(r, null);
  43825   finishG(value);
  43826   char *s = toStringO(r);
  43827   ck_assert_str_eq(s, "{}");
  43828   free(s);
  43829   terminateO(self);
  43830 
  43831 END_TEST
  43832 
  43833 
  43834 START_TEST(setTopSmallStringSmallJsonGT)
  43835 
  43836   smallJsont* r;
  43837   smallJsont *self    = allocG(rtSmallJsont);
  43838   smallStringt *value = allocSmallString("qwe");
  43839 
  43840   r = setTopSmallStringSmallJsonG(self, value);
  43841   ck_assert_ptr_ne(r, null);
  43842   finishG(value);
  43843   char *s = toStringO(r);
  43844   ck_assert_str_eq(s, "qwe");
  43845   free(s);
  43846   terminateO(self);
  43847 
  43848 END_TEST
  43849 
  43850 
  43851 START_TEST(setTopNFreeSmallJsonGT)
  43852 
  43853   smallJsont* r;
  43854   smallJsont *self = allocG(rtSmallJsont);
  43855   baset *value     = (baset*)allocSmallInt(2);
  43856 
  43857   r = setTopNFreeSmallJsonG(self, value);
  43858   ck_assert_ptr_ne(r, null);
  43859   char *s = toStringO(r);
  43860   ck_assert_str_eq(s, "2");
  43861   free(s);
  43862   terminateO(self);
  43863 
  43864 END_TEST
  43865 
  43866 
  43867 START_TEST(setTopNFreeBoolSmallJsonGT)
  43868 
  43869   smallJsont* r;
  43870   smallJsont *self = allocG(rtSmallJsont);
  43871 
  43872   r = setTopNFreeBoolSmallJsonG(self, true);
  43873   ck_assert_ptr_ne(r, null);
  43874   char *s = toStringO(r);
  43875   ck_assert_str_eq(s, "true");
  43876   free(s);
  43877   terminateO(self);
  43878 
  43879 END_TEST
  43880 
  43881 
  43882 START_TEST(setTopNFreeDoubleSmallJsonGT)
  43883 
  43884   smallJsont* r;
  43885   smallJsont *self = allocG(rtSmallJsont);
  43886 
  43887   r = setTopNFreeDoubleSmallJsonG(self, 2);
  43888   ck_assert_ptr_ne(r, null);
  43889   char *s = toStringO(r);
  43890   ck_assert_str_eq(s, "2.000000e+00");
  43891   free(s);
  43892   terminateO(self);
  43893 
  43894 END_TEST
  43895 
  43896 
  43897 START_TEST(setTopNFreeIntSmallJsonGT)
  43898 
  43899   smallJsont* r;
  43900   smallJsont *self = allocG(rtSmallJsont);
  43901 
  43902   r = setTopNFreeIntSmallJsonG(self, 2);
  43903   ck_assert_ptr_ne(r, null);
  43904   char *s = toStringO(r);
  43905   ck_assert_str_eq(s, "2");
  43906   free(s);
  43907   terminateO(self);
  43908 
  43909 END_TEST
  43910 
  43911 
  43912 START_TEST(setTopNFreeStringSmallJsonGT)
  43913 
  43914   smallJsont* r;
  43915   smallJsont *self = allocG(rtSmallJsont);
  43916   char *value      = strdup("qwe");
  43917 
  43918   r = setTopNFreeStringSmallJsonG(self, value);
  43919   ck_assert_ptr_ne(r, null);
  43920   char *s = toStringO(r);
  43921   ck_assert_str_eq(s, "qwe");
  43922   free(s);
  43923   terminateO(self);
  43924 
  43925 END_TEST
  43926 
  43927 
  43928 START_TEST(setTopNFreeDictSmallJsonGT)
  43929 
  43930   smallJsont* r;
  43931   smallJsont *self  = allocG(rtSmallJsont);
  43932   smallDictt *value = allocSmallDict();
  43933 
  43934   r = setTopNFreeDictSmallJsonG(self, value);
  43935   ck_assert_ptr_ne(r, null);
  43936   char *s = toStringO(r);
  43937   ck_assert_str_eq(s, "{}");
  43938   free(s);
  43939   terminateO(self);
  43940 
  43941 END_TEST
  43942 
  43943 
  43944 START_TEST(setTopNFreeArraySmallJsonGT)
  43945 
  43946   smallJsont* r;
  43947   smallJsont *self   = allocG(rtSmallJsont);
  43948   smallArrayt *value = allocSmallArray();
  43949 
  43950   r = setTopNFreeArraySmallJsonG(self, value);
  43951   ck_assert_ptr_ne(r, null);
  43952   char *s = toStringO(r);
  43953   ck_assert_str_eq(s, "[]");
  43954   free(s);
  43955   terminateO(self);
  43956 
  43957 END_TEST
  43958 
  43959 
  43960 START_TEST(setTopNFreeArraycSmallJsonGT)
  43961 
  43962   smallJsont* r;
  43963   smallJsont *self = allocG(rtSmallJsont);
  43964   char **value     = listCreateS("a","bb");
  43965 
  43966   r = setTopNFreeArraycSmallJsonG(self, value);
  43967   ck_assert_ptr_ne(r, null);
  43968   char *s = toStringO(r);
  43969   ck_assert_str_eq(s, "[\"a\",\"bb\"]");
  43970   free(s);
  43971   terminateO(self);
  43972 
  43973 END_TEST
  43974 
  43975 
  43976 START_TEST(setTopNFreeSmallBoolSmallJsonGT)
  43977 
  43978   smallJsont* r;
  43979   smallJsont *self  = allocG(rtSmallJsont);
  43980   smallBoolt *value = allocSmallBool(true);
  43981 
  43982   r = setTopNFreeSmallBoolSmallJsonG(self, value);
  43983   ck_assert_ptr_ne(r, null);
  43984   char *s = toStringO(r);
  43985   ck_assert_str_eq(s, "true");
  43986   free(s);
  43987   terminateO(self);
  43988 
  43989 END_TEST
  43990 
  43991 
  43992 START_TEST(setTopNFreeSmallDoubleSmallJsonGT)
  43993 
  43994   smallJsont* r;
  43995   smallJsont *self    = allocG(rtSmallJsont);
  43996   smallDoublet *value = allocSmallDouble(2);
  43997 
  43998   r = setTopNFreeSmallDoubleSmallJsonG(self, value);
  43999   ck_assert_ptr_ne(r, null);
  44000   char *s = toStringO(r);
  44001   ck_assert_str_eq(s, "2.000000e+00");
  44002   free(s);
  44003   terminateO(self);
  44004 
  44005 END_TEST
  44006 
  44007 
  44008 START_TEST(setTopNFreeSmallIntSmallJsonGT)
  44009 
  44010   smallJsont* r;
  44011   smallJsont *self = allocG(rtSmallJsont);
  44012   smallIntt *value = allocSmallInt(2);
  44013 
  44014   r = setTopNFreeSmallIntSmallJsonG(self, value);
  44015   ck_assert_ptr_ne(r, null);
  44016   char *s = toStringO(r);
  44017   ck_assert_str_eq(s, "2");
  44018   free(s);
  44019   terminateO(self);
  44020 
  44021 END_TEST
  44022 
  44023 
  44024 START_TEST(setTopNFreeSmallJsonSmallJsonGT)
  44025 
  44026   smallJsont* r;
  44027   smallJsont *self  = allocG(rtSmallJsont);
  44028   smallJsont *value = allocSmallJson();
  44029 
  44030   r = setTopNFreeSmallJsonSmallJsonG(self, value);
  44031   ck_assert_ptr_ne(r, null);
  44032   char *s = toStringO(r);
  44033   ck_assert_str_eq(s, "{}");
  44034   free(s);
  44035   terminateO(self);
  44036 
  44037 END_TEST
  44038 
  44039 
  44040 START_TEST(setTopNFreeSmallStringSmallJsonGT)
  44041 
  44042   smallJsont* r;
  44043   smallJsont *self    = allocG(rtSmallJsont);
  44044   smallStringt *value = allocSmallString("qwe");
  44045 
  44046   r = setTopNFreeSmallStringSmallJsonG(self, value);
  44047   ck_assert_ptr_ne(r, null);
  44048   char *s = toStringO(r);
  44049   ck_assert_str_eq(s, "qwe");
  44050   free(s);
  44051   terminateO(self);
  44052 
  44053 END_TEST
  44054 
  44055 
  44056 START_TEST(fromArraySmallJsonGT)
  44057 
  44058   smallJsont* r;
  44059   smallJsont *self = allocSmallJson();
  44060 
  44061   char *array[] = {"1", "22", "333"};
  44062   r = fromArraySmallJsonG(self, array, 3);
  44063   ck_assert_ptr_ne(r, NULL);
  44064   char *s = toStringO(r);
  44065   ck_assert_str_eq(s, "[\"1\",\"22\",\"333\"]");
  44066   free(s);
  44067   terminateO(self);
  44068 
  44069 END_TEST
  44070 
  44071 
  44072 START_TEST(fromCArraySmallJsonGT)
  44073 
  44074   smallJsont* r;
  44075   smallJsont *self = allocSmallJson();
  44076 
  44077   const char *array[] = {"1", "22", "333"};
  44078   r = fromCArraySmallJsonG(self, array, 3);
  44079   ck_assert_ptr_ne(r, NULL);
  44080   char *s = toStringO(r);
  44081   ck_assert_str_eq(s, "[\"1\",\"22\",\"333\"]");
  44082   free(s);
  44083   terminateO(self);
  44084 
  44085 END_TEST
  44086 
  44087 
  44088 START_TEST(getTopSmallJsonGT)
  44089 
  44090   baset*        r;
  44091   smallJsont *self = allocG(rtSmallJsont);
  44092 
  44093   setTopIntO(self, 987);
  44094   r = getTopSmallJsonG(self, null);
  44095   ck_assert_ptr_ne(r, null);
  44096   ck_assert_str_eq(r->type, "smallInt");
  44097   finishO(r);
  44098   terminateO(self);
  44099 
  44100 END_TEST
  44101 
  44102 
  44103 START_TEST(getTopUndefinedSmallJsonGT)
  44104 
  44105   undefinedt*   r  = allocUndefined();;
  44106   smallJsont *self = allocG(rtSmallJsont);
  44107 
  44108   setTopO(self, (baset*) r);
  44109   finishO(r);
  44110   r = getTopUndefinedSmallJsonG(self, null);
  44111   ck_assert_ptr_ne(r, null);
  44112   char *s = toStringO(r);
  44113   finishO(r);
  44114   ck_assert_str_eq(s, "null");
  44115   free(s);
  44116   terminateO(self);
  44117 
  44118 END_TEST
  44119 
  44120 
  44121 START_TEST(getTopBoolSmallJsonGT)
  44122 
  44123   bool          r;
  44124   smallJsont *self = allocG(rtSmallJsont);
  44125 
  44126   setTopBoolO(self, true);
  44127   r = getTopBoolSmallJsonG(self, true);
  44128   ck_assert(r);
  44129   terminateO(self);
  44130 
  44131 END_TEST
  44132 
  44133 
  44134 START_TEST(getTopBoolPSmallJsonGT)
  44135 
  44136   bool*         r;
  44137   smallJsont *self = allocG(rtSmallJsont);
  44138 
  44139   setTopBoolO(self, true);
  44140   r = getTopBoolPSmallJsonG(self, null);
  44141   ck_assert_ptr_ne(r, null);
  44142   ck_assert(*r);
  44143   terminateO(self);
  44144 
  44145 END_TEST
  44146 
  44147 
  44148 START_TEST(getTopDoubleSmallJsonGT)
  44149 
  44150   double        r;
  44151   smallJsont *self = allocG(rtSmallJsont);
  44152 
  44153   setTopDoubleO(self, 2);
  44154   r = getTopDoubleSmallJsonG(self, 0);
  44155   ck_assert(r==2);
  44156   terminateO(self);
  44157 
  44158 END_TEST
  44159 
  44160 
  44161 START_TEST(getTopDoublePSmallJsonGT)
  44162 
  44163   double*       r;
  44164   smallJsont *self = allocG(rtSmallJsont);
  44165 
  44166   setTopDoubleO(self, 2);
  44167   r = getTopDoublePSmallJsonG(self, null);
  44168   ck_assert_ptr_ne(r, null);
  44169   ck_assert(*r==2);
  44170   terminateO(self);
  44171 
  44172 END_TEST
  44173 
  44174 
  44175 START_TEST(getTopIntSmallJsonGT)
  44176 
  44177   int64_t       r;
  44178   smallJsont *self = allocG(rtSmallJsont);
  44179 
  44180   setTopIntO(self, 3);
  44181   r = getTopIntSmallJsonG(self, 0);
  44182   ck_assert_int_eq(r, 3);
  44183   terminateO(self);
  44184 
  44185 END_TEST
  44186 
  44187 
  44188 START_TEST(getTopIntPSmallJsonGT)
  44189 
  44190   int64_t*      r;
  44191   smallJsont *self = allocG(rtSmallJsont);
  44192 
  44193   setTopIntO(self, 3);
  44194   r = getTopIntPSmallJsonG(self, null);
  44195   ck_assert_ptr_ne(r, null);
  44196   ck_assert_int_eq(*r, 3);
  44197   terminateO(self);
  44198 
  44199 END_TEST
  44200 
  44201 
  44202 START_TEST(getTopInt32SmallJsonGT)
  44203 
  44204   int32_t       r;
  44205   smallJsont *self = allocG(rtSmallJsont);
  44206 
  44207   setTopIntO(self, 3);
  44208   r = getTopInt32SmallJsonG(self, 0);
  44209   ck_assert_int_eq(r, 3);
  44210   terminateO(self);
  44211 
  44212 END_TEST
  44213 
  44214 
  44215 START_TEST(getTopInt32PSmallJsonGT)
  44216 
  44217   int32_t*      r;
  44218   smallJsont *self = allocG(rtSmallJsont);
  44219 
  44220   setTopIntO(self, 3);
  44221   r = getTopInt32PSmallJsonG(self, null);
  44222   ck_assert_ptr_ne(r, null);
  44223   ck_assert_int_eq(*r, 3);
  44224   terminateO(self);
  44225 
  44226 END_TEST
  44227 
  44228 
  44229 START_TEST(getTopUintSmallJsonGT)
  44230 
  44231   uint64_t      r;
  44232   smallJsont *self = allocG(rtSmallJsont);
  44233 
  44234   setTopIntO(self, 3);
  44235   r = getTopUintSmallJsonG(self, 0);
  44236   ck_assert_int_eq(r, 3);
  44237   terminateO(self);
  44238 
  44239 END_TEST
  44240 
  44241 
  44242 START_TEST(getTopUintPSmallJsonGT)
  44243 
  44244   uint64_t*     r;
  44245   smallJsont *self = allocG(rtSmallJsont);
  44246 
  44247   setTopIntO(self, 3);
  44248   r = getTopUintPSmallJsonG(self, null);
  44249   ck_assert_ptr_ne(r, null);
  44250   ck_assert_int_eq(*r, 3);
  44251   terminateO(self);
  44252 
  44253 END_TEST
  44254 
  44255 
  44256 START_TEST(getTopUint32SmallJsonGT)
  44257 
  44258   uint32_t      r;
  44259   smallJsont *self = allocG(rtSmallJsont);
  44260 
  44261   setTopIntO(self, 3);
  44262   r = getTopUint32SmallJsonG(self, 0);
  44263   ck_assert_int_eq(r, 3);
  44264   terminateO(self);
  44265 
  44266 END_TEST
  44267 
  44268 
  44269 START_TEST(getTopUint32PSmallJsonGT)
  44270 
  44271   uint32_t*     r;
  44272   smallJsont *self = allocG(rtSmallJsont);
  44273 
  44274   setTopIntO(self, 3);
  44275   r = getTopUint32PSmallJsonG(self, null);
  44276   ck_assert_ptr_ne(r, null);
  44277   ck_assert_int_eq(*r, 3);
  44278   terminateO(self);
  44279 
  44280 END_TEST
  44281 
  44282 
  44283 START_TEST(getTopSSmallJsonGT)
  44284 
  44285   char*         r;
  44286   smallJsont *self = allocG(rtSmallJsont);
  44287 
  44288   setTopStringO(self, "qwe");
  44289   r = getTopSSmallJsonG(self, null);
  44290   ck_assert_ptr_ne(r, null);
  44291   ck_assert_str_eq(r, "qwe");
  44292   terminateO(self);
  44293 
  44294 END_TEST
  44295 
  44296 
  44297 START_TEST(getTopDictSmallJsonGT)
  44298 
  44299   smallDictt*   r  = allocSmallDict();
  44300   smallJsont *self = allocG(rtSmallJsont);
  44301 
  44302   setTopNFreeDictO(self, r);
  44303   r = getTopDictSmallJsonG(self, null);
  44304   ck_assert_ptr_ne(r, null);
  44305   char *s = toStringO(r);
  44306   finishO(r);
  44307   ck_assert_str_eq(s, "{}");
  44308   free(s);
  44309   terminateO(self);
  44310 
  44311 END_TEST
  44312 
  44313 
  44314 START_TEST(getTopArraySmallJsonGT)
  44315 
  44316   smallArrayt*  r  = allocSmallArray();
  44317   smallJsont *self = allocG(rtSmallJsont);
  44318 
  44319   setTopNFreeArrayO(self, r);
  44320   r = getTopArraySmallJsonG(self, null);
  44321   ck_assert_ptr_ne(r, null);
  44322   char *s = toStringO(r);
  44323   finishO(r);
  44324   ck_assert_str_eq(s, "[]");
  44325   free(s);
  44326   terminateO(self);
  44327 
  44328 END_TEST
  44329 
  44330 
  44331 START_TEST(getTopSmallBoolSmallJsonGT)
  44332 
  44333   smallBoolt*   r  = allocSmallBool(true);
  44334   smallJsont *self = allocG(rtSmallJsont);
  44335 
  44336   setTopNFreeSmallBoolO(self, r);
  44337   r = getTopSmallBoolSmallJsonG(self, null);
  44338   ck_assert_ptr_ne(r, null);
  44339   char *s = toStringO(r);
  44340   finishO(r);
  44341   ck_assert_str_eq(s, "true");
  44342   free(s);
  44343   terminateO(self);
  44344 
  44345 END_TEST
  44346 
  44347 
  44348 START_TEST(getTopSmallDoubleSmallJsonGT)
  44349 
  44350   smallDoublet* r  = allocSmallDouble(2);
  44351   smallJsont *self = allocG(rtSmallJsont);
  44352 
  44353   setTopNFreeSmallDoubleO(self, r);
  44354   r = getTopSmallDoubleSmallJsonG(self, null);
  44355   ck_assert_ptr_ne(r, null);
  44356   char *s = toStringO(r);
  44357   finishO(r);
  44358   ck_assert_str_eq(s, "2.000000e+00");
  44359   free(s);
  44360   terminateO(self);
  44361 
  44362 END_TEST
  44363 
  44364 
  44365 START_TEST(getTopSmallIntSmallJsonGT)
  44366 
  44367   smallIntt*    r  = allocSmallInt(2);
  44368   smallJsont *self = allocG(rtSmallJsont);
  44369 
  44370   setTopNFreeSmallIntO(self, r);
  44371   r = getTopSmallIntSmallJsonG(self, null);
  44372   ck_assert_ptr_ne(r, null);
  44373   char *s = toStringO(r);
  44374   finishO(r);
  44375   ck_assert_str_eq(s, "2");
  44376   free(s);
  44377   terminateO(self);
  44378 
  44379 END_TEST
  44380 
  44381 
  44382 START_TEST(getTopSmallStringSmallJsonGT)
  44383 
  44384   smallStringt* r  = allocSmallString("qwe");
  44385   smallJsont *self = allocG(rtSmallJsont);
  44386 
  44387   setTopNFreeSmallStringO(self, r);
  44388   r = getTopSmallStringSmallJsonG(self, null);
  44389   ck_assert_ptr_ne(r, null);
  44390   char *s = toStringO(r);
  44391   finishO(r);
  44392   ck_assert_str_eq(s, "qwe");
  44393   free(s);
  44394   terminateO(self);
  44395 
  44396 END_TEST
  44397 
  44398 
  44399 START_TEST(pushSmallJsonGT)
  44400 
  44401   smallJsont* r;
  44402   smallJsont *self = allocSmallJson();
  44403   baset *value = (baset*) allocSmallInt(1);
  44404 
  44405   r = pushSmallJsonG(self, value);
  44406   ck_assert_ptr_ne(r, null);
  44407   finishO(value);
  44408   char *s = toStringO(r);
  44409   ck_assert_str_eq(s, "[1]");
  44410   free(s);
  44411   terminateO(self);
  44412 
  44413 END_TEST
  44414 
  44415 
  44416 START_TEST(pushUndefinedSmallJsonGT)
  44417 
  44418   smallJsont* r;
  44419   smallJsont *self = allocSmallJson();
  44420 
  44421   r = pushUndefinedSmallJsonG(self, NULL);
  44422   ck_assert_ptr_ne(r, null);
  44423   char *s = toStringO(r);
  44424   ck_assert_str_eq(s, "[null]");
  44425   free(s);
  44426   terminateO(self);
  44427 
  44428 END_TEST
  44429 
  44430 
  44431 START_TEST(pushBoolSmallJsonGT)
  44432 
  44433   smallJsont* r;
  44434   smallJsont *self = allocSmallJson();
  44435 
  44436   r = pushBoolSmallJsonG(self, true);
  44437   ck_assert_ptr_ne(r, null);
  44438   char *s = toStringO(r);
  44439   ck_assert_str_eq(s, "[true]");
  44440   free(s);
  44441   terminateO(self);
  44442 
  44443 END_TEST
  44444 
  44445 
  44446 START_TEST(pushDoubleSmallJsonGT)
  44447 
  44448   smallJsont* r;
  44449   smallJsont *self = allocSmallJson();
  44450 
  44451   r = pushDoubleSmallJsonG(self, 1);
  44452   ck_assert_ptr_ne(r, null);
  44453   char *s = toStringO(r);
  44454   ck_assert_str_eq(s, "[1.000000e+00]");
  44455   free(s);
  44456   terminateO(self);
  44457 
  44458 END_TEST
  44459 
  44460 
  44461 START_TEST(pushIntSmallJsonGT)
  44462 
  44463   smallJsont* r;
  44464   smallJsont *self = allocSmallJson();
  44465 
  44466   r = pushIntSmallJsonG(self, 1);
  44467   ck_assert_ptr_ne(r, null);
  44468   char *s = toStringO(r);
  44469   ck_assert_str_eq(s, "[1]");
  44470   free(s);
  44471   terminateO(self);
  44472 
  44473 END_TEST
  44474 
  44475 
  44476 START_TEST(pushSSmallJsonGT)
  44477 
  44478   smallJsont* r;
  44479   smallJsont *self = allocSmallJson();
  44480 
  44481   r = pushSSmallJsonG(self, "qwe");
  44482   ck_assert_ptr_ne(r, null);
  44483   char *s = toStringO(r);
  44484   ck_assert_str_eq(s, "[\"qwe\"]");
  44485   free(s);
  44486   terminateO(self);
  44487 
  44488 END_TEST
  44489 
  44490 
  44491 START_TEST(pushCharSmallJsonGT)
  44492 
  44493   smallJsont* r;
  44494   smallJsont *self = allocSmallJson();
  44495 
  44496   r = pushCharSmallJsonG(self, 'Q');
  44497   ck_assert_ptr_ne(r, null);
  44498   char *s = toStringO(r);
  44499   ck_assert_str_eq(s, "[\"Q\"]");
  44500   free(s);
  44501   terminateO(self);
  44502 
  44503 END_TEST
  44504 
  44505 
  44506 START_TEST(pushDictSmallJsonGT)
  44507 
  44508   smallJsont* r;
  44509   smallJsont *self = allocSmallJson();
  44510   smallDictt *dict  = allocSmallDict();
  44511 
  44512   r = pushDictSmallJsonG(self, dict);
  44513   ck_assert_ptr_ne(r, null);
  44514   finishO(dict);
  44515   char *s = toStringO(r);
  44516   ck_assert_str_eq(s, "[{}]");
  44517   free(s);
  44518   terminateO(self);
  44519 
  44520 END_TEST
  44521 
  44522 
  44523 START_TEST(pushArraySmallJsonGT)
  44524 
  44525   smallJsont* r;
  44526   smallJsont *self  = allocSmallJson();
  44527   smallArrayt *array = allocSmallArray();
  44528 
  44529   r = pushArraySmallJsonG(self, array);
  44530   ck_assert_ptr_ne(r, null);
  44531   finishO(array);
  44532   char *s = toStringO(r);
  44533   ck_assert_str_eq(s, "[[]]");
  44534   free(s);
  44535   terminateO(self);
  44536 
  44537 END_TEST
  44538 
  44539 
  44540 START_TEST(pushArraycSmallJsonGT)
  44541 
  44542   smallJsont* r;
  44543   smallJsont *self = allocSmallJson();
  44544   char **array      = listCreateS("a","bb");
  44545 
  44546   r = pushArraycSmallJsonG(self, array);
  44547   ck_assert_ptr_ne(r, null);
  44548   ck_assert_int_eq(lenO(r), 1);
  44549   listFreeS(array);
  44550   char *s = toStringO(r);
  44551   ck_assert_str_eq(s, "[[\"a\",\"bb\"]]");
  44552   free(s);
  44553   terminateO(self);
  44554 
  44555 END_TEST
  44556 
  44557 
  44558 START_TEST(pushCArraycSmallJsonGT)
  44559 
  44560   smallJsont* r;
  44561   smallJsont *self   = allocSmallJson();
  44562   const char *array[] = {"a", "bb", NULL};
  44563 
  44564   r = pushCArraycSmallJsonG(self, array);
  44565   ck_assert_ptr_ne(r, null);
  44566   ck_assert_int_eq(lenO(r), 1);
  44567   char *s = toStringO(r);
  44568   ck_assert_str_eq(s, "[[\"a\",\"bb\"]]");
  44569   free(s);
  44570   terminateO(self);
  44571 
  44572 END_TEST
  44573 
  44574 
  44575 START_TEST(pushVoidSmallJsonGT)
  44576 
  44577   smallJsont* r;
  44578   smallJsont *self = allocSmallJson();
  44579 
  44580   // NULL value
  44581   r = pushVoidSmallJsonG(self, NULL);
  44582   ck_assert_ptr_ne(r, null);
  44583   char *s = toStringO(r);
  44584   ck_assert_str_eq(s, "[null]");
  44585   free(s);
  44586   // value
  44587   r = pushVoidSmallJsonG(self, r);
  44588   s = toStringO(r);
  44589   ck_assert_str_eq(s, "[null,\"<data container>\"]");
  44590   free(s);
  44591   terminateO(self);
  44592 
  44593 END_TEST
  44594 
  44595 
  44596 START_TEST(pushSmallBoolSmallJsonGT)
  44597 
  44598   smallJsont* r;
  44599   smallJsont *self = allocSmallJson();
  44600   smallBoolt *value = allocSmallBool(true);
  44601 
  44602   r = pushSmallBoolSmallJsonG(self, value);
  44603   ck_assert_ptr_ne(r, null);
  44604   finishO(value);
  44605   char *s = toStringO(r);
  44606   ck_assert_str_eq(s, "[true]");
  44607   free(s);
  44608   terminateO(self);
  44609 
  44610 END_TEST
  44611 
  44612 
  44613 START_TEST(pushSmallBytesSmallJsonGT)
  44614 
  44615   smallJsont* r;
  44616   smallJsont *self = allocSmallJson();
  44617   smallBytest *value = allocSmallBytes("qwe", 3);
  44618 
  44619   r = pushSmallBytesSmallJsonG(self, value);
  44620   ck_assert_ptr_ne(r, null);
  44621   finishO(value);
  44622   char *s = toStringO(r);
  44623   ck_assert_str_eq(s, "[[0x71,0x77,0x65]]");
  44624   free(s);
  44625   terminateO(self);
  44626 
  44627 END_TEST
  44628 
  44629 
  44630 START_TEST(pushSmallDoubleSmallJsonGT)
  44631 
  44632   smallJsont* r;
  44633   smallJsont *self = allocSmallJson();
  44634   smallDoublet *value = allocSmallDouble(1);
  44635 
  44636   r = pushSmallDoubleSmallJsonG(self, value);
  44637   ck_assert_ptr_ne(r, null);
  44638   finishO(value);
  44639   char *s = toStringO(r);
  44640   ck_assert_str_eq(s, "[1.000000e+00]");
  44641   free(s);
  44642   terminateO(self);
  44643 
  44644 END_TEST
  44645 
  44646 
  44647 START_TEST(pushSmallIntSmallJsonGT)
  44648 
  44649   smallJsont* r;
  44650   smallJsont *self = allocSmallJson();
  44651   smallIntt *value  = allocSmallInt(1);
  44652 
  44653   r = pushSmallIntSmallJsonG(self, value);
  44654   ck_assert_ptr_ne(r, null);
  44655   finishO(value);
  44656   char *s = toStringO(r);
  44657   ck_assert_str_eq(s, "[1]");
  44658   free(s);
  44659   terminateO(self);
  44660 
  44661 END_TEST
  44662 
  44663 
  44664 START_TEST(pushSmallJsonSmallJsonGT)
  44665 
  44666   smallJsont* r;
  44667   smallJsont *self = allocSmallJson();
  44668   smallJsont *value = allocSmallJson();
  44669 
  44670   r = pushSmallJsonSmallJsonG(self, value);
  44671   ck_assert_ptr_ne(r, null);
  44672   finishO(value);
  44673   char *s = toStringO(r);
  44674   ck_assert_str_eq(s, "[{}]");
  44675   free(s);
  44676   terminateO(self);
  44677 
  44678 END_TEST
  44679 
  44680 
  44681 START_TEST(pushSmallStringSmallJsonGT)
  44682 
  44683   smallJsont* r;
  44684   smallJsont *self    = allocSmallJson();
  44685   smallStringt *string = allocSmallString("qwe");
  44686 
  44687   r = pushSmallStringSmallJsonG(self, string);
  44688   ck_assert_ptr_ne(r, null);
  44689   finishO(string);
  44690   char *s = toStringO(r);
  44691   ck_assert_str_eq(s, "[\"qwe\"]");
  44692   free(s);
  44693   terminateO(self);
  44694 
  44695 END_TEST
  44696 
  44697 
  44698 START_TEST(pushSmallContainerSmallJsonGT)
  44699 
  44700   smallJsont* r;
  44701   smallJsont *self = allocSmallJson();
  44702 
  44703   createSmallContainer(c);
  44704   r = pushSmallContainerSmallJsonG(self, &c);
  44705   ck_assert_ptr_ne(r, null);
  44706   char *s = toStringO(r);
  44707   ck_assert_str_eq(s, "[\"<data container>\"]");
  44708   free(s);
  44709   terminateO(self);
  44710 
  44711 END_TEST
  44712 
  44713 
  44714 START_TEST(pushNFreeSmallJsonGT)
  44715 
  44716   smallJsont* r;
  44717   smallJsont *self = allocSmallJson();
  44718   baset *value = (baset*) allocSmallInt(1);
  44719 
  44720   r = pushNFreeSmallJsonG(self, value);
  44721   ck_assert_ptr_ne(r, null);
  44722   char *s = toStringO(r);
  44723   ck_assert_str_eq(s, "[1]");
  44724   free(s);
  44725   terminateO(self);
  44726 
  44727 END_TEST
  44728 
  44729 
  44730 START_TEST(pushNFreeUndefinedSmallJsonGT)
  44731 
  44732   smallJsont* r;
  44733   smallJsont *self = allocSmallJson();
  44734   undefinedt *value = allocUndefined();
  44735 
  44736   r = pushNFreeUndefinedSmallJsonG(self, value);
  44737   ck_assert_ptr_ne(r, null);
  44738   char *s = toStringO(r);
  44739   ck_assert_str_eq(s, "[null]");
  44740   free(s);
  44741   terminateO(self);
  44742 
  44743 END_TEST
  44744 
  44745 
  44746 START_TEST(pushNFreeSSmallJsonGT)
  44747 
  44748   smallJsont* r;
  44749   smallJsont *self = allocSmallJson();
  44750 
  44751   r = pushNFreeSSmallJsonG(self, strdup("qwe"));
  44752   ck_assert_ptr_ne(r, null);
  44753   char *s = toStringO(r);
  44754   ck_assert_str_eq(s, "[\"qwe\"]");
  44755   free(s);
  44756   terminateO(self);
  44757 
  44758 END_TEST
  44759 
  44760 
  44761 START_TEST(pushNFreeDictSmallJsonGT)
  44762 
  44763   smallJsont* r;
  44764   smallJsont *self = allocSmallJson();
  44765   smallDictt *dict  = allocSmallDict();
  44766 
  44767   r = pushNFreeDictSmallJsonG(self, dict);
  44768   ck_assert_ptr_ne(r, null);
  44769   char *s = toStringO(r);
  44770   ck_assert_str_eq(s, "[{}]");
  44771   free(s);
  44772   terminateO(self);
  44773 
  44774 END_TEST
  44775 
  44776 
  44777 START_TEST(pushNFreeArraySmallJsonGT)
  44778 
  44779   smallJsont* r;
  44780   smallJsont *self  = allocSmallJson();
  44781   smallArrayt *array = allocSmallArray();
  44782 
  44783   r = pushNFreeArraySmallJsonG(self, array);
  44784   ck_assert_ptr_ne(r, null);
  44785   char *s = toStringO(r);
  44786   ck_assert_str_eq(s, "[[]]");
  44787   free(s);
  44788   terminateO(self);
  44789 
  44790 END_TEST
  44791 
  44792 
  44793 START_TEST(pushNFreeArraycSmallJsonGT)
  44794 
  44795   smallJsont* r;
  44796   smallJsont *self = allocSmallJson();
  44797   char **array      = listCreateS("a","bb");
  44798 
  44799   r = pushNFreeArraycSmallJsonG(self, array);
  44800   ck_assert_ptr_ne(r, null);
  44801   ck_assert_int_eq(lenO(r), 1);
  44802   char *s = toStringO(r);
  44803   ck_assert_str_eq(s, "[[\"a\",\"bb\"]]");
  44804   free(s);
  44805   terminateO(self);
  44806 
  44807 END_TEST
  44808 
  44809 
  44810 START_TEST(pushNFreeSmallBoolSmallJsonGT)
  44811 
  44812   smallJsont* r;
  44813   smallJsont *self = allocSmallJson();
  44814   smallBoolt *value = allocSmallBool(true);
  44815 
  44816   r = pushNFreeSmallBoolSmallJsonG(self, value);
  44817   ck_assert_ptr_ne(r, null);
  44818   char *s = toStringO(r);
  44819   ck_assert_str_eq(s, "[true]");
  44820   free(s);
  44821   terminateO(self);
  44822 
  44823 END_TEST
  44824 
  44825 
  44826 START_TEST(pushNFreeSmallBytesSmallJsonGT)
  44827 
  44828   smallJsont* r;
  44829   smallJsont *self = allocSmallJson();
  44830   smallBytest *value = allocSmallBytes("qwe", 3);
  44831 
  44832   r = pushNFreeSmallBytesSmallJsonG(self, value);
  44833   ck_assert_ptr_ne(r, null);
  44834   char *s = toStringO(r);
  44835   ck_assert_str_eq(s, "[[0x71,0x77,0x65]]");
  44836   free(s);
  44837   terminateO(self);
  44838 
  44839 END_TEST
  44840 
  44841 
  44842 START_TEST(pushNFreeSmallDoubleSmallJsonGT)
  44843 
  44844   smallJsont* r;
  44845   smallJsont *self = allocSmallJson();
  44846   smallDoublet *value = allocSmallDouble(1);
  44847 
  44848   r = pushNFreeSmallDoubleSmallJsonG(self, value);
  44849   ck_assert_ptr_ne(r, null);
  44850   char *s = toStringO(r);
  44851   ck_assert_str_eq(s, "[1.000000e+00]");
  44852   free(s);
  44853   terminateO(self);
  44854 
  44855 END_TEST
  44856 
  44857 
  44858 START_TEST(pushNFreeSmallIntSmallJsonGT)
  44859 
  44860   smallJsont* r;
  44861   smallJsont *self = allocSmallJson();
  44862   smallIntt *value  = allocSmallInt(1);
  44863 
  44864   r = pushNFreeSmallIntSmallJsonG(self, value);
  44865   ck_assert_ptr_ne(r, null);
  44866   char *s = toStringO(r);
  44867   ck_assert_str_eq(s, "[1]");
  44868   free(s);
  44869   terminateO(self);
  44870 
  44871 END_TEST
  44872 
  44873 
  44874 START_TEST(pushNFreeSmallJsonSmallJsonGT)
  44875 
  44876   smallJsont* r;
  44877   smallJsont *self = allocSmallJson();
  44878   smallJsont *value = allocSmallJson();
  44879 
  44880   r = pushNFreeSmallJsonSmallJsonG(self, value);
  44881   ck_assert_ptr_ne(r, null);
  44882   char *s = toStringO(r);
  44883   ck_assert_str_eq(s, "[{}]");
  44884   free(s);
  44885   terminateO(self);
  44886 
  44887 END_TEST
  44888 
  44889 
  44890 START_TEST(pushNFreeSmallStringSmallJsonGT)
  44891 
  44892   smallJsont* r;
  44893   smallJsont *self = allocSmallJson();
  44894   smallStringt *string = allocSmallString("qwe");
  44895 
  44896   r = pushNFreeSmallStringSmallJsonG(self, string);
  44897   ck_assert_ptr_ne(r, null);
  44898   char *s = toStringO(r);
  44899   ck_assert_str_eq(s, "[\"qwe\"]");
  44900   free(s);
  44901   terminateO(self);
  44902 
  44903 END_TEST
  44904 
  44905 
  44906 START_TEST(pushNFreeSmallContainerSmallJsonGT)
  44907 
  44908   smallJsont* r;
  44909   smallJsont *self = allocSmallJson();
  44910 
  44911   createAllocateSmallContainer(c);
  44912   r = pushNFreeSmallContainerSmallJsonG(self, c);
  44913   ck_assert_ptr_ne(r, null);
  44914   char *s = toStringO(r);
  44915   ck_assert_str_eq(s, "[\"<data container>\"]");
  44916   free(s);
  44917   terminateO(self);
  44918 
  44919 END_TEST
  44920 
  44921 
  44922 START_TEST(popSmallJsonGT)
  44923 
  44924   baset*           r;
  44925   smallJsont *self = allocSmallJson();
  44926 
  44927   smallJsont *r2   = self->f->pushInt(self, 1);
  44928   ck_assert_ptr_ne(r2, null);
  44929   r = popSmallJsonG(self, NULL);
  44930   ck_assert_ptr_ne(r, null);
  44931   char *s = toStringO(r);
  44932   terminateO(r);
  44933   ck_assert_str_eq(s, "1");
  44934   free(s);
  44935   terminateO(self);
  44936 
  44937 END_TEST
  44938 
  44939 
  44940 START_TEST(popUndefinedSmallJsonGT)
  44941 
  44942   undefinedt*      r;
  44943   smallJsont *self = allocSmallJson();
  44944 
  44945   smallJsont *r2   = self->f->pushUndefined(self);
  44946   ck_assert_ptr_ne(r2, null);
  44947   r = popUndefinedSmallJsonG(self, null);
  44948   ck_assert_ptr_ne(r, null);
  44949   char *s = toStringO(r);
  44950   terminateO(r);
  44951   ck_assert_str_eq(s, "null");
  44952   free(s);
  44953   terminateO(self);
  44954 
  44955 END_TEST
  44956 
  44957 
  44958 START_TEST(popBoolSmallJsonGT)
  44959 
  44960   bool             r;
  44961   smallJsont *self = allocSmallJson();
  44962 
  44963   smallJsont *r2   = self->f->pushBool(self, TRUE);
  44964   ck_assert_ptr_ne(r2, null);
  44965   r = popBoolSmallJsonG(self, null);
  44966   ck_assert(r);
  44967   terminateO(self);
  44968 
  44969 END_TEST
  44970 
  44971 
  44972 START_TEST(popDoubleSmallJsonGT)
  44973 
  44974   double           r;
  44975   smallJsont *self = allocSmallJson();
  44976 
  44977   smallJsont *r2   = self->f->pushDouble(self, 2.0);
  44978   ck_assert_ptr_ne(r2, null);
  44979   r = popDoubleSmallJsonG(self, 0);
  44980   ck_assert(r==2.0);
  44981   terminateO(self);
  44982 
  44983 END_TEST
  44984 
  44985 
  44986 START_TEST(popIntSmallJsonGT)
  44987 
  44988   int64_t          r;
  44989   smallJsont *self = allocSmallJson();
  44990 
  44991   smallJsont *r2   = self->f->pushInt(self, 2);
  44992   ck_assert_ptr_ne(r2, null);
  44993   r = popIntSmallJsonG(self, 0);
  44994   ck_assert_int_eq(r, 2);
  44995   terminateO(self);
  44996 
  44997 END_TEST
  44998 
  44999 
  45000 START_TEST(popInt32SmallJsonGT)
  45001 
  45002   int32_t          r;
  45003   smallJsont *self = allocSmallJson();
  45004 
  45005   smallJsont *r2   = self->f->pushInt(self, 2);
  45006   ck_assert_ptr_ne(r2, null);
  45007   r = popInt32SmallJsonG(self, 0);
  45008   ck_assert_int_eq(r, 2);
  45009   terminateO(self);
  45010 
  45011 END_TEST
  45012 
  45013 
  45014 START_TEST(popUintSmallJsonGT)
  45015 
  45016   uint64_t         r;
  45017   smallJsont *self = allocSmallJson();
  45018 
  45019   smallJsont *r2   = self->f->pushInt(self, 2);
  45020   ck_assert_ptr_ne(r2, null);
  45021   r = popUintSmallJsonG(self, 0);
  45022   ck_assert_int_eq(r, 2);
  45023   terminateO(self);
  45024 
  45025 END_TEST
  45026 
  45027 
  45028 START_TEST(popUint32SmallJsonGT)
  45029 
  45030   uint32_t         r;
  45031   smallJsont *self = allocSmallJson();
  45032 
  45033   smallJsont *r2   = self->f->pushInt(self, 2);
  45034   ck_assert_ptr_ne(r2, null);
  45035   r = popUint32SmallJsonG(self, 0);
  45036   ck_assert_int_eq(r, 2);
  45037   terminateO(self);
  45038 
  45039 END_TEST
  45040 
  45041 
  45042 START_TEST(popSSmallJsonGT)
  45043 
  45044   char*            r;
  45045   smallJsont *self = allocSmallJson();
  45046 
  45047   smallJsont *r2   = self->f->pushS(self, "2");
  45048   ck_assert_ptr_ne(r2, null);
  45049   r = popSSmallJsonG(self, null);
  45050   ck_assert_str_eq(r, "2");
  45051   free(r);
  45052   terminateO(self);
  45053 
  45054 END_TEST
  45055 
  45056 
  45057 START_TEST(popDictSmallJsonGT)
  45058 
  45059   smallDictt*      r;
  45060   smallJsont *self = allocSmallJson();
  45061 
  45062   createSmallDict(d);
  45063   smallJsont *r2   = self->f->pushDict(self, &d);
  45064   ck_assert_ptr_ne(r2, null);
  45065   r = popDictSmallJsonG(self, null);
  45066   ck_assert_ptr_ne(r, null);
  45067   char *s = toStringO(r);
  45068   ck_assert_str_eq(s, "{}");
  45069   free(s);
  45070   terminateO(r);
  45071   terminateO(self);
  45072 
  45073 END_TEST
  45074 
  45075 
  45076 START_TEST(popArraySmallJsonGT)
  45077 
  45078   smallArrayt*     r;
  45079   smallJsont *self = allocSmallJson();
  45080 
  45081   createSmallArray(a);
  45082   smallJsont *r2   = self->f->pushArray(self, &a);
  45083   ck_assert_ptr_ne(r2, null);
  45084   r = popArraySmallJsonG(self, null);
  45085   ck_assert_ptr_ne(r, null);
  45086   char *s = toStringO(r);
  45087   ck_assert_str_eq(s, "[]");
  45088   free(s);
  45089   terminateO(r);
  45090   terminateO(self);
  45091 
  45092 END_TEST
  45093 
  45094 
  45095 START_TEST(popSmallBoolSmallJsonGT)
  45096 
  45097   smallBoolt*      r;
  45098   smallJsont *self = allocSmallJson();
  45099 
  45100   smallJsont *r2   = self->f->pushBool(self, true);
  45101   ck_assert_ptr_ne(r2, null);
  45102   r = popSmallBoolSmallJsonG(self, null);
  45103   ck_assert_ptr_ne(r, null);
  45104   char *s = toStringO(r);
  45105   ck_assert_str_eq(s, "true");
  45106   free(s);
  45107   terminateO(r);
  45108   terminateO(self);
  45109 
  45110 END_TEST
  45111 
  45112 
  45113 START_TEST(popSmallBytesSmallJsonGT)
  45114 
  45115   smallBytest*      r;
  45116   smallJsont *self = allocSmallJson();
  45117 
  45118   createSmallBytes(b);
  45119   smallJsont *r2   = self->f->pushSmallBytes(self, &b);
  45120   ck_assert_ptr_ne(r2, null);
  45121   r = popSmallBytesSmallJsonG(self, null);
  45122   ck_assert_ptr_ne(r, null);
  45123   char *s = toStringO(r);
  45124   ck_assert_str_eq(s, "[]");
  45125   free(s);
  45126   terminateO(r);
  45127   terminateO(self);
  45128 
  45129 END_TEST
  45130 
  45131 
  45132 START_TEST(popSmallDoubleSmallJsonGT)
  45133 
  45134   smallDoublet*    r;
  45135   smallJsont *self = allocSmallJson();
  45136 
  45137   smallJsont *r2   = self->f->pushDouble(self, 1);
  45138   ck_assert_ptr_ne(r2, null);
  45139   r = popSmallDoubleSmallJsonG(self, null);
  45140   ck_assert_ptr_ne(r, null);
  45141   char *s = toStringO(r);
  45142   ck_assert_str_eq(s, "1.000000e+00");
  45143   free(s);
  45144   terminateO(r);
  45145   terminateO(self);
  45146 
  45147 END_TEST
  45148 
  45149 
  45150 START_TEST(popSmallIntSmallJsonGT)
  45151 
  45152   smallIntt*       r;
  45153   smallJsont *self = allocSmallJson();
  45154 
  45155   smallJsont *r2   = self->f->pushInt(self, 1);
  45156   ck_assert_ptr_ne(r2, null);
  45157   r = popSmallIntSmallJsonG(self, null);
  45158   ck_assert_ptr_ne(r, null);
  45159   char *s = toStringO(r);
  45160   ck_assert_str_eq(s, "1");
  45161   free(s);
  45162   terminateO(r);
  45163   terminateO(self);
  45164 
  45165 END_TEST
  45166 
  45167 
  45168 START_TEST(popSmallJsonSmallJsonGT)
  45169 
  45170   smallJsont*      r;
  45171   smallJsont *self = allocSmallJson();
  45172 
  45173   createSmallJson(j);
  45174   smallJsont *r2   = self->f->pushSmallJson(self, &j);
  45175   ck_assert_ptr_ne(r2, null);
  45176   r = popSmallJsonSmallJsonG(self, null);
  45177   ck_assert_ptr_ne(r, null);
  45178   char *s = toStringO(r);
  45179   ck_assert_str_eq(s, "{}");
  45180   free(s);
  45181   terminateO(r);
  45182   terminateO(self);
  45183 
  45184 END_TEST
  45185 
  45186 
  45187 START_TEST(popSmallStringSmallJsonGT)
  45188 
  45189   smallStringt*    r;
  45190   smallJsont *self = allocSmallJson();
  45191 
  45192   createSmallString(S);
  45193   smallJsont *r2   = self->f->pushSmallString(self, &S);
  45194   ck_assert_ptr_ne(r2, null);
  45195   r = popSmallStringSmallJsonG(self, null);
  45196   ck_assert_ptr_ne(r, null);
  45197   char *s = toStringO(r);
  45198   ck_assert_str_eq(s, "");
  45199   free(s);
  45200   terminateO(r);
  45201   terminateO(self);
  45202 
  45203 END_TEST
  45204 
  45205 
  45206 START_TEST(popVoidSmallJsonGT)
  45207 
  45208   void*            r;
  45209   smallJsont *self = allocSmallJson();
  45210 
  45211   createSmallContainer(c);
  45212   setValO(&c, &r);
  45213   smallJsont *r2   = self->f->pushSmallContainer(self, &c);
  45214   ck_assert_ptr_ne(r2, null);
  45215   r = popVoidSmallJsonG(self, null);
  45216   ck_assert_ptr_eq(r, &r);
  45217   terminateO(self);
  45218 
  45219 END_TEST
  45220 
  45221 
  45222 START_TEST(popSmallContainerSmallJsonGT)
  45223 
  45224   smallContainert* r;
  45225   smallJsont *self = allocSmallJson();
  45226 
  45227   createSmallContainer(c);
  45228   smallJsont *r2   = self->f->pushSmallContainer(self, &c);
  45229   ck_assert_ptr_ne(r2, null);
  45230   r = popSmallContainerSmallJsonG(self, null);
  45231   ck_assert_ptr_ne(r, null);
  45232   char *s = toStringO(r);
  45233   ck_assert_str_eq(s, "<data smallContainer>");
  45234   free(s);
  45235   terminateO(r);
  45236   terminateO(self);
  45237 
  45238 END_TEST
  45239 
  45240 
  45241 START_TEST(setSmallJsonGT)
  45242 
  45243   smallJsont* r;
  45244   smallJsont *self = allocSmallJson();
  45245   baset *value     = (baset*) allocSmallInt(2);
  45246 
  45247   r = setSmallJsonG(self, "1", value);
  45248   ck_assert_ptr_ne(r, null);
  45249   finishO(value);
  45250   char *s = toStringO(r);
  45251   ck_assert_str_eq(s, "{\"1\":2}");
  45252   free(s);
  45253   terminateO(self);
  45254 
  45255 END_TEST
  45256 
  45257 
  45258 START_TEST(setUndefinedSmallJsonGT)
  45259 
  45260   smallJsont* r;
  45261   smallJsont *self = allocSmallJson();
  45262 
  45263   r = setUndefinedSmallJsonG(self, "1", null);
  45264   ck_assert_ptr_ne(r, null);
  45265   char *s = toStringO(r);
  45266   ck_assert_str_eq(s, "{\"1\":null}");
  45267   free(s);
  45268   terminateO(self);
  45269 
  45270 END_TEST
  45271 
  45272 
  45273 START_TEST(setBoolSmallJsonGT)
  45274 
  45275   smallJsont* r;
  45276   smallJsont *self = allocSmallJson();
  45277 
  45278   r = setBoolSmallJsonG(self, "1", true);
  45279   ck_assert_ptr_ne(r, null);
  45280   char *s = toStringO(r);
  45281   ck_assert_str_eq(s, "{\"1\":true}");
  45282   free(s);
  45283   terminateO(self);
  45284 
  45285 END_TEST
  45286 
  45287 
  45288 START_TEST(setDoubleSmallJsonGT)
  45289 
  45290   smallJsont* r;
  45291   smallJsont *self = allocSmallJson();
  45292 
  45293   r = setDoubleSmallJsonG(self, "1", 2.2);
  45294   ck_assert_ptr_ne(r, null);
  45295   char *s = toStringO(r);
  45296   ck_assert_str_eq(s, "{\"1\":2.200000e+00}");
  45297   free(s);
  45298   terminateO(self);
  45299 
  45300 END_TEST
  45301 
  45302 
  45303 START_TEST(setIntSmallJsonGT)
  45304 
  45305   smallJsont* r;
  45306   smallJsont *self = allocSmallJson();
  45307 
  45308   r = setIntSmallJsonG(self, "1", 2);
  45309   ck_assert_ptr_ne(r, null);
  45310   char *s = toStringO(r);
  45311   ck_assert_str_eq(s, "{\"1\":2}");
  45312   free(s);
  45313   terminateO(self);
  45314 
  45315 END_TEST
  45316 
  45317 
  45318 START_TEST(setSSmallJsonGT)
  45319 
  45320   smallJsont* r;
  45321   smallJsont *self = allocSmallJson();
  45322 
  45323   r = setSSmallJsonG(self, "1", "qwe");
  45324   ck_assert_ptr_ne(r, null);
  45325   char *s = toStringO(r);
  45326   ck_assert_str_eq(s, "{\"1\":\"qwe\"}");
  45327   free(s);
  45328   terminateO(self);
  45329 
  45330 END_TEST
  45331 
  45332 
  45333 START_TEST(setCharSmallJsonGT)
  45334 
  45335   smallJsont* r;
  45336   smallJsont *self = allocSmallJson();
  45337 
  45338   r = setCharSmallJsonG(self, "1", 'x');
  45339   ck_assert_ptr_ne(r, null);
  45340   char *s = toStringO(r);
  45341   ck_assert_str_eq(s, "{\"1\":\"x\"}");
  45342   free(s);
  45343   terminateO(self);
  45344 
  45345 END_TEST
  45346 
  45347 
  45348 START_TEST(setDictSmallJsonGT)
  45349 
  45350   smallJsont* r;
  45351   smallJsont *self = allocSmallJson();
  45352   smallDictt *dict = allocSmallDict();
  45353 
  45354   r = setDictSmallJsonG(self, "1", dict);
  45355   ck_assert_ptr_ne(r, null);
  45356   finishO(dict);
  45357   char *s = toStringO(r);
  45358   ck_assert_str_eq(s, "{\"1\":{}}");
  45359   free(s);
  45360   terminateO(self);
  45361 
  45362 END_TEST
  45363 
  45364 
  45365 START_TEST(setArraySmallJsonGT)
  45366 
  45367   smallJsont* r;
  45368   smallJsont *self   = allocSmallJson();
  45369   smallArrayt *array = allocSmallArray();
  45370 
  45371   r = setArraySmallJsonG(self, "1", array);
  45372   ck_assert_ptr_ne(r, null);
  45373   finishO(array);
  45374   char *s = toStringO(r);
  45375   ck_assert_str_eq(s, "{\"1\":[]}");
  45376   free(s);
  45377   terminateO(self);
  45378 
  45379 END_TEST
  45380 
  45381 
  45382 START_TEST(setArraycSmallJsonGT)
  45383 
  45384   smallJsont* r;
  45385   smallJsont *self = allocSmallJson();
  45386   char **array     = listCreateS("a", "b");
  45387 
  45388   r = setArraycSmallJsonG(self, "1", array);
  45389   ck_assert_ptr_ne(r, null);
  45390   listFreeS(array);
  45391   char *s = toStringO(r);
  45392   ck_assert_str_eq(s, "{\"1\":[\"a\",\"b\"]}");
  45393   free(s);
  45394   terminateO(self);
  45395 
  45396 END_TEST
  45397 
  45398 
  45399 START_TEST(setCArraycSmallJsonGT)
  45400 
  45401   smallJsont* r;
  45402   smallJsont *self    = allocSmallJson();
  45403   const char *array[] = {"a", "b", null};
  45404 
  45405   r = setCArraycSmallJsonG(self, "1", array);
  45406   ck_assert_ptr_ne(r, null);
  45407   char *s = toStringO(r);
  45408   ck_assert_str_eq(s, "{\"1\":[\"a\",\"b\"]}");
  45409   free(s);
  45410   terminateO(self);
  45411 
  45412 END_TEST
  45413 
  45414 
  45415 START_TEST(setVoidSmallJsonGT)
  45416 
  45417   smallJsont* r;
  45418   smallJsont *self = allocSmallJson();
  45419 
  45420   r = setVoidSmallJsonG(self, "1", null);
  45421   ck_assert_ptr_ne(r, null);
  45422   char *s = toStringO(r);
  45423   ck_assert_str_eq(s, "{\"1\":null}");
  45424   free(s);
  45425   r = setVoidSmallJsonG(self, "1", &r);
  45426   ck_assert_ptr_ne(r, null);
  45427   s = toStringO(r);
  45428   ck_assert_str_eq(s, "{\"1\":\"<data container>\"}");
  45429   free(s);
  45430   // null key
  45431   r = setVoidSmallJsonG(self, null, &r);
  45432   ck_assert_ptr_eq(r, null);
  45433   terminateO(self);
  45434 
  45435 END_TEST
  45436 
  45437 
  45438 START_TEST(setSmallBoolSmallJsonGT)
  45439 
  45440   smallJsont* r;
  45441   smallJsont *self = allocSmallJson();
  45442   smallBoolt *value = allocSmallBool(true);
  45443 
  45444   r = setSmallBoolSmallJsonG(self, "1", value);
  45445   ck_assert_ptr_ne(r, null);
  45446   finishO(value);
  45447   char *s = toStringO(r);
  45448   ck_assert_str_eq(s, "{\"1\":true}");
  45449   free(s);
  45450   terminateO(self);
  45451 
  45452 END_TEST
  45453 
  45454 
  45455 START_TEST(setSmallBytesSmallJsonGT)
  45456 
  45457   smallJsont* r;
  45458   smallJsont *self   = allocSmallJson();
  45459   smallBytest *value = allocSmallBytes("qwe", sizeof("qwe"));
  45460 
  45461   r = setSmallBytesSmallJsonG(self, "1", value);
  45462   ck_assert_ptr_ne(r, null);
  45463   finishO(value);
  45464   char *s = toStringO(r);
  45465   ck_assert_str_eq(s, "{\"1\":[0x71,0x77,0x65,0x00]}");
  45466   free(s);
  45467   terminateO(self);
  45468 
  45469 END_TEST
  45470 
  45471 
  45472 START_TEST(setSmallDoubleSmallJsonGT)
  45473 
  45474   smallJsont* r;
  45475   smallJsont *self    = allocSmallJson();
  45476   smallDoublet *value = allocSmallDouble(2.2);
  45477 
  45478   r = setSmallDoubleSmallJsonG(self, "1", value);
  45479   ck_assert_ptr_ne(r, null);
  45480   finishO(value);
  45481   char *s = toStringO(r);
  45482   ck_assert_str_eq(s, "{\"1\":2.200000e+00}");
  45483   free(s);
  45484   terminateO(self);
  45485 
  45486 END_TEST
  45487 
  45488 
  45489 START_TEST(setSmallIntSmallJsonGT)
  45490 
  45491   smallJsont* r;
  45492   smallJsont *self = allocSmallJson();
  45493   smallIntt *value = allocSmallInt(2);
  45494 
  45495   r = setSmallIntSmallJsonG(self, "1", value);
  45496   ck_assert_ptr_ne(r, null);
  45497   finishO(value);
  45498   char *s = toStringO(r);
  45499   ck_assert_str_eq(s, "{\"1\":2}");
  45500   free(s);
  45501   terminateO(self);
  45502 
  45503 END_TEST
  45504 
  45505 
  45506 START_TEST(setSmallJsonSmallJsonGT)
  45507 
  45508   smallJsont* r;
  45509   smallJsont *self  = allocSmallJson();
  45510   smallJsont *value = allocSmallJson();
  45511 
  45512   setTopIntO(value, 2);
  45513   r = setSmallJsonSmallJsonG(self, "1", value);
  45514   ck_assert_ptr_ne(r, null);
  45515   finishO(value);
  45516   char *s = toStringO(r);
  45517   ck_assert_str_eq(s, "{\"1\":2}");
  45518   free(s);
  45519   terminateO(self);
  45520 
  45521 END_TEST
  45522 
  45523 
  45524 START_TEST(setSmallStringSmallJsonGT)
  45525 
  45526   smallJsont* r;
  45527   smallJsont *self     = allocSmallJson();
  45528   smallStringt *string = allocSmallString("qwe");
  45529 
  45530   r = setSmallStringSmallJsonG(self, "1", string);
  45531   ck_assert_ptr_ne(r, null);
  45532   finishO(string);
  45533   char *s = toStringO(r);
  45534   ck_assert_str_eq(s, "{\"1\":\"qwe\"}");
  45535   free(s);
  45536   terminateO(self);
  45537 
  45538 END_TEST
  45539 
  45540 
  45541 START_TEST(setSmallContainerSmallJsonGT)
  45542 
  45543   smallJsont* r;
  45544   smallJsont *self           = allocSmallJson();
  45545   smallContainert *container = allocSmallContainer(null);
  45546 
  45547   r = setSmallContainerSmallJsonG(self, "1", container);
  45548   ck_assert_ptr_ne(r, null);
  45549   finishO(container);
  45550   char *s = toStringO(r);
  45551   ck_assert_str_eq(s, "{\"1\":\"<data container>\"}");
  45552   free(s);
  45553   terminateO(self);
  45554 
  45555 END_TEST
  45556 
  45557 
  45558 START_TEST(setNFreeSmallJsonGT)
  45559 
  45560   smallJsont* r;
  45561   smallJsont *self = allocSmallJson();
  45562   baset *value;
  45563 
  45564   value   = (baset*)allocUndefined();
  45565   r = setNFreeSmallJsonG(self, "1", value);
  45566   ck_assert_ptr_ne(r, null);
  45567   char *s = toStringO(r);
  45568   ck_assert_str_eq(s, "{\"1\":null}");
  45569   free(s);
  45570   terminateO(self);
  45571 
  45572 END_TEST
  45573 
  45574 
  45575 START_TEST(setNFreeUndefinedSmallJsonGT)
  45576 
  45577   smallJsont* r;
  45578   smallJsont *self      = allocSmallJson();
  45579   undefinedt *undefined = allocUndefined();
  45580 
  45581   r = setNFreeUndefinedSmallJsonG(self, "1", undefined);
  45582   ck_assert_ptr_ne(r, null);
  45583   char *s = toStringO(r);
  45584   ck_assert_str_eq(s, "{\"1\":null}");
  45585   free(s);
  45586   terminateO(self);
  45587 
  45588 END_TEST
  45589 
  45590 
  45591 START_TEST(setNFreeSSmallJsonGT)
  45592 
  45593   smallJsont* r;
  45594   smallJsont *self = allocSmallJson();
  45595   char *string     = strdup("qwe");
  45596 
  45597   r = setNFreeSSmallJsonG(self, "1", string);
  45598   ck_assert_ptr_ne(r, null);
  45599   char *s = toStringO(r);
  45600   ck_assert_str_eq(s, "{\"1\":\"qwe\"}");
  45601   free(s);
  45602   terminateO(self);
  45603 
  45604 END_TEST
  45605 
  45606 
  45607 START_TEST(setNFreeDictSmallJsonGT)
  45608 
  45609   smallJsont* r;
  45610   smallJsont *self = allocSmallJson();
  45611   smallDictt *dict = allocSmallDict();
  45612 
  45613   r = setNFreeDictSmallJsonG(self, "1", dict);
  45614   ck_assert_ptr_ne(r, null);
  45615   char *s = toStringO(r);
  45616   ck_assert_str_eq(s, "{\"1\":{}}");
  45617   free(s);
  45618   terminateO(self);
  45619 
  45620 END_TEST
  45621 
  45622 
  45623 START_TEST(setNFreeArraySmallJsonGT)
  45624 
  45625   smallJsont* r;
  45626   smallJsont *self   = allocSmallJson();
  45627   smallArrayt *array = allocSmallArray();
  45628 
  45629   r = setNFreeArraySmallJsonG(self, "1", array);
  45630   ck_assert_ptr_ne(r, null);
  45631   char *s = toStringO(r);
  45632   ck_assert_str_eq(s, "{\"1\":[]}");
  45633   free(s);
  45634   terminateO(self);
  45635 
  45636 END_TEST
  45637 
  45638 
  45639 START_TEST(setNFreeArraycSmallJsonGT)
  45640 
  45641   smallJsont* r;
  45642   smallJsont *self = allocSmallJson();
  45643   char **array     = listCreateS("a", "b");
  45644 
  45645   r = setNFreeArraycSmallJsonG(self, "1", array);
  45646   ck_assert_ptr_ne(r, null);
  45647   char *s = toStringO(r);
  45648   ck_assert_str_eq(s, "{\"1\":[\"a\",\"b\"]}");
  45649   free(s);
  45650   terminateO(self);
  45651 
  45652 END_TEST
  45653 
  45654 
  45655 START_TEST(setNFreeSmallBoolSmallJsonGT)
  45656 
  45657   smallJsont* r;
  45658   smallJsont *self  = allocSmallJson();
  45659   smallBoolt *value = allocSmallBool(true);
  45660 
  45661   r = setNFreeSmallBoolSmallJsonG(self, "1", value);
  45662   ck_assert_ptr_ne(r, null);
  45663   char *s = toStringO(r);
  45664   ck_assert_str_eq(s, "{\"1\":true}");
  45665   free(s);
  45666   terminateO(self);
  45667 
  45668 END_TEST
  45669 
  45670 
  45671 START_TEST(setNFreeSmallBytesSmallJsonGT)
  45672 
  45673   smallJsont* r;
  45674   smallJsont *self   = allocSmallJson();
  45675   smallBytest *value = allocSmallBytes("qwe", sizeof("qwe"));
  45676 
  45677   r = setNFreeSmallBytesSmallJsonG(self, "1", value);
  45678   ck_assert_ptr_ne(r, null);
  45679   char *s = toStringO(r);
  45680   ck_assert_str_eq(s, "{\"1\":[0x71,0x77,0x65,0x00]}");
  45681   free(s);
  45682   terminateO(self);
  45683 
  45684 END_TEST
  45685 
  45686 
  45687 START_TEST(setNFreeSmallDoubleSmallJsonGT)
  45688 
  45689   smallJsont* r;
  45690   smallJsont *self    = allocSmallJson();
  45691   smallDoublet *value = allocSmallDouble(2.2);
  45692 
  45693   r = setNFreeSmallDoubleSmallJsonG(self, "1", value);
  45694   ck_assert_ptr_ne(r, null);
  45695   char *s = toStringO(r);
  45696   ck_assert_str_eq(s, "{\"1\":2.200000e+00}");
  45697   free(s);
  45698   terminateO(self);
  45699 
  45700 END_TEST
  45701 
  45702 
  45703 START_TEST(setNFreeSmallIntSmallJsonGT)
  45704 
  45705   smallJsont* r;
  45706   smallJsont *self = allocSmallJson();
  45707   smallIntt *value = allocSmallInt(2);
  45708 
  45709   r = setNFreeSmallIntSmallJsonG(self, "1", value);
  45710   ck_assert_ptr_ne(r, null);
  45711   char *s = toStringO(r);
  45712   ck_assert_str_eq(s, "{\"1\":2}");
  45713   free(s);
  45714   terminateO(self);
  45715 
  45716 END_TEST
  45717 
  45718 
  45719 START_TEST(setNFreeSmallJsonSmallJsonGT)
  45720 
  45721   smallJsont* r;
  45722   smallJsont *self = allocSmallJson();
  45723   smallJsont *value = allocSmallJson();
  45724 
  45725   setTopIntO(value, 2);
  45726   r = setNFreeSmallJsonSmallJsonG(self, "1", value);
  45727   ck_assert_ptr_ne(r, null);
  45728   char *s = toStringO(r);
  45729   ck_assert_str_eq(s, "{\"1\":2}");
  45730   free(s);
  45731   terminateO(self);
  45732 
  45733 END_TEST
  45734 
  45735 
  45736 START_TEST(setNFreeSmallStringSmallJsonGT)
  45737 
  45738   smallJsont* r;
  45739   smallJsont *self     = allocSmallJson();
  45740   smallStringt *string = allocSmallString("qwe");
  45741 
  45742   r = setNFreeSmallStringSmallJsonG(self, "1", string);
  45743   ck_assert_ptr_ne(r, null);
  45744   char *s = toStringO(r);
  45745   ck_assert_str_eq(s, "{\"1\":\"qwe\"}");
  45746   free(s);
  45747   terminateO(self);
  45748 
  45749 END_TEST
  45750 
  45751 
  45752 START_TEST(setNFreeSmallContainerSmallJsonGT)
  45753 
  45754   smallJsont* r;
  45755   smallJsont *self           = allocSmallJson();
  45756   smallContainert *container = allocSmallContainer(null);
  45757 
  45758   r = setNFreeSmallContainerSmallJsonG(self, "1", container);
  45759   ck_assert_ptr_ne(r, null);
  45760   char *s = toStringO(r);
  45761   ck_assert_str_eq(s, "{\"1\":\"<data container>\"}");
  45762   free(s);
  45763   terminateO(self);
  45764 
  45765 END_TEST
  45766 
  45767 
  45768 START_TEST(setPDictSmallJsonGT)
  45769 
  45770   smallJsont* r;
  45771   smallJsont *self = allocSmallJson();
  45772   smallDictt *dict;
  45773 
  45774   dict = allocSmallDict();
  45775   r    = self->f->setDict(self, "1", dict);
  45776   ck_assert_ptr_ne(r, null);
  45777   dict->f->setInt(dict, "a", 1);
  45778   r    = setPDictSmallJsonG(self, "1", dict);
  45779   ck_assert_ptr_ne(r, null);
  45780   char *s = toStringO(r);
  45781   ck_assert_str_eq(s, "{\"1\":{\"a\":1}}");
  45782   free(s);
  45783   finishO(dict);
  45784   terminateO(self);
  45785 
  45786 END_TEST
  45787 
  45788 
  45789 START_TEST(setPArraySmallJsonGT)
  45790 
  45791   smallJsont* r;
  45792   smallJsont *self = allocSmallJson();
  45793   smallArrayt *array;
  45794 
  45795   array   = allocSmallArray();
  45796   r       = self->f->setArray(self, "1", array);
  45797   ck_assert_ptr_ne(r, null);
  45798   array->f->pushInt(array, 1);
  45799   r       = setPArraySmallJsonG(self, "1", array);
  45800   ck_assert_ptr_ne(r, null);
  45801   char *s = toStringO(r);
  45802   ck_assert_str_eq(s, "{\"1\":[1]}");
  45803   free(s);
  45804   finishO(array);
  45805   terminateO(self);
  45806 
  45807 END_TEST
  45808 
  45809 
  45810 START_TEST(setPSmallJsonSmallJsonGT)
  45811 
  45812   smallJsont* r;
  45813   smallJsont *self = allocSmallJson();
  45814   smallJsont *json;
  45815 
  45816   json    = allocSmallJson();
  45817   r       = self->f->setSmallJson(self, "1", json);
  45818   ck_assert_ptr_ne(r, null);
  45819   json->f->setInt(json, "a", 1);
  45820   r       = setPSmallJsonSmallJsonG(self, "1", json);
  45821   ck_assert_ptr_ne(r, null);
  45822   finishO(json);
  45823   char *s = toStringO(r);
  45824   ck_assert_str_eq(s, "{\"1\":{\"a\":1}}");
  45825   free(s);
  45826   terminateO(self);
  45827 
  45828 END_TEST
  45829 
  45830 
  45831 START_TEST(setPSmallStringSmallJsonGT)
  45832 
  45833   smallJsont* r;
  45834   smallJsont *self = allocSmallJson();
  45835   smallStringt *string;
  45836 
  45837   string = allocSmallString("");
  45838   r      = self->f->setSmallString(self, "1", string);
  45839   ck_assert_ptr_ne(r, null);
  45840   string->f->appendS(string, "s");
  45841   r      = setPSmallStringSmallJsonG(self, "1", string);
  45842   ck_assert_ptr_ne(r, null);
  45843   finishO(string);
  45844   char *s = toStringO(r);
  45845   ck_assert_str_eq(s, "{\"1\":\"s\"}");
  45846   free(s);
  45847   terminateO(self);
  45848 
  45849 END_TEST
  45850 
  45851 
  45852 START_TEST(setNFreePDictSmallJsonGT)
  45853 
  45854   smallJsont* r;
  45855   smallJsont *self = allocSmallJson();
  45856   smallDictt *value;
  45857 
  45858   value   = allocSmallDict();
  45859   r       = self->f->setDict(self, "1", value);
  45860   ck_assert_ptr_ne(r, null);
  45861   value->f->setInt(value, "a", 1);
  45862   r       = setNFreePDictSmallJsonG(self, "1", value);
  45863   ck_assert_ptr_ne(r, null);
  45864   char *s = toStringO(r);
  45865   ck_assert_str_eq(s, "{\"1\":{\"a\":1}}");
  45866   free(s);
  45867   terminateO(self);
  45868 
  45869 END_TEST
  45870 
  45871 
  45872 START_TEST(setNFreePArraySmallJsonGT)
  45873 
  45874   smallJsont* r;
  45875   smallJsont *self = allocSmallJson();
  45876   smallArrayt *value;
  45877 
  45878   value   = allocSmallArray();
  45879   r       = self->f->setArray(self, "1", value);
  45880   ck_assert_ptr_ne(r, null);
  45881   value->f->pushInt(value, 2);
  45882   r       = setNFreePArraySmallJsonG(self, "1", value);
  45883   ck_assert_ptr_ne(r, null);
  45884   char *s = toStringO(r);
  45885   ck_assert_str_eq(s, "{\"1\":[2]}");
  45886   free(s);
  45887   terminateO(self);
  45888 
  45889 END_TEST
  45890 
  45891 
  45892 START_TEST(setNFreePSmallJsonSmallJsonGT)
  45893 
  45894   smallJsont* r;
  45895   smallJsont *self = allocSmallJson();
  45896   smallJsont *value;
  45897 
  45898   value   = allocSmallJson();
  45899   r       = self->f->setSmallJson(self, "1", value);
  45900   ck_assert_ptr_ne(r, null);
  45901   value->f->setInt(value, "a", 1);
  45902   r       = setNFreePSmallJsonSmallJsonG(self, "1", value);
  45903   ck_assert_ptr_ne(r, null);
  45904   char *s = toStringO(r);
  45905   ck_assert_str_eq(s, "{\"1\":{\"a\":1}}");
  45906   free(s);
  45907   terminateO(self);
  45908 
  45909 END_TEST
  45910 
  45911 
  45912 START_TEST(setNFreePSmallStringSmallJsonGT)
  45913 
  45914   smallJsont* r;
  45915   smallJsont *self = allocSmallJson();
  45916   smallStringt *value;
  45917 
  45918   value = allocSmallString("");
  45919   r       = self->f->setSmallString(self, "1", value);
  45920   ck_assert_ptr_ne(r, null);
  45921   value->f->appendS(value, "2");
  45922   r       = setNFreePSmallStringSmallJsonG(self, "1", value);
  45923   ck_assert_ptr_ne(r, null);
  45924   char *s = toStringO(r);
  45925   ck_assert_str_eq(s, "{\"1\":\"2\"}");
  45926   free(s);
  45927   terminateO(self);
  45928 
  45929 END_TEST
  45930 
  45931 
  45932 START_TEST(setAtSmallJsonGT)
  45933 
  45934   smallJsont* r;
  45935   smallJsont *self = allocSmallJson();
  45936   baset *value = (baset*) allocSmallInt(1);
  45937 
  45938   r       = pushSmallJsonG(self, value);
  45939   ck_assert_ptr_ne(r, null);
  45940   finishO(value);
  45941   value   = (baset*) allocSmallInt(2);
  45942   r       = setAtSmallJsonG(self, 0, value);
  45943   ck_assert_ptr_ne(r, null);
  45944   finishO(value);
  45945   char *s = toStringO(r);
  45946   ck_assert_str_eq(s, "[2]");
  45947   free(s);
  45948   terminateO(self);
  45949 
  45950 END_TEST
  45951 
  45952 
  45953 START_TEST(setAtUndefinedSmallJsonGT)
  45954 
  45955   smallJsont* r;
  45956   smallJsont *self = allocSmallJson();
  45957   baset *value = (baset*) allocSmallInt(1);
  45958 
  45959   r       = pushSmallJsonG(self, value);
  45960   ck_assert_ptr_ne(r, null);
  45961   finishO(value);
  45962   char *v = strdup("freed by setAtUndefinedSmallJsonG");
  45963   r = setAtUndefinedSmallJsonG(self, 0, v);
  45964   ck_assert_ptr_ne(r, null);
  45965   char *s = toStringO(r);
  45966   ck_assert_str_eq(s, "[null]");
  45967   free(s);
  45968   terminateO(self);
  45969 
  45970 END_TEST
  45971 
  45972 
  45973 START_TEST(setAtBoolSmallJsonGT)
  45974 
  45975   smallJsont* r;
  45976   smallJsont *self = allocSmallJson();
  45977 
  45978   r = pushBoolSmallJsonG(self, true);
  45979   ck_assert_ptr_ne(r, null);
  45980   r = setAtBoolSmallJsonG(self, 0, false);
  45981   ck_assert_ptr_ne(r, null);
  45982   char *s = toStringO(r);
  45983   ck_assert_str_eq(s, "[false]");
  45984   free(s);
  45985   terminateO(self);
  45986 
  45987 END_TEST
  45988 
  45989 
  45990 START_TEST(setAtDoubleSmallJsonGT)
  45991 
  45992   smallJsont* r;
  45993   smallJsont *self = allocSmallJson();
  45994 
  45995   r = pushDoubleSmallJsonG(self, 1);
  45996   ck_assert_ptr_ne(r, null);
  45997   r = setAtDoubleSmallJsonG(self, 0, 2);
  45998   ck_assert_ptr_ne(r, null);
  45999   char *s = toStringO(r);
  46000   ck_assert_str_eq(s, "[2.000000e+00]");
  46001   free(s);
  46002   terminateO(self);
  46003 
  46004 END_TEST
  46005 
  46006 
  46007 START_TEST(setAtIntSmallJsonGT)
  46008 
  46009   smallJsont* r;
  46010   smallJsont *self = allocSmallJson();
  46011 
  46012   r = pushIntSmallJsonG(self, 1);
  46013   ck_assert_ptr_ne(r, null);
  46014   r = setAtIntSmallJsonG(self, 0, 2);
  46015   ck_assert_ptr_ne(r, null);
  46016   char *s = toStringO(r);
  46017   ck_assert_str_eq(s, "[2]");
  46018   free(s);
  46019   terminateO(self);
  46020 
  46021 END_TEST
  46022 
  46023 
  46024 START_TEST(setAtSSmallJsonGT)
  46025 
  46026   smallJsont* r;
  46027   smallJsont *self = allocSmallJson();
  46028 
  46029   r = pushSSmallJsonG(self, "qwe");
  46030   ck_assert_ptr_ne(r, null);
  46031   r = setAtSSmallJsonG(self, 0, "asd");
  46032   ck_assert_ptr_ne(r, null);
  46033   char *s = toStringO(r);
  46034   ck_assert_str_eq(s, "[\"asd\"]");
  46035   free(s);
  46036   terminateO(self);
  46037 
  46038 END_TEST
  46039 
  46040 
  46041 START_TEST(setAtCharSmallJsonGT)
  46042 
  46043   smallJsont* r;
  46044   smallJsont *self = allocSmallJson();
  46045 
  46046   r = pushCharSmallJsonG(self, 'Q');
  46047   ck_assert_ptr_ne(r, null);
  46048   r = setAtCharSmallJsonG(self, 0, 'x');
  46049   ck_assert_ptr_ne(r, null);
  46050   char *s = toStringO(r);
  46051   ck_assert_str_eq(s, "[\"x\"]");
  46052   free(s);
  46053   terminateO(self);
  46054 
  46055 END_TEST
  46056 
  46057 
  46058 START_TEST(setAtDictSmallJsonGT)
  46059 
  46060   smallJsont* r;
  46061   smallJsont *self = allocSmallJson();
  46062   smallDictt *dict  = allocSmallDict();
  46063 
  46064   r = pushDictSmallJsonG(self, dict);
  46065   ck_assert_ptr_ne(r, null);
  46066   resetO(dict);
  46067   dict->f->setInt(dict, "a", 1);
  46068   r = setAtDictSmallJsonG(self, 0, dict);
  46069   ck_assert_ptr_ne(r, null);
  46070   finishO(dict);
  46071   char *s = toStringO(r);
  46072   ck_assert_str_eq(s, "[{\"a\":1}]");
  46073   free(s);
  46074   terminateO(self);
  46075 
  46076 END_TEST
  46077 
  46078 
  46079 START_TEST(setAtArraySmallJsonGT)
  46080 
  46081   smallJsont* r;
  46082   smallJsont *self  = allocSmallJson();
  46083   smallArrayt *array = allocSmallArray();
  46084 
  46085   r = pushArraySmallJsonG(self, array);
  46086   ck_assert_ptr_ne(r, null);
  46087   resetO(array);
  46088   array->f->pushInt(array, 1);
  46089   r = setAtArraySmallJsonG(self, 0, array);
  46090   ck_assert_ptr_ne(r, null);
  46091   finishO(array);
  46092   char *s = toStringO(r);
  46093   ck_assert_str_eq(s, "[[1]]");
  46094   free(s);
  46095   terminateO(self);
  46096 
  46097 END_TEST
  46098 
  46099 
  46100 START_TEST(setAtArraycSmallJsonGT)
  46101 
  46102   smallJsont* r;
  46103   smallJsont *self = allocSmallJson();
  46104   char **array      = listCreateS("a","bb");
  46105 
  46106   r     = pushArraycSmallJsonG(self, array);
  46107   ck_assert_ptr_ne(r, null);
  46108   listFreeS(array);
  46109   array = listCreateS("1","22");
  46110   r     = setAtArraycSmallJsonG(self, 0, array);
  46111   ck_assert_ptr_ne(r, null);
  46112   ck_assert_int_eq(lenO(r), 1);
  46113   listFreeS(array);
  46114   char *s = toStringO(r);
  46115   ck_assert_str_eq(s, "[[\"1\",\"22\"]]");
  46116   free(s);
  46117   terminateO(self);
  46118 
  46119 END_TEST
  46120 
  46121 
  46122 START_TEST(setAtCArraycSmallJsonGT)
  46123 
  46124   smallJsont* r;
  46125   smallJsont *self = allocSmallJson();
  46126   const char *array[] = {"a", "bb", NULL};
  46127 
  46128   r = pushCArraycSmallJsonG(self, array);
  46129   ck_assert_ptr_ne(r, null);
  46130   const char *array2[] = {"1", "22", NULL};
  46131   r = setAtCArraycSmallJsonG(self, 0, array2);
  46132   ck_assert_ptr_ne(r, null);
  46133   ck_assert_int_eq(lenO(r), 1);
  46134   char *s = toStringO(r);
  46135   ck_assert_str_eq(s, "[[\"1\",\"22\"]]");
  46136   free(s);
  46137   terminateO(self);
  46138 
  46139 END_TEST
  46140 
  46141 
  46142 START_TEST(setAtVoidSmallJsonGT)
  46143 
  46144   smallJsont* r;
  46145   smallJsont *self = allocSmallJson();
  46146 
  46147   // NULL value
  46148   r = pushVoidSmallJsonG(self, NULL);
  46149   ck_assert_ptr_ne(r, null);
  46150   r = setAtVoidSmallJsonG(self, 0, null);
  46151   ck_assert_ptr_ne(r, null);
  46152   r = setAtVoidSmallJsonG(self, 0, r);
  46153   ck_assert_ptr_ne(r, null);
  46154   char *s = toStringO(r);
  46155   ck_assert_str_eq(s, "[\"<data container>\"]");
  46156   free(s);
  46157   terminateO(self);
  46158 
  46159 END_TEST
  46160 
  46161 
  46162 START_TEST(setAtSmallBoolSmallJsonGT)
  46163 
  46164   smallJsont* r;
  46165   smallJsont *self = allocSmallJson();
  46166   smallBoolt *value = allocSmallBool(true);
  46167 
  46168   r = pushBoolSmallJsonG(self, false);
  46169   ck_assert_ptr_ne(r, null);
  46170   r = setAtSmallBoolSmallJsonG(self, 0, value);
  46171   ck_assert_ptr_ne(r, null);
  46172   finishO(value);
  46173   char *s = toStringO(r);
  46174   ck_assert_str_eq(s, "[true]");
  46175   free(s);
  46176   terminateO(self);
  46177 
  46178 END_TEST
  46179 
  46180 
  46181 START_TEST(setAtSmallBytesSmallJsonGT)
  46182 
  46183   smallJsont* r;
  46184   smallJsont *self = allocSmallJson();
  46185   smallBytest *value = allocSmallBytes("qwe", 3);
  46186 
  46187   r = pushSmallBytesSmallJsonG(self, value);
  46188   ck_assert_ptr_ne(r, null);
  46189   finishO(value);
  46190   value = allocSmallBytes("asd", 3);
  46191   r = setAtSmallBytesSmallJsonG(self, 0, value);
  46192   ck_assert_ptr_ne(r, null);
  46193   finishO(value);
  46194   char *s = toStringO(r);
  46195   ck_assert_str_eq(s, "[[0x61,0x73,0x64]]");
  46196   free(s);
  46197   terminateO(self);
  46198 
  46199 END_TEST
  46200 
  46201 
  46202 START_TEST(setAtSmallDoubleSmallJsonGT)
  46203 
  46204   smallJsont* r;
  46205   smallJsont *self = allocSmallJson();
  46206   smallDoublet *value = allocSmallDouble(1);
  46207 
  46208   r = pushDoubleSmallJsonG(self, 2);
  46209   ck_assert_ptr_ne(r, null);
  46210   r = setAtSmallDoubleSmallJsonG(self, 0, value);
  46211   ck_assert_ptr_ne(r, null);
  46212   finishO(value);
  46213   char *s = toStringO(r);
  46214   ck_assert_str_eq(s, "[1.000000e+00]");
  46215   free(s);
  46216 
  46217   terminateO(self);
  46218 
  46219 END_TEST
  46220 
  46221 
  46222 START_TEST(setAtSmallIntSmallJsonGT)
  46223 
  46224   smallJsont* r;
  46225   smallJsont *self = allocSmallJson();
  46226   smallIntt *value  = allocSmallInt(1);
  46227 
  46228   r = pushIntSmallJsonG(self, 2);
  46229   ck_assert_ptr_ne(r, null);
  46230   r = setAtSmallIntSmallJsonG(self, 0, value);
  46231   ck_assert_ptr_ne(r, null);
  46232   finishO(value);
  46233   char *s = toStringO(r);
  46234   ck_assert_str_eq(s, "[1]");
  46235   free(s);
  46236   terminateO(self);
  46237 
  46238 END_TEST
  46239 
  46240 
  46241 START_TEST(setAtSmallJsonSmallJsonGT)
  46242 
  46243   smallJsont* r;
  46244   smallJsont *self = allocSmallJson();
  46245   smallJsont *value = allocSmallJson();
  46246 
  46247   r = pushSmallJsonSmallJsonG(self, value);
  46248   ck_assert_ptr_ne(r, null);
  46249   finishO(value);
  46250   value = allocSmallJson();
  46251   value->f->setInt(value, "a", 1);
  46252   r = setAtSmallJsonSmallJsonG(self, 0, value);
  46253   ck_assert_ptr_ne(r, null);
  46254   finishO(value);
  46255   char *s = toStringO(r);
  46256   ck_assert_str_eq(s, "[{\"a\":1}]");
  46257   free(s);
  46258   terminateO(self);
  46259 
  46260 END_TEST
  46261 
  46262 
  46263 START_TEST(setAtSmallStringSmallJsonGT)
  46264 
  46265   smallJsont* r;
  46266   smallJsont *self = allocSmallJson();
  46267   smallStringt *string = allocSmallString("qwe");
  46268 
  46269   r = pushSSmallJsonG(self, "asd");
  46270   ck_assert_ptr_ne(r, null);
  46271   r = setAtSmallStringSmallJsonG(self, 0, string);
  46272   ck_assert_ptr_ne(r, null);
  46273   finishO(string);
  46274   char *s = toStringO(r);
  46275   ck_assert_str_eq(s, "[\"qwe\"]");
  46276   free(s);
  46277   terminateO(self);
  46278 
  46279 END_TEST
  46280 
  46281 
  46282 START_TEST(setAtSmallContainerSmallJsonGT)
  46283 
  46284   smallJsont* r;
  46285   smallJsont *self = allocSmallJson();
  46286 
  46287   createSmallContainer(c);
  46288   r = pushSmallContainerSmallJsonG(self, &c);
  46289   ck_assert_ptr_ne(r, null);
  46290   createSmallContainer(c2);
  46291   r = setAtSmallContainerSmallJsonG(self, 0, &c2);
  46292   ck_assert_ptr_ne(r, null);
  46293   char *s = toStringO(r);
  46294   ck_assert_str_eq(s, "[\"<data container>\"]");
  46295   free(s);
  46296   terminateO(self);
  46297 
  46298 END_TEST
  46299 
  46300 
  46301 START_TEST(setAtNFreeSmallJsonGT)
  46302 
  46303   smallJsont* r;
  46304   smallJsont *self = allocSmallJson();
  46305   baset *value = (baset*) allocSmallInt(1);
  46306 
  46307   r       = pushSmallJsonG(self, value);
  46308   ck_assert_ptr_ne(r, null);
  46309   finishO(value);
  46310   value   = (baset*) allocSmallInt(2);
  46311   r       = setAtNFreeSmallJsonG(self, 0, value);
  46312   ck_assert_ptr_ne(r, null);
  46313   char *s = toStringO(r);
  46314   ck_assert_str_eq(s, "[2]");
  46315   free(s);
  46316   terminateO(self);
  46317 
  46318 END_TEST
  46319 
  46320 
  46321 START_TEST(setAtNFreeUndefinedSmallJsonGT)
  46322 
  46323   smallJsont* r;
  46324   smallJsont *self = allocSmallJson();
  46325   baset *value = (baset*) allocSmallInt(1);
  46326 
  46327   r       = pushSmallJsonG(self, value);
  46328   ck_assert_ptr_ne(r, null);
  46329   finishO(value);
  46330   r = setAtNFreeUndefinedSmallJsonG(self, 0, null);
  46331   ck_assert_ptr_ne(r, null);
  46332   char *s = toStringO(r);
  46333   ck_assert_str_eq(s, "[null]");
  46334   free(s);
  46335   terminateO(self);
  46336 
  46337 END_TEST
  46338 
  46339 
  46340 START_TEST(setAtNFreeSSmallJsonGT)
  46341 
  46342   smallJsont* r;
  46343   smallJsont *self = allocSmallJson();
  46344 
  46345   r = pushSSmallJsonG(self, "qwe");
  46346   ck_assert_ptr_ne(r, null);
  46347   r = setAtNFreeSSmallJsonG(self, 0, strdup("asd"));
  46348   ck_assert_ptr_ne(r, null);
  46349   char *s = toStringO(r);
  46350   ck_assert_str_eq(s, "[\"asd\"]");
  46351   free(s);
  46352   terminateO(self);
  46353 
  46354 END_TEST
  46355 
  46356 
  46357 START_TEST(setAtNFreeDictSmallJsonGT)
  46358 
  46359   smallJsont* r;
  46360   smallJsont *self = allocSmallJson();
  46361   smallDictt *dict  = allocSmallDict();
  46362 
  46363   r = pushDictSmallJsonG(self, dict);
  46364   ck_assert_ptr_ne(r, null);
  46365   resetO(dict);
  46366   dict->f->setInt(dict, "a", 1);
  46367   r = setAtNFreeDictSmallJsonG(self, 0, dict);
  46368   ck_assert_ptr_ne(r, null);
  46369   char *s = toStringO(r);
  46370   ck_assert_str_eq(s, "[{\"a\":1}]");
  46371   free(s);
  46372   terminateO(self);
  46373 
  46374 END_TEST
  46375 
  46376 
  46377 START_TEST(setAtNFreeArraySmallJsonGT)
  46378 
  46379   smallJsont* r;
  46380   smallJsont *self = allocSmallJson();
  46381   smallArrayt *array = allocSmallArray();
  46382 
  46383   r = pushArraySmallJsonG(self, array);
  46384   ck_assert_ptr_ne(r, null);
  46385   resetO(array);
  46386   array->f->pushInt(array, 1);
  46387   r = setAtNFreeArraySmallJsonG(self, 0, array);
  46388   ck_assert_ptr_ne(r, null);
  46389   char *s = toStringO(r);
  46390   ck_assert_str_eq(s, "[[1]]");
  46391   free(s);
  46392   terminateO(self);
  46393 
  46394 END_TEST
  46395 
  46396 
  46397 START_TEST(setAtNFreeArraycSmallJsonGT)
  46398 
  46399   smallJsont* r;
  46400   smallJsont *self = allocSmallJson();
  46401   char **array      = listCreateS("a","bb");
  46402 
  46403   r     = pushArraycSmallJsonG(self, array);
  46404   ck_assert_ptr_ne(r, null);
  46405   listFreeS(array);
  46406   array = listCreateS("1","22");
  46407   r     = setAtNFreeArraycSmallJsonG(self, 0, array);
  46408   ck_assert_ptr_ne(r, null);
  46409   ck_assert_int_eq(lenO(r), 1);
  46410   char *s = toStringO(r);
  46411   ck_assert_str_eq(s, "[[\"1\",\"22\"]]");
  46412   free(s);
  46413   terminateO(self);
  46414 
  46415 END_TEST
  46416 
  46417 
  46418 START_TEST(setAtNFreeSmallBoolSmallJsonGT)
  46419 
  46420   smallJsont* r;
  46421   smallJsont *self = allocSmallJson();
  46422   smallBoolt *value = allocSmallBool(true);
  46423 
  46424   r = pushBoolSmallJsonG(self, false);
  46425   ck_assert_ptr_ne(r, null);
  46426   r = setAtNFreeSmallBoolSmallJsonG(self, 0, value);
  46427   ck_assert_ptr_ne(r, null);
  46428   char *s = toStringO(r);
  46429   ck_assert_str_eq(s, "[true]");
  46430   free(s);
  46431   terminateO(self);
  46432 
  46433 END_TEST
  46434 
  46435 
  46436 START_TEST(setAtNFreeSmallBytesSmallJsonGT)
  46437 
  46438   smallJsont* r;
  46439   smallJsont *self = allocSmallJson();
  46440   smallBytest *value = allocSmallBytes("qwe", 3);
  46441 
  46442   r = pushSmallBytesSmallJsonG(self, value);
  46443   ck_assert_ptr_ne(r, null);
  46444   finishO(value);
  46445   value = allocSmallBytes("asd", 3);
  46446   r = setAtNFreeSmallBytesSmallJsonG(self, 0, value);
  46447   ck_assert_ptr_ne(r, null);
  46448   char *s = toStringO(r);
  46449   ck_assert_str_eq(s, "[[0x61,0x73,0x64]]");
  46450   free(s);
  46451   terminateO(self);
  46452 
  46453 END_TEST
  46454 
  46455 
  46456 START_TEST(setAtNFreeSmallDoubleSmallJsonGT)
  46457 
  46458   smallJsont* r;
  46459   smallJsont *self = allocSmallJson();
  46460   smallDoublet *value = allocSmallDouble(1);
  46461 
  46462   r = pushDoubleSmallJsonG(self, 2);
  46463   ck_assert_ptr_ne(r, null);
  46464   r = setAtNFreeSmallDoubleSmallJsonG(self, 0, value);
  46465   ck_assert_ptr_ne(r, null);
  46466   char *s = toStringO(r);
  46467   ck_assert_str_eq(s, "[1.000000e+00]");
  46468   free(s);
  46469   terminateO(self);
  46470 
  46471 END_TEST
  46472 
  46473 
  46474 START_TEST(setAtNFreeSmallIntSmallJsonGT)
  46475 
  46476   smallJsont* r;
  46477   smallJsont *self = allocSmallJson();
  46478   smallIntt *value  = allocSmallInt(1);
  46479 
  46480   r = pushIntSmallJsonG(self, 2);
  46481   ck_assert_ptr_ne(r, null);
  46482   r = setAtNFreeSmallIntSmallJsonG(self, 0, value);
  46483   ck_assert_ptr_ne(r, null);
  46484   char *s = toStringO(r);
  46485   ck_assert_str_eq(s, "[1]");
  46486   free(s);
  46487   terminateO(self);
  46488 
  46489 END_TEST
  46490 
  46491 
  46492 START_TEST(setAtNFreeSmallJsonSmallJsonGT)
  46493 
  46494   smallJsont* r;
  46495   smallJsont *self = allocSmallJson();
  46496   smallJsont *value = allocSmallJson();
  46497 
  46498   r = pushSmallJsonSmallJsonG(self, value);
  46499   ck_assert_ptr_ne(r, null);
  46500   finishO(value);
  46501   value = allocSmallJson();
  46502   value->f->setInt(value, "a", 1);
  46503   r = setAtNFreeSmallJsonSmallJsonG(self, 0, value);
  46504   ck_assert_ptr_ne(r, null);
  46505   char *s = toStringO(r);
  46506   ck_assert_str_eq(s, "[{\"a\":1}]");
  46507   free(s);
  46508   terminateO(self);
  46509 
  46510 END_TEST
  46511 
  46512 
  46513 START_TEST(setAtNFreeSmallStringSmallJsonGT)
  46514 
  46515   smallJsont* r;
  46516   smallJsont *self = allocSmallJson();
  46517   smallStringt *string = allocSmallString("qwe");
  46518 
  46519   r = pushSSmallJsonG(self, "asd");
  46520   ck_assert_ptr_ne(r, null);
  46521   r = setAtNFreeSmallStringSmallJsonG(self, 0, string);
  46522   ck_assert_ptr_ne(r, null);
  46523   char *s = toStringO(r);
  46524   ck_assert_str_eq(s, "[\"qwe\"]");
  46525   free(s);
  46526   terminateO(self);
  46527 
  46528 END_TEST
  46529 
  46530 
  46531 START_TEST(setAtNFreeSmallContainerSmallJsonGT)
  46532 
  46533   smallJsont* r;
  46534   smallJsont *self = allocSmallJson();
  46535 
  46536   createSmallContainer(c);
  46537   r = pushSmallContainerSmallJsonG(self, &c);
  46538   ck_assert_ptr_ne(r, null);
  46539   createAllocateSmallContainer(c2);
  46540   r = setAtNFreeSmallContainerSmallJsonG(self, 0, c2);
  46541   ck_assert_ptr_ne(r, null);
  46542   char *s = toStringO(r);
  46543   ck_assert_str_eq(s, "[\"<data container>\"]");
  46544   free(s);
  46545   terminateO(self);
  46546 
  46547 END_TEST
  46548 
  46549 
  46550 START_TEST(setPAtDictSmallJsonGT)
  46551 
  46552   smallJsont* r;
  46553   smallJsont *self = allocSmallJson();
  46554   smallDictt *dict  = allocSmallDict();
  46555 
  46556   r = pushDictSmallJsonG(self, dict);
  46557   ck_assert_ptr_ne(r, null);
  46558   finishO(dict);
  46559   dict = getAtDictSmallJsonG(self, null, 0);
  46560   ck_assert_ptr_ne(dict, null);
  46561   dict->f->setInt(dict, "a", 1);
  46562   r = setPAtDictSmallJsonG(self, 0, dict);
  46563   ck_assert_ptr_ne(r, null);
  46564   finishO(dict);
  46565   char *s = toStringO(r);
  46566   ck_assert_str_eq(s, "[{\"a\":1}]");
  46567   free(s);
  46568   terminateO(self);
  46569 
  46570 END_TEST
  46571 
  46572 
  46573 START_TEST(setPAtArraySmallJsonGT)
  46574 
  46575   smallJsont* r;
  46576   smallJsont *self = allocSmallJson();
  46577   smallArrayt *array = allocSmallArray();
  46578 
  46579   r = pushArraySmallJsonG(self, array);
  46580   ck_assert_ptr_ne(r, null);
  46581   finishO(array);
  46582   array = getAtArraySmallJsonG(self, null, 0);
  46583   ck_assert_ptr_ne(array, null);
  46584   array->f->pushInt(array, 1);
  46585   r = setPAtArraySmallJsonG(self, 0, array);
  46586   ck_assert_ptr_ne(r, null);
  46587   finishO(array);
  46588   char *s = toStringO(r);
  46589   ck_assert_str_eq(s, "[[1]]");
  46590   free(s);
  46591   terminateO(self);
  46592 
  46593 END_TEST
  46594 
  46595 
  46596 START_TEST(setPAtSmallJsonSmallJsonGT)
  46597 
  46598   smallJsont* r;
  46599   smallJsont *self = allocSmallJson();
  46600   smallJsont *value = allocSmallJson();
  46601 
  46602   r = pushSmallJsonSmallJsonG(self, value);
  46603   ck_assert_ptr_ne(r, null);
  46604   finishO(value);
  46605   value = getAtSmallJsonSmallJsonG(self, null, 0);
  46606   value->f->setInt(value, "a", 1);
  46607   r = setPAtSmallJsonSmallJsonG(self, 0, value);
  46608   ck_assert_ptr_ne(r, null);
  46609   finishO(value);
  46610   char *s = toStringO(r);
  46611   ck_assert_str_eq(s, "[{\"a\":1}]");
  46612   free(s);
  46613   terminateO(self);
  46614 
  46615 END_TEST
  46616 
  46617 
  46618 START_TEST(setPAtSmallStringSmallJsonGT)
  46619 
  46620   smallJsont* r;
  46621   smallJsont *self = allocSmallJson();
  46622   smallStringt *string;
  46623 
  46624   r = pushSSmallJsonG(self, "asd");
  46625   ck_assert_ptr_ne(r, null);
  46626   string = getAtSmallStringSmallJsonG(self, null, 0);
  46627   setValO(string, "qwe");
  46628   r = setPAtSmallStringSmallJsonG(self, 0, string);
  46629   ck_assert_ptr_ne(r, null);
  46630   finishO(string);
  46631   char *s = toStringO(r);
  46632   ck_assert_str_eq(s, "[\"qwe\"]");
  46633   free(s);
  46634   terminateO(self);
  46635 
  46636 END_TEST
  46637 
  46638 
  46639 START_TEST(setPAtNFreeDictSmallJsonGT)
  46640 
  46641   smallJsont* r;
  46642   smallJsont *self = allocSmallJson();
  46643   smallDictt *dict  = allocSmallDict();
  46644 
  46645   r = pushDictSmallJsonG(self, dict);
  46646   ck_assert_ptr_ne(r, null);
  46647   finishO(dict);
  46648   dict = getAtDictSmallJsonG(self, null, 0);
  46649   ck_assert_ptr_ne(dict, null);
  46650   dict->f->setInt(dict, "a", 1);
  46651   r = setPAtNFreeDictSmallJsonG(self, 0, dict);
  46652   ck_assert_ptr_ne(r, null);
  46653   char *s = toStringO(r);
  46654   ck_assert_str_eq(s, "[{\"a\":1}]");
  46655   free(s);
  46656   terminateO(self);
  46657 
  46658 END_TEST
  46659 
  46660 
  46661 START_TEST(setPAtNFreeArraySmallJsonGT)
  46662 
  46663   smallJsont* r;
  46664   smallJsont *self = allocSmallJson();
  46665   smallArrayt *array = allocSmallArray();
  46666 
  46667   r = pushArraySmallJsonG(self, array);
  46668   ck_assert_ptr_ne(r, null);
  46669   finishO(array);
  46670   array = getAtArraySmallJsonG(self, null, 0);
  46671   ck_assert_ptr_ne(array, null);
  46672   array->f->pushInt(array, 1);
  46673   r = setPAtNFreeArraySmallJsonG(self, 0, array);
  46674   ck_assert_ptr_ne(r, null);
  46675   char *s = toStringO(r);
  46676   ck_assert_str_eq(s, "[[1]]");
  46677   free(s);
  46678   terminateO(self);
  46679 
  46680 END_TEST
  46681 
  46682 
  46683 START_TEST(setPAtNFreeSmallJsonSmallJsonGT)
  46684 
  46685   smallJsont* r;
  46686   smallJsont *self = allocSmallJson();
  46687   smallJsont *value = allocSmallJson();
  46688 
  46689   r = pushSmallJsonSmallJsonG(self, value);
  46690   ck_assert_ptr_ne(r, null);
  46691   finishO(value);
  46692   value = getAtSmallJsonSmallJsonG(self, null, 0);
  46693   value->f->setInt(value, "a", 1);
  46694   r = setPAtNFreeSmallJsonSmallJsonG(self, 0, value);
  46695   ck_assert_ptr_ne(r, null);
  46696   char *s = toStringO(r);
  46697   ck_assert_str_eq(s, "[{\"a\":1}]");
  46698   free(s);
  46699   terminateO(self);
  46700 
  46701 END_TEST
  46702 
  46703 
  46704 START_TEST(setPAtNFreeSmallStringSmallJsonGT)
  46705 
  46706   smallJsont* r;
  46707   smallJsont *self = allocSmallJson();
  46708   smallStringt *string;
  46709 
  46710   r = pushSSmallJsonG(self, "asd");
  46711   ck_assert_ptr_ne(r, null);
  46712   string = getAtSmallStringSmallJsonG(self, null, 0);
  46713   setValO(string, "qwe");
  46714   r = setPAtNFreeSmallStringSmallJsonG(self, 0, string);
  46715   ck_assert_ptr_ne(r, null);
  46716   char *s = toStringO(r);
  46717   ck_assert_str_eq(s, "[\"qwe\"]");
  46718   free(s);
  46719   terminateO(self);
  46720 
  46721 END_TEST
  46722 
  46723 
  46724 START_TEST(getSmallJsonGT)
  46725 
  46726   baset*      r;
  46727   smallJsont *self = allocSmallJson();
  46728 
  46729   self->f->setInt(self, "1", 2);
  46730   r = getSmallJsonG(self, null, "1");
  46731   ck_assert_ptr_ne(r, null);
  46732   char *s = toStringO(r);
  46733   finishO(r);
  46734   ck_assert_str_eq(s, "2");
  46735   free(s);
  46736   terminateO(self);
  46737 
  46738 END_TEST
  46739 
  46740 
  46741 START_TEST(getUndefinedSmallJsonGT)
  46742 
  46743   undefinedt*      r;
  46744   smallJsont *self = allocSmallJson();
  46745 
  46746   smallJsont *r2 = self->f->setUndefined(self, "1");
  46747   ck_assert_ptr_ne(r2, null);
  46748   r = getUndefinedSmallJsonG(self, null, "1");
  46749   ck_assert_ptr_ne(r, null);
  46750   finishO(r);
  46751   terminateO(self);
  46752 
  46753 END_TEST
  46754 
  46755 
  46756 START_TEST(getBoolSmallJsonGT)
  46757 
  46758   bool             r;
  46759   smallJsont *self = allocSmallJson();
  46760 
  46761   smallJsont *r2 = self->f->setBool(self, "1", true);
  46762   ck_assert_ptr_ne(r2, null);
  46763   r = getBoolSmallJsonG(self, false, "1");
  46764   ck_assert(r);
  46765   terminateO(self);
  46766 
  46767 END_TEST
  46768 
  46769 
  46770 START_TEST(getBoolPSmallJsonGT)
  46771 
  46772   bool*            r;
  46773   smallJsont *self = allocSmallJson();
  46774 
  46775   smallJsont *r2 = self->f->setBool(self, "1", true);
  46776   ck_assert_ptr_ne(r2, null);
  46777   r = getBoolPSmallJsonG(self, null, "1");
  46778   ck_assert_ptr_ne(r, null);
  46779   ck_assert(*r);
  46780   terminateO(self);
  46781 
  46782 END_TEST
  46783 
  46784 
  46785 START_TEST(getDoubleSmallJsonGT)
  46786 
  46787   double           r;
  46788   smallJsont *self = allocSmallJson();
  46789 
  46790   smallJsont *r2 = self->f->setDouble(self, "1", 2.2);
  46791   ck_assert_ptr_ne(r2, null);
  46792   r = getDoubleSmallJsonG(self, 0, "1");
  46793   ck_assert(r == 2.2);
  46794   terminateO(self);
  46795 
  46796 END_TEST
  46797 
  46798 
  46799 START_TEST(getDoublePSmallJsonGT)
  46800 
  46801   double*          r;
  46802   smallJsont *self = allocSmallJson();
  46803 
  46804   smallJsont *r2 = self->f->setDouble(self, "1", 2.2);
  46805   ck_assert_ptr_ne(r2, null);
  46806   r = getDoublePSmallJsonG(self, null, "1");
  46807   ck_assert_ptr_ne(r, null);
  46808   ck_assert(*r == 2.2);
  46809   terminateO(self);
  46810 
  46811 END_TEST
  46812 
  46813 
  46814 START_TEST(getIntSmallJsonGT)
  46815 
  46816   int64_t          r;
  46817   smallJsont *self = allocSmallJson();
  46818 
  46819   smallJsont *r2 = self->f->setInt(self, "1", 2);
  46820   ck_assert_ptr_ne(r2, null);
  46821   r = getIntSmallJsonG(self, 0, "1");
  46822   ck_assert_int_eq(r, 2);
  46823   terminateO(self);
  46824 
  46825 END_TEST
  46826 
  46827 
  46828 START_TEST(getIntPSmallJsonGT)
  46829 
  46830   int64_t*         r;
  46831   smallJsont *self = allocSmallJson();
  46832 
  46833   smallJsont *r2 = self->f->setInt(self, "1", 2);
  46834   ck_assert_ptr_ne(r2, null);
  46835   r = getIntPSmallJsonG(self, null, "1");
  46836   ck_assert_ptr_ne(r, null);
  46837   ck_assert_int_eq(*r, 2);
  46838   terminateO(self);
  46839 
  46840 END_TEST
  46841 
  46842 
  46843 START_TEST(getInt32SmallJsonGT)
  46844 
  46845   int32_t          r;
  46846   smallJsont *self = allocSmallJson();
  46847 
  46848   smallJsont *r2 = self->f->setInt(self, "1", 2);
  46849   ck_assert_ptr_ne(r2, null);
  46850   r = getInt32SmallJsonG(self, 0, "1");
  46851   ck_assert_int_eq(r, 2);
  46852   terminateO(self);
  46853 
  46854 END_TEST
  46855 
  46856 
  46857 START_TEST(getInt32PSmallJsonGT)
  46858 
  46859   int32_t*         r;
  46860   smallJsont *self = allocSmallJson();
  46861 
  46862   smallJsont *r2 = self->f->setInt(self, "1", 2);
  46863   ck_assert_ptr_ne(r2, null);
  46864   r = getInt32PSmallJsonG(self, null, "1");
  46865   ck_assert_ptr_ne(r, null);
  46866   ck_assert_int_eq(*r, 2);
  46867   terminateO(self);
  46868 
  46869 END_TEST
  46870 
  46871 
  46872 START_TEST(getUintSmallJsonGT)
  46873 
  46874   uint64_t         r;
  46875   smallJsont *self = allocSmallJson();
  46876 
  46877   smallJsont *r2 = self->f->setInt(self, "1", 2);
  46878   ck_assert_ptr_ne(r2, null);
  46879   r = getUintSmallJsonG(self, 0, "1");
  46880   ck_assert_int_eq(r, 2);
  46881   terminateO(self);
  46882 
  46883 END_TEST
  46884 
  46885 
  46886 START_TEST(getUintPSmallJsonGT)
  46887 
  46888   uint64_t*        r;
  46889   smallJsont *self = allocSmallJson();
  46890 
  46891   smallJsont *r2 = self->f->setInt(self, "1", 2);
  46892   ck_assert_ptr_ne(r2, null);
  46893   r = getUintPSmallJsonG(self, null, "1");
  46894   ck_assert_ptr_ne(r, null);
  46895   ck_assert_int_eq(*r, 2);
  46896   terminateO(self);
  46897 
  46898 END_TEST
  46899 
  46900 
  46901 START_TEST(getUint32SmallJsonGT)
  46902 
  46903   uint32_t         r;
  46904   smallJsont *self = allocSmallJson();
  46905 
  46906   smallJsont *r2 = self->f->setInt(self, "1", 2);
  46907   ck_assert_ptr_ne(r2, null);
  46908   r = getUint32SmallJsonG(self, 0, "1");
  46909   ck_assert_int_eq(r, 2);
  46910   terminateO(self);
  46911 
  46912 END_TEST
  46913 
  46914 
  46915 START_TEST(getUint32PSmallJsonGT)
  46916 
  46917   uint32_t*        r;
  46918   smallJsont *self = allocSmallJson();
  46919 
  46920   smallJsont *r2 = self->f->setInt(self, "1", 2);
  46921   ck_assert_ptr_ne(r2, null);
  46922   r = getUint32PSmallJsonG(self, null, "1");
  46923   ck_assert_ptr_ne(r, null);
  46924   ck_assert_int_eq(*r, 2);
  46925   terminateO(self);
  46926 
  46927 END_TEST
  46928 
  46929 
  46930 START_TEST(getSSmallJsonGT)
  46931 
  46932   char*            r;
  46933   smallJsont *self = allocSmallJson();
  46934 
  46935   smallJsont *r2 = self->f->setS(self, "1", "qwe");
  46936   ck_assert_ptr_ne(r2, null);
  46937   r = getSSmallJsonG(self, null, "1");
  46938   ck_assert_ptr_ne(r, null);
  46939   ck_assert_str_eq(r, "qwe");
  46940   terminateO(self);
  46941 
  46942 END_TEST
  46943 
  46944 
  46945 START_TEST(getDictSmallJsonGT)
  46946 
  46947   smallJsont* r2;
  46948   smallDictt*      r;
  46949   smallJsont *self = allocSmallJson();
  46950   smallDictt *dict = allocSmallDict();
  46951 
  46952   r2 = self->f->setNFreeDict(self, "1", dict);
  46953   ck_assert_ptr_ne(r2, null);
  46954   r = getDictSmallJsonG(self, null, "1");
  46955   ck_assert_ptr_ne(r, null);
  46956   char *s = toStringO(r);
  46957   finishO(r);
  46958   ck_assert_str_eq(s, "{}");
  46959   free(s);
  46960   terminateO(self);
  46961 
  46962 END_TEST
  46963 
  46964 
  46965 START_TEST(getArraySmallJsonGT)
  46966 
  46967   smallArrayt *r;
  46968   smallJsont *self   = allocSmallJson();
  46969   smallArrayt *array = allocSmallArray();
  46970 
  46971   smallJsont *r2 = self->f->setNFreeArray(self, "1", array);
  46972   ck_assert_ptr_ne(r2, null);
  46973   r = getArraySmallJsonG(self, null, "1");
  46974   ck_assert_ptr_ne(r, null);
  46975   char *s = toStringO(r);
  46976   finishO(r);
  46977   ck_assert_str_eq(s, "[]");
  46978   free(s);
  46979   terminateO(self);
  46980 
  46981 END_TEST
  46982 
  46983 
  46984 START_TEST(getSmallBoolSmallJsonGT)
  46985 
  46986   smallBoolt*      r;
  46987   smallJsont *self = allocSmallJson();
  46988 
  46989   smallJsont *r2 = self->f->setBool(self, "1", true);
  46990   ck_assert_ptr_ne(r2, null);
  46991   r = getSmallBoolSmallJsonG(self, null, "1");
  46992   ck_assert_ptr_ne(r, null);
  46993   char *s = toStringO(r);
  46994   finishO(r);
  46995   ck_assert_str_eq(s, "true");
  46996   free(s);
  46997   terminateO(self);
  46998 
  46999 END_TEST
  47000 
  47001 
  47002 START_TEST(getSmallBytesSmallJsonGT)
  47003 
  47004   smallBytest*     r;
  47005   smallJsont *self   = allocSmallJson();
  47006   smallBytest *value = allocSmallBytes("qwe", sizeof("qwe"));
  47007 
  47008   smallJsont *r2 = self->f->setNFreeSmallBytes(self, "1", value);
  47009   ck_assert_ptr_ne(r2, null);
  47010   r = getSmallBytesSmallJsonG(self, null, "1");
  47011   ck_assert_ptr_ne(r, null);
  47012   char *s = toStringO(r);
  47013   finishO(r);
  47014   ck_assert_str_eq(s, "[0x71,0x77,0x65,0x00]");
  47015   free(s);
  47016   terminateO(self);
  47017 
  47018 END_TEST
  47019 
  47020 
  47021 START_TEST(getSmallDoubleSmallJsonGT)
  47022 
  47023   smallDoublet*    r;
  47024   smallJsont *self = allocSmallJson();
  47025 
  47026   smallJsont *r2 = self->f->setDouble(self, "1", 2.2);
  47027   ck_assert_ptr_ne(r2, null);
  47028   r = getSmallDoubleSmallJsonG(self, null, "1");
  47029   ck_assert_ptr_ne(r, null);
  47030   char *s = toStringO(r);
  47031   finishO(r);
  47032   ck_assert_str_eq(s, "2.200000e+00");
  47033   free(s);
  47034   terminateO(self);
  47035 
  47036 END_TEST
  47037 
  47038 
  47039 START_TEST(getSmallIntSmallJsonGT)
  47040 
  47041   smallIntt*       r;
  47042   smallJsont *self = allocSmallJson();
  47043 
  47044   smallJsont *r2 = self->f->setInt(self, "1", 2);
  47045   ck_assert_ptr_ne(r2, null);
  47046   r = getSmallIntSmallJsonG(self, null, "1");
  47047   ck_assert_ptr_ne(r, null);
  47048   char *s = toStringO(r);
  47049   finishO(r);
  47050   ck_assert_str_eq(s, "2");
  47051   free(s);
  47052   terminateO(self);
  47053 
  47054 END_TEST
  47055 
  47056 
  47057 START_TEST(getSmallJsonSmallJsonGT)
  47058 
  47059   smallJsont* r;
  47060   smallJsont *self = allocSmallJson();
  47061   smallJsont *value = allocSmallJson();
  47062 
  47063   setTopIntO(value, 2);
  47064   smallJsont *r2 = self->f->setNFreeSmallJson(self, "1", value);
  47065   ck_assert_ptr_ne(r2, null);
  47066   r = getSmallJsonSmallJsonG(self, null, "1");
  47067   ck_assert_ptr_ne(r, null);
  47068   char *s = toStringO(r);
  47069   finishO(r);
  47070   ck_assert_str_eq(s, "2");
  47071   free(s);
  47072   terminateO(self);
  47073 
  47074 END_TEST
  47075 
  47076 
  47077 START_TEST(getSmallStringSmallJsonGT)
  47078 
  47079   smallStringt*    r;
  47080   smallJsont *self = allocSmallJson();
  47081 
  47082   smallJsont *r2 = self->f->setS(self, "1", "qwe");
  47083   ck_assert_ptr_ne(r2, null);
  47084   r = getSmallStringSmallJsonG(self, null, "1");
  47085   ck_assert_ptr_ne(r, null);
  47086   char *s = toStringO(r);
  47087   finishO(r);
  47088   ck_assert_str_eq(s, "qwe");
  47089   free(s);
  47090   terminateO(self);
  47091 
  47092 END_TEST
  47093 
  47094 
  47095 START_TEST(getVoidSmallJsonGT)
  47096 
  47097   void*            r;
  47098   smallJsont *self = allocSmallJson();
  47099 
  47100   createSmallContainer(c);
  47101   setValO(&c, &r);
  47102   smallJsont *r2 = self->f->setSmallContainer(self, "1", &c);
  47103   ck_assert_ptr_ne(r2, null);
  47104   r = getVoidSmallJsonG(self, null, "1");
  47105   ck_assert_ptr_eq(r, &r);
  47106   terminateO(self);
  47107 
  47108 END_TEST
  47109 
  47110 
  47111 START_TEST(getSmallContainerSmallJsonGT)
  47112 
  47113   smallContainert* r;
  47114   smallJsont *self = allocSmallJson();
  47115 
  47116   createSmallContainer(c);
  47117   setValO(&c, &r);
  47118   smallJsont *r2 = self->f->setSmallContainer(self, "1", &c);
  47119   ck_assert_ptr_ne(r2, null);
  47120   r = getSmallContainerSmallJsonG(self, null, "1");
  47121   ck_assert_ptr_ne(r, null);
  47122   char *s = toStringO(r);
  47123   finishO(r);
  47124   ck_assert_str_eq(s, "<data smallContainer>");
  47125   free(s);
  47126   terminateO(self);
  47127 
  47128 END_TEST
  47129 
  47130 
  47131 START_TEST(getNDupSmallJsonGT)
  47132 
  47133   baset*           r;
  47134   smallJsont *self = allocSmallJson();
  47135 
  47136   self->f->setInt(self, "1", 2);
  47137   r = getNDupSmallJsonG(self, null, "1");
  47138   ck_assert_ptr_ne(r, null);
  47139   char *s = toStringO(r);
  47140   terminateO(r);
  47141   ck_assert_str_eq(s, "2");
  47142   free(s);
  47143   terminateO(self);
  47144 
  47145 END_TEST
  47146 
  47147 
  47148 START_TEST(getNDupUndefinedSmallJsonGT)
  47149 
  47150   undefinedt*      r;
  47151   smallJsont *self = allocSmallJson();
  47152 
  47153   smallJsont *r2 = self->f->setUndefined(self, "1");
  47154   ck_assert_ptr_ne(r2, null);
  47155   r = getNDupUndefinedSmallJsonG(self, null, "1");
  47156   ck_assert_ptr_ne(r, null);
  47157   terminateO(r);
  47158   terminateO(self);
  47159 
  47160 END_TEST
  47161 
  47162 
  47163 START_TEST(getNDupBoolSmallJsonGT)
  47164 
  47165   bool             r;
  47166   smallJsont *self = allocSmallJson();
  47167 
  47168   smallJsont *r2 = self->f->setBool(self, "1", true);
  47169   ck_assert_ptr_ne(r2, null);
  47170   r = getNDupBoolSmallJsonG(self, false, "1");
  47171   ck_assert(r);
  47172   terminateO(self);
  47173 
  47174 END_TEST
  47175 
  47176 
  47177 START_TEST(getNDupDoubleSmallJsonGT)
  47178 
  47179   double           r;
  47180   smallJsont *self = allocSmallJson();
  47181 
  47182   smallJsont *r2 = self->f->setDouble(self, "1", 2.2);
  47183   ck_assert_ptr_ne(r2, null);
  47184   r = getNDupDoubleSmallJsonG(self, 0, "1");
  47185   ck_assert(r == 2.2);
  47186   terminateO(self);
  47187 
  47188 END_TEST
  47189 
  47190 
  47191 START_TEST(getNDupIntSmallJsonGT)
  47192 
  47193   int64_t          r;
  47194   smallJsont *self = allocSmallJson();
  47195 
  47196   smallJsont *r2 = self->f->setInt(self, "1", 2);
  47197   ck_assert_ptr_ne(r2, null);
  47198   r = getNDupIntSmallJsonG(self, 0, "1");
  47199   ck_assert_int_eq(r, 2);
  47200   terminateO(self);
  47201 
  47202 END_TEST
  47203 
  47204 
  47205 START_TEST(getNDupInt32SmallJsonGT)
  47206 
  47207   int32_t          r;
  47208   smallJsont *self = allocSmallJson();
  47209 
  47210   smallJsont *r2 = self->f->setInt(self, "1", 2);
  47211   ck_assert_ptr_ne(r2, null);
  47212   r = getNDupInt32SmallJsonG(self, 0, "1");
  47213   ck_assert_int_eq(r, 2);
  47214   terminateO(self);
  47215 
  47216 END_TEST
  47217 
  47218 
  47219 START_TEST(getNDupUintSmallJsonGT)
  47220 
  47221   uint64_t         r;
  47222   smallJsont *self = allocSmallJson();
  47223 
  47224   smallJsont *r2 = self->f->setInt(self, "1", 2);
  47225   ck_assert_ptr_ne(r2, null);
  47226   r = getNDupUintSmallJsonG(self, 0, "1");
  47227   ck_assert_int_eq(r, 2);
  47228   terminateO(self);
  47229 
  47230 END_TEST
  47231 
  47232 
  47233 START_TEST(getNDupUint32SmallJsonGT)
  47234 
  47235   uint32_t         r;
  47236   smallJsont *self = allocSmallJson();
  47237 
  47238   smallJsont *r2 = self->f->setInt(self, "1", 2);
  47239   ck_assert_ptr_ne(r2, null);
  47240   r = getNDupUint32SmallJsonG(self, 0, "1");
  47241   ck_assert_int_eq(r, 2);
  47242   terminateO(self);
  47243 
  47244 END_TEST
  47245 
  47246 
  47247 START_TEST(getNDupSSmallJsonGT)
  47248 
  47249   char*            r;
  47250   smallJsont *self = allocSmallJson();
  47251 
  47252   smallJsont *r2 = self->f->setS(self, "1", "qwe");
  47253   ck_assert_ptr_ne(r2, null);
  47254   r = getNDupSSmallJsonG(self, null, "1");
  47255   ck_assert_ptr_ne(r, null);
  47256   ck_assert_str_eq(r, "qwe");
  47257   free(r);
  47258   terminateO(self);
  47259 
  47260 END_TEST
  47261 
  47262 
  47263 START_TEST(getNDupDictSmallJsonGT)
  47264 
  47265   smallJsont* r2;
  47266   smallDictt*      r;
  47267   smallJsont *self = allocSmallJson();
  47268   smallDictt *dict = allocSmallDict();
  47269 
  47270   r2 = self->f->setNFreeDict(self, "1", dict);
  47271   ck_assert_ptr_ne(r2, null);
  47272   r = getNDupDictSmallJsonG(self, null, "1");
  47273   ck_assert_ptr_ne(r, null);
  47274   char *s = toStringO(r);
  47275   terminateO(r);
  47276   ck_assert_str_eq(s, "{}");
  47277   free(s);
  47278   terminateO(self);
  47279 
  47280 END_TEST
  47281 
  47282 
  47283 START_TEST(getNDupArraySmallJsonGT)
  47284 
  47285   smallArrayt*     r;
  47286   smallJsont *self   = allocSmallJson();
  47287   smallArrayt *array = allocSmallArray();
  47288 
  47289   smallJsont *r2 = self->f->setNFreeArray(self, "1", array);
  47290   ck_assert_ptr_ne(r2, null);
  47291   r = getNDupArraySmallJsonG(self, null, "1");
  47292   ck_assert_ptr_ne(r, null);
  47293   char *s = toStringO(r);
  47294   terminateO(r);
  47295   ck_assert_str_eq(s, "[]");
  47296   free(s);
  47297   terminateO(self);
  47298 
  47299 END_TEST
  47300 
  47301 
  47302 START_TEST(getNDupSmallBoolSmallJsonGT)
  47303 
  47304   smallBoolt*      r;
  47305   smallJsont *self = allocSmallJson();
  47306 
  47307   smallJsont *r2 = self->f->setBool(self, "1", true);
  47308   ck_assert_ptr_ne(r2, null);
  47309   r = getNDupSmallBoolSmallJsonG(self, null, "1");
  47310   ck_assert_ptr_ne(r, null);
  47311   char *s = toStringO(r);
  47312   terminateO(r);
  47313   ck_assert_str_eq(s, "true");
  47314   free(s);
  47315   terminateO(self);
  47316 
  47317 END_TEST
  47318 
  47319 
  47320 START_TEST(getNDupSmallBytesSmallJsonGT)
  47321 
  47322   smallBytest*     r;
  47323   smallJsont *self   = allocSmallJson();
  47324   smallBytest *value = allocSmallBytes("qwe", sizeof("qwe"));
  47325 
  47326   smallJsont *r2 = self->f->setNFreeSmallBytes(self, "1", value);
  47327   ck_assert_ptr_ne(r2, null);
  47328   r = getNDupSmallBytesSmallJsonG(self, null, "1");
  47329   ck_assert_ptr_ne(r, null);
  47330   char *s = toStringO(r);
  47331   terminateO(r);
  47332   ck_assert_str_eq(s, "[0x71,0x77,0x65,0x00]");
  47333   free(s);
  47334   terminateO(self);
  47335 
  47336 END_TEST
  47337 
  47338 
  47339 START_TEST(getNDupSmallDoubleSmallJsonGT)
  47340 
  47341   smallDoublet*    r;
  47342   smallJsont *self = allocSmallJson();
  47343 
  47344   smallJsont *r2 = self->f->setDouble(self, "1", 2.2);
  47345   ck_assert_ptr_ne(r2, null);
  47346   r = getNDupSmallDoubleSmallJsonG(self, null, "1");
  47347   ck_assert_ptr_ne(r, null);
  47348   char *s = toStringO(r);
  47349   terminateO(r);
  47350   ck_assert_str_eq(s, "2.200000e+00");
  47351   free(s);
  47352   terminateO(self);
  47353 
  47354 END_TEST
  47355 
  47356 
  47357 START_TEST(getNDupSmallIntSmallJsonGT)
  47358 
  47359   smallIntt*       r;
  47360   smallJsont *self = allocSmallJson();
  47361 
  47362   smallJsont *r2 = self->f->setInt(self, "1", 2);
  47363   ck_assert_ptr_ne(r2, null);
  47364   r = getNDupSmallIntSmallJsonG(self, null, "1");
  47365   ck_assert_ptr_ne(r, null);
  47366   char *s = toStringO(r);
  47367   terminateO(r);
  47368   ck_assert_str_eq(s, "2");
  47369   free(s);
  47370   terminateO(self);
  47371 
  47372 END_TEST
  47373 
  47374 
  47375 START_TEST(getNDupSmallJsonSmallJsonGT)
  47376 
  47377   smallJsont*      r;
  47378   smallJsont *self  = allocSmallJson();
  47379   smallJsont *value = allocSmallJson();
  47380 
  47381   setTopIntO(value, 2);
  47382   smallJsont *r2 = self->f->setNFreeSmallJson(self, "1", value);
  47383   ck_assert_ptr_ne(r2, null);
  47384   r = getNDupSmallJsonSmallJsonG(self, null, "1");
  47385   ck_assert_ptr_ne(r, null);
  47386   char *s = toStringO(r);
  47387   terminateO(r);
  47388   ck_assert_str_eq(s, "2");
  47389   free(s);
  47390   terminateO(self);
  47391 
  47392 END_TEST
  47393 
  47394 
  47395 START_TEST(getNDupSmallStringSmallJsonGT)
  47396 
  47397   smallStringt*    r;
  47398   smallJsont *self = allocSmallJson();
  47399 
  47400   smallJsont *r2 = self->f->setS(self, "1", "qwe");
  47401   ck_assert_ptr_ne(r2, null);
  47402   r = getNDupSmallStringSmallJsonG(self, null, "1");
  47403   ck_assert_ptr_ne(r, null);
  47404   char *s = toStringO(r);
  47405   terminateO(r);
  47406   ck_assert_str_eq(s, "qwe");
  47407   free(s);
  47408   terminateO(self);
  47409 
  47410 END_TEST
  47411 
  47412 
  47413 START_TEST(getNDupVoidSmallJsonGT)
  47414 
  47415   void*            r;
  47416   smallJsont *self = allocSmallJson();
  47417 
  47418   createSmallContainer(c);
  47419   setValO(&c, &r);
  47420   smallJsont *r2 = self->f->setSmallContainer(self, "1", &c);
  47421   ck_assert_ptr_ne(r2, null);
  47422   r = getNDupVoidSmallJsonG(self, null, "1");
  47423   ck_assert_ptr_eq(r, null);
  47424   terminateO(self);
  47425 
  47426 END_TEST
  47427 
  47428 
  47429 START_TEST(getNDupSmallContainerSmallJsonGT)
  47430 
  47431   smallContainert* r;
  47432   smallJsont *self = allocSmallJson();
  47433 
  47434   createSmallContainer(c);
  47435   setValO(&c, &r);
  47436   smallJsont *r2 = self->f->setSmallContainer(self, "1", &c);
  47437   ck_assert_ptr_ne(r2, null);
  47438   r = getNDupSmallContainerSmallJsonG(self, null, "1");
  47439   ck_assert_ptr_ne(r, null);
  47440   char *s = toStringO(r);
  47441   terminateO(r);
  47442   ck_assert_str_eq(s, "<data smallContainer>");
  47443   free(s);
  47444   terminateO(self);
  47445 
  47446 END_TEST
  47447 
  47448 
  47449 START_TEST(getAtSmallJsonGT)
  47450 
  47451   baset*           r;
  47452   smallJsont *self = allocSmallJson();
  47453 
  47454   smallJsont *r2   = self->f->pushInt(self, 1);
  47455   ck_assert_ptr_ne(r2, null);
  47456   r = getAtSmallJsonG(self, NULL, 0);
  47457   ck_assert_ptr_ne(r, null);
  47458   char *s = toStringO(r);
  47459   finishO(r);
  47460   ck_assert_str_eq(s, "1");
  47461   free(s);
  47462   terminateO(self);
  47463 
  47464 END_TEST
  47465 
  47466 
  47467 START_TEST(getAtUndefinedSmallJsonGT)
  47468 
  47469   undefinedt*      r;
  47470   smallJsont *self = allocSmallJson();
  47471 
  47472   smallJsont *r2   = self->f->pushUndefined(self);
  47473   ck_assert_ptr_ne(r2, null);
  47474   r = getAtUndefinedSmallJsonG(self, null, 0);
  47475   ck_assert_ptr_ne(r, null);
  47476   char *s = toStringO(r);
  47477   finishO(r);
  47478   ck_assert_str_eq(s, "null");
  47479   free(s);
  47480   terminateO(self);
  47481 
  47482 END_TEST
  47483 
  47484 
  47485 START_TEST(getAtBoolSmallJsonGT)
  47486 
  47487   bool             r;
  47488   smallJsont *self = allocSmallJson();
  47489 
  47490   smallJsont *r2   = self->f->pushBool(self, TRUE);
  47491   ck_assert_ptr_ne(r2, null);
  47492   r = getAtBoolSmallJsonG(self, null, 0);
  47493   ck_assert(r);
  47494   terminateO(self);
  47495 
  47496 END_TEST
  47497 
  47498 
  47499 START_TEST(getAtBoolPSmallJsonGT)
  47500 
  47501   bool*            r;
  47502   smallJsont *self = allocSmallJson();
  47503 
  47504   smallJsont *r2   = self->f->pushBool(self, TRUE);
  47505   ck_assert_ptr_ne(r2, null);
  47506   r = getAtBoolPSmallJsonG(self, null, 0);
  47507   ck_assert_ptr_ne(r, null);
  47508   ck_assert(*r);
  47509   terminateO(self);
  47510 
  47511 END_TEST
  47512 
  47513 
  47514 START_TEST(getAtDoubleSmallJsonGT)
  47515 
  47516   double           r;
  47517   smallJsont *self = allocSmallJson();
  47518 
  47519   smallJsont *r2   = self->f->pushDouble(self, 2.0);
  47520   ck_assert_ptr_ne(r2, null);
  47521   r = getAtDoubleSmallJsonG(self, 0, 0);
  47522   ck_assert(r==2.0);
  47523   terminateO(self);
  47524 
  47525 END_TEST
  47526 
  47527 
  47528 START_TEST(getAtDoublePSmallJsonGT)
  47529 
  47530   double*          r;
  47531   smallJsont *self = allocSmallJson();
  47532 
  47533   smallJsont *r2   = self->f->pushDouble(self, 2.0);
  47534   ck_assert_ptr_ne(r2, null);
  47535   r = getAtDoublePSmallJsonG(self, 0, 0);
  47536   ck_assert_ptr_ne(r, null);
  47537   ck_assert(*r==2.0);
  47538   terminateO(self);
  47539 
  47540 END_TEST
  47541 
  47542 
  47543 START_TEST(getAtIntSmallJsonGT)
  47544 
  47545   int64_t          r;
  47546   smallJsont *self = allocSmallJson();
  47547 
  47548   smallJsont *r2   = self->f->pushInt(self, 2);
  47549   ck_assert_ptr_ne(r2, null);
  47550   r = getAtIntSmallJsonG(self, 0, 0);
  47551   ck_assert_int_eq(r, 2);
  47552   terminateO(self);
  47553 
  47554 END_TEST
  47555 
  47556 
  47557 START_TEST(getAtIntPSmallJsonGT)
  47558 
  47559   int64_t*         r;
  47560   smallJsont *self = allocSmallJson();
  47561 
  47562   smallJsont *r2   = self->f->pushInt(self, 2);
  47563   ck_assert_ptr_ne(r2, null);
  47564   r = getAtIntPSmallJsonG(self, 0, 0);
  47565   ck_assert_ptr_ne(r, null);
  47566   ck_assert_int_eq(*r, 2);
  47567   terminateO(self);
  47568 
  47569 END_TEST
  47570 
  47571 
  47572 START_TEST(getAtInt32SmallJsonGT)
  47573 
  47574   int32_t          r;
  47575   smallJsont *self = allocSmallJson();
  47576 
  47577   smallJsont *r2   = self->f->pushInt(self, 2);
  47578   ck_assert_ptr_ne(r2, null);
  47579   r = getAtInt32SmallJsonG(self, 0, 0);
  47580   ck_assert_int_eq(r, 2);
  47581   terminateO(self);
  47582 
  47583 END_TEST
  47584 
  47585 
  47586 START_TEST(getAtInt32PSmallJsonGT)
  47587 
  47588   int32_t*         r;
  47589   smallJsont *self = allocSmallJson();
  47590 
  47591   smallJsont *r2   = self->f->pushInt(self, 2);
  47592   ck_assert_ptr_ne(r2, null);
  47593   r = getAtInt32PSmallJsonG(self, 0, 0);
  47594   ck_assert_ptr_ne(r, null);
  47595   ck_assert_int_eq(*r, 2);
  47596   terminateO(self);
  47597 
  47598 END_TEST
  47599 
  47600 
  47601 START_TEST(getAtUintSmallJsonGT)
  47602 
  47603   uint64_t         r;
  47604   smallJsont *self = allocSmallJson();
  47605 
  47606   smallJsont *r2   = self->f->pushInt(self, 2);
  47607   ck_assert_ptr_ne(r2, null);
  47608   r = getAtUintSmallJsonG(self, 0, 0);
  47609   ck_assert_int_eq(r, 2);
  47610   terminateO(self);
  47611 
  47612 END_TEST
  47613 
  47614 
  47615 START_TEST(getAtUintPSmallJsonGT)
  47616 
  47617   uint64_t*        r;
  47618   smallJsont *self = allocSmallJson();
  47619 
  47620   smallJsont *r2   = self->f->pushInt(self, 2);
  47621   ck_assert_ptr_ne(r2, null);
  47622   r = getAtUintPSmallJsonG(self, 0, 0);
  47623   ck_assert_ptr_ne(r, null);
  47624   ck_assert_int_eq(*r, 2);
  47625   terminateO(self);
  47626 
  47627 END_TEST
  47628 
  47629 
  47630 START_TEST(getAtUint32SmallJsonGT)
  47631 
  47632   uint32_t         r;
  47633   smallJsont *self = allocSmallJson();
  47634 
  47635   smallJsont *r2   = self->f->pushInt(self, 2);
  47636   ck_assert_ptr_ne(r2, null);
  47637   r = getAtUint32SmallJsonG(self, 0, 0);
  47638   ck_assert_int_eq(r, 2);
  47639   terminateO(self);
  47640 
  47641 END_TEST
  47642 
  47643 
  47644 START_TEST(getAtUint32PSmallJsonGT)
  47645 
  47646   uint32_t*        r;
  47647   smallJsont *self = allocSmallJson();
  47648 
  47649   smallJsont *r2   = self->f->pushInt(self, 2);
  47650   ck_assert_ptr_ne(r2, null);
  47651   r = getAtUint32PSmallJsonG(self, 0, 0);
  47652   ck_assert_ptr_ne(r, null);
  47653   ck_assert_int_eq(*r, 2);
  47654   terminateO(self);
  47655 
  47656 END_TEST
  47657 
  47658 
  47659 START_TEST(getAtSSmallJsonGT)
  47660 
  47661   char*            r;
  47662   smallJsont *self = allocSmallJson();
  47663 
  47664   smallJsont *r2   = self->f->pushS(self, "2");
  47665   ck_assert_ptr_ne(r2, null);
  47666   r = getAtSSmallJsonG(self, null, 0);
  47667   ck_assert_str_eq(r, "2");
  47668   terminateO(self);
  47669 
  47670 END_TEST
  47671 
  47672 
  47673 START_TEST(getAtDictSmallJsonGT)
  47674 
  47675   smallDictt*      r;
  47676   smallJsont *self = allocSmallJson();
  47677 
  47678   createSmallDict(d);
  47679   smallJsont *r2   = self->f->pushDict(self, &d);
  47680   ck_assert_ptr_ne(r2, null);
  47681   r = getAtDictSmallJsonG(self, null, 0);
  47682   ck_assert_ptr_ne(r, null);
  47683   char *s = toStringO(r);
  47684   ck_assert_str_eq(s, "{}");
  47685   free(s);
  47686   finishO(r);
  47687   terminateO(self);
  47688 
  47689 END_TEST
  47690 
  47691 
  47692 START_TEST(getAtArraySmallJsonGT)
  47693 
  47694   smallArrayt*     r;
  47695   smallJsont *self = allocSmallJson();
  47696 
  47697   createSmallArray(a);
  47698   smallJsont *r2   = self->f->pushArray(self, &a);
  47699   ck_assert_ptr_ne(r2, null);
  47700   r = getAtArraySmallJsonG(self, null, 0);
  47701   ck_assert_ptr_ne(r, null);
  47702   char *s = toStringO(r);
  47703   ck_assert_str_eq(s, "[]");
  47704   free(s);
  47705   finishO(r);
  47706   terminateO(self);
  47707 
  47708 END_TEST
  47709 
  47710 
  47711 START_TEST(getAtSmallBoolSmallJsonGT)
  47712 
  47713   smallBoolt*      r;
  47714   smallJsont *self = allocSmallJson();
  47715 
  47716   smallJsont *r2   = self->f->pushBool(self, true);
  47717   ck_assert_ptr_ne(r2, null);
  47718   r = getAtSmallBoolSmallJsonG(self, null, 0);
  47719   ck_assert_ptr_ne(r, null);
  47720   char *s = toStringO(r);
  47721   ck_assert_str_eq(s, "true");
  47722   free(s);
  47723   finishO(r);
  47724   terminateO(self);
  47725 
  47726 END_TEST
  47727 
  47728 
  47729 START_TEST(getAtSmallBytesSmallJsonGT)
  47730 
  47731   smallBytest*      r;
  47732   smallJsont *self = allocSmallJson();
  47733 
  47734   createSmallBytes(b);
  47735   smallJsont *r2   = self->f->pushSmallBytes(self, &b);
  47736   ck_assert_ptr_ne(r2, null);
  47737   r = getAtSmallBytesSmallJsonG(self, null, 0);
  47738   ck_assert_ptr_ne(r, null);
  47739   char *s = toStringO(r);
  47740   ck_assert_str_eq(s, "[]");
  47741   free(s);
  47742   finishO(r);
  47743   terminateO(self);
  47744 
  47745 END_TEST
  47746 
  47747 
  47748 START_TEST(getAtSmallDoubleSmallJsonGT)
  47749 
  47750   smallDoublet*    r;
  47751   smallJsont *self = allocSmallJson();
  47752 
  47753   smallJsont *r2   = self->f->pushDouble(self, 1);
  47754   ck_assert_ptr_ne(r2, null);
  47755   r = getAtSmallDoubleSmallJsonG(self, null, 0);
  47756   ck_assert_ptr_ne(r, null);
  47757   char *s = toStringO(r);
  47758   ck_assert_str_eq(s, "1.000000e+00");
  47759   free(s);
  47760   finishO(r);
  47761   terminateO(self);
  47762 
  47763 END_TEST
  47764 
  47765 
  47766 START_TEST(getAtSmallIntSmallJsonGT)
  47767 
  47768   smallIntt*       r;
  47769   smallJsont *self = allocSmallJson();
  47770 
  47771   smallJsont *r2   = self->f->pushInt(self, 1);
  47772   ck_assert_ptr_ne(r2, null);
  47773   r = getAtSmallIntSmallJsonG(self, null, 0);
  47774   ck_assert_ptr_ne(r, null);
  47775   char *s = toStringO(r);
  47776   ck_assert_str_eq(s, "1");
  47777   free(s);
  47778   finishO(r);
  47779   terminateO(self);
  47780 
  47781 END_TEST
  47782 
  47783 
  47784 START_TEST(getAtSmallJsonSmallJsonGT)
  47785 
  47786   smallJsont* r;
  47787   smallJsont *self = allocSmallJson();
  47788 
  47789   createSmallJson(j);
  47790   smallJsont *r2   = self->f->pushSmallJson(self, &j);
  47791   ck_assert_ptr_ne(r2, null);
  47792   r = getAtSmallJsonSmallJsonG(self, null, 0);
  47793   ck_assert_ptr_ne(r, null);
  47794   char *s = toStringO(r);
  47795   ck_assert_str_eq(s, "{}");
  47796   free(s);
  47797   finishO(r);
  47798   terminateO(self);
  47799 
  47800 END_TEST
  47801 
  47802 
  47803 START_TEST(getAtSmallStringSmallJsonGT)
  47804 
  47805   smallStringt*    r;
  47806   smallJsont *self = allocSmallJson();
  47807 
  47808   createSmallString(S);
  47809   smallJsont *r2   = self->f->pushSmallString(self, &S);
  47810   ck_assert_ptr_ne(r2, null);
  47811   r = getAtSmallStringSmallJsonG(self, null, 0);
  47812   ck_assert_ptr_ne(r, null);
  47813   char *s = toStringO(r);
  47814   ck_assert_str_eq(s, "");
  47815   free(s);
  47816   finishO(r);
  47817   terminateO(self);
  47818 
  47819 END_TEST
  47820 
  47821 
  47822 START_TEST(getAtVoidSmallJsonGT)
  47823 
  47824   void*            r;
  47825   smallJsont *self = allocSmallJson();
  47826 
  47827   createSmallContainer(c);
  47828   setValO(&c, &r);
  47829   smallJsont *r2   = self->f->pushSmallContainer(self, &c);
  47830   ck_assert_ptr_ne(r2, null);
  47831   r = getAtVoidSmallJsonG(self, null, 0);
  47832   ck_assert_ptr_eq(r, &r);
  47833   terminateO(self);
  47834 
  47835 END_TEST
  47836 
  47837 
  47838 START_TEST(getAtSmallContainerSmallJsonGT)
  47839 
  47840   smallContainert* r;
  47841   smallJsont *self = allocSmallJson();
  47842 
  47843   createSmallContainer(c);
  47844   smallJsont *r2   = self->f->pushSmallContainer(self, &c);
  47845   ck_assert_ptr_ne(r2, null);
  47846   r = getAtSmallContainerSmallJsonG(self, null, 0);
  47847   ck_assert_ptr_ne(r, null);
  47848   char *s = toStringO(r);
  47849   ck_assert_str_eq(s, "<data smallContainer>");
  47850   free(s);
  47851   finishO(r);
  47852   terminateO(self);
  47853 
  47854 END_TEST
  47855 
  47856 
  47857 START_TEST(getAtNDupSmallJsonGT)
  47858 
  47859   baset*           r;
  47860   smallJsont *self = allocSmallJson();
  47861 
  47862   smallJsont *r2   = self->f->pushInt(self, 1);
  47863   ck_assert_ptr_ne(r2, null);
  47864   r = getAtNDupSmallJsonG(self, NULL, 0);
  47865   ck_assert_ptr_ne(r, null);
  47866   char *s = toStringO(r);
  47867   terminateO(r);
  47868   ck_assert_str_eq(s, "1");
  47869   free(s);
  47870   terminateO(self);
  47871 
  47872 END_TEST
  47873 
  47874 
  47875 START_TEST(getAtNDupUndefinedSmallJsonGT)
  47876 
  47877   undefinedt*      r;
  47878   smallJsont *self = allocSmallJson();
  47879 
  47880   smallJsont *r2   = self->f->pushUndefined(self);
  47881   ck_assert_ptr_ne(r2, null);
  47882   r = getAtNDupUndefinedSmallJsonG(self, null, 0);
  47883   ck_assert_ptr_ne(r, null);
  47884   char *s = toStringO(r);
  47885   terminateO(r);
  47886   ck_assert_str_eq(s, "null");
  47887   free(s);
  47888   terminateO(self);
  47889 
  47890 END_TEST
  47891 
  47892 
  47893 START_TEST(getAtNDupBoolSmallJsonGT)
  47894 
  47895   bool             r;
  47896   smallJsont *self = allocSmallJson();
  47897 
  47898   smallJsont *r2   = self->f->pushBool(self, TRUE);
  47899   ck_assert_ptr_ne(r2, null);
  47900   r = getAtNDupBoolSmallJsonG(self, null, 0);
  47901   ck_assert(r);
  47902   terminateO(self);
  47903 
  47904 END_TEST
  47905 
  47906 
  47907 START_TEST(getAtNDupDoubleSmallJsonGT)
  47908 
  47909   double           r;
  47910   smallJsont *self = allocSmallJson();
  47911 
  47912   smallJsont *r2   = self->f->pushDouble(self, 2.0);
  47913   ck_assert_ptr_ne(r2, null);
  47914   r = getAtNDupDoubleSmallJsonG(self, 0, 0);
  47915   ck_assert(r==2.0);
  47916   terminateO(self);
  47917 
  47918 END_TEST
  47919 
  47920 
  47921 START_TEST(getAtNDupIntSmallJsonGT)
  47922 
  47923   int64_t          r;
  47924   smallJsont *self = allocSmallJson();
  47925 
  47926   smallJsont *r2   = self->f->pushInt(self, 2);
  47927   ck_assert_ptr_ne(r2, null);
  47928   r = getAtNDupIntSmallJsonG(self, 0, 0);
  47929   ck_assert_int_eq(r, 2);
  47930   terminateO(self);
  47931 
  47932 END_TEST
  47933 
  47934 
  47935 START_TEST(getAtNDupInt32SmallJsonGT)
  47936 
  47937   int32_t          r;
  47938   smallJsont *self = allocSmallJson();
  47939 
  47940   smallJsont *r2   = self->f->pushInt(self, 2);
  47941   ck_assert_ptr_ne(r2, null);
  47942   r = getAtNDupInt32SmallJsonG(self, 0, 0);
  47943   ck_assert_int_eq(r, 2);
  47944   terminateO(self);
  47945 
  47946 END_TEST
  47947 
  47948 
  47949 START_TEST(getAtNDupUintSmallJsonGT)
  47950 
  47951   uint64_t         r;
  47952   smallJsont *self = allocSmallJson();
  47953 
  47954   smallJsont *r2   = self->f->pushInt(self, 2);
  47955   ck_assert_ptr_ne(r2, null);
  47956   r = getAtNDupUintSmallJsonG(self, 0, 0);
  47957   ck_assert_int_eq(r, 2);
  47958   terminateO(self);
  47959 
  47960 END_TEST
  47961 
  47962 
  47963 START_TEST(getAtNDupUint32SmallJsonGT)
  47964 
  47965   uint32_t         r;
  47966   smallJsont *self = allocSmallJson();
  47967 
  47968   smallJsont *r2   = self->f->pushInt(self, 2);
  47969   ck_assert_ptr_ne(r2, null);
  47970   r = getAtNDupUint32SmallJsonG(self, 0, 0);
  47971   ck_assert_int_eq(r, 2);
  47972   terminateO(self);
  47973 
  47974 END_TEST
  47975 
  47976 
  47977 START_TEST(getAtNDupSSmallJsonGT)
  47978 
  47979   char*            r;
  47980   smallJsont *self = allocSmallJson();
  47981 
  47982   smallJsont *r2   = self->f->pushS(self, "2");
  47983   ck_assert_ptr_ne(r2, null);
  47984   r = getAtNDupSSmallJsonG(self, null, 0);
  47985   ck_assert_str_eq(r, "2");
  47986   free(r);
  47987   terminateO(self);
  47988 
  47989 END_TEST
  47990 
  47991 
  47992 START_TEST(getAtNDupDictSmallJsonGT)
  47993 
  47994   smallDictt*      r;
  47995   smallJsont *self = allocSmallJson();
  47996 
  47997   createSmallDict(d);
  47998   smallJsont *r2   = self->f->pushDict(self, &d);
  47999   ck_assert_ptr_ne(r2, null);
  48000   r = getAtNDupDictSmallJsonG(self, null, 0);
  48001   ck_assert_ptr_ne(r, null);
  48002   char *s = toStringO(r);
  48003   ck_assert_str_eq(s, "{}");
  48004   free(s);
  48005   terminateO(r);
  48006   terminateO(self);
  48007 
  48008 END_TEST
  48009 
  48010 
  48011 START_TEST(getAtNDupArraySmallJsonGT)
  48012 
  48013   smallArrayt*     r;
  48014   smallJsont *self = allocSmallJson();
  48015 
  48016   createSmallArray(a);
  48017   smallJsont *r2   = self->f->pushArray(self, &a);
  48018   ck_assert_ptr_ne(r2, null);
  48019   r = getAtNDupArraySmallJsonG(self, null, 0);
  48020   ck_assert_ptr_ne(r, null);
  48021   char *s = toStringO(r);
  48022   ck_assert_str_eq(s, "[]");
  48023   free(s);
  48024   terminateO(r);
  48025   terminateO(self);
  48026 
  48027 END_TEST
  48028 
  48029 
  48030 START_TEST(getAtNDupSmallBoolSmallJsonGT)
  48031 
  48032   smallBoolt*      r;
  48033   smallJsont *self = allocSmallJson();
  48034 
  48035   smallJsont *r2   = self->f->pushBool(self, true);
  48036   ck_assert_ptr_ne(r2, null);
  48037   r = getAtNDupSmallBoolSmallJsonG(self, null, 0);
  48038   ck_assert_ptr_ne(r, null);
  48039   char *s = toStringO(r);
  48040   ck_assert_str_eq(s, "true");
  48041   free(s);
  48042   terminateO(r);
  48043   terminateO(self);
  48044 
  48045 END_TEST
  48046 
  48047 
  48048 START_TEST(getAtNDupSmallBytesSmallJsonGT)
  48049 
  48050   smallBytest*      r;
  48051   smallJsont *self = allocSmallJson();
  48052 
  48053   createSmallBytes(b);
  48054   smallJsont *r2   = self->f->pushSmallBytes(self, &b);
  48055   ck_assert_ptr_ne(r2, null);
  48056   r = getAtNDupSmallBytesSmallJsonG(self, null, 0);
  48057   ck_assert_ptr_ne(r, null);
  48058   char *s = toStringO(r);
  48059   ck_assert_str_eq(s, "[]");
  48060   free(s);
  48061   terminateO(r);
  48062   terminateO(self);
  48063 
  48064 END_TEST
  48065 
  48066 
  48067 START_TEST(getAtNDupSmallDoubleSmallJsonGT)
  48068 
  48069   smallDoublet*    r;
  48070   smallJsont *self = allocSmallJson();
  48071 
  48072   smallJsont *r2   = self->f->pushDouble(self, 1);
  48073   ck_assert_ptr_ne(r2, null);
  48074   r = getAtNDupSmallDoubleSmallJsonG(self, null, 0);
  48075   ck_assert_ptr_ne(r, null);
  48076   char *s = toStringO(r);
  48077   ck_assert_str_eq(s, "1.000000e+00");
  48078   free(s);
  48079   terminateO(r);
  48080   terminateO(self);
  48081 
  48082 END_TEST
  48083 
  48084 
  48085 START_TEST(getAtNDupSmallIntSmallJsonGT)
  48086 
  48087   smallIntt*       r;
  48088   smallJsont *self = allocSmallJson();
  48089 
  48090   smallJsont *r2   = self->f->pushInt(self, 1);
  48091   ck_assert_ptr_ne(r2, null);
  48092   r = getAtNDupSmallIntSmallJsonG(self, null, 0);
  48093   ck_assert_ptr_ne(r, null);
  48094   char *s = toStringO(r);
  48095   ck_assert_str_eq(s, "1");
  48096   free(s);
  48097   terminateO(r);
  48098   terminateO(self);
  48099 
  48100 END_TEST
  48101 
  48102 
  48103 START_TEST(getAtNDupSmallJsonSmallJsonGT)
  48104 
  48105   smallJsont*      r;
  48106   smallJsont *self = allocSmallJson();
  48107 
  48108   createSmallJson(j);
  48109   smallJsont *r2   = self->f->pushSmallJson(self, &j);
  48110   ck_assert_ptr_ne(r2, null);
  48111   r = getAtNDupSmallJsonSmallJsonG(self, null, 0);
  48112   ck_assert_ptr_ne(r, null);
  48113   char *s = toStringO(r);
  48114   ck_assert_str_eq(s, "{}");
  48115   free(s);
  48116   terminateO(r);
  48117   terminateO(self);
  48118 
  48119 END_TEST
  48120 
  48121 
  48122 START_TEST(getAtNDupSmallStringSmallJsonGT)
  48123 
  48124   smallStringt*    r;
  48125   smallJsont *self = allocSmallJson();
  48126 
  48127   createSmallString(S);
  48128   smallJsont *r2   = self->f->pushSmallString(self, &S);
  48129   ck_assert_ptr_ne(r2, null);
  48130   r = getAtNDupSmallStringSmallJsonG(self, null, 0);
  48131   ck_assert_ptr_ne(r, null);
  48132   char *s = toStringO(r);
  48133   ck_assert_str_eq(s, "");
  48134   free(s);
  48135   terminateO(r);
  48136   terminateO(self);
  48137 
  48138 END_TEST
  48139 
  48140 
  48141 START_TEST(getAtNDupVoidSmallJsonGT)
  48142 
  48143   void*            r;
  48144   smallJsont *self = allocSmallJson();
  48145 
  48146   createSmallContainer(c);
  48147   setValO(&c, &r);
  48148   smallJsont *r2   = self->f->pushSmallContainer(self, &c);
  48149   ck_assert_ptr_ne(r2, null);
  48150   r = getAtNDupVoidSmallJsonG(self, null, 0);
  48151   ck_assert_ptr_eq(r, NULL);
  48152   terminateO(self);
  48153 
  48154 END_TEST
  48155 
  48156 
  48157 START_TEST(getAtNDupSmallContainerSmallJsonGT)
  48158 
  48159   smallContainert* r;
  48160   smallJsont *self = allocSmallJson();
  48161 
  48162   createSmallContainer(c);
  48163   smallJsont *r2   = self->f->pushSmallContainer(self, &c);
  48164   ck_assert_ptr_ne(r2, null);
  48165   r = getAtNDupSmallContainerSmallJsonG(self, null, 0);
  48166   ck_assert_ptr_ne(r, null);
  48167   char *s = toStringO(r);
  48168   ck_assert_str_eq(s, "<data smallContainer>");
  48169   free(s);
  48170   terminateO(r);
  48171   terminateO(self);
  48172 
  48173 END_TEST
  48174 
  48175 
  48176 START_TEST(getNumSmallJsonGT)
  48177 
  48178   double r;
  48179   smallJsont *self = allocSmallJson();
  48180   smallJsont *r2;
  48181 
  48182   r2 = self->f->setInt(self, "1", 1);
  48183   ck_assert_ptr_ne(r2, null);
  48184   r2 = self->f->setDouble(self, "2", 2.2);
  48185   ck_assert_ptr_ne(r2, null);
  48186   r2 = self->f->setS(self, "3", "2");
  48187   ck_assert_ptr_ne(r2, null);
  48188   r = getNumSmallJsonG(self, "1");
  48189   ck_assert(r == 1);
  48190   r = getNumSmallJsonG(self, "2");
  48191   ck_assert(r == 2.2);
  48192   terminateO(self);
  48193 
  48194 END_TEST
  48195 
  48196 
  48197 START_TEST(getNumAtSmallJsonGT)
  48198 
  48199   double r;
  48200   smallJsont *self = allocSmallJson();
  48201   smallJsont *r2;
  48202 
  48203   r2 = self->f->pushDouble(self, 1);
  48204   ck_assert_ptr_ne(r2, NULL);
  48205   r  = getNumAtSmallJsonG(self, 0);
  48206   ck_assert(r==1);
  48207   terminateO(self);
  48208 
  48209 END_TEST
  48210 
  48211 
  48212 START_TEST(delKeySmallJsonGT)
  48213 
  48214   smallJsont* r;
  48215   smallJsont *self = allocG(rtSmallJsont);
  48216 
  48217   r = self->f->setInt(self, "1", 1);
  48218   ck_assert_ptr_ne(r, null);
  48219   r = self->f->setDouble(self, "2", 2.2);
  48220   ck_assert_ptr_ne(r, null);
  48221   r = delKeySmallJsonG(self, "2", 0);
  48222   ck_assert_ptr_ne(r, null);
  48223   char *s = toStringO(r);
  48224   ck_assert_str_eq(s, "{\"1\":1}");
  48225   free(s);
  48226   terminateO(self);
  48227 
  48228 END_TEST
  48229 
  48230 
  48231 START_TEST(delSmallJsonGT)
  48232 
  48233   smallJsont* r;
  48234   smallJsont *self = allocSmallJson();
  48235 
  48236   r = self->f->pushInt(self, 1);
  48237   ck_assert_ptr_ne(r, null);
  48238   r = self->f->pushInt(self, 2);
  48239   ck_assert_ptr_ne(r, null);
  48240   r = self->f->pushInt(self, 3);
  48241   ck_assert_ptr_ne(r, null);
  48242   r = self->f->pushInt(self, 4);
  48243   ck_assert_ptr_ne(r, null);
  48244   r = delSmallJsonG(self, 1, -1);
  48245   ck_assert_ptr_ne(r, null);
  48246   char *s = toStringO(r);
  48247   ck_assert_str_eq(s, "[1,4]");
  48248   free(s);
  48249   terminateO(self);
  48250 
  48251 END_TEST
  48252 
  48253 
  48254 START_TEST(delElemSmallJsonGT)
  48255 
  48256   smallJsont* r;
  48257   smallJsont *self = allocG(rtSmallJsont);
  48258 
  48259   r = self->f->setInt(self, "1", 1);
  48260   ck_assert_ptr_ne(r, null);
  48261   r = self->f->setDouble(self, "2", 2.2);
  48262   ck_assert_ptr_ne(r, null);
  48263   r = delElemSmallJsonG(self, "2");
  48264   ck_assert_ptr_ne(r, null);
  48265   char *s = toStringO(r);
  48266   ck_assert_str_eq(s, "{\"1\":1}");
  48267   free(s);
  48268   terminateO(self);
  48269 
  48270 END_TEST
  48271 
  48272 
  48273 START_TEST(delElemIndexSmallJsonGT)
  48274 
  48275   smallJsont* r;
  48276   smallJsont *self = allocSmallJson();
  48277 
  48278   r = self->f->pushInt(self, 1);
  48279   ck_assert_ptr_ne(r, null);
  48280   r = self->f->pushInt(self, 2);
  48281   ck_assert_ptr_ne(r, null);
  48282   r = self->f->pushInt(self, 3);
  48283   ck_assert_ptr_ne(r, null);
  48284   r = self->f->pushInt(self, 4);
  48285   ck_assert_ptr_ne(r, null);
  48286   r = delElemIndexSmallJsonG(self, 0);
  48287   ck_assert_ptr_ne(r, null);
  48288   char *s = toStringO(r);
  48289   ck_assert_str_eq(s, "[2,3,4]");
  48290   free(s);
  48291   r = delElemIndexSmallJsonG(self, -1);
  48292   ck_assert_ptr_ne(r, null);
  48293   s = toStringO(r);
  48294   ck_assert_str_eq(s, "[2,3]");
  48295   free(s);
  48296   r = delElemIndexSmallJsonG(self, 5);
  48297   ck_assert_ptr_eq(r, null);
  48298   r = delElemIndexSmallJsonG(self, -5);
  48299   ck_assert_ptr_eq(r, null);
  48300   terminateO(self);
  48301 
  48302 END_TEST
  48303 
  48304 
  48305 START_TEST(prependSmallJsonGT)
  48306 
  48307   smallJsont* r;
  48308   smallJsont *self = allocSmallJson();
  48309   baset *value = (baset*) allocSmallInt(1);
  48310 
  48311   r = prependSmallJsonG(self, value);
  48312   ck_assert_ptr_ne(r, null);
  48313   finishO(value);
  48314   char *s = toStringO(r);
  48315   ck_assert_str_eq(s, "[1]");
  48316   free(s);
  48317   terminateO(self);
  48318 
  48319 END_TEST
  48320 
  48321 
  48322 START_TEST(prependUndefinedSmallJsonGT)
  48323 
  48324   smallJsont* r;
  48325   smallJsont *self = allocSmallJson();
  48326 
  48327   r = prependUndefinedSmallJsonG(self, NULL);
  48328   ck_assert_ptr_ne(r, null);
  48329   char *s = toStringO(r);
  48330   ck_assert_str_eq(s, "[null]");
  48331   free(s);
  48332   terminateO(self);
  48333 
  48334 END_TEST
  48335 
  48336 
  48337 START_TEST(prependBoolSmallJsonGT)
  48338 
  48339   smallJsont* r;
  48340   smallJsont *self = allocSmallJson();
  48341 
  48342   r = prependBoolSmallJsonG(self, true);
  48343   ck_assert_ptr_ne(r, null);
  48344   char *s = toStringO(r);
  48345   ck_assert_str_eq(s, "[true]");
  48346   free(s);
  48347   terminateO(self);
  48348 
  48349 END_TEST
  48350 
  48351 
  48352 START_TEST(prependDoubleSmallJsonGT)
  48353 
  48354   smallJsont* r;
  48355   smallJsont *self = allocSmallJson();
  48356 
  48357   r = prependDoubleSmallJsonG(self, 1);
  48358   ck_assert_ptr_ne(r, null);
  48359   char *s = toStringO(r);
  48360   ck_assert_str_eq(s, "[1.000000e+00]");
  48361   free(s);
  48362   terminateO(self);
  48363 
  48364 END_TEST
  48365 
  48366 
  48367 START_TEST(prependIntSmallJsonGT)
  48368 
  48369   smallJsont* r;
  48370   smallJsont *self = allocSmallJson();
  48371 
  48372   r = prependIntSmallJsonG(self, 1);
  48373   ck_assert_ptr_ne(r, null);
  48374   char *s = toStringO(r);
  48375   ck_assert_str_eq(s, "[1]");
  48376   free(s);
  48377   terminateO(self);
  48378 
  48379 END_TEST
  48380 
  48381 
  48382 START_TEST(prependSSmallJsonGT)
  48383 
  48384   smallJsont* r;
  48385   smallJsont *self = allocSmallJson();
  48386 
  48387   r = prependSSmallJsonG(self, "qwe");
  48388   ck_assert_ptr_ne(r, null);
  48389   char *s = toStringO(r);
  48390   ck_assert_str_eq(s, "[\"qwe\"]");
  48391   free(s);
  48392   terminateO(self);
  48393 
  48394 END_TEST
  48395 
  48396 
  48397 START_TEST(prependCharSmallJsonGT)
  48398 
  48399   smallJsont* r;
  48400   smallJsont *self = allocSmallJson();
  48401 
  48402   r = prependCharSmallJsonG(self, 'Q');
  48403   ck_assert_ptr_ne(r, null);
  48404   char *s = toStringO(r);
  48405   ck_assert_str_eq(s, "[\"Q\"]");
  48406   free(s);
  48407   terminateO(self);
  48408 
  48409 END_TEST
  48410 
  48411 
  48412 START_TEST(prependDictSmallJsonGT)
  48413 
  48414   smallJsont* r;
  48415   smallJsont *self = allocSmallJson();
  48416   smallDictt *dict  = allocSmallDict();
  48417 
  48418   r = prependDictSmallJsonG(self, dict);
  48419   ck_assert_ptr_ne(r, null);
  48420   finishO(dict);
  48421   char *s = toStringO(r);
  48422   ck_assert_str_eq(s, "[{}]");
  48423   free(s);
  48424   terminateO(self);
  48425 
  48426 END_TEST
  48427 
  48428 
  48429 START_TEST(prependArraySmallJsonGT)
  48430 
  48431   smallJsont* r;
  48432   smallJsont *self  = allocSmallJson();
  48433   smallArrayt *array = allocSmallArray();
  48434 
  48435   r = prependArraySmallJsonG(self, array);
  48436   ck_assert_ptr_ne(r, null);
  48437   finishO(array);
  48438   char *s = toStringO(r);
  48439   ck_assert_str_eq(s, "[[]]");
  48440   free(s);
  48441   terminateO(self);
  48442 
  48443 END_TEST
  48444 
  48445 
  48446 START_TEST(prependArraycSmallJsonGT)
  48447 
  48448   smallJsont* r;
  48449   smallJsont *self = allocSmallJson();
  48450   char **array      = listCreateS("a","bb");
  48451 
  48452   r = prependArraycSmallJsonG(self, array);
  48453   ck_assert_ptr_ne(r, null);
  48454   ck_assert_int_eq(lenO(r), 1);
  48455   listFreeS(array);
  48456   char *s = toStringO(r);
  48457   ck_assert_str_eq(s, "[[\"a\",\"bb\"]]");
  48458   free(s);
  48459   terminateO(self);
  48460 
  48461 END_TEST
  48462 
  48463 
  48464 START_TEST(prependCArraycSmallJsonGT)
  48465 
  48466   smallJsont* r;
  48467   smallJsont *self   = allocSmallJson();
  48468   const char *array[] = {"a", "bb", NULL};
  48469 
  48470   r = prependCArraycSmallJsonG(self, array);
  48471   ck_assert_ptr_ne(r, null);
  48472   ck_assert_int_eq(lenO(r), 1);
  48473   char *s = toStringO(r);
  48474   ck_assert_str_eq(s, "[[\"a\",\"bb\"]]");
  48475   free(s);
  48476   terminateO(self);
  48477 
  48478 END_TEST
  48479 
  48480 
  48481 START_TEST(prependVoidSmallJsonGT)
  48482 
  48483   smallJsont* r;
  48484   smallJsont *self = allocSmallJson();
  48485 
  48486   // NULL value
  48487   r = prependVoidSmallJsonG(self, NULL);
  48488   ck_assert_ptr_ne(r, null);
  48489   char *s = toStringO(r);
  48490   ck_assert_str_eq(s, "[null]");
  48491   free(s);
  48492   // value
  48493   r = prependVoidSmallJsonG(self, r);
  48494   s = toStringO(r);
  48495   ck_assert_str_eq(s, "[\"<data container>\",null]");
  48496   free(s);
  48497   terminateO(self);
  48498 
  48499 END_TEST
  48500 
  48501 
  48502 START_TEST(prependSmallBoolSmallJsonGT)
  48503 
  48504   smallJsont* r;
  48505   smallJsont *self = allocSmallJson();
  48506   smallBoolt *value = allocSmallBool(true);
  48507 
  48508   r = prependSmallBoolSmallJsonG(self, value);
  48509   ck_assert_ptr_ne(r, null);
  48510   finishO(value);
  48511   char *s = toStringO(r);
  48512   ck_assert_str_eq(s, "[true]");
  48513   free(s);
  48514   terminateO(self);
  48515 
  48516 END_TEST
  48517 
  48518 
  48519 START_TEST(prependSmallBytesSmallJsonGT)
  48520 
  48521   smallJsont* r;
  48522   smallJsont *self = allocSmallJson();
  48523   smallBytest *value = allocSmallBytes("qwe", 3);
  48524 
  48525   r = prependSmallBytesSmallJsonG(self, value);
  48526   ck_assert_ptr_ne(r, null);
  48527   finishO(value);
  48528   char *s = toStringO(r);
  48529   ck_assert_str_eq(s, "[[0x71,0x77,0x65]]");
  48530   free(s);
  48531   terminateO(self);
  48532 
  48533 END_TEST
  48534 
  48535 
  48536 START_TEST(prependSmallDoubleSmallJsonGT)
  48537 
  48538   smallJsont* r;
  48539   smallJsont *self = allocSmallJson();
  48540   smallDoublet *value = allocSmallDouble(1);
  48541 
  48542   r = prependSmallDoubleSmallJsonG(self, value);
  48543   ck_assert_ptr_ne(r, null);
  48544   finishO(value);
  48545   char *s = toStringO(r);
  48546   ck_assert_str_eq(s, "[1.000000e+00]");
  48547   free(s);
  48548   terminateO(self);
  48549 
  48550 END_TEST
  48551 
  48552 
  48553 START_TEST(prependSmallIntSmallJsonGT)
  48554 
  48555   smallJsont* r;
  48556   smallJsont *self = allocSmallJson();
  48557   smallIntt *value  = allocSmallInt(1);
  48558 
  48559   r = prependSmallIntSmallJsonG(self, value);
  48560   ck_assert_ptr_ne(r, null);
  48561   finishO(value);
  48562   char *s = toStringO(r);
  48563   ck_assert_str_eq(s, "[1]");
  48564   free(s);
  48565   terminateO(self);
  48566 
  48567 END_TEST
  48568 
  48569 
  48570 START_TEST(prependSmallJsonSmallJsonGT)
  48571 
  48572   smallJsont* r;
  48573   smallJsont *self = allocSmallJson();
  48574   smallJsont *value = allocSmallJson();
  48575 
  48576   r = prependSmallJsonSmallJsonG(self, value);
  48577   ck_assert_ptr_ne(r, null);
  48578   finishO(value);
  48579   char *s = toStringO(r);
  48580   ck_assert_str_eq(s, "[{}]");
  48581   free(s);
  48582   terminateO(self);
  48583 
  48584 END_TEST
  48585 
  48586 
  48587 START_TEST(prependSmallStringSmallJsonGT)
  48588 
  48589   smallJsont* r;
  48590   smallJsont *self    = allocSmallJson();
  48591   smallStringt *string = allocSmallString("qwe");
  48592 
  48593   r = prependSmallStringSmallJsonG(self, string);
  48594   ck_assert_ptr_ne(r, null);
  48595   finishO(string);
  48596   char *s = toStringO(r);
  48597   ck_assert_str_eq(s, "[\"qwe\"]");
  48598   free(s);
  48599   terminateO(self);
  48600 
  48601 END_TEST
  48602 
  48603 
  48604 START_TEST(prependSmallContainerSmallJsonGT)
  48605 
  48606   smallJsont* r;
  48607   smallJsont *self = allocSmallJson();
  48608 
  48609   createSmallContainer(c);
  48610   r = prependSmallContainerSmallJsonG(self, &c);
  48611   ck_assert_ptr_ne(r, null);
  48612   char *s = toStringO(r);
  48613   ck_assert_str_eq(s, "[\"<data container>\"]");
  48614   free(s);
  48615   terminateO(self);
  48616 
  48617 END_TEST
  48618 
  48619 
  48620 START_TEST(prependNFreeSmallJsonGT)
  48621 
  48622   smallJsont* r;
  48623   smallJsont *self = allocSmallJson();
  48624   baset *value = (baset*) allocSmallInt(1);
  48625 
  48626   r = prependNFreeSmallJsonG(self, value);
  48627   ck_assert_ptr_ne(r, null);
  48628   char *s = toStringO(r);
  48629   ck_assert_str_eq(s, "[1]");
  48630   free(s);
  48631   terminateO(self);
  48632 
  48633 END_TEST
  48634 
  48635 
  48636 START_TEST(prependNFreeUndefinedSmallJsonGT)
  48637 
  48638   smallJsont* r;
  48639   smallJsont *self = allocSmallJson();
  48640   undefinedt *value = allocUndefined();
  48641 
  48642   r = prependNFreeUndefinedSmallJsonG(self, value);
  48643   ck_assert_ptr_ne(r, null);
  48644   char *s = toStringO(r);
  48645   ck_assert_str_eq(s, "[null]");
  48646   free(s);
  48647   terminateO(self);
  48648 
  48649 END_TEST
  48650 
  48651 
  48652 START_TEST(prependNFreeSSmallJsonGT)
  48653 
  48654   smallJsont* r;
  48655   smallJsont *self = allocSmallJson();
  48656 
  48657   r = prependNFreeSSmallJsonG(self, strdup("qwe"));
  48658   ck_assert_ptr_ne(r, null);
  48659   char *s = toStringO(r);
  48660   ck_assert_str_eq(s, "[\"qwe\"]");
  48661   free(s);
  48662   terminateO(self);
  48663 
  48664 END_TEST
  48665 
  48666 
  48667 START_TEST(prependNFreeDictSmallJsonGT)
  48668 
  48669   smallJsont* r;
  48670   smallJsont *self = allocSmallJson();
  48671   smallDictt *dict  = allocSmallDict();
  48672 
  48673   r = prependNFreeDictSmallJsonG(self, dict);
  48674   ck_assert_ptr_ne(r, null);
  48675   char *s = toStringO(r);
  48676   ck_assert_str_eq(s, "[{}]");
  48677   free(s);
  48678   terminateO(self);
  48679 
  48680 END_TEST
  48681 
  48682 
  48683 START_TEST(prependNFreeArraySmallJsonGT)
  48684 
  48685   smallJsont* r;
  48686   smallJsont *self  = allocSmallJson();
  48687   smallArrayt *array = allocSmallArray();
  48688 
  48689   r = prependNFreeArraySmallJsonG(self, array);
  48690   ck_assert_ptr_ne(r, null);
  48691   char *s = toStringO(r);
  48692   ck_assert_str_eq(s, "[[]]");
  48693   free(s);
  48694   terminateO(self);
  48695 
  48696 END_TEST
  48697 
  48698 
  48699 START_TEST(prependNFreeArraycSmallJsonGT)
  48700 
  48701   smallJsont* r;
  48702   smallJsont *self = allocSmallJson();
  48703   char **array      = listCreateS("a","bb");
  48704 
  48705   r = prependNFreeArraycSmallJsonG(self, array);
  48706   ck_assert_ptr_ne(r, null);
  48707   ck_assert_int_eq(lenO(r), 1);
  48708   char *s = toStringO(r);
  48709   ck_assert_str_eq(s, "[[\"a\",\"bb\"]]");
  48710   free(s);
  48711   terminateO(self);
  48712 
  48713 END_TEST
  48714 
  48715 
  48716 START_TEST(prependNFreeSmallBoolSmallJsonGT)
  48717 
  48718   smallJsont* r;
  48719   smallJsont *self = allocSmallJson();
  48720   smallBoolt *value = allocSmallBool(true);
  48721 
  48722   r = prependNFreeSmallBoolSmallJsonG(self, value);
  48723   ck_assert_ptr_ne(r, null);
  48724   char *s = toStringO(r);
  48725   ck_assert_str_eq(s, "[true]");
  48726   free(s);
  48727   terminateO(self);
  48728 
  48729 END_TEST
  48730 
  48731 
  48732 START_TEST(prependNFreeSmallBytesSmallJsonGT)
  48733 
  48734   smallJsont* r;
  48735   smallJsont *self = allocSmallJson();
  48736   smallBytest *value = allocSmallBytes("qwe", 3);
  48737 
  48738   r = prependNFreeSmallBytesSmallJsonG(self, value);
  48739   ck_assert_ptr_ne(r, null);
  48740   char *s = toStringO(r);
  48741   ck_assert_str_eq(s, "[[0x71,0x77,0x65]]");
  48742   free(s);
  48743   terminateO(self);
  48744 
  48745 END_TEST
  48746 
  48747 
  48748 START_TEST(prependNFreeSmallDoubleSmallJsonGT)
  48749 
  48750   smallJsont* r;
  48751   smallJsont *self = allocSmallJson();
  48752   smallDoublet *value = allocSmallDouble(1);
  48753 
  48754   r = prependNFreeSmallDoubleSmallJsonG(self, value);
  48755   ck_assert_ptr_ne(r, null);
  48756   char *s = toStringO(r);
  48757   ck_assert_str_eq(s, "[1.000000e+00]");
  48758   free(s);
  48759   terminateO(self);
  48760 
  48761 END_TEST
  48762 
  48763 
  48764 START_TEST(prependNFreeSmallIntSmallJsonGT)
  48765 
  48766   smallJsont* r;
  48767   smallJsont *self = allocSmallJson();
  48768   smallIntt *value  = allocSmallInt(1);
  48769 
  48770   r = prependNFreeSmallIntSmallJsonG(self, value);
  48771   ck_assert_ptr_ne(r, null);
  48772   char *s = toStringO(r);
  48773   ck_assert_str_eq(s, "[1]");
  48774   free(s);
  48775   terminateO(self);
  48776 
  48777 END_TEST
  48778 
  48779 
  48780 START_TEST(prependNFreeSmallJsonSmallJsonGT)
  48781 
  48782   smallJsont* r;
  48783   smallJsont *self = allocSmallJson();
  48784   smallJsont *value = allocSmallJson();
  48785 
  48786   r = prependNFreeSmallJsonSmallJsonG(self, value);
  48787   ck_assert_ptr_ne(r, null);
  48788   char *s = toStringO(r);
  48789   ck_assert_str_eq(s, "[{}]");
  48790   free(s);
  48791   terminateO(self);
  48792 
  48793 END_TEST
  48794 
  48795 
  48796 START_TEST(prependNFreeSmallStringSmallJsonGT)
  48797 
  48798   smallJsont* r;
  48799   smallJsont *self = allocSmallJson();
  48800   smallStringt *string = allocSmallString("qwe");
  48801 
  48802   r = prependNFreeSmallStringSmallJsonG(self, string);
  48803   ck_assert_ptr_ne(r, null);
  48804   char *s = toStringO(r);
  48805   ck_assert_str_eq(s, "[\"qwe\"]");
  48806   free(s);
  48807   terminateO(self);
  48808 
  48809 END_TEST
  48810 
  48811 
  48812 START_TEST(prependNFreeSmallContainerSmallJsonGT)
  48813 
  48814   smallJsont* r;
  48815   smallJsont *self = allocSmallJson();
  48816 
  48817   createAllocateSmallContainer(c);
  48818   r = prependNFreeSmallContainerSmallJsonG(self, c);
  48819   ck_assert_ptr_ne(r, null);
  48820   char *s = toStringO(r);
  48821   ck_assert_str_eq(s, "[\"<data container>\"]");
  48822   free(s);
  48823   terminateO(self);
  48824 
  48825 END_TEST
  48826 
  48827 
  48828 START_TEST(dequeueSmallJsonGT)
  48829 
  48830   baset*           r;
  48831   smallJsont *self = allocSmallJson();
  48832 
  48833   smallJsont *r2   = self->f->pushInt(self, 1);
  48834   ck_assert_ptr_ne(r2, null);
  48835   r = dequeueSmallJsonG(self, NULL);
  48836   ck_assert_ptr_ne(r, null);
  48837   char *s = toStringO(r);
  48838   terminateO(r);
  48839   ck_assert_str_eq(s, "1");
  48840   free(s);
  48841   terminateO(self);
  48842 
  48843 END_TEST
  48844 
  48845 
  48846 START_TEST(dequeueUndefinedSmallJsonGT)
  48847 
  48848   undefinedt*      r;
  48849   smallJsont *self = allocSmallJson();
  48850 
  48851   smallJsont *r2   = self->f->pushUndefined(self);
  48852   ck_assert_ptr_ne(r2, null);
  48853   r = dequeueUndefinedSmallJsonG(self, null);
  48854   ck_assert_ptr_ne(r, null);
  48855   char *s = toStringO(r);
  48856   terminateO(r);
  48857   ck_assert_str_eq(s, "null");
  48858   free(s);
  48859   terminateO(self);
  48860 
  48861 END_TEST
  48862 
  48863 
  48864 START_TEST(dequeueBoolSmallJsonGT)
  48865 
  48866   bool             r;
  48867   smallJsont *self = allocSmallJson();
  48868 
  48869   smallJsont *r2   = self->f->pushBool(self, TRUE);
  48870   ck_assert_ptr_ne(r2, null);
  48871   r = dequeueBoolSmallJsonG(self, null);
  48872   ck_assert(r);
  48873   terminateO(self);
  48874 
  48875 END_TEST
  48876 
  48877 
  48878 START_TEST(dequeueDoubleSmallJsonGT)
  48879 
  48880   double           r;
  48881   smallJsont *self = allocSmallJson();
  48882 
  48883   smallJsont *r2   = self->f->pushDouble(self, 2.0);
  48884   ck_assert_ptr_ne(r2, null);
  48885   r = dequeueDoubleSmallJsonG(self, 0);
  48886   ck_assert(r==2.0);
  48887   terminateO(self);
  48888 
  48889 END_TEST
  48890 
  48891 
  48892 START_TEST(dequeueIntSmallJsonGT)
  48893 
  48894   int64_t          r;
  48895   smallJsont *self = allocSmallJson();
  48896 
  48897   smallJsont *r2   = self->f->pushInt(self, 2);
  48898   ck_assert_ptr_ne(r2, null);
  48899   r = dequeueIntSmallJsonG(self, 0);
  48900   ck_assert_int_eq(r, 2);
  48901   terminateO(self);
  48902 
  48903 END_TEST
  48904 
  48905 
  48906 START_TEST(dequeueInt32SmallJsonGT)
  48907 
  48908   int32_t          r;
  48909   smallJsont *self = allocSmallJson();
  48910 
  48911   smallJsont *r2   = self->f->pushInt(self, 2);
  48912   ck_assert_ptr_ne(r2, null);
  48913   r = dequeueInt32SmallJsonG(self, 0);
  48914   ck_assert_int_eq(r, 2);
  48915   terminateO(self);
  48916 
  48917 END_TEST
  48918 
  48919 
  48920 START_TEST(dequeueUintSmallJsonGT)
  48921 
  48922   uint64_t         r;
  48923   smallJsont *self = allocSmallJson();
  48924 
  48925   smallJsont *r2   = self->f->pushInt(self, 2);
  48926   ck_assert_ptr_ne(r2, null);
  48927   r = dequeueUintSmallJsonG(self, 0);
  48928   ck_assert_int_eq(r, 2);
  48929   terminateO(self);
  48930 
  48931 END_TEST
  48932 
  48933 
  48934 START_TEST(dequeueUint32SmallJsonGT)
  48935 
  48936   uint32_t         r;
  48937   smallJsont *self = allocSmallJson();
  48938 
  48939   smallJsont *r2   = self->f->pushInt(self, 2);
  48940   ck_assert_ptr_ne(r2, null);
  48941   r = dequeueUint32SmallJsonG(self, 0);
  48942   ck_assert_int_eq(r, 2);
  48943   terminateO(self);
  48944 
  48945 END_TEST
  48946 
  48947 
  48948 START_TEST(dequeueSSmallJsonGT)
  48949 
  48950   char*            r;
  48951   smallJsont *self = allocSmallJson();
  48952 
  48953   smallJsont *r2   = self->f->pushS(self, "2");
  48954   ck_assert_ptr_ne(r2, null);
  48955   r = dequeueSSmallJsonG(self, null);
  48956   ck_assert_str_eq(r, "2");
  48957   free(r);
  48958   terminateO(self);
  48959 
  48960 END_TEST
  48961 
  48962 
  48963 START_TEST(dequeueDictSmallJsonGT)
  48964 
  48965   smallDictt*      r;
  48966   smallJsont *self = allocSmallJson();
  48967 
  48968   createSmallDict(d);
  48969   smallJsont *r2   = self->f->pushDict(self, &d);
  48970   ck_assert_ptr_ne(r2, null);
  48971   r = dequeueDictSmallJsonG(self, null);
  48972   ck_assert_ptr_ne(r, null);
  48973   char *s = toStringO(r);
  48974   ck_assert_str_eq(s, "{}");
  48975   free(s);
  48976   terminateO(r);
  48977   terminateO(self);
  48978 
  48979 END_TEST
  48980 
  48981 
  48982 START_TEST(dequeueArraySmallJsonGT)
  48983 
  48984   smallArrayt*     r;
  48985   smallJsont *self = allocSmallJson();
  48986 
  48987   createSmallArray(a);
  48988   smallJsont *r2   = self->f->pushArray(self, &a);
  48989   ck_assert_ptr_ne(r2, null);
  48990   r = dequeueArraySmallJsonG(self, null);
  48991   ck_assert_ptr_ne(r, null);
  48992   char *s = toStringO(r);
  48993   ck_assert_str_eq(s, "[]");
  48994   free(s);
  48995   terminateO(r);
  48996   terminateO(self);
  48997 
  48998 END_TEST
  48999 
  49000 
  49001 START_TEST(dequeueSmallBoolSmallJsonGT)
  49002 
  49003   smallBoolt*      r;
  49004   smallJsont *self = allocSmallJson();
  49005 
  49006   smallJsont *r2   = self->f->pushBool(self, true);
  49007   ck_assert_ptr_ne(r2, null);
  49008   r = dequeueSmallBoolSmallJsonG(self, null);
  49009   ck_assert_ptr_ne(r, null);
  49010   char *s = toStringO(r);
  49011   ck_assert_str_eq(s, "true");
  49012   free(s);
  49013   terminateO(r);
  49014   terminateO(self);
  49015 
  49016 END_TEST
  49017 
  49018 
  49019 START_TEST(dequeueSmallBytesSmallJsonGT)
  49020 
  49021   smallBytest*      r;
  49022   smallJsont *self = allocSmallJson();
  49023 
  49024   createSmallBytes(b);
  49025   smallJsont *r2   = self->f->pushSmallBytes(self, &b);
  49026   ck_assert_ptr_ne(r2, null);
  49027   r = dequeueSmallBytesSmallJsonG(self, null);
  49028   ck_assert_ptr_ne(r, null);
  49029   char *s = toStringO(r);
  49030   ck_assert_str_eq(s, "[]");
  49031   free(s);
  49032   terminateO(r);
  49033   terminateO(self);
  49034 
  49035 END_TEST
  49036 
  49037 
  49038 START_TEST(dequeueSmallDoubleSmallJsonGT)
  49039 
  49040   smallDoublet*    r;
  49041   smallJsont *self = allocSmallJson();
  49042 
  49043   smallJsont *r2   = self->f->pushDouble(self, 1);
  49044   ck_assert_ptr_ne(r2, null);
  49045   r = dequeueSmallDoubleSmallJsonG(self, null);
  49046   ck_assert_ptr_ne(r, null);
  49047   char *s = toStringO(r);
  49048   ck_assert_str_eq(s, "1.000000e+00");
  49049   free(s);
  49050   terminateO(r);
  49051   terminateO(self);
  49052 
  49053 END_TEST
  49054 
  49055 
  49056 START_TEST(dequeueSmallIntSmallJsonGT)
  49057 
  49058   smallIntt*       r;
  49059   smallJsont *self = allocSmallJson();
  49060 
  49061   smallJsont *r2   = self->f->pushInt(self, 1);
  49062   ck_assert_ptr_ne(r2, null);
  49063   r = dequeueSmallIntSmallJsonG(self, null);
  49064   ck_assert_ptr_ne(r, null);
  49065   char *s = toStringO(r);
  49066   ck_assert_str_eq(s, "1");
  49067   free(s);
  49068   terminateO(r);
  49069   terminateO(self);
  49070 
  49071 END_TEST
  49072 
  49073 
  49074 START_TEST(dequeueSmallJsonSmallJsonGT)
  49075 
  49076   smallJsont*      r;
  49077   smallJsont *self = allocSmallJson();
  49078 
  49079   createSmallJson(j);
  49080   smallJsont *r2   = self->f->pushSmallJson(self, &j);
  49081   ck_assert_ptr_ne(r2, null);
  49082   r = dequeueSmallJsonSmallJsonG(self, null);
  49083   ck_assert_ptr_ne(r, null);
  49084   char *s = toStringO(r);
  49085   ck_assert_str_eq(s, "{}");
  49086   free(s);
  49087   terminateO(r);
  49088   terminateO(self);
  49089 
  49090 END_TEST
  49091 
  49092 
  49093 START_TEST(dequeueSmallStringSmallJsonGT)
  49094 
  49095   smallStringt*    r;
  49096   smallJsont *self = allocSmallJson();
  49097 
  49098   createSmallString(S);
  49099   smallJsont *r2   = self->f->pushSmallString(self, &S);
  49100   ck_assert_ptr_ne(r2, null);
  49101   r = dequeueSmallStringSmallJsonG(self, null);
  49102   ck_assert_ptr_ne(r, null);
  49103   char *s = toStringO(r);
  49104   ck_assert_str_eq(s, "");
  49105   free(s);
  49106   terminateO(r);
  49107   terminateO(self);
  49108 
  49109 END_TEST
  49110 
  49111 
  49112 START_TEST(dequeueVoidSmallJsonGT)
  49113 
  49114   void*            r;
  49115   smallJsont *self = allocSmallJson();
  49116 
  49117   createSmallContainer(c);
  49118   setValO(&c, &r);
  49119   smallJsont *r2   = self->f->pushSmallContainer(self, &c);
  49120   ck_assert_ptr_ne(r2, null);
  49121   r = dequeueVoidSmallJsonG(self, null);
  49122   ck_assert_ptr_eq(r, &r);
  49123   terminateO(self);
  49124 
  49125 END_TEST
  49126 
  49127 
  49128 START_TEST(dequeueSmallContainerSmallJsonGT)
  49129 
  49130   smallContainert* r;
  49131   smallJsont *self = allocSmallJson();
  49132 
  49133   createSmallContainer(c);
  49134   smallJsont *r2   = self->f->pushSmallContainer(self, &c);
  49135   ck_assert_ptr_ne(r2, null);
  49136   r = dequeueSmallContainerSmallJsonG(self, null);
  49137   ck_assert_ptr_ne(r, null);
  49138   char *s = toStringO(r);
  49139   ck_assert_str_eq(s, "<data smallContainer>");
  49140   free(s);
  49141   terminateO(r);
  49142   terminateO(self);
  49143 
  49144 END_TEST
  49145 
  49146 
  49147 START_TEST(reverseSmallJsonGT)
  49148 
  49149   smallJsont* r;
  49150   smallJsont *self = allocSmallJson();
  49151 
  49152   self->f->pushInt(self, 1);
  49153   self->f->pushInt(self, 2);
  49154   r = reverseSmallJsonG(self);
  49155   ck_assert_ptr_ne(r, NULL);
  49156   char *s = toStringO(r);
  49157   ck_assert_str_eq(s, "[2,1]");
  49158   free(s);
  49159   terminateO(self);
  49160 
  49161 END_TEST
  49162 
  49163 
  49164 START_TEST(mergeDictSmallJsonGT)
  49165 
  49166   smallJsont*  r;
  49167   smallJsont *self  = allocG(rtSmallJsont);
  49168   smallDictt *value = allocSmallDict();
  49169 
  49170   self->f->setS(self, "1", "2");
  49171   self->f->setS(self, "3", "4");
  49172   value->f->setS(value, "3", "#");
  49173   value->f->setInt(value, "4", 0);
  49174   r = mergeDictSmallJsonG(self, value);
  49175   ck_assert_ptr_ne(r, null);
  49176   char *s = toStringO(r);
  49177   ck_assert_str_eq(s, "{\"1\":\"2\",\"3\":\"#\",\"4\":0}");
  49178   free(s);
  49179   smashO(value);
  49180   terminateO(self);
  49181 
  49182 END_TEST
  49183 
  49184 
  49185 START_TEST(mergeDictNSmashSmallJsonGT)
  49186 
  49187   smallJsont*  r;
  49188   smallJsont *self  = allocG(rtSmallJsont);
  49189   smallDictt *value = allocSmallDict();
  49190 
  49191   self->f->setS(self, "1", "2");
  49192   self->f->setS(self, "3", "4");
  49193   value->f->setS(value, "3", "#");
  49194   value->f->setInt(value, "4", 0);
  49195   r = mergeDictNSmashSmallJsonG(self, value);
  49196   ck_assert_ptr_ne(r, null);
  49197   char *s = toStringO(r);
  49198   ck_assert_str_eq(s, "{\"1\":\"2\",\"3\":\"#\",\"4\":0}");
  49199   free(s);
  49200   terminateO(self);
  49201 
  49202 END_TEST
  49203 
  49204 
  49205 START_TEST(mergeSmallJsonGT)
  49206 
  49207   smallJsont* r;
  49208   smallJsont *self = allocSmallJson();
  49209   smallJsont *json  = allocSmallJson();
  49210 
  49211   r = self->f->pushInt(self, 1);
  49212   ck_assert_ptr_ne(r, null);
  49213   json->f->pushInt(json, 1);
  49214   json->f->pushInt(json, 2);
  49215   r = mergeSmallJsonG(self, json);
  49216   ck_assert_ptr_ne(r, NULL);
  49217   smashO(json);
  49218   char *s = toStringO(r);
  49219   ck_assert_str_eq(s, "[1,1,2]");
  49220   free(s);
  49221   terminateO(self);
  49222 
  49223 END_TEST
  49224 
  49225 
  49226 START_TEST(mergeNSmashSmallJsonGT)
  49227 
  49228   smallJsont* r;
  49229   smallJsont *self = allocSmallJson();
  49230   smallJsont *json  = allocSmallJson();
  49231 
  49232   r = self->f->pushInt(self, 1);
  49233   ck_assert_ptr_ne(r, null);
  49234   json->f->pushInt(json, 1);
  49235   json->f->pushInt(json, 2);
  49236   r = mergeNSmashSmallJsonG(self, json);
  49237   ck_assert_ptr_ne(r, NULL);
  49238   char *s = toStringO(r);
  49239   ck_assert_str_eq(s, "[1,1,2]");
  49240   free(s);
  49241   terminateO(self);
  49242 
  49243 END_TEST
  49244 
  49245 
  49246 START_TEST(appendSmallJsonGT)
  49247 
  49248   smallJsont* r;
  49249   smallJsont *self  = allocSmallJson();
  49250   smallArrayt *array = allocSmallArray();
  49251 
  49252   r = self->f->pushInt(self, 1);
  49253   ck_assert_ptr_ne(r, null);
  49254   array->f->pushInt(array, 1);
  49255   array->f->pushInt(array, 2);
  49256   r = appendSmallJsonG(self, array);
  49257   ck_assert_ptr_ne(r, NULL);
  49258   smashO(array);
  49259   char *s = toStringO(r);
  49260   ck_assert_str_eq(s, "[1,1,2]");
  49261   free(s);
  49262   terminateO(self);
  49263 
  49264 END_TEST
  49265 
  49266 
  49267 START_TEST(appendNSmashSmallJsonGT)
  49268 
  49269   smallJsont* r;
  49270   smallJsont *self  = allocSmallJson();
  49271   smallArrayt *array = allocSmallArray();
  49272 
  49273   r = self->f->pushInt(self, 1);
  49274   ck_assert_ptr_ne(r, null);
  49275   array->f->pushInt(array, 1);
  49276   array->f->pushInt(array, 2);
  49277   r = appendNSmashSmallJsonG(self, array);
  49278   ck_assert_ptr_ne(r, NULL);
  49279   char *s = toStringO(r);
  49280   ck_assert_str_eq(s, "[1,1,2]");
  49281   free(s);
  49282   terminateO(self);
  49283 
  49284 END_TEST
  49285 
  49286 
  49287 START_TEST(appendArraySmallJsonGT)
  49288 
  49289   smallJsont* r;
  49290   smallJsont *self = allocSmallJson();
  49291   char **array      = listCreateS("1", "2");
  49292 
  49293   r = self->f->pushInt(self, 1);
  49294   ck_assert_ptr_ne(r, null);
  49295   r = appendArraySmallJsonG(self, array);
  49296   ck_assert_ptr_ne(r, NULL);
  49297   listFreeS(array);
  49298   char *s = toStringO(r);
  49299   ck_assert_str_eq(s, "[1,\"1\",\"2\"]");
  49300   free(s);
  49301   terminateO(self);
  49302 
  49303 END_TEST
  49304 
  49305 
  49306 START_TEST(appendNSmashArraySmallJsonGT)
  49307 
  49308   smallJsont* r;
  49309   smallJsont *self = allocSmallJson();
  49310   char **array      = listCreateS("1", "2");
  49311 
  49312   r = self->f->pushInt(self, 1);
  49313   ck_assert_ptr_ne(r, null);
  49314   r = appendNSmashArraySmallJsonG(self, array);
  49315   ck_assert_ptr_ne(r, NULL);
  49316   char *s = toStringO(r);
  49317   ck_assert_str_eq(s, "[1,\"1\",\"2\"]");
  49318   free(s);
  49319   terminateO(self);
  49320 
  49321 END_TEST
  49322 
  49323 
  49324 START_TEST(appendCArraySmallJsonGT)
  49325 
  49326   smallJsont* r;
  49327   smallJsont *self = allocSmallJson();
  49328   const char *array[] = {"1", "2", null};
  49329 
  49330   r = self->f->pushInt(self, 1);
  49331   ck_assert_ptr_ne(r, null);
  49332   r = appendCArraySmallJsonG(self, array);
  49333   ck_assert_ptr_ne(r, NULL);
  49334   char *s = toStringO(r);
  49335   ck_assert_str_eq(s, "[1,\"1\",\"2\"]");
  49336   free(s);
  49337   terminateO(self);
  49338 
  49339 END_TEST
  49340 
  49341 
  49342 START_TEST(shiftSmallJsonGT)
  49343 
  49344   smallJsont* r;
  49345   smallJsont *self = allocSmallJson();
  49346   smallArrayt *array = allocSmallArray();
  49347 
  49348   r = self->f->pushInt(self, 1);
  49349   ck_assert_ptr_ne(r, null);
  49350   array->f->pushInt(array, 1);
  49351   array->f->pushInt(array, 2);
  49352   r = shiftSmallJsonG(self, array);
  49353   ck_assert_ptr_ne(r, NULL);
  49354   smashO(array);
  49355   char *s = toStringO(r);
  49356   ck_assert_str_eq(s, "[1,2,1]");
  49357   free(s);
  49358   terminateO(self);
  49359 
  49360 END_TEST
  49361 
  49362 
  49363 START_TEST(shiftNSmashSmallJsonGT)
  49364 
  49365   smallJsont* r;
  49366   smallJsont *self = allocSmallJson();
  49367   smallArrayt *array = allocSmallArray();
  49368 
  49369   r = self->f->pushInt(self, 1);
  49370   ck_assert_ptr_ne(r, null);
  49371   array->f->pushInt(array, 1);
  49372   array->f->pushInt(array, 2);
  49373   r = shiftNSmashSmallJsonG(self, array);
  49374   ck_assert_ptr_ne(r, NULL);
  49375   char *s = toStringO(r);
  49376   ck_assert_str_eq(s, "[1,2,1]");
  49377   free(s);
  49378   terminateO(self);
  49379 
  49380 END_TEST
  49381 
  49382 
  49383 START_TEST(shiftSmallJsonSmallJsonGT)
  49384 
  49385   smallJsont* r;
  49386   smallJsont *self = allocSmallJson();
  49387   smallJsont *json  = allocSmallJson();
  49388 
  49389   r = self->f->pushInt(self, 1);
  49390   ck_assert_ptr_ne(r, null);
  49391   json->f->pushInt(json, 1);
  49392   json->f->pushInt(json, 2);
  49393   r = shiftSmallJsonSmallJsonG(self, json);
  49394   ck_assert_ptr_ne(r, NULL);
  49395   smashO(json);
  49396   char *s = toStringO(r);
  49397   ck_assert_str_eq(s, "[1,2,1]");
  49398   free(s);
  49399   terminateO(self);
  49400 
  49401 END_TEST
  49402 
  49403 
  49404 START_TEST(shiftNSmashSmallJsonSmallJsonGT)
  49405 
  49406   smallJsont* r;
  49407   smallJsont *self = allocSmallJson();
  49408   smallJsont *json  = allocSmallJson();
  49409 
  49410   r = self->f->pushInt(self, 1);
  49411   ck_assert_ptr_ne(r, null);
  49412   json->f->pushInt(json, 1);
  49413   json->f->pushInt(json, 2);
  49414   r = shiftNSmashSmallJsonSmallJsonG(self, json);
  49415   ck_assert_ptr_ne(r, NULL);
  49416   char *s = toStringO(r);
  49417   ck_assert_str_eq(s, "[1,2,1]");
  49418   free(s);
  49419   terminateO(self);
  49420 
  49421 END_TEST
  49422 
  49423 
  49424 START_TEST(addSmallJsonGT)
  49425 
  49426   smallJsont* r;
  49427   smallJsont *self = allocSmallJson();
  49428   createAllocateSmallArray(a);
  49429 
  49430   // add an element to check that the second array is added
  49431   // at the end
  49432   r = self->f->pushInt(self, 1);
  49433   ck_assert_ptr_ne(r, null);
  49434 
  49435   // add array
  49436   a->f->pushInt(a, 2);
  49437   r = addSmallJsonG(self, a);
  49438   smashO(a);
  49439   ck_assert_ptr_ne(r, null);
  49440   char *s = toStringO(r);
  49441   terminateO(r);
  49442   ck_assert_str_eq(s, "[1,2]");
  49443   free(s);
  49444   terminateO(self);
  49445 
  49446 END_TEST
  49447 
  49448 
  49449 START_TEST(addJsonSmallJsonGT)
  49450 
  49451   smallJsont* r;
  49452   smallJsont *self = allocG(rtSmallJsont);
  49453   smallJsont *a    = allocSmallJson();
  49454 
  49455   // add an element to check that the second array is added
  49456   // at the end
  49457   r = self->f->pushInt(self, 1);
  49458   ck_assert_ptr_ne(r, null);
  49459 
  49460   // add array
  49461   a->f->pushInt(a, 2);
  49462   r = addJsonSmallJsonG(self, a);
  49463   smashO(a);
  49464   ck_assert_ptr_ne(r, null);
  49465   char *s = toStringO(r);
  49466   terminateO(r);
  49467   ck_assert_str_eq(s, "[1,2]");
  49468   free(s);
  49469   terminateO(self);
  49470 
  49471 END_TEST
  49472 
  49473 
  49474 START_TEST(sliceSmallJsonGT)
  49475 
  49476   smallJsont* r;
  49477   smallJsont *self = allocSmallJson();
  49478 
  49479   r = self->f->pushInt(self, 1);
  49480   ck_assert_ptr_ne(r, null);
  49481   r = self->f->pushInt(self, 2);
  49482   ck_assert_ptr_ne(r, null);
  49483   r = self->f->pushInt(self, 3);
  49484   ck_assert_ptr_ne(r, null);
  49485   r = self->f->pushInt(self, 4);
  49486   ck_assert_ptr_ne(r, null);
  49487   r = sliceSmallJsonG(self, 1, -1);
  49488   ck_assert_ptr_ne(r, null);
  49489   char *s = toStringO(r);
  49490   ck_assert_str_eq(s, "[2,3]");
  49491   free(s);
  49492   terminateO(self);
  49493 
  49494 END_TEST
  49495 
  49496 
  49497 START_TEST(cropSmallJsonGT)
  49498 
  49499   smallJsont* r;
  49500   smallJsont *self = allocSmallJson();
  49501 
  49502   r = self->f->pushInt(self, 1);
  49503   ck_assert_ptr_ne(r, null);
  49504   r = self->f->pushInt(self, 2);
  49505   ck_assert_ptr_ne(r, null);
  49506   r = self->f->pushInt(self, 3);
  49507   ck_assert_ptr_ne(r, null);
  49508   r = self->f->pushInt(self, 4);
  49509   ck_assert_ptr_ne(r, null);
  49510   r = cropSmallJsonG(self, 1, -1);
  49511   ck_assert_ptr_ne(r, null);
  49512   char *s = toStringO(r);
  49513   terminateO(r);
  49514   ck_assert_str_eq(s, "[2,3]");
  49515   free(s);
  49516   s = toStringO(self);
  49517   ck_assert_str_eq(s, "[1,4]");
  49518   free(s);
  49519   terminateO(self);
  49520 
  49521 END_TEST
  49522 
  49523 
  49524 START_TEST(cropSSmallJsonGT)
  49525 
  49526   char* s;
  49527   smallJsont *self = allocG(rtSmallJsont);
  49528 
  49529   setTopSO(self, "sheepy");
  49530   s = cropSSmallJsonG(self, 0,2);
  49531   ck_assert_str_eq(s, "sh");
  49532   ck_assert_str_eq(sjGet(self), "eepy");
  49533   free(s);
  49534   terminateO(self);
  49535 
  49536 END_TEST
  49537 
  49538 
  49539 START_TEST(cropSmallStringSmallJsonGT)
  49540 
  49541   smallStringt* r;
  49542   smallJsont *self = allocG(rtSmallJsont);
  49543 
  49544   setTopSO(self, "sheepy");
  49545   r = cropSmallStringSmallJsonG(self, 0,2);
  49546   ck_assert_ptr_ne(r, null);
  49547   ck_assert_str_eq(ssGet(r), "sh");
  49548   ck_assert_str_eq(sjGet(self), "eepy");
  49549   terminateO(r);
  49550   terminateO(self);
  49551 
  49552 END_TEST
  49553 
  49554 
  49555 START_TEST(cropElemAtSmallJsonGT)
  49556 
  49557   baset* r;
  49558   smallJsont *self = allocSmallJson();
  49559 
  49560   smallJsont *r2 = self->f->pushInt(self, 1);
  49561   ck_assert_ptr_ne(r2, null);
  49562   r = cropElemAtSmallJsonG(self, 0);
  49563   ck_assert_ptr_ne(r, null);
  49564   char *s = toStringO(r);
  49565   terminateO(r);
  49566   ck_assert_str_eq(s, "1");
  49567   free(s);
  49568   terminateO(self);
  49569 
  49570 END_TEST
  49571 
  49572 
  49573 START_TEST(cropElemAtUndefinedSmallJsonGT)
  49574 
  49575   undefinedt* r;
  49576   smallJsont *self = allocSmallJson();
  49577 
  49578   smallJsont *r2 = self->f->pushUndefined(self);
  49579   ck_assert_ptr_ne(r2, null);
  49580   r = cropElemAtUndefinedSmallJsonG(self, 0);
  49581   ck_assert_ptr_ne(r, null);
  49582   char *s = toStringO(r);
  49583   terminateO(r);
  49584   ck_assert_str_eq(s, "null");
  49585   free(s);
  49586   terminateO(self);
  49587 
  49588 END_TEST
  49589 
  49590 
  49591 START_TEST(cropElemAtBoolSmallJsonGT)
  49592 
  49593   bool r;
  49594   smallJsont *self = allocSmallJson();
  49595 
  49596   smallJsont *r2 = self->f->pushBool(self, true);
  49597   ck_assert_ptr_ne(r2, null);
  49598   r = cropElemAtBoolSmallJsonG(self, 0);
  49599   ck_assert(r);
  49600   terminateO(self);
  49601 
  49602 END_TEST
  49603 
  49604 
  49605 START_TEST(cropElemAtDoubleSmallJsonGT)
  49606 
  49607   double r;
  49608   smallJsont *self = allocSmallJson();
  49609 
  49610   smallJsont *r2 = self->f->pushDouble(self, 1);
  49611   ck_assert_ptr_ne(r2, null);
  49612   r = cropElemAtDoubleSmallJsonG(self, 0);
  49613   ck_assert(r==1);
  49614   terminateO(self);
  49615 
  49616 END_TEST
  49617 
  49618 
  49619 START_TEST(cropElemAtIntSmallJsonGT)
  49620 
  49621   int64_t r;
  49622   smallJsont *self = allocSmallJson();
  49623 
  49624   smallJsont *r2 = self->f->pushInt(self, 2);
  49625   ck_assert_ptr_ne(r2, null);
  49626   r = cropElemAtIntSmallJsonG(self, 0);
  49627   ck_assert_int_eq(r, 2);
  49628   terminateO(self);
  49629 
  49630 END_TEST
  49631 
  49632 
  49633 START_TEST(cropElemAtInt32SmallJsonGT)
  49634 
  49635   int32_t r;
  49636   smallJsont *self = allocSmallJson();
  49637 
  49638   smallJsont *r2 = self->f->pushInt(self, 2);
  49639   ck_assert_ptr_ne(r2, null);
  49640   r = cropElemAtInt32SmallJsonG(self, 0);
  49641   ck_assert_int_eq(r, 2);
  49642   terminateO(self);
  49643 
  49644 END_TEST
  49645 
  49646 
  49647 START_TEST(cropElemAtUintSmallJsonGT)
  49648 
  49649   uint64_t r;
  49650   smallJsont *self = allocSmallJson();
  49651 
  49652   smallJsont *r2 = self->f->pushInt(self, 2);
  49653   ck_assert_ptr_ne(r2, null);
  49654   r = cropElemAtUintSmallJsonG(self, 0);
  49655   ck_assert_int_eq(r, 2);
  49656   terminateO(self);
  49657 
  49658 END_TEST
  49659 
  49660 
  49661 START_TEST(cropElemAtUint32SmallJsonGT)
  49662 
  49663   uint32_t r;
  49664   smallJsont *self = allocSmallJson();
  49665 
  49666   smallJsont *r2 = self->f->pushInt(self, 2);
  49667   ck_assert_ptr_ne(r2, null);
  49668   r = cropElemAtUint32SmallJsonG(self, 0);
  49669   ck_assert_int_eq(r, 2);
  49670   terminateO(self);
  49671 
  49672 END_TEST
  49673 
  49674 
  49675 START_TEST(cropElemAtSSmallJsonGT)
  49676 
  49677   char* r;
  49678   smallJsont *self = allocSmallJson();
  49679 
  49680   smallJsont *r2 = self->f->pushS(self, "qwe");
  49681   ck_assert_ptr_ne(r2, null);
  49682   r = cropElemAtSSmallJsonG(self, 0);
  49683   ck_assert_str_eq(r, "qwe");
  49684   free(r);
  49685   terminateO(self);
  49686 
  49687 END_TEST
  49688 
  49689 
  49690 START_TEST(cropElemAtCharSmallJsonGT)
  49691 
  49692   char r;
  49693   smallJsont *self = allocG(rtSmallJsont);
  49694 
  49695   setTopSO(self, "sheepy");
  49696   r = cropElemAtCharSmallJsonG(self, 0);
  49697   ck_assert_int_eq(r, 's');
  49698   ck_assert_str_eq(sjGet(self), "heepy");
  49699   terminateO(self);
  49700 
  49701 END_TEST
  49702 
  49703 
  49704 START_TEST(cropElemAtDictSmallJsonGT)
  49705 
  49706   smallDictt* r;
  49707   smallJsont *self = allocSmallJson();
  49708 
  49709   createSmallDict(d);
  49710   (&d)->f->setInt(&d, "a", 1);
  49711   smallJsont *r2 = self->f->pushDict(self, &d);
  49712   ck_assert_ptr_ne(r2, null);
  49713   r = cropElemAtDictSmallJsonG(self, 0);
  49714   ck_assert_ptr_ne(r, null);
  49715   char *s = toStringO(r);
  49716   terminateO(r);
  49717   ck_assert_str_eq(s, "{\"a\":1}");
  49718   free(s);
  49719   terminateO(self);
  49720 
  49721 END_TEST
  49722 
  49723 
  49724 START_TEST(cropElemAtArraySmallJsonGT)
  49725 
  49726   smallArrayt* r;
  49727   smallJsont *self = allocSmallJson();
  49728 
  49729   r = allocSmallArray();
  49730   r->f->pushInt(r, 1);
  49731   smallJsont *r2 = self->f->pushNFreeArray(self, r);
  49732   ck_assert_ptr_ne(r2, null);
  49733   r = cropElemAtArraySmallJsonG(self, 0);
  49734   ck_assert_ptr_ne(r, null);
  49735   char *s = toStringO(r);
  49736   terminateO(r);
  49737   ck_assert_str_eq(s, "[1]");
  49738   free(s);
  49739   terminateO(self);
  49740 
  49741 END_TEST
  49742 
  49743 
  49744 START_TEST(cropElemAtSmallBoolSmallJsonGT)
  49745 
  49746   smallBoolt* r;
  49747   smallJsont *self = allocSmallJson();
  49748 
  49749   smallJsont *r2 = self->f->pushBool(self, true);
  49750   ck_assert_ptr_ne(r2, null);
  49751   r = cropElemAtSmallBoolSmallJsonG(self, 0);
  49752   ck_assert_ptr_ne(r, null);
  49753   char *s = toStringO(r);
  49754   terminateO(r);
  49755   ck_assert_str_eq(s, "true");
  49756   free(s);
  49757   terminateO(self);
  49758 
  49759 END_TEST
  49760 
  49761 
  49762 START_TEST(cropElemAtSmallBytesSmallJsonGT)
  49763 
  49764   smallBytest* r;
  49765   smallJsont *self = allocSmallJson();
  49766 
  49767   r = allocSmallBytes("qwe", 3);
  49768   smallJsont *r2 = self->f->pushNFreeSmallBytes(self, r);
  49769   ck_assert_ptr_ne(r2, null);
  49770   r = cropElemAtSmallBytesSmallJsonG(self, 0);
  49771   ck_assert_ptr_ne(r, null);
  49772   char *s = toStringO(r);
  49773   terminateO(r);
  49774   ck_assert_str_eq(s, "[0x71,0x77,0x65]");
  49775   free(s);
  49776   terminateO(self);
  49777 
  49778 END_TEST
  49779 
  49780 
  49781 START_TEST(cropElemAtSmallDoubleSmallJsonGT)
  49782 
  49783   smallDoublet* r;
  49784   smallJsont *self = allocSmallJson();
  49785 
  49786   smallJsont *r2 = self->f->pushDouble(self, 1);
  49787   ck_assert_ptr_ne(r2, null);
  49788   r = cropElemAtSmallDoubleSmallJsonG(self, 0);
  49789   ck_assert_ptr_ne(r, null);
  49790   char *s = toStringO(r);
  49791   terminateO(r);
  49792   ck_assert_str_eq(s, "1.000000e+00");
  49793   free(s);
  49794   terminateO(self);
  49795 
  49796 END_TEST
  49797 
  49798 
  49799 START_TEST(cropElemAtSmallIntSmallJsonGT)
  49800 
  49801   smallIntt* r;
  49802   smallJsont *self = allocSmallJson();
  49803 
  49804   smallJsont *r2 = self->f->pushInt(self, 1);
  49805   ck_assert_ptr_ne(r2, null);
  49806   r = cropElemAtSmallIntSmallJsonG(self, 0);
  49807   ck_assert_ptr_ne(r, null);
  49808   char *s = toStringO(r);
  49809   terminateO(r);
  49810   ck_assert_str_eq(s, "1");
  49811   free(s);
  49812   terminateO(self);
  49813 
  49814 END_TEST
  49815 
  49816 
  49817 START_TEST(cropElemAtSmallJsonSmallJsonGT)
  49818 
  49819   smallJsont* r;
  49820   smallJsont *self = allocSmallJson();
  49821 
  49822   r = allocSmallJson();
  49823   r->f->setInt(r, "a", 1);
  49824   smallJsont *r2 = self->f->pushNFreeSmallJson(self, r);
  49825   ck_assert_ptr_ne(r2, null);
  49826   r = cropElemAtSmallJsonSmallJsonG(self, 0);
  49827   ck_assert_ptr_ne(r, null);
  49828   char *s = toStringO(r);
  49829   terminateO(r);
  49830   ck_assert_str_eq(s, "{\"a\":1}");
  49831   free(s);
  49832   terminateO(self);
  49833 
  49834 END_TEST
  49835 
  49836 
  49837 START_TEST(cropElemAtSmallStringSmallJsonGT)
  49838 
  49839   smallStringt* r;
  49840   smallJsont *self = allocSmallJson();
  49841 
  49842   smallJsont *r2 = self->f->pushS(self, "qwe");
  49843   ck_assert_ptr_ne(r2, null);
  49844   r = cropElemAtSmallStringSmallJsonG(self, 0);
  49845   ck_assert_ptr_ne(r, null);
  49846   char *s = toStringO(r);
  49847   terminateO(r);
  49848   ck_assert_str_eq(s, "qwe");
  49849   free(s);
  49850   terminateO(self);
  49851 
  49852 END_TEST
  49853 
  49854 
  49855 START_TEST(cropElemAtVoidSmallJsonGT)
  49856 
  49857   void* r;
  49858   smallJsont *self = allocSmallJson();
  49859 
  49860   smallJsont *r2 = pushVoidSmallJsonG(self, &r);
  49861   ck_assert_ptr_ne(r2, null);
  49862   r = cropElemAtVoidSmallJsonG(self, 0);
  49863   ck_assert_ptr_eq(r, &r);
  49864   terminateO(self);
  49865 
  49866 END_TEST
  49867 
  49868 
  49869 START_TEST(cropElemAtSmallContainerSmallJsonGT)
  49870 
  49871   smallContainert* r;
  49872   smallJsont *self = allocSmallJson();
  49873 
  49874   createSmallContainer(e2);
  49875   smallJsont *r2 = self->f->pushSmallContainer(self, &e2);
  49876   ck_assert_ptr_ne(r2, null);
  49877   r = cropElemAtSmallContainerSmallJsonG(self, 0);
  49878   ck_assert_ptr_ne(r, null);
  49879   char *s = toStringO(r);
  49880   terminateO(r);
  49881   ck_assert_str_eq(s, "<data smallContainer>");
  49882   free(s);
  49883   terminateO(self);
  49884 
  49885 END_TEST
  49886 
  49887 
  49888 START_TEST(cropElemKeySmallJsonGT)
  49889 
  49890   baset* r;
  49891   smallJsont *self = allocSmallJson();
  49892   smallJsont *r2;
  49893 
  49894   r2 = self->f->setInt(self, "1", 1);
  49895   ck_assert_ptr_ne(r2, null);
  49896   r2 = self->f->setDouble(self, "2", 2.2);
  49897   ck_assert_ptr_ne(r2, null);
  49898   r2 = self->f->setS(self, "3", "2");
  49899   ck_assert_ptr_ne(r2, null);
  49900   r2 = self->f->setUndefined(self, "u");
  49901   ck_assert_ptr_ne(r2, null);
  49902   createSmallContainer(c);
  49903   r2 = self->f->setSmallContainer(self, "c", &c);
  49904   ck_assert_ptr_ne(r2, null);
  49905   createAllocateSmallInt(I);
  49906   setValG(I, 11);
  49907   I->type = "anothertype";
  49908   r2 = self->f->set(self, "b", (baset*)I);
  49909   ck_assert_ptr_ne(r2, null);
  49910   // crop string
  49911   r = cropElemKeySmallJsonG(self, "3");
  49912   ck_assert_ptr_ne(r, null);
  49913   char *s = toStringO(r);
  49914   terminateO(r);
  49915   ck_assert_str_eq(s, "2");
  49916   free(s);
  49917   s = toStringO(self);
  49918   ck_assert_str_eq(s, "{\"1\":1,\"2\":2.200000e+00,\"u\":null,\"c\":\"<data container>\",\"b\":\"<data container>\"}");
  49919   free(s);
  49920   terminateO(self);
  49921 
  49922 END_TEST
  49923 
  49924 
  49925 START_TEST(cropElemKeyUndefinedSmallJsonGT)
  49926 
  49927   undefinedt* r;
  49928   smallJsont *self = allocSmallJson();
  49929   smallJsont *r2;
  49930 
  49931   r2 = self->f->setInt(self, "1", 1);
  49932   ck_assert_ptr_ne(r2, null);
  49933   r2 = self->f->setDouble(self, "2", 2.2);
  49934   ck_assert_ptr_ne(r2, null);
  49935   r2 = self->f->setUndefined(self, "u");
  49936   ck_assert_ptr_ne(r2, null);
  49937   r = cropElemKeyUndefinedSmallJsonG(self, "u");
  49938   ck_assert_ptr_ne(r, null);
  49939   char *s = toStringO(r);
  49940   terminateO(r);
  49941   ck_assert_str_eq(s, "null");
  49942   free(s);
  49943   s = toStringO(self);
  49944   ck_assert_str_eq(s, "{\"1\":1,\"2\":2.200000e+00}");
  49945   free(s);
  49946   terminateO(self);
  49947 
  49948 END_TEST
  49949 
  49950 
  49951 START_TEST(cropElemKeyBoolSmallJsonGT)
  49952 
  49953   bool r;
  49954   smallJsont *self = allocSmallJson();
  49955   smallJsont *r2;
  49956 
  49957   r2 = self->f->setInt(self, "1", 1);
  49958   ck_assert_ptr_ne(r2, null);
  49959   r2 = self->f->setDouble(self, "2", 2.2);
  49960   ck_assert_ptr_ne(r2, null);
  49961   r2 = self->f->setBool(self, "b", true);
  49962   ck_assert_ptr_ne(r2, null);
  49963   createAllocateSmallInt(I);
  49964   setValG(I, 11);
  49965   I->type = "anothertype";
  49966   r2 = self->f->set(self, "B", (baset*)I);
  49967   ck_assert_ptr_ne(r2, null);
  49968   r = cropElemKeyBoolSmallJsonG(self, "b");
  49969   ck_assert(r);
  49970   char *s = toStringO(self);
  49971   ck_assert_str_eq(s, "{\"1\":1,\"2\":2.200000e+00,\"B\":\"<data container>\"}");
  49972   free(s);
  49973   terminateO(self);
  49974 
  49975 END_TEST
  49976 
  49977 
  49978 START_TEST(cropElemKeyDoubleSmallJsonGT)
  49979 
  49980   double r;
  49981   smallJsont *self = allocSmallJson();
  49982   smallJsont *r2;
  49983 
  49984   r2 = self->f->setInt(self, "1", 1);
  49985   ck_assert_ptr_ne(r2, null);
  49986   r2 = self->f->setDouble(self, "2", 2.2);
  49987   ck_assert_ptr_ne(r2, null);
  49988   r2 = self->f->setDouble(self, "b", 3.3);
  49989   ck_assert_ptr_ne(r2, null);
  49990   createAllocateSmallInt(I);
  49991   setValG(I, 11);
  49992   I->type = "anothertype";
  49993   r2 = self->f->set(self, "B", (baset*)I);
  49994   ck_assert_ptr_ne(r2, null);
  49995   r = cropElemKeyDoubleSmallJsonG(self, "b");
  49996   ck_assert(r == 3.3);
  49997   char *s = toStringO(self);
  49998   ck_assert_str_eq(s, "{\"1\":1,\"2\":2.200000e+00,\"B\":\"<data container>\"}");
  49999   free(s);
  50000   terminateO(self);
  50001 
  50002 END_TEST
  50003 
  50004 
  50005 START_TEST(cropElemKeyIntSmallJsonGT)
  50006 
  50007   int64_t r;
  50008   smallJsont *self = allocSmallJson();
  50009   smallJsont *r2;
  50010 
  50011   r2 = self->f->setInt(self, "1", 1);
  50012   ck_assert_ptr_ne(r2, null);
  50013   r2 = self->f->setDouble(self, "2", 2.2);
  50014   ck_assert_ptr_ne(r2, null);
  50015   r2 = self->f->setInt(self, "b", 2);
  50016   ck_assert_ptr_ne(r2, null);
  50017   createAllocateSmallInt(I);
  50018   setValG(I, 11);
  50019   I->type = "anothertype";
  50020   r2 = self->f->set(self, "B", (baset*)I);
  50021   ck_assert_ptr_ne(r2, null);
  50022   r = cropElemKeyIntSmallJsonG(self, "b");
  50023   ck_assert_int_eq(r, 2);
  50024   char *s = toStringO(self);
  50025   ck_assert_str_eq(s, "{\"1\":1,\"2\":2.200000e+00,\"B\":\"<data container>\"}");
  50026   free(s);
  50027   terminateO(self);
  50028 
  50029 END_TEST
  50030 
  50031 
  50032 START_TEST(cropElemKeyInt32SmallJsonGT)
  50033 
  50034   int32_t r;
  50035   smallJsont *self = allocSmallJson();
  50036   smallJsont *r2;
  50037 
  50038   r2 = self->f->setInt(self, "1", 1);
  50039   ck_assert_ptr_ne(r2, null);
  50040   r2 = self->f->setDouble(self, "2", 2.2);
  50041   ck_assert_ptr_ne(r2, null);
  50042   r2 = self->f->setInt(self, "b", 2);
  50043   ck_assert_ptr_ne(r2, null);
  50044   createAllocateSmallInt(I);
  50045   setValG(I, 11);
  50046   I->type = "anothertype";
  50047   r2 = self->f->set(self, "B", (baset*)I);
  50048   ck_assert_ptr_ne(r2, null);
  50049   r = cropElemKeyInt32SmallJsonG(self, "b");
  50050   ck_assert_int_eq(r, 2);
  50051   char *s = toStringO(self);
  50052   ck_assert_str_eq(s, "{\"1\":1,\"2\":2.200000e+00,\"B\":\"<data container>\"}");
  50053   free(s);
  50054   terminateO(self);
  50055 
  50056 END_TEST
  50057 
  50058 
  50059 START_TEST(cropElemKeyUintSmallJsonGT)
  50060 
  50061   uint64_t r;
  50062   smallJsont *self = allocSmallJson();
  50063   smallJsont *r2;
  50064 
  50065   r2 = self->f->setInt(self, "1", 1);
  50066   ck_assert_ptr_ne(r2, null);
  50067   r2 = self->f->setDouble(self, "2", 2.2);
  50068   ck_assert_ptr_ne(r2, null);
  50069   r2 = self->f->setInt(self, "b", 2);
  50070   ck_assert_ptr_ne(r2, null);
  50071   createAllocateSmallInt(I);
  50072   setValG(I, 11);
  50073   I->type = "anothertype";
  50074   r2 = self->f->set(self, "B", (baset*)I);
  50075   ck_assert_ptr_ne(r2, null);
  50076   r = cropElemKeyUintSmallJsonG(self, "b");
  50077   ck_assert_int_eq(r, 2);
  50078   char *s = toStringO(self);
  50079   ck_assert_str_eq(s, "{\"1\":1,\"2\":2.200000e+00,\"B\":\"<data container>\"}");
  50080   free(s);
  50081   terminateO(self);
  50082 
  50083 END_TEST
  50084 
  50085 
  50086 START_TEST(cropElemKeyUint32SmallJsonGT)
  50087 
  50088   uint32_t r;
  50089   smallJsont *self = allocSmallJson();
  50090   smallJsont *r2;
  50091 
  50092   r2 = self->f->setInt(self, "1", 1);
  50093   ck_assert_ptr_ne(r2, null);
  50094   r2 = self->f->setDouble(self, "2", 2.2);
  50095   ck_assert_ptr_ne(r2, null);
  50096   r2 = self->f->setInt(self, "b", 2);
  50097   ck_assert_ptr_ne(r2, null);
  50098   createAllocateSmallInt(I);
  50099   setValG(I, 11);
  50100   I->type = "anothertype";
  50101   r2 = self->f->set(self, "B", (baset*)I);
  50102   ck_assert_ptr_ne(r2, null);
  50103   r = cropElemKeyUint32SmallJsonG(self, "b");
  50104   ck_assert_int_eq(r, 2);
  50105   char *s = toStringO(self);
  50106   ck_assert_str_eq(s, "{\"1\":1,\"2\":2.200000e+00,\"B\":\"<data container>\"}");
  50107   free(s);
  50108   terminateO(self);
  50109 
  50110 END_TEST
  50111 
  50112 
  50113 START_TEST(cropElemKeySSmallJsonGT)
  50114 
  50115   char* r;
  50116   smallJsont *self = allocSmallJson();
  50117   smallJsont *r2;
  50118 
  50119   r2 = self->f->setInt(self, "1", 1);
  50120   ck_assert_ptr_ne(r2, null);
  50121   r2 = self->f->setDouble(self, "2", 2.2);
  50122   ck_assert_ptr_ne(r2, null);
  50123   r2 = self->f->setS(self, "b", "qwe");
  50124   ck_assert_ptr_ne(r2, null);
  50125   createAllocateSmallInt(I);
  50126   setValG(I, 11);
  50127   I->type = "anothertype";
  50128   r2 = self->f->set(self, "B", (baset*)I);
  50129   ck_assert_ptr_ne(r2, null);
  50130   r = cropElemKeySSmallJsonG(self, "b");
  50131   ck_assert_str_eq(r, "qwe");
  50132   free(r);
  50133   char *s = toStringO(self);
  50134   ck_assert_str_eq(s, "{\"1\":1,\"2\":2.200000e+00,\"B\":\"<data container>\"}");
  50135   free(s);
  50136   terminateO(self);
  50137 
  50138 END_TEST
  50139 
  50140 
  50141 START_TEST(cropElemKeyDictSmallJsonGT)
  50142 
  50143   smallDictt* r;
  50144   smallJsont *self = allocSmallJson();
  50145   smallJsont *r2;
  50146 
  50147   r2 = self->f->setInt(self, "1", 1);
  50148   ck_assert_ptr_ne(r2, null);
  50149   r2 = self->f->setDouble(self, "2", 2.2);
  50150   ck_assert_ptr_ne(r2, null);
  50151   createAllocateSmallDict(d);
  50152   r2 = self->f->setNFreeDict(self, "b", d);
  50153   ck_assert_ptr_ne(r2, null);
  50154   createAllocateSmallInt(I);
  50155   setValG(I, 11);
  50156   I->type = "anothertype";
  50157   r2 = self->f->set(self, "B", (baset*)I);
  50158   ck_assert_ptr_ne(r2, null);
  50159   r = cropElemKeyDictSmallJsonG(self, "b");
  50160   ck_assert_ptr_ne(r, null);
  50161   char *s = toStringO(r);
  50162   terminateO(r);
  50163   ck_assert_str_eq(s, "{}");
  50164   free(s);
  50165   s = toStringO(self);
  50166   ck_assert_str_eq(s, "{\"1\":1,\"2\":2.200000e+00,\"B\":\"<data container>\"}");
  50167   free(s);
  50168   terminateO(self);
  50169 
  50170 END_TEST
  50171 
  50172 
  50173 START_TEST(cropElemKeyArraySmallJsonGT)
  50174 
  50175   smallArrayt* r;
  50176   smallJsont *self = allocSmallJson();
  50177   smallJsont *r2;
  50178 
  50179   r2 = self->f->setInt(self, "1", 1);
  50180   ck_assert_ptr_ne(r2, null);
  50181   r2 = self->f->setDouble(self, "2", 2.2);
  50182   ck_assert_ptr_ne(r2, null);
  50183   createAllocateSmallArray(d);
  50184   r2 = self->f->setNFreeArray(self, "b", d);
  50185   ck_assert_ptr_ne(r2, null);
  50186   createAllocateSmallInt(I);
  50187   setValG(I, 11);
  50188   I->type = "anothertype";
  50189   r2 = self->f->set(self, "B", (baset*)I);
  50190   ck_assert_ptr_ne(r2, null);
  50191   r = cropElemKeyArraySmallJsonG(self, "b");
  50192   ck_assert_ptr_ne(r, null);
  50193   char *s = toStringO(r);
  50194   terminateO(r);
  50195   ck_assert_str_eq(s, "[]");
  50196   free(s);
  50197   s = toStringO(self);
  50198   ck_assert_str_eq(s, "{\"1\":1,\"2\":2.200000e+00,\"B\":\"<data container>\"}");
  50199   free(s);
  50200   terminateO(self);
  50201 
  50202 END_TEST
  50203 
  50204 
  50205 START_TEST(cropElemKeySmallBoolSmallJsonGT)
  50206 
  50207   smallBoolt* r;
  50208   smallJsont *self = allocSmallJson();
  50209   smallJsont *r2;
  50210 
  50211   r2 = self->f->setInt(self, "1", 1);
  50212   ck_assert_ptr_ne(r2, null);
  50213   r2 = self->f->setDouble(self, "2", 2.2);
  50214   ck_assert_ptr_ne(r2, null);
  50215   r2 = self->f->setBool(self, "b", true);
  50216   ck_assert_ptr_ne(r2, null);
  50217   createAllocateSmallInt(I);
  50218   setValG(I, 11);
  50219   I->type = "anothertype";
  50220   r2 = self->f->set(self, "B", (baset*)I);
  50221   ck_assert_ptr_ne(r2, null);
  50222   r = cropElemKeySmallBoolSmallJsonG(self, "b");
  50223   ck_assert_ptr_ne(r, null);
  50224   char *s = toStringO(r);
  50225   terminateO(r);
  50226   ck_assert_str_eq(s, "true");
  50227   free(s);
  50228   s = toStringO(self);
  50229   ck_assert_str_eq(s, "{\"1\":1,\"2\":2.200000e+00,\"B\":\"<data container>\"}");
  50230   free(s);
  50231   terminateO(self);
  50232 
  50233 END_TEST
  50234 
  50235 
  50236 START_TEST(cropElemKeySmallBytesSmallJsonGT)
  50237 
  50238   smallBytest* r;
  50239   smallJsont *self = allocSmallJson();
  50240   smallJsont *r2;
  50241 
  50242   r2 = self->f->setInt(self, "1", 1);
  50243   ck_assert_ptr_ne(r2, null);
  50244   r2 = self->f->setDouble(self, "2", 2.2);
  50245   ck_assert_ptr_ne(r2, null);
  50246   createAllocateSmallBytes(d);
  50247   r2 = self->f->setNFreeSmallBytes(self, "b", d);
  50248   ck_assert_ptr_ne(r2, null);
  50249   createAllocateSmallInt(I);
  50250   setValG(I, 11);
  50251   I->type = "anothertype";
  50252   r2 = self->f->set(self, "B", (baset*)I);
  50253   ck_assert_ptr_ne(r2, null);
  50254   r = cropElemKeySmallBytesSmallJsonG(self, "b");
  50255   ck_assert_ptr_ne(r, null);
  50256   char *s = toStringO(r);
  50257   terminateO(r);
  50258   ck_assert_str_eq(s, "[]");
  50259   free(s);
  50260   s = toStringO(self);
  50261   ck_assert_str_eq(s, "{\"1\":1,\"2\":2.200000e+00,\"B\":\"<data container>\"}");
  50262   free(s);
  50263   terminateO(self);
  50264 
  50265 END_TEST
  50266 
  50267 
  50268 START_TEST(cropElemKeySmallDoubleSmallJsonGT)
  50269 
  50270   smallDoublet* r;
  50271   smallJsont *self = allocSmallJson();
  50272   smallJsont *r2;
  50273 
  50274   r2 = self->f->setInt(self, "1", 1);
  50275   ck_assert_ptr_ne(r2, null);
  50276   r2 = self->f->setDouble(self, "2", 2.2);
  50277   ck_assert_ptr_ne(r2, null);
  50278   r2 = self->f->setDouble(self, "b", 3.3);
  50279   ck_assert_ptr_ne(r2, null);
  50280   createAllocateSmallInt(I);
  50281   setValG(I, 11);
  50282   I->type = "anothertype";
  50283   r2 = self->f->set(self, "B", (baset*)I);
  50284   ck_assert_ptr_ne(r2, null);
  50285   r = cropElemKeySmallDoubleSmallJsonG(self, "b");
  50286   ck_assert_ptr_ne(r, null);
  50287   char *s = toStringO(r);
  50288   terminateO(r);
  50289   ck_assert_str_eq(s, "3.300000e+00");
  50290   free(s);
  50291   s = toStringO(self);
  50292   ck_assert_str_eq(s, "{\"1\":1,\"2\":2.200000e+00,\"B\":\"<data container>\"}");
  50293   free(s);
  50294   terminateO(self);
  50295 
  50296 END_TEST
  50297 
  50298 
  50299 START_TEST(cropElemKeySmallIntSmallJsonGT)
  50300 
  50301   smallIntt* r;
  50302   smallJsont *self = allocSmallJson();
  50303   smallJsont *r2;
  50304 
  50305   r2 = self->f->setInt(self, "1", 1);
  50306   ck_assert_ptr_ne(r2, null);
  50307   r2 = self->f->setDouble(self, "2", 2.2);
  50308   ck_assert_ptr_ne(r2, null);
  50309   r2 = self->f->setInt(self, "b", 2);
  50310   ck_assert_ptr_ne(r2, null);
  50311   createAllocateSmallInt(I);
  50312   setValG(I, 11);
  50313   I->type = "anothertype";
  50314   r2 = self->f->set(self, "B", (baset*)I);
  50315   ck_assert_ptr_ne(r2, null);
  50316   r = cropElemKeySmallIntSmallJsonG(self, "b");
  50317   ck_assert_ptr_ne(r, null);
  50318   char *s = toStringO(r);
  50319   terminateO(r);
  50320   ck_assert_str_eq(s, "2");
  50321   free(s);
  50322   s = toStringO(self);
  50323   ck_assert_str_eq(s, "{\"1\":1,\"2\":2.200000e+00,\"B\":\"<data container>\"}");
  50324   free(s);
  50325   terminateO(self);
  50326 
  50327 END_TEST
  50328 
  50329 
  50330 START_TEST(cropElemKeySmallJsonSmallJsonGT)
  50331 
  50332   smallJsont* r;
  50333   smallJsont *self = allocSmallJson();
  50334   smallJsont *r2;
  50335 
  50336   r2 = self->f->setInt(self, "1", 1);
  50337   ck_assert_ptr_ne(r2, null);
  50338   createAllocateSmallBytes(b);
  50339   r2 = self->f->setNFreeSmallBytes(self, "2", b);
  50340   ck_assert_ptr_ne(r2, null);
  50341   createAllocateSmallJson(d);
  50342   r2 = self->f->setNFreeSmallJson(self, "b", d);
  50343   ck_assert_ptr_ne(r2, null);
  50344   createAllocateSmallInt(I);
  50345   setValG(I, 11);
  50346   I->type = "anothertype";
  50347   r2 = self->f->set(self, "B", (baset*)I);
  50348   ck_assert_ptr_ne(r2, null);
  50349   r = cropElemKeySmallJsonSmallJsonG(self, "b");
  50350   ck_assert_ptr_ne(r, null);
  50351   char *s = toStringO(r);
  50352   terminateO(r);
  50353   ck_assert_str_eq(s, "{}");
  50354   free(s);
  50355   s = toStringO(self);
  50356   ck_assert_str_eq(s, "{\"1\":1,\"2\":[],\"B\":\"<data container>\"}");
  50357   free(s);
  50358   terminateO(self);
  50359 
  50360 END_TEST
  50361 
  50362 
  50363 START_TEST(cropElemKeySmallStringSmallJsonGT)
  50364 
  50365   smallStringt* r;
  50366   smallJsont *self = allocSmallJson();
  50367   smallJsont *r2;
  50368 
  50369   r2 = self->f->setInt(self, "1", 1);
  50370   ck_assert_ptr_ne(r2, null);
  50371   r2 = self->f->setDouble(self, "2", 2.2);
  50372   ck_assert_ptr_ne(r2, null);
  50373   r2 = self->f->setS(self, "b", "qwe");
  50374   ck_assert_ptr_ne(r2, null);
  50375   createAllocateSmallInt(I);
  50376   setValG(I, 11);
  50377   I->type = "anothertype";
  50378   r2 = self->f->set(self, "B", (baset*)I);
  50379   ck_assert_ptr_ne(r2, null);
  50380   r = cropElemKeySmallStringSmallJsonG(self, "b");
  50381   ck_assert_ptr_ne(r, null);
  50382   char *s = toStringO(r);
  50383   terminateO(r);
  50384   ck_assert_str_eq(s, "qwe");
  50385   free(s);
  50386   s = toStringO(self);
  50387   ck_assert_str_eq(s, "{\"1\":1,\"2\":2.200000e+00,\"B\":\"<data container>\"}");
  50388   free(s);
  50389   terminateO(self);
  50390 
  50391 END_TEST
  50392 
  50393 
  50394 START_TEST(cropElemKeyVoidSmallJsonGT)
  50395 
  50396   void* r;
  50397   smallJsont *self = allocSmallJson();
  50398   smallJsont *r2;
  50399 
  50400   r2 = self->f->setInt(self, "1", 1);
  50401   ck_assert_ptr_ne(r2, null);
  50402   r2 = self->f->setDouble(self, "2", 2.2);
  50403   ck_assert_ptr_ne(r2, null);
  50404   smallContainert *c = allocSmallContainer(&r);
  50405   r2 = self->f->setNFreeSmallContainer(self, "b", c);
  50406   ck_assert_ptr_ne(r2, null);
  50407   createAllocateSmallInt(I);
  50408   setValG(I, 11);
  50409   I->type = "anothertype";
  50410   r2 = self->f->set(self, "B", (baset*)I);
  50411   ck_assert_ptr_ne(r2, null);
  50412   r = cropElemKeyVoidSmallJsonG(self, "b");
  50413   ck_assert_ptr_eq(r, &r);
  50414   char *s = toStringO(self);
  50415   ck_assert_str_eq(s, "{\"1\":1,\"2\":2.200000e+00,\"B\":\"<data container>\"}");
  50416   free(s);
  50417   terminateO(self);
  50418 
  50419 END_TEST
  50420 
  50421 
  50422 START_TEST(cropElemKeySmallContainerSmallJsonGT)
  50423 
  50424   smallContainert* r;
  50425   smallJsont *self = allocSmallJson();
  50426   smallJsont *r2;
  50427 
  50428   r2 = self->f->setInt(self, "1", 1);
  50429   ck_assert_ptr_ne(r2, null);
  50430   r2 = self->f->setDouble(self, "2", 2.2);
  50431   ck_assert_ptr_ne(r2, null);
  50432   smallContainert *c = allocSmallContainer(&r);
  50433   r2 = self->f->setNFreeSmallContainer(self, "b", c);
  50434   ck_assert_ptr_ne(r2, null);
  50435   createAllocateSmallInt(I);
  50436   setValG(I, 11);
  50437   I->type = "anothertype";
  50438   r2 = self->f->set(self, "B", (baset*)I);
  50439   ck_assert_ptr_ne(r2, null);
  50440   r = cropElemKeySmallContainerSmallJsonG(self, "b");
  50441   ck_assert_ptr_ne(r, null);
  50442   char *s = toStringO(r);
  50443   terminateO(r);
  50444   ck_assert_str_eq(s, "<data smallContainer>");
  50445   free(s);
  50446   s = toStringO(self);
  50447   ck_assert_str_eq(s, "{\"1\":1,\"2\":2.200000e+00,\"B\":\"<data container>\"}");
  50448   free(s);
  50449   terminateO(self);
  50450 
  50451 END_TEST
  50452 
  50453 
  50454 START_TEST(copySmallJsonGT)
  50455 
  50456   smallJsont* r;
  50457   smallJsont *self = allocSmallJson();
  50458 
  50459   // add elements to self
  50460   r = self->f->pushInt(self, 1);
  50461   ck_assert_ptr_ne(r, null);
  50462   r = self->f->pushInt(self, 2);
  50463   ck_assert_ptr_ne(r, null);
  50464   r = self->f->pushInt(self, 3);
  50465   ck_assert_ptr_ne(r, null);
  50466   r = self->f->pushInt(self, 4);
  50467   ck_assert_ptr_ne(r, null);
  50468   r = copySmallJsonG(self, 1, -1);
  50469   ck_assert_ptr_ne(r, null);
  50470   ck_assert_int_eq(lenO(r), 2);
  50471   char *s = toStringO(r);
  50472   terminateO(r);
  50473   ck_assert_str_eq(s, "[2,3]");
  50474   free(s);
  50475   s = toStringO(self);
  50476   ck_assert_str_eq(s, "[1,2,3,4]");
  50477   free(s);
  50478   terminateO(self);
  50479 
  50480 END_TEST
  50481 
  50482 
  50483 START_TEST(insertSmallJsonGT)
  50484 
  50485   smallJsont* r;
  50486   smallJsont *self     = allocSmallJson();
  50487   smallArrayt *toInsert = allocSmallArray();
  50488 
  50489   toInsert->f->pushInt(toInsert, 3);
  50490   r = insertSmallJsonG(self, 0, toInsert);
  50491   smashO(toInsert);
  50492   ck_assert_ptr_ne(r, null);
  50493   char *s  = toStringO(r);
  50494   ck_assert_str_eq(s, "[3]");
  50495   free(s);
  50496   terminateO(self);
  50497 
  50498 END_TEST
  50499 
  50500 
  50501 START_TEST(insertNSmashSmallJsonGT)
  50502 
  50503   smallJsont* r;
  50504   smallJsont *self     = allocSmallJson();
  50505   smallArrayt *toInsert = allocSmallArray();
  50506 
  50507   toInsert->f->pushInt(toInsert, 3);
  50508   r = insertNSmashSmallJsonG(self, 0, toInsert);
  50509   ck_assert_ptr_ne(r, null);
  50510   char *s  = toStringO(r);
  50511   ck_assert_str_eq(s, "[3]");
  50512   free(s);
  50513   terminateO(self);
  50514 
  50515 END_TEST
  50516 
  50517 
  50518 START_TEST(insertSmallJsonSmallJsonGT)
  50519 
  50520   smallJsont* r;
  50521   smallJsont *self    = allocSmallJson();
  50522   setTypeArrayO(self);
  50523   smallJsont *toInsert = allocSmallJson();
  50524 
  50525   toInsert->f->pushInt(toInsert, 3);
  50526   r = insertSmallJsonSmallJsonG(self, 0, toInsert);
  50527   smashO(toInsert);
  50528   ck_assert_ptr_ne(r, null);
  50529   char *s  = toStringO(r);
  50530   ck_assert_str_eq(s, "[3]");
  50531   free(s);
  50532   terminateO(self);
  50533 
  50534 END_TEST
  50535 
  50536 
  50537 START_TEST(insertNSmashSmallJsonSmallJsonGT)
  50538 
  50539   smallJsont* r;
  50540   smallJsont *self = allocSmallJson();
  50541   setTypeArrayO(self);
  50542   smallJsont *toInsert = allocSmallJson();
  50543 
  50544   toInsert->f->pushInt(toInsert, 3);
  50545   r = insertNSmashSmallJsonSmallJsonG(self, 0, toInsert);
  50546   ck_assert_ptr_ne(r, null);
  50547   char *s  = toStringO(r);
  50548   ck_assert_str_eq(s, "[3]");
  50549   free(s);
  50550   terminateO(self);
  50551 
  50552 END_TEST
  50553 
  50554 
  50555 START_TEST(insertStringSmallJsonGT)
  50556 
  50557   smallJsont*    r;
  50558   smallJsont *self       = allocG(rtSmallJsont);
  50559   smallStringt *toInsert = allocSmallString("lib");
  50560 
  50561   setTopSO(self, "sheepy");
  50562   r = insertStringSmallJsonG(self, 0, toInsert);
  50563   ck_assert_ptr_ne(r, null);
  50564   char *s = toStringO(r);
  50565   ck_assert_str_eq(s, "libsheepy");
  50566   free(s);
  50567   terminateO(toInsert);
  50568   terminateO(self);
  50569 
  50570 END_TEST
  50571 
  50572 
  50573 START_TEST(insertSSmallJsonGT)
  50574 
  50575   smallJsont*    r;
  50576   smallJsont *self = allocG(rtSmallJsont);
  50577 
  50578   setTopSO(self, "sheepy");
  50579   r = insertSSmallJsonG(self, 0, "lib");
  50580   ck_assert_ptr_ne(r, null);
  50581   char *s = toStringO(r);
  50582   ck_assert_str_eq(s, "libsheepy");
  50583   free(s);
  50584   terminateO(self);
  50585 
  50586 END_TEST
  50587 
  50588 
  50589 START_TEST(insertNFreeSmallJsonGT)
  50590 
  50591   smallJsont*    r;
  50592   smallJsont *self       = allocG(rtSmallJsont);
  50593   smallStringt *toInsert = allocSmallString("lib");
  50594 
  50595   setTopSO(self, "sheepy");
  50596   r = insertNFreeStringSmallJsonG(self, 0, toInsert);
  50597   ck_assert_ptr_ne(r, null);
  50598   char *s = toStringO(r);
  50599   ck_assert_str_eq(s, "libsheepy");
  50600   free(s);
  50601   terminateO(self);
  50602 
  50603 END_TEST
  50604 
  50605 
  50606 START_TEST(insertSNFreeStringSmallJsonGT)
  50607 
  50608   smallJsont*    r;
  50609   smallJsont *self = allocG(rtSmallJsont);
  50610 
  50611   setTopSO(self, "sheepy");
  50612   r = insertNFreeSSmallJsonG(self, 0, strdup("lib"));
  50613   ck_assert_ptr_ne(r, null);
  50614   char *s = toStringO(r);
  50615   ck_assert_str_eq(s, "libsheepy");
  50616   free(s);
  50617   terminateO(self);
  50618 
  50619 END_TEST
  50620 
  50621 
  50622 START_TEST(injectSmallJsonGT)
  50623 
  50624   smallJsont* r;
  50625   smallJsont *self = allocSmallJson();
  50626   baset *value      = (baset*) allocSmallInt(8);
  50627 
  50628   r = injectSmallJsonG(self, 0, value);
  50629   ck_assert_ptr_ne(r, null);
  50630   finishO(value);
  50631   char *s  = toStringO(r);
  50632   ck_assert_str_eq(s, "[8]");
  50633   free(s);
  50634   terminateO(self);
  50635 
  50636 END_TEST
  50637 
  50638 
  50639 START_TEST(injectUndefinedSmallJsonGT)
  50640 
  50641   smallJsont* r;
  50642   smallJsont *self = allocSmallJson();
  50643 
  50644   r = injectUndefinedSmallJsonG(self, 0, null);
  50645   ck_assert_ptr_ne(r, null);
  50646   char *s  = toStringO(r);
  50647   ck_assert_str_eq(s, "[null]");
  50648   free(s);
  50649   terminateO(self);
  50650 
  50651 END_TEST
  50652 
  50653 
  50654 START_TEST(injectBoolSmallJsonGT)
  50655 
  50656   smallJsont* r;
  50657   smallJsont *self = allocSmallJson();
  50658 
  50659   r = injectBoolSmallJsonG(self, 0, true);
  50660   ck_assert_ptr_ne(r, null);
  50661   char *s  = toStringO(r);
  50662   ck_assert_str_eq(s, "[true]");
  50663   free(s);
  50664   terminateO(self);
  50665 
  50666 END_TEST
  50667 
  50668 
  50669 START_TEST(injectDoubleSmallJsonGT)
  50670 
  50671   smallJsont* r;
  50672   smallJsont *self = allocSmallJson();
  50673 
  50674   r = injectDoubleSmallJsonG(self, 0, 1);
  50675   ck_assert_ptr_ne(r, null);
  50676   char *s  = toStringO(r);
  50677   ck_assert_str_eq(s, "[1.000000e+00]");
  50678   free(s);
  50679   terminateO(self);
  50680 
  50681 END_TEST
  50682 
  50683 
  50684 START_TEST(injectIntSmallJsonGT)
  50685 
  50686   smallJsont* r;
  50687   smallJsont *self = allocSmallJson();
  50688 
  50689   r = injectIntSmallJsonG(self, 0, 2);
  50690   ck_assert_ptr_ne(r, null);
  50691   char *s  = toStringO(r);
  50692   ck_assert_str_eq(s, "[2]");
  50693   free(s);
  50694   terminateO(self);
  50695 
  50696 END_TEST
  50697 
  50698 
  50699 START_TEST(injectSSmallJsonGT)
  50700 
  50701   smallJsont* r;
  50702   smallJsont *self = allocSmallJson();
  50703 
  50704   r = injectSSmallJsonG(self, 0, "qwe");
  50705   ck_assert_ptr_ne(r, null);
  50706   char *s  = toStringO(r);
  50707   ck_assert_str_eq(s, "[\"qwe\"]");
  50708   free(s);
  50709   terminateO(self);
  50710 
  50711 END_TEST
  50712 
  50713 
  50714 START_TEST(injectCharSmallJsonGT)
  50715 
  50716   smallJsont* r;
  50717   smallJsont *self = allocSmallJson();
  50718 
  50719   r = injectCharSmallJsonG(self, 0, 'a');
  50720   ck_assert_ptr_ne(r, null);
  50721   char *s  = toStringO(r);
  50722   ck_assert_str_eq(s, "[\"a\"]");
  50723   free(s);
  50724   terminateO(self);
  50725 
  50726 END_TEST
  50727 
  50728 
  50729 START_TEST(injectDictSmallJsonGT)
  50730 
  50731   smallJsont* r;
  50732   smallJsont *self = allocSmallJson();
  50733 
  50734   createSmallDict(d);
  50735   r = injectDictSmallJsonG(self, 0, &d);
  50736   ck_assert_ptr_ne(r, null);
  50737   char *s  = toStringO(r);
  50738   ck_assert_str_eq(s, "[{}]");
  50739   free(s);
  50740   terminateO(self);
  50741 
  50742 END_TEST
  50743 
  50744 
  50745 START_TEST(injectArraySmallJsonGT)
  50746 
  50747   smallJsont* r;
  50748   smallJsont *self = allocSmallJson();
  50749 
  50750   createSmallArray(a);
  50751   r = injectArraySmallJsonG(self, 0, &a);
  50752   ck_assert_ptr_ne(r, null);
  50753   char *s  = toStringO(r);
  50754   ck_assert_str_eq(s, "[[]]");
  50755   free(s);
  50756   terminateO(self);
  50757 
  50758 END_TEST
  50759 
  50760 
  50761 START_TEST(injectArraycSmallJsonGT)
  50762 
  50763   smallJsont* r;
  50764   smallJsont *self = allocSmallJson();
  50765   char **array      = listCreateS("a","b");
  50766 
  50767   r = injectArraycSmallJsonG(self, 0, array);
  50768   ck_assert_ptr_ne(r, null);
  50769   listFreeS(array);
  50770   char *s  = toStringO(r);
  50771   ck_assert_str_eq(s, "[[\"a\",\"b\"]]");
  50772   free(s);
  50773   terminateO(self);
  50774 
  50775 END_TEST
  50776 
  50777 
  50778 START_TEST(injectCArraycSmallJsonGT)
  50779 
  50780   smallJsont* r;
  50781   smallJsont *self   = allocSmallJson();
  50782   const char *array[] = {"a","b",null};
  50783 
  50784   r = injectCArraycSmallJsonG(self, 0, array);
  50785   ck_assert_ptr_ne(r, null);
  50786   char *s  = toStringO(r);
  50787   ck_assert_str_eq(s, "[[\"a\",\"b\"]]");
  50788   free(s);
  50789   terminateO(self);
  50790 
  50791 END_TEST
  50792 
  50793 
  50794 START_TEST(injectVoidSmallJsonGT)
  50795 
  50796   smallJsont* r;
  50797   smallJsont *self = allocSmallJson();
  50798 
  50799   r = injectVoidSmallJsonG(self, 0, null);
  50800   ck_assert_ptr_ne(r, null);
  50801   char *s  = toStringO(r);
  50802   ck_assert_str_eq(s, "[null]");
  50803   free(s);
  50804   r = injectVoidSmallJsonG(self, 0, &r);
  50805   ck_assert_ptr_ne(r, null);
  50806   s  = toStringO(r);
  50807   ck_assert_str_eq(s, "[\"<data container>\",null]");
  50808   free(s);
  50809   terminateO(self);
  50810 
  50811 END_TEST
  50812 
  50813 
  50814 START_TEST(injectSmallBoolSmallJsonGT)
  50815 
  50816   smallJsont* r;
  50817   smallJsont *self = allocSmallJson();
  50818 
  50819   smallBoolt *b = allocSmallBool(true);
  50820   r = injectSmallBoolSmallJsonG(self, 0, b);
  50821   ck_assert_ptr_ne(r, null);
  50822   finishO(b);
  50823   char *s  = toStringO(r);
  50824   ck_assert_str_eq(s, "[true]");
  50825   free(s);
  50826   terminateO(self);
  50827 
  50828 END_TEST
  50829 
  50830 
  50831 START_TEST(injectSmallBytesSmallJsonGT)
  50832 
  50833   smallJsont* r;
  50834   smallJsont *self = allocSmallJson();
  50835   smallBytest *b    = allocSmallBytes("qwe", 3);
  50836 
  50837   r = injectSmallBytesSmallJsonG(self, 0, b);
  50838   ck_assert_ptr_ne(r, null);
  50839   finishO(b);
  50840   char *s  = toStringO(r);
  50841   ck_assert_str_eq(s, "[[0x71,0x77,0x65]]");
  50842   free(s);
  50843   terminateO(self);
  50844 
  50845 END_TEST
  50846 
  50847 
  50848 START_TEST(injectSmallDoubleSmallJsonGT)
  50849 
  50850   smallJsont* r;
  50851   smallJsont *self = allocSmallJson();
  50852   smallDoublet *value = allocSmallDouble(1);
  50853 
  50854   r = injectSmallDoubleSmallJsonG(self, 0, value);
  50855   ck_assert_ptr_ne(r, null);
  50856   finishO(value);
  50857   char *s  = toStringO(r);
  50858   ck_assert_str_eq(s, "[1.000000e+00]");
  50859   free(s);
  50860   terminateO(self);
  50861 
  50862 END_TEST
  50863 
  50864 
  50865 START_TEST(injectSmallIntSmallJsonGT)
  50866 
  50867   smallJsont* r;
  50868   smallJsont *self = allocSmallJson();
  50869   smallIntt *value  = allocSmallInt(1);
  50870 
  50871   r = injectSmallIntSmallJsonG(self, 0, value);
  50872   ck_assert_ptr_ne(r, null);
  50873   finishO(value);
  50874   char *s  = toStringO(r);
  50875   ck_assert_str_eq(s, "[1]");
  50876   free(s);
  50877   terminateO(self);
  50878 
  50879 END_TEST
  50880 
  50881 
  50882 START_TEST(injectSmallJsonSmallJsonGT)
  50883 
  50884   smallJsont* r;
  50885   smallJsont *self  = allocSmallJson();
  50886   smallJsont *string = allocSmallJson();
  50887 
  50888   r = injectSmallJsonSmallJsonG(self, 0, string);
  50889   ck_assert_ptr_ne(r, null);
  50890   finishO(string);
  50891   char *s  = toStringO(r);
  50892   ck_assert_str_eq(s, "[{}]");
  50893   free(s);
  50894   terminateO(self);
  50895 
  50896 END_TEST
  50897 
  50898 
  50899 START_TEST(injectSmallStringSmallJsonGT)
  50900 
  50901   smallJsont* r;
  50902   smallJsont *self    = allocSmallJson();
  50903   smallStringt *string = allocSmallString("qwe");
  50904 
  50905   r = injectSmallStringSmallJsonG(self, 0, string);
  50906   ck_assert_ptr_ne(r, null);
  50907   finishO(string);
  50908   char *s  = toStringO(r);
  50909   ck_assert_str_eq(s, "[\"qwe\"]");
  50910   free(s);
  50911   terminateO(self);
  50912 
  50913 END_TEST
  50914 
  50915 
  50916 START_TEST(injectSmallContainerSmallJsonGT)
  50917 
  50918   smallJsont* r;
  50919   smallJsont *self      = allocSmallJson();
  50920   smallContainert *value = allocSmallContainer(null);
  50921 
  50922   r = injectSmallContainerSmallJsonG(self, 0, value);
  50923   ck_assert_ptr_ne(r, null);
  50924   finishO(value);
  50925   char *s  = toStringO(r);
  50926   ck_assert_str_eq(s, "[\"<data container>\"]");
  50927   free(s);
  50928   terminateO(self);
  50929 
  50930 END_TEST
  50931 
  50932 
  50933 START_TEST(injectNFreeSmallJsonGT)
  50934 
  50935   smallJsont* r;
  50936   smallJsont *self = allocSmallJson();
  50937   baset *value      = (baset*) allocSmallInt(8);
  50938 
  50939   r = injectNFreeSmallJsonG(self, 0, value);
  50940   ck_assert_ptr_ne(r, null);
  50941   char *s  = toStringO(r);
  50942   ck_assert_str_eq(s, "[8]");
  50943   free(s);
  50944   terminateO(self);
  50945 
  50946 END_TEST
  50947 
  50948 
  50949 START_TEST(injectNFreeUndefinedSmallJsonGT)
  50950 
  50951   smallJsont* r;
  50952   smallJsont *self = allocSmallJson();
  50953 
  50954   createAllocateUndefined(u);
  50955   r = injectNFreeUndefinedSmallJsonG(self, 0, u);
  50956   ck_assert_ptr_ne(r, null);
  50957   char *s  = toStringO(r);
  50958   ck_assert_str_eq(s, "[null]");
  50959   free(s);
  50960   terminateO(self);
  50961 
  50962 END_TEST
  50963 
  50964 
  50965 START_TEST(injectNFreeSSmallJsonGT)
  50966 
  50967   smallJsont* r;
  50968   smallJsont *self = allocSmallJson();
  50969   char *string      = strdup("qwe");
  50970 
  50971   r = injectNFreeSSmallJsonG(self, 0, string);
  50972   ck_assert_ptr_ne(r, null);
  50973   char *s  = toStringO(r);
  50974   ck_assert_str_eq(s, "[\"qwe\"]");
  50975   free(s);
  50976   terminateO(self);
  50977 
  50978 END_TEST
  50979 
  50980 
  50981 START_TEST(injectNFreeDictSmallJsonGT)
  50982 
  50983   smallJsont* r;
  50984   smallJsont *self = allocSmallJson();
  50985 
  50986   createAllocateSmallDict(d);
  50987   r = injectNFreeDictSmallJsonG(self, 0, d);
  50988   ck_assert_ptr_ne(r, null);
  50989   char *s  = toStringO(r);
  50990   ck_assert_str_eq(s, "[{}]");
  50991   free(s);
  50992   terminateO(self);
  50993 
  50994 END_TEST
  50995 
  50996 
  50997 START_TEST(injectNFreeArraySmallJsonGT)
  50998 
  50999   smallJsont* r;
  51000   smallJsont *self = allocSmallJson();
  51001 
  51002   createAllocateSmallArray(a);
  51003   r = injectNFreeArraySmallJsonG(self, 0, a);
  51004   ck_assert_ptr_ne(r, null);
  51005   char *s  = toStringO(r);
  51006   ck_assert_str_eq(s, "[[]]");
  51007   free(s);
  51008   terminateO(self);
  51009 
  51010 END_TEST
  51011 
  51012 
  51013 START_TEST(injectNFreeArraycSmallJsonGT)
  51014 
  51015   smallJsont* r;
  51016   smallJsont *self = allocSmallJson();
  51017   char **array      = listCreateS("a","b");
  51018 
  51019   r = injectNFreeArraycSmallJsonG(self, 0, array);
  51020   ck_assert_ptr_ne(r, null);
  51021   char *s  = toStringO(r);
  51022   ck_assert_str_eq(s, "[[\"a\",\"b\"]]");
  51023   free(s);
  51024   terminateO(self);
  51025 
  51026 END_TEST
  51027 
  51028 
  51029 START_TEST(injectNFreeSmallBoolSmallJsonGT)
  51030 
  51031   smallJsont* r;
  51032   smallJsont *self = allocSmallJson();
  51033 
  51034   smallBoolt *b = allocSmallBool(true);
  51035   r = injectNFreeSmallBoolSmallJsonG(self, 0, b);
  51036   ck_assert_ptr_ne(r, null);
  51037   char *s  = toStringO(r);
  51038   ck_assert_str_eq(s, "[true]");
  51039   free(s);
  51040   terminateO(self);
  51041 
  51042 END_TEST
  51043 
  51044 
  51045 START_TEST(injectNFreeSmallBytesSmallJsonGT)
  51046 
  51047   smallJsont* r;
  51048   smallJsont *self = allocSmallJson();
  51049   smallBytest *b    = allocSmallBytes("qwe", 3);
  51050 
  51051   r = injectNFreeSmallBytesSmallJsonG(self, 0, b);
  51052   ck_assert_ptr_ne(r, null);
  51053   char *s  = toStringO(r);
  51054   ck_assert_str_eq(s, "[[0x71,0x77,0x65]]");
  51055   free(s);
  51056   terminateO(self);
  51057 
  51058 END_TEST
  51059 
  51060 
  51061 START_TEST(injectNFreeSmallDoubleSmallJsonGT)
  51062 
  51063   smallJsont* r;
  51064   smallJsont *self   = allocSmallJson();
  51065   smallDoublet *value = allocSmallDouble(1);
  51066 
  51067   r = injectNFreeSmallDoubleSmallJsonG(self, 0, value);
  51068   ck_assert_ptr_ne(r, null);
  51069   char *s  = toStringO(r);
  51070   ck_assert_str_eq(s, "[1.000000e+00]");
  51071   free(s);
  51072   terminateO(self);
  51073 
  51074 END_TEST
  51075 
  51076 
  51077 START_TEST(injectNFreeSmallIntSmallJsonGT)
  51078 
  51079   smallJsont* r;
  51080   smallJsont *self = allocSmallJson();
  51081   smallIntt *value  = allocSmallInt(1);
  51082 
  51083   r = injectNFreeSmallIntSmallJsonG(self, 0, value);
  51084   ck_assert_ptr_ne(r, null);
  51085   char *s  = toStringO(r);
  51086   ck_assert_str_eq(s, "[1]");
  51087   free(s);
  51088   terminateO(self);
  51089 
  51090 END_TEST
  51091 
  51092 
  51093 START_TEST(injectNFreeSmallJsonSmallJsonGT)
  51094 
  51095   smallJsont* r;
  51096   smallJsont *self  = allocSmallJson();
  51097   smallJsont *string = allocSmallJson();
  51098 
  51099   r = injectNFreeSmallJsonSmallJsonG(self, 0, string);
  51100   ck_assert_ptr_ne(r, null);
  51101   char *s  = toStringO(r);
  51102   ck_assert_str_eq(s, "[{}]");
  51103   free(s);
  51104   terminateO(self);
  51105 
  51106 END_TEST
  51107 
  51108 
  51109 START_TEST(injectNFreeSmallStringSmallJsonGT)
  51110 
  51111   smallJsont* r;
  51112   smallJsont *self    = allocSmallJson();
  51113   smallStringt *string = allocSmallString("qwe");
  51114 
  51115   r = injectNFreeSmallStringSmallJsonG(self, 0, string);
  51116   ck_assert_ptr_ne(r, null);
  51117   char *s  = toStringO(r);
  51118   ck_assert_str_eq(s, "[\"qwe\"]");
  51119   free(s);
  51120   terminateO(self);
  51121 
  51122 END_TEST
  51123 
  51124 
  51125 START_TEST(injectNFreeSmallContainerSmallJsonGT)
  51126 
  51127   smallJsont* r;
  51128   smallJsont *self = allocSmallJson();
  51129   smallContainert *value = allocSmallContainer(null);
  51130 
  51131   r = injectNFreeSmallContainerSmallJsonG(self, 0, value);
  51132   ck_assert_ptr_ne(r, null);
  51133   char *s  = toStringO(r);
  51134   ck_assert_str_eq(s, "[\"<data container>\"]");
  51135   free(s);
  51136   terminateO(self);
  51137 
  51138 END_TEST
  51139 
  51140 
  51141 START_TEST(uniqSmallJsonGT)
  51142 
  51143   smallJsont* r;
  51144   smallJsont *self = allocSmallJson();
  51145 
  51146   self->f->pushUndefined(self);
  51147   self->f->pushBool(self, true);
  51148   self->f->pushNFreeDict(self, allocSmallDict());
  51149   self->f->pushDouble(self, 1);
  51150   self->f->pushInt(self, 2);
  51151   self->f->pushS(self, "");
  51152   self->f->pushNFreeArray(self, allocSmallArray());
  51153   self->f->pushNFreeSmallBytes(self, allocSmallBytes("qwe",4));
  51154   self->f->pushUndefined(self);
  51155   self->f->pushBool(self, true);
  51156   self->f->pushNFreeDict(self, allocSmallDict());
  51157   self->f->pushDouble(self, 1);
  51158   self->f->pushInt(self, 2);
  51159   self->f->pushS(self, "");
  51160   self->f->pushNFreeArray(self, allocSmallArray());
  51161   self->f->pushNFreeSmallBytes(self, allocSmallBytes("qwe",4));
  51162   r = uniqSmallJsonG(self, 0);
  51163   ck_assert_ptr_ne(r, NULL);
  51164   char *s = toStringO(r);
  51165   ck_assert_str_eq(s, "[null,true,{},1.000000e+00,2,\"\",[],[0x71,0x77,0x65,0x00]]");
  51166   free(s);
  51167   // json string
  51168   freeO(self);
  51169   setTopSO(self, "/qwd///");
  51170   r = uniqSmallJsonG(self, '/');
  51171   ck_assert_ptr_ne(r, null);
  51172   s = toStringO(r);
  51173   ck_assert_str_eq(s, "/qwd/");
  51174   free(s);
  51175   terminateO(self);
  51176 
  51177 END_TEST
  51178 
  51179 
  51180 START_TEST(sortSmallJsonGT)
  51181 
  51182   smallJsont* r;
  51183   smallJsont *self = allocSmallJson();
  51184 
  51185   self->f->pushS(self, "bb");
  51186   self->f->pushS(self, "a");
  51187   r = sortSmallJsonG(self);
  51188   ck_assert_ptr_ne(r, null);
  51189   char *s = toStringO(r);
  51190   ck_assert_str_eq(s, "[\"a\",\"bb\"]");
  51191   free(s);
  51192   terminateO(self);
  51193 
  51194 END_TEST
  51195 
  51196 
  51197 START_TEST(sortFSmallJsonGT)
  51198 
  51199   smallJsont* r;
  51200   smallJsont *self = allocSmallJson();
  51201 
  51202   // sort dict
  51203   smallDictt *d[4];
  51204   arange(i,d) d[i] = allocSmallDict();
  51205   d[0]->f->setInt(d[0], "a", 1);
  51206   d[1]->f->setInt(d[1], "a", 0);
  51207   d[3]->f->setInt(d[3], "a", 0);
  51208   d[3]->f->setInt(d[3], "b", 0);
  51209   arange(i,d) self->f->pushNFreeDict(self, d[i]);
  51210   r = sortFSmallJsonG(self, sortFOCmp);
  51211   ck_assert_ptr_ne(r, null);
  51212   char *s = toStringO(r);
  51213   ck_assert_str_eq(s, "[{},{\"a\":0},{\"a\":1},{\"a\":0,\"b\":0}]");
  51214   free(s);
  51215   terminateO(self);
  51216 
  51217 END_TEST
  51218 
  51219 
  51220 START_TEST(icSortSmallJsonGT)
  51221 
  51222   smallJsont* r;
  51223   smallJsont *self = allocSmallJson();
  51224 
  51225   self->f->pushS(self, "bb");
  51226   self->f->pushS(self, "A");
  51227   r = icSortSmallJsonG(self);
  51228   ck_assert_ptr_ne(r, null);
  51229   char *s = toStringO(r);
  51230   ck_assert_str_eq(s, "[\"A\",\"bb\"]");
  51231   free(s);
  51232   terminateO(self);
  51233 
  51234 END_TEST
  51235 
  51236 
  51237 START_TEST(icUniqSmallJsonGT)
  51238 
  51239   smallJsont* r;
  51240   smallJsont *self = allocSmallJson();
  51241 
  51242   self->f->pushUndefined(self);
  51243   self->f->pushBool(self, true);
  51244   self->f->pushNFreeDict(self, allocSmallDict());
  51245   self->f->pushDouble(self, 1);
  51246   self->f->pushInt(self, 2);
  51247   self->f->pushS(self, "ASD");
  51248   self->f->pushNFreeArray(self, allocSmallArray());
  51249   self->f->pushNFreeSmallBytes(self, allocSmallBytes("qwe",4));
  51250   self->f->pushUndefined(self);
  51251   self->f->pushBool(self, true);
  51252   self->f->pushNFreeDict(self, allocSmallDict());
  51253   self->f->pushDouble(self, 1);
  51254   self->f->pushInt(self, 2);
  51255   self->f->pushS(self, "asd");
  51256   self->f->pushNFreeArray(self, allocSmallArray());
  51257   self->f->pushNFreeSmallBytes(self, allocSmallBytes("qwe",4));
  51258   r = icUniqSmallJsonG(self, 0);
  51259   ck_assert_ptr_ne(r, NULL);
  51260   char *s = toStringO(r);
  51261   ck_assert_str_eq(s, "[null,true,{},1.000000e+00,2,\"ASD\",[],[0x71,0x77,0x65,0x00]]");
  51262   free(s);
  51263   // json string
  51264   freeO(self);
  51265   setTopSO(self, "/qQwd///");
  51266   r = icUniqSmallJsonG(self, 'q');
  51267   ck_assert_ptr_ne(r, null);
  51268   s = toStringO(r);
  51269   ck_assert_str_eq(s, "/qwd///");
  51270   free(s);
  51271   terminateO(self);
  51272 
  51273 END_TEST
  51274 
  51275 
  51276 START_TEST(hasSmallJsonGT)
  51277 
  51278   bool r;
  51279   smallJsont *self = allocSmallJson();
  51280 
  51281   r = hasSmallJsonG(self, null);
  51282   ck_assert(!r);
  51283   terminateO(self);
  51284 
  51285 END_TEST
  51286 
  51287 
  51288 START_TEST(hasUndefinedSmallJsonGT)
  51289 
  51290   bool r;
  51291   smallJsont *self = allocSmallJson();
  51292 
  51293   r = hasUndefinedSmallJsonG(self, null);
  51294   ck_assert(!r);
  51295   terminateO(self);
  51296 
  51297 END_TEST
  51298 
  51299 
  51300 START_TEST(hasBoolSmallJsonGT)
  51301 
  51302   bool r;
  51303   smallJsont *self = allocSmallJson();
  51304 
  51305   r = hasBoolSmallJsonG(self, true);
  51306   ck_assert(!r);
  51307   terminateO(self);
  51308 
  51309 END_TEST
  51310 
  51311 
  51312 START_TEST(hasDoubleSmallJsonGT)
  51313 
  51314   bool r;
  51315   smallJsont *self = allocSmallJson();
  51316 
  51317   r = hasDoubleSmallJsonG(self, 1);
  51318   ck_assert(!r);
  51319   terminateO(self);
  51320 
  51321 END_TEST
  51322 
  51323 
  51324 START_TEST(hasIntSmallJsonGT)
  51325 
  51326   bool r;
  51327   smallJsont *self = allocSmallJson();
  51328 
  51329   r = hasIntSmallJsonG(self, 1);
  51330   ck_assert(!r);
  51331   terminateO(self);
  51332 
  51333 END_TEST
  51334 
  51335 
  51336 START_TEST(hasSSmallJsonGT)
  51337 
  51338   bool r;
  51339   smallJsont *self = allocSmallJson();
  51340 
  51341   r = hasSSmallJsonG(self, null);
  51342   ck_assert(!r);
  51343   terminateO(self);
  51344 
  51345 END_TEST
  51346 
  51347 
  51348 START_TEST(hasCharSmallJsonGT)
  51349 
  51350   bool r;
  51351   smallJsont *self = allocSmallJson();
  51352 
  51353   r = hasCharSmallJsonG(self, ' ');
  51354   ck_assert(!r);
  51355   terminateO(self);
  51356 
  51357 END_TEST
  51358 
  51359 
  51360 START_TEST(hasDictSmallJsonGT)
  51361 
  51362   bool r;
  51363   smallJsont *self = allocSmallJson();
  51364 
  51365   r = hasDictSmallJsonG(self, null);
  51366   ck_assert(!r);
  51367   terminateO(self);
  51368 
  51369 END_TEST
  51370 
  51371 
  51372 START_TEST(hasArraySmallJsonGT)
  51373 
  51374   bool r;
  51375   smallJsont *self = allocSmallJson();
  51376 
  51377   r = hasArraySmallJsonG(self, null);
  51378   ck_assert(!r);
  51379   terminateO(self);
  51380 
  51381 END_TEST
  51382 
  51383 
  51384 START_TEST(hasArraycSmallJsonGT)
  51385 
  51386   bool r;
  51387   smallJsont *self = allocSmallJson();
  51388 
  51389   r = hasArraycSmallJsonG(self, null);
  51390   ck_assert(!r);
  51391   terminateO(self);
  51392 
  51393 END_TEST
  51394 
  51395 
  51396 START_TEST(hasCArraycSmallJsonGT)
  51397 
  51398   bool r;
  51399   smallJsont *self = allocSmallJson();
  51400 
  51401   r = hasCArraycSmallJsonG(self, null);
  51402   ck_assert(!r);
  51403   terminateO(self);
  51404 
  51405 END_TEST
  51406 
  51407 
  51408 START_TEST(hasSmallBoolSmallJsonGT)
  51409 
  51410   bool r;
  51411   smallJsont *self = allocSmallJson();
  51412 
  51413   r = hasSmallBoolSmallJsonG(self, null);
  51414   ck_assert(!r);
  51415   terminateO(self);
  51416 
  51417 END_TEST
  51418 
  51419 
  51420 START_TEST(hasSmallBytesSmallJsonGT)
  51421 
  51422   bool r;
  51423   smallJsont *self = allocSmallJson();
  51424 
  51425   r = hasSmallBytesSmallJsonG(self, null);
  51426   ck_assert(!r);
  51427   terminateO(self);
  51428 
  51429 END_TEST
  51430 
  51431 
  51432 START_TEST(hasSmallDoubleSmallJsonGT)
  51433 
  51434   bool r;
  51435   smallJsont *self = allocSmallJson();
  51436 
  51437   r = hasSmallDoubleSmallJsonG(self, null);
  51438   ck_assert(!r);
  51439   terminateO(self);
  51440 
  51441 END_TEST
  51442 
  51443 
  51444 START_TEST(hasSmallIntSmallJsonGT)
  51445 
  51446   bool r;
  51447   smallJsont *self = allocSmallJson();
  51448 
  51449   r = hasSmallIntSmallJsonG(self, null);
  51450   ck_assert(!r);
  51451   terminateO(self);
  51452 
  51453 END_TEST
  51454 
  51455 
  51456 START_TEST(hasSmallJsonSmallJsonGT)
  51457 
  51458   bool r;
  51459   smallJsont *self = allocSmallJson();
  51460 
  51461   r = hasSmallJsonSmallJsonG(self, null);
  51462   ck_assert(!r);
  51463   terminateO(self);
  51464 
  51465 END_TEST
  51466 
  51467 
  51468 START_TEST(hasSmallStringSmallJsonGT)
  51469 
  51470   bool r;
  51471   smallJsont *self = allocSmallJson();
  51472 
  51473   r = hasSmallStringSmallJsonG(self, null);
  51474   ck_assert(!r);
  51475   terminateO(self);
  51476 
  51477 END_TEST
  51478 
  51479 
  51480 START_TEST(hasSmallContainerSmallJsonGT)
  51481 
  51482   bool r;
  51483   smallJsont *self = allocSmallJson();
  51484 
  51485   r = hasSmallContainerSmallJsonG(self, null);
  51486   ck_assert(!r);
  51487   terminateO(self);
  51488 
  51489 END_TEST
  51490 
  51491 
  51492 START_TEST(findSmallJsonGT)
  51493 
  51494   smallJsont* r;
  51495   smallJsont *self = allocG(rtSmallJsont);
  51496 
  51497   // find string in the middle
  51498   freeO(self);
  51499   setTopSO(self, "sheepy");
  51500   r =  findSmallJsonG(self, "ee");
  51501   ck_assert_ptr_ne(r, null);
  51502   ck_assert_str_eq(sjGet(r), "eepy");
  51503   terminateO(r);
  51504   terminateO(self);
  51505 
  51506 END_TEST
  51507 
  51508 
  51509 START_TEST(findCharSmallJsonGT)
  51510 
  51511   smallJsont* r;
  51512   smallJsont *self = allocG(rtSmallJsont);
  51513 
  51514   // find string in the middle
  51515   setTopSO(self, "sheepy");
  51516   r = findCharSmallJsonG(self, 'e');
  51517   ck_assert_ptr_ne(r, null);
  51518   ck_assert_str_eq(sjGet(r), "eepy");
  51519   terminateO(r);
  51520   terminateO(self);
  51521 
  51522 END_TEST
  51523 
  51524 
  51525 START_TEST(findSmallStringSmallJsonGT)
  51526 
  51527   smallJsont* r;
  51528   smallJsont *self     = allocG(rtSmallJsont);
  51529   smallStringt *needle = allocSmallString("ee");
  51530 
  51531   // find string in the middle
  51532   setTopSO(self, "sheepy");
  51533   r = findSmallStringSmallJsonG(self, needle);
  51534   ck_assert_ptr_ne(r, null);
  51535   ck_assert_str_eq(sjGet(r), "eepy");
  51536   terminateO(r);
  51537   terminateO(needle);
  51538   terminateO(self);
  51539 
  51540 END_TEST
  51541 
  51542 
  51543 START_TEST(findJsonSmallJsonGT)
  51544 
  51545   smallJsont* r;
  51546   smallJsont *self   = allocG(rtSmallJsont);
  51547   smallJsont *needle = allocSmallJson();
  51548 
  51549   // find string in the middle
  51550   setTopSO(self, "sheepy");
  51551   setTopSO(needle, "ee");
  51552   r = findJsonSmallJsonG(self, needle);
  51553   ck_assert_ptr_ne(r, null);
  51554   ck_assert_str_eq(sjGet(r), "eepy");
  51555   terminateO(r);
  51556   terminateO(needle);
  51557   terminateO(self);
  51558 
  51559 END_TEST
  51560 
  51561 
  51562 START_TEST(indexOfSmallJsonGT)
  51563 
  51564   ssize_t r;
  51565   smallJsont *self = allocSmallJson();
  51566 
  51567   r = indexOfSmallJsonG(self, null);
  51568   ck_assert_int_eq(r, -1);
  51569   terminateO(self);
  51570 
  51571 END_TEST
  51572 
  51573 
  51574 START_TEST(indexOfUndefinedSmallJsonGT)
  51575 
  51576   ssize_t r;
  51577   smallJsont *self = allocSmallJson();
  51578 
  51579   r = indexOfUndefinedSmallJsonG(self, null);
  51580   ck_assert_int_eq(r, -1);
  51581   terminateO(self);
  51582 
  51583 END_TEST
  51584 
  51585 
  51586 START_TEST(indexOfBoolSmallJsonGT)
  51587 
  51588   ssize_t r;
  51589   smallJsont *self = allocSmallJson();
  51590 
  51591   r = indexOfBoolSmallJsonG(self, false);
  51592   ck_assert_int_eq(r, -1);
  51593   terminateO(self);
  51594 
  51595 END_TEST
  51596 
  51597 
  51598 START_TEST(indexOfDoubleSmallJsonGT)
  51599 
  51600   ssize_t r;
  51601   smallJsont *self = allocSmallJson();
  51602 
  51603   r = indexOfDoubleSmallJsonG(self, 0);
  51604   ck_assert_int_eq(r, -1);
  51605   terminateO(self);
  51606 
  51607 END_TEST
  51608 
  51609 
  51610 START_TEST(indexOfIntSmallJsonGT)
  51611 
  51612   ssize_t r;
  51613   smallJsont *self = allocSmallJson();
  51614 
  51615   r = indexOfIntSmallJsonG(self, 0);
  51616   ck_assert_int_eq(r, -1);
  51617   terminateO(self);
  51618 
  51619 END_TEST
  51620 
  51621 
  51622 START_TEST(indexOfSSmallJsonGT)
  51623 
  51624   ssize_t r;
  51625   smallJsont *self = allocSmallJson();
  51626 
  51627   r = indexOfSSmallJsonG(self, null);
  51628   ck_assert_int_eq(r, -1);
  51629   terminateO(self);
  51630 
  51631 END_TEST
  51632 
  51633 
  51634 START_TEST(indexOfCharSmallJsonGT)
  51635 
  51636   ssize_t r;
  51637   smallJsont *self = allocSmallJson();
  51638 
  51639   r = indexOfCharSmallJsonG(self, ' ');
  51640   ck_assert_int_eq(r, -1);
  51641   terminateO(self);
  51642 
  51643 END_TEST
  51644 
  51645 
  51646 START_TEST(indexOfDictSmallJsonGT)
  51647 
  51648   ssize_t r;
  51649   smallJsont *self = allocSmallJson();
  51650 
  51651   r = indexOfDictSmallJsonG(self, null);
  51652   ck_assert_int_eq(r, -1);
  51653   terminateO(self);
  51654 
  51655 END_TEST
  51656 
  51657 
  51658 START_TEST(indexOfArraySmallJsonGT)
  51659 
  51660   ssize_t r;
  51661   smallJsont *self = allocSmallJson();
  51662 
  51663   r = indexOfArraySmallJsonG(self, null);
  51664   ck_assert_int_eq(r, -1);
  51665   terminateO(self);
  51666 
  51667 END_TEST
  51668 
  51669 
  51670 START_TEST(indexOfArraycSmallJsonGT)
  51671 
  51672   ssize_t r;
  51673   smallJsont *self = allocSmallJson();
  51674 
  51675   r = indexOfArraycSmallJsonG(self, null);
  51676   ck_assert_int_eq(r, -1);
  51677   terminateO(self);
  51678 
  51679 END_TEST
  51680 
  51681 
  51682 START_TEST(indexOfCArraycSmallJsonGT)
  51683 
  51684   ssize_t r;
  51685   smallJsont *self = allocSmallJson();
  51686 
  51687   r = indexOfCArraycSmallJsonG(self, null);
  51688   ck_assert_int_eq(r, -1);
  51689   terminateO(self);
  51690 
  51691 END_TEST
  51692 
  51693 
  51694 START_TEST(indexOfSmallBoolSmallJsonGT)
  51695 
  51696   ssize_t r;
  51697   smallJsont *self = allocSmallJson();
  51698 
  51699   r = indexOfSmallBoolSmallJsonG(self, null);
  51700   ck_assert_int_eq(r, -1);
  51701   terminateO(self);
  51702 
  51703 END_TEST
  51704 
  51705 
  51706 START_TEST(indexOfSmallBytesSmallJsonGT)
  51707 
  51708   ssize_t r;
  51709   smallJsont *self = allocSmallJson();
  51710 
  51711   r = indexOfSmallBytesSmallJsonG(self, null);
  51712   ck_assert_int_eq(r, -1);
  51713   terminateO(self);
  51714 
  51715 END_TEST
  51716 
  51717 
  51718 START_TEST(indexOfSmallDoubleSmallJsonGT)
  51719 
  51720   ssize_t r;
  51721   smallJsont *self = allocSmallJson();
  51722 
  51723   r = indexOfSmallDoubleSmallJsonG(self, null);
  51724   ck_assert_int_eq(r, -1);
  51725   terminateO(self);
  51726 
  51727 END_TEST
  51728 
  51729 
  51730 START_TEST(indexOfSmallIntSmallJsonGT)
  51731 
  51732   ssize_t r;
  51733   smallJsont *self = allocSmallJson();
  51734 
  51735   r = indexOfSmallIntSmallJsonG(self, null);
  51736   ck_assert_int_eq(r, -1);
  51737   terminateO(self);
  51738 
  51739 END_TEST
  51740 
  51741 
  51742 START_TEST(indexOfSmallJsonSmallJsonGT)
  51743 
  51744   ssize_t r;
  51745   smallJsont *self = allocSmallJson();
  51746 
  51747   r = indexOfSmallJsonSmallJsonG(self, null);
  51748   ck_assert_int_eq(r, -1);
  51749   terminateO(self);
  51750 
  51751 END_TEST
  51752 
  51753 
  51754 START_TEST(indexOfSmallStringSmallJsonGT)
  51755 
  51756   ssize_t r;
  51757   smallJsont *self = allocSmallJson();
  51758 
  51759   r = indexOfSmallStringSmallJsonG(self, null);
  51760   ck_assert_int_eq(r, -1);
  51761   terminateO(self);
  51762 
  51763 END_TEST
  51764 
  51765 
  51766 START_TEST(indexOfSmallContainerSmallJsonGT)
  51767 
  51768   ssize_t r;
  51769   smallJsont *self = allocSmallJson();
  51770 
  51771   r = indexOfSmallContainerSmallJsonG(self, null);
  51772   ck_assert_int_eq(r, -1);
  51773   terminateO(self);
  51774 
  51775 END_TEST
  51776 
  51777 
  51778 START_TEST(binarySearchSmallJsonGT)
  51779 
  51780   ssize_t r;
  51781   smallJsont *self = allocSmallJson();
  51782 
  51783   r = binarySearchSmallJsonG(self, null);
  51784   ck_assert_int_eq(r, -1);
  51785   terminateO(self);
  51786 
  51787 END_TEST
  51788 
  51789 
  51790 START_TEST(binarySearchUndefinedSmallJsonGT)
  51791 
  51792   ssize_t r;
  51793   smallJsont *self = allocSmallJson();
  51794 
  51795   r = binarySearchUndefinedSmallJsonG(self, null);
  51796   ck_assert_int_eq(r, -1);
  51797   terminateO(self);
  51798 
  51799 END_TEST
  51800 
  51801 
  51802 START_TEST(binarySearchBoolSmallJsonGT)
  51803 
  51804   ssize_t r;
  51805   smallJsont *self = allocSmallJson();
  51806 
  51807   r = binarySearchBoolSmallJsonG(self, false);
  51808   ck_assert_int_eq(r, -1);
  51809   terminateO(self);
  51810 
  51811 END_TEST
  51812 
  51813 
  51814 START_TEST(binarySearchDoubleSmallJsonGT)
  51815 
  51816   ssize_t r;
  51817   smallJsont *self = allocSmallJson();
  51818 
  51819   r = binarySearchDoubleSmallJsonG(self, 0);
  51820   ck_assert_int_eq(r, -1);
  51821   terminateO(self);
  51822 
  51823 END_TEST
  51824 
  51825 
  51826 START_TEST(binarySearchIntSmallJsonGT)
  51827 
  51828   ssize_t r;
  51829   smallJsont *self = allocSmallJson();
  51830 
  51831   r = binarySearchIntSmallJsonG(self, 0);
  51832   ck_assert_int_eq(r, -1);
  51833   terminateO(self);
  51834 
  51835 END_TEST
  51836 
  51837 
  51838 START_TEST(binarySearchSSmallJsonGT)
  51839 
  51840   ssize_t r;
  51841   smallJsont *self = allocSmallJson();
  51842 
  51843   r = binarySearchSSmallJsonG(self, null);
  51844   ck_assert_int_eq(r, -1);
  51845   terminateO(self);
  51846 
  51847 END_TEST
  51848 
  51849 
  51850 START_TEST(binarySearchCharSmallJsonGT)
  51851 
  51852   ssize_t r;
  51853   smallJsont *self = allocSmallJson();
  51854 
  51855   r = binarySearchCharSmallJsonG(self, ' ');
  51856   ck_assert_int_eq(r, -1);
  51857   terminateO(self);
  51858 
  51859 END_TEST
  51860 
  51861 
  51862 START_TEST(binarySearchDictSmallJsonGT)
  51863 
  51864   ssize_t r;
  51865   smallJsont *self = allocSmallJson();
  51866 
  51867   r = binarySearchDictSmallJsonG(self, null);
  51868   ck_assert_int_eq(r, -1);
  51869   terminateO(self);
  51870 
  51871 END_TEST
  51872 
  51873 
  51874 START_TEST(binarySearchArraySmallJsonGT)
  51875 
  51876   ssize_t r;
  51877   smallJsont *self = allocSmallJson();
  51878 
  51879   r = binarySearchArraySmallJsonG(self, null);
  51880   ck_assert_int_eq(r, -1);
  51881   terminateO(self);
  51882 
  51883 END_TEST
  51884 
  51885 
  51886 START_TEST(binarySearchArraycSmallJsonGT)
  51887 
  51888   ssize_t r;
  51889   smallJsont *self = allocSmallJson();
  51890 
  51891   r = binarySearchArraycSmallJsonG(self, null);
  51892   ck_assert_int_eq(r, -1);
  51893   terminateO(self);
  51894 
  51895 END_TEST
  51896 
  51897 
  51898 START_TEST(binarySearchCArraycSmallJsonGT)
  51899 
  51900   ssize_t r;
  51901   smallJsont *self = allocSmallJson();
  51902 
  51903   r = binarySearchCArraycSmallJsonG(self, null);
  51904   ck_assert_int_eq(r, -1);
  51905   terminateO(self);
  51906 
  51907 END_TEST
  51908 
  51909 
  51910 START_TEST(binarySearchSmallBoolSmallJsonGT)
  51911 
  51912   ssize_t r;
  51913   smallJsont *self = allocSmallJson();
  51914 
  51915   r = binarySearchSmallBoolSmallJsonG(self, null);
  51916   ck_assert_int_eq(r, -1);
  51917   terminateO(self);
  51918 
  51919 END_TEST
  51920 
  51921 
  51922 START_TEST(binarySearchSmallBytesSmallJsonGT)
  51923 
  51924   ssize_t r;
  51925   smallJsont *self = allocSmallJson();
  51926 
  51927   r = binarySearchSmallBytesSmallJsonG(self, null);
  51928   ck_assert_int_eq(r, -1);
  51929   terminateO(self);
  51930 
  51931 END_TEST
  51932 
  51933 
  51934 START_TEST(binarySearchSmallDoubleSmallJsonGT)
  51935 
  51936   ssize_t r;
  51937   smallJsont *self = allocSmallJson();
  51938 
  51939   r = binarySearchSmallDoubleSmallJsonG(self, null);
  51940   ck_assert_int_eq(r, -1);
  51941   terminateO(self);
  51942 
  51943 END_TEST
  51944 
  51945 
  51946 START_TEST(binarySearchSmallIntSmallJsonGT)
  51947 
  51948   ssize_t r;
  51949   smallJsont *self = allocSmallJson();
  51950 
  51951   r = binarySearchSmallIntSmallJsonG(self, null);
  51952   ck_assert_int_eq(r, -1);
  51953   terminateO(self);
  51954 
  51955 END_TEST
  51956 
  51957 
  51958 START_TEST(binarySearchSmallJsonSmallJsonGT)
  51959 
  51960   ssize_t r;
  51961   smallJsont *self = allocSmallJson();
  51962 
  51963   r = binarySearchSmallJsonSmallJsonG(self, null);
  51964   ck_assert_int_eq(r, -1);
  51965   terminateO(self);
  51966 
  51967 END_TEST
  51968 
  51969 
  51970 START_TEST(binarySearchSmallStringSmallJsonGT)
  51971 
  51972   ssize_t r;
  51973   smallJsont *self = allocSmallJson();
  51974 
  51975   r = binarySearchSmallStringSmallJsonG(self, null);
  51976   ck_assert_int_eq(r, -1);
  51977   terminateO(self);
  51978 
  51979 END_TEST
  51980 
  51981 
  51982 START_TEST(binarySearchSmallContainerSmallJsonGT)
  51983 
  51984   ssize_t r;
  51985   smallJsont *self = allocSmallJson();
  51986 
  51987   r = binarySearchSmallContainerSmallJsonG(self, null);
  51988   ck_assert_int_eq(r, -1);
  51989   terminateO(self);
  51990 
  51991 END_TEST
  51992 
  51993 
  51994 START_TEST(icHasSmallJsonGT)
  51995 
  51996   bool r;
  51997   smallJsont *self = allocSmallJson();
  51998 
  51999   r = icHasSmallJsonG(self, null);
  52000   ck_assert(!r);
  52001   terminateO(self);
  52002 
  52003 END_TEST
  52004 
  52005 
  52006 START_TEST(icHasSSmallJsonGT)
  52007 
  52008   bool r;
  52009   smallJsont *self = allocSmallJson();
  52010 
  52011   r = icHasSSmallJsonG(self, null);
  52012   ck_assert(!r);
  52013   terminateO(self);
  52014 
  52015 END_TEST
  52016 
  52017 
  52018 START_TEST(icHasCharSmallJsonGT)
  52019 
  52020   bool r;
  52021   smallJsont *self = allocSmallJson();
  52022 
  52023   r = icHasCharSmallJsonG(self, 'a');
  52024   ck_assert(!r);
  52025   terminateO(self);
  52026 
  52027 END_TEST
  52028 
  52029 
  52030 START_TEST(icHasDictSmallJsonGT)
  52031 
  52032   bool r;
  52033   smallJsont *self = allocSmallJson();
  52034 
  52035   r = icHasDictSmallJsonG(self, null);
  52036   ck_assert(!r);
  52037   terminateO(self);
  52038 
  52039 END_TEST
  52040 
  52041 
  52042 START_TEST(icHasArraySmallJsonGT)
  52043 
  52044   bool r;
  52045   smallJsont *self = allocSmallJson();
  52046 
  52047   r = icHasArraySmallJsonG(self, null);
  52048   ck_assert(!r);
  52049   terminateO(self);
  52050 
  52051 END_TEST
  52052 
  52053 
  52054 START_TEST(icHasArraycSmallJsonGT)
  52055 
  52056   bool r;
  52057   smallJsont *self = allocSmallJson();
  52058 
  52059   r = icHasArraycSmallJsonG(self, null);
  52060   ck_assert(!r);
  52061   terminateO(self);
  52062 
  52063 END_TEST
  52064 
  52065 
  52066 START_TEST(icHasCArraycSmallJsonGT)
  52067 
  52068   bool r;
  52069   smallJsont *self = allocSmallJson();
  52070 
  52071   r = icHasCArraycSmallJsonG(self, null);
  52072   ck_assert(!r);
  52073   terminateO(self);
  52074 
  52075 END_TEST
  52076 
  52077 
  52078 START_TEST(icHasSmallStringSmallJsonGT)
  52079 
  52080   bool r;
  52081   smallJsont *self = allocSmallJson();
  52082 
  52083   r = icHasSmallStringSmallJsonG(self, null);
  52084   ck_assert(!r);
  52085   terminateO(self);
  52086 
  52087 END_TEST
  52088 
  52089 
  52090 START_TEST(icFindSmallJsonGT)
  52091 
  52092   smallJsont* r;
  52093   smallJsont *self = allocG(rtSmallJsont);
  52094 
  52095   // icFind string in the middle
  52096   setTopSO(self, "sheepy");
  52097   r =  icFindSmallJsonG(self, "EE");
  52098   ck_assert_ptr_ne(r, null);
  52099   ck_assert_str_eq(sjGet(r), "eepy");
  52100   terminateO(r);
  52101   terminateO(self);
  52102 
  52103 END_TEST
  52104 
  52105 
  52106 START_TEST(icFindCharSmallJsonGT)
  52107 
  52108   smallJsont* r;
  52109   smallJsont *self = allocG(rtSmallJsont);
  52110 
  52111   // find string in the middle
  52112   setTopSO(self, "sheepy");
  52113   r = icFindCharSmallJsonG(self, 'E');
  52114   ck_assert_ptr_ne(r, null);
  52115   ck_assert_str_eq(sjGet(r), "eepy");
  52116   terminateO(r);
  52117   terminateO(self);
  52118 
  52119 END_TEST
  52120 
  52121 
  52122 START_TEST(icFindSmallStringSmallJsonGT)
  52123 
  52124   smallJsont* r;
  52125   smallJsont *self     = allocG(rtSmallJsont);
  52126   smallStringt *needle = allocSmallString("EE");
  52127 
  52128   // find string in the middle
  52129   setTopSO(self, "sheepy");
  52130   r = icFindSmallStringSmallJsonG(self, needle);
  52131   ck_assert_ptr_ne(r, null);
  52132   ck_assert_str_eq(sjGet(r), "eepy");
  52133   terminateO(r);
  52134   terminateO(needle);
  52135   terminateO(self);
  52136 
  52137 END_TEST
  52138 
  52139 
  52140 START_TEST(icFindJsonSmallJsonGT)
  52141 
  52142   smallJsont* r;
  52143   smallJsont *self   = allocG(rtSmallJsont);
  52144   smallJsont *needle = allocSmallJson();
  52145 
  52146   // find string in the middle
  52147   setTopSO(self, "sheepy");
  52148   setTopSO(needle, "EE");
  52149   r = icFindJsonSmallJsonG(self, needle);
  52150   ck_assert_ptr_ne(r, null);
  52151   ck_assert_str_eq(sjGet(r), "eepy");
  52152   terminateO(r);
  52153   terminateO(needle);
  52154   terminateO(self);
  52155 
  52156 END_TEST
  52157 
  52158 
  52159 START_TEST(icIndexOfSmallJsonGT)
  52160 
  52161   ssize_t r;
  52162   smallJsont *self = allocSmallJson();
  52163 
  52164   r = icIndexOfSmallJsonG(self, null);
  52165   ck_assert_int_eq(r, -1);
  52166   terminateO(self);
  52167 
  52168 END_TEST
  52169 
  52170 
  52171 START_TEST(icIndexOfSSmallJsonGT)
  52172 
  52173   ssize_t r;
  52174   smallJsont *self = allocSmallJson();
  52175 
  52176   r = icIndexOfSSmallJsonG(self, null);
  52177   ck_assert_int_eq(r, -1);
  52178   terminateO(self);
  52179 
  52180 END_TEST
  52181 
  52182 
  52183 START_TEST(icIndexOfCharSmallJsonGT)
  52184 
  52185   ssize_t r;
  52186   smallJsont *self = allocSmallJson();
  52187 
  52188   r = icIndexOfCharSmallJsonG(self, 'A');
  52189   ck_assert_int_eq(r, -1);
  52190   terminateO(self);
  52191 
  52192 END_TEST
  52193 
  52194 
  52195 START_TEST(icIndexOfDictSmallJsonGT)
  52196 
  52197   ssize_t r;
  52198   smallJsont *self = allocSmallJson();
  52199 
  52200   r = icIndexOfDictSmallJsonG(self, null);
  52201   ck_assert_int_eq(r, -1);
  52202   terminateO(self);
  52203 
  52204 END_TEST
  52205 
  52206 
  52207 START_TEST(icIndexOfArraySmallJsonGT)
  52208 
  52209   ssize_t r;
  52210   smallJsont *self = allocSmallJson();
  52211 
  52212   r = icIndexOfArraySmallJsonG(self, null);
  52213   ck_assert_int_eq(r, -1);
  52214   terminateO(self);
  52215 
  52216 END_TEST
  52217 
  52218 
  52219 START_TEST(icIndexOfArraycSmallJsonGT)
  52220 
  52221   ssize_t r;
  52222   smallJsont *self = allocSmallJson();
  52223 
  52224   r = icIndexOfArraycSmallJsonG(self, null);
  52225   ck_assert_int_eq(r, -1);
  52226   terminateO(self);
  52227 
  52228 END_TEST
  52229 
  52230 
  52231 START_TEST(icIndexOfCArraycSmallJsonGT)
  52232 
  52233   ssize_t r;
  52234   smallJsont *self = allocSmallJson();
  52235 
  52236   r = icIndexOfCArraycSmallJsonG(self, null);
  52237   ck_assert_int_eq(r, -1);
  52238   terminateO(self);
  52239 
  52240 END_TEST
  52241 
  52242 
  52243 START_TEST(icIndexOfSmallStringSmallJsonGT)
  52244 
  52245   ssize_t r;
  52246   smallJsont *self = allocSmallJson();
  52247 
  52248   r = icIndexOfSmallStringSmallJsonG(self, null);
  52249   ck_assert_int_eq(r, -1);
  52250   terminateO(self);
  52251 
  52252 END_TEST
  52253 
  52254 
  52255 START_TEST(icBinarySearchSmallJsonGT)
  52256 
  52257   ssize_t r;
  52258   smallJsont *self = allocSmallJson();
  52259 
  52260   r = icBinarySearchSmallJsonG(self, null);
  52261   ck_assert_int_eq(r, -1);
  52262   terminateO(self);
  52263 
  52264 END_TEST
  52265 
  52266 
  52267 START_TEST(icBinarySearchSSmallJsonGT)
  52268 
  52269   ssize_t r;
  52270   smallJsont *self = allocSmallJson();
  52271 
  52272   r = icBinarySearchSSmallJsonG(self, null);
  52273   ck_assert_int_eq(r, -1);
  52274   terminateO(self);
  52275 
  52276 END_TEST
  52277 
  52278 
  52279 START_TEST(icBinarySearchCharSmallJsonGT)
  52280 
  52281   ssize_t r;
  52282   smallJsont *self = allocSmallJson();
  52283 
  52284   r = icBinarySearchCharSmallJsonG(self, 'a');
  52285   ck_assert_int_eq(r, -1);
  52286   terminateO(self);
  52287 
  52288 END_TEST
  52289 
  52290 
  52291 START_TEST(icBinarySearchDictSmallJsonGT)
  52292 
  52293   ssize_t r;
  52294   smallJsont *self = allocSmallJson();
  52295 
  52296   r = icBinarySearchDictSmallJsonG(self, null);
  52297   ck_assert_int_eq(r, -1);
  52298   terminateO(self);
  52299 
  52300 END_TEST
  52301 
  52302 
  52303 START_TEST(icBinarySearchArraySmallJsonGT)
  52304 
  52305   ssize_t r;
  52306   smallJsont *self = allocSmallJson();
  52307 
  52308   r = icBinarySearchArraySmallJsonG(self, null);
  52309   ck_assert_int_eq(r, -1);
  52310   terminateO(self);
  52311 
  52312 END_TEST
  52313 
  52314 
  52315 START_TEST(icBinarySearchArraycSmallJsonGT)
  52316 
  52317   ssize_t r;
  52318   smallJsont *self = allocSmallJson();
  52319 
  52320   r = icBinarySearchArraycSmallJsonG(self, null);
  52321   ck_assert_int_eq(r, -1);
  52322   terminateO(self);
  52323 
  52324 END_TEST
  52325 
  52326 
  52327 START_TEST(icBinarySearchCArraycSmallJsonGT)
  52328 
  52329   ssize_t r;
  52330   smallJsont *self = allocSmallJson();
  52331 
  52332   r = icBinarySearchCArraycSmallJsonG(self, null);
  52333   ck_assert_int_eq(r, -1);
  52334   terminateO(self);
  52335 
  52336 END_TEST
  52337 
  52338 
  52339 START_TEST(icBinarySearchSmallStringSmallJsonGT)
  52340 
  52341   ssize_t r;
  52342   smallJsont *self = allocSmallJson();
  52343 
  52344   r = icBinarySearchSmallStringSmallJsonG(self, null);
  52345   ck_assert_int_eq(r, -1);
  52346   terminateO(self);
  52347 
  52348 END_TEST
  52349 
  52350 
  52351 START_TEST(keyBySmallJsonGT)
  52352 
  52353   char* r;
  52354   smallJsont *self = allocSmallJson();
  52355   baset *value;
  52356 
  52357   smallJsont *r2 = self->f->setInt(self, "1", 1);
  52358   ck_assert_ptr_ne(r2, null);
  52359   value = (baset*) allocSmallInt(1);
  52360   r = keyBySmallJsonG(self, value);
  52361   ck_assert_str_eq(r, "1");
  52362   terminateO(value);
  52363   terminateO(self);
  52364 
  52365 END_TEST
  52366 
  52367 
  52368 START_TEST(keyByUndefinedSmallJsonGT)
  52369 
  52370   char* r;
  52371   smallJsont *self = allocSmallJson();
  52372   undefinedt *value;
  52373 
  52374   smallJsont *r2 = self->f->setUndefined(self, "1");
  52375   ck_assert_ptr_ne(r2, null);
  52376   value = allocUndefined();
  52377   r = keyByUndefinedSmallJsonG(self, value);
  52378   ck_assert_str_eq(r, "1");
  52379   terminateO(value);
  52380   terminateO(self);
  52381 
  52382 END_TEST
  52383 
  52384 
  52385 START_TEST(keyByBoolSmallJsonGT)
  52386 
  52387   char* r;
  52388   smallJsont *self = allocSmallJson();
  52389 
  52390   smallJsont *r2 = self->f->setBool(self, "1", true);
  52391   ck_assert_ptr_ne(r2, null);
  52392   r = keyByBoolSmallJsonG(self, true);
  52393   ck_assert_str_eq(r, "1");
  52394   terminateO(self);
  52395 
  52396 END_TEST
  52397 
  52398 
  52399 START_TEST(keyByDoubleSmallJsonGT)
  52400 
  52401   char* r;
  52402   smallJsont *self = allocSmallJson();
  52403 
  52404   smallJsont *r2 = self->f->setDouble(self, "1", 2.2);
  52405   ck_assert_ptr_ne(r2, null);
  52406   r = keyByDoubleSmallJsonG(self, 2.2);
  52407   ck_assert_str_eq(r, "1");
  52408   terminateO(self);
  52409 
  52410 END_TEST
  52411 
  52412 
  52413 START_TEST(keyByIntSmallJsonGT)
  52414 
  52415   char* r;
  52416   smallJsont *self = allocSmallJson();
  52417 
  52418   smallJsont *r2 = self->f->setInt(self, "1", 2);
  52419   ck_assert_ptr_ne(r2, null);
  52420   r = keyByIntSmallJsonG(self, 2);
  52421   ck_assert_str_eq(r, "1");
  52422   terminateO(self);
  52423 
  52424 END_TEST
  52425 
  52426 
  52427 START_TEST(keyBySSmallJsonGT)
  52428 
  52429   char* r;
  52430   smallJsont *self = allocSmallJson();
  52431 
  52432   smallJsont *r2 = self->f->setS(self, "1", "qwe");
  52433   ck_assert_ptr_ne(r2, null);
  52434   r = keyBySSmallJsonG(self, "qwe");
  52435   ck_assert_str_eq(r, "1");
  52436   terminateO(self);
  52437 
  52438 END_TEST
  52439 
  52440 
  52441 START_TEST(keyByCharSmallJsonGT)
  52442 
  52443   char* r;
  52444   smallJsont *self = allocSmallJson();
  52445 
  52446   smallJsont *r2 = self->f->setS(self, "1", "q");
  52447   ck_assert_ptr_ne(r2, null);
  52448   r = keyByCharSmallJsonG(self, 'q');
  52449   ck_assert_str_eq(r, "1");
  52450   terminateO(self);
  52451 
  52452 END_TEST
  52453 
  52454 
  52455 START_TEST(keyByDictSmallJsonGT)
  52456 
  52457   char* r;
  52458   smallJsont *self = allocSmallJson();
  52459   smallDictt *dict = allocSmallDict();
  52460 
  52461   createAllocateSmallDict(d);
  52462   d->f->setS(d, "another", "dict");
  52463   smallJsont *r2 = self->f->setNFreeDict(self, "d", d);
  52464   ck_assert_ptr_ne(r2, null);
  52465   r2 = self->f->setNFreeDict(self, "1", dict);
  52466   ck_assert_ptr_ne(r2, null);
  52467   dict = allocSmallDict();
  52468   r = keyByDictSmallJsonG(self, dict);
  52469   ck_assert_str_eq(r, "1");
  52470   terminateO(dict);
  52471   terminateO(self);
  52472 
  52473 END_TEST
  52474 
  52475 
  52476 START_TEST(keyByArraySmallJsonGT)
  52477 
  52478   char* r;
  52479   smallJsont *self   = allocSmallJson();
  52480   smallArrayt *array = allocSmallArray();
  52481 
  52482   createAllocateSmallArray(d);
  52483   d->f->pushS(d, "another array");
  52484   smallJsont *r2 = self->f->setNFreeArray(self, "d", d);
  52485   ck_assert_ptr_ne(r2, null);
  52486   r2 = self->f->setNFreeArray(self, "1", array);
  52487   ck_assert_ptr_ne(r2, null);
  52488   array = allocSmallArray();
  52489   r = keyByArraySmallJsonG(self, array);
  52490   ck_assert_str_eq(r, "1");
  52491   terminateO(array);
  52492   terminateO(self);
  52493 
  52494 END_TEST
  52495 
  52496 
  52497 START_TEST(keyByArraycSmallJsonGT)
  52498 
  52499   char* r;
  52500   smallJsont *self = allocSmallJson();
  52501   char **array     = listCreateS("a","b");
  52502 
  52503   char **d = listCreateS("asd", "zxcv");
  52504   smallJsont *r2 = self->f->setNFreeArrayc(self, "d", d);
  52505   ck_assert_ptr_ne(r2, null);
  52506   r2 = self->f->setArrayc(self, "1", array);
  52507   ck_assert_ptr_ne(r2, null);
  52508   r = keyByArraycSmallJsonG(self, array);
  52509   ck_assert_ptr_ne(r, NULL);
  52510   ck_assert_str_eq(r, "1");
  52511   listFreeS(array);
  52512   terminateO(self);
  52513 
  52514 END_TEST
  52515 
  52516 
  52517 START_TEST(keyByCArraycSmallJsonGT)
  52518 
  52519   char* r;
  52520   smallJsont *self = allocSmallJson();
  52521   char **array     = listCreateS("a","b");
  52522   const char *a[]  = {"a", "b", null};
  52523 
  52524   char **d = listCreateS("asd", "zxcv");
  52525   smallJsont *r2 = self->f->setNFreeArrayc(self, "d", d);
  52526   ck_assert_ptr_ne(r2, null);
  52527   r2 = self->f->setArrayc(self, "1", array);
  52528   ck_assert_ptr_ne(r2, null);
  52529   r = keyByCArraycSmallJsonG(self, a);
  52530   ck_assert_ptr_ne(r, NULL);
  52531   ck_assert_str_eq(r, "1");
  52532   listFreeS(array);
  52533   terminateO(self);
  52534 
  52535 END_TEST
  52536 
  52537 
  52538 START_TEST(keyBySmallBoolSmallJsonGT)
  52539 
  52540   char* r;
  52541   smallJsont *self  = allocSmallJson();
  52542   smallBoolt *value = allocSmallBool(true);
  52543 
  52544   createAllocateSmallBool(d);
  52545   setValO(d, false);
  52546   smallJsont *r2 = self->f->setNFreeSmallBool(self, "d", d);
  52547   ck_assert_ptr_ne(r2, null);
  52548   r2 = self->f->setNFreeSmallBool(self, "1", value);
  52549   ck_assert_ptr_ne(r2, null);
  52550   value = allocSmallBool(true);
  52551   r = keyBySmallBoolSmallJsonG(self, value);
  52552   ck_assert_str_eq(r, "1");
  52553   terminateO(value);
  52554   terminateO(self);
  52555 
  52556 END_TEST
  52557 
  52558 
  52559 START_TEST(keyBySmallBytesSmallJsonGT)
  52560 
  52561   char* r;
  52562   smallJsont *self   = allocSmallJson();
  52563   smallBytest *value = allocSmallBytes("qwe", sizeof("qwe"));
  52564 
  52565   smallBytest *d = allocSmallBytes("asd", sizeof("asd"));
  52566   smallJsont *r2 = self->f->setNFreeSmallBytes(self, "d", d);
  52567   ck_assert_ptr_ne(r2, null);
  52568   r2 = self->f->setNFreeSmallBytes(self, "1", value);
  52569   ck_assert_ptr_ne(r2, null);
  52570   value = allocSmallBytes("qwe", sizeof("qwe"));
  52571   r = keyBySmallBytesSmallJsonG(self, value);
  52572   ck_assert_str_eq(r, "1");
  52573   terminateO(value);
  52574   terminateO(self);
  52575 
  52576 END_TEST
  52577 
  52578 
  52579 START_TEST(keyBySmallDoubleSmallJsonGT)
  52580 
  52581   char* r;
  52582   smallJsont *self    = allocSmallJson();
  52583   smallDoublet *value = allocSmallDouble(2.2);
  52584 
  52585   createAllocateSmallDouble(d);
  52586   smallJsont *r2 = self->f->setNFreeSmallDouble(self, "d", d);
  52587   ck_assert_ptr_ne(r2, null);
  52588   r2 = self->f->setNFreeSmallDouble(self, "1", value);
  52589   ck_assert_ptr_ne(r2, null);
  52590   value = allocSmallDouble(2.2);
  52591   r = keyBySmallDoubleSmallJsonG(self, value);
  52592   ck_assert_str_eq(r, "1");
  52593   terminateO(value);
  52594   terminateO(self);
  52595 
  52596 END_TEST
  52597 
  52598 
  52599 START_TEST(keyBySmallIntSmallJsonGT)
  52600 
  52601   char* r;
  52602   smallJsont *self = allocSmallJson();
  52603   smallIntt *value = allocSmallInt(2);
  52604 
  52605   createAllocateSmallInt(d);
  52606   smallJsont *r2 = self->f->setNFreeSmallInt(self, "d", d);
  52607   ck_assert_ptr_ne(r2, null);
  52608   r2 = self->f->setNFreeSmallInt(self, "1", value);
  52609   ck_assert_ptr_ne(r2, null);
  52610   value = allocSmallInt(2);
  52611   r = keyBySmallIntSmallJsonG(self, value);
  52612   ck_assert_str_eq(r, "1");
  52613   terminateO(value);
  52614   terminateO(self);
  52615 
  52616 END_TEST
  52617 
  52618 
  52619 START_TEST(keyBySmallJsonSmallJsonGT)
  52620 
  52621   char* r;
  52622   smallJsont *self  = allocSmallJson();
  52623   smallJsont *value = allocSmallJson();
  52624 
  52625   createUndefined(u);
  52626   setTopO(value, (baset*)&u);
  52627   self->f->setUndefined(self, "1");
  52628   r = keyBySmallJsonSmallJsonG(self, value);
  52629   ck_assert_str_eq(r, "1");
  52630   terminateO(value);
  52631   terminateO(self);
  52632 
  52633 END_TEST
  52634 
  52635 
  52636 START_TEST(keyBySmallStringSmallJsonGT)
  52637 
  52638   char* r;
  52639   smallJsont *self    = allocSmallJson();
  52640   smallStringt *value = allocSmallString("qwe");
  52641 
  52642   createAllocateSmallString(d);
  52643   smallJsont *r2 = self->f->setNFreeSmallString(self, "d", d);
  52644   ck_assert_ptr_ne(r2, null);
  52645   r2 = self->f->setNFreeSmallString(self, "1", value);
  52646   ck_assert_ptr_ne(r2, null);
  52647   value = allocSmallString("qwe");
  52648   r = keyBySmallStringSmallJsonG(self, value);
  52649   ck_assert_str_eq(r, "1");
  52650   terminateO(value);
  52651   terminateO(self);
  52652 
  52653 END_TEST
  52654 
  52655 
  52656 START_TEST(keyBySmallContainerSmallJsonGT)
  52657 
  52658   char* r;
  52659   smallJsont *self       = allocSmallJson();
  52660   smallContainert *value = allocSmallContainer(null);
  52661 
  52662   createAllocateSmallString(d);
  52663   smallJsont *r2 = self->f->setNFreeSmallString(self, "d", d);
  52664   ck_assert_ptr_ne(r2, null);
  52665   r = keyBySmallContainerSmallJsonG(self, value);
  52666   ck_assert_ptr_eq(r, null);
  52667   terminateO(value);
  52668   terminateO(self);
  52669 
  52670 END_TEST
  52671 
  52672 
  52673 START_TEST(icKeyBySmallJsonGT)
  52674 
  52675   char* r;
  52676   smallJsont *self = allocSmallJson();
  52677   baset *value;
  52678 
  52679   smallJsont *r2 = self->f->setS(self, "1", "QQ");
  52680   ck_assert_ptr_ne(r2, null);
  52681   value = (baset*) allocSmallString("qq");
  52682   r = icKeyBySmallJsonG(self, value);
  52683   ck_assert_str_eq(r, "1");
  52684   terminateO(value);
  52685   terminateO(self);
  52686 
  52687 END_TEST
  52688 
  52689 
  52690 START_TEST(icKeyBySSmallJsonGT)
  52691 
  52692   char* r;
  52693   smallJsont *self = allocSmallJson();
  52694 
  52695   smallJsont *r2 = self->f->setS(self, "1", "qwe");
  52696   ck_assert_ptr_ne(r2, null);
  52697   r = icKeyBySSmallJsonG(self, "QWE");
  52698   ck_assert_str_eq(r, "1");
  52699   terminateO(self);
  52700 
  52701 END_TEST
  52702 
  52703 
  52704 START_TEST(icKeyByCharSmallJsonGT)
  52705 
  52706   char* r;
  52707   smallJsont *self = allocSmallJson();
  52708 
  52709   smallJsont *r2 = self->f->setS(self, "1", "q");
  52710   ck_assert_ptr_ne(r2, null);
  52711   r = icKeyByCharSmallJsonG(self, 'Q');
  52712   ck_assert_str_eq(r, "1");
  52713   terminateO(self);
  52714 
  52715 END_TEST
  52716 
  52717 
  52718 START_TEST(icKeyByDictSmallJsonGT)
  52719 
  52720   char* r;
  52721   smallJsont *self = allocSmallJson();
  52722   smallDictt *dict = allocSmallDict();
  52723 
  52724   createAllocateSmallDict(d);
  52725   d->f->setS(d, "another", "dict");
  52726   smallJsont *r2 = self->f->setNFreeDict(self, "d", d);
  52727   ck_assert_ptr_ne(r2, null);
  52728   dict->f->setS(dict, "asd", "asd");
  52729   r2 = self->f->setNFreeDict(self, "1", dict);
  52730   ck_assert_ptr_ne(r2, null);
  52731   dict = allocSmallDict();
  52732   dict->f->setS(dict, "ASD", "asd");
  52733   r = icKeyByDictSmallJsonG(self, dict);
  52734   ck_assert_str_eq(r, "1");
  52735   terminateO(dict);
  52736   terminateO(self);
  52737 
  52738 END_TEST
  52739 
  52740 
  52741 START_TEST(icKeyByArraySmallJsonGT)
  52742 
  52743   char* r;
  52744   smallJsont *self   = allocSmallJson();
  52745   smallArrayt *array = allocSmallArray();
  52746 
  52747   createAllocateSmallArray(d);
  52748   d->f->pushS(d, "another array");
  52749   smallJsont *r2 = self->f->setNFreeArray(self, "d", d);
  52750   ck_assert_ptr_ne(r2, null);
  52751   array->f->pushS(array, "the array");
  52752   r2 = self->f->setNFreeArray(self, "1", array);
  52753   ck_assert_ptr_ne(r2, null);
  52754   array = allocSmallArray();
  52755   array->f->pushS(array, "The array");
  52756   r = icKeyByArraySmallJsonG(self, array);
  52757   ck_assert_str_eq(r, "1");
  52758   terminateO(array);
  52759   terminateO(self);
  52760 
  52761 END_TEST
  52762 
  52763 
  52764 START_TEST(icKeyByArraycSmallJsonGT)
  52765 
  52766   char* r;
  52767   smallJsont *self = allocSmallJson();
  52768   char **array     = listCreateS("a","b");
  52769 
  52770   char **d = listCreateS("asd", "zxcv");
  52771   smallJsont *r2 = self->f->setNFreeArrayc(self, "d", d);
  52772   ck_assert_ptr_ne(r2, null);
  52773   r2 = self->f->setArrayc(self, "1", array);
  52774   ck_assert_ptr_ne(r2, null);
  52775   iUpperS(&array[0]);
  52776   r = icKeyByArraycSmallJsonG(self, array);
  52777   ck_assert_ptr_ne(r, NULL);
  52778   ck_assert_str_eq(r, "1");
  52779   listFreeS(array);
  52780   terminateO(self);
  52781 
  52782 END_TEST
  52783 
  52784 
  52785 START_TEST(icKeyByCArraycSmallJsonGT)
  52786 
  52787   char* r;
  52788   smallJsont *self = allocSmallJson();
  52789   const char *a2[] = {"a","b",null};
  52790   char **array     = listCreateS("a","b");
  52791 
  52792   char **d = listCreateS("asd", "zxcv");
  52793   smallJsont *r2 = self->f->setNFreeArrayc(self, "d", d);
  52794   ck_assert_ptr_ne(r2, null);
  52795   r2 = self->f->setArrayc(self, "1", array);
  52796   ck_assert_ptr_ne(r2, null);
  52797   iUpperS(&array[0]);
  52798   r = icKeyByCArraycSmallJsonG(self, a2);
  52799   ck_assert_ptr_ne(r, NULL);
  52800   ck_assert_str_eq(r, "1");
  52801   listFreeS(array);
  52802   terminateO(self);
  52803 
  52804 END_TEST
  52805 
  52806 
  52807 START_TEST(icKeyBySmallStringSmallJsonGT)
  52808 
  52809   char* r;
  52810   smallJsont *self    = allocSmallJson();
  52811   smallStringt *value = allocSmallString("qwe");
  52812 
  52813   createAllocateSmallString(d);
  52814   smallJsont *r2 = self->f->setNFreeSmallString(self, "d", d);
  52815   ck_assert_ptr_ne(r2, null);
  52816   r2 = self->f->setNFreeSmallString(self, "1", value);
  52817   ck_assert_ptr_ne(r2, null);
  52818   value = allocSmallString("QWE");
  52819   r = icKeyBySmallStringSmallJsonG(self, value);
  52820   ck_assert_str_eq(r, "1");
  52821   terminateO(value);
  52822   terminateO(self);
  52823 
  52824 END_TEST
  52825 
  52826 
  52827 START_TEST(replaceSmallJsonGT)
  52828 
  52829   smallJsont*  r;
  52830   smallJsont *self = allocG(rtSmallJsont);
  52831   setTopSO(self, "#ee#ee#ad");
  52832 
  52833   // replace string, multiple character new delimeter
  52834   r = replaceSmallJsonG(self, "#","^^", 0);
  52835   ck_assert_ptr_ne(r, null);
  52836   char *s = toStringO(r);
  52837   ck_assert_str_eq(s, "^^ee^^ee^^ad");
  52838   free(s);
  52839   terminateO(self);
  52840 
  52841 END_TEST
  52842 
  52843 
  52844 START_TEST(replaceCharSSmallJsonGT)
  52845 
  52846   smallJsont* r;
  52847   smallJsont *self = allocG(rtSmallJsont);
  52848 
  52849   // replace string, multiple character new delimeter
  52850   setTopSO(self, "#ee#ee#ad");
  52851   r = replaceCharSSmallJsonG(self, '#',"^^", 0);
  52852   ck_assert_ptr_ne(r, null);
  52853   char *s = toStringO(r);
  52854   ck_assert_str_eq(s, "^^ee^^ee^^ad");
  52855   free(s);
  52856   terminateO(self);
  52857 
  52858 END_TEST
  52859 
  52860 
  52861 START_TEST(replaceSCharSmallJsonGT)
  52862 
  52863   smallJsont* r;
  52864   smallJsont *self = allocG(rtSmallJsont);
  52865 
  52866   // replace string, multiple character new delimeter
  52867   setTopSO(self, "#ee#ee#ad");
  52868   r = replaceSCharSmallJsonG(self, "#",'^',0);
  52869   ck_assert_ptr_ne(r, null);
  52870   char *s = toStringO(r);
  52871   ck_assert_str_eq(s, "^ee^ee^ad");
  52872   free(s);
  52873   terminateO(self);
  52874 
  52875 END_TEST
  52876 
  52877 
  52878 START_TEST(replaceCharCharSmallJsonGT)
  52879 
  52880   smallJsont* r;
  52881   smallJsont *self = allocG(rtSmallJsont);
  52882 
  52883   // replace string, multiple character new delimeter
  52884   setTopSO(self, "#ee#ee#ad");
  52885   r = replaceCharCharSmallJsonG(self, '#','^', 0);
  52886   ck_assert_ptr_ne(r, null);
  52887   char *s = toStringO(r);
  52888   ck_assert_str_eq(s, "^ee^ee^ad");
  52889   free(s);
  52890   terminateO(self);
  52891 
  52892 END_TEST
  52893 
  52894 
  52895 START_TEST(replaceSmallStringSmallStringSmallJsonGT)
  52896 
  52897   smallJsont* r;
  52898   smallJsont *self = allocG(rtSmallJsont);
  52899   setTopSO(self, "#ee#ee#ad");
  52900   smallStringt *olds = allocSmallString("");
  52901   smallStringt *news = allocSmallString("");
  52902 
  52903   setValO(olds, "#");
  52904   setValO(news, "^^");
  52905   r = replaceSmallStringSmallStringSmallJsonG(self, olds, news, 0);
  52906   ck_assert_ptr_ne(r, null);
  52907   char *s = toStringO(r);
  52908   ck_assert_str_eq(s, "^^ee^^ee^^ad");
  52909   free(s);
  52910   terminateO(olds);
  52911   terminateO(news);
  52912   terminateO(self);
  52913 
  52914 END_TEST
  52915 
  52916 
  52917 START_TEST(replaceSmallStringSSmallJsonGT)
  52918 
  52919   smallJsont* r;
  52920   smallJsont *self = allocG(rtSmallJsont);
  52921   setTopSO(self, "#ee#ee#ad");
  52922   smallStringt *olds = allocSmallString("");
  52923   const char *news;
  52924 
  52925   // replace string, multiple character new delimeter
  52926   setValO(olds, "#");
  52927   news = "^^";
  52928   r = replaceSmallStringSSmallJsonG(self, olds, news, 0);
  52929   ck_assert_ptr_ne(r, null);
  52930   char *s = toStringO(r);
  52931   ck_assert_str_eq(s, "^^ee^^ee^^ad");
  52932   free(s);
  52933   terminateO(olds);
  52934   terminateO(self);
  52935 
  52936 END_TEST
  52937 
  52938 
  52939 START_TEST(replaceSmallStringCharSmallJsonGT)
  52940 
  52941   smallJsont* r;
  52942   smallJsont *self = allocG(rtSmallJsont);
  52943   setTopSO(self, "#ee#ee#ad");
  52944   smallStringt *olds = allocSmallString("");
  52945   char news;
  52946 
  52947   // replace string, multiple character new delimeter
  52948   setValO(olds, "#");
  52949   news = '^';
  52950   r = replaceSmallStringCharSmallJsonG(self, olds, news, 0);
  52951   ck_assert_ptr_ne(r, null);
  52952   char *s = toStringO(r);
  52953   ck_assert_str_eq(s, "^ee^ee^ad");
  52954   free(s);
  52955   terminateO(olds);
  52956   terminateO(self);
  52957 
  52958 END_TEST
  52959 
  52960 
  52961 START_TEST(replaceSSmallStringSmallJsonGT)
  52962 
  52963   smallJsont* r;
  52964   smallJsont *self = allocG(rtSmallJsont);
  52965   setTopSO(self, "#ee#ee#ad");
  52966   const char *olds;
  52967   smallStringt *news = allocSmallString("");
  52968 
  52969   // replace string, multiple character new delimeter
  52970   olds = "#";
  52971   setValO(news, "^^");
  52972   r = replaceSSmallStringSmallJsonG(self, olds, news, 0);
  52973   ck_assert_ptr_ne(r, null);
  52974   char *s = toStringO(r);
  52975   ck_assert_str_eq(s, "^^ee^^ee^^ad");
  52976   free(s);
  52977   terminateO(news);
  52978   terminateO(self);
  52979 
  52980 END_TEST
  52981 
  52982 
  52983 START_TEST(replaceCharSmallStringSmallJsonGT)
  52984 
  52985   smallJsont* r;
  52986   smallJsont *self = allocG(rtSmallJsont);
  52987   setTopSO(self, "#ee#ee#ad");
  52988   char olds;
  52989   smallStringt *news = allocSmallString("");
  52990 
  52991   // replace string, multiple character new delimeter
  52992   olds = '#';
  52993   setValO(news, "^^");
  52994   r = replaceCharSmallStringSmallJsonG(self, olds, news, 0);
  52995   ck_assert_ptr_ne(r, null);
  52996   char *s = toStringO(r);
  52997   ck_assert_str_eq(s, "^^ee^^ee^^ad");
  52998   free(s);
  52999   terminateO(news);
  53000   terminateO(self);
  53001 
  53002 END_TEST
  53003 
  53004 
  53005 START_TEST(replaceJsonJsonSmallJsonGT)
  53006 
  53007   smallJsont* r;
  53008   smallJsont *self = allocG(rtSmallJsont);
  53009   setTopSO(self, "#ee#ee#ad");
  53010   smallJsont *olds = allocSmallJson();
  53011   smallJsont *news = allocSmallJson();
  53012 
  53013   // replace string, multiple character new delimeter
  53014   setTopSO(olds, "#");
  53015   setTopSO(news, "^^");
  53016   r = replaceJsonJsonSmallJsonG(self, olds, news, 0);
  53017   ck_assert_ptr_ne(r, null);
  53018   char *s = toStringO(r);
  53019   ck_assert_str_eq(s, "^^ee^^ee^^ad");
  53020   free(s);
  53021   terminateO(olds);
  53022   terminateO(news);
  53023   terminateO(self);
  53024 
  53025 END_TEST
  53026 
  53027 
  53028 START_TEST(replaceJsonSmallStringSmallJsonGT)
  53029 
  53030   smallJsont* r;
  53031   smallJsont *self = allocG(rtSmallJsont);
  53032   setTopSO(self, "#ee#ee#ad");
  53033   smallJsont *olds   = allocSmallJson();
  53034   smallStringt *news = allocSmallString("");
  53035 
  53036   // replace string, multiple character new delimeter
  53037   freeO(olds);
  53038   setTopSO(olds, "#");
  53039   setValO(news, "^^");
  53040   r = replaceJsonSmallStringSmallJsonG(self, olds, news, 0);
  53041   ck_assert_ptr_ne(r, null);
  53042   char *s = toStringO(r);
  53043   ck_assert_str_eq(s, "^^ee^^ee^^ad");
  53044   free(s);
  53045   terminateO(olds);
  53046   terminateO(news);
  53047   terminateO(self);
  53048 
  53049 END_TEST
  53050 
  53051 
  53052 START_TEST(replaceJsonSSmallJsonGT)
  53053 
  53054   smallJsont* r;
  53055   smallJsont *self = allocG(rtSmallJsont);
  53056   setTopSO(self, "#ee#ee#ad");
  53057   smallJsont *olds   = allocSmallJson();
  53058   const char *news;
  53059 
  53060   // replace string, multiple character new delimeter
  53061   freeO(olds);
  53062   setTopSO(olds, "#");
  53063   news = "^^";
  53064   r = replaceJsonSSmallJsonG(self, olds, news, 0);
  53065   ck_assert_ptr_ne(r, null);
  53066   char *s = toStringO(r);
  53067   ck_assert_str_eq(s, "^^ee^^ee^^ad");
  53068   free(s);
  53069   terminateO(olds);
  53070   terminateO(self);
  53071 
  53072 END_TEST
  53073 
  53074 
  53075 START_TEST(replaceJsonCharSmallJsonGT)
  53076 
  53077   smallJsont* r;
  53078   smallJsont *self = allocG(rtSmallJsont);
  53079   setTopSO(self, "#ee#ee#ad");
  53080   smallJsont *olds = allocSmallJson();
  53081   char news;
  53082 
  53083   // replace string, multiple character new delimeter
  53084   freeO(olds);
  53085   setTopSO(olds, "#");
  53086   news = '^';
  53087   r = replaceJsonCharSmallJsonG(self, olds, news, 0);
  53088   ck_assert_ptr_ne(r, null);
  53089   char *s = toStringO(r);
  53090   ck_assert_str_eq(s, "^ee^ee^ad");
  53091   free(s);
  53092   terminateO(olds);
  53093   terminateO(self);
  53094 
  53095 END_TEST
  53096 
  53097 
  53098 START_TEST(replaceSmallStringJsonSmallJsonGT)
  53099 
  53100   smallJsont* r;
  53101   smallJsont *self = allocG(rtSmallJsont);
  53102   setTopSO(self, "#ee#ee#ad");
  53103   smallStringt *olds = allocSmallString("");
  53104   smallJsont *news   = allocSmallJson();
  53105 
  53106   // replace string, multiple character new delimeter
  53107   setValO(olds, "#");
  53108   setTopSO(news, "^^");
  53109   r = replaceSmallStringJsonSmallJsonG(self, olds, news, 0);
  53110   ck_assert_ptr_ne(r, null);
  53111   char *s = toStringO(r);
  53112   ck_assert_str_eq(s, "^^ee^^ee^^ad");
  53113   free(s);
  53114   terminateO(olds);
  53115   terminateO(news);
  53116   terminateO(self);
  53117 
  53118 END_TEST
  53119 
  53120 
  53121 START_TEST(replaceSJsonSmallJsonGT)
  53122 
  53123   smallJsont* r;
  53124   smallJsont *self = allocG(rtSmallJsont);
  53125   setTopSO(self, "#ee#ee#ad");
  53126   const char *olds;
  53127   smallJsont *news = allocSmallJson();
  53128 
  53129   // replace string, multiple character new delimeter
  53130   olds = "#";
  53131   setTopSO(news, "^^");
  53132   r = replaceSJsonSmallJsonG(self, olds, news, 0);
  53133   ck_assert_ptr_ne(r, null);
  53134   char *s = toStringO(r);
  53135   ck_assert_str_eq(s, "^^ee^^ee^^ad");
  53136   free(s);
  53137   terminateO(news);
  53138   terminateO(self);
  53139 
  53140 END_TEST
  53141 
  53142 
  53143 START_TEST(replaceCharJsonSmallJsonGT)
  53144 
  53145   smallJsont* r;
  53146   smallJsont *self = allocG(rtSmallJsont);
  53147   setTopSO(self, "#ee#ee#ad");
  53148   char olds;
  53149   smallJsont *news = allocSmallJson();
  53150 
  53151   // replace string, multiple character new delimeter
  53152   olds = '#';
  53153   setTopSO(news, "^^");
  53154   r = replaceCharJsonSmallJsonG(self, olds, news, 0);
  53155   ck_assert_ptr_ne(r, null);
  53156   char *s = toStringO(r);
  53157   ck_assert_str_eq(s, "^^ee^^ee^^ad");
  53158   free(s);
  53159   terminateO(news);
  53160   terminateO(self);
  53161 
  53162 END_TEST
  53163 
  53164 
  53165 START_TEST(icReplaceSmallJsonGT)
  53166 
  53167   smallJsont*  r;
  53168   smallJsont *self = allocG(rtSmallJsont);
  53169   setTopSO(self, "BeebeeBad");
  53170 
  53171   // replace string, multiple character new delimeter
  53172   r = icReplaceSmallJsonG(self, "b","^^", 0);
  53173   ck_assert_ptr_ne(r, null);
  53174   char *s = toStringO(r);
  53175   ck_assert_str_eq(s, "^^ee^^ee^^ad");
  53176   free(s);
  53177   terminateO(self);
  53178 
  53179 END_TEST
  53180 
  53181 
  53182 START_TEST(icReplaceCharSSmallJsonGT)
  53183 
  53184   smallJsont* r;
  53185   smallJsont *self = allocG(rtSmallJsont);
  53186   setTopSO(self, "");
  53187 
  53188   // replace string, multiple character new delimeter
  53189   freeO(self);
  53190   setTopSO(self, "BeebeeBad");
  53191   r = icReplaceCharSSmallJsonG(self, 'B',"^^", 0);
  53192   ck_assert_ptr_ne(r, null);
  53193   char *s = toStringO(r);
  53194   ck_assert_str_eq(s, "^^ee^^ee^^ad");
  53195   free(s);
  53196   terminateO(self);
  53197 
  53198 END_TEST
  53199 
  53200 
  53201 START_TEST(icReplaceSCharSmallJsonGT)
  53202 
  53203   smallJsont* r;
  53204   smallJsont *self = allocG(rtSmallJsont);
  53205   setTopSO(self, "");
  53206 
  53207   // replace string, multiple character new delimeter
  53208   freeO(self);
  53209   setTopSO(self, "BeebeeBad");
  53210   r = icReplaceSCharSmallJsonG(self, "b",'^',0);
  53211   ck_assert_ptr_ne(r, null);
  53212   char *s = toStringO(r);
  53213   ck_assert_str_eq(s, "^ee^ee^ad");
  53214   free(s);
  53215   terminateO(self);
  53216 
  53217 END_TEST
  53218 
  53219 
  53220 START_TEST(icReplaceCharCharSmallJsonGT)
  53221 
  53222   smallJsont* r;
  53223   smallJsont *self = allocG(rtSmallJsont);
  53224   setTopSO(self, "");
  53225 
  53226   // replace string, multiple character new delimeter
  53227   freeO(self);
  53228   setTopSO(self, "beeBeebad");
  53229   r = icReplaceCharCharSmallJsonG(self, 'b','^', 0);
  53230   ck_assert_ptr_ne(r, null);
  53231   char *s = toStringO(r);
  53232   ck_assert_str_eq(s, "^ee^ee^ad");
  53233   free(s);
  53234   terminateO(self);
  53235 
  53236 END_TEST
  53237 
  53238 
  53239 START_TEST(icReplaceSmallStringSmallStringSmallJsonGT)
  53240 
  53241   smallJsont* r;
  53242   smallJsont *self = allocG(rtSmallJsont);
  53243   setTopSO(self, "beebeebad");
  53244   smallStringt *olds = allocSmallString("");
  53245   smallStringt *news = allocSmallString("");
  53246 
  53247   // replace string, multiple character new delimeter
  53248   setValO(olds, "B");
  53249   setValO(news, "^^");
  53250   r = icReplaceSmallStringSmallStringSmallJsonG(self, olds, news, 0);
  53251   ck_assert_ptr_ne(r, null);
  53252   char *s = toStringO(r);
  53253   ck_assert_str_eq(s, "^^ee^^ee^^ad");
  53254   free(s);
  53255   terminateO(olds);
  53256   terminateO(news);
  53257   terminateO(self);
  53258 
  53259 END_TEST
  53260 
  53261 
  53262 START_TEST(icReplaceSmallStringSSmallJsonGT)
  53263 
  53264   smallJsont* r;
  53265   smallJsont *self = allocG(rtSmallJsont);
  53266   setTopSO(self, "beebeebad");
  53267   smallStringt *olds = allocSmallString("");
  53268   const char *news;
  53269 
  53270   // replace string, multiple character new delimeter
  53271   setValO(olds, "B");
  53272   news = "^^";
  53273   r = icReplaceSmallStringSSmallJsonG(self, olds, news, 0);
  53274   ck_assert_ptr_ne(r, null);
  53275   char *s = toStringO(r);
  53276   ck_assert_str_eq(s, "^^ee^^ee^^ad");
  53277   free(s);
  53278   terminateO(olds);
  53279   terminateO(self);
  53280 
  53281 END_TEST
  53282 
  53283 
  53284 START_TEST(icReplaceSmallStringCharSmallJsonGT)
  53285 
  53286   smallJsont* r;
  53287   smallJsont *self = allocG(rtSmallJsont);
  53288   setTopSO(self, "beebeebad");
  53289   smallStringt *olds = allocSmallString("");
  53290   char news;
  53291 
  53292   // replace string, multiple character new delimeter
  53293   setValO(olds, "B");
  53294   news = '^';
  53295   r = icReplaceSmallStringCharSmallJsonG(self, olds, news, 0);
  53296   ck_assert_ptr_ne(r, null);
  53297   char *s = toStringO(r);
  53298   ck_assert_str_eq(s, "^ee^ee^ad");
  53299   free(s);
  53300   terminateO(olds);
  53301   terminateO(self);
  53302 
  53303 END_TEST
  53304 
  53305 
  53306 START_TEST(icReplaceSSmallStringSmallJsonGT)
  53307 
  53308   smallJsont* r;
  53309   smallJsont *self = allocG(rtSmallJsont);
  53310   setTopSO(self, "beebeebad");
  53311   const char *olds;
  53312   smallStringt *news = allocSmallString("");
  53313 
  53314   // replace string, multiple character new delimeter
  53315   olds = "B";
  53316   setValO(news, "^^");
  53317   r = icReplaceSSmallStringSmallJsonG(self, olds, news, 0);
  53318   ck_assert_ptr_ne(r, null);
  53319   char *s = toStringO(r);
  53320   ck_assert_str_eq(s, "^^ee^^ee^^ad");
  53321   free(s);
  53322   terminateO(news);
  53323   terminateO(self);
  53324 
  53325 END_TEST
  53326 
  53327 
  53328 START_TEST(icReplaceCharSmallStringSmallJsonGT)
  53329 
  53330   smallJsont* r;
  53331   smallJsont *self = allocG(rtSmallJsont);
  53332   setTopSO(self, "beebeebad");
  53333   char olds;
  53334   smallStringt *news = allocSmallString("");
  53335 
  53336   // replace string, multiple character new delimeter
  53337   olds = 'B';
  53338   setValO(news, "^^");
  53339   r = icReplaceCharSmallStringSmallJsonG(self, olds, news, 0);
  53340   ck_assert_ptr_ne(r, null);
  53341   char *s = toStringO(r);
  53342   ck_assert_str_eq(s, "^^ee^^ee^^ad");
  53343   free(s);
  53344   terminateO(news);
  53345   terminateO(self);
  53346 
  53347 END_TEST
  53348 
  53349 
  53350 START_TEST(icReplaceJsonJsonSmallJsonGT)
  53351 
  53352   smallJsont* r;
  53353   smallJsont *self = allocG(rtSmallJsont);
  53354   setTopSO(self, "BeebeeBad");
  53355   smallJsont *olds = allocSmallJson();
  53356   smallJsont *news = allocSmallJson();
  53357 
  53358   // replace string, multiple character new delimeter
  53359   freeO(olds);
  53360   freeO(news);
  53361   setTopSO(olds, "B");
  53362   setTopSO(news, "^^");
  53363   r = icReplaceJsonJsonSmallJsonG(self, olds, news, 0);
  53364   ck_assert_ptr_ne(r, null);
  53365   char *s = toStringO(r);
  53366   ck_assert_str_eq(s, "^^ee^^ee^^ad");
  53367   free(s);
  53368   terminateO(olds);
  53369   terminateO(news);
  53370   terminateO(self);
  53371 
  53372 END_TEST
  53373 
  53374 
  53375 START_TEST(icReplaceJsonSmallStringSmallJsonGT)
  53376 
  53377   smallJsont* r;
  53378   smallJsont *self = allocG(rtSmallJsont);
  53379   setTopSO(self, "BeebeeBad");
  53380   smallJsont *olds   = allocSmallJson();
  53381   smallStringt *news = allocSmallString("");
  53382 
  53383   // replace string, multiple character new delimeter
  53384   freeO(olds);
  53385   setTopSO(olds, "B");
  53386   setValO(news, "^^");
  53387   r = icReplaceJsonSmallStringSmallJsonG(self, olds, news, 0);
  53388   ck_assert_ptr_ne(r, null);
  53389   char *s = toStringO(r);
  53390   ck_assert_str_eq(s, "^^ee^^ee^^ad");
  53391   free(s);
  53392   terminateO(olds);
  53393   terminateO(news);
  53394   terminateO(self);
  53395 
  53396 END_TEST
  53397 
  53398 
  53399 START_TEST(icReplaceJsonSSmallJsonGT)
  53400 
  53401   smallJsont* r;
  53402   smallJsont *self = allocG(rtSmallJsont);
  53403   setTopSO(self, "BeebeeBad");
  53404   smallJsont *olds   = allocSmallJson();
  53405   const char *news;
  53406 
  53407   // replace string, multiple character new delimeter
  53408   freeO(olds);
  53409   setTopSO(olds, "b");
  53410   news = "^^";
  53411   r = icReplaceJsonSSmallJsonG(self, olds, news, 0);
  53412   ck_assert_ptr_ne(r, null);
  53413   char *s = toStringO(r);
  53414   ck_assert_str_eq(s, "^^ee^^ee^^ad");
  53415   free(s);
  53416   terminateO(olds);
  53417   terminateO(self);
  53418 
  53419 END_TEST
  53420 
  53421 
  53422 START_TEST(icReplaceJsonCharSmallJsonGT)
  53423 
  53424   smallJsont* r;
  53425   smallJsont *self = allocG(rtSmallJsont);
  53426   setTopSO(self, "beeBeebad");
  53427   smallJsont *olds   = allocSmallJson();
  53428   char news;
  53429 
  53430   // replace string, multiple character new delimeter
  53431   freeO(olds);
  53432   setTopSO(olds, "B");
  53433   news = '^';
  53434   r = icReplaceJsonCharSmallJsonG(self, olds, news, 0);
  53435   ck_assert_ptr_ne(r, null);
  53436   char *s = toStringO(r);
  53437   ck_assert_str_eq(s, "^ee^ee^ad");
  53438   free(s);
  53439   terminateO(olds);
  53440   terminateO(self);
  53441 
  53442 END_TEST
  53443 
  53444 
  53445 START_TEST(icReplaceSmallStringJsonSmallJsonGT)
  53446 
  53447   smallJsont* r;
  53448   smallJsont *self = allocG(rtSmallJsont);
  53449   setTopSO(self, "BeeBeeBad");
  53450   smallStringt *olds = allocSmallString("");
  53451   smallJsont *news   = allocSmallJson();
  53452 
  53453   // replace string, multiple character new delimeter
  53454   freeO(news);
  53455   setValO(olds, "b");
  53456   setTopSO(news, "^^");
  53457   r = icReplaceSmallStringJsonSmallJsonG(self, olds, news, 0);
  53458   ck_assert_ptr_ne(r, null);
  53459   char *s = toStringO(r);
  53460   ck_assert_str_eq(s, "^^ee^^ee^^ad");
  53461   free(s);
  53462   terminateO(olds);
  53463   terminateO(news);
  53464   terminateO(self);
  53465 
  53466 END_TEST
  53467 
  53468 
  53469 START_TEST(icReplaceSJsonSmallJsonGT)
  53470 
  53471   smallJsont* r;
  53472   smallJsont *self = allocG(rtSmallJsont);
  53473   setTopSO(self, "beebeebad");
  53474   const char *olds;
  53475   smallJsont *news   = allocSmallJson();
  53476 
  53477   // replace string, multiple character new delimeter
  53478   freeO(news);
  53479   olds = "B";
  53480   setTopSO(news, "^^");
  53481   r = icReplaceSJsonSmallJsonG(self, olds, news, 0);
  53482   ck_assert_ptr_ne(r, null);
  53483   char *s = toStringO(r);
  53484   ck_assert_str_eq(s, "^^ee^^ee^^ad");
  53485   free(s);
  53486   terminateO(news);
  53487   terminateO(self);
  53488 
  53489 END_TEST
  53490 
  53491 
  53492 START_TEST(icReplaceCharJsonSmallJsonGT)
  53493 
  53494   smallJsont* r;
  53495   smallJsont *self = allocG(rtSmallJsont);
  53496   setTopSO(self, "beebeebad");
  53497   char olds;
  53498   smallJsont *news   = allocSmallJson();
  53499 
  53500   // replace string, multiple character new delimeter
  53501   freeO(news);
  53502   olds = 'B';
  53503   setTopSO(news, "^^");
  53504   r = icReplaceCharJsonSmallJsonG(self, olds, news, 0);
  53505   ck_assert_ptr_ne(r, null);
  53506   char *s = toStringO(r);
  53507   ck_assert_str_eq(s, "^^ee^^ee^^ad");
  53508   free(s);
  53509   terminateO(news);
  53510   terminateO(self);
  53511 
  53512 END_TEST
  53513 
  53514 
  53515 START_TEST(equalSmallJsonSmallArrayGT)
  53516 
  53517   bool r;
  53518   smallJsont *self   = allocG(rtSmallJsont);
  53519   smallArrayt *array = allocSmallArray();
  53520 
  53521   // empty arrays
  53522   setTypeArrayO(self);
  53523   r = equalSmallJsonSmallArrayG(self, array);
  53524   ck_assert(r);
  53525   // empty self, non empty array
  53526   array->f->pushInt(array, 1);
  53527   r = equalSmallJsonSmallArrayG(self, array);
  53528   ck_assert(!r);
  53529   terminateO(array);
  53530   terminateO(self);
  53531 
  53532 END_TEST
  53533 
  53534 
  53535 START_TEST(equalSmallJsonArrayGT)
  53536 
  53537   bool r;
  53538   smallJsont *self = allocG(rtSmallJsont);
  53539   char ** p2       = NULL;
  53540 
  53541   // empty arrays
  53542   setTypeArrayO(self);
  53543   r = equalSmallJsonArrayG(self, NULL);
  53544   ck_assert(r);
  53545   // empty self, non empty array
  53546   p2 = listCreateS("a");
  53547   r = equalSmallJsonArrayG(self, p2);
  53548   ck_assert(!r);
  53549   listFreeS(p2);
  53550   terminateO(self);
  53551 
  53552 END_TEST
  53553 
  53554 
  53555 START_TEST(equalSmallJsonCArrayGT)
  53556 
  53557   bool r;
  53558   smallJsont *self = allocG(rtSmallJsont);
  53559   const char *p2[] = {"a", null};
  53560 
  53561   self->f->pushS(self, "a");
  53562   r = equalSmallJsonCArrayG(self, p2);
  53563   ck_assert(r);
  53564   terminateO(self);
  53565 
  53566 END_TEST
  53567 
  53568 
  53569 START_TEST(equalSmallJsonBaseGT)
  53570 
  53571   bool r;
  53572   smallJsont *self = allocG(rtSmallJsont);
  53573   baset* p2;
  53574 
  53575   // json bool
  53576   setTopBoolO(self, false);
  53577   p2 = (baset*) allocSmallBool(false);
  53578   r = equalSmallJsonBaseG(self, p2);
  53579   ck_assert(r);
  53580   freeO(self);
  53581   setTopBoolO(self, true);
  53582   r = equalSmallJsonBaseG(self, p2);
  53583   ck_assert(!r);
  53584   terminateO(p2);
  53585   terminateO(self);
  53586 
  53587 END_TEST
  53588 
  53589 
  53590 START_TEST(equalSmallJsonChaGT)
  53591 
  53592   bool r;
  53593   smallJsont* self = allocG(rtSmallJsont);
  53594   setTopSO(self, "");
  53595 
  53596   r = equalSmallJsonChaG(self,'q');
  53597   ck_assert(!r);
  53598   freeO(self);
  53599   setTopSO(self, "q");
  53600   r = equalSmallJsonChaG(self,'q');
  53601   ck_assert(r);
  53602   terminateO(self);
  53603 
  53604 END_TEST
  53605 
  53606 
  53607 START_TEST(equalSmallJsonCharGT)
  53608 
  53609   bool r;
  53610   smallJsont* self = allocG(rtSmallJsont);
  53611   setTopSO(self, "");
  53612 
  53613   r = equalSmallJsonCharG(self,"qwe");
  53614   ck_assert(!r);
  53615   freeO(self);
  53616   setTopSO(self, "qwe");
  53617   r = equalSmallJsonCharG(self,"qwe");
  53618   ck_assert(r);
  53619   terminateO(self);
  53620 
  53621 END_TEST
  53622 
  53623 
  53624 START_TEST(equalSmallJsonBoolGT)
  53625 
  53626   bool r;
  53627   smallJsont* self = allocG(rtSmallJsont);
  53628 
  53629   // empty json
  53630   r = equalSmallJsonBoolG(self, false);
  53631   ck_assert(!r);
  53632   // json bool
  53633   freeO(self);
  53634   setTypeBoolO(self);
  53635   r = equalSmallJsonBoolG(self, false);
  53636   ck_assert(r);
  53637   terminateO(self);
  53638 
  53639 END_TEST
  53640 
  53641 
  53642 START_TEST(equalSmallJsonDoubleGT)
  53643 
  53644   bool r;
  53645   smallJsont* self = allocG(rtSmallJsont);
  53646 
  53647   // empty json
  53648   r = equalSmallJsonDoubleG(self, 0);
  53649   ck_assert(!r);
  53650   // json bool
  53651   freeO(self);
  53652   setTypeBoolO(self);
  53653   r = equalSmallJsonDoubleG(self, 0);
  53654   ck_assert(r);
  53655   terminateO(self);
  53656 
  53657 END_TEST
  53658 
  53659 
  53660 START_TEST(equalSmallJsonInt64GT)
  53661 
  53662   bool r;
  53663   smallJsont* self = allocG(rtSmallJsont);
  53664 
  53665   // empty json
  53666   r = equalSmallJsonInt64G(self, 0);
  53667   ck_assert(!r);
  53668   // json bool
  53669   freeO(self);
  53670   setTypeBoolO(self);
  53671   r = equalSmallJsonInt64G(self, 0);
  53672   ck_assert(r);
  53673   terminateO(self);
  53674 
  53675 END_TEST
  53676 
  53677 
  53678 START_TEST(equalSmallJsonInt32GT)
  53679 
  53680   bool r;
  53681   smallJsont* self = allocG(rtSmallJsont);
  53682 
  53683   // empty json
  53684   r = equalSmallJsonInt32G(self, 0);
  53685   ck_assert(!r);
  53686   // json bool
  53687   freeO(self);
  53688   setTypeBoolO(self);
  53689   r = equalSmallJsonInt32G(self, 0);
  53690   ck_assert(r);
  53691   terminateO(self);
  53692 
  53693 END_TEST
  53694 
  53695 
  53696 START_TEST(equalSmallJsonUint32GT)
  53697 
  53698   bool r;
  53699   smallJsont* self = allocG(rtSmallJsont);
  53700 
  53701   // empty json
  53702   r = equalSmallJsonUint32G(self, 0);
  53703   ck_assert(!r);
  53704   // json bool
  53705   freeO(self);
  53706   setTypeBoolO(self);
  53707   r = equalSmallJsonUint32G(self, 0);
  53708   ck_assert(r);
  53709   terminateO(self);
  53710 
  53711 END_TEST
  53712 
  53713 
  53714 START_TEST(equalSmallJsonUint64GT)
  53715 
  53716   bool r;
  53717   smallJsont* self = allocG(rtSmallJsont);
  53718 
  53719   // empty json
  53720   r = equalSmallJsonUint64G(self, 0);
  53721   ck_assert(!r);
  53722   // json bool
  53723   freeO(self);
  53724   setTypeBoolO(self);
  53725   r = equalSmallJsonUint64G(self, 0);
  53726   ck_assert(r);
  53727   terminateO(self);
  53728 
  53729 END_TEST
  53730 
  53731 
  53732 START_TEST(equalSmallJsonSmallBoolGT)
  53733 
  53734   bool r;
  53735   smallJsont* self = allocG(rtSmallJsont);
  53736   smallBoolt* p2   = allocSmallBool(false);
  53737 
  53738   // empty json
  53739   r = equalSmallJsonSmallBoolG(self, p2);
  53740   ck_assert(!r);
  53741   // not equal
  53742   setTopBoolO(self, true);
  53743   r = equalSmallJsonSmallBoolG(self, p2);
  53744   ck_assert(!r);
  53745   // equal
  53746   setValO(p2, true);
  53747   r = equalSmallJsonSmallBoolG(self, p2);
  53748   ck_assert(r);
  53749   terminateO(p2);
  53750   terminateO(self);
  53751 
  53752 END_TEST
  53753 
  53754 
  53755 START_TEST(equalSmallJsonSmallBytesGT)
  53756 
  53757   smallJsont* self = allocG(rtSmallJsont);
  53758   smallBytest* p2  = allocSmallBytes("true", strlen("true"));
  53759 
  53760   // empty json
  53761   ck_assert(!equalSmallJsonSmallBytesG(self, p2));
  53762   // json bool
  53763   setTopBoolO(self, true);
  53764   ck_assert(!equalSmallJsonSmallBytesG(self, p2));
  53765   freeO(p2);
  53766   pushBufferO(p2, "true", sizeof("true"));
  53767   ck_assert(equalSmallJsonSmallBytesG(self, p2));
  53768   freeO(self);
  53769   terminateO(p2);
  53770   terminateO(self);
  53771 
  53772 END_TEST
  53773 
  53774 
  53775 START_TEST(equalSmallJsonSmallDoubleGT)
  53776 
  53777   bool r;
  53778   smallJsont* self = allocG(rtSmallJsont);
  53779   smallDoublet* p2 = allocSmallDouble(0);
  53780 
  53781   // empty json
  53782   r = equalSmallJsonSmallDoubleG(self, p2);
  53783   ck_assert(!r);
  53784   // json bool
  53785   freeO(self);
  53786   setTypeBoolO(self);
  53787   r = equalSmallJsonSmallDoubleG(self, p2);
  53788   ck_assert(r);
  53789   terminateO(p2);
  53790   terminateO(self);
  53791 
  53792 END_TEST
  53793 
  53794 
  53795 START_TEST(equalSmallJsonSmallIntGT)
  53796 
  53797   bool r;
  53798   smallJsont* self = allocG(rtSmallJsont);
  53799   smallIntt* p2    = allocSmallInt(0);
  53800 
  53801   // empty json
  53802   r = equalSmallJsonSmallIntG(self, p2);
  53803   ck_assert(!r);
  53804   // json bool
  53805   freeO(self);
  53806   setTypeBoolO(self);
  53807   r = equalSmallJsonSmallIntG(self, p2);
  53808   ck_assert(r);
  53809   terminateO(p2);
  53810   terminateO(self);
  53811 
  53812 END_TEST
  53813 
  53814 
  53815 START_TEST(equalSmallJsonSmallJsonGT)
  53816 
  53817   bool r;
  53818   smallJsont* self = allocG(rtSmallJsont);
  53819   smallJsont* p2   = allocSmallJson();
  53820 
  53821   // empty json
  53822   r = equalSmallJsonSmallJsonG(self, p2);
  53823   ck_assert(!r);
  53824   // undefined
  53825   setTypeUndefinedO(p2);
  53826   ck_assert(!equalSmallJsonSmallJsonG(self, p2));
  53827   setTypeUndefinedO(self);
  53828   ck_assert(equalSmallJsonSmallJsonG(self, p2));
  53829   terminateO(p2);
  53830   terminateO(self);
  53831 
  53832 END_TEST
  53833 
  53834 
  53835 START_TEST(equalSmallJsonSmallStringGT)
  53836 
  53837   bool r;
  53838   smallJsont* self = allocG(rtSmallJsont);
  53839   smallStringt* p2 = allocSmallString("");
  53840 
  53841   // empty json
  53842   r = equalSmallJsonSmallStringG(self, p2);
  53843   ck_assert(!r);
  53844   // json bool
  53845   setTypeBoolO(self);
  53846   setValO(p2, "false");
  53847   r = equalSmallJsonSmallStringG(self, p2);
  53848   ck_assert(r);
  53849   setValO(p2, "true");
  53850   r = equalSmallJsonSmallStringG(self, p2);
  53851   ck_assert(!r);
  53852   terminateO(p2);
  53853   terminateO(self);
  53854 
  53855 END_TEST
  53856 
  53857 
  53858 START_TEST(equalSmallJsonSmallDictGT)
  53859 
  53860   bool r;
  53861   smallJsont* self = allocG(rtSmallJsont);
  53862   smallDictt* p2   = allocSmallDict();
  53863 
  53864   // empty json
  53865   r = equalSmallJsonSmallDictG(self, p2);
  53866   ck_assert(!r);
  53867   setTypeDictO(self);
  53868   r = equalSmallJsonSmallDictG(self, p2);
  53869   ck_assert(!r);
  53870   // equal
  53871   self->f->setInt(self, "a", 1);
  53872   self->f->setInt(self, "b", 2);
  53873   self->f->setInt(self, "c", 3);
  53874   p2->f->setInt(p2, "b", 2);
  53875   p2->f->setInt(p2, "a", 1);
  53876   p2->f->setInt(p2, "c", 3);
  53877   r = equalSmallJsonSmallDictG(self, p2);
  53878   ck_assert(r);
  53879   terminateO(p2);
  53880   terminateO(self);
  53881 
  53882 END_TEST
  53883 
  53884 
  53885 START_TEST(icEqualSmallJsonSmallArrayGT)
  53886 
  53887   bool r;
  53888   smallJsont *self   = allocG(rtSmallJsont);
  53889   smallArrayt *array = allocSmallArray();
  53890 
  53891   self->f->pushS(self, "a");
  53892   array->f->pushS(array, "A");
  53893   r = icEqualSmallJsonSmallArrayG(self, array);
  53894   ck_assert(r);
  53895   terminateO(array);
  53896   terminateO(self);
  53897 
  53898 END_TEST
  53899 
  53900 
  53901 START_TEST(icEqualSmallJsonArrayGT)
  53902 
  53903   bool r;
  53904   smallJsont *self = allocG(rtSmallJsont);
  53905   char ** p2       = NULL;
  53906 
  53907   listPushS(&p2, "a");
  53908   self->f->pushS(self, "A");
  53909   r = icEqualSmallJsonArrayG(self, p2);
  53910   ck_assert(r);
  53911   listFreeS(p2);
  53912   terminateO(self);
  53913 
  53914 END_TEST
  53915 
  53916 
  53917 START_TEST(icEqualSmallJsonCArrayGT)
  53918 
  53919   bool r;
  53920   smallJsont *self = allocG(rtSmallJsont);
  53921   const char *p2[] = {"a", null};
  53922 
  53923   self->f->pushS(self, "A");
  53924   r = icEqualSmallJsonCArrayG(self, p2);
  53925   ck_assert(r);
  53926   terminateO(self);
  53927 
  53928 END_TEST
  53929 
  53930 
  53931 START_TEST(icEqualSmallJsonBaseGT)
  53932 
  53933   bool r;
  53934   smallJsont *self = allocG(rtSmallJsont);
  53935   baset* p2;
  53936 
  53937   // json bool
  53938   setTopBoolO(self, false);
  53939   p2 = (baset*) allocSmallBool(false);
  53940   r = icEqualSmallJsonBaseG(self, p2);
  53941   ck_assert(r);
  53942   terminateO(p2);
  53943   terminateO(self);
  53944 
  53945 END_TEST
  53946 
  53947 
  53948 START_TEST(icEqualSmallJsonSmallDictGT)
  53949 
  53950   bool r;
  53951   smallJsont* self = allocG(rtSmallJsont);
  53952   smallDictt* p2   = allocSmallDict();
  53953 
  53954   // equal
  53955   self->f->setS(self, "a", "a");
  53956   self->f->setInt(self, "b", 2);
  53957   self->f->setInt(self, "c", 3);
  53958   p2->f->setInt(p2, "b", 2);
  53959   p2->f->setS(p2, "a", "A");
  53960   p2->f->setInt(p2, "c", 3);
  53961   r = icEqualSmallJsonSmallDictG(self, p2);
  53962   ck_assert(r);
  53963   terminateO(p2);
  53964   terminateO(self);
  53965 
  53966 END_TEST
  53967 
  53968 
  53969 START_TEST(icEqualSmallJsonSmallJsonGT)
  53970 
  53971   bool r;
  53972   smallJsont* self   = allocG(rtSmallJsont);
  53973   smallJsont *string = allocSmallJson();
  53974 
  53975   setTopSO(string, "qwe");
  53976   setTopSO(self, "QWE");
  53977   r = icEqualSmallJsonSmallJsonG(self, string);
  53978   ck_assert(r);
  53979   terminateO(string);
  53980   terminateO(self);
  53981 
  53982 END_TEST
  53983 
  53984 
  53985 START_TEST(icEqualSmallJsonSmallStringGT)
  53986 
  53987   bool r;
  53988   smallJsont* self     = allocG(rtSmallJsont);
  53989   smallStringt *string = allocSmallString("qwe");
  53990 
  53991   setTopSO(self, "QWE");
  53992   r = icEqualSmallJsonSmallStringG(self, string);
  53993   ck_assert(r);
  53994   terminateO(string);
  53995   terminateO(self);
  53996 
  53997 END_TEST
  53998 
  53999 
  54000 START_TEST(icEqualCharSmallJsonGT)
  54001 
  54002   bool r;
  54003   smallJsont *self = allocG(rtSmallJsont);
  54004   setTopSO(self, "");
  54005 
  54006   r = icEqualCharSmallJsonG(self,'q');
  54007   ck_assert(!r);
  54008   freeO(self);
  54009   setTopSO(self, "q");
  54010   r = icEqualCharSmallJsonG(self,'Q');
  54011   ck_assert(r);
  54012   terminateO(self);
  54013 
  54014 END_TEST
  54015 
  54016 
  54017 START_TEST(icEqualSSmallJsonGT)
  54018 
  54019   bool r;
  54020   smallJsont *self = allocG(rtSmallJsont);
  54021 
  54022   // empty json
  54023   r = icEqualSSmallJsonG(self, "qwe");
  54024   ck_assert(!r);
  54025   // equal
  54026   setTopSO(self, "QWE");
  54027   r = icEqualSSmallJsonG(self, "qwe");
  54028   ck_assert(r);
  54029   terminateO(self);
  54030 
  54031 END_TEST
  54032 
  54033 
  54034 START_TEST(equalISSmallJsonGT)
  54035 
  54036   smallJsont *self = allocG(rtSmallJsont);
  54037   setTopSO(self, "Ashee|");
  54038 
  54039   ck_assert(equalISSmallJsonG(self, "shee", 1));
  54040   terminateO(self);
  54041 
  54042 END_TEST
  54043 
  54044 
  54045 START_TEST(equalICharSmallJsonGT)
  54046 
  54047   smallJsont *self = allocG(rtSmallJsont);
  54048   setTopSO(self, "Ashee");
  54049 
  54050   // identical strings
  54051   ck_assert(equalICharSmallJsonG(self, 's', 1));
  54052   terminateO(self);
  54053 
  54054 END_TEST
  54055 
  54056 
  54057 START_TEST(equalIJsonSmallJsonGT)
  54058 
  54059   smallJsont *self = allocG(rtSmallJsont);
  54060   setTopSO(self, "Ashee|");
  54061   smallJsont *string = allocSmallJson();
  54062 
  54063   // identical strings
  54064   setTopSO(string, "shee");
  54065   ck_assert(equalIJsonSmallJsonG(self, string, 1));
  54066   terminateO(string);
  54067   terminateO(self);
  54068 
  54069 END_TEST
  54070 
  54071 
  54072 START_TEST(equalISmallStringSmallJsonGT)
  54073 
  54074   smallJsont *self = allocG(rtSmallJsont);
  54075   setTopSO(self, "Ashee|");
  54076   smallStringt *string = allocSmallString("shee");
  54077 
  54078   // identical strings
  54079   ck_assert(equalISmallStringSmallJsonG(self, string, 1));
  54080   terminateO(string);
  54081   terminateO(self);
  54082 
  54083 END_TEST
  54084 
  54085 
  54086 START_TEST(startsWithSSmallJsonGT)
  54087 
  54088   smallJsont *self = allocG(rtSmallJsont);
  54089 
  54090   setTopSO(self, "sheepy");
  54091   ck_assert(startsWithSSmallJsonG(self, "shee"));
  54092   terminateO(self);
  54093 
  54094 END_TEST
  54095 
  54096 
  54097 START_TEST(startsWithCharSmallJsonGT)
  54098 
  54099   smallJsont *self = allocG(rtSmallJsont);
  54100   setTopSO(self, "shee");
  54101 
  54102   // identical strings
  54103   ck_assert(startsWithCharSmallJsonG(self, 's'));
  54104   terminateO(self);
  54105 
  54106 END_TEST
  54107 
  54108 
  54109 START_TEST(startsWithSmallStringSmallJsonGT)
  54110 
  54111   smallJsont *self = allocG(rtSmallJsont);
  54112   setTopSO(self, "sheepy");
  54113   smallStringt *string = allocSmallString("shee");
  54114 
  54115   // identical strings
  54116   ck_assert(startsWithSmallStringSmallJsonG(self, string));
  54117   terminateO(string);
  54118   terminateO(self);
  54119 
  54120 END_TEST
  54121 
  54122 
  54123 START_TEST(startsWithJsonSmallJsonGT)
  54124 
  54125   smallJsont *self = allocG(rtSmallJsont);
  54126   setTopSO(self, "sheepy");
  54127   smallJsont *string = allocSmallJson();
  54128 
  54129   // identical strings
  54130   setTopSO(string, "shee");
  54131   ck_assert(startsWithJsonSmallJsonG(self, string));
  54132   terminateO(string);
  54133   terminateO(self);
  54134 
  54135 END_TEST
  54136 
  54137 
  54138 START_TEST(endsWithSSmallJsonGT)
  54139 
  54140   smallJsont *self = allocG(rtSmallJsont);
  54141   setTopSO(self, "sheepy");
  54142 
  54143   ck_assert(endsWithSSmallJsonG(self, "eepy"));
  54144   terminateO(self);
  54145 
  54146 END_TEST
  54147 
  54148 
  54149 START_TEST(endsWithCharSmallJsonGT)
  54150 
  54151   smallJsont *self = allocG(rtSmallJsont);
  54152   setTopSO(self, "shee");
  54153 
  54154   // identical strings
  54155   ck_assert(endsWithCharSmallJsonG(self, 'e'));
  54156   terminateO(self);
  54157 
  54158 END_TEST
  54159 
  54160 
  54161 START_TEST(endsWithSmallStringSmallJsonGT)
  54162 
  54163   smallJsont *self = allocG(rtSmallJsont);
  54164   setTopSO(self, "shee");
  54165   smallStringt *string = allocSmallString("hee");
  54166 
  54167   // identical strings
  54168   ck_assert(endsWithSmallStringSmallJsonG(self, string));
  54169   terminateO(string);
  54170   terminateO(self);
  54171 
  54172 END_TEST
  54173 
  54174 
  54175 START_TEST(endsWithJsonSmallJsonGT)
  54176 
  54177   smallJsont *self = allocG(rtSmallJsont);
  54178   setTopSO(self, "shee");
  54179   smallJsont *string = allocSmallJson();
  54180 
  54181   // identical strings
  54182   setTopSO(string, "hee");
  54183   ck_assert(endsWithJsonSmallJsonG(self, string));
  54184   terminateO(string);
  54185   terminateO(self);
  54186 
  54187 END_TEST
  54188 
  54189 
  54190 START_TEST(countSSmallJsonGT)
  54191 
  54192   smallJsont *self = allocG(rtSmallJsont);
  54193   setTopSO(self, "sheepy");
  54194 
  54195   // positive count
  54196   ck_assert_int_eq(countSSmallJsonG(self, "shee"), 1);
  54197   terminateO(self);
  54198 
  54199 END_TEST
  54200 
  54201 
  54202 START_TEST(countCharSmallJsonGT)
  54203 
  54204   smallJsont *self = allocG(rtSmallJsont);
  54205   setTopSO(self, "shee");
  54206 
  54207   // positive count
  54208   ck_assert_int_eq(countCharSmallJsonG(self, 's'), 1);
  54209   terminateO(self);
  54210 
  54211 END_TEST
  54212 
  54213 
  54214 START_TEST(countSmallStringSmallJsonGT)
  54215 
  54216   smallJsont *self = allocG(rtSmallJsont);
  54217   setTopSO(self, "sheepy");
  54218   smallStringt *string = allocSmallString("shee");
  54219 
  54220   // positive count
  54221   ck_assert_int_eq(countSmallStringSmallJsonG(self, string), 1);
  54222   terminateO(string);
  54223   terminateO(self);
  54224 
  54225 END_TEST
  54226 
  54227 
  54228 START_TEST(countJsonSmallJsonGT)
  54229 
  54230   smallJsont *self = allocG(rtSmallJsont);
  54231   setTopSO(self, "sheepy");
  54232   smallJsont *string = allocSmallJson();
  54233 
  54234   // positive count
  54235   setTopSO(string, "shee");
  54236   ck_assert_int_eq(countJsonSmallJsonG(self, string), 1);
  54237   terminateO(string);
  54238   terminateO(self);
  54239 
  54240 END_TEST
  54241 
  54242 
  54243 START_TEST(icStartsWithSSmallJsonGT)
  54244 
  54245   smallJsont *self = allocG(rtSmallJsont);
  54246   setTopSO(self, "shee");
  54247 
  54248   ck_assert(icStartsWithSSmallJsonG(self, "SH"));
  54249   terminateO(self);
  54250 
  54251 END_TEST
  54252 
  54253 
  54254 START_TEST(icStartsWithCharSmallJsonGT)
  54255 
  54256   smallJsont *self = allocG(rtSmallJsont);
  54257   setTopSO(self, "shee");
  54258 
  54259   ck_assert(icStartsWithCharSmallJsonG(self, 'S'));
  54260   terminateO(self);
  54261 
  54262 END_TEST
  54263 
  54264 
  54265 START_TEST(icStartsWithSmallStringSmallJsonGT)
  54266 
  54267   smallJsont *self = allocG(rtSmallJsont);
  54268   setTopSO(self, "shee");
  54269   smallStringt *string = allocSmallString("SH");
  54270 
  54271   ck_assert(icStartsWithSmallStringSmallJsonG(self, string));
  54272   terminateO(string);
  54273   terminateO(self);
  54274 
  54275 END_TEST
  54276 
  54277 
  54278 START_TEST(icStartsWithJsonSmallJsonGT)
  54279 
  54280   smallJsont *self = allocG(rtSmallJsont);
  54281   setTopSO(self, "shee");
  54282   smallJsont *string = allocSmallJson();
  54283 
  54284   setTopSO(string, "SH");
  54285   ck_assert(icStartsWithJsonSmallJsonG(self, string));
  54286   terminateO(string);
  54287   terminateO(self);
  54288 
  54289 END_TEST
  54290 
  54291 
  54292 START_TEST(icEndsWithSSmallJsonGT)
  54293 
  54294   smallJsont *self = allocG(rtSmallJsont);
  54295 
  54296   setTopSO(self, "sheepy");
  54297   ck_assert(icEndsWithSSmallJsonG(self, "EEPY"));
  54298   terminateO(self);
  54299 
  54300 END_TEST
  54301 
  54302 
  54303 START_TEST(icEndsWithCharSmallJsonGT)
  54304 
  54305   smallJsont *self = allocG(rtSmallJsont);
  54306   setTopSO(self, "shee");
  54307 
  54308   ck_assert(icEndsWithCharSmallJsonG(self, 'E'));
  54309   terminateO(self);
  54310 
  54311 END_TEST
  54312 
  54313 
  54314 START_TEST(icEndsWithSmallStringSmallJsonGT)
  54315 
  54316   smallJsont *self = allocG(rtSmallJsont);
  54317   setTopSO(self, "sheepy");
  54318   smallStringt *string = allocSmallString("EEPY");
  54319 
  54320   ck_assert(icEndsWithSmallStringSmallJsonG(self, string));
  54321   terminateO(string);
  54322   terminateO(self);
  54323 
  54324 END_TEST
  54325 
  54326 
  54327 START_TEST(icEndsWithJsonSmallJsonGT)
  54328 
  54329   smallJsont *self = allocG(rtSmallJsont);
  54330   setTopSO(self, "sheepy");
  54331   smallJsont *string = allocSmallJson();
  54332 
  54333   setTopSO(string, "EEPY");
  54334   ck_assert(icEndsWithJsonSmallJsonG(self, string));
  54335   terminateO(string);
  54336   terminateO(self);
  54337 
  54338 END_TEST
  54339 
  54340 
  54341 START_TEST(icCountSSmallJsonGT)
  54342 
  54343   smallJsont *self = allocG(rtSmallJsont);
  54344   setTopSO(self, "sheepy");
  54345 
  54346   ck_assert_int_eq(icCountSSmallJsonG(self, "SH"), 1);
  54347   terminateO(self);
  54348 
  54349 END_TEST
  54350 
  54351 
  54352 START_TEST(icCountCharSmallJsonGT)
  54353 
  54354   smallJsont *self = allocG(rtSmallJsont);
  54355   setTopSO(self, "shee");
  54356 
  54357   ck_assert_int_eq(icCountCharSmallJsonG(self, 'S'), 1);
  54358   terminateO(self);
  54359 
  54360 END_TEST
  54361 
  54362 
  54363 START_TEST(icCountSmallStringSmallJsonGT)
  54364 
  54365   smallJsont *self = allocG(rtSmallJsont);
  54366   setTopSO(self, "sheepy");
  54367   smallStringt *string = allocSmallString("SHEE");
  54368 
  54369   ck_assert_int_eq(icCountSmallStringSmallJsonG(self, string), 1);
  54370   terminateO(string);
  54371   terminateO(self);
  54372 
  54373 END_TEST
  54374 
  54375 
  54376 START_TEST(icCountJsonSmallJsonGT)
  54377 
  54378   smallJsont *self = allocG(rtSmallJsont);
  54379   setTopSO(self, "sheepy");
  54380   smallJsont *string = allocSmallJson();
  54381 
  54382   setTopSO(string, "SH");
  54383   ck_assert_int_eq(icCountJsonSmallJsonG(self, string), 1);
  54384   terminateO(string);
  54385   terminateO(self);
  54386 
  54387 END_TEST
  54388 
  54389 
  54390 START_TEST(isNumberSmallJsonGT)
  54391 
  54392   smallJsont *self = allocG(rtSmallJsont);
  54393 
  54394   setTopSO(self, "-12.3");
  54395   ck_assert(isNumberSmallJsonG(self));
  54396   terminateO(self);
  54397 
  54398 END_TEST
  54399 
  54400 
  54401 START_TEST(isIntSmallJsonGT)
  54402 
  54403   smallJsont *self = allocG(rtSmallJsont);
  54404 
  54405   setTopSO(self, "-123");
  54406   ck_assert(isIntSmallJsonG(self));
  54407   terminateO(self);
  54408 
  54409 END_TEST
  54410 
  54411 
  54412 START_TEST(parseIntSmallJsonGT)
  54413 
  54414   smallJsont *self = allocG(rtSmallJsont);
  54415 
  54416   setTopSO(self, "123sheepy");
  54417   ck_assert_int_eq(parseIntSmallJsonG(self), 123);
  54418   terminateO(self);
  54419 
  54420 END_TEST
  54421 
  54422 
  54423 START_TEST(parseDoubleSmallJsonGT)
  54424 
  54425   smallJsont *self = allocG(rtSmallJsont);
  54426 
  54427   setTopSO(self, "123.2sheepy");
  54428   ck_assert_int_eq(parseDoubleSmallJsonG(self), 123);
  54429   terminateO(self);
  54430 
  54431 END_TEST
  54432 
  54433 
  54434 START_TEST(intToSmallJsonGT)
  54435 
  54436   smallJsont* r;
  54437   smallJsont *self = allocG(rtSmallJsont);
  54438 
  54439   r = intToSmallJsonG(self, 123);
  54440   ck_assert_ptr_ne(r, null);
  54441   char *s = toStringO(r);
  54442   ck_assert_str_eq(s, "123");
  54443   free(s);
  54444   terminateO(self);
  54445 
  54446 END_TEST
  54447 
  54448 
  54449 START_TEST(doubleToSmallJsonGT)
  54450 
  54451   smallJsont* r;
  54452   smallJsont *self = allocG(rtSmallJsont);
  54453 
  54454   r = doubleToSmallJsonG(self, 123.4);
  54455   ck_assert_ptr_ne(r, null);
  54456   char *s = toStringO(r);
  54457   ck_assert_str_eq(s, "1.234000e+02");
  54458   free(s);
  54459   terminateO(self);
  54460 
  54461 END_TEST
  54462 
  54463 
  54464 START_TEST(lenSmallJsonGT)
  54465 
  54466   size_t r;
  54467   smallJsont *self = allocSmallJson();
  54468 
  54469   self->f->pushInt(self, 1);
  54470   r = lenSmallJsonG(self);
  54471   ck_assert_int_eq(r, 1);
  54472   terminateO(self);
  54473 
  54474 END_TEST
  54475 
  54476 
  54477 START_TEST(upperSmallJsonGT)
  54478 
  54479   smallJsont*    r;
  54480   smallJsont *self = allocG(rtSmallJsont);
  54481   setTopSO(self, "sheepy");
  54482 
  54483   // string
  54484   r = upperSmallJsonG(self);
  54485   ck_assert_ptr_ne(r, null);
  54486   char *s = toStringO(r);
  54487   ck_assert_str_eq(s, "SHEEPY");
  54488   free(s);
  54489   terminateO(self);
  54490 
  54491 END_TEST
  54492 
  54493 
  54494 START_TEST(lowerSmallJsonGT)
  54495 
  54496   smallJsont*    r;
  54497   smallJsont *self = allocG(rtSmallJsont);
  54498   setTopSO(self, "SHeePY");
  54499 
  54500   // string
  54501   r = lowerSmallJsonG(self);
  54502   ck_assert_ptr_ne(r, null);
  54503   char *s = toStringO(r);
  54504   ck_assert_str_eq(s, "sheepy");
  54505   free(s);
  54506   terminateO(self);
  54507 
  54508 END_TEST
  54509 
  54510 
  54511 START_TEST(trimSmallJsonGT)
  54512 
  54513   smallJsont* r;
  54514   smallJsont *self = allocSmallJson();
  54515 
  54516   self->f->pushInt(self, 1);
  54517   delElemIndexO(self, 0);
  54518   r = trimSmallJsonG(self);
  54519   ck_assert_ptr_ne(r, null);
  54520   ck_assert_int_eq(lenSmallJsonG(self), 0);
  54521   terminateO(self);
  54522 
  54523 END_TEST
  54524 
  54525 
  54526 START_TEST(lTrimSmallJsonGT)
  54527 
  54528   smallJsont*    r;
  54529   smallJsont *self = allocG(rtSmallJsont);
  54530 
  54531   setTopSO(self, "  SHeePY");
  54532   r = lTrimSmallJsonG(self);
  54533   ck_assert_ptr_ne(r, null);
  54534   char *s = toStringO(r);
  54535   ck_assert_str_eq(s, "SHeePY");
  54536   free(s);
  54537   terminateO(self);
  54538 
  54539 END_TEST
  54540 
  54541 
  54542 START_TEST(rTrimSmallJsonGT)
  54543 
  54544   smallJsont*    r;
  54545   smallJsont *self = allocG(rtSmallJsont);
  54546 
  54547   setTopSO(self, "SHeePY	");
  54548   r = rTrimSmallJsonG(self);
  54549   ck_assert_ptr_ne(r, null);
  54550   char *s = toStringO(r);
  54551   ck_assert_str_eq(s, "SHeePY");
  54552   free(s);
  54553   terminateO(self);
  54554 
  54555 END_TEST
  54556 
  54557 
  54558 START_TEST(compactSmallJsonGT)
  54559 
  54560   smallJsont* r;
  54561   smallJsont *self = allocSmallJson();
  54562 
  54563   self->f->pushUndefined(self);
  54564   //  null element
  54565   self->f->pushUndefined(self);
  54566   delElemIndexO(self, 1);
  54567   self->f->pushBool(self, true);
  54568   createSmallContainer(c);
  54569   self->f->pushSmallContainer(self, &c);
  54570   //  empty dict
  54571   createSmallDict(d);
  54572   self->f->pushDict(self, &d);
  54573   resetO(&d);
  54574   (&d)->f->setInt(&d, "a", 1);
  54575   self->f->pushDict(self, &d);
  54576   self->f->pushDouble(self, 2);
  54577   self->f->pushInt(self, 5);
  54578   self->f->pushS(self, "   ");
  54579   self->f->pushS(self, "asd");
  54580   //  empty Array
  54581   createSmallArray(a);
  54582   self->f->pushArray(self, &a);
  54583   resetO(&a);
  54584   (&a)->f->pushInt(&a, 1);
  54585   self->f->pushArray(self, &a);
  54586   //  empty bytes
  54587   createSmallBytes(b);
  54588   self->f->pushSmallBytes(self, &b);
  54589   smallBytest *B = allocSmallBytes("asd", 4);
  54590   self->f->pushNFreeSmallBytes(self, B);
  54591   r = compactSmallJsonG(self);
  54592   ck_assert_ptr_ne(r, NULL);
  54593   ck_assert_int_eq(lenO(r), 8);
  54594   char *s = toStringO(r);
  54595   ck_assert_str_eq(s, "[true,\"<data container>\",{\"a\":1},2.000000e+00,5,\"asd\",[1],[0x61,0x73,0x64,0x00]]");
  54596   free(s);
  54597   terminateO(self);
  54598 
  54599 END_TEST
  54600 
  54601 
  54602 START_TEST(emptySmallJsonGT)
  54603 
  54604   smallJsont* r;
  54605   smallJsont *self = allocSmallJson();
  54606 
  54607   self->f->pushInt(self, 1);
  54608   r = emptySmallJsonG(self);
  54609   ck_assert_ptr_ne(r, null);
  54610   char *s = toStringO(r);
  54611   ck_assert_str_eq(s, "[]");
  54612   free(s);
  54613   terminateO(self);
  54614 
  54615 END_TEST
  54616 
  54617 
  54618 START_TEST(isEmptySmallJsonGT)
  54619 
  54620   bool r;
  54621   smallJsont *self = allocSmallJson();
  54622 
  54623   r = isEmptySmallJsonG(self);
  54624   ck_assert(r);
  54625   terminateO(self);
  54626 
  54627 END_TEST
  54628 
  54629 
  54630 START_TEST(isBlankSmallJsonGT)
  54631 
  54632   bool r;
  54633   smallJsont *self = allocSmallJson();
  54634 
  54635   r = isBlankSmallJsonG(self);
  54636   ck_assert(r);
  54637   terminateO(self);
  54638 
  54639 END_TEST
  54640 
  54641 
  54642 START_TEST(joinSmallJsonGT)
  54643 
  54644   smallStringt* r;
  54645   smallJsont *self = allocSmallJson();
  54646 
  54647   self->f->pushS(self, "a");
  54648   self->f->pushS(self, "b");
  54649   r = joinSmallJsonG(self, "|");
  54650   ck_assert_ptr_ne(r, null);
  54651   char *s = toStringO(r);
  54652   ck_assert_str_eq(s, "a|b");
  54653   free(s);
  54654   terminateO(r);
  54655   terminateO(self);
  54656 
  54657 END_TEST
  54658 
  54659 
  54660 START_TEST(joinCharSmallJsonGT)
  54661 
  54662   smallStringt* r;
  54663   smallJsont *self = allocSmallJson();
  54664 
  54665   self->f->pushS(self, "a");
  54666   self->f->pushS(self, "b");
  54667   r = joinCharSmallJsonG(self, '|');
  54668   ck_assert_ptr_ne(r, null);
  54669   char *s = toStringO(r);
  54670   ck_assert_str_eq(s, "a|b");
  54671   free(s);
  54672   terminateO(r);
  54673   terminateO(self);
  54674 
  54675 END_TEST
  54676 
  54677 
  54678 START_TEST(joinSmallJsonSmallJsonGT)
  54679 
  54680   smallStringt* r;
  54681   smallJsont *self = allocSmallJson();
  54682 
  54683   r = joinSmallJsonSmallJsonG(self, null);
  54684   ck_assert_ptr_eq(r, null);
  54685   terminateO(self);
  54686 
  54687 END_TEST
  54688 
  54689 
  54690 START_TEST(joinSmallStringSmallJsonGT)
  54691 
  54692   smallStringt* r;
  54693   smallJsont *self = allocSmallJson();
  54694 
  54695   r = joinSmallStringSmallJsonG(self, null);
  54696   ck_assert_ptr_eq(r, null);
  54697   terminateO(self);
  54698 
  54699 END_TEST
  54700 
  54701 
  54702 START_TEST(joinSSmallJsonGT)
  54703 
  54704   char* r;
  54705   smallJsont *self = allocSmallJson();
  54706 
  54707   r = joinSSmallJsonG(self, null);
  54708   ck_assert_ptr_eq(r, null);
  54709   terminateO(self);
  54710 
  54711 END_TEST
  54712 
  54713 
  54714 START_TEST(joinCharSSmallJsonGT)
  54715 
  54716   char* r;
  54717   smallJsont *self = allocSmallJson();
  54718 
  54719   r = joinCharSSmallJsonG(self, '#');
  54720   ck_assert_ptr_eq(r, null);
  54721   terminateO(self);
  54722 
  54723 END_TEST
  54724 
  54725 
  54726 START_TEST(joinSmallJsonSSmallJsonGT)
  54727 
  54728   char* r;
  54729   smallJsont *self = allocSmallJson();
  54730 
  54731   r = joinSmallJsonSSmallJsonG(self, null);
  54732   ck_assert_ptr_eq(r, null);
  54733   terminateO(self);
  54734 
  54735 END_TEST
  54736 
  54737 
  54738 START_TEST(joinSmallStringSSmallJsonGT)
  54739 
  54740   char* r;
  54741   smallJsont *self = allocSmallJson();
  54742 
  54743   r = joinSmallStringSSmallJsonG(self, null);
  54744   ck_assert_ptr_eq(r, null);
  54745   terminateO(self);
  54746 
  54747 END_TEST
  54748 
  54749 
  54750 START_TEST(splitSmallJsonGT)
  54751 
  54752   smallJsont* r;
  54753   smallJsont *self = allocG(rtSmallJsont);
  54754 
  54755   setTopSO(self, "one/two");
  54756   r = splitSmallJsonG(self, "/");
  54757   ck_assert_ptr_ne(r, null);
  54758   char *s = toStringO(r);
  54759   ck_assert_str_eq(s, "[\"one\",\"two\"]");
  54760   free(s);
  54761   terminateO(r);
  54762   terminateO(self);
  54763 
  54764 END_TEST
  54765 
  54766 
  54767 START_TEST(splitCharSmallJsonGT)
  54768 
  54769   smallJsont* r;
  54770   smallJsont *self = allocG(rtSmallJsont);
  54771 
  54772   setTopSO(self, "one/two");
  54773   r = splitCharSmallJsonG(self, '/');
  54774   ck_assert_ptr_ne(r, null);
  54775   char *s = toStringO(r);
  54776   ck_assert_str_eq(s, "[\"one\",\"two\"]");
  54777   free(s);
  54778   terminateO(r);
  54779   terminateO(self);
  54780 
  54781 END_TEST
  54782 
  54783 
  54784 START_TEST(splitSmallJsonSmallJsonGT)
  54785 
  54786   smallJsont* r;
  54787   smallJsont *self = allocG(rtSmallJsont);
  54788   smallJsont *delim  = allocSmallJson();
  54789 
  54790   setTopSO(self, "one/two");
  54791   setTopSO(delim, "/");
  54792   r = splitSmallJsonSmallJsonG(self, delim);
  54793   ck_assert_ptr_ne(r, null);
  54794   char *s = toStringO(r);
  54795   ck_assert_str_eq(s, "[\"one\",\"two\"]");
  54796   free(s);
  54797   terminateO(r);
  54798   terminateO(delim);
  54799   terminateO(self);
  54800 
  54801 END_TEST
  54802 
  54803 
  54804 START_TEST(splitSmallStringSmallJsonGT)
  54805 
  54806   smallJsont* r;
  54807   smallJsont *self = allocG(rtSmallJsont);
  54808   smallStringt *delim = allocSmallString("/");
  54809 
  54810   setTopSO(self, "one/two");
  54811   r = splitSmallStringSmallJsonG(self, delim);
  54812   ck_assert_ptr_ne(r, null);
  54813   char *s = toStringO(r);
  54814   ck_assert_str_eq(s, "[\"one\",\"two\"]");
  54815   free(s);
  54816   terminateO(r);
  54817   terminateO(delim);
  54818   terminateO(self);
  54819 
  54820 END_TEST
  54821 
  54822 
  54823 START_TEST(splitSSmallJsonGT)
  54824 
  54825   char** r;
  54826   smallJsont *self = allocG(rtSmallJsont);
  54827 
  54828   setTopSO(self, "one/two");
  54829   r = splitSSmallJsonG(self, "/");
  54830   ck_assert_uint_eq(listLengthS(r),2);
  54831   ck_assert_str_eq(r[0], "one");
  54832   ck_assert_str_eq(r[1], "two");
  54833   listFreeS(r);
  54834   terminateO(self);
  54835 
  54836 END_TEST
  54837 
  54838 
  54839 START_TEST(splitCharSSmallJsonGT)
  54840 
  54841   char** r;
  54842   smallJsont *self = allocG(rtSmallJsont);
  54843 
  54844   setTopSO(self, "one/two");
  54845   r = splitCharSSmallJsonG(self, '/');
  54846   ck_assert_uint_eq(listLengthS(r),2);
  54847   ck_assert_str_eq(r[0], "one");
  54848   ck_assert_str_eq(r[1], "two");
  54849   listFreeS(r);
  54850   terminateO(self);
  54851 
  54852 END_TEST
  54853 
  54854 
  54855 START_TEST(splitSmallJsonSSmallJsonGT)
  54856 
  54857   char** r;
  54858   smallJsont *self  = allocG(rtSmallJsont);
  54859   smallJsont *delim = allocSmallJson();
  54860 
  54861   setTopSO(self, "one/two");
  54862   setTopSO(delim, "/");
  54863   r = splitSmallJsonSSmallJsonG(self, delim);
  54864   ck_assert_uint_eq(listLengthS(r),2);
  54865   ck_assert_str_eq(r[0], "one");
  54866   ck_assert_str_eq(r[1], "two");
  54867   listFreeS(r);
  54868   terminateO(delim);
  54869   terminateO(self);
  54870 
  54871 END_TEST
  54872 
  54873 
  54874 START_TEST(splitSmallStringSSmallJsonGT)
  54875 
  54876   char** r;
  54877   smallJsont *self    = allocG(rtSmallJsont);
  54878   smallStringt *delim = allocSmallString("/");
  54879 
  54880   setTopSO(self, "one/two");
  54881   r = splitSmallStringSSmallJsonG(self, delim);
  54882   ck_assert_uint_eq(listLengthS(r),2);
  54883   ck_assert_str_eq(r[0], "one");
  54884   ck_assert_str_eq(r[1], "two");
  54885   listFreeS(r);
  54886   terminateO(delim);
  54887   terminateO(self);
  54888 
  54889 END_TEST
  54890 
  54891 
  54892 START_TEST(extractSmallJsonGT)
  54893 
  54894   smallJsont* r;
  54895   smallJsont *self = allocG(rtSmallJsont);
  54896 
  54897   setTopSO(self, "one/two|");
  54898   r = extractSmallJsonG(self, "/", "|");
  54899   ck_assert_ptr_ne(r, null);
  54900   char *s = toStringO(r);
  54901   ck_assert_str_eq(s, "[\"two\"]");
  54902   free(s);
  54903   terminateO(r);
  54904   terminateO(self);
  54905 
  54906 END_TEST
  54907 
  54908 
  54909 START_TEST(extractCharSSmallJsonGT)
  54910 
  54911   smallJsont* r;
  54912   smallJsont *self = allocG(rtSmallJsont);
  54913 
  54914   setTopSO(self, "one/two|");
  54915   r = extractCharSSmallJsonG(self, '/', "|");
  54916   ck_assert_ptr_ne(r, null);
  54917   char *s = toStringO(r);
  54918   ck_assert_str_eq(s, "[\"two\"]");
  54919   free(s);
  54920   terminateO(r);
  54921   terminateO(self);
  54922 
  54923 END_TEST
  54924 
  54925 
  54926 START_TEST(extractSCharSmallJsonGT)
  54927 
  54928   smallJsont* r;
  54929   smallJsont *self = allocG(rtSmallJsont);
  54930 
  54931   setTopSO(self, "one/two|");
  54932   r = extractSCharSmallJsonG(self, "/", '|');
  54933   ck_assert_ptr_ne(r, null);
  54934   char *s = toStringO(r);
  54935   ck_assert_str_eq(s, "[\"two\"]");
  54936   free(s);
  54937   terminateO(r);
  54938   terminateO(self);
  54939 
  54940 END_TEST
  54941 
  54942 
  54943 START_TEST(extractCharCharSmallJsonGT)
  54944 
  54945   smallJsont* r;
  54946   smallJsont *self = allocG(rtSmallJsont);
  54947 
  54948   setTopSO(self, "one/two|");
  54949   r = extractCharCharSmallJsonG(self, '/', '|');
  54950   ck_assert_ptr_ne(r, null);
  54951   char *s = toStringO(r);
  54952   ck_assert_str_eq(s, "[\"two\"]");
  54953   free(s);
  54954   terminateO(r);
  54955   terminateO(self);
  54956 
  54957 END_TEST
  54958 
  54959 
  54960 START_TEST(extractSmallJsonSmallJsonSmallJsonGT)
  54961 
  54962   smallJsont* r;
  54963   smallJsont *self   = allocG(rtSmallJsont);
  54964   smallJsont* delim1 = allocSmallJson();
  54965   smallJsont* delim2 = allocSmallJson();
  54966 
  54967   setTopSO(self, "one/two|");
  54968   setTopSO(delim1, "/");
  54969   setTopSO(delim2, "|");
  54970   r = extractSmallJsonSmallJsonSmallJsonG(self, delim1, delim2);
  54971   ck_assert_ptr_ne(r, null);
  54972   char *s = toStringO(r);
  54973   ck_assert_str_eq(s, "[\"two\"]");
  54974   free(s);
  54975   terminateO(r);
  54976   terminateO(delim1);
  54977   terminateO(delim2);
  54978   terminateO(self);
  54979 
  54980 END_TEST
  54981 
  54982 
  54983 START_TEST(extractSmallJsonSmallStringSmallJsonGT)
  54984 
  54985   smallJsont* r;
  54986   smallJsont *self     = allocG(rtSmallJsont);
  54987   smallJsont* delim1   = allocSmallJson();
  54988   smallStringt* delim2 = allocSmallString("|");
  54989 
  54990   setTopSO(self, "one/two|");
  54991   setTopSO(delim1, "/");
  54992   r = extractSmallJsonSmallStringSmallJsonG(self, delim1, delim2);
  54993   ck_assert_ptr_ne(r, null);
  54994   char *s = toStringO(r);
  54995   ck_assert_str_eq(s, "[\"two\"]");
  54996   free(s);
  54997   terminateO(r);
  54998   terminateO(delim1);
  54999   terminateO(delim2);
  55000   terminateO(self);
  55001 
  55002 END_TEST
  55003 
  55004 
  55005 START_TEST(extractSmallJsonSSmallJsonGT)
  55006 
  55007   smallJsont* r;
  55008   smallJsont *self   = allocG(rtSmallJsont);
  55009   smallJsont* delim1 = allocSmallJson();
  55010 
  55011   setTopSO(self, "one/two|");
  55012   setTopSO(delim1, "/");
  55013   r = extractSmallJsonSSmallJsonG(self, delim1, "|");
  55014   ck_assert_ptr_ne(r, null);
  55015   char *s = toStringO(r);
  55016   ck_assert_str_eq(s, "[\"two\"]");
  55017   free(s);
  55018   terminateO(r);
  55019   terminateO(delim1);
  55020   terminateO(self);
  55021 
  55022 END_TEST
  55023 
  55024 
  55025 START_TEST(extractSmallJsonCharSmallJsonGT)
  55026 
  55027   smallJsont* r;
  55028   smallJsont *self   = allocG(rtSmallJsont);
  55029   smallJsont* delim1 = allocSmallJson();
  55030 
  55031   setTopSO(self, "one/two|");
  55032   setTopSO(delim1, "/");
  55033   r = extractSmallJsonCharSmallJsonG(self, delim1, '|');
  55034   ck_assert_ptr_ne(r, null);
  55035   char *s = toStringO(r);
  55036   ck_assert_str_eq(s, "[\"two\"]");
  55037   free(s);
  55038   terminateO(r);
  55039   terminateO(delim1);
  55040   terminateO(self);
  55041 
  55042 END_TEST
  55043 
  55044 
  55045 START_TEST(extractSmallStringSmallJsonSmallJsonGT)
  55046 
  55047   smallJsont* r;
  55048   smallJsont *self     = allocG(rtSmallJsont);
  55049   smallStringt* delim1 = allocSmallString("/");
  55050   smallJsont* delim2   = allocSmallJson();
  55051 
  55052   setTopSO(self, "one/two|");
  55053   setTopSO(delim2, "|");
  55054   r = extractSmallStringSmallJsonSmallJsonG(self, delim1, delim2);
  55055   ck_assert_ptr_ne(r, null);
  55056   char *s = toStringO(r);
  55057   ck_assert_str_eq(s, "[\"two\"]");
  55058   free(s);
  55059   terminateO(r);
  55060   terminateO(delim1);
  55061   terminateO(delim2);
  55062   terminateO(self);
  55063 
  55064 END_TEST
  55065 
  55066 
  55067 START_TEST(extractSmallStringSmallStringSmallJsonGT)
  55068 
  55069   smallJsont* r;
  55070   smallJsont *self     = allocG(rtSmallJsont);
  55071   smallStringt* delim1 = allocSmallString("/");
  55072   smallStringt* delim2 = allocSmallString("|");
  55073 
  55074   setTopSO(self, "one/two|");
  55075   r = extractSmallStringSmallStringSmallJsonG(self, delim1, delim2);
  55076   ck_assert_ptr_ne(r, null);
  55077   char *s = toStringO(r);
  55078   ck_assert_str_eq(s, "[\"two\"]");
  55079   free(s);
  55080   terminateO(r);
  55081   terminateO(delim1);
  55082   terminateO(delim2);
  55083   terminateO(self);
  55084 
  55085 END_TEST
  55086 
  55087 
  55088 START_TEST(extractSmallStringSSmallJsonGT)
  55089 
  55090   smallJsont* r;
  55091   smallJsont *self     = allocG(rtSmallJsont);
  55092   smallStringt* delim1 = allocSmallString("/");
  55093 
  55094   setTopSO(self, "one/two|");
  55095   r = extractSmallStringSSmallJsonG(self, delim1, "|");
  55096   ck_assert_ptr_ne(r, null);
  55097   char *s = toStringO(r);
  55098   ck_assert_str_eq(s, "[\"two\"]");
  55099   free(s);
  55100   terminateO(r);
  55101   terminateO(delim1);
  55102   terminateO(self);
  55103 
  55104 END_TEST
  55105 
  55106 
  55107 START_TEST(extractSmallStringCharSmallJsonGT)
  55108 
  55109   smallJsont* r;
  55110   smallJsont *self     = allocG(rtSmallJsont);
  55111   smallStringt* delim1 = allocSmallString("/");
  55112 
  55113   setTopSO(self, "one/two|");
  55114   r = extractSmallStringCharSmallJsonG(self, delim1, '|');
  55115   ck_assert_ptr_ne(r, null);
  55116   char *s = toStringO(r);
  55117   ck_assert_str_eq(s, "[\"two\"]");
  55118   free(s);
  55119   terminateO(r);
  55120   terminateO(delim1);
  55121   terminateO(self);
  55122 
  55123 END_TEST
  55124 
  55125 
  55126 START_TEST(extractSSmallJsonSmallJsonGT)
  55127 
  55128   smallJsont* r;
  55129   smallJsont *self   = allocG(rtSmallJsont);
  55130   smallJsont* delim2 = allocSmallJson();
  55131 
  55132   setTopSO(self, "one/two|");
  55133   setTopSO(delim2, "|");
  55134   r = extractSSmallJsonSmallJsonG(self, "/", delim2);
  55135   ck_assert_ptr_ne(r, null);
  55136   char *s = toStringO(r);
  55137   ck_assert_str_eq(s, "[\"two\"]");
  55138   free(s);
  55139   terminateO(r);
  55140   terminateO(delim2);
  55141   terminateO(self);
  55142 
  55143 END_TEST
  55144 
  55145 
  55146 START_TEST(extractSSmallStringSmallJsonGT)
  55147 
  55148   smallJsont* r;
  55149   smallJsont *self     = allocG(rtSmallJsont);
  55150   smallStringt* delim2 = allocSmallString("|");
  55151 
  55152   setTopSO(self, "one/two|");
  55153   setValO(delim2, "|");
  55154   r = extractSSmallStringSmallJsonG(self, "/", delim2);
  55155   ck_assert_ptr_ne(r, null);
  55156   char *s = toStringO(r);
  55157   ck_assert_str_eq(s, "[\"two\"]");
  55158   free(s);
  55159   terminateO(r);
  55160   terminateO(delim2);
  55161   terminateO(self);
  55162 
  55163 END_TEST
  55164 
  55165 
  55166 START_TEST(extractCharSmallJsonSmallJsonGT)
  55167 
  55168   smallJsont* r;
  55169   smallJsont *self   = allocG(rtSmallJsont);
  55170   smallJsont* delim2 = allocSmallJson();
  55171 
  55172   setTopSO(self, "one/two|");
  55173   setTopSO(delim2, "|");
  55174   r = extractCharSmallJsonSmallJsonG(self, '/', delim2);
  55175   ck_assert_ptr_ne(r, null);
  55176   char *s = toStringO(r);
  55177   ck_assert_str_eq(s, "[\"two\"]");
  55178   free(s);
  55179   terminateO(r);
  55180   terminateO(delim2);
  55181   terminateO(self);
  55182 
  55183 END_TEST
  55184 
  55185 
  55186 START_TEST(extractCharSmallStringSmallJsonGT)
  55187 
  55188   smallJsont* r;
  55189   smallJsont *self     = allocG(rtSmallJsont);
  55190   smallStringt* delim2 = allocSmallString("|");
  55191 
  55192   setTopSO(self, "one/two|");
  55193   setValO(delim2, "|");
  55194   r = extractCharSmallStringSmallJsonG(self, '/', delim2);
  55195   ck_assert_ptr_ne(r, null);
  55196   char *s = toStringO(r);
  55197   ck_assert_str_eq(s, "[\"two\"]");
  55198   free(s);
  55199   terminateO(r);
  55200   terminateO(delim2);
  55201   terminateO(self);
  55202 
  55203 END_TEST
  55204 
  55205 
  55206 START_TEST(icSplitSmallJsonGT)
  55207 
  55208   smallJsont* r;
  55209   smallJsont *self = allocG(rtSmallJsont);
  55210 
  55211   setTopSO(self, "one/two");
  55212   r = icSplitSmallJsonG(self, "/");
  55213   ck_assert_ptr_ne(r, null);
  55214   char *s = toStringO(r);
  55215   ck_assert_str_eq(s, "[\"one\",\"two\"]");
  55216   free(s);
  55217   terminateO(r);
  55218   terminateO(self);
  55219 
  55220 END_TEST
  55221 
  55222 
  55223 START_TEST(icSplitCharSmallJsonGT)
  55224 
  55225   smallJsont* r;
  55226   smallJsont *self = allocG(rtSmallJsont);
  55227 
  55228   setTopSO(self, "one/two");
  55229   r = icSplitCharSmallJsonG(self, 'T');
  55230   ck_assert_ptr_ne(r, null);
  55231   char *s = toStringO(r);
  55232   ck_assert_str_eq(s, "[\"one/\",\"wo\"]");
  55233   free(s);
  55234   terminateO(r);
  55235   terminateO(self);
  55236 
  55237 END_TEST
  55238 
  55239 
  55240 START_TEST(icSplitSmallJsonSmallJsonGT)
  55241 
  55242   smallJsont* r;
  55243   smallJsont *self = allocG(rtSmallJsont);
  55244   smallJsont *delim  = allocSmallJson();
  55245 
  55246   setTopSO(self, "one/two");
  55247   setTopSO(delim, "/");
  55248   r = icSplitSmallJsonSmallJsonG(self, delim);
  55249   ck_assert_ptr_ne(r, null);
  55250   char *s = toStringO(r);
  55251   ck_assert_str_eq(s, "[\"one\",\"two\"]");
  55252   free(s);
  55253   terminateO(r);
  55254   terminateO(delim);
  55255   terminateO(self);
  55256 
  55257 END_TEST
  55258 
  55259 
  55260 START_TEST(icSplitSmallStringSmallJsonGT)
  55261 
  55262   smallJsont* r;
  55263   smallJsont *self = allocG(rtSmallJsont);
  55264   smallStringt *delim = allocSmallString("/");
  55265 
  55266   setTopSO(self, "one/two");
  55267   r = icSplitSmallStringSmallJsonG(self, delim);
  55268   ck_assert_ptr_ne(r, null);
  55269   char *s = toStringO(r);
  55270   ck_assert_str_eq(s, "[\"one\",\"two\"]");
  55271   free(s);
  55272   terminateO(r);
  55273   terminateO(delim);
  55274   terminateO(self);
  55275 
  55276 END_TEST
  55277 
  55278 
  55279 START_TEST(icSplitSSmallJsonGT)
  55280 
  55281   char** r;
  55282   smallJsont *self = allocG(rtSmallJsont);
  55283 
  55284   setTopSO(self, "one/two");
  55285   r = icSplitSSmallJsonG(self, "/");
  55286   ck_assert_uint_eq(listLengthS(r),2);
  55287   ck_assert_str_eq(r[0], "one");
  55288   ck_assert_str_eq(r[1], "two");
  55289   listFreeS(r);
  55290   terminateO(self);
  55291 
  55292 END_TEST
  55293 
  55294 
  55295 START_TEST(icSplitCharSSmallJsonGT)
  55296 
  55297   char** r;
  55298   smallJsont *self = allocG(rtSmallJsont);
  55299 
  55300   setTopSO(self, "one/two");
  55301   r = icSplitCharSSmallJsonG(self, 'T');
  55302   ck_assert_uint_eq(listLengthS(r),2);
  55303   ck_assert_str_eq(r[0], "one/");
  55304   ck_assert_str_eq(r[1], "wo");
  55305   listFreeS(r);
  55306   terminateO(self);
  55307 
  55308 END_TEST
  55309 
  55310 
  55311 START_TEST(icSplitSmallJsonSSmallJsonGT)
  55312 
  55313   char** r;
  55314   smallJsont *self  = allocG(rtSmallJsont);
  55315   smallJsont *delim = allocSmallJson();
  55316 
  55317   setTopSO(self, "one/two");
  55318   setTopSO(delim, "/");
  55319   r = icSplitSmallJsonSSmallJsonG(self, delim);
  55320   ck_assert_uint_eq(listLengthS(r),2);
  55321   ck_assert_str_eq(r[0], "one");
  55322   ck_assert_str_eq(r[1], "two");
  55323   listFreeS(r);
  55324   terminateO(delim);
  55325   terminateO(self);
  55326 
  55327 END_TEST
  55328 
  55329 
  55330 START_TEST(icSplitSmallStringSSmallJsonGT)
  55331 
  55332   char** r;
  55333   smallJsont *self    = allocG(rtSmallJsont);
  55334   smallStringt *delim = allocSmallString("/");
  55335 
  55336   setTopSO(self, "one/two");
  55337   r = icSplitSmallStringSSmallJsonG(self, delim);
  55338   ck_assert_uint_eq(listLengthS(r),2);
  55339   ck_assert_str_eq(r[0], "one");
  55340   ck_assert_str_eq(r[1], "two");
  55341   listFreeS(r);
  55342   terminateO(delim);
  55343   terminateO(self);
  55344 
  55345 END_TEST
  55346 
  55347 
  55348 START_TEST(icExtractSmallJsonGT)
  55349 
  55350   smallJsont* r;
  55351   smallJsont *self = allocG(rtSmallJsont);
  55352 
  55353   setTopSO(self, "one/twos");
  55354   r = icExtractSmallJsonG(self, "E", "S");
  55355   ck_assert_ptr_ne(r, null);
  55356   char *s = toStringO(r);
  55357   ck_assert_str_eq(s, "[\"/two\"]");
  55358   free(s);
  55359   terminateO(r);
  55360   terminateO(self);
  55361 
  55362 END_TEST
  55363 
  55364 
  55365 START_TEST(icExtractCharSSmallJsonGT)
  55366 
  55367   smallJsont* r;
  55368   smallJsont *self = allocG(rtSmallJsont);
  55369 
  55370   setTopSO(self, "one/twos");
  55371   r = icExtractCharSSmallJsonG(self, 'E', "S");
  55372   ck_assert_ptr_ne(r, null);
  55373   char *s = toStringO(r);
  55374   ck_assert_str_eq(s, "[\"/two\"]");
  55375   free(s);
  55376   terminateO(r);
  55377   terminateO(self);
  55378 
  55379 END_TEST
  55380 
  55381 
  55382 START_TEST(icExtractSCharSmallJsonGT)
  55383 
  55384   smallJsont* r;
  55385   smallJsont *self = allocG(rtSmallJsont);
  55386 
  55387   setTopSO(self, "one/twos");
  55388   r = icExtractSCharSmallJsonG(self, "E", 'S');
  55389   ck_assert_ptr_ne(r, null);
  55390   char *s = toStringO(r);
  55391   ck_assert_str_eq(s, "[\"/two\"]");
  55392   free(s);
  55393   terminateO(r);
  55394   terminateO(self);
  55395 
  55396 END_TEST
  55397 
  55398 
  55399 START_TEST(icExtractCharCharSmallJsonGT)
  55400 
  55401   smallJsont* r;
  55402   smallJsont *self = allocG(rtSmallJsont);
  55403 
  55404   setTopSO(self, "one/twos");
  55405   r = icExtractCharCharSmallJsonG(self, 'E', 'S');
  55406   ck_assert_ptr_ne(r, null);
  55407   char *s = toStringO(r);
  55408   ck_assert_str_eq(s, "[\"/two\"]");
  55409   free(s);
  55410   terminateO(r);
  55411   terminateO(self);
  55412 
  55413 END_TEST
  55414 
  55415 
  55416 START_TEST(icExtractSmallJsonSmallJsonSmallJsonGT)
  55417 
  55418   smallJsont* r;
  55419   smallJsont *self   = allocG(rtSmallJsont);
  55420   smallJsont* delim1 = allocSmallJson();
  55421   smallJsont* delim2 = allocSmallJson();
  55422 
  55423   setTopSO(self, "one/twos");
  55424   setTopSO(delim1, "E");
  55425   setTopSO(delim2, "S");
  55426   r = icExtractSmallJsonSmallJsonSmallJsonG(self, delim1, delim2);
  55427   ck_assert_ptr_ne(r, null);
  55428   char *s = toStringO(r);
  55429   ck_assert_str_eq(s, "[\"/two\"]");
  55430   free(s);
  55431   terminateO(r);
  55432   terminateO(delim1);
  55433   terminateO(delim2);
  55434   terminateO(self);
  55435 
  55436 END_TEST
  55437 
  55438 
  55439 START_TEST(icExtractSmallJsonSmallStringSmallJsonGT)
  55440 
  55441   smallJsont* r;
  55442   smallJsont *self     = allocG(rtSmallJsont);
  55443   smallJsont* delim1   = allocSmallJson();
  55444   smallStringt* delim2 = allocSmallString("S");
  55445 
  55446   setTopSO(self, "one/twos");
  55447   setTopSO(delim1, "E");
  55448   r = icExtractSmallJsonSmallStringSmallJsonG(self, delim1, delim2);
  55449   ck_assert_ptr_ne(r, null);
  55450   char *s = toStringO(r);
  55451   ck_assert_str_eq(s, "[\"/two\"]");
  55452   free(s);
  55453   terminateO(r);
  55454   terminateO(delim1);
  55455   terminateO(delim2);
  55456   terminateO(self);
  55457 
  55458 END_TEST
  55459 
  55460 
  55461 START_TEST(icExtractSmallJsonSSmallJsonGT)
  55462 
  55463   smallJsont* r;
  55464   smallJsont *self   = allocG(rtSmallJsont);
  55465   smallJsont* delim1 = allocSmallJson();
  55466 
  55467   setTopSO(self, "one/twos");
  55468   setTopSO(delim1, "E");
  55469   r = icExtractSmallJsonSSmallJsonG(self, delim1, "S");
  55470   ck_assert_ptr_ne(r, null);
  55471   char *s = toStringO(r);
  55472   ck_assert_str_eq(s, "[\"/two\"]");
  55473   free(s);
  55474   terminateO(r);
  55475   terminateO(delim1);
  55476   terminateO(self);
  55477 
  55478 END_TEST
  55479 
  55480 
  55481 START_TEST(icExtractSmallJsonCharSmallJsonGT)
  55482 
  55483   smallJsont* r;
  55484   smallJsont *self   = allocG(rtSmallJsont);
  55485   smallJsont* delim1 = allocSmallJson();
  55486 
  55487   setTopSO(self, "one/twos");
  55488   setTopSO(delim1, "E");
  55489   r = icExtractSmallJsonCharSmallJsonG(self, delim1, 'S');
  55490   ck_assert_ptr_ne(r, null);
  55491   char *s = toStringO(r);
  55492   ck_assert_str_eq(s, "[\"/two\"]");
  55493   free(s);
  55494   terminateO(r);
  55495   terminateO(delim1);
  55496   terminateO(self);
  55497 
  55498 END_TEST
  55499 
  55500 
  55501 START_TEST(icExtractSmallStringSmallJsonSmallJsonGT)
  55502 
  55503   smallJsont* r;
  55504   smallJsont *self     = allocG(rtSmallJsont);
  55505   smallStringt* delim1 = allocSmallString("E");
  55506   smallJsont* delim2   = allocSmallJson();
  55507 
  55508   setTopSO(self, "one/twos");
  55509   setTopSO(delim2, "S");
  55510   r = icExtractSmallStringSmallJsonSmallJsonG(self, delim1, delim2);
  55511   ck_assert_ptr_ne(r, null);
  55512   char *s = toStringO(r);
  55513   ck_assert_str_eq(s, "[\"/two\"]");
  55514   free(s);
  55515   terminateO(r);
  55516   terminateO(delim1);
  55517   terminateO(delim2);
  55518   terminateO(self);
  55519 
  55520 END_TEST
  55521 
  55522 
  55523 START_TEST(icExtractSmallStringSmallStringSmallJsonGT)
  55524 
  55525   smallJsont* r;
  55526   smallJsont *self     = allocG(rtSmallJsont);
  55527   smallStringt* delim1 = allocSmallString("E");
  55528   smallStringt* delim2 = allocSmallString("|");
  55529 
  55530   setTopSO(self, "one/twos");
  55531   setValO(delim2, "S");
  55532   r = icExtractSmallStringSmallStringSmallJsonG(self, delim1, delim2);
  55533   ck_assert_ptr_ne(r, null);
  55534   char *s = toStringO(r);
  55535   ck_assert_str_eq(s, "[\"/two\"]");
  55536   free(s);
  55537   terminateO(r);
  55538   terminateO(delim1);
  55539   terminateO(delim2);
  55540   terminateO(self);
  55541 
  55542 END_TEST
  55543 
  55544 
  55545 START_TEST(icExtractSmallStringSSmallJsonGT)
  55546 
  55547   smallJsont* r;
  55548   smallJsont *self     = allocG(rtSmallJsont);
  55549   smallStringt* delim1 = allocSmallString("E");
  55550 
  55551   setTopSO(self, "one/twos");
  55552   r = icExtractSmallStringSSmallJsonG(self, delim1, "S");
  55553   ck_assert_ptr_ne(r, null);
  55554   char *s = toStringO(r);
  55555   ck_assert_str_eq(s, "[\"/two\"]");
  55556   free(s);
  55557   terminateO(r);
  55558   terminateO(delim1);
  55559   terminateO(self);
  55560 
  55561 END_TEST
  55562 
  55563 
  55564 START_TEST(icExtractSmallStringCharSmallJsonGT)
  55565 
  55566   smallJsont* r;
  55567   smallJsont *self     = allocG(rtSmallJsont);
  55568   smallStringt* delim1 = allocSmallString("E");
  55569 
  55570   setTopSO(self, "one/twos");
  55571   r = icExtractSmallStringCharSmallJsonG(self, delim1, 'S');
  55572   ck_assert_ptr_ne(r, null);
  55573   char *s = toStringO(r);
  55574   ck_assert_str_eq(s, "[\"/two\"]");
  55575   free(s);
  55576   terminateO(r);
  55577   terminateO(delim1);
  55578   terminateO(self);
  55579 
  55580 END_TEST
  55581 
  55582 
  55583 START_TEST(icExtractSSmallJsonSmallJsonGT)
  55584 
  55585   smallJsont* r;
  55586   smallJsont *self   = allocG(rtSmallJsont);
  55587   smallJsont* delim2 = allocSmallJson();
  55588 
  55589   setTopSO(self, "one/twos");
  55590   setTopSO(delim2, "S");
  55591   r = icExtractSSmallJsonSmallJsonG(self, "E", delim2);
  55592   ck_assert_ptr_ne(r, null);
  55593   char *s = toStringO(r);
  55594   ck_assert_str_eq(s, "[\"/two\"]");
  55595   free(s);
  55596   terminateO(r);
  55597   terminateO(delim2);
  55598   terminateO(self);
  55599 
  55600 END_TEST
  55601 
  55602 
  55603 START_TEST(icExtractSSmallStringSmallJsonGT)
  55604 
  55605   smallJsont* r;
  55606   smallJsont *self     = allocG(rtSmallJsont);
  55607   smallStringt* delim2 = allocSmallString("|");
  55608 
  55609   setTopSO(self, "one/twos");
  55610   setValO(delim2, "S");
  55611   r = icExtractSSmallStringSmallJsonG(self, "E", delim2);
  55612   ck_assert_ptr_ne(r, null);
  55613   char *s = toStringO(r);
  55614   ck_assert_str_eq(s, "[\"/two\"]");
  55615   free(s);
  55616   terminateO(r);
  55617   terminateO(delim2);
  55618   terminateO(self);
  55619 
  55620 END_TEST
  55621 
  55622 
  55623 START_TEST(icExtractCharSmallJsonSmallJsonGT)
  55624 
  55625   smallJsont* r;
  55626   smallJsont *self   = allocG(rtSmallJsont);
  55627   smallJsont* delim2 = allocSmallJson();
  55628 
  55629   setTopSO(self, "one/twos");
  55630   setTopSO(delim2, "S");
  55631   r = icExtractCharSmallJsonSmallJsonG(self, 'E', delim2);
  55632   ck_assert_ptr_ne(r, null);
  55633   char *s = toStringO(r);
  55634   ck_assert_str_eq(s, "[\"/two\"]");
  55635   free(s);
  55636   terminateO(r);
  55637   terminateO(delim2);
  55638   terminateO(self);
  55639 
  55640 END_TEST
  55641 
  55642 
  55643 START_TEST(icExtractCharSmallStringSmallJsonGT)
  55644 
  55645   smallJsont* r;
  55646   smallJsont *self     = allocG(rtSmallJsont);
  55647   smallStringt* delim2 = allocSmallString("|");
  55648 
  55649   setTopSO(self, "one/twos");
  55650   setValO(delim2, "S");
  55651   r = icExtractCharSmallStringSmallJsonG(self, 'E', delim2);
  55652   ck_assert_ptr_ne(r, null);
  55653   char *s = toStringO(r);
  55654   ck_assert_str_eq(s, "[\"/two\"]");
  55655   free(s);
  55656   terminateO(r);
  55657   terminateO(delim2);
  55658   terminateO(self);
  55659 
  55660 END_TEST
  55661 
  55662 
  55663 START_TEST(zipSmallJsonGT)
  55664 
  55665   smallJsont* r;
  55666   smallJsont *self = allocSmallJson();
  55667   smallArrayt *array1 = allocSmallArray();
  55668   smallArrayt *array2 = allocSmallArray();
  55669 
  55670   // zip arrays
  55671   // add an element to self
  55672   // array1 has 2 elements
  55673   // array2 has 3 elements
  55674   // only 2 elements are zipped
  55675   self->f->pushS(self, "qwe");
  55676   array1->f->pushS(array1, "a");
  55677   array1->f->pushS(array1, "b");
  55678   array2->f->pushInt(array2, 1);
  55679   array2->f->pushInt(array2, 2);
  55680   array2->f->pushInt(array2, 3);
  55681   r = zipSmallJsonG(self, array1, array2);
  55682   ck_assert_ptr_ne(r, NULL);
  55683   char *s = toStringO(r);
  55684   ck_assert_str_eq(s, "[\"qwe\",[\"a\",1],[\"b\",2]]");
  55685   free(s);
  55686   //    delete the element not in self
  55687   delElemO(array2, 2);
  55688   terminateO(self);
  55689   smashO(array1);
  55690   smashO(array2);
  55691 
  55692 END_TEST
  55693 
  55694 
  55695 START_TEST(zipArraySmallJsonGT)
  55696 
  55697   smallJsont* r;
  55698   smallJsont *self = allocSmallJson();
  55699   char** array1;
  55700   smallArrayt *array2 = allocSmallArray();
  55701 
  55702   self->f->pushS(self, "qwe");
  55703   array1  = listCreateS("a", "b");
  55704   array2->f->pushS(array2, "1");
  55705   array2->f->pushS(array2, "2");
  55706   r = zipArraySmallJsonG(self, array1, array2);
  55707   ck_assert_ptr_ne(r, NULL);
  55708   char *s = toStringO(r);
  55709   ck_assert_str_eq(s, "[\"qwe\",[\"a\",\"1\"],[\"b\",\"2\"]]");
  55710   free(s);
  55711   terminateO(self);
  55712   free(array1);
  55713   smashO(array2);
  55714 
  55715 END_TEST
  55716 
  55717 
  55718 START_TEST(zipCArraySmallJsonGT)
  55719 
  55720   smallJsont* r;
  55721   smallJsont *self    = allocSmallJson();
  55722   const char* array1[] = {"a", "b", null};
  55723   smallArrayt *array2  = allocSmallArray();
  55724 
  55725   self->f->pushS(self, "qwe");
  55726   array2->f->pushS(array2, "1");
  55727   array2->f->pushS(array2, "2");
  55728   r = zipCArraySmallJsonG(self, array1, array2);
  55729   ck_assert_ptr_ne(r, NULL);
  55730   char *s = toStringO(r);
  55731   ck_assert_str_eq(s, "[\"qwe\",[\"a\",\"1\"],[\"b\",\"2\"]]");
  55732   free(s);
  55733   terminateO(self);
  55734   smashO(array2);
  55735 
  55736 END_TEST
  55737 
  55738 
  55739 START_TEST(zipCharSmallJsonGT)
  55740 
  55741   smallJsont* r;
  55742   smallJsont *self   = allocSmallJson();
  55743   smallArrayt *array1 = allocSmallArray();
  55744   char** array2;
  55745 
  55746   self->f->pushS(self, "qwe");
  55747   array1->f->pushS(array1, "a");
  55748   array1->f->pushS(array1, "b");
  55749   array2  = listCreateS("1", "2");
  55750   r = zipCharSmallJsonG(self, array1, array2);
  55751   ck_assert_ptr_ne(r, NULL);
  55752   char *s = toStringO(r);
  55753   ck_assert_str_eq(s, "[\"qwe\",[\"a\",\"1\"],[\"b\",\"2\"]]");
  55754   free(s);
  55755   terminateO(self);
  55756   smashO(array1);
  55757   free(array2);
  55758 
  55759 END_TEST
  55760 
  55761 
  55762 START_TEST(zipCCharSmallJsonGT)
  55763 
  55764   smallJsont* r;
  55765   smallJsont *self    = allocSmallJson();
  55766   smallArrayt *array1  = allocSmallArray();
  55767   const char* array2[] = {"1", "2", "3", null};
  55768 
  55769   self->f->pushS(self, "qwe");
  55770   array1->f->pushS(array1, "a");
  55771   array1->f->pushS(array1, "b");
  55772   r = zipCCharSmallJsonG(self, array1, array2);
  55773   ck_assert_ptr_ne(r, NULL);
  55774   char *s = toStringO(r);
  55775   ck_assert_str_eq(s, "[\"qwe\",[\"a\",\"1\"],[\"b\",\"2\"]]");
  55776   free(s);
  55777   terminateO(self);
  55778   smashO(array1);
  55779 
  55780 END_TEST
  55781 
  55782 
  55783 START_TEST(zipArrayCharSmallJsonGT)
  55784 
  55785   smallJsont* r;
  55786   smallJsont *self = allocSmallJson();
  55787   char** array1;
  55788   char** array2;
  55789 
  55790   self->f->pushS(self, "qwe");
  55791   array1  = listCreateS("a", "b");
  55792   array2  = listCreateS("1", "2");
  55793   r = zipArrayCharSmallJsonG(self, array1, array2);
  55794   ck_assert_ptr_ne(r, NULL);
  55795   char *s = toStringO(r);
  55796   ck_assert_str_eq(s, "[\"qwe\",[\"a\",\"1\"],[\"b\",\"2\"]]");
  55797   free(s);
  55798   terminateO(self);
  55799   free(array1);
  55800   free(array2);
  55801 
  55802 END_TEST
  55803 
  55804 
  55805 START_TEST(zipArrayCCharSmallJsonGT)
  55806 
  55807   smallJsont* r;
  55808   smallJsont *self    = allocSmallJson();
  55809   char** array1;
  55810   const char* array2[] = {"1", "2", "3", null};
  55811 
  55812   self->f->pushS(self, "qwe");
  55813   array1  = listCreateS("a", "b");
  55814   r = zipArrayCCharSmallJsonG(self, array1, array2);
  55815   ck_assert_ptr_ne(r, NULL);
  55816   char *s = toStringO(r);
  55817   ck_assert_str_eq(s, "[\"qwe\",[\"a\",\"1\"],[\"b\",\"2\"]]");
  55818   free(s);
  55819   terminateO(self);
  55820   free(array1);
  55821 
  55822 END_TEST
  55823 
  55824 
  55825 START_TEST(zipCArrayCharSmallJsonGT)
  55826 
  55827   smallJsont* r;
  55828   smallJsont *self    = allocSmallJson();
  55829   const char* array1[] = {"a", "b", null};
  55830   char** array2;
  55831 
  55832   self->f->pushS(self, "qwe");
  55833   array2  = listCreateS("1", "2");
  55834   r = zipCArrayCharSmallJsonG(self, array1, array2);
  55835   ck_assert_ptr_ne(r, NULL);
  55836   char *s = toStringO(r);
  55837   ck_assert_str_eq(s, "[\"qwe\",[\"a\",\"1\"],[\"b\",\"2\"]]");
  55838   free(s);
  55839   terminateO(self);
  55840   free(array2);
  55841 
  55842 END_TEST
  55843 
  55844 
  55845 START_TEST(zipCArrayCCharSmallJsonGT)
  55846 
  55847   smallJsont* r;
  55848   smallJsont *self    = allocSmallJson();
  55849   const char* array1[] = {"a", "b", null};
  55850   const char* array2[] = {"1", "2", "3", null};
  55851 
  55852   self->f->pushS(self, "qwe");
  55853   r = zipCArrayCCharSmallJsonG(self, array1, array2);
  55854   ck_assert_ptr_ne(r, NULL);
  55855   char *s = toStringO(r);
  55856   ck_assert_str_eq(s, "[\"qwe\",[\"a\",\"1\"],[\"b\",\"2\"]]");
  55857   free(s);
  55858   terminateO(self);
  55859 
  55860 END_TEST
  55861 
  55862 
  55863 START_TEST(zipJsonSmallJsonGT)
  55864 
  55865   smallJsont* r;
  55866   smallJsont *self   = allocSmallJson();
  55867   smallJsont *keys   = allocSmallJson();
  55868   smallJsont *values = allocSmallJson();
  55869 
  55870   self->f->setInt(self, "", 1);
  55871   // 3 elements in keys
  55872   // 2 elements in values
  55873   // only 2 key/values are zipped
  55874   keys->f->pushS(keys, "a");
  55875   keys->f->pushS(keys, "b");
  55876   keys->f->pushS(keys, "c");
  55877   values->f->pushInt(values, 1);
  55878   values->f->pushInt(values, 2);
  55879   r = zipJsonSmallJsonG(self, keys, values);
  55880   terminateO(keys);
  55881   smashO(values);
  55882   ck_assert_ptr_ne(r, NULL);
  55883   char *s = toStringO(r);
  55884   ck_assert_str_eq(s, "{\"\":1,\"a\":1,\"b\":2}");
  55885   free(s);
  55886   terminateO(self);
  55887 
  55888 END_TEST
  55889 
  55890 
  55891 START_TEST(zipJsonSmallArraySmallJsonGT)
  55892 
  55893   smallJsont* r;
  55894   smallJsont *self    = allocSmallJson();
  55895   smallJsont *keys    = allocSmallJson();
  55896   smallArrayt *values = allocSmallArray();
  55897 
  55898   self->f->setInt(self, "", 1);
  55899   // 3 elements in keys
  55900   // 2 elements in values
  55901   // only 2 key/values are zipped
  55902   keys->f->pushS(keys, "a");
  55903   keys->f->pushS(keys, "b");
  55904   keys->f->pushS(keys, "c");
  55905   values->f->pushInt(values, 1);
  55906   values->f->pushInt(values, 2);
  55907   r = zipJsonSmallArraySmallJsonG(self, keys, values);
  55908   terminateO(keys);
  55909   smashO(values);
  55910   ck_assert_ptr_ne(r, NULL);
  55911   char *s = toStringO(r);
  55912   ck_assert_str_eq(s, "{\"\":1,\"a\":1,\"b\":2}");
  55913   free(s);
  55914   terminateO(self);
  55915 
  55916 END_TEST
  55917 
  55918 
  55919 START_TEST(zipJsonArraySmallJsonGT)
  55920 
  55921   smallJsont* r;
  55922   smallJsont *self = allocSmallJson();
  55923   smallJsont *keys = allocSmallJson();
  55924   char **values;
  55925 
  55926   self->f->setInt(self, "", 1);
  55927   // 3 elements in keys
  55928   // 2 elements in values
  55929   // only 2 key/values are zipped
  55930   keys->f->pushS(keys, "a");
  55931   keys->f->pushS(keys, "b");
  55932   keys->f->pushS(keys, "c");
  55933   values = listCreateS("1", "2");
  55934   r = zipJsonArraySmallJsonG(self, keys, values);
  55935   terminateO(keys);
  55936   listFreeS(values);
  55937   ck_assert_ptr_ne(r, NULL);
  55938   char *s = toStringO(r);
  55939   ck_assert_str_eq(s, "{\"\":1,\"a\":\"1\",\"b\":\"2\"}");
  55940   free(s);
  55941   terminateO(self);
  55942 
  55943 END_TEST
  55944 
  55945 
  55946 START_TEST(zipJsonCArraySmallJsonGT)
  55947 
  55948   smallJsont* r;
  55949   smallJsont *self     = allocG(rtSmallJsont);
  55950   smallJsont *keys     = allocSmallJson();
  55951   const char* values[] = {"1", "2", null};
  55952 
  55953   self->f->setInt(self, "", 1);
  55954   // 3 elements in keys
  55955   // 2 elements in values
  55956   // only 2 key/values are zipped
  55957   keys->f->pushS(keys, "a");
  55958   keys->f->pushS(keys, "b");
  55959   keys->f->pushS(keys, "c");
  55960   r = zipJsonCArraySmallJsonG(self, keys, values);
  55961   terminateO(keys);
  55962   ck_assert_ptr_ne(r, NULL);
  55963   char *s = toStringO(r);
  55964   ck_assert_str_eq(s, "{\"\":1,\"a\":\"1\",\"b\":\"2\"}");
  55965   free(s);
  55966   terminateO(self);
  55967 
  55968 END_TEST
  55969 
  55970 
  55971 START_TEST(zipSmallArrayJsonSmallJsonGT)
  55972 
  55973   smallJsont* r;
  55974   smallJsont *self   = allocSmallJson();
  55975   smallArrayt *keys  = allocSmallArray();
  55976   smallJsont *values = allocSmallJson();
  55977 
  55978   self->f->setInt(self, "", 1);
  55979   // 3 elements in keys
  55980   // 2 elements in values
  55981   // only 2 key/values are zipped
  55982   keys->f->pushS(keys, "a");
  55983   keys->f->pushS(keys, "b");
  55984   keys->f->pushS(keys, "c");
  55985   values->f->pushInt(values, 1);
  55986   values->f->pushInt(values, 2);
  55987   r = zipSmallArrayJsonSmallJsonG(self, keys, values);
  55988   terminateO(keys);
  55989   smashO(values);
  55990   ck_assert_ptr_ne(r, NULL);
  55991   char *s = toStringO(r);
  55992   ck_assert_str_eq(s, "{\"\":1,\"a\":1,\"b\":2}");
  55993   free(s);
  55994   terminateO(self);
  55995 
  55996 END_TEST
  55997 
  55998 
  55999 START_TEST(zipArrayJsonSmallJsonGT)
  56000 
  56001   smallJsont* r;
  56002   smallJsont *self   = allocSmallJson();
  56003   char** keys;
  56004   smallJsont *values = allocSmallJson();
  56005 
  56006   self->f->setInt(self, "", 1);
  56007   // 3 elements in keys
  56008   // 2 elements in values
  56009   // only 2 key/values are zipped
  56010   keys = listCreateS("a", "b", "c");
  56011   values->f->pushInt(values, 1);
  56012   values->f->pushInt(values, 2);
  56013   r = zipArrayJsonSmallJsonG(self, keys, values);
  56014   listFreeS(keys);
  56015   smashO(values);
  56016   ck_assert_ptr_ne(r, NULL);
  56017   char *s = toStringO(r);
  56018   ck_assert_str_eq(s, "{\"\":1,\"a\":1,\"b\":2}");
  56019   free(s);
  56020   terminateO(self);
  56021 
  56022 END_TEST
  56023 
  56024 
  56025 START_TEST(zipCArrayJsonSmallJsonGT)
  56026 
  56027   smallJsont* r;
  56028   smallJsont *self   = allocG(rtSmallJsont);
  56029   const char* keys[] = {"a", "b", "c", null};
  56030   smallJsont *values = allocSmallJson();
  56031 
  56032   self->f->setInt(self, "", 1);
  56033   // 3 elements in keys
  56034   // 2 elements in values
  56035   // only 2 key/values are zipped
  56036   values->f->pushInt(values, 1);
  56037   values->f->pushInt(values, 2);
  56038   r = zipCArrayJsonSmallJsonG(self, keys, values);
  56039   smashO(values);
  56040   ck_assert_ptr_ne(r, NULL);
  56041   char *s = toStringO(r);
  56042   ck_assert_str_eq(s, "{\"\":1,\"a\":1,\"b\":2}");
  56043   free(s);
  56044   terminateO(self);
  56045 
  56046 END_TEST
  56047 
  56048 
  56049 START_TEST(stringifySmallStringSmallJsonGT)
  56050 
  56051   smallStringt* r;
  56052   smallJsont *self = allocG(rtSmallJsont);
  56053 
  56054   self->f->setS(self, "\\\\", "\\erw\\\"");
  56055   r = stringifySmallStringSmallJsonG(self, 2);
  56056   ck_assert_ptr_ne(r, null);
  56057   char *s = toStringO(r);
  56058   terminateO(r);
  56059   ck_assert_str_eq(s, "{\n  \"\\\\\": \"\\\\erw\\\\\\\"\"\n}\n");
  56060   free(s);
  56061   terminateO(self);
  56062 
  56063 END_TEST
  56064 
  56065 
  56066 START_TEST(toYMLSmallStringSmallJsonGT)
  56067 
  56068   smallStringt* r;
  56069   smallJsont *self = allocG(rtSmallJsont);
  56070 
  56071   self->f->pushS(self, "qwe");
  56072   r = toYMLSmallStringSmallJsonG(self, 2);
  56073   ck_assert_ptr_ne(r, null);
  56074   char *s = toStringO(r);
  56075   ck_assert_str_eq(s, "---\n  - qwe\n");
  56076   free(s);
  56077   terminateO(r);
  56078   terminateO(self);
  56079 
  56080 END_TEST
  56081 
  56082 
  56083 START_TEST(parseSmallJsonGT)
  56084 
  56085   bool r;
  56086   smallJsont *self = allocG(rtSmallJsont);
  56087 
  56088   r = parseSmallJsonG(self, "true");
  56089   ck_assert(r);
  56090   char *s = toStringO(self);
  56091   ck_assert_str_eq(s, "true");
  56092   free(s);
  56093   terminateO(self);
  56094 
  56095 END_TEST
  56096 
  56097 
  56098 START_TEST(parseSmallJsonSmallJsonGT)
  56099 
  56100   bool r;
  56101   smallJsont *self  = allocG(rtSmallJsont);
  56102   smallJsont *input = allocSmallJson();
  56103 
  56104   // non json string
  56105   r = parseSmallJsonSmallJsonG(self, input);
  56106   ck_assert(!r);
  56107   // json string
  56108   setTopSO(input, "true");
  56109   r = parseSmallJsonSmallJsonG(self, input);
  56110   ck_assert(r);
  56111   terminateO(input);
  56112   char *s = toStringO(self);
  56113   ck_assert_str_eq(s, "true");
  56114   free(s);
  56115   terminateO(self);
  56116 
  56117 END_TEST
  56118 
  56119 
  56120 START_TEST(parseSmallStringSmallJsonGT)
  56121 
  56122   bool r;
  56123   smallJsont *self    = allocG(rtSmallJsont);
  56124   smallStringt *input = allocSmallString("true");
  56125 
  56126   // string
  56127   r = parseSmallStringSmallJsonG(self, input);
  56128   ck_assert(r);
  56129   terminateO(input);
  56130   char *s = toStringO(self);
  56131   ck_assert_str_eq(s, "true");
  56132   free(s);
  56133   terminateO(self);
  56134 
  56135 END_TEST
  56136 
  56137 
  56138 START_TEST(parseYMLSmallJsonGT)
  56139 
  56140   bool r;
  56141   smallJsont *self = allocG(rtSmallJsont);
  56142 
  56143   //r = parseYMLSmallJsonG(self);
  56144   r = parseYMLSmallJsonG(self, "---\n - qwe");
  56145   ck_assert(r);
  56146   char *s = toStringO(self);
  56147   ck_assert_str_eq(s, "[\"qwe\"]");
  56148   free(s);
  56149   terminateO(self);
  56150 
  56151 END_TEST
  56152 
  56153 
  56154 START_TEST(parseYMLSmallJsonSmallJsonGT)
  56155 
  56156   bool r;
  56157   smallJsont *self  = allocG(rtSmallJsont);
  56158   smallJsont *input = allocSmallJson();
  56159 
  56160   // non json string
  56161   r = parseYMLSmallJsonSmallJsonG(self, input);
  56162   ck_assert(!r);
  56163   // json string
  56164   setTopSO(input, "---\n - qwe");
  56165   r = parseYMLSmallJsonSmallJsonG(self, input);
  56166   ck_assert(r);
  56167   terminateO(input);
  56168   char *s = toStringO(self);
  56169   ck_assert_str_eq(s, "[\"qwe\"]");
  56170   free(s);
  56171   terminateO(self);
  56172 
  56173 END_TEST
  56174 
  56175 
  56176 START_TEST(parseYMLSmallStringSmallJsonGT)
  56177 
  56178   bool r;
  56179   smallJsont *self    = allocG(rtSmallJsont);
  56180   smallStringt *input = allocSmallString("---\n - qwe");
  56181 
  56182   // string
  56183   r = parseYMLSmallStringSmallJsonG(self, input);
  56184   ck_assert(r);
  56185   terminateO(input);
  56186   char *s = toStringO(self);
  56187   ck_assert_str_eq(s, "[\"qwe\"]");
  56188   free(s);
  56189   terminateO(self);
  56190 
  56191 END_TEST
  56192 
  56193 
  56194 START_TEST(logSmallJsonGT)
  56195 
  56196   smallJsont *self = allocSmallJson();
  56197 
  56198   self->f->pushS(self, "qwe");
  56199   self->f->pushS(self, "asd");
  56200   delElemIndexO(self, 0);
  56201   logSmallJsonG(self);
  56202   terminateO(self);
  56203 
  56204 END_TEST
  56205 
  56206 
  56207 START_TEST(readFileSmallJsonGT)
  56208 
  56209   smallJsont *self = allocG(rtSmallJsont);
  56210 
  56211   self->f->setS(self, "key", "value");
  56212   writeFileO(self, "read.JSON");
  56213   freeO(self);
  56214   ck_assert_ptr_ne(readFileSmallJsonG(self, "read.JSON"), null);
  56215   rmAll("read.JSON");
  56216   char *s = toStringO(self);
  56217   ck_assert_str_eq(s, "{\"key\":\"value\"}");
  56218   free(s);
  56219   terminateO(self);
  56220 
  56221 END_TEST
  56222 
  56223 
  56224 START_TEST(readFileSmallStringSmallJsonGT)
  56225 
  56226   smallJsont *self = allocG(rtSmallJsont);
  56227   smallStringt *filePath = allocSmallString("read.json");
  56228 
  56229   self->f->setS(self, "key", "value");
  56230   writeFileO(self, "read.json");
  56231   freeO(self);
  56232   ck_assert_ptr_ne(readFileSmallStringSmallJsonG(self, filePath), null);
  56233   char *s = toStringO(self);
  56234   ck_assert_str_eq(s, "{\"key\":\"value\"}");
  56235   free(s);
  56236   rmAll("read.json");
  56237   terminateO(filePath);
  56238   terminateO(self);
  56239 
  56240 END_TEST
  56241 
  56242 
  56243 START_TEST(readFileJsonSmallJsonGT)
  56244 
  56245   smallJsont *self     = allocG(rtSmallJsont);
  56246   smallJsont *filePath = allocSmallJson();
  56247 
  56248   setTopSO(filePath, "read.json");
  56249   self->f->setS(self, "key", "value");
  56250   writeFileO(self, "read.json");
  56251   freeO(self);
  56252   ck_assert_ptr_ne(readFileJsonSmallJsonG(self, filePath), null);
  56253   char *s = toStringO(self);
  56254   ck_assert_str_eq(s, "{\"key\":\"value\"}");
  56255   free(s);
  56256   rmAll("read.json");
  56257   terminateO(filePath);
  56258   terminateO(self);
  56259 
  56260 END_TEST
  56261 
  56262 
  56263 START_TEST(readStreamSmallJsonGT)
  56264 
  56265   smallJsont* r;
  56266   smallJsont *self = allocG(rtSmallJsont);
  56267   FILE *fp;
  56268 
  56269   // stream
  56270   fp = fopen("file.json", "r");
  56271   r = readStreamSmallJsonG(self, fp);
  56272   fclose(fp);
  56273   ck_assert_ptr_ne(r, NULL);
  56274   char *s = toStringO(r);
  56275   ck_assert_str_eq(s, "{\"dasd\":\"asd\",\"asd\":234,\"dict\":{\"array\":[1,1],\"asd\":true,\"float\":3.434000e+01},\"bool\":false,\"zzz\":null}");
  56276   free(s);
  56277   terminateO(self);
  56278 
  56279 END_TEST
  56280 
  56281 
  56282 START_TEST(writeFileSmallJsonGT)
  56283 
  56284   int r;
  56285   smallJsont *self = allocG(rtSmallJsont);
  56286 
  56287   self->f->setInt(self, "", 1);
  56288   self->f->setInt(self, "b", 2);
  56289   r = writeFileSmallJsonG(self, "smallDictFile.json");
  56290   ck_assert(r);
  56291   ck_assert(fileExists("smallDictFile.json"));
  56292   char *s = readFileToS("smallDictFile.json");
  56293   ck_assert_str_eq(s, "{\n  \"\": 1,\n  \"b\": 2\n}\n");
  56294   free(s);
  56295   rmAll("smallDictFile.json");
  56296   terminateO(self);
  56297 
  56298 END_TEST
  56299 
  56300 
  56301 START_TEST(writeFileSmallStringSmallJsonGT)
  56302 
  56303   bool        r;
  56304   smallJsont *self = allocSmallJson();
  56305   smallStringt *filePath = allocSmallString("smallDictFile.json");
  56306 
  56307   self->f->setInt(self, "", 1);
  56308   self->f->setInt(self, "b", 2);
  56309   r = writeFileSmallStringSmallJsonG(self, filePath);
  56310   ck_assert(r);
  56311   ck_assert(fileExists("smallDictFile.json"));
  56312   char *s = readFileToS("smallDictFile.json");
  56313   ck_assert_str_eq(s, "{\n  \"\": 1,\n  \"b\": 2\n}\n");
  56314   free(s);
  56315   rmAll("smallDictFile.json");
  56316   terminateO(filePath);
  56317   terminateO(self);
  56318 
  56319 END_TEST
  56320 
  56321 
  56322 START_TEST(writeFileJsonSmallJsonGT)
  56323 
  56324   bool        r;
  56325   smallJsont *self     = allocSmallJson();
  56326   smallJsont *filePath = allocSmallJson();
  56327 
  56328   self->f->setInt(self, "", 1);
  56329   self->f->setInt(self, "b", 2);
  56330   setTopSO(filePath, "smallDictFile.json");
  56331   r = writeFileJsonSmallJsonG(self, filePath);
  56332   ck_assert(r);
  56333   ck_assert(fileExists("smallDictFile.json"));
  56334   char *s = readFileToS("smallDictFile.json");
  56335   ck_assert_str_eq(s, "{\n  \"\": 1,\n  \"b\": 2\n}\n");
  56336   free(s);
  56337   rmAll("smallDictFile.json");
  56338   terminateO(filePath);
  56339   terminateO(self);
  56340 
  56341 END_TEST
  56342 
  56343 
  56344 START_TEST(writeStreamSmallJsonGT)
  56345 
  56346   int r;
  56347   smallJsont *self = allocG(rtSmallJsont);
  56348   FILE *fp;
  56349 
  56350   // write textOutTest.null
  56351   fp = fopen("file.json", "r");
  56352   smallJsont *r2 = readStreamO(self, fp);
  56353   fclose(fp);
  56354   ck_assert_ptr_ne(r2, NULL);
  56355   fp = fopen("outTest.json", "w");
  56356   r = writeStreamSmallJsonG(self, fp);
  56357   ck_assert(r);
  56358   fclose(fp);
  56359     // check textOutTest.null
  56360   fp = fopen("outTest.json", "r");
  56361   r2 = readStreamO(self, fp);
  56362   fclose(fp);
  56363   ck_assert_ptr_ne(r2, NULL);
  56364   char *s = toStringO(r2);
  56365   ck_assert_str_eq(s, "{\"dasd\":\"asd\",\"asd\":234,\"dict\":{\"array\":[1,1],\"asd\":true,\"float\":3.434000e+01},\"bool\":false,\"zzz\":null}");
  56366   free(s);
  56367   rmAll("outTest.json");
  56368   terminateO(self);
  56369 
  56370 END_TEST
  56371 
  56372 
  56373 START_TEST(appendFileSmallJsonGT)
  56374 
  56375   bool        r;
  56376   smallJsont *self = allocSmallJson();
  56377 
  56378   self->f->setInt(self, "", 1);
  56379   self->f->setInt(self, "b", 2);
  56380   writeFileS("smallDictFile.json", "-");
  56381   r = appendFileSmallJsonG(self, "smallDictFile.json");
  56382   ck_assert(r);
  56383   ck_assert(fileExists("smallDictFile.json"));
  56384   char *s = readFileToS("smallDictFile.json");
  56385   ck_assert_str_eq(s, "-{\n  \"\": 1,\n  \"b\": 2\n}\n");
  56386   free(s);
  56387   rmAll("smallDictFile.json");
  56388   terminateO(self);
  56389 
  56390 END_TEST
  56391 
  56392 
  56393 START_TEST(appendFileSmallStringSmallJsonGT)
  56394 
  56395   bool        r;
  56396   smallJsont *self       = allocSmallJson();
  56397   smallStringt *filePath = allocSmallString("smallDictFile.json");
  56398 
  56399   self->f->setInt(self, "", 1);
  56400   self->f->setInt(self, "b", 2);
  56401   writeFileS("smallDictFile.json", "-");
  56402   r = appendFileSmallStringSmallJsonG(self, filePath);
  56403   ck_assert(r);
  56404   ck_assert(fileExists("smallDictFile.json"));
  56405   char *s = readFileToS("smallDictFile.json");
  56406   ck_assert_str_eq(s, "-{\n  \"\": 1,\n  \"b\": 2\n}\n");
  56407   free(s);
  56408   rmAll("smallDictFile.json");
  56409   terminateO(filePath);
  56410   terminateO(self);
  56411 
  56412 END_TEST
  56413 
  56414 
  56415 START_TEST(appendFileJsonSmallJsonGT)
  56416 
  56417   int r;
  56418   smallJsont *self     = allocG(rtSmallJsont);
  56419   smallJsont *filePath = allocSmallJson();
  56420 
  56421   setTopSO(filePath, "smallDictFile.json");
  56422   self->f->setInt(self, "", 1);
  56423   self->f->setInt(self, "b", 2);
  56424   writeFileS("smallDictFile.json", "-");
  56425   r = appendFileJsonSmallJsonG(self, filePath);
  56426   ck_assert(r);
  56427   ck_assert(fileExists("smallDictFile.json"));
  56428   char *s = readFileToS("smallDictFile.json");
  56429   ck_assert_str_eq(s, "-{\n  \"\": 1,\n  \"b\": 2\n}\n");
  56430   free(s);
  56431   rmAll("smallDictFile.json");
  56432   terminateO(filePath);
  56433   terminateO(self);
  56434 
  56435 END_TEST
  56436 
  56437 
  56438 START_TEST(readTextSmallJsonGT)
  56439 
  56440   smallJsont* r;
  56441   smallJsont *self = allocSmallJson();
  56442 
  56443   r = readTextSmallJsonG(self, "../textTest.null");
  56444   ck_assert_ptr_ne(r, NULL);
  56445   char *s = toStringO(r);
  56446   ck_assert_str_eq(s, "[\"LINE 1\",\"ANOTHER line\"]");
  56447   free(s);
  56448   terminateO(self);
  56449 
  56450 END_TEST
  56451 
  56452 
  56453 START_TEST(readTextSmallStringSmallJsonGT)
  56454 
  56455   smallJsont* r;
  56456   smallJsont *self       = allocSmallJson();
  56457   smallStringt *filePath = allocSmallString("");
  56458 
  56459   // text
  56460   setValO(filePath, "../textTest.null");
  56461   r = readTextSmallStringSmallJsonG(self, filePath);
  56462   ck_assert_ptr_ne(r, NULL);
  56463   char *s = toStringO(r);
  56464   ck_assert_str_eq(s, "[\"LINE 1\",\"ANOTHER line\"]");
  56465   free(s);
  56466   terminateO(self);
  56467   terminateO(filePath);
  56468 
  56469 END_TEST
  56470 
  56471 
  56472 START_TEST(readTextJsonSmallJsonGT)
  56473 
  56474   smallJsont* r;
  56475   smallJsont *self     = allocG(rtSmallJsont);
  56476   smallJsont *filePath = allocSmallJson();
  56477 
  56478   // text
  56479   setTopSO(filePath, "../textTest.null");
  56480   r = readTextJsonSmallJsonG(self, filePath);
  56481   ck_assert_ptr_ne(r, NULL);
  56482   char *s = toStringO(r);
  56483   ck_assert_str_eq(s, "[\"LINE 1\",\"ANOTHER line\"]");
  56484   free(s);
  56485   terminateO(filePath);
  56486   terminateO(self);
  56487 
  56488 END_TEST
  56489 
  56490 
  56491 START_TEST(readTextStreamSmallJsonGT)
  56492 
  56493   smallJsont* r;
  56494   smallJsont *self = allocG(rtSmallJsont);
  56495   FILE *fp;
  56496 
  56497   fp = fopen("../textTest.null", "r");
  56498   r = readTextStreamSmallJsonG(self, fp);
  56499   fclose(fp);
  56500   ck_assert_ptr_ne(r, NULL);
  56501   char *s = toStringO(r);
  56502   ck_assert_str_eq(s, "[\"LINE 1\",\"ANOTHER line\"]");
  56503   free(s);
  56504   terminateO(self);
  56505 
  56506 END_TEST
  56507 
  56508 
  56509 START_TEST(writeTextSmallJsonGT)
  56510 
  56511   bool r;
  56512   smallJsont *self = allocSmallJson();
  56513 
  56514   smallJsont *r2 = readTextO(self, "../textTest.null");
  56515   ck_assert_ptr_ne(r2, NULL);
  56516   r = writeTextSmallJsonG(self, "../textOutTest.null");
  56517   ck_assert(r);
  56518     // check textOutTest.null
  56519   emptyO(self);
  56520   r2 = readTextO(self, "../textOutTest.null");
  56521   ck_assert_ptr_ne(r2, NULL);
  56522   char *s = toStringO(r2);
  56523   ck_assert_str_eq(s, "[\"LINE 1\",\"ANOTHER line\"]");
  56524   free(s);
  56525   rmAll("../textOutTest.null");
  56526   terminateO(self);
  56527 
  56528 END_TEST
  56529 
  56530 
  56531 START_TEST(writeTextSmallStringSmallJsonGT)
  56532 
  56533   bool r;
  56534   smallJsont *self      = allocSmallJson();
  56535   smallStringt *filePath = allocSmallString("");
  56536 
  56537   // write textOutTest.null
  56538   smallJsont *r2 = readTextO(self, "../textTest.null");
  56539   ck_assert_ptr_ne(r2, NULL);
  56540   setValO(filePath, "../textOutTest.null");
  56541   r = writeTextSmallStringSmallJsonG(self, filePath);
  56542   ck_assert(r);
  56543     // check textOutTest.null
  56544   emptyO(self);
  56545   r2 = readTextO(self, "../textOutTest.null");
  56546   ck_assert_ptr_ne(r2, NULL);
  56547   char *s = toStringO(r2);
  56548   ck_assert_str_eq(s, "[\"LINE 1\",\"ANOTHER line\"]");
  56549   free(s);
  56550   rmAll("../textOutTest.null");
  56551   terminateO(self);
  56552   terminateO(filePath);
  56553 
  56554 END_TEST
  56555 
  56556 
  56557 START_TEST(writeTextJsonSmallJsonGT)
  56558 
  56559   bool r;
  56560   smallJsont *self     = allocG(rtSmallJsont);
  56561   smallJsont *filePath = allocSmallJson();
  56562 
  56563   // write textOutTest.null
  56564   smallJsont *r2 = readTextO(self, "../textTest.null");
  56565   ck_assert_ptr_ne(r2, NULL);
  56566   freeO(filePath);
  56567   setTopSO(filePath, "../textOutTest.null");
  56568   r = writeTextJsonSmallJsonG(self, filePath);
  56569   ck_assert(r);
  56570     // check textOutTest.null
  56571   emptyO(self);
  56572   r2 = readTextO(self, "../textOutTest.null");
  56573   ck_assert_ptr_ne(r2, NULL);
  56574   char *s = toStringO(r2);
  56575   ck_assert_str_eq(s, "[\"LINE 1\",\"ANOTHER line\"]");
  56576   free(s);
  56577   rmAll("../textOutTest.null");
  56578   terminateO(filePath);
  56579   terminateO(self);
  56580 
  56581 END_TEST
  56582 
  56583 
  56584 START_TEST(writeTextStreamSmallJsonGT)
  56585 
  56586   bool r;
  56587   smallJsont *self = allocG(rtSmallJsont);
  56588   FILE *fp;
  56589 
  56590   // non json array
  56591   fp = fopen("../textTest.null", "r");
  56592   r = writeTextStreamSmallJsonG(self, fp);
  56593   ck_assert(!r);
  56594   // write textOutTest.null
  56595   smallJsont *r2 = self->f->readTextStream(self, fp);
  56596   fclose(fp);
  56597   ck_assert_ptr_ne(r2, NULL);
  56598   fp = fopen("../textOutTest.null", "w");
  56599   r = writeTextStreamSmallJsonG(self, fp);
  56600   fclose(fp);
  56601   ck_assert(r);
  56602   rmAll("../textOutTest.null");
  56603   terminateO(self);
  56604 
  56605 END_TEST
  56606 
  56607 
  56608 START_TEST(appendTextSmallStringSmallJsonGT)
  56609 
  56610   bool r;
  56611   smallJsont *self       = allocSmallJson();
  56612   smallStringt *filePath = allocSmallString("");
  56613 
  56614   // append to textOutTest.null
  56615   smallJsont *r2 = readTextO(self, "../textTest.null");
  56616   ck_assert_ptr_ne(r2, NULL);
  56617   r = writeTextO(self, "../textOutTest.null");
  56618   ck_assert(r);
  56619   emptyO(self);
  56620   self->f->pushS(self, "A");
  56621   self->f->pushS(self, "B");
  56622   setValO(filePath, "../textOutTest.null");
  56623   r = appendTextSmallStringSmallJsonG(self, filePath);
  56624     // check textOutTest.null
  56625   emptyO(self);
  56626   r2 = readTextO(self, "../textOutTest.null");
  56627   char *s = toStringO(r2);
  56628   ck_assert_str_eq(s, "[\"LINE 1\",\"ANOTHER line\",\"A\",\"B\"]");
  56629   free(s);
  56630   terminateO(self);
  56631   terminateO(filePath);
  56632 
  56633 END_TEST
  56634 
  56635 
  56636 START_TEST(appendTextJsonSmallJsonGT)
  56637 
  56638   bool r;
  56639   smallJsont *self     = allocG(rtSmallJsont);
  56640   smallJsont *filePath = allocSmallJson();
  56641 
  56642   // append to textOutTest.null
  56643   smallJsont *r2 = readTextO(self, "../textTest.null");
  56644   ck_assert_ptr_ne(r2, NULL);
  56645   r = writeTextO(self, "../textOutTest.null");
  56646   ck_assert(r);
  56647   emptyO(self);
  56648   self->f->pushS(self, "A");
  56649   self->f->pushS(self, "B");
  56650   freeO(filePath);
  56651   setTopSO(filePath, "../textOutTest.null");
  56652   r = appendTextJsonSmallJsonG(self, filePath);
  56653     // check textOutTest.null
  56654   emptyO(self);
  56655   r2 = readTextO(self, "../textOutTest.null");
  56656   ck_assert_ptr_ne(r2, NULL);
  56657   char *s = toStringO(r2);
  56658   ck_assert_str_eq(s, "[\"LINE 1\",\"ANOTHER line\",\"A\",\"B\"]");
  56659   free(s);
  56660   rmAll("../textOutTest.null");
  56661   terminateO(filePath);
  56662   terminateO(self);
  56663 
  56664 END_TEST
  56665 
  56666 
  56667 START_TEST(cSmallJsonT)
  56668 
  56669   // local object
  56670   createSmallJson(obj);
  56671   ck_assert_str_eq(obj.type, "smallJson");
  56672   // object
  56673   createAllocateSmallJson(obj2);
  56674   ck_assert_str_eq(obj2->type, "smallJson");
  56675   // toString
  56676   char *s = obj2->f->toString(obj2);
  56677   ck_assert_str_eq(s, "{}");
  56678   free(s);
  56679   createAllocateSmallInt(oInt);
  56680   oInt->f->set(oInt, 123);
  56681   obj2->f->set(obj2, "int", (baset *) oInt);
  56682   finishO(oInt);
  56683   initiateAllocateSmallInt(&oInt);
  56684   oInt->f->set(oInt, 123);
  56685   obj2->f->set(obj2, "int2", (baset *) oInt);
  56686   finishO(oInt);
  56687     // no effect - no push to dictionary
  56688   initiateAllocateSmallInt(&oInt);
  56689   obj2->f->push(obj2, (baset *) oInt);
  56690   finishO(oInt);
  56691   s = obj2->f->toString(obj2);
  56692   ck_assert_str_eq(s, "{\"int\":123,\"int2\":123}");
  56693   free(s);
  56694   terminateO(obj2);
  56695   initiateAllocateSmallJson(&obj2);
  56696   smallJsont *r = obj2->f->push(obj2, null);
  56697   ck_assert_ptr_eq(r, null);
  56698   createAllocateSmallInt(oInt2);
  56699   oInt2->f->set(oInt2, 123);
  56700   obj2->f->push(obj2, (baset *) oInt2);
  56701   finishO(oInt2);
  56702   initiateAllocateSmallInt(&oInt2);
  56703   oInt2->f->set(oInt2, 123);
  56704   obj2->f->push(obj2, (baset *) oInt2);
  56705   finishO(oInt2);
  56706     // no effect - no set with key to array
  56707   initiateAllocateSmallInt(&oInt2);
  56708   obj2->f->set(obj2, "noEffect", (baset *) oInt2);
  56709   finishO(oInt2);
  56710   s = obj2->f->toString(obj2);
  56711   ck_assert_str_eq(s, "[123,123]");
  56712   free(s);
  56713   // duplicate
  56714   smallJsont *o;
  56715   o = obj2->f->duplicate(obj2);
  56716   s = toStringO(o);
  56717   ck_assert_str_eq(s, "[123,123]");
  56718   free(s);
  56719   terminateO(o);
  56720   terminateO(obj2);
  56721   initiateAllocateSmallJson(&obj2);
  56722   createAllocateSmallInt(oInt3);
  56723   oInt3->f->set(oInt3, 123);
  56724   obj2->f->set(obj2, "int", (baset *) oInt3);
  56725   finishO(oInt3);
  56726   o = obj2->f->duplicate(obj2);
  56727   s = toStringO(o);
  56728   ck_assert_str_eq(s, "{\"int\":123}");
  56729   free(s);
  56730   terminateO(o);
  56731   // dispose
  56732     // array
  56733   initiateAllocateSmallJson(&o);
  56734   initiateAllocateSmallInt(&oInt);
  56735   oInt->f->set(oInt, 123);
  56736   o->f->push(o, (baset*)oInt);
  56737   finishO(oInt);
  56738   ck_assert_uint_eq(o->topA->count, 1);
  56739   smallt *i = sArrayGetTiny(o->topA, 0);
  56740   o->f->dispose(o);
  56741   ck_assert_ptr_eq(o->topA, NULL);
  56742   sFree(i);
  56743   terminateO(o);
  56744     // dictionary
  56745   initiateAllocateSmallJson(&o);
  56746   initiateAllocateSmallInt(&oInt);
  56747   oInt->f->set(oInt, 123);
  56748   o->f->set(o, "in", (baset*)oInt);
  56749   finishO(oInt);
  56750   ck_assert_uint_eq(o->top->count, 1);
  56751   smallt *data = o->top->elements.data;
  56752   sFree(data);
  56753   o->f->dispose(o);
  56754   ck_assert_ptr_eq(o->top, NULL);
  56755   terminateO(o);
  56756   // smash
  56757   initiateAllocateSmallJson(&o);
  56758     // array
  56759   initiateAllocateSmallInt(&oInt);
  56760   oInt->f->set(oInt, 123);
  56761   o->f->push(o, (baset*)oInt);
  56762   finishO(oInt);
  56763   ck_assert_uint_eq(o->topA->count, 1);
  56764   i = sArrayGetTiny(o->topA, 0);
  56765   o->f->smash(&o);
  56766   ck_assert_ptr_eq(o, NULL);
  56767   sFree(i);
  56768     // dict
  56769   initiateAllocateSmallJson(&o);
  56770   initiateAllocateSmallInt(&oInt);
  56771   oInt->f->set(oInt, 123);
  56772   o->f->set(o, "in", (baset*)oInt);
  56773   finishO(oInt);
  56774   ck_assert_uint_eq(o->top->count, 1);
  56775   data = o->top->elements.data;
  56776   sFree(data);
  56777   o->f->smash(&o);
  56778   ck_assert_ptr_eq(o, NULL);
  56779   // setType*
  56780   initiateAllocateSmallJson(&o);
  56781   o->f->setTypeUndefined(o);
  56782   ck_assert_str_eq(o->f->getTopType(o), "undefined");
  56783   o->f->setTypeBool(o);
  56784   ck_assert_str_eq(o->f->getTopType(o), "bool");
  56785   o->f->setTypeDouble(o);
  56786   ck_assert_str_eq(o->f->getTopType(o), "double");
  56787   o->f->setTypeInt(o);
  56788   ck_assert_str_eq(o->f->getTopType(o), "int");
  56789   o->f->setTypeString(o);
  56790   ck_assert_str_eq(o->f->getTopType(o), "string");
  56791   o->f->setTypeDict(o);
  56792   ck_assert_str_eq(o->f->getTopType(o), "dict");
  56793   o->f->setTypeArray(o);
  56794   ck_assert_str_eq(o->f->getTopType(o), "array");
  56795   terminateO(o);
  56796   // getTopTypeJson setTopJson getTopJson - undefined bool double int string
  56797   baset *b;
  56798   smallJsont *o2;
  56799   initiateAllocateSmallJson(&o);
  56800   ck_assert_ptr_eq(o->f->getTopType(o), NULL);
  56801     // non json object
  56802   createAllocateSmallContainer(jcontainer);
  56803       // setTop
  56804         // null value
  56805   ck_assert_ptr_eq(o->f->setTop(o, null), null);
  56806   o->f->setTop(o, (baset *)jcontainer);
  56807   terminateO(jcontainer);
  56808   ck_assert_ptr_eq(o->f->getTopType(o), NULL);
  56809       // getTop
  56810   b = o->f->getTop(o);
  56811   ck_assert_ptr_eq(b, NULL);
  56812     // undefined
  56813   createAllocateUndefined(jUndef);
  56814       // setTop
  56815   o->f->setTop(o, (baset *)jUndef);
  56816   finishO(jUndef);
  56817       // getTopType
  56818   ck_assert_str_eq(o->f->getTopType(o), "undefined");
  56819       // getTop
  56820   b = o->f->getTop(o);
  56821   ck_assert_str_eq(b->type, "undefined");
  56822   finishO(b);
  56823       // duplicateO
  56824   o2 = duplicateO(o);
  56825       // toStringO
  56826   s  = toStringO(o2);
  56827   ck_assert_str_eq(s, "null");
  56828   free(s);
  56829       // stringify
  56830   s = o->f->stringify(o,2);
  56831   ck_assert_str_eq(s, "null");
  56832   free(s);
  56833       // toYML
  56834   s = o->f->toYML(o,2);
  56835   ck_assert_str_eq(s, "---\n  null");
  56836   free(s);
  56837       // smash
  56838   o2->f->smash(&o2);
  56839       // freeO
  56840   freeO(o);
  56841   ck_assert_ptr_eq(o->f->getTopType(o), NULL);
  56842   terminateO(o);
  56843     // cBool
  56844   initiateAllocateSmallJson(&o);
  56845   createAllocateSmallBool(jBool);
  56846       // setTop
  56847   o->f->setTop(o, (baset *)jBool);
  56848   finishO(jBool);
  56849       // getTopType
  56850   ck_assert_str_eq(o->f->getTopType(o), "bool");
  56851       // getTop
  56852   b = o->f->getTop(o);
  56853   ck_assert_str_eq(b->type, "smallBool");
  56854   finishO(b);
  56855       // duplicateO
  56856   o2 = duplicateO(o);
  56857       // toStringO
  56858   s  = toStringO(o2);
  56859   ck_assert_str_eq(s, "false");
  56860   free(s);
  56861       // stringify
  56862   s = o->f->stringify(o,2);
  56863   ck_assert_str_eq(s, "false");
  56864   free(s);
  56865       // toYML
  56866   s = o->f->toYML(o,2);
  56867   ck_assert_str_eq(s, "---\n  false");
  56868   free(s);
  56869       // smash
  56870   o2->f->smash(&o2);
  56871       // freeO
  56872   freeO(o);
  56873   ck_assert_ptr_eq(o->f->getTopType(o), NULL);
  56874   terminateO(o);
  56875     // cDouble
  56876   initiateAllocateSmallJson(&o);
  56877   createAllocateSmallDouble(jDouble);
  56878       // setTop
  56879   o->f->setTop(o, (baset *)jDouble);
  56880   finishO(jDouble);
  56881       // getTopType
  56882   ck_assert_str_eq(o->f->getTopType(o), "double");
  56883       // getTop
  56884   b = o->f->getTop(o);
  56885   ck_assert_str_eq(b->type, "smallDouble");
  56886   finishO(b);
  56887       // duplicateO
  56888   o2 = duplicateO(o);
  56889       // toStringO
  56890   s  = toStringO(o2);
  56891   ck_assert_str_eq(s, "0.000000e+00");
  56892   free(s);
  56893       // stringify
  56894   s = o->f->stringify(o,2);
  56895   ck_assert_str_eq(s, "0.000000e+00");
  56896   free(s);
  56897       // toYML
  56898   s = o->f->toYML(o,2);
  56899   ck_assert_str_eq(s, "---\n  0.000000e+00");
  56900   free(s);
  56901       // smash
  56902   o2->f->smash(&o2);
  56903       // freeO
  56904   freeO(o);
  56905   ck_assert_ptr_eq(o->f->getTopType(o), NULL);
  56906   terminateO(o);
  56907     // cInt
  56908   initiateAllocateSmallJson(&o);
  56909   createAllocateSmallInt(jInt);
  56910       // setTop
  56911   o->f->setTop(o, (baset *)jInt);
  56912   finishO(jInt);
  56913       // getTopType
  56914   ck_assert_str_eq(o->f->getTopType(o), "int");
  56915       // getTop
  56916   b = o->f->getTop(o);
  56917   ck_assert_str_eq(b->type, "smallInt");
  56918   finishO(b);
  56919       // duplicateO
  56920   o2 = duplicateO(o);
  56921       // toStringO
  56922   s  = toStringO(o2);
  56923   ck_assert_str_eq(s, "0");
  56924   free(s);
  56925       // stringify
  56926   s = o->f->stringify(o,2);
  56927   ck_assert_str_eq(s, "0");
  56928   free(s);
  56929       // toYML
  56930   s = o->f->toYML(o,2);
  56931   ck_assert_str_eq(s, "---\n  0");
  56932   free(s);
  56933       // smash
  56934   o2->f->smash(&o2);
  56935       // freeO
  56936   freeO(o);
  56937   ck_assert_ptr_eq(o->f->getTopType(o), NULL);
  56938   terminateO(o);
  56939     // string
  56940   initiateAllocateSmallJson(&o);
  56941   createAllocateSmallString(jString);
  56942   jString->f->set(jString, "sheepy");
  56943       // setTop
  56944   o->f->setTop(o, (baset *)jString);
  56945   finishO(jString);
  56946       // getTopType
  56947   ck_assert_str_eq(o->f->getTopType(o), "string");
  56948       // getTop
  56949   b = o->f->getTop(o);
  56950   ck_assert_str_eq(b->type, "smallString");
  56951   finishO(b);
  56952       // duplicateO
  56953   o2 = duplicateO(o);
  56954       // toStringO
  56955   s  = toStringO(o2);
  56956   ck_assert_str_eq(s, "sheepy");
  56957   free(s);
  56958       // stringify
  56959   s = o->f->stringify(o,2);
  56960   ck_assert_str_eq(s, "\"sheepy\"");
  56961   free(s);
  56962       // toYML
  56963   s = o->f->toYML(o,2);
  56964   ck_assert_str_eq(s, "---\n  \"sheepy\"");
  56965   free(s);
  56966       // smash
  56967   o2->f->smash(&o2);
  56968       // freeO
  56969   freeO(o);
  56970   ck_assert_ptr_eq(o->f->getTopType(o), NULL);
  56971   terminateO(o);
  56972     // dict
  56973   initiateAllocateSmallJson(&o);
  56974   o->f->setS(o, "1", "2");
  56975   createAllocateSmallDict(jdict);
  56976       // setTop
  56977         // start iteration before setTop to check if
  56978         // iterElement is finished
  56979   iterStartO(o);
  56980         // set json type to SMALLJSON_IS_EMPTY because as of today
  56981         // setTop only works when the object is empty
  56982   o->topIsA = 0;
  56983   o->f->setTop(o, (baset *)jdict);
  56984   finishO(jdict);
  56985       // getTopType
  56986   ck_assert_str_eq(o->f->getTopType(o), "dict");
  56987       // getTop
  56988   b = o->f->getTop(o);
  56989   ck_assert_str_eq(b->type, "smallDict");
  56990   finishO(b);
  56991       // duplicateO
  56992   o2 = duplicateO(o);
  56993       // toStringO
  56994   s  = toStringO(o2);
  56995   ck_assert_str_eq(s, "{}");
  56996   free(s);
  56997       // stringify
  56998   s = o->f->stringify(o,2);
  56999   ck_assert_str_eq(s, "{}\n");
  57000   free(s);
  57001       // toYML
  57002   s = o->f->toYML(o,2);
  57003   ck_assert_str_eq(s, "---\n  {}\n");
  57004   free(s);
  57005       // smash
  57006   o2->f->smash(&o2);
  57007       // freeO
  57008   freeO(o);
  57009   ck_assert_ptr_eq(o->f->getTopType(o), NULL);
  57010   terminateO(o);
  57011     // array
  57012   initiateAllocateSmallJson(&o);
  57013   createAllocateSmallArray(jArray);
  57014       // setTop
  57015   o->f->setTop(o, (baset *)jArray);
  57016   finishO(jArray);
  57017       // getTopType
  57018   ck_assert_str_eq(o->f->getTopType(o), "array");
  57019       // getTop
  57020   b = o->f->getTop(o);
  57021   ck_assert_str_eq(b->type, "smallArray");
  57022   finishO(b);
  57023       // duplicateO
  57024   o2 = duplicateO(o);
  57025       // toStringO
  57026   s  = toStringO(o2);
  57027   ck_assert_str_eq(s, "[]");
  57028   free(s);
  57029       // stringify
  57030   s = o->f->stringify(o,2);
  57031   ck_assert_str_eq(s, "[]\n");
  57032   free(s);
  57033       // toYML
  57034   s = o->f->toYML(o,2);
  57035   ck_assert_str_eq(s, "---\n  []\n");
  57036   free(s);
  57037       // smash
  57038   o2->f->smash(&o2);
  57039       // freeO
  57040   freeO(o);
  57041   ck_assert_ptr_eq(o->f->getTopType(o), NULL);
  57042   terminateO(o);
  57043   // get
  57044   smallIntt *in = (smallIntt *) obj2->f->get(obj2, "int");
  57045   ck_assert(in->value->value == 123);
  57046   createAllocateSmallDict(oD2);
  57047   smallIntt *in2 = duplicateO(in);
  57048   oD2->f->set(oD2, "int", (baset *)in2);
  57049   finishO(in2);
  57050   in2 = duplicateO(in);
  57051   oD2->f->set(oD2, "int2", (baset *)in2);
  57052   finishO(in2);
  57053   obj2->f->set(obj2, "dict", (baset *)oD2);
  57054   finishO(oD2);
  57055   createAllocateSmallArray(oTA2);
  57056   in2 = duplicateO(in);
  57057   oTA2->f->push(oTA2, (baset *)in2);
  57058   finishO(in2);
  57059   in2 = duplicateO(in);
  57060   oTA2->f->push(oTA2, (baset *)in2);
  57061   finishO(in2);
  57062   smashO(in);
  57063   obj2->f->set(obj2, "array", (baset *)oTA2);
  57064   finishO(oTA2);
  57065     // get dict element
  57066   in = (smallIntt *) obj2->f->get(obj2, "\"dict\".\"int2\"");
  57067   ck_assert(in->value->value == 123);
  57068   smashO(in);
  57069     // non existing element
  57070   in = (smallIntt *) obj2->f->get(obj2, "\"dict\".\"void\"");
  57071   ck_assert_ptr_eq(in, NULL);
  57072     // missing " at the end
  57073   in = (smallIntt *) obj2->f->get(obj2, "\"dict\".\"int2");
  57074   ck_assert_ptr_eq(in, NULL);
  57075     // get array element
  57076   in = (smallIntt *) obj2->f->get(obj2, "\"array\"[0]");
  57077   ck_assert(in->value->value == 123);
  57078   smashO(in);
  57079     // missing ] at the end
  57080   in = (smallIntt *) obj2->f->get(obj2, "\"array\"[0");
  57081   ck_assert_ptr_eq(in, NULL);
  57082     // json array
  57083   createAllocateSmallJson(json);
  57084   createAllocateSmallInt(oInt4);
  57085   oInt4->f->set(oInt4, 345);
  57086   json->f->push(json, (baset *) oInt4);
  57087   finishO(oInt4);
  57088   in = (smallIntt *) json->f->get(json, "[0]");
  57089   ck_assert(in->value->value == 345);
  57090   smashO(in);
  57091   // set get json path
  57092   createSmallJson(jpath);
  57093     // dict is top
  57094   jpath.f->parse(&jpath, "{ \"a\": {\"a\": true}, \"b\": 234, \"c\": [\"qwe\",32]}");
  57095       // get non existing element in 'c' array
  57096   b = jpath.f->get(&jpath,"\"c\"[3]");
  57097   ck_assert_ptr_eq(b, NULL);
  57098   finishO(b);
  57099       // dictionary keys should not be unescaped
  57100   createSmallBool(ba);
  57101   jpath.f->set(&jpath, "b\\\\", cBa(&ba));
  57102   jBool = (smallBoolt*)jpath.f->get(&jpath,"b\\\\");
  57103   ck_assert(jBool->value->value == false);
  57104   finishO(jBool);
  57105       // keys in json paths should be unescaped
  57106   createSmallBool(bb);
  57107   bb.f->set(&bb, true);
  57108   jpath.f->set(&jpath, "\"b\\\\\"", (baset*)&bb);
  57109   jBool = (smallBoolt*)jpath.f->get(&jpath,"\"b\\\\\"");
  57110   ck_assert(jBool->value->value == true);
  57111   finishO(jBool);
  57112   freeO(&jpath);
  57113     // array is top
  57114     // get dict in dict
  57115   jpath.f->parse(&jpath, "[1,{\"a\": {\"a\": true}, \"b\": 234, \"c\": [\"qwe\",32]}, [[11],22,33]]");
  57116   b = jpath.f->get(&jpath,"[1].\"a\"");
  57117   ck_assert_str_eq(b->type, "smallDict");
  57118   finishO(b);
  57119     // get bool in dict
  57120   jBool = (smallBoolt*)jpath.f->get(&jpath,"[1]\"a\"\"a\"");
  57121   ck_assert(jBool->value->value == true);
  57122   finishO(jBool);
  57123     // get array in array
  57124   jArray = (smallArrayt*)jpath.f->get(&jpath,"[2][0]");
  57125   ck_assert_str_eq(jArray->type, "smallArray");
  57126   ck_assert_uint_eq(lenO(jArray), 1);
  57127   finishG(jArray);
  57128     // get element in array
  57129   in = (smallIntt*)(jpath.f->get(&jpath,"[2][0][0]"));
  57130   ck_assert_uint_eq(in->value->value, 11);
  57131   finishG(in);
  57132     // set element in array with negative index
  57133   createSmallBool(be);
  57134   jpath.f->set(&jpath, "[-1][0][0]", (baset*)&be);
  57135     // get element in array with negative index
  57136   jBool = (smallBoolt*)jpath.f->get(&jpath,"[-1][0][0]");
  57137   ck_assert(jBool->value->value == false);
  57138   finishG(jBool);
  57139     // set new element in dict
  57140   createSmallBool(b2);
  57141   o2 = jpath.f->set(&jpath, "[1]\"a\"\"b\\\"\"", (baset*)&b2);
  57142   ck_assert_ptr_ne(o2, NULL);
  57143   jBool = (smallBoolt*)jpath.f->get(&jpath,"[1]\"a\"\"b\\\"\"");
  57144   ck_assert(jBool->value->value == false);
  57145   finishG(jBool);
  57146   createSmallBool(b3);
  57147   o2 = jpath.f->set(&jpath, "[1]\"a\"\"b\\\\\"", (baset*)&b3);
  57148   ck_assert_ptr_ne(o2, NULL);
  57149   jBool = (smallBoolt*)jpath.f->get(&jpath,"[1]\"a\"\"b\\\\\"");
  57150   ck_assert(jBool->value->value == false);
  57151   finishG(jBool);
  57152     // escape key in json path
  57153     // \\\""
  57154   char *ks = jpath.f->makeKey(&jpath, "\\\\\\\"\"");
  57155   ck_assert_str_eq(ks, "\"\\\\\\\\\\\\\\\"\\\"\"");
  57156   createSmallBool(b4);
  57157   iPrependS(&ks, "[1]");
  57158   o2 = jpath.f->set(&jpath, ks, (baset*)&b4);
  57159   ck_assert_ptr_ne(o2, NULL);
  57160   jBool = (smallBoolt*)jpath.f->get(&jpath,ks);
  57161   ck_assert(jBool->value->value == false);
  57162   finishG(jBool);
  57163   free(ks);
  57164     // wrong path
  57165   b = jpath.f->get(&jpath,"[3][0][0]");
  57166   ck_assert_ptr_eq(b, NULL);
  57167   finishG(b);
  57168     // missing index
  57169   b = jpath.f->get(&jpath,"[][0][0]");
  57170   ck_assert_ptr_eq(b, NULL);
  57171   finishG(b);
  57172     // try to assign dictionary key to array, wrong
  57173   createSmallBool(b0);
  57174   o2 = jpath.f->set(&jpath, "[2][0]\"sdf\\\"", (baset*)&b0);
  57175   ck_assert_ptr_eq(o2, NULL);
  57176   freeO(&jpath);
  57177   // len
  57178   initiateAllocateSmallJson(&o);
  57179   ck_assert_uint_eq(o->f->len(o), 0);
  57180   o->f->setTypeUndefined(o);
  57181   ck_assert_uint_eq(o->f->len(o), 1);
  57182   o->f->setTypeBool(o);
  57183   ck_assert_uint_eq(o->f->len(o), 1);
  57184   o->f->setTypeDouble(o);
  57185   ck_assert_uint_eq(o->f->len(o), 1);
  57186   o->f->setTypeInt(o);
  57187   ck_assert_uint_eq(o->f->len(o), 1);
  57188   o->f->setTypeString(o);
  57189   ck_assert_uint_eq(o->f->len(o), 0);
  57190   o->f->setTypeDict(o);
  57191   ck_assert_uint_eq(o->f->len(o), 0);
  57192   o->f->setTypeArray(o);
  57193   ck_assert_uint_eq(o->f->len(o), 0);
  57194   terminateO(o);
  57195   // empty
  57196   initiateAllocateSmallJson(&o);
  57197     // empty empty
  57198   o->f->empty(o);
  57199   o->f->setTypeString(o);
  57200   sFree((smallt *)o->topS);
  57201   o->topS = allocSStringTiny("er");
  57202   o->f->empty(o);
  57203   ck_assert_uint_eq(o->f->len(o), 0);
  57204   o->f->setTypeDict(o);
  57205   initiateAllocateSmallInt(&in);
  57206   o->f->set(o, "wer", (baset *)in);
  57207   finishO(in);
  57208   o->f->empty(o);
  57209   ck_assert_uint_eq(o->f->len(o), 0);
  57210   o->f->setTypeArray(o);
  57211   initiateAllocateSmallInt(&in);
  57212   o->f->push(o, (baset *)in);
  57213   finishO(in);
  57214   o->f->empty(o);
  57215   ck_assert_uint_eq(o->f->len(o), 0);
  57216   terminateO(o);
  57217   // stringify
  57218     // array
  57219   initiateAllocateSmallString(&jString);
  57220   jString->f->set(jString, "sheepy");
  57221   json->f->push(json, (baset *) jString);
  57222   finishO(jString);
  57223   initiateAllocateSmallDict(&jdict);
  57224   json->f->push(json, (baset *) jdict);
  57225   finishO(jdict);
  57226   initiateAllocateSmallArray(&jArray);
  57227   json->f->push(json, (baset *) jArray);
  57228   finishO(jArray);
  57229   initiateAllocateSmallDict(&jdict);
  57230   initiateAllocateSmallString(&jString);
  57231   jString->f->set(jString, "sheepy");
  57232   jdict->f->set(jdict, "string", (baset *) jString);
  57233   finishO(jString);
  57234   initiateAllocateSmallContainer(&jcontainer);
  57235   jdict->f->set(jdict, "container", (baset *) jcontainer);
  57236   finishO(jcontainer);
  57237   json->f->push(json, (baset *) jdict);
  57238   finishO(jdict);
  57239   initiateAllocateSmallArray(&jArray);
  57240   initiateAllocateSmallString(&jString);
  57241   jString->f->set(jString, "sheepy");
  57242   jArray->f->push(jArray, (baset *) jString);
  57243   finishO(jString);
  57244   initiateAllocateSmallContainer(&jcontainer);
  57245   jArray->f->push(jArray, (baset *) jcontainer);
  57246   finishO(jcontainer);
  57247   json->f->push(json, (baset *) jArray);
  57248   finishO(jArray);
  57249 
  57250   s = json->f->stringify(json, 2);
  57251   ck_assert_str_eq(s, "[\n  345,\n  \"sheepy\",\n  {},\n  [],\n  {\n    \"string\": \"sheepy\",\n    \"container\": \"<data container>\"\n  },\n  [\n    \"sheepy\",\n    \"<data container>\"\n  ]\n]\n");
  57252   free(s);
  57253     // empty
  57254   createAllocateSmallJson(json2);
  57255   s = json2->f->stringify(json2, 2);
  57256   ck_assert_str_eq(s, "{}");
  57257   free(s);
  57258     // dict
  57259   initiateAllocateSmallString(&jString);
  57260   jString->f->set(jString, "sheepy");
  57261   json2->f->set(json2, "s", (baset *) jString);
  57262   finishO(jString);
  57263   initiateAllocateSmallDict(&jdict);
  57264   json2->f->set(json2, "d",(baset *) jdict);
  57265   finishO(jdict);
  57266   initiateAllocateSmallArray(&jArray);
  57267   json2->f->set(json2, "a", (baset *) jArray);
  57268   finishO(jArray);
  57269   initiateAllocateSmallDict(&jdict);
  57270   initiateAllocateSmallString(&jString);
  57271   jString->f->set(jString, "sheepy");
  57272   jdict->f->set(jdict, "string", (baset *) jString);
  57273   finishO(jString);
  57274   initiateAllocateSmallContainer(&jcontainer);
  57275   jdict->f->set(jdict, "container", (baset *) jcontainer);
  57276   finishO(jcontainer);
  57277   json2->f->set(json2, "d2",(baset *) jdict);
  57278   finishO(jdict);
  57279   initiateAllocateSmallArray(&jArray);
  57280   initiateAllocateSmallString(&jString);
  57281   jString->f->set(jString, "sheepy");
  57282   jArray->f->push(jArray, (baset *) jString);
  57283   finishO(jString);
  57284   initiateAllocateSmallContainer(&jcontainer);
  57285   jArray->f->push(jArray, (baset *) jcontainer);
  57286   finishO(jcontainer);
  57287   json2->f->set(json2, "a2", (baset *) jArray);
  57288   finishO(jArray);
  57289   initiateAllocateSmallInt(&oInt4);
  57290   oInt4->f->set(oInt4, 345);
  57291   json2->f->set(json2, "int", (baset *) oInt4);
  57292   finishO(oInt4);
  57293   s = json2->f->stringify(json2, 2);
  57294   ck_assert_str_eq(s, "{\n  \"s\": \"sheepy\",\n  \"d\": {},\n  \"a\": [],\n  \"d2\": {\n    \"string\": \"sheepy\",\n    \"container\": \"<data container>\"\n  },\n  \"a2\": [\n    \"sheepy\",\n    \"<data container>\"\n  ],\n  \"int\": 345\n}\n");
  57295   free(s);
  57296   // toYML
  57297     // array
  57298   s = json->f->toYML(json, 2);
  57299   ck_assert_str_eq(s, "---\n  - 345\n  - sheepy\n  - {}\n  - []\n  - string: sheepy\n    container: \"<data container>\"\n  - - sheepy\n    - \"<data container>\"\n");
  57300   free(s);
  57301     // empty
  57302   createAllocateSmallJson(json3);
  57303   s = json3->f->toYML(json3, 2);
  57304   ck_assert_str_eq(s, "---\n");
  57305   free(s);
  57306   terminateO(json3);
  57307     // dict
  57308   s = json2->f->toYML(json2, 2);
  57309   ck_assert_str_eq(s, "---\n  s: sheepy\n  d:\n    {}\n  a:\n    []\n  d2:\n    string: sheepy\n    container: \"<data container>\"\n  a2:\n    - sheepy\n    - \"<data container>\"\n  int: 345\n");
  57310   free(s);
  57311   terminateO(json2);
  57312   terminateO(json);
  57313   // parse
  57314     // top null - undefined
  57315   initiateAllocateSmallJson(&json);
  57316   json->f->parse(json, "null");
  57317   ck_assert_str_eq(json->f->getTopType(json), "undefined");
  57318   terminateO(json);
  57319     // top bool
  57320   initiateAllocateSmallJson(&json);
  57321   json->f->parse(json, "true");
  57322   ck_assert_str_eq(json->f->getTopType(json), "bool");
  57323   terminateO(json);
  57324     // top double
  57325   initiateAllocateSmallJson(&json);
  57326   json->f->parse(json, "0.01");
  57327   ck_assert_str_eq(json->f->getTopType(json), "double");
  57328   terminateO(json);
  57329     // top int
  57330   initiateAllocateSmallJson(&json);
  57331   json->f->parse(json, "10");
  57332   ck_assert_str_eq(json->f->getTopType(json), "int");
  57333   terminateO(json);
  57334     // top string
  57335   initiateAllocateSmallJson(&json);
  57336   json->f->parse(json, "\"wef\"");
  57337   ck_assert_str_eq(json->f->getTopType(json), "string");
  57338   terminateO(json);
  57339     // from file dictionary
  57340   char **file = readText("file.json");
  57341   char *jsonText = join(file, "\n");
  57342   createAllocateSmallJson(jsOfromF);
  57343   jsOfromF->f->parse(jsOfromF, jsonText);
  57344   s = toStringO(jsOfromF);
  57345   //printf("JSON FILE: %s\n", s);
  57346   ck_assert_str_eq(s, "{\"dasd\":\"asd\",\"asd\":234,\"dict\":{\"array\":[1,1],\"asd\":true,\"float\":3.434000e+01},\"bool\":false,\"zzz\":null}");
  57347   free(s);
  57348   free(jsonText);
  57349   listFreeS(file);
  57350   terminateO(jsOfromF);
  57351     // json array top
  57352   file = readText("fileA.json");
  57353   jsonText = join(file, "\n");
  57354   initiateAllocateSmallJson(&jsOfromF);
  57355   jsOfromF->f->parse(jsOfromF, jsonText);
  57356   s = toStringO(jsOfromF);
  57357   ck_assert_str_eq(s, "[\"asd\",234,{\"array\":[1,1],\"asd\":true,\"float\":3.434000e+01}]");
  57358   free(s);
  57359   free(jsonText);
  57360   listFreeS(file);
  57361   terminateO(jsOfromF);
  57362     // wrong json incomplete dict
  57363   initiateAllocateSmallJson(&json);
  57364   json->f->parse(json, "{\"wef\": {");
  57365   s = toStringO(json);
  57366   ck_assert_str_eq(s, "{}");
  57367   free(s);
  57368   terminateO(json);
  57369     // wrong json incomplete array
  57370   initiateAllocateSmallJson(&json);
  57371   json->f->parse(json, "{\"wef\": [");
  57372   s = toStringO(json);
  57373   ck_assert_str_eq(s, "{}");
  57374   free(s);
  57375   terminateO(json);
  57376     // wrong json incomplete string
  57377   initiateAllocateSmallJson(&json);
  57378   json->f->parse(json, "{\"wef\": \"wer");
  57379   s = toStringO(json);
  57380   ck_assert_str_eq(s, "{}");
  57381   free(s);
  57382   terminateO(json);
  57383     // wrong json incomplete top dict
  57384   initiateAllocateSmallJson(&json);
  57385   json->f->parse(json, "{ \"wef");
  57386   s = toStringO(json);
  57387   ck_assert_str_eq(s, "{}");
  57388   free(s);
  57389   terminateO(json);
  57390     // wrong json incomplete top array
  57391   initiateAllocateSmallJson(&json);
  57392   json->f->parse(json, "[\"wef");
  57393   s = toStringO(json);
  57394   ck_assert_str_eq(s, "{}");
  57395   free(s);
  57396   terminateO(json);
  57397     // wrong json incomplete top string
  57398   initiateAllocateSmallJson(&json);
  57399   json->f->parse(json, "\"wef");
  57400   s = toStringO(json);
  57401   ck_assert_str_eq(s, "{}");
  57402   free(s);
  57403   terminateO(json);
  57404   // parseYML
  57405     // yml only top dict or array - NO: top null undefined top bool top double top int top string
  57406     // from file dictionary
  57407   file = readText("file.yml");
  57408   jsonText = join(file, "\n");
  57409   initiateAllocateSmallJson(&jsOfromF);
  57410   jsOfromF->f->parseYML(jsOfromF, jsonText);
  57411   s = toStringO(jsOfromF);
  57412   ck_assert_str_eq(s, "{\"dict\":{\"array\":[1,1],\"float\":3.434000e+01,\"asd\":true},\"dasd\":\"asd\",\"asd\":234,\"bool\":false,\"zzz\":null}");
  57413   free(s);
  57414   free(jsonText);
  57415   listFreeS(file);
  57416   terminateO(jsOfromF);
  57417     // json array top
  57418   file = readText("fileA.yml");
  57419   jsonText = join(file, "\n");
  57420   initiateAllocateSmallJson(&jsOfromF);
  57421   jsOfromF->f->parseYML(jsOfromF, jsonText);
  57422   s = toStringO(jsOfromF);
  57423   //printf("JSON FILE: %s\n", toStringO(jsOfromF));
  57424   ck_assert_str_eq(s, "[{\"dict\":\"hello\",\"array\":[1,1],\"float\":3.434000e+01,\"asd\":true},\"asd\",234]");
  57425   free(s);
  57426   free(jsonText);
  57427   listFreeS(file);
  57428   terminateO(jsOfromF);
  57429   // serial deserial
  57430   smallBytest *B;
  57431   initiateAllocateSmallJson(&o);
  57432   ck_assert_ptr_eq(o->f->serial(o), NULL);
  57433     // non json object
  57434   initiateAllocateSmallContainer(&jcontainer);
  57435   o->f->setTop(o, (baset *)jcontainer);
  57436   ck_assert_ptr_eq(o->f->serial(o), NULL);
  57437   terminateO(jcontainer);
  57438     // undefined
  57439   undefinedt *oU = allocUndefined();
  57440   o->f->setTop(o, (baset *)oU);
  57441   finishO(oU);
  57442   B = o->f->serial(o);
  57443   s = sToString((smallt *) B->B);
  57444   ck_assert_str_eq(s, "[0x01]");
  57445   free(s);
  57446   freeO(o);
  57447   o->f->deserial(o, B);
  57448   s = toStringO(o);
  57449   ck_assert_str_eq(s, "null");
  57450   free(s);
  57451   terminateO(B);
  57452   terminateO(o);
  57453     // Bool
  57454   initiateAllocateSmallJson(&o);
  57455   smallBoolt *oBool = allocSmallBool(true);
  57456   o->f->setTop(o, (baset *)oBool);
  57457   finishO(oBool);
  57458   B = o->f->serial(o);
  57459   s = sToString((smallt *) B->B);
  57460   ck_assert_str_eq(s, "[0x02,0x01]");
  57461   free(s);
  57462   o->f->deserial(o, B);
  57463   s = toStringO(o);
  57464   ck_assert_str_eq(s, "true");
  57465   free(s);
  57466   terminateO(B);
  57467   terminateO(o);
  57468     // Double
  57469   initiateAllocateSmallJson(&o);
  57470   smallDoublet *od = allocSmallDouble(10);
  57471   o->f->setTop(o, (baset *)od);
  57472   finishO(od);
  57473   B = o->f->serial(o);
  57474   s = sToString((smallt *) B->B);
  57475   ck_assert_str_eq(s, "[0x06,0x00,0x00,0x00,0x00,0x00,0x00,0x24,0x40]");
  57476   free(s);
  57477   o->f->deserial(o, B);
  57478   s = toStringO(o);
  57479   ck_assert_str_eq(s, "1.000000e+01");
  57480   free(s);
  57481   terminateO(B);
  57482   terminateO(o);
  57483     // Int
  57484   initiateAllocateSmallJson(&o);
  57485   oInt = allocSmallInt(85);
  57486   o->f->setTop(o, (baset *)oInt);
  57487   finishO(oInt);
  57488   B = o->f->serial(o);
  57489   s = sToString((smallt *) B->B);
  57490   ck_assert_str_eq(s, "[0x07,0x55,0x00,0x00,0x00,0x00,0x00,0x00,0x00]");
  57491   free(s);
  57492   o->f->deserial(o, B);
  57493   s = toStringO(o);
  57494   ck_assert_str_eq(s, "85");
  57495   free(s);
  57496   terminateO(B);
  57497   terminateO(o);
  57498     // string
  57499   initiateAllocateSmallJson(&o);
  57500   smallStringt *st = allocSmallString("sheepy");
  57501   o->f->setTop(o, (baset *)st);
  57502   finishO(st);
  57503   B = o->f->serial(o);
  57504   s = sToString((smallt *) B->B);
  57505   ck_assert_str_eq(s, "[0x08,0x73,0x68,0x65,0x65,0x70,0x79,0x00]");
  57506   free(s);
  57507   o->f->deserial(o, B);
  57508   s = toStringO(o);
  57509   ck_assert_str_eq(s, "sheepy");
  57510   free(s);
  57511   terminateO(B);
  57512   terminateO(o);
  57513     // dict
  57514   initiateAllocateSmallJson(&o);
  57515   smallDictt *sDD = allocSmallDict();
  57516   o->f->setTop(o, (baset *)sDD);
  57517   finishO(sDD);
  57518   B = o->f->serial(o);
  57519   s = sToString((smallt *) B->B);
  57520   ck_assert_str_eq(s, "[0x04,0x00,0x00,0x00,0x00]");
  57521   free(s);
  57522   o->f->deserial(o, B);
  57523   s = toStringO(o);
  57524   ck_assert_str_eq(s, "{}");
  57525   free(s);
  57526   terminateO(B);
  57527   terminateO(o);
  57528     // array
  57529   initiateAllocateSmallJson(&o);
  57530   smallArrayt *sAA = allocSmallArray();
  57531   o->f->setTop(o, (baset *)sAA);
  57532   finishO(sAA);
  57533   B = o->f->serial(o);
  57534   s = sToString((smallt *) B->B);
  57535   ck_assert_str_eq(s, "[0x0a,0x00,0x00,0x00,0x00]");
  57536   free(s);
  57537   o->f->deserial(o, B);
  57538   s = toStringO(o);
  57539   ck_assert_str_eq(s, "[]");
  57540   free(s);
  57541   terminateO(B);
  57542   terminateO(o);
  57543     // deserial non json object
  57544   initiateAllocateSmallJson(&o);
  57545   initiateAllocateSmallBytes(&B);
  57546   sContainert *c = allocSContainer(NULL);
  57547   B->B = sSerial((smallt *) c);
  57548   sFree((smallt *) c);
  57549   o->f->deserial(o, B);
  57550   ck_assert_uint_eq(o->topIsA, 0/*=JSON_IS_EMPTY*/);
  57551   terminateO(B);
  57552   terminateO(o);
  57553     // deserial empty sBytest
  57554   initiateAllocateSmallJson(&o);
  57555   initiateAllocateSmallBytes(&B);
  57556   o->f->deserial(o, B);
  57557   ck_assert_uint_eq(o->topIsA, 0/*=JSON_IS_EMPTY*/);
  57558   terminateO(B);
  57559   terminateO(o);
  57560     // NULL object
  57561   initiateAllocateSmallJson(&o);
  57562   o->f->setTypeUndefined(o);
  57563   sFree((smallt *) o->topU);
  57564   o->topU = NULL;
  57565   ck_assert_ptr_eq(o->f->serial(o),NULL);
  57566   o->f->deserial(o, NULL);
  57567   terminateO(o);
  57568   // free local object
  57569   obj.f->free(&obj);
  57570   ck_assert_str_eq(obj.type, "smallJson");
  57571   // free object
  57572   obj2->f->terminate(&obj2);
  57573   ck_assert_ptr_eq(obj2, NULL);
  57574   initiateAllocateSmallJson(&o);
  57575   terminateO(o);
  57576   ck_assert_ptr_eq(o, NULL);
  57577     // undefined
  57578   initiateAllocateSmallJson(&o);
  57579   o->f->setTypeUndefined(o);
  57580   terminateO(o);
  57581   ck_assert_ptr_eq(o, NULL);
  57582     // bool
  57583   initiateAllocateSmallJson(&o);
  57584   o->f->setTypeBool(o);
  57585   terminateO(o);
  57586   ck_assert_ptr_eq(o, NULL);
  57587     // double
  57588   initiateAllocateSmallJson(&o);
  57589   o->f->setTypeDouble(o);
  57590   terminateO(o);
  57591   ck_assert_ptr_eq(o, NULL);
  57592     // int
  57593   initiateAllocateSmallJson(&o);
  57594   o->f->setTypeInt(o);
  57595   terminateO(o);
  57596   ck_assert_ptr_eq(o, NULL);
  57597     // string
  57598   initiateAllocateSmallJson(&o);
  57599   o->f->setTypeString(o);
  57600   terminateO(o);
  57601   ck_assert_ptr_eq(o, NULL);
  57602     // dict
  57603   initiateAllocateSmallJson(&o);
  57604   o->f->setTypeDict(o);
  57605   terminateO(o);
  57606   ck_assert_ptr_eq(o, NULL);
  57607     // array
  57608   initiateAllocateSmallJson(&o);
  57609   o->f->setTypeArray(o);
  57610   terminateO(o);
  57611   ck_assert_ptr_eq(o, NULL);
  57612 
  57613 END_TEST
  57614 
  57615 
  57616 
  57617 Suite * libsheepySuite(void) {
  57618   Suite *s;
  57619   TCase *tc_core;
  57620 
  57621   s = suite_create("libsheepy");
  57622 
  57623   /* Core test case */
  57624   tc_core = tcase_create("Object");
  57625 
  57626   setLogMode(LOG_VERBOSE);
  57627 
  57628   // disable btrace to make the test run faster
  57629   btraceDisable();
  57630 
  57631   tcase_add_test(tc_core, createSJFT);
  57632   tcase_add_test(tc_core, getsoSmallJsonT);
  57633   tcase_add_test(tc_core, setsoSmallJsonT);
  57634   tcase_add_test(tc_core, mirrorSmallJsonT);
  57635   tcase_add_test(tc_core, setTopBoolSmallJsonT);
  57636   tcase_add_test(tc_core, setTopDoubleSmallJsonT);
  57637   tcase_add_test(tc_core, setTopIntSmallJsonT);
  57638   tcase_add_test(tc_core, setTopStringSmallJsonT);
  57639   tcase_add_test(tc_core, setTopCharSmallJsonT);
  57640   tcase_add_test(tc_core, setTopDictSmallJsonT);
  57641   tcase_add_test(tc_core, setTopArraySmallJsonT);
  57642   tcase_add_test(tc_core, setTopArraycSmallJsonT);
  57643   tcase_add_test(tc_core, setTopSmallBoolSmallJsonT);
  57644   tcase_add_test(tc_core, setTopSmallDoubleSmallJsonT);
  57645   tcase_add_test(tc_core, setTopSmallIntSmallJsonT);
  57646   tcase_add_test(tc_core, setTopSmallJsonSmallJsonT);
  57647   tcase_add_test(tc_core, setTopSmallStringSmallJsonT);
  57648   tcase_add_test(tc_core, setTopNFreeSmallJsonT);
  57649   tcase_add_test(tc_core, setTopNFreeBoolSmallJsonT);
  57650   tcase_add_test(tc_core, setTopNFreeDoubleSmallJsonT);
  57651   tcase_add_test(tc_core, setTopNFreeIntSmallJsonT);
  57652   tcase_add_test(tc_core, setTopNFreeStringSmallJsonT);
  57653   tcase_add_test(tc_core, setTopNFreeDictSmallJsonT);
  57654   tcase_add_test(tc_core, setTopNFreeArraySmallJsonT);
  57655   tcase_add_test(tc_core, setTopNFreeArraycSmallJsonT);
  57656   tcase_add_test(tc_core, setTopNFreeSmallBoolSmallJsonT);
  57657   tcase_add_test(tc_core, setTopNFreeSmallDoubleSmallJsonT);
  57658   tcase_add_test(tc_core, setTopNFreeSmallIntSmallJsonT);
  57659   tcase_add_test(tc_core, setTopNFreeSmallJsonSmallJsonT);
  57660   tcase_add_test(tc_core, setTopNFreeSmallStringSmallJsonT);
  57661   tcase_add_test(tc_core, fromArraySmallJsonT);
  57662   tcase_add_test(tc_core, fromArrayNFreeSmallJsonT);
  57663   tcase_add_test(tc_core, fromArrayDictSmallJsonT);
  57664   tcase_add_test(tc_core, toArrayDictSmallJsonT);
  57665   tcase_add_test(tc_core, getTopUndefinedSmallJsonT);
  57666   tcase_add_test(tc_core, getTopBoolSmallJsonT);
  57667   tcase_add_test(tc_core, getTopBoolPSmallJsonT);
  57668   tcase_add_test(tc_core, getTopDoubleSmallJsonT);
  57669   tcase_add_test(tc_core, getTopDoublePSmallJsonT);
  57670   tcase_add_test(tc_core, getTopIntSmallJsonT);
  57671   tcase_add_test(tc_core, getTopIntPSmallJsonT);
  57672   tcase_add_test(tc_core, getTopInt32SmallJsonT);
  57673   tcase_add_test(tc_core, getTopInt32PSmallJsonT);
  57674   tcase_add_test(tc_core, getTopUintSmallJsonT);
  57675   tcase_add_test(tc_core, getTopUintPSmallJsonT);
  57676   tcase_add_test(tc_core, getTopUint32SmallJsonT);
  57677   tcase_add_test(tc_core, getTopUint32PSmallJsonT);
  57678   tcase_add_test(tc_core, getTopSSmallJsonT);
  57679   tcase_add_test(tc_core, getTopDictSmallJsonT);
  57680   tcase_add_test(tc_core, getTopArraySmallJsonT);
  57681   tcase_add_test(tc_core, getTopSmallBoolSmallJsonT);
  57682   tcase_add_test(tc_core, getTopSmallDoubleSmallJsonT);
  57683   tcase_add_test(tc_core, getTopSmallIntSmallJsonT);
  57684   tcase_add_test(tc_core, getTopSmallStringSmallJsonT);
  57685   tcase_add_test(tc_core, keyIsSmallJsonT);
  57686   tcase_add_test(tc_core, keyIsSSmallJsonT);
  57687   tcase_add_test(tc_core, makeKeySmallJsonT);
  57688   tcase_add_test(tc_core, iMakeKeySmallJsonT);
  57689   tcase_add_test(tc_core, bMakeKeySmallJsonT);
  57690   tcase_add_test(tc_core, bLMakeKeySmallJsonT);
  57691   tcase_add_test(tc_core, makeKeyLenSmallJsonT);
  57692   tcase_add_test(tc_core, setSmallJsonT);
  57693   tcase_add_test(tc_core, setUndefinedSmallJsonT);
  57694   tcase_add_test(tc_core, setBoolSmallJsonT);
  57695   tcase_add_test(tc_core, setDoubleSmallJsonT);
  57696   tcase_add_test(tc_core, setIntSmallJsonT);
  57697   tcase_add_test(tc_core, setSSmallJsonT);
  57698   tcase_add_test(tc_core, setCharSmallJsonT);
  57699   tcase_add_test(tc_core, setDictSmallJsonT);
  57700   tcase_add_test(tc_core, setArraySmallJsonT);
  57701   tcase_add_test(tc_core, setArraycSmallJsonT);
  57702   tcase_add_test(tc_core, setSmallBoolSmallJsonT);
  57703   tcase_add_test(tc_core, setSmallBytesSmallJsonT);
  57704   tcase_add_test(tc_core, setSmallDoubleSmallJsonT);
  57705   tcase_add_test(tc_core, setSmallIntSmallJsonT);
  57706   tcase_add_test(tc_core, setSmallJsonSmallJsonT);
  57707   tcase_add_test(tc_core, setSmallStringSmallJsonT);
  57708   tcase_add_test(tc_core, setSmallContainerSmallJsonT);
  57709   tcase_add_test(tc_core, setNFreeSmallJsonT);
  57710   tcase_add_test(tc_core, setNFreeUndefinedSmallJsonT);
  57711   tcase_add_test(tc_core, setNFreeSSmallJsonT);
  57712   tcase_add_test(tc_core, setNFreeDictSmallJsonT);
  57713   tcase_add_test(tc_core, setNFreeArraySmallJsonT);
  57714   tcase_add_test(tc_core, setNFreeArraycSmallJsonT);
  57715   tcase_add_test(tc_core, setNFreeSmallBoolSmallJsonT);
  57716   tcase_add_test(tc_core, setNFreeSmallBytesSmallJsonT);
  57717   tcase_add_test(tc_core, setNFreeSmallDoubleSmallJsonT);
  57718   tcase_add_test(tc_core, setNFreeSmallIntSmallJsonT);
  57719   tcase_add_test(tc_core, setNFreeSmallJsonSmallJsonT);
  57720   tcase_add_test(tc_core, setNFreeSmallStringSmallJsonT);
  57721   tcase_add_test(tc_core, setNFreeSmallContainerSmallJsonT);
  57722   tcase_add_test(tc_core, setPDictSmallJsonT);
  57723   tcase_add_test(tc_core, setPArraySmallJsonT);
  57724   tcase_add_test(tc_core, setPSmallJsonSmallJsonT);
  57725   tcase_add_test(tc_core, setPSmallStringSmallJsonT);
  57726   tcase_add_test(tc_core, setNFreePDictSmallJsonT);
  57727   tcase_add_test(tc_core, setNFreePArraySmallJsonT);
  57728   tcase_add_test(tc_core, setNFreePSmallJsonSmallJsonT);
  57729   tcase_add_test(tc_core, setNFreePSmallStringSmallJsonT);
  57730   tcase_add_test(tc_core, setAtSmallJsonT);
  57731   tcase_add_test(tc_core, setAtUndefinedSmallJsonT);
  57732   tcase_add_test(tc_core, setAtBoolSmallJsonT);
  57733   tcase_add_test(tc_core, setAtDoubleSmallJsonT);
  57734   tcase_add_test(tc_core, setAtIntSmallJsonT);
  57735   tcase_add_test(tc_core, setAtSSmallJsonT);
  57736   tcase_add_test(tc_core, setAtCharSmallJsonT);
  57737   tcase_add_test(tc_core, setAtDictSmallJsonT);
  57738   tcase_add_test(tc_core, setAtArraySmallJsonT);
  57739   tcase_add_test(tc_core, setAtArraycSmallJsonT);
  57740   tcase_add_test(tc_core, setAtSmallBoolSmallJsonT);
  57741   tcase_add_test(tc_core, setAtSmallBytesSmallJsonT);
  57742   tcase_add_test(tc_core, setAtSmallDoubleSmallJsonT);
  57743   tcase_add_test(tc_core, setAtSmallIntSmallJsonT);
  57744   tcase_add_test(tc_core, setAtSmallJsonSmallJsonT);
  57745   tcase_add_test(tc_core, setAtSmallStringSmallJsonT);
  57746   tcase_add_test(tc_core, setAtSmallContainerSmallJsonT);
  57747   tcase_add_test(tc_core, setAtNFreeSmallJsonT);
  57748   tcase_add_test(tc_core, setAtNFreeUndefinedSmallJsonT);
  57749   tcase_add_test(tc_core, setAtNFreeSSmallJsonT);
  57750   tcase_add_test(tc_core, setAtNFreeDictSmallJsonT);
  57751   tcase_add_test(tc_core, setAtNFreeArraySmallJsonT);
  57752   tcase_add_test(tc_core, setAtNFreeArraycSmallJsonT);
  57753   tcase_add_test(tc_core, setAtNFreeSmallBoolSmallJsonT);
  57754   tcase_add_test(tc_core, setAtNFreeSmallBytesSmallJsonT);
  57755   tcase_add_test(tc_core, setAtNFreeSmallDoubleSmallJsonT);
  57756   tcase_add_test(tc_core, setAtNFreeSmallIntSmallJsonT);
  57757   tcase_add_test(tc_core, setAtNFreeSmallJsonSmallJsonT);
  57758   tcase_add_test(tc_core, setAtNFreeSmallStringSmallJsonT);
  57759   tcase_add_test(tc_core, setAtNFreeSmallContainerSmallJsonT);
  57760   tcase_add_test(tc_core, setPAtDictSmallJsonT);
  57761   tcase_add_test(tc_core, setPAtArraySmallJsonT);
  57762   tcase_add_test(tc_core, setPAtSmallJsonSmallJsonT);
  57763   tcase_add_test(tc_core, setPAtSmallStringSmallJsonT);
  57764   tcase_add_test(tc_core, setPAtNFreeDictSmallJsonT);
  57765   tcase_add_test(tc_core, setPAtNFreeArraySmallJsonT);
  57766   tcase_add_test(tc_core, setPAtNFreeSmallJsonSmallJsonT);
  57767   tcase_add_test(tc_core, setPAtNFreeSmallStringSmallJsonT);
  57768   tcase_add_test(tc_core, pushUndefinedSmallJsonT);
  57769   tcase_add_test(tc_core, pushBoolSmallJsonT);
  57770   tcase_add_test(tc_core, pushDoubleSmallJsonT);
  57771   tcase_add_test(tc_core, pushIntSmallJsonT);
  57772   tcase_add_test(tc_core, pushSSmallJsonT);
  57773   tcase_add_test(tc_core, pushCharSmallJsonT);
  57774   tcase_add_test(tc_core, pushDictSmallJsonT);
  57775   tcase_add_test(tc_core, pushArraySmallJsonT);
  57776   tcase_add_test(tc_core, pushArraycSmallJsonT);
  57777   tcase_add_test(tc_core, pushSmallBoolSmallJsonT);
  57778   tcase_add_test(tc_core, pushSmallBytesSmallJsonT);
  57779   tcase_add_test(tc_core, pushSmallDoubleSmallJsonT);
  57780   tcase_add_test(tc_core, pushSmallIntSmallJsonT);
  57781   tcase_add_test(tc_core, pushSmallJsonSmallJsonT);
  57782   tcase_add_test(tc_core, pushSmallStringSmallJsonT);
  57783   tcase_add_test(tc_core, pushSmallContainerSmallJsonT);
  57784   tcase_add_test(tc_core, pushNFreeSmallJsonT);
  57785   tcase_add_test(tc_core, pushNFreeUndefinedSmallJsonT);
  57786   tcase_add_test(tc_core, pushNFreeSSmallJsonT);
  57787   tcase_add_test(tc_core, pushNFreeDictSmallJsonT);
  57788   tcase_add_test(tc_core, pushNFreeArraySmallJsonT);
  57789   tcase_add_test(tc_core, pushNFreeArraycSmallJsonT);
  57790   tcase_add_test(tc_core, pushNFreeSmallBoolSmallJsonT);
  57791   tcase_add_test(tc_core, pushNFreeSmallBytesSmallJsonT);
  57792   tcase_add_test(tc_core, pushNFreeSmallDoubleSmallJsonT);
  57793   tcase_add_test(tc_core, pushNFreeSmallIntSmallJsonT);
  57794   tcase_add_test(tc_core, pushNFreeSmallJsonSmallJsonT);
  57795   tcase_add_test(tc_core, pushNFreeSmallStringSmallJsonT);
  57796   tcase_add_test(tc_core, pushNFreeSmallContainerSmallJsonT);
  57797   tcase_add_test(tc_core, pushManySmallJsonT);
  57798   tcase_add_test(tc_core, pushManySSmallJsonT);
  57799   tcase_add_test(tc_core, pushNFreeManySmallJsonT);
  57800   tcase_add_test(tc_core, pushNFreeManySSmallJsonT);
  57801   tcase_add_test(tc_core, popSmallJsonT);
  57802   tcase_add_test(tc_core, popUndefinedSmallJsonT);
  57803   tcase_add_test(tc_core, popBoolSmallJsonT);
  57804   tcase_add_test(tc_core, popDoubleSmallJsonT);
  57805   tcase_add_test(tc_core, popIntSmallJsonT);
  57806   tcase_add_test(tc_core, popInt32SmallJsonT);
  57807   tcase_add_test(tc_core, popUintSmallJsonT);
  57808   tcase_add_test(tc_core, popUint32SmallJsonT);
  57809   tcase_add_test(tc_core, popSSmallJsonT);
  57810   tcase_add_test(tc_core, popDictSmallJsonT);
  57811   tcase_add_test(tc_core, popArraySmallJsonT);
  57812   tcase_add_test(tc_core, popSmallBoolSmallJsonT);
  57813   tcase_add_test(tc_core, popSmallBytesSmallJsonT);
  57814   tcase_add_test(tc_core, popSmallDoubleSmallJsonT);
  57815   tcase_add_test(tc_core, popSmallIntSmallJsonT);
  57816   tcase_add_test(tc_core, popSmallJsonSmallJsonT);
  57817   tcase_add_test(tc_core, popSmallStringSmallJsonT);
  57818   tcase_add_test(tc_core, popVoidSmallJsonT);
  57819   tcase_add_test(tc_core, popSmallContainerSmallJsonT);
  57820   tcase_add_test(tc_core, popNumSmallJsonT);
  57821   tcase_add_test(tc_core, prependSmallJsonT);
  57822   tcase_add_test(tc_core, prependUndefinedSmallJsonT);
  57823   tcase_add_test(tc_core, prependBoolSmallJsonT);
  57824   tcase_add_test(tc_core, prependDoubleSmallJsonT);
  57825   tcase_add_test(tc_core, prependIntSmallJsonT);
  57826   tcase_add_test(tc_core, prependSSmallJsonT);
  57827   tcase_add_test(tc_core, prependCharSmallJsonT);
  57828   tcase_add_test(tc_core, prependDictSmallJsonT);
  57829   tcase_add_test(tc_core, prependArraySmallJsonT);
  57830   tcase_add_test(tc_core, prependArraycSmallJsonT);
  57831   tcase_add_test(tc_core, prependSmallBoolSmallJsonT);
  57832   tcase_add_test(tc_core, prependSmallBytesSmallJsonT);
  57833   tcase_add_test(tc_core, prependSmallDoubleSmallJsonT);
  57834   tcase_add_test(tc_core, prependSmallIntSmallJsonT);
  57835   tcase_add_test(tc_core, prependSmallJsonSmallJsonT);
  57836   tcase_add_test(tc_core, prependSmallStringSmallJsonT);
  57837   tcase_add_test(tc_core, prependSmallContainerSmallJsonT);
  57838   tcase_add_test(tc_core, prependNFreeSmallJsonT);
  57839   tcase_add_test(tc_core, prependNFreeUndefinedSmallJsonT);
  57840   tcase_add_test(tc_core, prependNFreeSSmallJsonT);
  57841   tcase_add_test(tc_core, prependNFreeDictSmallJsonT);
  57842   tcase_add_test(tc_core, prependNFreeArraySmallJsonT);
  57843   tcase_add_test(tc_core, prependNFreeArraycSmallJsonT);
  57844   tcase_add_test(tc_core, prependNFreeSmallBoolSmallJsonT);
  57845   tcase_add_test(tc_core, prependNFreeSmallBytesSmallJsonT);
  57846   tcase_add_test(tc_core, prependNFreeSmallDoubleSmallJsonT);
  57847   tcase_add_test(tc_core, prependNFreeSmallIntSmallJsonT);
  57848   tcase_add_test(tc_core, prependNFreeSmallJsonSmallJsonT);
  57849   tcase_add_test(tc_core, prependNFreeSmallStringSmallJsonT);
  57850   tcase_add_test(tc_core, prependNFreeSmallContainerSmallJsonT);
  57851   tcase_add_test(tc_core, dequeueSmallJsonT);
  57852   tcase_add_test(tc_core, dequeueUndefinedSmallJsonT);
  57853   tcase_add_test(tc_core, dequeueBoolSmallJsonT);
  57854   tcase_add_test(tc_core, dequeueDoubleSmallJsonT);
  57855   tcase_add_test(tc_core, dequeueIntSmallJsonT);
  57856   tcase_add_test(tc_core, dequeueInt32SmallJsonT);
  57857   tcase_add_test(tc_core, dequeueUintSmallJsonT);
  57858   tcase_add_test(tc_core, dequeueUint32SmallJsonT);
  57859   tcase_add_test(tc_core, dequeueSSmallJsonT);
  57860   tcase_add_test(tc_core, dequeueDictSmallJsonT);
  57861   tcase_add_test(tc_core, dequeueArraySmallJsonT);
  57862   tcase_add_test(tc_core, dequeueSmallBoolSmallJsonT);
  57863   tcase_add_test(tc_core, dequeueSmallBytesSmallJsonT);
  57864   tcase_add_test(tc_core, dequeueSmallDoubleSmallJsonT);
  57865   tcase_add_test(tc_core, dequeueSmallIntSmallJsonT);
  57866   tcase_add_test(tc_core, dequeueSmallJsonSmallJsonT);
  57867   tcase_add_test(tc_core, dequeueSmallStringSmallJsonT);
  57868   tcase_add_test(tc_core, dequeueVoidSmallJsonT);
  57869   tcase_add_test(tc_core, dequeueSmallContainerSmallJsonT);
  57870   tcase_add_test(tc_core, dequeueNumSmallJsonT);
  57871   tcase_add_test(tc_core, reverseSmallJsonT);
  57872   tcase_add_test(tc_core, catSmallJsonT);
  57873   tcase_add_test(tc_core, mergeDictSmallJsonT);
  57874   tcase_add_test(tc_core, mergeDictNSmashSmallJsonT);
  57875   tcase_add_test(tc_core, mergeSmallJsonT);
  57876   tcase_add_test(tc_core, mergeNSmashSmallJsonT);
  57877   tcase_add_test(tc_core, appendSmallJsonT);
  57878   tcase_add_test(tc_core, appendNSmashSmallJsonT);
  57879   tcase_add_test(tc_core, appendArraySmallJsonT);
  57880   tcase_add_test(tc_core, appendNSmashArraySmallJsonT);
  57881   tcase_add_test(tc_core, shiftSmallJsonT);
  57882   tcase_add_test(tc_core, shiftNSmashSmallJsonT);
  57883   tcase_add_test(tc_core, shiftSmallJsonSmallJsonT);
  57884   tcase_add_test(tc_core, shiftNSmashSmallJsonSmallJsonT);
  57885   tcase_add_test(tc_core, addSmallJsonT);
  57886   tcase_add_test(tc_core, addJsonSmallJsonT);
  57887   tcase_add_test(tc_core, sliceSmallJsonT);
  57888   tcase_add_test(tc_core, cropSmallJsonT);
  57889   tcase_add_test(tc_core, cropSSmallJsonT);
  57890   tcase_add_test(tc_core, cropSmallStringSmallJsonT);
  57891   tcase_add_test(tc_core, cropElemAtSmallJsonT);
  57892   tcase_add_test(tc_core, cropElemAtUndefinedSmallJsonT);
  57893   tcase_add_test(tc_core, cropElemAtBoolSmallJsonT);
  57894   tcase_add_test(tc_core, cropElemAtDoubleSmallJsonT);
  57895   tcase_add_test(tc_core, cropElemAtIntSmallJsonT);
  57896   tcase_add_test(tc_core, cropElemAtInt32SmallJsonT);
  57897   tcase_add_test(tc_core, cropElemAtUintSmallJsonT);
  57898   tcase_add_test(tc_core, cropElemAtUint32SmallJsonT);
  57899   tcase_add_test(tc_core, cropElemAtSSmallJsonT);
  57900   tcase_add_test(tc_core, cropElemAtCharSmallJsonT);
  57901   tcase_add_test(tc_core, cropElemAtDictSmallJsonT);
  57902   tcase_add_test(tc_core, cropElemAtArraySmallJsonT);
  57903   tcase_add_test(tc_core, cropElemAtSmallBoolSmallJsonT);
  57904   tcase_add_test(tc_core, cropElemAtSmallBytesSmallJsonT);
  57905   tcase_add_test(tc_core, cropElemAtSmallDoubleSmallJsonT);
  57906   tcase_add_test(tc_core, cropElemAtSmallIntSmallJsonT);
  57907   tcase_add_test(tc_core, cropElemAtSmallJsonSmallJsonT);
  57908   tcase_add_test(tc_core, cropElemAtSmallStringSmallJsonT);
  57909   tcase_add_test(tc_core, cropElemAtVoidSmallJsonT);
  57910   tcase_add_test(tc_core, cropElemAtSmallContainerSmallJsonT);
  57911   tcase_add_test(tc_core, cropElemKeySmallJsonT);
  57912   tcase_add_test(tc_core, cropElemKeyUndefinedSmallJsonT);
  57913   tcase_add_test(tc_core, cropElemKeyBoolSmallJsonT);
  57914   tcase_add_test(tc_core, cropElemKeyDoubleSmallJsonT);
  57915   tcase_add_test(tc_core, cropElemKeyIntSmallJsonT);
  57916   tcase_add_test(tc_core, cropElemKeyInt32SmallJsonT);
  57917   tcase_add_test(tc_core, cropElemKeyUintSmallJsonT);
  57918   tcase_add_test(tc_core, cropElemKeyUint32SmallJsonT);
  57919   tcase_add_test(tc_core, cropElemKeySSmallJsonT);
  57920   tcase_add_test(tc_core, cropElemKeyDictSmallJsonT);
  57921   tcase_add_test(tc_core, cropElemKeyArraySmallJsonT);
  57922   tcase_add_test(tc_core, cropElemKeySmallBoolSmallJsonT);
  57923   tcase_add_test(tc_core, cropElemKeySmallBytesSmallJsonT);
  57924   tcase_add_test(tc_core, cropElemKeySmallDoubleSmallJsonT);
  57925   tcase_add_test(tc_core, cropElemKeySmallIntSmallJsonT);
  57926   tcase_add_test(tc_core, cropElemKeySmallJsonSmallJsonT);
  57927   tcase_add_test(tc_core, cropElemKeySmallStringSmallJsonT);
  57928   tcase_add_test(tc_core, cropElemKeyVoidSmallJsonT);
  57929   tcase_add_test(tc_core, cropElemKeySmallContainerSmallJsonT);
  57930   tcase_add_test(tc_core, copySmallJsonT);
  57931   tcase_add_test(tc_core, insertSmallJsonT);
  57932   tcase_add_test(tc_core, insertNSmashSmallJsonT);
  57933   tcase_add_test(tc_core, insertSmallJsonSmallJsonT);
  57934   tcase_add_test(tc_core, insertNSmashSmallJsonSmallJsonT);
  57935   tcase_add_test(tc_core, insertStringSmallJsonT);
  57936   tcase_add_test(tc_core, insertSSmallJsonT);
  57937   tcase_add_test(tc_core, insertNFreeStringSmallJsonT);
  57938   tcase_add_test(tc_core, insertSNFreeSmallJsonT);
  57939   tcase_add_test(tc_core, injectSmallJsonT);
  57940   tcase_add_test(tc_core, injectUndefinedSmallJsonT);
  57941   tcase_add_test(tc_core, injectBoolSmallJsonT);
  57942   tcase_add_test(tc_core, injectDoubleSmallJsonT);
  57943   tcase_add_test(tc_core, injectIntSmallJsonT);
  57944   tcase_add_test(tc_core, injectSSmallJsonT);
  57945   tcase_add_test(tc_core, injectCharSmallJsonT);
  57946   tcase_add_test(tc_core, injectDictSmallJsonT);
  57947   tcase_add_test(tc_core, injectArraySmallJsonT);
  57948   tcase_add_test(tc_core, injectArraycSmallJsonT);
  57949   tcase_add_test(tc_core, injectSmallBoolSmallJsonT);
  57950   tcase_add_test(tc_core, injectSmallBytesSmallJsonT);
  57951   tcase_add_test(tc_core, injectSmallDoubleSmallJsonT);
  57952   tcase_add_test(tc_core, injectSmallIntSmallJsonT);
  57953   tcase_add_test(tc_core, injectSmallJsonSmallJsonT);
  57954   tcase_add_test(tc_core, injectSmallStringSmallJsonT);
  57955   tcase_add_test(tc_core, injectSmallContainerSmallJsonT);
  57956   tcase_add_test(tc_core, injectNFreeSmallJsonT);
  57957   tcase_add_test(tc_core, injectNFreeUndefinedSmallJsonT);
  57958   tcase_add_test(tc_core, injectNFreeSSmallJsonT);
  57959   tcase_add_test(tc_core, injectNFreeDictSmallJsonT);
  57960   tcase_add_test(tc_core, injectNFreeArraySmallJsonT);
  57961   tcase_add_test(tc_core, injectNFreeArraycSmallJsonT);
  57962   tcase_add_test(tc_core, injectNFreeSmallBoolSmallJsonT);
  57963   tcase_add_test(tc_core, injectNFreeSmallBytesSmallJsonT);
  57964   tcase_add_test(tc_core, injectNFreeSmallDoubleSmallJsonT);
  57965   tcase_add_test(tc_core, injectNFreeSmallIntSmallJsonT);
  57966   tcase_add_test(tc_core, injectNFreeSmallJsonSmallJsonT);
  57967   tcase_add_test(tc_core, injectNFreeSmallStringSmallJsonT);
  57968   tcase_add_test(tc_core, injectNFreeSmallContainerSmallJsonT);
  57969   tcase_add_test(tc_core, uniqSmallJsonT);
  57970   tcase_add_test(tc_core, sortSmallJsonT);
  57971   tcase_add_test(tc_core, icSortSmallJsonT);
  57972   tcase_add_test(tc_core, sortFSmallJsonT);
  57973   tcase_add_test(tc_core, icUniqSmallJsonT);
  57974   tcase_add_test(tc_core, uniqCharSmallJsonT);
  57975   tcase_add_test(tc_core, icUniqCharSmallJsonT);
  57976   tcase_add_test(tc_core, hasSmallJsonT);
  57977   tcase_add_test(tc_core, hasUndefinedSmallJsonT);
  57978   tcase_add_test(tc_core, hasBoolSmallJsonT);
  57979   tcase_add_test(tc_core, hasDoubleSmallJsonT);
  57980   tcase_add_test(tc_core, hasIntSmallJsonT);
  57981   tcase_add_test(tc_core, hasSSmallJsonT);
  57982   tcase_add_test(tc_core, hasCharSmallJsonT);
  57983   tcase_add_test(tc_core, hasDictSmallJsonT);
  57984   tcase_add_test(tc_core, hasArraySmallJsonT);
  57985   tcase_add_test(tc_core, hasArraycSmallJsonT);
  57986   tcase_add_test(tc_core, hasSmallBoolSmallJsonT);
  57987   tcase_add_test(tc_core, hasSmallBytesSmallJsonT);
  57988   tcase_add_test(tc_core, hasSmallDoubleSmallJsonT);
  57989   tcase_add_test(tc_core, hasSmallIntSmallJsonT);
  57990   tcase_add_test(tc_core, hasSmallJsonSmallJsonT);
  57991   tcase_add_test(tc_core, hasSmallStringSmallJsonT);
  57992   tcase_add_test(tc_core, hasSmallContainerSmallJsonT);
  57993   tcase_add_test(tc_core, findSmallJsonT);
  57994   tcase_add_test(tc_core, findCharSmallJsonT);
  57995   tcase_add_test(tc_core, findSmallStringSmallJsonT);
  57996   tcase_add_test(tc_core, findJsonSmallJsonT);
  57997   tcase_add_test(tc_core, indexOfSmallJsonT);
  57998   tcase_add_test(tc_core, indexOfUndefinedSmallJsonT);
  57999   tcase_add_test(tc_core, indexOfBoolSmallJsonT);
  58000   tcase_add_test(tc_core, indexOfDoubleSmallJsonT);
  58001   tcase_add_test(tc_core, indexOfIntSmallJsonT);
  58002   tcase_add_test(tc_core, indexOfSSmallJsonT);
  58003   tcase_add_test(tc_core, indexOfCharSmallJsonT);
  58004   tcase_add_test(tc_core, indexOfDictSmallJsonT);
  58005   tcase_add_test(tc_core, indexOfArraySmallJsonT);
  58006   tcase_add_test(tc_core, indexOfArraycSmallJsonT);
  58007   tcase_add_test(tc_core, indexOfSmallBoolSmallJsonT);
  58008   tcase_add_test(tc_core, indexOfSmallBytesSmallJsonT);
  58009   tcase_add_test(tc_core, indexOfSmallDoubleSmallJsonT);
  58010   tcase_add_test(tc_core, indexOfSmallIntSmallJsonT);
  58011   tcase_add_test(tc_core, indexOfSmallJsonSmallJsonT);
  58012   tcase_add_test(tc_core, indexOfSmallStringSmallJsonT);
  58013   tcase_add_test(tc_core, indexOfSmallContainerSmallJsonT);
  58014   tcase_add_test(tc_core, binarySearchSmallJsonT);
  58015   tcase_add_test(tc_core, binarySearchUndefinedSmallJsonT);
  58016   tcase_add_test(tc_core, binarySearchBoolSmallJsonT);
  58017   tcase_add_test(tc_core, binarySearchDoubleSmallJsonT);
  58018   tcase_add_test(tc_core, binarySearchIntSmallJsonT);
  58019   tcase_add_test(tc_core, binarySearchSSmallJsonT);
  58020   tcase_add_test(tc_core, binarySearchCharSmallJsonT);
  58021   tcase_add_test(tc_core, binarySearchDictSmallJsonT);
  58022   tcase_add_test(tc_core, binarySearchArraySmallJsonT);
  58023   tcase_add_test(tc_core, binarySearchArraycSmallJsonT);
  58024   tcase_add_test(tc_core, binarySearchSmallBoolSmallJsonT);
  58025   tcase_add_test(tc_core, binarySearchSmallBytesSmallJsonT);
  58026   tcase_add_test(tc_core, binarySearchSmallDoubleSmallJsonT);
  58027   tcase_add_test(tc_core, binarySearchSmallIntSmallJsonT);
  58028   tcase_add_test(tc_core, binarySearchSmallJsonSmallJsonT);
  58029   tcase_add_test(tc_core, binarySearchSmallStringSmallJsonT);
  58030   tcase_add_test(tc_core, binarySearchSmallContainerSmallJsonT);
  58031   tcase_add_test(tc_core, icHasSmallJsonT);
  58032   tcase_add_test(tc_core, icHasSSmallJsonT);
  58033   tcase_add_test(tc_core, icHasCharSmallJsonT);
  58034   tcase_add_test(tc_core, icHasDictSmallJsonT);
  58035   tcase_add_test(tc_core, icHasArraySmallJsonT);
  58036   tcase_add_test(tc_core, icHasArraycSmallJsonT);
  58037   tcase_add_test(tc_core, icHasSmallStringSmallJsonT);
  58038   tcase_add_test(tc_core, icFindSmallJsonT);
  58039   tcase_add_test(tc_core, icFindCharSmallJsonT);
  58040   tcase_add_test(tc_core, icFindSmallStringSmallJsonT);
  58041   tcase_add_test(tc_core, icFindJsonSmallJsonT);
  58042   tcase_add_test(tc_core, icIndexOfSmallJsonT);
  58043   tcase_add_test(tc_core, icIndexOfSSmallJsonT);
  58044   tcase_add_test(tc_core, icIndexOfCharSmallJsonT);
  58045   tcase_add_test(tc_core, icIndexOfDictSmallJsonT);
  58046   tcase_add_test(tc_core, icIndexOfArraySmallJsonT);
  58047   tcase_add_test(tc_core, icIndexOfArraycSmallJsonT);
  58048   tcase_add_test(tc_core, icIndexOfSmallStringSmallJsonT);
  58049   tcase_add_test(tc_core, icBinarySearchSmallJsonT);
  58050   tcase_add_test(tc_core, icBinarySearchSSmallJsonT);
  58051   tcase_add_test(tc_core, icBinarySearchCharSmallJsonT);
  58052   tcase_add_test(tc_core, icBinarySearchDictSmallJsonT);
  58053   tcase_add_test(tc_core, icBinarySearchArraySmallJsonT);
  58054   tcase_add_test(tc_core, icBinarySearchArraycSmallJsonT);
  58055   tcase_add_test(tc_core, icBinarySearchSmallStringSmallJsonT);
  58056   tcase_add_test(tc_core, keyBySmallJsonT);
  58057   tcase_add_test(tc_core, keyByUndefinedSmallJsonT);
  58058   tcase_add_test(tc_core, keyByBoolSmallJsonT);
  58059   tcase_add_test(tc_core, keyByDoubleSmallJsonT);
  58060   tcase_add_test(tc_core, keyByIntSmallJsonT);
  58061   tcase_add_test(tc_core, keyBySSmallJsonT);
  58062   tcase_add_test(tc_core, keyByCharSmallJsonT);
  58063   tcase_add_test(tc_core, keyByDictSmallJsonT);
  58064   tcase_add_test(tc_core, keyByArraySmallJsonT);
  58065   tcase_add_test(tc_core, keyByArraycSmallJsonT);
  58066   tcase_add_test(tc_core, keyBySmallBoolSmallJsonT);
  58067   tcase_add_test(tc_core, keyBySmallBytesSmallJsonT);
  58068   tcase_add_test(tc_core, keyBySmallDoubleSmallJsonT);
  58069   tcase_add_test(tc_core, keyBySmallIntSmallJsonT);
  58070   tcase_add_test(tc_core, keyBySmallJsonSmallJsonT);
  58071   tcase_add_test(tc_core, keyBySmallStringSmallJsonT);
  58072   tcase_add_test(tc_core, keyBySmallContainerSmallJsonT);
  58073   tcase_add_test(tc_core, icKeyBySmallJsonT);
  58074   tcase_add_test(tc_core, icKeyBySSmallJsonT);
  58075   tcase_add_test(tc_core, icKeyByCharSmallJsonT);
  58076   tcase_add_test(tc_core, icKeyByDictSmallJsonT);
  58077   tcase_add_test(tc_core, icKeyByArraySmallJsonT);
  58078   tcase_add_test(tc_core, icKeyByArraycSmallJsonT);
  58079   tcase_add_test(tc_core, icKeyBySmallStringSmallJsonT);
  58080   tcase_add_test(tc_core, replaceSmallJsonT);
  58081   tcase_add_test(tc_core, replaceCharSSmallJsonT);
  58082   tcase_add_test(tc_core, replaceSCharSmallJsonT);
  58083   tcase_add_test(tc_core, replaceCharCharSmallJsonT);
  58084   tcase_add_test(tc_core, replaceSmallStringSmallStringSmallJsonT);
  58085   tcase_add_test(tc_core, replaceSmallStringSSmallJsonT);
  58086   tcase_add_test(tc_core, replaceSmallStringCharSmallJsonT);
  58087   tcase_add_test(tc_core, replaceSSmallStringSmallJsonT);
  58088   tcase_add_test(tc_core, replaceCharSmallStringSmallJsonT);
  58089   tcase_add_test(tc_core, replaceJsonJsonSmallJsonT);
  58090   tcase_add_test(tc_core, replaceJsonSmallStringSmallJsonT);
  58091   tcase_add_test(tc_core, replaceJsonSSmallJsonT);
  58092   tcase_add_test(tc_core, replaceJsonCharSmallJsonT);
  58093   tcase_add_test(tc_core, replaceSmallStringJsonSmallJsonT);
  58094   tcase_add_test(tc_core, replaceSJsonSmallJsonT);
  58095   tcase_add_test(tc_core, replaceCharJsonSmallJsonT);
  58096   tcase_add_test(tc_core, replaceManySmallJsonT);
  58097   tcase_add_test(tc_core, icReplaceSmallJsonT);
  58098   tcase_add_test(tc_core, icReplaceCharSSmallJsonT);
  58099   tcase_add_test(tc_core, icReplaceSCharSmallJsonT);
  58100   tcase_add_test(tc_core, icReplaceCharCharSmallJsonT);
  58101   tcase_add_test(tc_core, icReplaceSmallStringSmallStringSmallJsonT);
  58102   tcase_add_test(tc_core, icReplaceSmallStringSSmallJsonT);
  58103   tcase_add_test(tc_core, icReplaceSmallStringCharSmallJsonT);
  58104   tcase_add_test(tc_core, icReplaceSSmallStringSmallJsonT);
  58105   tcase_add_test(tc_core, icReplaceCharSmallStringSmallJsonT);
  58106   tcase_add_test(tc_core, icReplaceJsonJsonSmallJsonT);
  58107   tcase_add_test(tc_core, icReplaceJsonSmallStringSmallJsonT);
  58108   tcase_add_test(tc_core, icReplaceJsonSSmallJsonT);
  58109   tcase_add_test(tc_core, icReplaceJsonCharSmallJsonT);
  58110   tcase_add_test(tc_core, icReplaceSmallStringJsonSmallJsonT);
  58111   tcase_add_test(tc_core, icReplaceSJsonSmallJsonT);
  58112   tcase_add_test(tc_core, icReplaceCharJsonSmallJsonT);
  58113   tcase_add_test(tc_core, icReplaceManySmallJsonT);
  58114   tcase_add_test(tc_core, equalSmallJsonSmallArrayT);
  58115   tcase_add_test(tc_core, equalSmallJsonArrayT);
  58116   tcase_add_test(tc_core, equalSmallJsonBaseT);
  58117   tcase_add_test(tc_core, equalSmallJsonChaT);
  58118   tcase_add_test(tc_core, equalSmallJsonCharT);
  58119   tcase_add_test(tc_core, equalSmallJsonBoolT);
  58120   tcase_add_test(tc_core, equalSmallJsonDoubleT);
  58121   tcase_add_test(tc_core, equalSmallJsonInt64T);
  58122   tcase_add_test(tc_core, equalSmallJsonInt32T);
  58123   tcase_add_test(tc_core, equalSmallJsonUint32T);
  58124   tcase_add_test(tc_core, equalSmallJsonUint64T);
  58125   tcase_add_test(tc_core, equalSmallJsonSmallBoolT);
  58126   tcase_add_test(tc_core, equalSmallJsonSmallBytesT);
  58127   tcase_add_test(tc_core, equalSmallJsonSmallDoubleT);
  58128   tcase_add_test(tc_core, equalSmallJsonSmallIntT);
  58129   tcase_add_test(tc_core, equalSmallJsonSmallJsonT);
  58130   tcase_add_test(tc_core, equalSmallJsonSmallStringT);
  58131   tcase_add_test(tc_core, equalSmallJsonSmallDictT);
  58132   tcase_add_test(tc_core, icEqualSmallJsonSmallArrayT);
  58133   tcase_add_test(tc_core, icEqualSmallJsonArrayT);
  58134   tcase_add_test(tc_core, icEqualSmallJsonBaseT);
  58135   tcase_add_test(tc_core, icEqualSmallJsonSmallDictT);
  58136   tcase_add_test(tc_core, icEqualSmallJsonSmallJsonT);
  58137   tcase_add_test(tc_core, icEqualSmallJsonSmallStringT);
  58138   tcase_add_test(tc_core, icEqualSSmallJsonT);
  58139   tcase_add_test(tc_core, icEqualCharSmallJsonT);
  58140   tcase_add_test(tc_core, equalISSmallJsonT);
  58141   tcase_add_test(tc_core, equalICharSmallJsonT);
  58142   tcase_add_test(tc_core, equalIJsonSmallJsonT);
  58143   tcase_add_test(tc_core, equalISmallStringSmallJsonT);
  58144   tcase_add_test(tc_core, startsWithSSmallJsonT);
  58145   tcase_add_test(tc_core, startsWithCharSmallJsonT);
  58146   tcase_add_test(tc_core, startsWithSmallStringSmallJsonT);
  58147   tcase_add_test(tc_core, startsWithJsonSmallJsonT);
  58148   tcase_add_test(tc_core, endsWithSSmallJsonT);
  58149   tcase_add_test(tc_core, endsWithCharSmallJsonT);
  58150   tcase_add_test(tc_core, endsWithSmallStringSmallJsonT);
  58151   tcase_add_test(tc_core, endsWithJsonSmallJsonT);
  58152   tcase_add_test(tc_core, countSSmallJsonT);
  58153   tcase_add_test(tc_core, countCharSmallJsonT);
  58154   tcase_add_test(tc_core, countSmallStringSmallJsonT);
  58155   tcase_add_test(tc_core, countJsonSmallJsonT);
  58156   tcase_add_test(tc_core, icStartsWithSSmallJsonT);
  58157   tcase_add_test(tc_core, icStartsWithCharSmallJsonT);
  58158   tcase_add_test(tc_core, icStartsWithSmallStringSmallJsonT);
  58159   tcase_add_test(tc_core, icStartsWithJsonSmallJsonT);
  58160   tcase_add_test(tc_core, icEndsWithSSmallJsonT);
  58161   tcase_add_test(tc_core, icEndsWithCharSmallJsonT);
  58162   tcase_add_test(tc_core, icEndsWithSmallStringSmallJsonT);
  58163   tcase_add_test(tc_core, icEndsWithJsonSmallJsonT);
  58164   tcase_add_test(tc_core, icCountSSmallJsonT);
  58165   tcase_add_test(tc_core, icCountCharSmallJsonT);
  58166   tcase_add_test(tc_core, icCountSmallStringSmallJsonT);
  58167   tcase_add_test(tc_core, icCountJsonSmallJsonT);
  58168   tcase_add_test(tc_core, isNumberSmallJsonT);
  58169   tcase_add_test(tc_core, isIntSmallJsonT);
  58170   tcase_add_test(tc_core, parseIntSmallJsonT);
  58171   tcase_add_test(tc_core, parseDoubleSmallJsonT);
  58172   tcase_add_test(tc_core, intToSmallJsonT);
  58173   tcase_add_test(tc_core, doubleToSmallJsonT);
  58174   tcase_add_test(tc_core, upperSmallJsonT);
  58175   tcase_add_test(tc_core, lowerSmallJsonT);
  58176   tcase_add_test(tc_core, trimSmallJsonT);
  58177   tcase_add_test(tc_core, lTrimSmallJsonT);
  58178   tcase_add_test(tc_core, rTrimSmallJsonT);
  58179   tcase_add_test(tc_core, keysSmallJsonT);
  58180   tcase_add_test(tc_core, keysSmallStringSmallJsonT);
  58181   tcase_add_test(tc_core, valuesSmallJsonT);
  58182   tcase_add_test(tc_core, compactSmallJsonT);
  58183   tcase_add_test(tc_core, isEmptySmallJsonT);
  58184   tcase_add_test(tc_core, isBlankSmallJsonT);
  58185   tcase_add_test(tc_core, forEachSmallJsonFT);
  58186   tcase_add_test(tc_core, enumerateSmallJsonFT);
  58187   tcase_add_test(tc_core, enumerateDictSmallJsonT);
  58188   tcase_add_test(tc_core, joinSmallJsonT);
  58189   tcase_add_test(tc_core, joinCharSmallJsonT);
  58190   tcase_add_test(tc_core, joinSmallJsonSmallJsonT);
  58191   tcase_add_test(tc_core, joinSmallStringSmallJsonT);
  58192   tcase_add_test(tc_core, joinSSmallJsonT);
  58193   tcase_add_test(tc_core, joinCharSSmallJsonT);
  58194   tcase_add_test(tc_core, joinSmallJsonSSmallJsonT);
  58195   tcase_add_test(tc_core, joinSmallStringSSmallJsonT);
  58196   tcase_add_test(tc_core, splitSmallJsonT);
  58197   tcase_add_test(tc_core, splitCharSmallJsonT);
  58198   tcase_add_test(tc_core, splitSmallJsonSmallJsonT);
  58199   tcase_add_test(tc_core, splitSmallStringSmallJsonT);
  58200   tcase_add_test(tc_core, splitSSmallJsonT);
  58201   tcase_add_test(tc_core, splitCharSSmallJsonT);
  58202   tcase_add_test(tc_core, splitSmallJsonSSmallJsonT);
  58203   tcase_add_test(tc_core, splitSmallStringSSmallJsonT);
  58204   tcase_add_test(tc_core, extractSmallJsonT);
  58205   tcase_add_test(tc_core, extractCharSSmallJsonT);
  58206   tcase_add_test(tc_core, extractSCharSmallJsonT);
  58207   tcase_add_test(tc_core, extractCharCharSmallJsonT);
  58208   tcase_add_test(tc_core, extractSmallJsonSmallJsonSmallJsonT);
  58209   tcase_add_test(tc_core, extractSmallJsonSmallStringSmallJsonT);
  58210   tcase_add_test(tc_core, extractSmallJsonSSmallJsonT);
  58211   tcase_add_test(tc_core, extractSmallJsonCharSmallJsonT);
  58212   tcase_add_test(tc_core, extractSmallStringSmallJsonSmallJsonT);
  58213   tcase_add_test(tc_core, extractSmallStringSmallStringSmallJsonT);
  58214   tcase_add_test(tc_core, extractSmallStringSSmallJsonT);
  58215   tcase_add_test(tc_core, extractSmallStringCharSmallJsonT);
  58216   tcase_add_test(tc_core, extractSSmallJsonSmallJsonT);
  58217   tcase_add_test(tc_core, extractSSmallStringSmallJsonT);
  58218   tcase_add_test(tc_core, extractCharSmallJsonSmallJsonT);
  58219   tcase_add_test(tc_core, extractCharSmallStringSmallJsonT);
  58220   tcase_add_test(tc_core, icSplitSmallJsonT);
  58221   tcase_add_test(tc_core, icSplitCharSmallJsonT);
  58222   tcase_add_test(tc_core, icSplitSmallJsonSmallJsonT);
  58223   tcase_add_test(tc_core, icSplitSmallStringSmallJsonT);
  58224   tcase_add_test(tc_core, icSplitSSmallJsonT);
  58225   tcase_add_test(tc_core, icSplitCharSSmallJsonT);
  58226   tcase_add_test(tc_core, icSplitSmallJsonSSmallJsonT);
  58227   tcase_add_test(tc_core, icSplitSmallStringSSmallJsonT);
  58228   tcase_add_test(tc_core, icExtractSmallJsonT);
  58229   tcase_add_test(tc_core, icExtractCharSSmallJsonT);
  58230   tcase_add_test(tc_core, icExtractSCharSmallJsonT);
  58231   tcase_add_test(tc_core, icExtractCharCharSmallJsonT);
  58232   tcase_add_test(tc_core, icExtractSmallJsonSmallJsonSmallJsonT);
  58233   tcase_add_test(tc_core, icExtractSmallJsonSmallStringSmallJsonT);
  58234   tcase_add_test(tc_core, icExtractSmallJsonSSmallJsonT);
  58235   tcase_add_test(tc_core, icExtractSmallJsonCharSmallJsonT);
  58236   tcase_add_test(tc_core, icExtractSmallStringSmallJsonSmallJsonT);
  58237   tcase_add_test(tc_core, icExtractSmallStringSmallStringSmallJsonT);
  58238   tcase_add_test(tc_core, icExtractSmallStringSSmallJsonT);
  58239   tcase_add_test(tc_core, icExtractSmallStringCharSmallJsonT);
  58240   tcase_add_test(tc_core, icExtractSSmallJsonSmallJsonT);
  58241   tcase_add_test(tc_core, icExtractSSmallStringSmallJsonT);
  58242   tcase_add_test(tc_core, icExtractCharSmallJsonSmallJsonT);
  58243   tcase_add_test(tc_core, icExtractCharSmallStringSmallJsonT);
  58244   tcase_add_test(tc_core, colorSmallJsonT);
  58245   tcase_add_test(tc_core, colordSmallJsonT);
  58246   tcase_add_test(tc_core, zipSmallJsonT);
  58247   tcase_add_test(tc_core, zipArraySmallJsonT);
  58248   tcase_add_test(tc_core, zipCArraySmallJsonT);
  58249   tcase_add_test(tc_core, zipCharSmallJsonT);
  58250   tcase_add_test(tc_core, zipCCharSmallJsonT);
  58251   tcase_add_test(tc_core, zipArrayCharSmallJsonT);
  58252   tcase_add_test(tc_core, zipCArrayCharSmallJsonT);
  58253   tcase_add_test(tc_core, zipArrayCCharSmallJsonT);
  58254   tcase_add_test(tc_core, zipCArrayCCharSmallJsonT);
  58255   tcase_add_test(tc_core, zipJsonSmallJsonT);
  58256   tcase_add_test(tc_core, zipJsonSmallArraySmallJsonT);
  58257   tcase_add_test(tc_core, zipJsonArraySmallJsonT);
  58258   tcase_add_test(tc_core, zipJsonCArraySmallJsonT);
  58259   tcase_add_test(tc_core, zipSmallArrayJsonSmallJsonT);
  58260   tcase_add_test(tc_core, zipArrayJsonSmallJsonT);
  58261   tcase_add_test(tc_core, zipCArrayJsonSmallJsonT);
  58262   tcase_add_test(tc_core, iterStartSmallJsonT);
  58263   tcase_add_test(tc_core, iterStartKeySmallJsonT);
  58264   tcase_add_test(tc_core, iterStartLastSmallJsonT);
  58265   tcase_add_test(tc_core, iterStartFromSmallJsonT);
  58266   tcase_add_test(tc_core, iterStartFromStepSmallJsonT);
  58267   tcase_add_test(tc_core, iterNextSmallJsonT);
  58268   tcase_add_test(tc_core, iterNextKeySmallJsonT);
  58269   tcase_add_test(tc_core, iterElementSmallJsonT);
  58270   tcase_add_test(tc_core, iterKeySmallJsonT);
  58271   tcase_add_test(tc_core, iterIndexSmallJsonT);
  58272   tcase_add_test(tc_core, iterStepSmallJsonT);
  58273   tcase_add_test(tc_core, getUndefinedSmallJsonT);
  58274   tcase_add_test(tc_core, getBoolSmallJsonT);
  58275   tcase_add_test(tc_core, getBoolPSmallJsonT);
  58276   tcase_add_test(tc_core, getDoubleSmallJsonT);
  58277   tcase_add_test(tc_core, getDoublePSmallJsonT);
  58278   tcase_add_test(tc_core, getIntSmallJsonT);
  58279   tcase_add_test(tc_core, getIntPSmallJsonT);
  58280   tcase_add_test(tc_core, getInt32SmallJsonT);
  58281   tcase_add_test(tc_core, getInt32PSmallJsonT);
  58282   tcase_add_test(tc_core, getUintSmallJsonT);
  58283   tcase_add_test(tc_core, getUintPSmallJsonT);
  58284   tcase_add_test(tc_core, getUint32SmallJsonT);
  58285   tcase_add_test(tc_core, getUint32PSmallJsonT);
  58286   tcase_add_test(tc_core, getSSmallJsonT);
  58287   tcase_add_test(tc_core, getDictSmallJsonT);
  58288   tcase_add_test(tc_core, getArraySmallJsonT);
  58289   tcase_add_test(tc_core, getSmallBoolSmallJsonT);
  58290   tcase_add_test(tc_core, getSmallBytesSmallJsonT);
  58291   tcase_add_test(tc_core, getSmallDoubleSmallJsonT);
  58292   tcase_add_test(tc_core, getSmallIntSmallJsonT);
  58293   tcase_add_test(tc_core, getSmallJsonSmallJsonT);
  58294   tcase_add_test(tc_core, getSmallStringSmallJsonT);
  58295   tcase_add_test(tc_core, getVoidSmallJsonT);
  58296   tcase_add_test(tc_core, getSmallContainerSmallJsonT);
  58297   tcase_add_test(tc_core, getNDupSmallJsonT);
  58298   tcase_add_test(tc_core, getNDupUndefinedSmallJsonT);
  58299   tcase_add_test(tc_core, getNDupBoolSmallJsonT);
  58300   tcase_add_test(tc_core, getNDupDoubleSmallJsonT);
  58301   tcase_add_test(tc_core, getNDupIntSmallJsonT);
  58302   tcase_add_test(tc_core, getNDupInt32SmallJsonT);
  58303   tcase_add_test(tc_core, getNDupUintSmallJsonT);
  58304   tcase_add_test(tc_core, getNDupUint32SmallJsonT);
  58305   tcase_add_test(tc_core, getNDupSSmallJsonT);
  58306   tcase_add_test(tc_core, getNDupDictSmallJsonT);
  58307   tcase_add_test(tc_core, getNDupArraySmallJsonT);
  58308   tcase_add_test(tc_core, getNDupSmallBoolSmallJsonT);
  58309   tcase_add_test(tc_core, getNDupSmallBytesSmallJsonT);
  58310   tcase_add_test(tc_core, getNDupSmallDoubleSmallJsonT);
  58311   tcase_add_test(tc_core, getNDupSmallIntSmallJsonT);
  58312   tcase_add_test(tc_core, getNDupSmallJsonSmallJsonT);
  58313   tcase_add_test(tc_core, getNDupSmallStringSmallJsonT);
  58314   tcase_add_test(tc_core, getNDupVoidSmallJsonT);
  58315   tcase_add_test(tc_core, getNDupSmallContainerSmallJsonT);
  58316   tcase_add_test(tc_core, getAtSmallJsonT);
  58317   tcase_add_test(tc_core, getAtUndefinedSmallJsonT);
  58318   tcase_add_test(tc_core, getAtBoolSmallJsonT);
  58319   tcase_add_test(tc_core, getAtBoolPSmallJsonT);
  58320   tcase_add_test(tc_core, getAtDoubleSmallJsonT);
  58321   tcase_add_test(tc_core, getAtDoublePSmallJsonT);
  58322   tcase_add_test(tc_core, getAtIntSmallJsonT);
  58323   tcase_add_test(tc_core, getAtIntPSmallJsonT);
  58324   tcase_add_test(tc_core, getAtInt32SmallJsonT);
  58325   tcase_add_test(tc_core, getAtInt32PSmallJsonT);
  58326   tcase_add_test(tc_core, getAtUintSmallJsonT);
  58327   tcase_add_test(tc_core, getAtUintPSmallJsonT);
  58328   tcase_add_test(tc_core, getAtUint32SmallJsonT);
  58329   tcase_add_test(tc_core, getAtUint32PSmallJsonT);
  58330   tcase_add_test(tc_core, getAtSSmallJsonT);
  58331   tcase_add_test(tc_core, getAtDictSmallJsonT);
  58332   tcase_add_test(tc_core, getAtArraySmallJsonT);
  58333   tcase_add_test(tc_core, getAtSmallBoolSmallJsonT);
  58334   tcase_add_test(tc_core, getAtSmallBytesSmallJsonT);
  58335   tcase_add_test(tc_core, getAtSmallDoubleSmallJsonT);
  58336   tcase_add_test(tc_core, getAtSmallIntSmallJsonT);
  58337   tcase_add_test(tc_core, getAtSmallJsonSmallJsonT);
  58338   tcase_add_test(tc_core, getAtSmallStringSmallJsonT);
  58339   tcase_add_test(tc_core, getAtVoidSmallJsonT);
  58340   tcase_add_test(tc_core, getAtSmallContainerSmallJsonT);
  58341   tcase_add_test(tc_core, getAtNDupSmallJsonT);
  58342   tcase_add_test(tc_core, getAtNDupUndefinedSmallJsonT);
  58343   tcase_add_test(tc_core, getAtNDupBoolSmallJsonT);
  58344   tcase_add_test(tc_core, getAtNDupDoubleSmallJsonT);
  58345   tcase_add_test(tc_core, getAtNDupIntSmallJsonT);
  58346   tcase_add_test(tc_core, getAtNDupInt32SmallJsonT);
  58347   tcase_add_test(tc_core, getAtNDupUintSmallJsonT);
  58348   tcase_add_test(tc_core, getAtNDupUint32SmallJsonT);
  58349   tcase_add_test(tc_core, getAtNDupSSmallJsonT);
  58350   tcase_add_test(tc_core, getAtNDupDictSmallJsonT);
  58351   tcase_add_test(tc_core, getAtNDupArraySmallJsonT);
  58352   tcase_add_test(tc_core, getAtNDupSmallBoolSmallJsonT);
  58353   tcase_add_test(tc_core, getAtNDupSmallBytesSmallJsonT);
  58354   tcase_add_test(tc_core, getAtNDupSmallDoubleSmallJsonT);
  58355   tcase_add_test(tc_core, getAtNDupSmallIntSmallJsonT);
  58356   tcase_add_test(tc_core, getAtNDupSmallJsonSmallJsonT);
  58357   tcase_add_test(tc_core, getAtNDupSmallStringSmallJsonT);
  58358   tcase_add_test(tc_core, getAtNDupVoidSmallJsonT);
  58359   tcase_add_test(tc_core, getAtNDupSmallContainerSmallJsonT);
  58360   tcase_add_test(tc_core, getNumSmallJsonT);
  58361   tcase_add_test(tc_core, getNumAtSmallJsonT);
  58362   tcase_add_test(tc_core, delElemSmallJsonT);
  58363   tcase_add_test(tc_core, delSmallJsonT);
  58364   tcase_add_test(tc_core, delElemIndexSmallJsonT);
  58365   tcase_add_test(tc_core, removeElemSmallJsonT);
  58366   tcase_add_test(tc_core, removeSmallJsonT);
  58367   tcase_add_test(tc_core, removeElemIndexSmallJsonT);
  58368   tcase_add_test(tc_core, stringifySmallStringSmallJsonT);
  58369   tcase_add_test(tc_core, toYMLSmallStringSmallJsonT);
  58370   tcase_add_test(tc_core, parseSmallJsonSmallJsonT);
  58371   tcase_add_test(tc_core, parseSmallStringSmallJsonT);
  58372   tcase_add_test(tc_core, parseYMLSmallJsonSmallJsonT);
  58373   tcase_add_test(tc_core, parseYMLSmallStringSmallJsonT);
  58374   tcase_add_test(tc_core, logSmallJsonT);
  58375   tcase_add_test(tc_core, readFileSmallJsonT);
  58376   tcase_add_test(tc_core, readFileSmallStringSmallJsonT);
  58377   tcase_add_test(tc_core, readFileJsonSmallJsonT);
  58378   tcase_add_test(tc_core, readStreamSmallJsonT);
  58379   tcase_add_test(tc_core, writeFileSmallJsonT);
  58380   tcase_add_test(tc_core, writeFileSmallStringSmallJsonT);
  58381   tcase_add_test(tc_core, writeFileJsonSmallJsonT);
  58382   tcase_add_test(tc_core, writeStreamSmallJsonT);
  58383   tcase_add_test(tc_core, appendFileSmallJsonT);
  58384   tcase_add_test(tc_core, appendFileSmallStringSmallJsonT);
  58385   tcase_add_test(tc_core, appendFileJsonSmallJsonT);
  58386   tcase_add_test(tc_core, readTextSmallJsonT);
  58387   tcase_add_test(tc_core, readTextSmallStringSmallJsonT);
  58388   tcase_add_test(tc_core, readTextJsonSmallJsonT);
  58389   tcase_add_test(tc_core, readTextStreamSmallJsonT);
  58390   tcase_add_test(tc_core, writeTextSmallJsonT);
  58391   tcase_add_test(tc_core, writeTextSmallStringSmallJsonT);
  58392   tcase_add_test(tc_core, writeTextJsonSmallJsonT);
  58393   tcase_add_test(tc_core, writeTextStreamSmallJsonT);
  58394   tcase_add_test(tc_core, appendTextSmallJsonT);
  58395   tcase_add_test(tc_core, appendTextSmallStringSmallJsonT);
  58396   tcase_add_test(tc_core, appendTextJsonSmallJsonT);
  58397   tcase_add_test(tc_core, typeStringSmallJsonT);
  58398   tcase_add_test(tc_core, typeSmallStringSmallJsonT);
  58399   tcase_add_test(tc_core, typeAtStringSmallJsonT);
  58400   tcase_add_test(tc_core, typeAtSmallStringSmallJsonT);
  58401   tcase_add_test(tc_core, typeStringKCharSmallJsonT);
  58402   tcase_add_test(tc_core, typeSmallStringKCharSmallJsonT);
  58403   tcase_add_test(tc_core, typeSmallJsonT);
  58404   tcase_add_test(tc_core, typeKCharSmallJsonT);
  58405   tcase_add_test(tc_core, typeAtSmallJsonT);
  58406   tcase_add_test(tc_core, typeStringsSmallJsonT);
  58407   tcase_add_test(tc_core, typesSmallJsonT);
  58408   tcase_add_test(tc_core, isETypeAtSmallJsonT);
  58409   tcase_add_test(tc_core, isEUndefinedAtSmallJsonT);
  58410   tcase_add_test(tc_core, isEBoolAtSmallJsonT);
  58411   tcase_add_test(tc_core, isEContainerAtSmallJsonT);
  58412   tcase_add_test(tc_core, isEDictAtSmallJsonT);
  58413   tcase_add_test(tc_core, isEDoubleAtSmallJsonT);
  58414   tcase_add_test(tc_core, isEIntAtSmallJsonT);
  58415   tcase_add_test(tc_core, isEStringAtSmallJsonT);
  58416   tcase_add_test(tc_core, isEFaststringAtSmallJsonT);
  58417   tcase_add_test(tc_core, isEArrayAtSmallJsonT);
  58418   tcase_add_test(tc_core, isEBytesAtSmallJsonT);
  58419   tcase_add_test(tc_core, isETypeSmallJsonT);
  58420   tcase_add_test(tc_core, isEUndefinedSmallJsonT);
  58421   tcase_add_test(tc_core, isEBoolSmallJsonT);
  58422   tcase_add_test(tc_core, isEContainerSmallJsonT);
  58423   tcase_add_test(tc_core, isEDictSmallJsonT);
  58424   tcase_add_test(tc_core, isEDoubleSmallJsonT);
  58425   tcase_add_test(tc_core, isEIntSmallJsonT);
  58426   tcase_add_test(tc_core, isEStringSmallJsonT);
  58427   tcase_add_test(tc_core, isEFaststringSmallJsonT);
  58428   tcase_add_test(tc_core, isEArraySmallJsonT);
  58429   tcase_add_test(tc_core, isEBytesSmallJsonT);
  58430   tcase_add_test(tc_core, areAllETypeSmallJsonT);
  58431   tcase_add_test(tc_core, areAllEUndefinedSmallJsonT);
  58432   tcase_add_test(tc_core, areAllEBoolSmallJsonT);
  58433   tcase_add_test(tc_core, areAllEContainerSmallJsonT);
  58434   tcase_add_test(tc_core, areAllEDictSmallJsonT);
  58435   tcase_add_test(tc_core, areAllEDoubleSmallJsonT);
  58436   tcase_add_test(tc_core, areAllEIntSmallJsonT);
  58437   tcase_add_test(tc_core, areAllEStringSmallJsonT);
  58438   tcase_add_test(tc_core, areAllEFaststringSmallJsonT);
  58439   tcase_add_test(tc_core, areAllEArraySmallJsonT);
  58440   tcase_add_test(tc_core, areAllEBytesSmallJsonT);
  58441   tcase_add_test(tc_core, duplicateSmallJsonGT);
  58442   tcase_add_test(tc_core, freeSmallJsonGT);
  58443   tcase_add_test(tc_core, setTopSmallJsonGT);
  58444   tcase_add_test(tc_core, setTopBoolSmallJsonGT);
  58445   tcase_add_test(tc_core, setTopDoubleSmallJsonGT);
  58446   tcase_add_test(tc_core, setTopIntSmallJsonGT);
  58447   tcase_add_test(tc_core, setTopStringSmallJsonGT);
  58448   tcase_add_test(tc_core, setTopCharSmallJsonGT);
  58449   tcase_add_test(tc_core, setTopDictSmallJsonGT);
  58450   tcase_add_test(tc_core, setTopArraySmallJsonGT);
  58451   tcase_add_test(tc_core, setTopArraycSmallJsonGT);
  58452   tcase_add_test(tc_core, setTopCArraycSmallJsonGT);
  58453   tcase_add_test(tc_core, setTopSmallBoolSmallJsonGT);
  58454   tcase_add_test(tc_core, setTopSmallDoubleSmallJsonGT);
  58455   tcase_add_test(tc_core, setTopSmallIntSmallJsonGT);
  58456   tcase_add_test(tc_core, setTopSmallJsonSmallJsonGT);
  58457   tcase_add_test(tc_core, setTopSmallStringSmallJsonGT);
  58458   tcase_add_test(tc_core, setTopNFreeSmallJsonGT);
  58459   tcase_add_test(tc_core, setTopNFreeBoolSmallJsonGT);
  58460   tcase_add_test(tc_core, setTopNFreeDoubleSmallJsonGT);
  58461   tcase_add_test(tc_core, setTopNFreeIntSmallJsonGT);
  58462   tcase_add_test(tc_core, setTopNFreeStringSmallJsonGT);
  58463   tcase_add_test(tc_core, setTopNFreeDictSmallJsonGT);
  58464   tcase_add_test(tc_core, setTopNFreeArraySmallJsonGT);
  58465   tcase_add_test(tc_core, setTopNFreeArraycSmallJsonGT);
  58466   tcase_add_test(tc_core, setTopNFreeSmallBoolSmallJsonGT);
  58467   tcase_add_test(tc_core, setTopNFreeSmallDoubleSmallJsonGT);
  58468   tcase_add_test(tc_core, setTopNFreeSmallIntSmallJsonGT);
  58469   tcase_add_test(tc_core, setTopNFreeSmallJsonSmallJsonGT);
  58470   tcase_add_test(tc_core, setTopNFreeSmallStringSmallJsonGT);
  58471   tcase_add_test(tc_core, fromArraySmallJsonGT);
  58472   tcase_add_test(tc_core, fromCArraySmallJsonGT);
  58473   tcase_add_test(tc_core, getTopSmallJsonGT);
  58474   tcase_add_test(tc_core, getTopUndefinedSmallJsonGT);
  58475   tcase_add_test(tc_core, getTopBoolSmallJsonGT);
  58476   tcase_add_test(tc_core, getTopBoolPSmallJsonGT);
  58477   tcase_add_test(tc_core, getTopDoubleSmallJsonGT);
  58478   tcase_add_test(tc_core, getTopDoublePSmallJsonGT);
  58479   tcase_add_test(tc_core, getTopIntSmallJsonGT);
  58480   tcase_add_test(tc_core, getTopIntPSmallJsonGT);
  58481   tcase_add_test(tc_core, getTopInt32SmallJsonGT);
  58482   tcase_add_test(tc_core, getTopInt32PSmallJsonGT);
  58483   tcase_add_test(tc_core, getTopUintSmallJsonGT);
  58484   tcase_add_test(tc_core, getTopUintPSmallJsonGT);
  58485   tcase_add_test(tc_core, getTopUint32SmallJsonGT);
  58486   tcase_add_test(tc_core, getTopUint32PSmallJsonGT);
  58487   tcase_add_test(tc_core, getTopSSmallJsonGT);
  58488   tcase_add_test(tc_core, getTopDictSmallJsonGT);
  58489   tcase_add_test(tc_core, getTopArraySmallJsonGT);
  58490   tcase_add_test(tc_core, getTopSmallBoolSmallJsonGT);
  58491   tcase_add_test(tc_core, getTopSmallDoubleSmallJsonGT);
  58492   tcase_add_test(tc_core, getTopSmallIntSmallJsonGT);
  58493   tcase_add_test(tc_core, getTopSmallStringSmallJsonGT);
  58494   tcase_add_test(tc_core, pushSmallJsonGT);
  58495   tcase_add_test(tc_core, pushUndefinedSmallJsonGT);
  58496   tcase_add_test(tc_core, pushBoolSmallJsonGT);
  58497   tcase_add_test(tc_core, pushDoubleSmallJsonGT);
  58498   tcase_add_test(tc_core, pushIntSmallJsonGT);
  58499   tcase_add_test(tc_core, pushSSmallJsonGT);
  58500   tcase_add_test(tc_core, pushCharSmallJsonGT);
  58501   tcase_add_test(tc_core, pushDictSmallJsonGT);
  58502   tcase_add_test(tc_core, pushArraySmallJsonGT);
  58503   tcase_add_test(tc_core, pushArraycSmallJsonGT);
  58504   tcase_add_test(tc_core, pushCArraycSmallJsonGT);
  58505   tcase_add_test(tc_core, pushVoidSmallJsonGT);
  58506   tcase_add_test(tc_core, pushSmallBoolSmallJsonGT);
  58507   tcase_add_test(tc_core, pushSmallBytesSmallJsonGT);
  58508   tcase_add_test(tc_core, pushSmallDoubleSmallJsonGT);
  58509   tcase_add_test(tc_core, pushSmallIntSmallJsonGT);
  58510   tcase_add_test(tc_core, pushSmallJsonSmallJsonGT);
  58511   tcase_add_test(tc_core, pushSmallStringSmallJsonGT);
  58512   tcase_add_test(tc_core, pushSmallContainerSmallJsonGT);
  58513   tcase_add_test(tc_core, pushNFreeSmallJsonGT);
  58514   tcase_add_test(tc_core, pushNFreeUndefinedSmallJsonGT);
  58515   tcase_add_test(tc_core, pushNFreeSSmallJsonGT);
  58516   tcase_add_test(tc_core, pushNFreeDictSmallJsonGT);
  58517   tcase_add_test(tc_core, pushNFreeArraySmallJsonGT);
  58518   tcase_add_test(tc_core, pushNFreeArraycSmallJsonGT);
  58519   tcase_add_test(tc_core, pushNFreeSmallBoolSmallJsonGT);
  58520   tcase_add_test(tc_core, pushNFreeSmallBytesSmallJsonGT);
  58521   tcase_add_test(tc_core, pushNFreeSmallDoubleSmallJsonGT);
  58522   tcase_add_test(tc_core, pushNFreeSmallIntSmallJsonGT);
  58523   tcase_add_test(tc_core, pushNFreeSmallJsonSmallJsonGT);
  58524   tcase_add_test(tc_core, pushNFreeSmallStringSmallJsonGT);
  58525   tcase_add_test(tc_core, pushNFreeSmallContainerSmallJsonGT);
  58526   tcase_add_test(tc_core, popSmallJsonGT);
  58527   tcase_add_test(tc_core, popUndefinedSmallJsonGT);
  58528   tcase_add_test(tc_core, popBoolSmallJsonGT);
  58529   tcase_add_test(tc_core, popDoubleSmallJsonGT);
  58530   tcase_add_test(tc_core, popIntSmallJsonGT);
  58531   tcase_add_test(tc_core, popInt32SmallJsonGT);
  58532   tcase_add_test(tc_core, popUintSmallJsonGT);
  58533   tcase_add_test(tc_core, popUint32SmallJsonGT);
  58534   tcase_add_test(tc_core, popSSmallJsonGT);
  58535   tcase_add_test(tc_core, popDictSmallJsonGT);
  58536   tcase_add_test(tc_core, popArraySmallJsonGT);
  58537   tcase_add_test(tc_core, popSmallBoolSmallJsonGT);
  58538   tcase_add_test(tc_core, popSmallBytesSmallJsonGT);
  58539   tcase_add_test(tc_core, popSmallDoubleSmallJsonGT);
  58540   tcase_add_test(tc_core, popSmallIntSmallJsonGT);
  58541   tcase_add_test(tc_core, popSmallJsonSmallJsonGT);
  58542   tcase_add_test(tc_core, popSmallStringSmallJsonGT);
  58543   tcase_add_test(tc_core, popVoidSmallJsonGT);
  58544   tcase_add_test(tc_core, popSmallContainerSmallJsonGT);
  58545   tcase_add_test(tc_core, setSmallJsonGT);
  58546   tcase_add_test(tc_core, setUndefinedSmallJsonGT);
  58547   tcase_add_test(tc_core, setBoolSmallJsonGT);
  58548   tcase_add_test(tc_core, setDoubleSmallJsonGT);
  58549   tcase_add_test(tc_core, setIntSmallJsonGT);
  58550   tcase_add_test(tc_core, setSSmallJsonGT);
  58551   tcase_add_test(tc_core, setCharSmallJsonGT);
  58552   tcase_add_test(tc_core, setDictSmallJsonGT);
  58553   tcase_add_test(tc_core, setArraySmallJsonGT);
  58554   tcase_add_test(tc_core, setArraycSmallJsonGT);
  58555   tcase_add_test(tc_core, setCArraycSmallJsonGT);
  58556   tcase_add_test(tc_core, setVoidSmallJsonGT);
  58557   tcase_add_test(tc_core, setSmallBoolSmallJsonGT);
  58558   tcase_add_test(tc_core, setSmallBytesSmallJsonGT);
  58559   tcase_add_test(tc_core, setSmallDoubleSmallJsonGT);
  58560   tcase_add_test(tc_core, setSmallIntSmallJsonGT);
  58561   tcase_add_test(tc_core, setSmallJsonSmallJsonGT);
  58562   tcase_add_test(tc_core, setSmallStringSmallJsonGT);
  58563   tcase_add_test(tc_core, setSmallContainerSmallJsonGT);
  58564   tcase_add_test(tc_core, setNFreeSmallJsonGT);
  58565   tcase_add_test(tc_core, setNFreeUndefinedSmallJsonGT);
  58566   tcase_add_test(tc_core, setNFreeSSmallJsonGT);
  58567   tcase_add_test(tc_core, setNFreeDictSmallJsonGT);
  58568   tcase_add_test(tc_core, setNFreeArraySmallJsonGT);
  58569   tcase_add_test(tc_core, setNFreeArraycSmallJsonGT);
  58570   tcase_add_test(tc_core, setNFreeSmallBoolSmallJsonGT);
  58571   tcase_add_test(tc_core, setNFreeSmallBytesSmallJsonGT);
  58572   tcase_add_test(tc_core, setNFreeSmallDoubleSmallJsonGT);
  58573   tcase_add_test(tc_core, setNFreeSmallIntSmallJsonGT);
  58574   tcase_add_test(tc_core, setNFreeSmallJsonSmallJsonGT);
  58575   tcase_add_test(tc_core, setNFreeSmallStringSmallJsonGT);
  58576   tcase_add_test(tc_core, setNFreeSmallContainerSmallJsonGT);
  58577   tcase_add_test(tc_core, setPDictSmallJsonGT);
  58578   tcase_add_test(tc_core, setPArraySmallJsonGT);
  58579   tcase_add_test(tc_core, setPSmallJsonSmallJsonGT);
  58580   tcase_add_test(tc_core, setPSmallStringSmallJsonGT);
  58581   tcase_add_test(tc_core, setNFreePDictSmallJsonGT);
  58582   tcase_add_test(tc_core, setNFreePArraySmallJsonGT);
  58583   tcase_add_test(tc_core, setNFreePSmallJsonSmallJsonGT);
  58584   tcase_add_test(tc_core, setNFreePSmallStringSmallJsonGT);
  58585   tcase_add_test(tc_core, setAtSmallJsonGT);
  58586   tcase_add_test(tc_core, setAtUndefinedSmallJsonGT);
  58587   tcase_add_test(tc_core, setAtBoolSmallJsonGT);
  58588   tcase_add_test(tc_core, setAtDoubleSmallJsonGT);
  58589   tcase_add_test(tc_core, setAtIntSmallJsonGT);
  58590   tcase_add_test(tc_core, setAtSSmallJsonGT);
  58591   tcase_add_test(tc_core, setAtCharSmallJsonGT);
  58592   tcase_add_test(tc_core, setAtDictSmallJsonGT);
  58593   tcase_add_test(tc_core, setAtArraySmallJsonGT);
  58594   tcase_add_test(tc_core, setAtArraycSmallJsonGT);
  58595   tcase_add_test(tc_core, setAtCArraycSmallJsonGT);
  58596   tcase_add_test(tc_core, setAtVoidSmallJsonGT);
  58597   tcase_add_test(tc_core, setAtSmallBoolSmallJsonGT);
  58598   tcase_add_test(tc_core, setAtSmallBytesSmallJsonGT);
  58599   tcase_add_test(tc_core, setAtSmallDoubleSmallJsonGT);
  58600   tcase_add_test(tc_core, setAtSmallIntSmallJsonGT);
  58601   tcase_add_test(tc_core, setAtSmallJsonSmallJsonGT);
  58602   tcase_add_test(tc_core, setAtSmallStringSmallJsonGT);
  58603   tcase_add_test(tc_core, setAtSmallContainerSmallJsonGT);
  58604   tcase_add_test(tc_core, setAtNFreeSmallJsonGT);
  58605   tcase_add_test(tc_core, setAtNFreeUndefinedSmallJsonGT);
  58606   tcase_add_test(tc_core, setAtNFreeSSmallJsonGT);
  58607   tcase_add_test(tc_core, setAtNFreeDictSmallJsonGT);
  58608   tcase_add_test(tc_core, setAtNFreeArraySmallJsonGT);
  58609   tcase_add_test(tc_core, setAtNFreeArraycSmallJsonGT);
  58610   tcase_add_test(tc_core, setAtNFreeSmallBoolSmallJsonGT);
  58611   tcase_add_test(tc_core, setAtNFreeSmallBytesSmallJsonGT);
  58612   tcase_add_test(tc_core, setAtNFreeSmallDoubleSmallJsonGT);
  58613   tcase_add_test(tc_core, setAtNFreeSmallIntSmallJsonGT);
  58614   tcase_add_test(tc_core, setAtNFreeSmallJsonSmallJsonGT);
  58615   tcase_add_test(tc_core, setAtNFreeSmallStringSmallJsonGT);
  58616   tcase_add_test(tc_core, setAtNFreeSmallContainerSmallJsonGT);
  58617   tcase_add_test(tc_core, setPAtDictSmallJsonGT);
  58618   tcase_add_test(tc_core, setPAtArraySmallJsonGT);
  58619   tcase_add_test(tc_core, setPAtSmallJsonSmallJsonGT);
  58620   tcase_add_test(tc_core, setPAtSmallStringSmallJsonGT);
  58621   tcase_add_test(tc_core, setPAtNFreeDictSmallJsonGT);
  58622   tcase_add_test(tc_core, setPAtNFreeArraySmallJsonGT);
  58623   tcase_add_test(tc_core, setPAtNFreeSmallJsonSmallJsonGT);
  58624   tcase_add_test(tc_core, setPAtNFreeSmallStringSmallJsonGT);
  58625   tcase_add_test(tc_core, getSmallJsonGT);
  58626   tcase_add_test(tc_core, getUndefinedSmallJsonGT);
  58627   tcase_add_test(tc_core, getBoolSmallJsonGT);
  58628   tcase_add_test(tc_core, getBoolPSmallJsonGT);
  58629   tcase_add_test(tc_core, getDoubleSmallJsonGT);
  58630   tcase_add_test(tc_core, getDoublePSmallJsonGT);
  58631   tcase_add_test(tc_core, getIntSmallJsonGT);
  58632   tcase_add_test(tc_core, getIntPSmallJsonGT);
  58633   tcase_add_test(tc_core, getInt32SmallJsonGT);
  58634   tcase_add_test(tc_core, getInt32PSmallJsonGT);
  58635   tcase_add_test(tc_core, getUintSmallJsonGT);
  58636   tcase_add_test(tc_core, getUintPSmallJsonGT);
  58637   tcase_add_test(tc_core, getUint32SmallJsonGT);
  58638   tcase_add_test(tc_core, getUint32PSmallJsonGT);
  58639   tcase_add_test(tc_core, getSSmallJsonGT);
  58640   tcase_add_test(tc_core, getDictSmallJsonGT);
  58641   tcase_add_test(tc_core, getArraySmallJsonGT);
  58642   tcase_add_test(tc_core, getSmallBoolSmallJsonGT);
  58643   tcase_add_test(tc_core, getSmallBytesSmallJsonGT);
  58644   tcase_add_test(tc_core, getSmallDoubleSmallJsonGT);
  58645   tcase_add_test(tc_core, getSmallIntSmallJsonGT);
  58646   tcase_add_test(tc_core, getSmallJsonSmallJsonGT);
  58647   tcase_add_test(tc_core, getSmallStringSmallJsonGT);
  58648   tcase_add_test(tc_core, getVoidSmallJsonGT);
  58649   tcase_add_test(tc_core, getSmallContainerSmallJsonGT);
  58650   tcase_add_test(tc_core, getNDupSmallJsonGT);
  58651   tcase_add_test(tc_core, getNDupUndefinedSmallJsonGT);
  58652   tcase_add_test(tc_core, getNDupBoolSmallJsonGT);
  58653   tcase_add_test(tc_core, getNDupDoubleSmallJsonGT);
  58654   tcase_add_test(tc_core, getNDupIntSmallJsonGT);
  58655   tcase_add_test(tc_core, getNDupInt32SmallJsonGT);
  58656   tcase_add_test(tc_core, getNDupUintSmallJsonGT);
  58657   tcase_add_test(tc_core, getNDupUint32SmallJsonGT);
  58658   tcase_add_test(tc_core, getNDupSSmallJsonGT);
  58659   tcase_add_test(tc_core, getNDupDictSmallJsonGT);
  58660   tcase_add_test(tc_core, getNDupArraySmallJsonGT);
  58661   tcase_add_test(tc_core, getNDupSmallBoolSmallJsonGT);
  58662   tcase_add_test(tc_core, getNDupSmallBytesSmallJsonGT);
  58663   tcase_add_test(tc_core, getNDupSmallDoubleSmallJsonGT);
  58664   tcase_add_test(tc_core, getNDupSmallIntSmallJsonGT);
  58665   tcase_add_test(tc_core, getNDupSmallJsonSmallJsonGT);
  58666   tcase_add_test(tc_core, getNDupSmallStringSmallJsonGT);
  58667   tcase_add_test(tc_core, getNDupVoidSmallJsonGT);
  58668   tcase_add_test(tc_core, getNDupSmallContainerSmallJsonGT);
  58669   tcase_add_test(tc_core, getAtSmallJsonGT);
  58670   tcase_add_test(tc_core, getAtUndefinedSmallJsonGT);
  58671   tcase_add_test(tc_core, getAtBoolSmallJsonGT);
  58672   tcase_add_test(tc_core, getAtBoolPSmallJsonGT);
  58673   tcase_add_test(tc_core, getAtDoubleSmallJsonGT);
  58674   tcase_add_test(tc_core, getAtDoublePSmallJsonGT);
  58675   tcase_add_test(tc_core, getAtIntSmallJsonGT);
  58676   tcase_add_test(tc_core, getAtIntPSmallJsonGT);
  58677   tcase_add_test(tc_core, getAtInt32SmallJsonGT);
  58678   tcase_add_test(tc_core, getAtInt32PSmallJsonGT);
  58679   tcase_add_test(tc_core, getAtUintSmallJsonGT);
  58680   tcase_add_test(tc_core, getAtUintPSmallJsonGT);
  58681   tcase_add_test(tc_core, getAtUint32SmallJsonGT);
  58682   tcase_add_test(tc_core, getAtUint32PSmallJsonGT);
  58683   tcase_add_test(tc_core, getAtSSmallJsonGT);
  58684   tcase_add_test(tc_core, getAtDictSmallJsonGT);
  58685   tcase_add_test(tc_core, getAtArraySmallJsonGT);
  58686   tcase_add_test(tc_core, getAtSmallBoolSmallJsonGT);
  58687   tcase_add_test(tc_core, getAtSmallBytesSmallJsonGT);
  58688   tcase_add_test(tc_core, getAtSmallDoubleSmallJsonGT);
  58689   tcase_add_test(tc_core, getAtSmallIntSmallJsonGT);
  58690   tcase_add_test(tc_core, getAtSmallJsonSmallJsonGT);
  58691   tcase_add_test(tc_core, getAtSmallStringSmallJsonGT);
  58692   tcase_add_test(tc_core, getAtVoidSmallJsonGT);
  58693   tcase_add_test(tc_core, getAtSmallContainerSmallJsonGT);
  58694   tcase_add_test(tc_core, getAtNDupSmallJsonGT);
  58695   tcase_add_test(tc_core, getAtNDupUndefinedSmallJsonGT);
  58696   tcase_add_test(tc_core, getAtNDupBoolSmallJsonGT);
  58697   tcase_add_test(tc_core, getAtNDupDoubleSmallJsonGT);
  58698   tcase_add_test(tc_core, getAtNDupIntSmallJsonGT);
  58699   tcase_add_test(tc_core, getAtNDupInt32SmallJsonGT);
  58700   tcase_add_test(tc_core, getAtNDupUintSmallJsonGT);
  58701   tcase_add_test(tc_core, getAtNDupUint32SmallJsonGT);
  58702   tcase_add_test(tc_core, getAtNDupSSmallJsonGT);
  58703   tcase_add_test(tc_core, getAtNDupDictSmallJsonGT);
  58704   tcase_add_test(tc_core, getAtNDupArraySmallJsonGT);
  58705   tcase_add_test(tc_core, getAtNDupSmallBoolSmallJsonGT);
  58706   tcase_add_test(tc_core, getAtNDupSmallBytesSmallJsonGT);
  58707   tcase_add_test(tc_core, getAtNDupSmallDoubleSmallJsonGT);
  58708   tcase_add_test(tc_core, getAtNDupSmallIntSmallJsonGT);
  58709   tcase_add_test(tc_core, getAtNDupSmallJsonSmallJsonGT);
  58710   tcase_add_test(tc_core, getAtNDupSmallStringSmallJsonGT);
  58711   tcase_add_test(tc_core, getAtNDupVoidSmallJsonGT);
  58712   tcase_add_test(tc_core, getAtNDupSmallContainerSmallJsonGT);
  58713   tcase_add_test(tc_core, getNumSmallJsonGT);
  58714   tcase_add_test(tc_core, getNumAtSmallJsonGT);
  58715   tcase_add_test(tc_core, delKeySmallJsonGT);
  58716   tcase_add_test(tc_core, delSmallJsonGT);
  58717   tcase_add_test(tc_core, delElemSmallJsonGT);
  58718   tcase_add_test(tc_core, delElemIndexSmallJsonGT);
  58719   tcase_add_test(tc_core, prependSmallJsonGT);
  58720   tcase_add_test(tc_core, prependUndefinedSmallJsonGT);
  58721   tcase_add_test(tc_core, prependBoolSmallJsonGT);
  58722   tcase_add_test(tc_core, prependDoubleSmallJsonGT);
  58723   tcase_add_test(tc_core, prependIntSmallJsonGT);
  58724   tcase_add_test(tc_core, prependSSmallJsonGT);
  58725   tcase_add_test(tc_core, prependCharSmallJsonGT);
  58726   tcase_add_test(tc_core, prependDictSmallJsonGT);
  58727   tcase_add_test(tc_core, prependArraySmallJsonGT);
  58728   tcase_add_test(tc_core, prependArraycSmallJsonGT);
  58729   tcase_add_test(tc_core, prependCArraycSmallJsonGT);
  58730   tcase_add_test(tc_core, prependVoidSmallJsonGT);
  58731   tcase_add_test(tc_core, prependSmallBoolSmallJsonGT);
  58732   tcase_add_test(tc_core, prependSmallBytesSmallJsonGT);
  58733   tcase_add_test(tc_core, prependSmallDoubleSmallJsonGT);
  58734   tcase_add_test(tc_core, prependSmallIntSmallJsonGT);
  58735   tcase_add_test(tc_core, prependSmallJsonSmallJsonGT);
  58736   tcase_add_test(tc_core, prependSmallStringSmallJsonGT);
  58737   tcase_add_test(tc_core, prependSmallContainerSmallJsonGT);
  58738   tcase_add_test(tc_core, prependNFreeSmallJsonGT);
  58739   tcase_add_test(tc_core, prependNFreeUndefinedSmallJsonGT);
  58740   tcase_add_test(tc_core, prependNFreeSSmallJsonGT);
  58741   tcase_add_test(tc_core, prependNFreeDictSmallJsonGT);
  58742   tcase_add_test(tc_core, prependNFreeArraySmallJsonGT);
  58743   tcase_add_test(tc_core, prependNFreeArraycSmallJsonGT);
  58744   tcase_add_test(tc_core, prependNFreeSmallBoolSmallJsonGT);
  58745   tcase_add_test(tc_core, prependNFreeSmallBytesSmallJsonGT);
  58746   tcase_add_test(tc_core, prependNFreeSmallDoubleSmallJsonGT);
  58747   tcase_add_test(tc_core, prependNFreeSmallIntSmallJsonGT);
  58748   tcase_add_test(tc_core, prependNFreeSmallJsonSmallJsonGT);
  58749   tcase_add_test(tc_core, prependNFreeSmallStringSmallJsonGT);
  58750   tcase_add_test(tc_core, prependNFreeSmallContainerSmallJsonGT);
  58751   tcase_add_test(tc_core, dequeueSmallJsonGT);
  58752   tcase_add_test(tc_core, dequeueUndefinedSmallJsonGT);
  58753   tcase_add_test(tc_core, dequeueBoolSmallJsonGT);
  58754   tcase_add_test(tc_core, dequeueDoubleSmallJsonGT);
  58755   tcase_add_test(tc_core, dequeueIntSmallJsonGT);
  58756   tcase_add_test(tc_core, dequeueInt32SmallJsonGT);
  58757   tcase_add_test(tc_core, dequeueUintSmallJsonGT);
  58758   tcase_add_test(tc_core, dequeueUint32SmallJsonGT);
  58759   tcase_add_test(tc_core, dequeueSSmallJsonGT);
  58760   tcase_add_test(tc_core, dequeueDictSmallJsonGT);
  58761   tcase_add_test(tc_core, dequeueArraySmallJsonGT);
  58762   tcase_add_test(tc_core, dequeueSmallBoolSmallJsonGT);
  58763   tcase_add_test(tc_core, dequeueSmallBytesSmallJsonGT);
  58764   tcase_add_test(tc_core, dequeueSmallDoubleSmallJsonGT);
  58765   tcase_add_test(tc_core, dequeueSmallIntSmallJsonGT);
  58766   tcase_add_test(tc_core, dequeueSmallJsonSmallJsonGT);
  58767   tcase_add_test(tc_core, dequeueSmallStringSmallJsonGT);
  58768   tcase_add_test(tc_core, dequeueVoidSmallJsonGT);
  58769   tcase_add_test(tc_core, dequeueSmallContainerSmallJsonGT);
  58770   tcase_add_test(tc_core, reverseSmallJsonGT);
  58771   tcase_add_test(tc_core, mergeDictSmallJsonGT);
  58772   tcase_add_test(tc_core, mergeDictNSmashSmallJsonGT);
  58773   tcase_add_test(tc_core, mergeSmallJsonGT);
  58774   tcase_add_test(tc_core, mergeNSmashSmallJsonGT);
  58775   tcase_add_test(tc_core, appendSmallJsonGT);
  58776   tcase_add_test(tc_core, appendNSmashSmallJsonGT);
  58777   tcase_add_test(tc_core, appendArraySmallJsonGT);
  58778   tcase_add_test(tc_core, appendNSmashArraySmallJsonGT);
  58779   tcase_add_test(tc_core, appendCArraySmallJsonGT);
  58780   tcase_add_test(tc_core, shiftSmallJsonGT);
  58781   tcase_add_test(tc_core, shiftNSmashSmallJsonGT);
  58782   tcase_add_test(tc_core, shiftSmallJsonSmallJsonGT);
  58783   tcase_add_test(tc_core, shiftNSmashSmallJsonSmallJsonGT);
  58784   tcase_add_test(tc_core, addSmallJsonGT);
  58785   tcase_add_test(tc_core, addJsonSmallJsonGT);
  58786   tcase_add_test(tc_core, sliceSmallJsonGT);
  58787   tcase_add_test(tc_core, cropSmallJsonGT);
  58788   tcase_add_test(tc_core, cropSSmallJsonGT);
  58789   tcase_add_test(tc_core, cropSmallStringSmallJsonGT);
  58790   tcase_add_test(tc_core, cropElemAtSmallJsonGT);
  58791   tcase_add_test(tc_core, cropElemAtUndefinedSmallJsonGT);
  58792   tcase_add_test(tc_core, cropElemAtBoolSmallJsonGT);
  58793   tcase_add_test(tc_core, cropElemAtDoubleSmallJsonGT);
  58794   tcase_add_test(tc_core, cropElemAtIntSmallJsonGT);
  58795   tcase_add_test(tc_core, cropElemAtInt32SmallJsonGT);
  58796   tcase_add_test(tc_core, cropElemAtUintSmallJsonGT);
  58797   tcase_add_test(tc_core, cropElemAtUint32SmallJsonGT);
  58798   tcase_add_test(tc_core, cropElemAtSSmallJsonGT);
  58799   tcase_add_test(tc_core, cropElemAtCharSmallJsonGT);
  58800   tcase_add_test(tc_core, cropElemAtDictSmallJsonGT);
  58801   tcase_add_test(tc_core, cropElemAtArraySmallJsonGT);
  58802   tcase_add_test(tc_core, cropElemAtSmallBoolSmallJsonGT);
  58803   tcase_add_test(tc_core, cropElemAtSmallBytesSmallJsonGT);
  58804   tcase_add_test(tc_core, cropElemAtSmallDoubleSmallJsonGT);
  58805   tcase_add_test(tc_core, cropElemAtSmallIntSmallJsonGT);
  58806   tcase_add_test(tc_core, cropElemAtSmallJsonSmallJsonGT);
  58807   tcase_add_test(tc_core, cropElemAtSmallStringSmallJsonGT);
  58808   tcase_add_test(tc_core, cropElemAtVoidSmallJsonGT);
  58809   tcase_add_test(tc_core, cropElemAtSmallContainerSmallJsonGT);
  58810   tcase_add_test(tc_core, cropElemKeySmallJsonGT);
  58811   tcase_add_test(tc_core, cropElemKeyUndefinedSmallJsonGT);
  58812   tcase_add_test(tc_core, cropElemKeyBoolSmallJsonGT);
  58813   tcase_add_test(tc_core, cropElemKeyDoubleSmallJsonGT);
  58814   tcase_add_test(tc_core, cropElemKeyIntSmallJsonGT);
  58815   tcase_add_test(tc_core, cropElemKeyInt32SmallJsonGT);
  58816   tcase_add_test(tc_core, cropElemKeyUintSmallJsonGT);
  58817   tcase_add_test(tc_core, cropElemKeyUint32SmallJsonGT);
  58818   tcase_add_test(tc_core, cropElemKeySSmallJsonGT);
  58819   tcase_add_test(tc_core, cropElemKeyDictSmallJsonGT);
  58820   tcase_add_test(tc_core, cropElemKeyArraySmallJsonGT);
  58821   tcase_add_test(tc_core, cropElemKeySmallBoolSmallJsonGT);
  58822   tcase_add_test(tc_core, cropElemKeySmallBytesSmallJsonGT);
  58823   tcase_add_test(tc_core, cropElemKeySmallDoubleSmallJsonGT);
  58824   tcase_add_test(tc_core, cropElemKeySmallIntSmallJsonGT);
  58825   tcase_add_test(tc_core, cropElemKeySmallJsonSmallJsonGT);
  58826   tcase_add_test(tc_core, cropElemKeySmallStringSmallJsonGT);
  58827   tcase_add_test(tc_core, cropElemKeyVoidSmallJsonGT);
  58828   tcase_add_test(tc_core, cropElemKeySmallContainerSmallJsonGT);
  58829   tcase_add_test(tc_core, copySmallJsonGT);
  58830   tcase_add_test(tc_core, insertSmallJsonGT);
  58831   tcase_add_test(tc_core, insertNSmashSmallJsonGT);
  58832   tcase_add_test(tc_core, insertSmallJsonSmallJsonGT);
  58833   tcase_add_test(tc_core, insertNSmashSmallJsonSmallJsonGT);
  58834   tcase_add_test(tc_core, insertStringSmallJsonGT);
  58835   tcase_add_test(tc_core, insertSSmallJsonGT);
  58836   tcase_add_test(tc_core, insertNFreeSmallJsonGT);
  58837   tcase_add_test(tc_core, insertSNFreeStringSmallJsonGT);
  58838   tcase_add_test(tc_core, injectSmallJsonGT);
  58839   tcase_add_test(tc_core, injectUndefinedSmallJsonGT);
  58840   tcase_add_test(tc_core, injectBoolSmallJsonGT);
  58841   tcase_add_test(tc_core, injectDoubleSmallJsonGT);
  58842   tcase_add_test(tc_core, injectIntSmallJsonGT);
  58843   tcase_add_test(tc_core, injectSSmallJsonGT);
  58844   tcase_add_test(tc_core, injectCharSmallJsonGT);
  58845   tcase_add_test(tc_core, injectDictSmallJsonGT);
  58846   tcase_add_test(tc_core, injectArraySmallJsonGT);
  58847   tcase_add_test(tc_core, injectArraycSmallJsonGT);
  58848   tcase_add_test(tc_core, injectCArraycSmallJsonGT);
  58849   tcase_add_test(tc_core, injectVoidSmallJsonGT);
  58850   tcase_add_test(tc_core, injectSmallBoolSmallJsonGT);
  58851   tcase_add_test(tc_core, injectSmallBytesSmallJsonGT);
  58852   tcase_add_test(tc_core, injectSmallDoubleSmallJsonGT);
  58853   tcase_add_test(tc_core, injectSmallIntSmallJsonGT);
  58854   tcase_add_test(tc_core, injectSmallJsonSmallJsonGT);
  58855   tcase_add_test(tc_core, injectSmallStringSmallJsonGT);
  58856   tcase_add_test(tc_core, injectSmallContainerSmallJsonGT);
  58857   tcase_add_test(tc_core, injectNFreeSmallJsonGT);
  58858   tcase_add_test(tc_core, injectNFreeUndefinedSmallJsonGT);
  58859   tcase_add_test(tc_core, injectNFreeSSmallJsonGT);
  58860   tcase_add_test(tc_core, injectNFreeDictSmallJsonGT);
  58861   tcase_add_test(tc_core, injectNFreeArraySmallJsonGT);
  58862   tcase_add_test(tc_core, injectNFreeArraycSmallJsonGT);
  58863   tcase_add_test(tc_core, injectNFreeSmallBoolSmallJsonGT);
  58864   tcase_add_test(tc_core, injectNFreeSmallBytesSmallJsonGT);
  58865   tcase_add_test(tc_core, injectNFreeSmallDoubleSmallJsonGT);
  58866   tcase_add_test(tc_core, injectNFreeSmallIntSmallJsonGT);
  58867   tcase_add_test(tc_core, injectNFreeSmallJsonSmallJsonGT);
  58868   tcase_add_test(tc_core, injectNFreeSmallStringSmallJsonGT);
  58869   tcase_add_test(tc_core, injectNFreeSmallContainerSmallJsonGT);
  58870   tcase_add_test(tc_core, uniqSmallJsonGT);
  58871   tcase_add_test(tc_core, sortSmallJsonGT);
  58872   tcase_add_test(tc_core, sortFSmallJsonGT);
  58873   tcase_add_test(tc_core, icSortSmallJsonGT);
  58874   tcase_add_test(tc_core, icUniqSmallJsonGT);
  58875   tcase_add_test(tc_core, hasSmallJsonGT);
  58876   tcase_add_test(tc_core, hasUndefinedSmallJsonGT);
  58877   tcase_add_test(tc_core, hasBoolSmallJsonGT);
  58878   tcase_add_test(tc_core, hasDoubleSmallJsonGT);
  58879   tcase_add_test(tc_core, hasIntSmallJsonGT);
  58880   tcase_add_test(tc_core, hasSSmallJsonGT);
  58881   tcase_add_test(tc_core, hasCharSmallJsonGT);
  58882   tcase_add_test(tc_core, hasDictSmallJsonGT);
  58883   tcase_add_test(tc_core, hasArraySmallJsonGT);
  58884   tcase_add_test(tc_core, hasArraycSmallJsonGT);
  58885   tcase_add_test(tc_core, hasCArraycSmallJsonGT);
  58886   tcase_add_test(tc_core, hasSmallBoolSmallJsonGT);
  58887   tcase_add_test(tc_core, hasSmallBytesSmallJsonGT);
  58888   tcase_add_test(tc_core, hasSmallDoubleSmallJsonGT);
  58889   tcase_add_test(tc_core, hasSmallIntSmallJsonGT);
  58890   tcase_add_test(tc_core, hasSmallJsonSmallJsonGT);
  58891   tcase_add_test(tc_core, hasSmallStringSmallJsonGT);
  58892   tcase_add_test(tc_core, hasSmallContainerSmallJsonGT);
  58893   tcase_add_test(tc_core, findSmallJsonGT);
  58894   tcase_add_test(tc_core, findCharSmallJsonGT);
  58895   tcase_add_test(tc_core, findSmallStringSmallJsonGT);
  58896   tcase_add_test(tc_core, findJsonSmallJsonGT);
  58897   tcase_add_test(tc_core, indexOfSmallJsonGT);
  58898   tcase_add_test(tc_core, indexOfUndefinedSmallJsonGT);
  58899   tcase_add_test(tc_core, indexOfBoolSmallJsonGT);
  58900   tcase_add_test(tc_core, indexOfDoubleSmallJsonGT);
  58901   tcase_add_test(tc_core, indexOfIntSmallJsonGT);
  58902   tcase_add_test(tc_core, indexOfSSmallJsonGT);
  58903   tcase_add_test(tc_core, indexOfCharSmallJsonGT);
  58904   tcase_add_test(tc_core, indexOfDictSmallJsonGT);
  58905   tcase_add_test(tc_core, indexOfArraySmallJsonGT);
  58906   tcase_add_test(tc_core, indexOfArraycSmallJsonGT);
  58907   tcase_add_test(tc_core, indexOfCArraycSmallJsonGT);
  58908   tcase_add_test(tc_core, indexOfSmallBoolSmallJsonGT);
  58909   tcase_add_test(tc_core, indexOfSmallBytesSmallJsonGT);
  58910   tcase_add_test(tc_core, indexOfSmallDoubleSmallJsonGT);
  58911   tcase_add_test(tc_core, indexOfSmallIntSmallJsonGT);
  58912   tcase_add_test(tc_core, indexOfSmallJsonSmallJsonGT);
  58913   tcase_add_test(tc_core, indexOfSmallStringSmallJsonGT);
  58914   tcase_add_test(tc_core, indexOfSmallContainerSmallJsonGT);
  58915   tcase_add_test(tc_core, binarySearchSmallJsonGT);
  58916   tcase_add_test(tc_core, binarySearchUndefinedSmallJsonGT);
  58917   tcase_add_test(tc_core, binarySearchBoolSmallJsonGT);
  58918   tcase_add_test(tc_core, binarySearchDoubleSmallJsonGT);
  58919   tcase_add_test(tc_core, binarySearchIntSmallJsonGT);
  58920   tcase_add_test(tc_core, binarySearchSSmallJsonGT);
  58921   tcase_add_test(tc_core, binarySearchCharSmallJsonGT);
  58922   tcase_add_test(tc_core, binarySearchDictSmallJsonGT);
  58923   tcase_add_test(tc_core, binarySearchArraySmallJsonGT);
  58924   tcase_add_test(tc_core, binarySearchArraycSmallJsonGT);
  58925   tcase_add_test(tc_core, binarySearchCArraycSmallJsonGT);
  58926   tcase_add_test(tc_core, binarySearchSmallBoolSmallJsonGT);
  58927   tcase_add_test(tc_core, binarySearchSmallBytesSmallJsonGT);
  58928   tcase_add_test(tc_core, binarySearchSmallDoubleSmallJsonGT);
  58929   tcase_add_test(tc_core, binarySearchSmallIntSmallJsonGT);
  58930   tcase_add_test(tc_core, binarySearchSmallJsonSmallJsonGT);
  58931   tcase_add_test(tc_core, binarySearchSmallStringSmallJsonGT);
  58932   tcase_add_test(tc_core, binarySearchSmallContainerSmallJsonGT);
  58933   tcase_add_test(tc_core, icHasSmallJsonGT);
  58934   tcase_add_test(tc_core, icHasSSmallJsonGT);
  58935   tcase_add_test(tc_core, icHasCharSmallJsonGT);
  58936   tcase_add_test(tc_core, icHasDictSmallJsonGT);
  58937   tcase_add_test(tc_core, icHasArraySmallJsonGT);
  58938   tcase_add_test(tc_core, icHasArraycSmallJsonGT);
  58939   tcase_add_test(tc_core, icHasCArraycSmallJsonGT);
  58940   tcase_add_test(tc_core, icHasSmallStringSmallJsonGT);
  58941   tcase_add_test(tc_core, icFindSmallJsonGT);
  58942   tcase_add_test(tc_core, icFindCharSmallJsonGT);
  58943   tcase_add_test(tc_core, icFindSmallStringSmallJsonGT);
  58944   tcase_add_test(tc_core, icFindJsonSmallJsonGT);
  58945   tcase_add_test(tc_core, icIndexOfSmallJsonGT);
  58946   tcase_add_test(tc_core, icIndexOfSSmallJsonGT);
  58947   tcase_add_test(tc_core, icIndexOfCharSmallJsonGT);
  58948   tcase_add_test(tc_core, icIndexOfDictSmallJsonGT);
  58949   tcase_add_test(tc_core, icIndexOfArraySmallJsonGT);
  58950   tcase_add_test(tc_core, icIndexOfArraycSmallJsonGT);
  58951   tcase_add_test(tc_core, icIndexOfCArraycSmallJsonGT);
  58952   tcase_add_test(tc_core, icIndexOfSmallStringSmallJsonGT);
  58953   tcase_add_test(tc_core, icBinarySearchSmallJsonGT);
  58954   tcase_add_test(tc_core, icBinarySearchSSmallJsonGT);
  58955   tcase_add_test(tc_core, icBinarySearchCharSmallJsonGT);
  58956   tcase_add_test(tc_core, icBinarySearchDictSmallJsonGT);
  58957   tcase_add_test(tc_core, icBinarySearchArraySmallJsonGT);
  58958   tcase_add_test(tc_core, icBinarySearchArraycSmallJsonGT);
  58959   tcase_add_test(tc_core, icBinarySearchCArraycSmallJsonGT);
  58960   tcase_add_test(tc_core, icBinarySearchSmallStringSmallJsonGT);
  58961   tcase_add_test(tc_core, keyBySmallJsonGT);
  58962   tcase_add_test(tc_core, keyByUndefinedSmallJsonGT);
  58963   tcase_add_test(tc_core, keyByBoolSmallJsonGT);
  58964   tcase_add_test(tc_core, keyByDoubleSmallJsonGT);
  58965   tcase_add_test(tc_core, keyByIntSmallJsonGT);
  58966   tcase_add_test(tc_core, keyBySSmallJsonGT);
  58967   tcase_add_test(tc_core, keyByCharSmallJsonGT);
  58968   tcase_add_test(tc_core, keyByDictSmallJsonGT);
  58969   tcase_add_test(tc_core, keyByArraySmallJsonGT);
  58970   tcase_add_test(tc_core, keyByArraycSmallJsonGT);
  58971   tcase_add_test(tc_core, keyByCArraycSmallJsonGT);
  58972   tcase_add_test(tc_core, keyBySmallBoolSmallJsonGT);
  58973   tcase_add_test(tc_core, keyBySmallBytesSmallJsonGT);
  58974   tcase_add_test(tc_core, keyBySmallDoubleSmallJsonGT);
  58975   tcase_add_test(tc_core, keyBySmallIntSmallJsonGT);
  58976   tcase_add_test(tc_core, keyBySmallJsonSmallJsonGT);
  58977   tcase_add_test(tc_core, keyBySmallStringSmallJsonGT);
  58978   tcase_add_test(tc_core, keyBySmallContainerSmallJsonGT);
  58979   tcase_add_test(tc_core, icKeyBySmallJsonGT);
  58980   tcase_add_test(tc_core, icKeyBySSmallJsonGT);
  58981   tcase_add_test(tc_core, icKeyByCharSmallJsonGT);
  58982   tcase_add_test(tc_core, icKeyByDictSmallJsonGT);
  58983   tcase_add_test(tc_core, icKeyByArraySmallJsonGT);
  58984   tcase_add_test(tc_core, icKeyByArraycSmallJsonGT);
  58985   tcase_add_test(tc_core, icKeyByCArraycSmallJsonGT);
  58986   tcase_add_test(tc_core, icKeyBySmallStringSmallJsonGT);
  58987   tcase_add_test(tc_core, replaceSmallJsonGT);
  58988   tcase_add_test(tc_core, replaceCharSSmallJsonGT);
  58989   tcase_add_test(tc_core, replaceSCharSmallJsonGT);
  58990   tcase_add_test(tc_core, replaceCharCharSmallJsonGT);
  58991   tcase_add_test(tc_core, replaceSmallStringSmallStringSmallJsonGT);
  58992   tcase_add_test(tc_core, replaceSmallStringSSmallJsonGT);
  58993   tcase_add_test(tc_core, replaceSmallStringCharSmallJsonGT);
  58994   tcase_add_test(tc_core, replaceSSmallStringSmallJsonGT);
  58995   tcase_add_test(tc_core, replaceCharSmallStringSmallJsonGT);
  58996   tcase_add_test(tc_core, replaceJsonJsonSmallJsonGT);
  58997   tcase_add_test(tc_core, replaceJsonSmallStringSmallJsonGT);
  58998   tcase_add_test(tc_core, replaceJsonSSmallJsonGT);
  58999   tcase_add_test(tc_core, replaceJsonCharSmallJsonGT);
  59000   tcase_add_test(tc_core, replaceSmallStringJsonSmallJsonGT);
  59001   tcase_add_test(tc_core, replaceSJsonSmallJsonGT);
  59002   tcase_add_test(tc_core, replaceCharJsonSmallJsonGT);
  59003   tcase_add_test(tc_core, icReplaceSmallJsonGT);
  59004   tcase_add_test(tc_core, icReplaceCharSSmallJsonGT);
  59005   tcase_add_test(tc_core, icReplaceSCharSmallJsonGT);
  59006   tcase_add_test(tc_core, icReplaceCharCharSmallJsonGT);
  59007   tcase_add_test(tc_core, icReplaceSmallStringSmallStringSmallJsonGT);
  59008   tcase_add_test(tc_core, icReplaceSmallStringSSmallJsonGT);
  59009   tcase_add_test(tc_core, icReplaceSmallStringCharSmallJsonGT);
  59010   tcase_add_test(tc_core, icReplaceSSmallStringSmallJsonGT);
  59011   tcase_add_test(tc_core, icReplaceCharSmallStringSmallJsonGT);
  59012   tcase_add_test(tc_core, icReplaceJsonJsonSmallJsonGT);
  59013   tcase_add_test(tc_core, icReplaceJsonSmallStringSmallJsonGT);
  59014   tcase_add_test(tc_core, icReplaceJsonSSmallJsonGT);
  59015   tcase_add_test(tc_core, icReplaceJsonCharSmallJsonGT);
  59016   tcase_add_test(tc_core, icReplaceSmallStringJsonSmallJsonGT);
  59017   tcase_add_test(tc_core, icReplaceSJsonSmallJsonGT);
  59018   tcase_add_test(tc_core, icReplaceCharJsonSmallJsonGT);
  59019   tcase_add_test(tc_core, equalSmallJsonSmallArrayGT);
  59020   tcase_add_test(tc_core, equalSmallJsonArrayGT);
  59021   tcase_add_test(tc_core, equalSmallJsonCArrayGT);
  59022   tcase_add_test(tc_core, equalSmallJsonBaseGT);
  59023   tcase_add_test(tc_core, equalSmallJsonChaGT);
  59024   tcase_add_test(tc_core, equalSmallJsonCharGT);
  59025   tcase_add_test(tc_core, equalSmallJsonBoolGT);
  59026   tcase_add_test(tc_core, equalSmallJsonDoubleGT);
  59027   tcase_add_test(tc_core, equalSmallJsonInt64GT);
  59028   tcase_add_test(tc_core, equalSmallJsonInt32GT);
  59029   tcase_add_test(tc_core, equalSmallJsonUint32GT);
  59030   tcase_add_test(tc_core, equalSmallJsonUint64GT);
  59031   tcase_add_test(tc_core, equalSmallJsonSmallBoolGT);
  59032   tcase_add_test(tc_core, equalSmallJsonSmallBytesGT);
  59033   tcase_add_test(tc_core, equalSmallJsonSmallDoubleGT);
  59034   tcase_add_test(tc_core, equalSmallJsonSmallIntGT);
  59035   tcase_add_test(tc_core, equalSmallJsonSmallJsonGT);
  59036   tcase_add_test(tc_core, equalSmallJsonSmallStringGT);
  59037   tcase_add_test(tc_core, equalSmallJsonSmallDictGT);
  59038   tcase_add_test(tc_core, icEqualSmallJsonSmallArrayGT);
  59039   tcase_add_test(tc_core, icEqualSmallJsonArrayGT);
  59040   tcase_add_test(tc_core, icEqualSmallJsonCArrayGT);
  59041   tcase_add_test(tc_core, icEqualSmallJsonBaseGT);
  59042   tcase_add_test(tc_core, icEqualSmallJsonSmallDictGT);
  59043   tcase_add_test(tc_core, icEqualSmallJsonSmallJsonGT);
  59044   tcase_add_test(tc_core, icEqualSmallJsonSmallStringGT);
  59045   tcase_add_test(tc_core, icEqualCharSmallJsonGT);
  59046   tcase_add_test(tc_core, icEqualSSmallJsonGT);
  59047   tcase_add_test(tc_core, equalISSmallJsonGT);
  59048   tcase_add_test(tc_core, equalICharSmallJsonGT);
  59049   tcase_add_test(tc_core, equalIJsonSmallJsonGT);
  59050   tcase_add_test(tc_core, equalISmallStringSmallJsonGT);
  59051   tcase_add_test(tc_core, startsWithSSmallJsonGT);
  59052   tcase_add_test(tc_core, startsWithCharSmallJsonGT);
  59053   tcase_add_test(tc_core, startsWithSmallStringSmallJsonGT);
  59054   tcase_add_test(tc_core, startsWithJsonSmallJsonGT);
  59055   tcase_add_test(tc_core, endsWithSSmallJsonGT);
  59056   tcase_add_test(tc_core, endsWithCharSmallJsonGT);
  59057   tcase_add_test(tc_core, endsWithSmallStringSmallJsonGT);
  59058   tcase_add_test(tc_core, endsWithJsonSmallJsonGT);
  59059   tcase_add_test(tc_core, countSSmallJsonGT);
  59060   tcase_add_test(tc_core, countCharSmallJsonGT);
  59061   tcase_add_test(tc_core, countSmallStringSmallJsonGT);
  59062   tcase_add_test(tc_core, countJsonSmallJsonGT);
  59063   tcase_add_test(tc_core, icStartsWithSSmallJsonGT);
  59064   tcase_add_test(tc_core, icStartsWithCharSmallJsonGT);
  59065   tcase_add_test(tc_core, icStartsWithSmallStringSmallJsonGT);
  59066   tcase_add_test(tc_core, icStartsWithJsonSmallJsonGT);
  59067   tcase_add_test(tc_core, icEndsWithSSmallJsonGT);
  59068   tcase_add_test(tc_core, icEndsWithCharSmallJsonGT);
  59069   tcase_add_test(tc_core, icEndsWithSmallStringSmallJsonGT);
  59070   tcase_add_test(tc_core, icEndsWithJsonSmallJsonGT);
  59071   tcase_add_test(tc_core, icCountSSmallJsonGT);
  59072   tcase_add_test(tc_core, icCountCharSmallJsonGT);
  59073   tcase_add_test(tc_core, icCountSmallStringSmallJsonGT);
  59074   tcase_add_test(tc_core, icCountJsonSmallJsonGT);
  59075   tcase_add_test(tc_core, isNumberSmallJsonGT);
  59076   tcase_add_test(tc_core, isIntSmallJsonGT);
  59077   tcase_add_test(tc_core, parseIntSmallJsonGT);
  59078   tcase_add_test(tc_core, parseDoubleSmallJsonGT);
  59079   tcase_add_test(tc_core, intToSmallJsonGT);
  59080   tcase_add_test(tc_core, doubleToSmallJsonGT);
  59081   tcase_add_test(tc_core, lenSmallJsonGT);
  59082   tcase_add_test(tc_core, upperSmallJsonGT);
  59083   tcase_add_test(tc_core, lowerSmallJsonGT);
  59084   tcase_add_test(tc_core, trimSmallJsonGT);
  59085   tcase_add_test(tc_core, lTrimSmallJsonGT);
  59086   tcase_add_test(tc_core, rTrimSmallJsonGT);
  59087   tcase_add_test(tc_core, compactSmallJsonGT);
  59088   tcase_add_test(tc_core, emptySmallJsonGT);
  59089   tcase_add_test(tc_core, isEmptySmallJsonGT);
  59090   tcase_add_test(tc_core, isBlankSmallJsonGT);
  59091   tcase_add_test(tc_core, joinSmallJsonGT);
  59092   tcase_add_test(tc_core, joinCharSmallJsonGT);
  59093   tcase_add_test(tc_core, joinSmallJsonSmallJsonGT);
  59094   tcase_add_test(tc_core, joinSmallStringSmallJsonGT);
  59095   tcase_add_test(tc_core, joinSSmallJsonGT);
  59096   tcase_add_test(tc_core, joinCharSSmallJsonGT);
  59097   tcase_add_test(tc_core, joinSmallJsonSSmallJsonGT);
  59098   tcase_add_test(tc_core, joinSmallStringSSmallJsonGT);
  59099   tcase_add_test(tc_core, splitSmallJsonGT);
  59100   tcase_add_test(tc_core, splitCharSmallJsonGT);
  59101   tcase_add_test(tc_core, splitSmallJsonSmallJsonGT);
  59102   tcase_add_test(tc_core, splitSmallStringSmallJsonGT);
  59103   tcase_add_test(tc_core, splitSSmallJsonGT);
  59104   tcase_add_test(tc_core, splitCharSSmallJsonGT);
  59105   tcase_add_test(tc_core, splitSmallJsonSSmallJsonGT);
  59106   tcase_add_test(tc_core, splitSmallStringSSmallJsonGT);
  59107   tcase_add_test(tc_core, extractSmallJsonGT);
  59108   tcase_add_test(tc_core, extractCharSSmallJsonGT);
  59109   tcase_add_test(tc_core, extractSCharSmallJsonGT);
  59110   tcase_add_test(tc_core, extractCharCharSmallJsonGT);
  59111   tcase_add_test(tc_core, extractSmallJsonSmallJsonSmallJsonGT);
  59112   tcase_add_test(tc_core, extractSmallJsonSmallStringSmallJsonGT);
  59113   tcase_add_test(tc_core, extractSmallJsonSSmallJsonGT);
  59114   tcase_add_test(tc_core, extractSmallJsonCharSmallJsonGT);
  59115   tcase_add_test(tc_core, extractSmallStringSmallJsonSmallJsonGT);
  59116   tcase_add_test(tc_core, extractSmallStringSmallStringSmallJsonGT);
  59117   tcase_add_test(tc_core, extractSmallStringSSmallJsonGT);
  59118   tcase_add_test(tc_core, extractSmallStringCharSmallJsonGT);
  59119   tcase_add_test(tc_core, extractSSmallJsonSmallJsonGT);
  59120   tcase_add_test(tc_core, extractSSmallStringSmallJsonGT);
  59121   tcase_add_test(tc_core, extractCharSmallJsonSmallJsonGT);
  59122   tcase_add_test(tc_core, extractCharSmallStringSmallJsonGT);
  59123   tcase_add_test(tc_core, icSplitSmallJsonGT);
  59124   tcase_add_test(tc_core, icSplitCharSmallJsonGT);
  59125   tcase_add_test(tc_core, icSplitSmallJsonSmallJsonGT);
  59126   tcase_add_test(tc_core, icSplitSmallStringSmallJsonGT);
  59127   tcase_add_test(tc_core, icSplitSSmallJsonGT);
  59128   tcase_add_test(tc_core, icSplitCharSSmallJsonGT);
  59129   tcase_add_test(tc_core, icSplitSmallJsonSSmallJsonGT);
  59130   tcase_add_test(tc_core, icSplitSmallStringSSmallJsonGT);
  59131   tcase_add_test(tc_core, icExtractSmallJsonGT);
  59132   tcase_add_test(tc_core, icExtractCharSSmallJsonGT);
  59133   tcase_add_test(tc_core, icExtractSCharSmallJsonGT);
  59134   tcase_add_test(tc_core, icExtractCharCharSmallJsonGT);
  59135   tcase_add_test(tc_core, icExtractSmallJsonSmallJsonSmallJsonGT);
  59136   tcase_add_test(tc_core, icExtractSmallJsonSmallStringSmallJsonGT);
  59137   tcase_add_test(tc_core, icExtractSmallJsonSSmallJsonGT);
  59138   tcase_add_test(tc_core, icExtractSmallJsonCharSmallJsonGT);
  59139   tcase_add_test(tc_core, icExtractSmallStringSmallJsonSmallJsonGT);
  59140   tcase_add_test(tc_core, icExtractSmallStringSmallStringSmallJsonGT);
  59141   tcase_add_test(tc_core, icExtractSmallStringSSmallJsonGT);
  59142   tcase_add_test(tc_core, icExtractSmallStringCharSmallJsonGT);
  59143   tcase_add_test(tc_core, icExtractSSmallJsonSmallJsonGT);
  59144   tcase_add_test(tc_core, icExtractSSmallStringSmallJsonGT);
  59145   tcase_add_test(tc_core, icExtractCharSmallJsonSmallJsonGT);
  59146   tcase_add_test(tc_core, icExtractCharSmallStringSmallJsonGT);
  59147   tcase_add_test(tc_core, zipSmallJsonGT);
  59148   tcase_add_test(tc_core, zipArraySmallJsonGT);
  59149   tcase_add_test(tc_core, zipCArraySmallJsonGT);
  59150   tcase_add_test(tc_core, zipCharSmallJsonGT);
  59151   tcase_add_test(tc_core, zipCCharSmallJsonGT);
  59152   tcase_add_test(tc_core, zipArrayCharSmallJsonGT);
  59153   tcase_add_test(tc_core, zipArrayCCharSmallJsonGT);
  59154   tcase_add_test(tc_core, zipCArrayCharSmallJsonGT);
  59155   tcase_add_test(tc_core, zipCArrayCCharSmallJsonGT);
  59156   tcase_add_test(tc_core, zipJsonSmallJsonGT);
  59157   tcase_add_test(tc_core, zipJsonSmallArraySmallJsonGT);
  59158   tcase_add_test(tc_core, zipJsonArraySmallJsonGT);
  59159   tcase_add_test(tc_core, zipJsonCArraySmallJsonGT);
  59160   tcase_add_test(tc_core, zipSmallArrayJsonSmallJsonGT);
  59161   tcase_add_test(tc_core, zipArrayJsonSmallJsonGT);
  59162   tcase_add_test(tc_core, zipCArrayJsonSmallJsonGT);
  59163   tcase_add_test(tc_core, stringifySmallStringSmallJsonGT);
  59164   tcase_add_test(tc_core, toYMLSmallStringSmallJsonGT);
  59165   tcase_add_test(tc_core, parseSmallJsonGT);
  59166   tcase_add_test(tc_core, parseSmallJsonSmallJsonGT);
  59167   tcase_add_test(tc_core, parseSmallStringSmallJsonGT);
  59168   tcase_add_test(tc_core, parseYMLSmallJsonGT);
  59169   tcase_add_test(tc_core, parseYMLSmallJsonSmallJsonGT);
  59170   tcase_add_test(tc_core, parseYMLSmallStringSmallJsonGT);
  59171   tcase_add_test(tc_core, logSmallJsonGT);
  59172   tcase_add_test(tc_core, readFileSmallJsonGT);
  59173   tcase_add_test(tc_core, readFileSmallStringSmallJsonGT);
  59174   tcase_add_test(tc_core, readFileJsonSmallJsonGT);
  59175   tcase_add_test(tc_core, readStreamSmallJsonGT);
  59176   tcase_add_test(tc_core, writeFileSmallJsonGT);
  59177   tcase_add_test(tc_core, writeFileSmallStringSmallJsonGT);
  59178   tcase_add_test(tc_core, writeFileJsonSmallJsonGT);
  59179   tcase_add_test(tc_core, writeStreamSmallJsonGT);
  59180   tcase_add_test(tc_core, appendFileSmallJsonGT);
  59181   tcase_add_test(tc_core, appendFileSmallStringSmallJsonGT);
  59182   tcase_add_test(tc_core, appendFileJsonSmallJsonGT);
  59183   tcase_add_test(tc_core, readTextSmallJsonGT);
  59184   tcase_add_test(tc_core, readTextSmallStringSmallJsonGT);
  59185   tcase_add_test(tc_core, readTextJsonSmallJsonGT);
  59186   tcase_add_test(tc_core, readTextStreamSmallJsonGT);
  59187   tcase_add_test(tc_core, writeTextSmallJsonGT);
  59188   tcase_add_test(tc_core, writeTextSmallStringSmallJsonGT);
  59189   tcase_add_test(tc_core, writeTextJsonSmallJsonGT);
  59190   tcase_add_test(tc_core, writeTextStreamSmallJsonGT);
  59191   tcase_add_test(tc_core, appendTextSmallStringSmallJsonGT);
  59192   tcase_add_test(tc_core, appendTextJsonSmallJsonGT);
  59193   tcase_add_test(tc_core, cSmallJsonT);
  59194 
  59195   suite_add_tcase(s, tc_core);
  59196 
  59197   return s;
  59198 }
  59199 
  59200 int main(int ARGC UNUSED, char** ARGV UNUSED) {
  59201   int number_failed;
  59202   Suite *s;
  59203   SRunner *sr;
  59204 
  59205   s = libsheepySuite();
  59206   sr = srunner_create(s);
  59207 
  59208   srunner_run_all(sr, CK_NORMAL);
  59209   number_failed = srunner_ntests_failed(sr);
  59210   srunner_free(sr);
  59211 
  59212   exit((number_failed == 0) ? EXIT_SUCCESS : EXIT_FAILURE);
  59213 }
  59214 // vim: set expandtab ts=2 sw=2: